read.markets/app/static/css/portfolio.css
Giorgio Gilestro 736d161990 ui: portfolio actions row + AI analysis regenerate
Two small UX changes to the portfolio panel:

1. "Forget this pie" is destructive enough to belong in edit-mode
   only. The button now hides by default and only surfaces when the
   #portfolio-panel.pf-editing class is on the panel (same surface
   that already shows per-row × and the add-position form). The
   element stays in the DOM so the existing click handler keeps
   working without re-mount.

2. "Generate AI analysis" disappears once an analysis exists. In its
   place a small "Regenerate" button is rendered inside the
   collapsible analysis box — in the summary header, right-aligned
   next to the timestamp. The button stops the summary's default
   toggle action so a click regenerates without collapsing the
   panel. runAnalysis() now tolerates either pf-analyze or pf-regen
   as the trigger, and showAnalysis() takes an optional
   onRegenerate callback so callers can wire the button to the
   current pie/enriched closure context. Re-hydration after the
   60s portfolio refresh passes the same callback so the button
   survives a refresh cycle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 15:04:08 +02:00

431 lines
12 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Cassandra — portfolio panel styles: overall stats, actions, inline edit
* mode (add composer, delete rows), analysis accordion. */
/* --- Portfolio overall ----------------------------------------------- */
.pf-overall {
border-bottom: 1px solid var(--border);
padding: 10px 14px 12px;
background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.pf-overall__head {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 8px;
}
.pf-name {
color: var(--accent);
text-transform: uppercase;
letter-spacing: 0.1em;
font-weight: 700;
font-size: 11px;
}
.pf-name::before { content: "◆ "; opacity: 0.6; }
.pf-as-of { color: var(--dim); font-size: 11px; }
.pf-overall__grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px 24px;
}
@media (max-width: 640px) {
.pf-overall__grid { grid-template-columns: repeat(2, 1fr); }
}
.pf-stat-label {
font-size: 10px;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.08em;
}
.pf-stat-value {
font-size: 16px;
color: var(--text);
font-variant-numeric: tabular-nums;
margin-top: 2px;
}
.pf-stat-value.pos { color: var(--positive); }
.pf-stat-value.neg { color: var(--negative); }
.pf-stat-value.neu { color: var(--muted); }
.pf-ccy { color: var(--dim); font-size: 11px; margin-left: 2px; }
.pf-pct { color: var(--dim); font-size: 11px; margin-left: 4px; }
.pf-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pf-pill {
font-size: 10.5px;
font-family: var(--font-mono);
color: var(--muted);
background: var(--surface-2);
border: 1px solid var(--border);
padding: 2px 6px;
letter-spacing: 0.04em;
}
.pf-warn {
border-left: 3px solid var(--alert);
background: color-mix(in srgb, var(--alert) 6%, transparent);
color: var(--alert);
padding: 8px 10px;
font-size: 12px;
margin: 10px 0;
}
.pf-actions {
display: flex;
gap: 8px;
margin-top: 12px;
}
.pf-actions button {
font-family: var(--font-mono);
font-size: 11px;
letter-spacing: 0.06em;
text-transform: uppercase;
background: var(--surface-2);
color: var(--accent);
border: 1px solid var(--border);
padding: 7px 14px;
cursor: pointer;
}
.pf-actions button:hover { border-color: var(--accent); }
.pf-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.pf-secondary { color: var(--muted); }
.pf-secondary:hover { color: var(--negative); border-color: var(--negative); }
/* "Forget this pie" is destructive — only show it while the user is
in edit mode (the same mode that surfaces the per-row delete × and
the add-position form). Outside of edit mode the row stays in the
DOM so existing handlers and any future surface that wants to
toggle it can do so without re-rendering. */
#pf-forget { display: none; }
#portfolio-panel.pf-editing #pf-forget { display: inline-block; }
.pf-analysis {
margin-top: 14px;
background: var(--surface-2);
border: 1px solid var(--border);
}
.pf-analysis__details { padding: 0; }
.pf-analysis__head {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
color: var(--muted);
letter-spacing: 0.06em;
text-transform: uppercase;
padding: 10px 16px;
cursor: pointer;
user-select: none;
list-style: none; /* hide native marker in Firefox */
}
.pf-analysis__head::-webkit-details-marker { display: none; }
.pf-analysis__head-right {
display: inline-flex;
align-items: center;
gap: 12px;
}
.pf-regen {
background: transparent;
border: 1px solid var(--border);
color: var(--muted);
padding: 3px 9px;
font: inherit;
font-size: 10.5px;
letter-spacing: inherit;
cursor: pointer;
text-transform: inherit;
}
.pf-regen:hover { color: var(--accent); border-color: var(--accent); }
.pf-regen:disabled { opacity: 0.5; cursor: not-allowed; }
.pf-analysis__head-left::before {
content: "▸ ";
display: inline-block;
width: 1em;
color: var(--accent);
transition: transform 120ms ease;
}
details[open] .pf-analysis__head-left::before { content: "▾ "; }
.pf-analysis__head:hover { color: var(--accent); }
.pf-analysis__head:hover .pf-analysis__head-left::before { color: var(--accent); }
.pf-analysis__details[open] .pf-analysis__head {
border-bottom: 1px solid var(--border);
}
.pf-analysis__body {
font-family: var(--font-sans);
font-size: 14px;
line-height: 1.65;
color: var(--text);
white-space: pre-wrap;
margin: 0;
padding: 14px 16px 16px;
}
/* ---------- Dashboard portfolio edit mode -----------------------------
*
* Inline composer that sits above the portfolio table. Aesthetic:
* terminal-style command line, no boxed-form chrome, ghost controls,
* tinted-neutral palette pulled from --border / --dim / --muted, accent
* is theme-aware (deep teal in light, electric cyan in dark).
*/
/* The portfolio panel header gains two extra children (the EDIT / Done
* pills). The global `.panel-header` uses `space-between`, which works
* for headers with only title+meta but collapses meta into title once
* any later child has `margin-left: auto`. Switch this header to a
* gap-based flow; meta now sits 12px from the title, edit pill at the
* far right via its own auto-margin. */
#portfolio-panel .panel-header {
justify-content: flex-start;
gap: 12px;
}
/* EDIT / Done toggle buttons in the panel header. */
.pf-edit-btn,
.pf-done-btn {
display: inline-flex;
align-items: center;
gap: 4px;
background: transparent;
border: 1px solid var(--border);
color: var(--dim);
padding: 2px 8px;
border-radius: 2px;
cursor: pointer;
font-family: var(--font-mono);
font-size: 11px;
letter-spacing: 0.04em;
text-transform: lowercase;
margin-left: auto;
transition: color 120ms ease-out, border-color 120ms ease-out;
}
.pf-edit-btn:hover, .pf-done-btn:hover {
color: var(--accent);
border-color: var(--accent);
}
/* The JS toggles these via the `hidden` attribute. `display: inline-flex`
* above otherwise wins over the UA's `[hidden] { display: none }`. */
.pf-edit-btn[hidden], .pf-done-btn[hidden] { display: none; }
/* × button per row — hidden by default, visible only in edit mode. */
.pf-row-del-cell { width: 20px; text-align: center; }
.pf-row-del {
display: none;
background: transparent;
border: none;
color: var(--dim);
cursor: pointer;
font-size: 14px;
padding: 0 4px;
font-family: inherit;
transition: color 120ms ease-out;
}
#portfolio-panel.pf-editing .pf-row-del { display: inline; }
#portfolio-panel.pf-editing .pf-row-del:hover { color: var(--negative); }
/* ---------- Inline add-position composer ----------------------------- */
.pf-add {
padding: 6px 12px 8px;
border-bottom: 1px dashed var(--border);
margin-bottom: 6px;
font-family: var(--font-mono);
font-size: 12px;
}
.pf-add__line {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.pf-add__prompt {
color: var(--accent);
font-weight: 600;
user-select: none;
margin-right: 2px;
}
.pf-add__div {
width: 1px;
height: 14px;
background: var(--border);
margin: 0 2px;
}
.pf-add__at {
color: var(--dim);
font-size: 11px;
user-select: none;
}
.pf-add__line input[type="text"],
.pf-add__line input[type="number"],
.pf-add__line input[type="date"] {
background: transparent;
border: none;
border-bottom: 1px solid var(--border);
color: var(--text);
padding: 2px 4px;
font-family: inherit;
font-size: 12px;
line-height: 1.4;
font-variant-numeric: tabular-nums;
border-radius: 0;
}
.pf-add__line input:focus {
outline: none;
border-bottom-color: var(--accent);
background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.pf-add__line input::placeholder {
color: var(--dim);
font-style: italic;
}
.pf-add__ticker {
width: 80px;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 600;
}
.pf-add__num--qty { width: 56px; text-align: right; }
.pf-add__num--cost { width: 76px; text-align: right; }
.pf-add__date { width: 128px; margin-left: 4px; }
/* Tiny pill that shows after a successful validate: "172.40 USD". */
.pf-add-currency {
color: var(--muted);
font-size: 11px;
min-width: 24px;
letter-spacing: 0.02em;
}
.pf-add-currency:empty { display: none; }
/* Calendar-icon button — ghost, square, terminal-feel. */
.pf-add__icon {
background: transparent;
border: 1px solid var(--border);
color: var(--dim);
width: 22px;
height: 22px;
padding: 0;
border-radius: 2px;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
transition: color 120ms ease-out, border-color 120ms ease-out;
}
.pf-add__icon:hover {
color: var(--accent);
border-color: var(--accent);
}
.pf-add__icon:focus-visible {
outline: none;
color: var(--accent);
border-color: var(--accent);
}
/* Submit button — a square accent-bordered plus glyph. Visually
* heavier than the ghost calendar icon (larger size, accent border)
* so the primary action reads as primary. Lights up to solid accent
* on hover/focus when enabled. */
.pf-add__submit {
margin-left: auto;
background: transparent;
border: 1px solid var(--accent);
color: var(--accent);
width: 26px;
height: 26px;
padding: 0;
border-radius: 2px;
cursor: pointer;
font-family: inherit;
font-size: 18px;
font-weight: 600;
line-height: 1;
display: inline-flex;
align-items: center;
justify-content: center;
transition: background 120ms ease-out, color 120ms ease-out,
border-color 120ms ease-out, transform 120ms ease-out;
}
.pf-add__submit:hover:not(:disabled),
.pf-add__submit:focus-visible:not(:disabled) {
background: var(--accent);
color: var(--bg);
outline: none;
}
.pf-add__submit:active:not(:disabled) {
transform: scale(0.94);
}
.pf-add__submit:disabled {
border-color: var(--border);
color: var(--dim);
cursor: not-allowed;
}
/* Status indicators next to the ticker + below the row. */
.pf-add-status {
font-size: 11px;
color: var(--muted);
font-variant-numeric: tabular-nums;
}
.pf-add-status:empty { display: none; }
.pf-add-status--pending { color: var(--dim); font-style: italic; }
.pf-add-status--ok { color: var(--positive); }
.pf-add-status--err { color: var(--negative); }
/* Secondary line below the main row — only takes space when a child has
* content. Holds the date-lookup status and the duplicate warning. */
.pf-add__notes {
display: flex;
gap: 14px;
margin-top: 4px;
font-size: 11px;
}
.pf-add__notes:has(:empty:only-child) { display: none; }
.pf-add-warning {
color: var(--warning);
}
.pf-add-warning:empty { display: none; }
/* Quietly explains the controls. Shown only when the form is visible,
* which is to say only in edit mode. */
.pf-add__hint {
margin: 6px 0 0;
font-size: 11px;
color: var(--dim);
line-height: 1.5;
font-style: italic;
}
.pf-add__hint kbd {
font-family: inherit;
font-style: normal;
font-size: 11px;
padding: 0 4px;
border: 1px solid var(--border);
border-radius: 2px;
color: var(--muted);
background: color-mix(in srgb, var(--accent) 4%, transparent);
}
/* --- Mobile (≤480px) -------------------------------------------------- */
@media (max-width: 480px) {
/* The existing 640px breakpoint already moves the overall grid to
2 cols. At ≤480 we keep 2 cols but tighten gap so the stat
values don't crowd the labels next to them. */
.pf-overall__grid { gap: 4px 12px; }
.pf-stat-value { font-size: 14px; }
/* Action buttons wrap to multiple rows instead of squishing onto
one. flex-wrap was already set above; ensure each button has a
comfortable tap target. */
.pf-actions { flex-wrap: wrap; gap: 6px; }
.pf-actions button {
flex: 1 1 auto;
padding: 8px 12px;
font-size: 11.5px;
}
/* Pill row stays wrapped; just give pills a small min-width so
two-character tags (USD, EUR) don't hug each other awkwardly. */
.pf-pill { padding: 3px 7px; }
/* The inline composer's input gets the full width — the desktop's
intrinsic-width sizing leaves it tiny on a phone. */
.pf-add__line { flex-wrap: wrap; gap: 6px; }
.pf-add__line input, .pf-add__line textarea { width: 100%; }
}