/* ═══════════════════════════════════════════════════════════════════
   Finanzen I — student application styles.
   Same palette and type as the Portfolio Clash pages (dark slate, indigo
   accent, Space Grotesk + Inter), a calmer composition: one centred column
   for onboarding, a card grid for the dashboard, no animated background.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg:      #0A0A0F;
    --surface: #101015;
    --card:    #16161D;
    --card-2:  #1C1C25;
    --border:  rgba(255,255,255,0.08);
    --border-s:rgba(255,255,255,0.05);
    --text-1:  #F4F4F6;
    --text-2:  #A3A3B2;
    --text-3:  #8B8B9C;
    --accent:  #6366F1;
    --accent-deep: #4F46E5;
    --on-accent: #FFFFFF;
    --a-dim:   rgba(99,102,241,0.12);
    --a-mid:   rgba(99,102,241,0.28);
    --pos:     #34D399;
    --pos-bg:  rgba(52,211,153,0.12);
    --neg:     #FB7185;
    --neg-bg:  rgba(251,113,133,0.12);
    --warn:    #F5B544;
    --warn-bg: rgba(245,181,68,0.12);
    --r:       10px;
    --r-md:    14px;
    --r-lg:    20px;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --shadow:  0 20px 60px -30px rgba(0,0,0,0.8);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-ui);
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 50% -10%, rgba(99,102,241,0.18), transparent 60%),
        radial-gradient(600px 400px at 100% 100%, rgba(99,102,241,0.06), transparent 60%);
    background-attachment: fixed;
    color: var(--text-1);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: var(--text-1); }
button, input { font: inherit; }
[hidden] { display: none !important; }

/* ── accessibility helpers ── */
.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 50;
    background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
    text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 2px; }
/* Headings receive focus after a navigation (app.js, for screen readers) — they are not
   interactive, so no ring (as on the professor page). Every link, button and input keeps it. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

/* ── top bar ── */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 20px;
    background: rgba(16,16,21,0.75);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    text-decoration: none; font-family: var(--font-display); font-weight: 700;
    font-size: 0.98rem; letter-spacing: -0.01em;
}
.logo-mark {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px;
    background: linear-gradient(140deg, #818CF8 0%, #4F46E5 100%);
    color: #fff; font-size: 0.86rem; letter-spacing: 0.02em;
    box-shadow: 0 4px 14px -4px rgba(99,102,241,0.6), inset 0 1px 0 rgba(255,255,255,0.25);
}
.logo-mark::after {
    content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px;
    border-radius: 50%; background: #A5B4FC; box-shadow: 0 0 6px #A5B4FC;
}
.brand-sep { color: var(--text-3); font-weight: 400; }
.brand-course { color: #C7D2FE; }
.topbar-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-nav .who { color: var(--text-2); font-size: 0.82rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-nav a, .topbar-nav button {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 100px; font-size: 0.8rem; font-weight: 600;
    text-decoration: none; cursor: pointer; border: 1px solid var(--border);
    background: transparent; color: var(--text-2);
    transition: color .15s, border-color .15s, background .15s;
}
.topbar-nav a:hover, .topbar-nav button:hover { color: var(--text-1); border-color: var(--a-mid); background: var(--a-dim); }

/* ── layout ── */
.main { flex: 1; width: 100%; padding: 28px 16px 48px; }
.column { max-width: 600px; margin: 0 auto; }
.wide { max-width: 1060px; margin: 0 auto; }
.footer {
    display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center;
    padding: 18px 16px 28px; color: var(--text-3); font-size: 0.78rem;
    border-top: 1px solid var(--border-s);
}
.footer a { color: var(--text-2); }
.noscript { padding: 24px; text-align: center; color: var(--text-2); }

/* ── course header (every onboarding screen) ── */
.course-head { text-align: center; margin: 8px 0 22px; }
.eyebrow {
    font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--text-3); font-weight: 600; margin-bottom: 8px;
}
.course-head h1 {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.05;
}
.course-head .term { color: var(--text-2); margin-top: 6px; }

/* ── progress strip ── */
.progress {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    margin: 0 0 22px; list-style: none;
}
.progress li {
    position: relative; padding: 10px 12px 10px 14px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--border-s);
    font-size: 0.78rem; color: var(--text-3); min-width: 0;
}
.progress li::before {
    content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
    border-radius: 3px; background: rgba(255,255,255,0.08);
}
.progress li .step { display: block; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 2px; }
.progress li .value { display: block; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress li.done { color: var(--text-2); }
.progress li.done::before { background: var(--pos); }
.progress li.done .value { color: var(--pos); }
.progress li.current { border-color: var(--a-mid); background: var(--a-dim); }
.progress li.current::before { background: var(--accent); }
.progress li.current .value { color: #C7D2FE; }

/* ── cards ── */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h2 {
    font-family: var(--font-display); font-weight: 600; font-size: 1.12rem;
    letter-spacing: -0.015em; margin-bottom: 4px;
}
.card .lead { color: var(--text-2); font-size: 0.92rem; margin-bottom: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head .tag { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice {
    display: flex; flex-direction: column; gap: 6px; text-align: left;
    padding: 18px; border-radius: var(--r-md);
    background: var(--card-2); border: 1px solid var(--border); color: var(--text-1);
    cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.choice:hover { border-color: var(--a-mid); background: rgba(99,102,241,0.08); transform: translateY(-1px); }
.choice strong { font-family: var(--font-display); font-size: 1.02rem; }
.choice span { color: var(--text-2); font-size: 0.86rem; }
.choice .arrow { color: #A5B4FC; font-weight: 600; margin-top: 4px; }

/* ── forms ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.field .hint { font-size: 0.8rem; color: var(--text-3); margin-top: 6px; }
.field input {
    width: 100%; padding: 11px 13px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--border); color: var(--text-1);
    transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: rgba(99,102,241,0.6); box-shadow: 0 0 0 3px rgba(99,102,241,0.18); }
.field.invalid input { border-color: rgba(251,113,133,0.6); }
.field .field-error { color: var(--neg); font-size: 0.8rem; margin-top: 6px; }
.field input.code { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0.18em; text-transform: uppercase; text-align: center; }
.readonly {
    display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 12px 14px; border-radius: var(--r);
    background: var(--surface); border: 1px dashed var(--border); font-size: 0.86rem; color: var(--text-2);
}
.readonly b { color: var(--text-1); font-weight: 600; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; color: var(--text-2); margin-bottom: 14px; }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.actions .spacer { flex: 1; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: var(--r); border: 1px solid transparent;
    font-weight: 600; font-size: 0.92rem; cursor: pointer; text-decoration: none;
    transition: opacity .15s, transform .15s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-secondary { background: var(--card-2); border-color: var(--border); color: var(--text-1); }
.btn-secondary:hover { border-color: var(--a-mid); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); border-color: var(--a-mid); }
.btn-danger { background: transparent; border-color: rgba(251,113,133,0.35); color: var(--neg); }
.btn-danger:hover { background: var(--neg-bg); }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: #A5B4FC; cursor: pointer; padding: 0; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #C7D2FE; }

/* ── alerts, toast, status ── */
.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px; font-size: 0.88rem;
    border: 1px solid var(--border);
}
.alert.error { background: var(--neg-bg); border-color: rgba(251,113,133,0.3); color: #FECDD3; }
.alert.warn  { background: var(--warn-bg); border-color: rgba(245,181,68,0.3); color: #FDE68A; }
.alert.ok    { background: var(--pos-bg); border-color: rgba(52,211,153,0.3); color: #A7F3D0; }
.alert.info  { background: var(--a-dim); border-color: var(--a-mid); color: #C7D2FE; }
.toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
    background: var(--card-2); border: 1px solid var(--border); color: var(--text-1);
    padding: 10px 16px; border-radius: 100px; font-size: 0.86rem; box-shadow: var(--shadow); z-index: 20;
    max-width: calc(100% - 32px);
}
.state-card { max-width: 520px; margin: 60px auto; text-align: center; color: var(--text-2); }
.state-card h2 { font-family: var(--font-display); color: var(--text-1); margin: 10px 0 6px; font-size: 1.3rem; }
.state-card .actions { justify-content: center; margin-top: 16px; }
.spinner {
    width: 26px; height: 26px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy { position: relative; }
.busy::after {
    content: ''; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
    animation: spin 0.8s linear infinite; margin-left: 2px;
}

/* ── pills / badges ── */
.pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
    background: var(--a-dim); color: #C7D2FE; border: 1px solid var(--a-mid);
}
.pill.ok { background: var(--pos-bg); color: #A7F3D0; border-color: rgba(52,211,153,0.3); }
.pill.muted { background: var(--surface); color: var(--text-3); border-color: var(--border); }
.pill.warn { background: var(--warn-bg); color: #FDE68A; border-color: rgba(245,181,68,0.3); }

/* ── team card ── */
.team-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.members { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.members li {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px;
    border-radius: 100px; background: var(--surface); border: 1px solid var(--border); font-size: 0.86rem;
    max-width: 100%;
}
.members li .avatar {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(140deg, #818CF8, #4F46E5); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; font-family: var(--font-display);
}
.members li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members li.you .name::after { content: ' (you)'; color: var(--text-3); }
.members li.empty { color: var(--text-3); border-style: dashed; }
.seats { font-size: 0.82rem; color: var(--text-2); }
.invite {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border);
}
.invite .label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; width: 100%; }
.invite code {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.16em;
    color: #C7D2FE; user-select: all;
}
.invite .hint { width: 100%; font-size: 0.8rem; color: var(--text-3); }

/* ── preview (join) ── */
.preview {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
    margin-bottom: 14px;
}
.preview .pname { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }

/* ── dashboard ── */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 6px 0 18px; }
.dash-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.1; }
.dash-head .term { color: var(--text-2); margin-top: 4px; }
.dash-head .phase { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.dash-head .phase small { color: var(--text-3); font-size: 0.8rem; }
.dash-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border-s); padding-bottom: 12px; }
.dash-nav a, .dash-nav span {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 100px;
    font-size: 0.84rem; font-weight: 600; text-decoration: none;
}
.dash-nav a[aria-current="page"] { background: var(--a-dim); color: #C7D2FE; border: 1px solid var(--a-mid); }
.dash-nav span { color: var(--text-3); border: 1px solid transparent; cursor: default; }
.dash-nav span .later { font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 100px; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash-grid .card + .card { margin-top: 0; }
.dash-col { display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; font-size: 0.9rem; }
.kv dt { color: var(--text-2); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.portfolios { display: grid; gap: 10px; }
.pf {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
    padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
}
.pf .pf-name { font-family: var(--font-display); font-weight: 600; }
.pf .pf-sub { grid-column: 1 / -1; color: var(--text-3); font-size: 0.8rem; }
.pf .pf-cash { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; text-align: right; white-space: nowrap; }
.pf.total { background: var(--a-dim); border-color: var(--a-mid); }
.checklist { list-style: none; display: grid; gap: 10px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 0.9rem; }
.checklist .mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; border: 1px solid var(--border); color: var(--text-3); }
.checklist .mark.done { background: var(--pos-bg); border-color: rgba(52,211,153,0.4); color: var(--pos); }
.checklist .mark.now { background: var(--a-dim); border-color: var(--a-mid); color: #C7D2FE; }
.checklist small { display: block; color: var(--text-3); font-size: 0.8rem; }
.note { font-size: 0.82rem; color: var(--text-3); margin-top: 12px; }

/* ── responsive ── */
@media (max-width: 760px) {
    .main { padding: 18px 12px 40px; }
    .card { padding: 18px 16px; border-radius: var(--r-md); }
    .choice-grid { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .progress li { padding: 8px 8px 8px 12px; }
    .progress li .step { font-size: 0.6rem; }
    .topbar { padding: 8px 12px; }
    .brand-text { display: none; }
    .brand-sep { display: none; }
    .topbar-nav .who { display: none; }
    .invite code { font-size: 1.3rem; }
    .actions .btn { flex: 1 1 auto; }
    .actions .btn-danger { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .spinner, .busy::after { animation-duration: 2s; }
    .btn:hover, .choice:hover { transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   Core Portfolio (Phase 6) — a product screen, not a form.
   Tokens: surface hierarchy, radii, motion. Then: hero, slot grid, cards,
   picker and confirmation sheets, review, positions, allocation bar,
   skeletons, motion, responsive.
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --s-1: var(--surface);            /* recessed */
    --s-2: var(--card);               /* base card */
    --s-3: var(--card-2);             /* raised */
    --s-4: #22222C;                   /* hover / sheet */
    --gap: 14px;
    --r-card: 18px;
    --r-tile: 14px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    --t-fast: 160ms;
    --t-med: 280ms;
    --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 30px -20px rgba(0,0,0,0.7);
    --shadow-2: 0 30px 70px -30px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.04) inset;
    --ring: 0 0 0 3px rgba(99,102,241,0.22);
}

/* ── layout ── */
.core-body { display: grid; gap: var(--gap); }
.core-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.core-main { display: grid; gap: var(--gap); min-width: 0; }
.rail-card { position: sticky; top: 72px; }
.card.rail-card + .card { margin-top: 0; }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.span-2 { grid-column: 1 / -1; }
.group-title { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin: 4px 0 10px; }
.review-group + .review-group { margin-top: 6px; }
.review-list { display: grid; gap: 10px; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 9px; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--s-3); border: 1px solid var(--border); color: var(--text-2); font-size: 1.2rem; line-height: 1; cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { color: var(--text-1); border-color: var(--a-mid); background: var(--a-dim); }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── hero ── */
.core-hero {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 1fr); gap: 22px; align-items: center;
    padding: 24px 26px; border-radius: var(--r-card);
    background: radial-gradient(600px 200px at 0% 0%, rgba(99,102,241,0.22), transparent 60%), var(--s-2);
    border: 1px solid var(--a-mid); box-shadow: var(--shadow-1);
}
.core-hero .amount {
    font-family: var(--font-display); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05;
    font-size: clamp(2rem, 4.5vw, 2.9rem); font-variant-numeric: tabular-nums; margin: 4px 0 8px;
}
.core-hero .facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 0.88rem; align-items: center; }
.core-hero .facts span:not(.pill)::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--a-mid); margin: 0 8px 2px 0; }
.core-hero .facts span.pill::before { display: none; }
.hero-side { display: grid; gap: 12px; justify-items: stretch; }
.progress-text { font-size: 0.88rem; color: var(--text-2); font-weight: 500; }
.core-hero.locked { grid-template-columns: minmax(0, 1fr) auto; background: radial-gradient(600px 200px at 0% 0%, rgba(52,211,153,0.16), transparent 60%), var(--s-2); border-color: rgba(52,211,153,0.3); }
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 8px; }
.tile { padding: 12px 14px; border-radius: var(--r-tile); background: rgba(255,255,255,0.03); border: 1px solid var(--border-s); min-width: 0; }
.tile .tl { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.tile .tv { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.tile .ts { color: var(--text-3); font-size: 0.76rem; margin-top: 1px; }
.tile.pos .tv { color: var(--pos); }
.tile.neg .tv { color: var(--neg); }

/* step trail */
.steps { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; }
.steps li {
    display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: 100px;
    font-size: 0.76rem; font-weight: 600; color: var(--text-3); border: 1px solid var(--border-s); background: rgba(255,255,255,0.02);
}
.steps .n { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.68rem; background: rgba(255,255,255,0.06); color: var(--text-2); }
.steps li.current { color: #C7D2FE; border-color: var(--a-mid); background: var(--a-dim); }
.steps li.current .n { background: var(--accent); color: #fff; }
.steps li.done { color: var(--text-2); }
.steps li.done .n { background: var(--pos-bg); color: var(--pos); }

/* five segments */
.segments { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.segments li { height: 9px; border-radius: 5px; background: rgba(255,255,255,0.08); transition: background var(--t-med) var(--ease), box-shadow var(--t-med); }
.segments li.done { background: var(--accent); box-shadow: 0 0 12px -2px rgba(99,102,241,0.7); }
.segments li.fixed { background: repeating-linear-gradient(135deg, rgba(165,180,252,0.55) 0 4px, rgba(165,180,252,0.25) 4px 8px); }
.segments li.locked { background: var(--pos); }

/* ── slot cards ── */
.slot-card {
    position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 190px;
    padding: 18px 18px 16px; border-radius: var(--r-card); background: var(--s-2); border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    transition: border-color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.slot-card.is-empty { border-style: dashed; border-color: rgba(255,255,255,0.14); background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent), var(--s-2); }
.slot-card.is-empty:hover { border-color: var(--a-mid); }
.slot-card.is-selected { border-color: rgba(99,102,241,0.45); }
.slot-card.is-selected::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(360px 120px at 100% 0%, rgba(99,102,241,0.12), transparent 70%); }
.slot-card.is-fixed { border-color: rgba(165,180,252,0.28); background: linear-gradient(135deg, rgba(165,180,252,0.07), transparent 55%), var(--s-2); min-height: 0; }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.slot-kicker { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.slot-target { font-size: 0.78rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.slot-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.check-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 600; color: #C7D2FE; }
.check-pill .ck { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; animation: pop var(--t-med) var(--ease) both; }
.slot-cta {
    display: flex; align-items: center; gap: 14px; flex: 1; text-align: left; width: 100%;
    padding: 16px; border-radius: var(--r-tile); border: 1px dashed rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.02); color: var(--text-1); cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease);
}
.slot-cta:hover { border-color: var(--a-mid); background: var(--a-dim); transform: translateY(-1px); }
.slot-cta:disabled { cursor: default; opacity: 0.6; transform: none; }
.slot-cta .plus { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 300; background: var(--a-dim); color: #C7D2FE; border: 1px solid var(--a-mid); flex-shrink: 0; }
.slot-cta .cta-text { display: grid; gap: 2px; }
.slot-cta b { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.slot-cta small { color: var(--text-3); font-size: 0.8rem; }

/* identity */
.asset-id { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; min-width: 0; }
.asset-id.sm { gap: 10px; }
.asset-text { min-width: 0; }
.asset-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.asset-sub { color: var(--text-3); font-size: 0.8rem; margin-top: 3px; overflow-wrap: anywhere; }
.brand-mark { width: 48px; height: 48px; border-radius: 13px; display: block; flex-shrink: 0; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 6px 16px -10px rgba(0,0,0,0.8); }
.brand-mark.sm { width: 34px; height: 34px; border-radius: 9px; }
.brand-mark.lg { width: 58px; height: 58px; border-radius: 16px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.brand-mark text { font-family: var(--font-display); font-weight: 700; }

/* bonds in cards */
.bond-chosen { display: grid; gap: 10px; }
.bond-figure { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; }
.bond-figure small { font-family: var(--font-ui); font-weight: 500; font-size: 0.78rem; color: var(--text-3); letter-spacing: 0; }

/* fixed ETF */
.fixed-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.fixed-left { display: grid; gap: 12px; justify-items: start; }
.lock-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 100px; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: #C7D2FE; background: var(--a-dim); border: 1px solid var(--a-mid); }
.fixed-note { color: var(--text-2); font-size: 0.86rem; max-width: 52ch; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 260px; }
.chips li { padding: 5px 10px; border-radius: 100px; font-size: 0.76rem; color: var(--text-2); background: var(--s-1); border: 1px solid var(--border); }

/* ── side rail ── */
.rail-card .card-head { margin-bottom: 12px; }
.tag.rev { color: #A5B4FC; }
.rail-list { list-style: none; display: grid; gap: 2px; margin: 0 0 14px; }
.rail-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-s); font-size: 0.86rem; }
.rail-list li:last-child { border-bottom: 0; }
.rail-list .mark { grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.66rem; color: var(--text-3); }
.rail-list li.done .mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.rail-list li.fixed .mark { background: var(--a-dim); border-color: var(--a-mid); color: #C7D2FE; }
.rail-list .k { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.rail-list .v { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-list li.open .v { color: var(--text-3); font-weight: 400; }
.rail-note { font-size: 0.82rem; color: var(--text-2); margin-top: 12px; }
.rail-fine { font-size: 0.74rem; color: var(--text-3); margin-top: 8px; }
.rail-total { padding: 14px 16px; border-radius: var(--r-tile); background: var(--a-dim); border: 1px solid var(--a-mid); margin-bottom: 12px; }
.rail-total.muted { background: var(--s-1); border-color: var(--border); }
.rail-total .tl { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: #C7D2FE; font-weight: 700; }
.rail-total.muted .tl { color: var(--text-3); }
.rail-total .tv { font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.rail-kv { font-size: 0.86rem; margin-bottom: 14px; }
.rail-kv dd { font-weight: 600; }
.rail-actions { display: grid; gap: 10px; margin-top: 4px; }
.rail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* allocation bar */
.alloc-wrap { margin: 2px 0 14px; }
.alloc-label { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin-bottom: 8px; }
.alloc { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; background: rgba(255,255,255,0.05); }
.alloc span { display: block; height: 100%; min-width: 0; transition: width var(--t-med) var(--ease); }
.alloc-legend { list-style: none; display: grid; gap: 5px; margin-top: 10px; font-size: 0.8rem; }
.alloc-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.alloc-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.alloc-legend .l { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alloc-legend .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.alloc-legend .p { font-variant-numeric: tabular-nums; color: var(--text-3); min-width: 48px; text-align: right; }

/* ── review and position cards ── */
.review-card {
    display: grid; gap: 12px; padding: 16px 18px; border-radius: var(--r-card);
    background: var(--s-2); border: 1px solid var(--border); box-shadow: var(--shadow-1);
}
.review-card.has-problem { border-color: rgba(245,181,68,0.35); }
.review-lead { margin-bottom: 2px; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.figure { padding: 10px 12px; border-radius: var(--r-tile); background: var(--s-1); border: 1px solid var(--border-s); min-width: 0; }
.figure .fl { display: block; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.figure .fv { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 3px; overflow-wrap: anywhere; }
.figure.strong { background: var(--a-dim); border-color: var(--a-mid); }
.figure.strong .fl { color: #C7D2FE; }
.figure.strong .fv { font-size: 1.1rem; }
.figure.pnl.pos .fv { color: var(--pos); }
.figure.pnl.neg .fv { color: var(--neg); }
.review-card .meta { font-size: 0.8rem; color: var(--text-3); }
.problem-text { font-size: 0.86rem; color: #FDE68A; }
details.tech { border-top: 1px solid var(--border-s); padding-top: 8px; }
details.tech summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; color: #A5B4FC; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech summary::before { content: '›'; display: inline-block; transition: transform var(--t-fast); font-size: 1rem; line-height: 1; }
details.tech[open] summary::before { transform: rotate(90deg); }
details.tech summary:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 3px; border-radius: 4px; }
.tech-kv { margin-top: 10px; font-size: 0.82rem; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; }
.tech-kv dt { white-space: nowrap; }
.tech-kv dd { font-weight: 500; overflow-wrap: anywhere; text-align: left; }
.alert .problems { margin: 6px 0 0 18px; display: grid; gap: 3px; }
.alert .alert-hint { margin-top: 8px; font-size: 0.82rem; opacity: 0.9; }

/* ── sheets (picker, confirmation) ── */
dialog.sheet {
    position: fixed; inset: 0; margin: auto; border: 0; padding: 16px; background: transparent; color: var(--text-1);
    width: min(780px, 100%); max-width: 100%; max-height: 100%; overflow: visible;
}
dialog.sheet.confirm { width: min(520px, 100%); }
dialog.sheet::backdrop { background: rgba(5,5,10,0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body:has(dialog.sheet[open]) { overflow: hidden; }
.sheet-card {
    display: flex; flex-direction: column; max-height: min(86vh, 900px); overflow: hidden;
    background: var(--s-3); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--r-card); box-shadow: var(--shadow-2);
    animation: sheet-in var(--t-med) var(--ease) both;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 12px; }
.sheet-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; margin-top: 4px; }
.sheet-sub { color: var(--text-2); font-size: 0.86rem; margin-top: 4px; }
.sheet-body { padding: 4px 22px 20px; overflow: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border-s); }
.sheet-alert .alert { margin-bottom: 12px; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-grid.bonds { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* asset and bond cards in the picker */
.asset-card {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left;
    padding: 12px 14px; border-radius: var(--r-tile); background: var(--s-1); border: 1px solid var(--border); color: var(--text-1);
    cursor: pointer; font: inherit;
    transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.asset-card:hover { border-color: var(--a-mid); background: var(--s-4); transform: translateY(-1px); box-shadow: 0 14px 28px -20px rgba(0,0,0,0.9); }
.asset-card:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 2px; }
.asset-card[aria-checked="true"] { border-color: var(--accent); background: var(--a-dim); box-shadow: 0 0 0 1px var(--accent) inset; }
.asset-card:disabled { cursor: default; opacity: 0.55; transform: none; }
.asset-card:disabled[aria-checked="true"], .asset-card.is-saving { opacity: 1; }
.asset-card .check {
    width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.18); color: transparent;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-med) var(--ease);
    transform: scale(0.85);
}
.asset-card[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1); }
.asset-card.is-saving .check { border-color: rgba(255,255,255,0.35); border-top-color: #fff; color: transparent; background: transparent; animation: spin 0.8s linear infinite; }
.asset-card .asset-name { font-size: 1rem; }
.bond-card { grid-template-columns: 1fr; align-items: stretch; gap: 8px; padding: 14px 16px; }
.bond-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bond-coupon { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.bond-coupon small { display: block; font-family: var(--font-ui); font-weight: 500; font-size: 0.74rem; color: var(--text-3); letter-spacing: 0; margin-top: 4px; }
.bond-card .asset-name { font-size: 0.98rem; }
.bond-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; font-size: 0.8rem; margin-top: 2px; }
.bond-facts dt { color: var(--text-3); }
.bond-facts dd { font-weight: 500; overflow-wrap: anywhere; }
.mono { font-family: var(--font-display); letter-spacing: 0.04em; }
.bond-coupon { white-space: nowrap; }
.zero-tag { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--text-2); background: var(--s-3); border: 1px solid var(--border); white-space: nowrap; }

/* confirmation sheet */
.confirm-lines { list-style: none; display: grid; gap: 6px; margin: 6px 0 12px; }
.confirm-lines li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--s-1); border: 1px solid var(--border-s); font-size: 0.86rem; }
.confirm-lines .l { display: grid; min-width: 0; }
.confirm-lines .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-lines .k { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.confirm-lines .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.confirm-totals { padding: 12px 14px; border-radius: var(--r-tile); background: var(--a-dim); border: 1px solid var(--a-mid); margin-bottom: 14px; }
.commitments { list-style: none; display: grid; gap: 8px; font-size: 0.88rem; color: var(--text-2); }
.commitments li { padding-left: 22px; position: relative; }
.commitments li::before { content: '✓'; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--a-dim); color: #C7D2FE; font-size: 0.62rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--a-mid); }
.commitments b { color: var(--text-1); }

/* ── skeletons ── */
.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.11) 50%, rgba(255,255,255,0.05) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel.line-s { width: 38%; height: 10px; }
.skel.line-m { width: 62%; height: 14px; margin-top: 4px; }
.skel.line-l { width: 100%; height: 14px; margin-top: 10px; }
.skel.amount { width: 55%; height: 38px; margin: 8px 0; }
.skel.bar { width: 100%; height: 9px; }
.skel.mark { width: 48px; height: 48px; border-radius: 13px; }
.skel.btn { width: 100%; height: 44px; border-radius: 12px; margin-top: auto; }
.skel.fig { height: 56px; border-radius: var(--r-tile); }
.skeleton .asset-id { margin: 4px 0; }
.asset-card.skeleton { cursor: default; min-height: 72px; }

/* ── motion ── */
.enter { animation: rise var(--t-med) var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    .enter, .sheet-card, .check-pill .ck, .skel { animation: none !important; }
    .slot-card, .slot-cta, .asset-card, .asset-card .check, .segments li, .alloc span, details.tech summary::before { transition: none !important; }
    .slot-cta:hover, .asset-card:hover { transform: none; }
    .asset-card.is-saving .check { animation: spin 2s linear infinite !important; }
}

/* ── responsive ── */
@media (max-width: 1000px) {
    .core-layout { grid-template-columns: 1fr; }
    .rail-card { position: static; }
}
@media (max-width: 760px) {
    .core-hero, .core-hero.locked { grid-template-columns: 1fr; gap: 16px; padding: 18px 16px; }
    .hero-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile .tv { font-size: 1.05rem; }
    .slot-grid { grid-template-columns: 1fr; }
    .slot-card { min-height: 0; padding: 16px; }
    .fixed-body { grid-template-columns: 1fr; }
    .chips { justify-content: flex-start; max-width: none; }
    .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tech-kv { grid-template-columns: 1fr; gap: 2px 0; }
    .tech-kv dt { white-space: normal; margin-top: 6px; }
    .figure.strong { grid-column: 1 / -1; }
    .option-grid, .option-grid.bonds { grid-template-columns: 1fr; }
    dialog.sheet, dialog.sheet.confirm { width: 100%; padding: 0; inset: auto 0 0 0; margin: 0; }
    .sheet-card { max-height: 92vh; border-radius: var(--r-card) var(--r-card) 0 0; border-bottom: 0; }
    .sheet-head, .sheet-body, .sheet-foot { padding-left: 16px; padding-right: 16px; }
    .sheet-foot .btn { flex: 1 1 auto; }
    .rail-row { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════
   Free Portfolio (Phase 7) — the trading terminal. Reuses the Core tokens
   and components (hero, tiles, cards, rail, sheets, skeletons, motion);
   adds the market browser, the stock cards, the trade ticket, the holdings
   and the activity list.
   ═══════════════════════════════════════════════════════════════════ */
.free-hero { background: radial-gradient(600px 200px at 0% 0%, rgba(99,102,241,0.2), transparent 60%), var(--s-2); grid-template-columns: minmax(0, 1fr) auto; }
.free-hero .hero-tiles { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.free-hero .hero-official { margin-top: 10px; font-size: 0.8rem; color: var(--text-3); }
.tone-pos { color: var(--pos) !important; }
.tone-neg { color: var(--neg) !important; }
.free-page { max-width: 1380px; }
.free-layout { grid-template-columns: minmax(0, 1fr) 360px; }
.free-rail { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 2px 0 10px; }
.section-head .group-title { margin: 0; }
.section-sub { font-size: 0.78rem; color: var(--text-3); }
.holdings-section, .activity-section, .orders-section { margin-top: 6px; }

/* ── market browser ── */
.market-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.market-search-wrap { position: relative; flex: 1 1 260px; display: flex; align-items: center; gap: 10px; }
.market-search {
    flex: 1; min-width: 0; padding: 11px 14px 11px 38px; border-radius: 100px;
    background: var(--s-1); border: 1px solid var(--border); color: var(--text-1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238B8B9C' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 14px center; background-size: 16px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.market-search::placeholder { color: var(--text-3); }
.market-search:focus { outline: none; border-color: rgba(99,102,241,0.6); box-shadow: var(--ring); }
.market-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.market-count { font-size: 0.78rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sort-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
    padding: 6px 11px; border-radius: 100px; font-size: 0.76rem; font-weight: 600; cursor: pointer;
    background: transparent; border: 1px solid var(--border); color: var(--text-2);
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.chip:hover { color: var(--text-1); border-color: var(--a-mid); }
.chip[aria-pressed="true"] { background: var(--a-dim); color: #C7D2FE; border-color: var(--a-mid); }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.stock-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stock-card {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; width: 100%;
    padding: 10px 12px; border-radius: 14px; background: var(--s-2); border: 1px solid var(--border); color: var(--text-1);
    cursor: pointer; font: inherit; box-shadow: var(--shadow-1); min-height: 64px;
    transition: border-color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast), background var(--t-fast);
}
.stock-card:hover { border-color: var(--a-mid); transform: translateY(-1px); box-shadow: 0 16px 30px -24px rgba(0,0,0,0.9); background: var(--s-3); }
.stock-card:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 2px; }
.stock-card[aria-pressed="true"] { border-color: var(--accent); background: linear-gradient(180deg, rgba(99,102,241,0.14), transparent 80%), var(--s-2); box-shadow: 0 0 0 1px var(--accent) inset; }
.stock-card .asset-name { font-size: 0.9rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-card .asset-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--text-3); }
.stock-card .asset-sub .tick { font-family: var(--font-display); letter-spacing: 0.05em; font-weight: 600; color: var(--text-2); font-size: 0.74rem; }
.stock-quote { display: grid; justify-items: end; gap: 3px; }
.stock-quote .px { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 100px; font-size: 0.68rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chg.pos { background: var(--pos-bg); color: var(--pos); }
.chg.neg { background: var(--neg-bg); color: var(--neg); }
.chg.flat, .chg.muted { background: var(--s-1); color: var(--text-3); }
.held-pill { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 100px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--a-dim); color: #C7D2FE; border: 1px solid var(--a-mid); white-space: nowrap; }
.stale-tag { font-size: 0.66rem; color: #FDE68A; white-space: nowrap; }
.market-empty { padding: 28px; text-align: center; border-radius: var(--r-card); border: 1px dashed var(--border); color: var(--text-2); }
.market-empty p { margin-top: 6px; font-size: 0.86rem; color: var(--text-3); }
.stock-card.skeleton { cursor: default; min-height: 64px; }

/* ── holdings rail ── */
.rail-holdings { display: grid; gap: 4px; margin-bottom: 12px; }
.rail-holding {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; width: 100%;
    padding: 8px 10px; border-radius: 12px; background: transparent; border: 1px solid transparent; color: var(--text-1); cursor: pointer; font: inherit;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.rail-holding:hover { background: var(--s-1); border-color: var(--border); }
.rail-holding .rh-text { display: grid; min-width: 0; }
.rail-holding .rh-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-holding .rh-sub { font-size: 0.74rem; color: var(--text-3); }
.rail-holding .rh-fig { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.rail-holding .rh-val { font-weight: 600; font-size: 0.9rem; }
.rail-holding .rh-pnl { font-size: 0.74rem; }
.rail-holding .rh-pnl.pos { color: var(--pos); }
.rail-holding .rh-pnl.neg { color: var(--neg); }
.rail-holding .rh-pnl.muted { color: var(--text-3); }
.rail-empty { padding: 14px; border-radius: var(--r-tile); background: var(--s-1); border: 1px dashed var(--border); font-size: 0.88rem; color: var(--text-2); }
.rail-empty b { color: var(--text-1); }
.holdings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.holding-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.holdings-empty { padding: 26px; border-radius: var(--r-card); border: 1px dashed var(--border); color: var(--text-2); }
.holdings-empty b { color: var(--text-1); display: block; margin-bottom: 4px; }
.holdings-empty p { font-size: 0.88rem; }

/* ── the trade ticket ──
   One column, one rhythm: the card's content box is the only width; every
   control is a full-width grid item (the number input's intrinsic width is
   not allowed to widen the column). Groups are 14px apart, the quantity
   group is 8px inside, the fine print 10px under the CTA. Control heights:
   48 (side toggle, quantity field, CTA) and 32 (helper chips). Label / value
   rows share one size, one row gap and right-aligned tabular numerals. */
.ticket-card { padding: 18px; }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ticket-head .asset-id { flex: 1 1 auto; }
.ticket-head .asset-name { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-head .asset-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-head .icon-btn { flex: 0 0 auto; }
.ticket-quote { padding: 12px 14px; border-radius: var(--r-tile); background: var(--s-1); border: 1px solid var(--border-s); margin-bottom: 12px; }
.tq-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; }
.tq-px { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1.15; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tq-meta { font-size: 0.76rem; line-height: 1.5; color: var(--text-3); margin-top: 4px; }
.ticket-kv, .est-kv { grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; font-size: 0.86rem; line-height: 1.5; }   /* the label keeps its line; a long value wraps right-aligned */
.ticket-kv dt, .est-kv dt { color: var(--text-2); white-space: nowrap; }
.ticket-kv dd, .est-kv dd { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.ticket-kv { margin-bottom: 16px; }
.ticket { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 16px; border-top: 1px solid var(--border-s); }
.ticket > * { min-width: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--s-1); border: 1px solid var(--border); }
.seg { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); font: inherit; font-weight: 700; font-size: 0.9rem; line-height: 1; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.seg:hover { color: var(--text-1); }
.seg:focus-visible { outline: 2px solid #A5B4FC; outline-offset: -2px; }
.seg:disabled { opacity: 0.4; cursor: not-allowed; }
.seg.buy[aria-checked="true"] { background: var(--pos-bg); color: #A7F3D0; border-color: rgba(52,211,153,0.35); }
.seg.sell[aria-checked="true"] { background: var(--neg-bg); color: #FECDD3; border-color: rgba(251,113,133,0.35); }
.qty-group { display: grid; gap: 8px; }
.qty-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 18px; }
.qty-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.qty-max { font-size: 0.74rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qty-field { display: flex; align-items: center; height: 48px; padding: 0 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.qty-field:focus-within { border-color: rgba(99,102,241,0.6); box-shadow: var(--ring); }
.qty-field:has(.qty:disabled) { opacity: 0.6; }
.qty { flex: 1 1 0; min-width: 0; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; background: transparent; color: var(--text-1);
       font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.qty:focus { outline: none; }
.qty::placeholder { color: var(--text-3); opacity: 0.6; }
.qty::-webkit-outer-spin-button, .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty { -moz-appearance: textfield; appearance: textfield; }
.qty-unit { flex: 0 0 auto; padding-left: 10px; color: var(--text-3); font-size: 0.8rem; white-space: nowrap; }
.qty-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.qty-chips .chip { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 8px; line-height: 1; white-space: nowrap; }
.estimate { display: grid; align-content: start; gap: 8px; padding: 12px 14px; border-radius: var(--r-tile); background: var(--s-1); border: 1px solid var(--border-s); transition: background var(--t-fast), border-color var(--t-fast); }
.estimate.has-plan { background: var(--a-dim); border-color: var(--a-mid); }
.is-sell .estimate.has-plan { background: rgba(251,113,133,0.08); border-color: rgba(251,113,133,0.3); }
.est-kv { margin: 0; }
.est-kv.muted dd { color: var(--text-2); }
.est-kv dd.pending { color: var(--text-3); font-weight: 500; }
.est-status { font-size: 0.76rem; line-height: 1.5; min-height: 2.28rem; color: var(--text-3); margin: 0; }   /* two lines reserved: hint, server stamp or refusal — the box never changes height */
.est-status.warn { color: #FDE68A; }
.ticket-alert:empty { display: none; }
.ticket-alert .alert { margin-bottom: 0; }
.ticket .btn-primary { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; }
.ticket .rail-fine { margin-top: -4px; }
.free-rail .ticket-card { max-height: calc(100vh - 84px); overflow: auto; }   /* a short viewport scrolls inside the sticky ticket; the CTA stays reachable */
.is-sell .btn-primary { background: #E11D48; }
.is-sell .btn-primary:hover { background: #BE123C; }

/* ── the confirmation sheet of a trade ── */
dialog.sheet.trade { width: min(500px, 100%); }
.confirm-identity { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin: 4px 0 14px; }
.confirm-side { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 0.68rem; letter-spacing: 0.14em; font-weight: 800; margin-bottom: 4px; }
.confirm-side.buy { background: var(--pos-bg); color: #A7F3D0; border: 1px solid rgba(52,211,153,0.35); }
.confirm-side.sell { background: var(--neg-bg); color: #FECDD3; border: 1px solid rgba(251,113,133,0.35); }
.trade-totals dt { color: var(--text-2); }
dialog.is-sell .confirm-totals { background: rgba(251,113,133,0.08); border-color: rgba(251,113,133,0.3); }
dialog.is-sell .btn-primary { background: #E11D48; }
dialog.is-sell .btn-primary:hover { background: #BE123C; }
dialog.sheet.ticket-sheet { width: min(560px, 100%); }
.ticket-sheet-card { padding: 0; }
.ticket-sheet-card .ticket-card { border: 0; box-shadow: none; position: static; max-height: 92vh; overflow: auto; }

/* ── activity ── */
.activity { list-style: none; display: grid; gap: 4px; }
.activity-row {
    display: grid; grid-template-columns: 130px 60px minmax(0, 1fr) 130px 150px 120px; gap: 10px; align-items: center;
    padding: 10px 14px; border-radius: 12px; background: var(--s-2); border: 1px solid var(--border-s); font-size: 0.86rem;
}
.act-when { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.act-side { display: inline-flex; justify-content: center; padding: 3px 0; border-radius: 100px; font-size: 0.68rem; letter-spacing: 0.1em; font-weight: 800; text-transform: uppercase; }
.act-side.buy { background: var(--pos-bg); color: #A7F3D0; }
.act-side.sell { background: var(--neg-bg); color: #FECDD3; }
.act-what { display: grid; min-width: 0; }
.act-what b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-what small { color: var(--text-3); font-size: 0.76rem; }
.act-cash { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.act-cash.pos { color: var(--pos); } .act-cash.neg { color: var(--text-1); }
.act-pnl { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.act-pnl.pos { color: var(--pos); } .act-pnl.neg { color: var(--neg); } .act-pnl.muted { color: var(--text-3); }
.act-by { text-align: right; color: var(--text-3); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-more { padding: 8px 14px; color: var(--text-3); font-size: 0.8rem; }
.activity-empty { padding: 20px; border-radius: var(--r-card); border: 1px dashed var(--border); color: var(--text-3); font-size: 0.86rem; }
.pf.combined { background: var(--pos-bg); border-color: rgba(52,211,153,0.3); }

/* ── orders (Phase 7.1): pending → executed | rejected; no cancel control ── */
.orders { list-style: none; display: grid; gap: 4px; }
.order-row {
    display: grid; grid-template-columns: auto minmax(0, 1.1fr) minmax(0, 1.4fr) 92px; gap: 12px; align-items: center;
    padding: 10px 14px; border-radius: 12px; background: var(--s-2); border: 1px solid var(--border-s); font-size: 0.86rem;
}
.order-row[data-status="pending"] { border-color: rgba(245,181,68,0.28); }
.ord-what { display: grid; min-width: 0; }
.ord-what b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-what small { color: var(--text-3); font-size: 0.76rem; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-detail { color: var(--text-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; min-width: 0; }
.order-row[data-status="rejected"] .ord-detail { color: var(--text-3); }
.order-status { display: inline-flex; justify-content: center; align-items: center; padding: 3px 9px; border-radius: 100px; font-size: 0.68rem; letter-spacing: 0.08em; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.order-status.pending { background: var(--warn-bg); color: #FDE68A; border: 1px solid rgba(245,181,68,0.3); }
.order-status.executed { background: var(--pos-bg); color: #A7F3D0; border: 1px solid rgba(52,211,153,0.3); }
.order-status.rejected { background: var(--s-1); color: var(--text-3); border: 1px solid var(--border); }
.order-row .order-status { justify-self: end; }
.rail-pending { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; font-size: 0.8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ticket-note { line-height: 1.5; }

/* ── responsive ── */
@media (max-width: 1280px) {
    .stock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .free-hero .hero-tiles { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}
@media (max-width: 1000px) {
    .free-layout { grid-template-columns: 1fr; }
    .free-rail .ticket-card { display: none; }
    .stock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .free-hero, .core-hero.free-hero { grid-template-columns: 1fr; }
    .stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .stock-card { padding: 9px 10px; gap: 8px; }
    .stock-card .asset-name { font-size: 0.84rem; }
    .holdings-grid { grid-template-columns: 1fr; }
    .activity-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'what cash' 'when side' 'pnl by'; gap: 4px 10px; }
    .act-what { grid-area: what; } .act-cash { grid-area: cash; } .act-when { grid-area: when; } .act-side { grid-area: side; justify-self: end; padding: 3px 9px; } .act-pnl { grid-area: pnl; text-align: left; } .act-by { grid-area: by; }
    .order-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'mark what status' 'mark detail detail'; gap: 4px 10px; }
    .order-row > :first-child { grid-area: mark; } .ord-what { grid-area: what; } .ord-detail { grid-area: detail; } .order-row .order-status { grid-area: status; }
    .market-tools { align-items: stretch; }
    .sort-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    dialog.sheet.ticket-sheet, dialog.sheet.trade { width: 100%; padding: 0; inset: auto 0 0 0; margin: 0; }
}
@media (max-width: 480px) {
    .stock-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .stock-card, .rail-holding, .chip, .seg { transition: none !important; }
    .stock-card:hover { transform: none; }
}

/* ═══ Tasks (Phase 8) — list, one task, the shared draft ═══ */
.pill.bad  { background: var(--neg-bg); color: #FECDD3; border-color: rgba(251,113,133,0.3); }
.pill.late { background: var(--warn-bg); color: #FDE68A; border-color: rgba(245,181,68,0.45); border-style: dashed; }
.tasks-page .back-link { display: inline-block; margin: 0 0 10px; font-size: 0.84rem; }
.task-section + .task-section { margin-top: 22px; }
.task-list { display: grid; gap: 10px; }
.task-card {
    display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
    padding: 16px 18px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--border);
    color: var(--text-1); text-decoration: none; transition: border-color var(--t-fast), transform var(--t-fast);
}
.task-card:hover { border-color: var(--a-mid); transform: translateY(-1px); }
.task-card:focus-visible { outline: none; box-shadow: var(--ring); }
.task-card-main { min-width: 0; display: grid; gap: 4px; }
.task-card-side { display: grid; gap: 6px; justify-items: end; text-align: right; flex: 0 0 auto; }
.task-card-side small { color: var(--text-3); font-size: 0.76rem; max-width: 200px; }
.task-title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.task-sum { color: var(--text-2); font-size: 0.88rem; overflow-wrap: anywhere; }
.task-meta { color: var(--text-3); font-size: 0.8rem; }
.task-body, .task-form { display: grid; gap: 12px; }
.task-body > .card, .task-body > div > .card, .task-form > .card { margin-top: 0; }
.task-body .alert { margin-bottom: 0; }
.task-status p { color: var(--text-2); font-size: 0.9rem; margin-top: 6px; }
.task-status .note { margin-top: 6px; }
.task-instructions p { color: var(--text-2); font-size: 0.92rem; margin-top: 8px; white-space: pre-line; overflow-wrap: anywhere; }
.task-event p { margin-top: 6px; overflow-wrap: anywhere; }
.task-notice:empty, .task-conflict:empty { display: none; }
.task-notice .alert, .task-conflict .alert { margin: 0; }
.task-conflict .actions { margin-top: 10px; }
.q-card { transition: border-color var(--t-fast); }
.q-card.has-problem { border-color: rgba(251,113,133,0.55); }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.q-num { font-family: var(--font-display); font-weight: 700; color: #A5B4FC; font-size: 0.9rem; }
.q-title { font-weight: 600; overflow-wrap: anywhere; }
.q-req { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.q-head .pill.eval { margin-left: auto; }
.q-prompt { color: var(--text-1); font-size: 0.94rem; white-space: pre-line; overflow-wrap: anywhere; margin-bottom: 10px; }
.q-meta { color: var(--text-3); font-size: 0.8rem; margin: -4px 0 10px; }
.q-hint { color: var(--text-3); font-size: 0.8rem; margin-top: 6px; min-height: 1.1em; }
.q-bond { background: var(--a-dim); border: 1px solid var(--a-mid); border-radius: var(--r); padding: 11px 13px; margin: 0 0 12px; }
.q-bond-title { font-weight: 600; font-size: 0.86rem; margin-bottom: 6px; }
.q-bond-facts { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 3px 14px; font-size: 0.86rem; margin: 0; }
.q-bond-facts dt { color: var(--text-2); }
.q-bond-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.q-bond .note { font-size: 0.8rem; color: var(--text-2); margin: 8px 0 0; }
.q-bond-note { font-size: 0.84rem; color: var(--text-2); background: var(--a-dim); border: 1px solid var(--a-mid); border-radius: var(--r); padding: 9px 13px; margin: 0 0 12px; }
@media (max-width: 480px) { .q-bond-facts { grid-template-columns: minmax(0, 1fr); gap: 0; } .q-bond-facts dd { margin-bottom: 5px; } }
.task-text {
    width: 100%; min-height: 110px; resize: vertical; padding: 11px 13px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--border); color: var(--text-1); font: inherit; font-size: 0.92rem; line-height: 1.5;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.task-text:focus { outline: none; border-color: rgba(99,102,241,0.6); box-shadow: var(--ring); }
.task-text:disabled, .task-number:disabled { opacity: 0.75; cursor: default; }
.q-number .qty-field { max-width: 320px; }
.task-number { flex: 1 1 0; min-width: 0; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; background: transparent; color: var(--text-1);
               font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.task-number:focus { outline: none; }
.q-options { display: grid; gap: 8px; }
.q-option {
    display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--border); font-size: 0.9rem; cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.q-option:hover { border-color: var(--a-mid); }
.q-option.chosen { border-color: rgba(99,102,241,0.6); background: var(--a-dim); }
.q-option input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: 0 0 auto; }
.q-option span { overflow-wrap: anywhere; }
.q-option:has(input:disabled) { cursor: default; }
.task-actions { position: sticky; bottom: 12px; z-index: 5; }
.task-actions .note { margin-top: 8px; }
.save-state { font-size: 0.8rem; color: var(--text-3); display: inline-flex; gap: 8px; align-items: center; }
.save-state.saving { color: #C7D2FE; }
.save-state.saved { color: var(--pos); }
.save-state.failed, .save-state.conflict { color: var(--neg); }
.save-state .link-btn { font-size: 0.8rem; }
.tasks-empty .lead { margin-bottom: 0; }
.dash-tasks .dash-task-list { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.dash-task-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.dash-task-list a { color: var(--text-1); text-decoration: none; display: grid; gap: 2px; min-width: 0; }
.dash-task-list a:hover .dash-task-title { color: #C7D2FE; }
.dash-task-title { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.dash-task-list small { color: var(--text-3); font-size: 0.78rem; }
@media (max-width: 760px) {
    .task-card { flex-direction: column; }
    .task-card-side { justify-items: start; text-align: left; }
    .task-actions { bottom: 8px; padding: 14px; }
    .task-actions .actions .btn { flex: 1 1 100%; }
    .q-number .qty-field { max-width: none; }
}

/* ═══ Analytics and datasets (Phase 9) — released figures, the not-yet list, the team's data ═══ */
.act-side.income { background: var(--a-dim); color: #C7D2FE; }
.an-section { margin-bottom: 18px; }
.an-sets { display: grid; gap: var(--gap); }
.an-sets .card + .card, .an-grid .card + .card { margin-top: 0; }
.an-empty .lead { margin-bottom: 0; }
.an-failed .alert { margin-bottom: 10px; }
.an-set .card-head { margin-bottom: 12px; }
.an-set .card-head h2 { overflow-wrap: anywhere; }
.an-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin: 0 0 16px; }
.an-fact { padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-s); min-width: 0; }
.an-fact dt { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.an-fact dd { margin-top: 3px; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.an-fact dd small { display: block; font-weight: 400; color: var(--text-3); font-size: 0.76rem; margin-top: 2px; }
.an-cat + .an-cat { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-s); }
.an-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.an-cat-head h3 { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: #C7D2FE; font-weight: 600; }
.an-cat-domain { font-size: 0.78rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.an-cat-expl { color: var(--text-2); font-size: 0.84rem; margin: 4px 0 10px; }
.an-metrics { list-style: none; display: grid; gap: 8px; }
.an-metric { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.an-metric.unavailable { border-style: dashed; }
.an-m-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.an-m-name { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.an-m-label { font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.an-m-scope { font-size: 0.76rem; color: var(--text-3); }
.an-m-fig { display: grid; justify-items: end; gap: 2px; text-align: right; }
.an-m-value { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-m-unit { font-size: 0.72rem; color: var(--text-3); }
.an-m-desc { color: var(--text-2); font-size: 0.84rem; margin-top: 6px; }
.an-m-msg { color: #FDE68A; font-size: 0.84rem; margin-top: 6px; }
.an-m-obs { color: var(--text-3); font-size: 0.76rem; margin-top: 4px; }
.an-pending .lead { margin-bottom: 10px; }
.an-pend-group + .an-pend-group { margin-top: 12px; }
.an-pend-group h3 { font-family: var(--font-display); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.an-pend-list { list-style: none; display: grid; gap: 4px; }
.an-pend-list li { font-size: 0.86rem; color: var(--text-2); padding-left: 14px; position: relative; overflow-wrap: anywhere; }
.an-pend-list li::before { content: ''; position: absolute; left: 2px; top: 0.6em; width: 5px; height: 5px; border-radius: 50%; background: var(--a-mid); }
.an-controls { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.an-control { flex: 1 1 100%; display: grid; gap: 6px; margin-bottom: 14px; }
.an-date { flex: 1 1 150px; min-width: 0; }
.an-label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.an-scopes { display: flex; gap: 4px; flex-wrap: wrap; }
.an-date input { color-scheme: dark; }
.an-scope-note { font-size: 0.82rem; color: var(--text-2); margin: -4px 0 12px; }
.an-scope-note b { color: #FDE68A; font-weight: 600; }
.an-tables { list-style: none; display: grid; gap: 8px; }
.an-table { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.an-table.all { background: var(--a-dim); border-color: var(--a-mid); }
.an-t-text { min-width: 0; display: grid; gap: 3px; }
.an-t-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.an-t-name b { font-weight: 600; font-size: 0.92rem; }
.an-t-file { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; color: var(--text-3); }
.an-t-text p { color: var(--text-3); font-size: 0.8rem; overflow-wrap: anywhere; }
.an-table .btn { flex: 0 0 auto; }
.an-dl-msg:empty { display: none; }
.an-dl-msg .alert { margin: 12px 0 0; }
@media (max-width: 760px) {
    .an-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .an-m-fig { justify-items: start; text-align: left; }
    .an-m-value { font-size: 1.15rem; }
    .an-table { flex-direction: column; align-items: stretch; }
    .an-table .btn { width: 100%; }
}
@media (max-width: 480px) {
    .an-facts { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════
   F52 — the Free Portfolio unlocks per team with its confirmed Core.
   The locked Free state (a card leading to the Core screen), static stock
   cards and holding rows while locked (they open no ticket), the line for
   a confirmed team waiting for Free trading, the Core confirmation sheet's
   warning, the locked Core heading and its note about the Free Portfolio.
   Reuses the tokens above; adds no layout to the approved terminal.
   ═══════════════════════════════════════════════════════════════════ */
.free-locked {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center;
    padding: 20px 22px; border-radius: var(--r-card);
    background: radial-gradient(520px 180px at 0% 0%, rgba(245,181,68,0.14), transparent 65%), var(--s-2);
    border: 1px solid rgba(245,181,68,0.35); box-shadow: var(--shadow-1);
}
.free-locked-mark {
    width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(245,181,68,0.35);
}
.free-locked-text { min-width: 0; display: grid; gap: 6px; }
.free-locked-text h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; line-height: 1.2; }
.free-locked-text p { font-size: 0.9rem; color: var(--text-2); overflow-wrap: anywhere; }
.free-locked-text .free-locked-fine { font-size: 0.82rem; color: var(--text-3); }
.free-locked-cta { white-space: nowrap; }
.stock-card.is-static, .rail-holding.is-static { cursor: default; }
.stock-card.is-static:hover { transform: none; border-color: var(--border); background: var(--s-2); box-shadow: var(--shadow-1); }
.rail-holding.is-static:hover { background: transparent; border-color: transparent; }
.free-unlocked-line b { color: #A7F3D0; font-weight: 600; }

/* the Core confirmation sheet: the lock is the first thing it says */
dialog.sheet.confirm.core-lock .sheet-card { border-color: rgba(245,181,68,0.35); }
.confirm-warning {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
    padding: 14px 16px; margin: 2px 0 10px; border-radius: var(--r-tile);
    background: var(--warn-bg); border: 1px solid rgba(245,181,68,0.4); color: #FDE68A;
    font-size: 0.92rem; font-weight: 500; line-height: 1.5;
}
.confirm-warning p { overflow-wrap: anywhere; }
.confirm-warning-mark {
    width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(245,181,68,0.18); color: var(--warn);
}
.confirm-unlock {
    margin-bottom: 12px; padding: 8px 12px; border-radius: 12px; font-size: 0.86rem;
    background: var(--pos-bg); border: 1px solid rgba(52,211,153,0.3); color: #A7F3D0;
}

/* the locked Core: its heading, and what it means for the Free Portfolio */
.locked-title {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; line-height: 1.3; color: #A7F3D0;
}
.locked-title svg { flex-shrink: 0; }
.free-unlock {
    display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
    padding: 12px 16px; border-radius: var(--r-tile); font-size: 0.9rem;
    background: var(--pos-bg); border: 1px solid rgba(52,211,153,0.3); color: #A7F3D0;
}
.free-unlock p { flex: 1 1 220px; min-width: 0; }
.free-unlock-mark { display: inline-flex; color: var(--pos); }
.free-unlock[data-free-access="waiting"] { background: var(--a-dim); border-color: var(--a-mid); color: #C7D2FE; }
.free-unlock[data-free-access="waiting"] .free-unlock-mark { color: #A5B4FC; }

@media (max-width: 760px) {
    .free-locked { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 16px; }
    .free-locked-cta { grid-column: 1 / -1; width: 100%; white-space: normal; }
    .free-unlock-cta { width: 100%; }
}
@media (max-width: 480px) {
    .free-locked-mark { width: 38px; height: 38px; border-radius: 12px; }
    .free-locked-text h2 { font-size: 1.08rem; }
}

/* ═══ Tasks — the DE | EN reading language (F53) ═══
   One segmented pill in the head of the task list and of a task: two toggle
   buttons (aria-pressed), the chosen one filled. On a desktop it sits at the
   right of the head, above the task's completion; when the head wraps (a
   phone) it moves under the title, left-aligned, and keeps a 36px touch
   height. The note "only available in …" sits right under it; on a task card
   it is one muted line. */
.task-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.task-lang { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 100px; background: var(--s-1); border: 1px solid var(--border); }
.task-lang-opt {
    position: relative; min-width: 46px; min-height: 36px; padding: 0 12px; border-radius: 100px; border: 1px solid transparent;
    background: transparent; color: var(--text-2); font: inherit; font-family: var(--font-display); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; line-height: 1; cursor: pointer;
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.task-lang-opt + .task-lang-opt::before { content: ''; position: absolute; left: -2px; top: 9px; bottom: 9px; width: 1px; background: var(--border); }   /* the "|" between DE and EN */
.task-lang-opt:hover { color: var(--text-1); }
.task-lang-opt:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 1px; }
.task-lang-opt[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }   /* the chosen language, unmistakable */
.task-lang-opt[aria-pressed="true"] + .task-lang-opt::before, .task-lang-opt + .task-lang-opt[aria-pressed="true"]::before { display: none; }
.task-lang-note { color: #FDE68A; font-size: 0.8rem; line-height: 1.4; max-width: 260px; text-align: right; overflow-wrap: anywhere; }
.task-lang-note:empty { display: none; }
.task-card .task-lang-note { max-width: none; text-align: left; font-size: 0.76rem; }
@media (max-width: 760px) {
    .task-head-side { align-items: flex-start; width: 100%; }
    .task-lang-note { max-width: none; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
    .task-lang-opt { transition: none; }
}

/* ═══ Tasks — locked until the team confirms its Core Portfolio (F54) ═══
   The lock card heads the task list and a locked task — the same look as the
   Free Portfolio's lock card (F52, above): a warning mark, what unlocks the
   tasks, and the way to the Core. A locked task's Submit stays visible but
   disabled, in a footer that does not stick to the screen while reading; a
   locked task card's status line reads as a warning, not as "closed". */
.task-locked {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center;
    padding: 20px 22px; border-radius: var(--r-card);
    background: radial-gradient(520px 180px at 0% 0%, rgba(245,181,68,0.14), transparent 65%), var(--s-2);
    border: 1px solid rgba(245,181,68,0.35); box-shadow: var(--shadow-1);
}
.task-locked-mark {
    width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(245,181,68,0.35);
}
.task-locked-text { min-width: 0; display: grid; gap: 6px; }
.task-locked-text h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; line-height: 1.2; }
.task-locked-text p { font-size: 0.9rem; color: var(--text-2); overflow-wrap: anywhere; }
.task-locked-cta { white-space: nowrap; }
.tasks-body > .task-locked { margin-bottom: 18px; }
.task-actions.is-locked { position: static; }
.task-card[data-locked="core"] .task-card-side small { color: #FDE68A; }
@media (max-width: 760px) {
    .task-locked { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 16px; }
    .task-locked-cta { grid-column: 1 / -1; width: 100%; white-space: normal; }
}
@media (max-width: 480px) {
    .task-locked-mark { width: 38px; height: 38px; border-radius: 12px; }
    .task-locked-text h2 { font-size: 1.08rem; }
}

/* ── F55: the mandatory student identification ─────────────────────
   A modal card on the page itself (not a <dialog>): while it is shown it is the
   only content, so there is nothing to click away to and nothing to dismiss. */
.identity-gate {
    display: flex; justify-content: center; align-items: flex-start;
    min-height: calc(100vh - 190px); padding: 28px 0 40px;
    background: radial-gradient(1200px 500px at 50% -10%, rgba(99,102,241,0.10), transparent 60%);
}
.identity-card {
    width: min(560px, 100%);
    border-color: rgba(99,102,241,0.38);
    box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(99,102,241,0.12) inset;
}
.identity-card h2 { font-family: var(--font-display); font-size: 1.45rem; letter-spacing: -0.02em; margin: 4px 0 8px; }
.identity-card .lead { margin-bottom: 14px; }
.identity-note {
    background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.28); border-radius: 10px;
    padding: 10px 12px; margin: 0 0 14px; font-size: 0.86rem; color: var(--text-2); overflow-wrap: anywhere;
}
.identity-note b { color: var(--text-1); font-family: var(--font-display); letter-spacing: 0.03em; }
.identity-form .field input { font-family: var(--font-display); letter-spacing: 0.04em; }
.identity-form .checkbox { margin-top: 6px; color: var(--text-1); }
.identity-form .actions .btn { min-width: 190px; }
.identity-fine { font-size: 0.78rem; color: var(--text-3); margin-top: 12px; line-height: 1.5; }
.members li.pending .name { color: var(--text-3); font-style: italic; }
@media (max-width: 560px) {
    .identity-gate { padding: 6px 0 24px; min-height: 0; }
    .identity-card h2 { font-size: 1.25rem; }
    .identity-form .actions .btn { width: 100%; }
}
