:root {
    --bg: #0e1117;
    --bg-elev: #161b22;
    --bg-soft: #1f242c;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --orange: #db6d28;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.22);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --page-max: 1400px;
    --page-pad: var(--space-5);
    --text-xs: 12px;
    --text-sm: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 20px;
    --text-2xl: 28px;
    font-variant-numeric: tabular-nums;
}

body.light-mode {
    --bg: #f6f8fa;
    --bg-elev: #ffffff;
    --bg-soft: #eaeef2;
    --border: #d0d7de;
    --text: #1f2328;
    --muted: #656d76;
    --accent: #0969da;
    --green: #1a7f37;
    --red: #cf222e;
    --yellow: #9a6700;
    --orange: #bc4c00;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
body.light-mode .top {
    background: rgba(255, 255, 255, 0.92);
    border-bottom-color: var(--border);
}
body.light-mode .tip-box,
body.light-mode .global-tip-box { background: #1f2328; color: #e6edf3; }
body.light-mode .tag-buy-strong,
body.light-mode .tag-buy      { background: #dafbe1; color: #1a7f37; box-shadow: none; }
body.light-mode .tag-hold,
body.light-mode .tag-missing  { background: #eaeef2; color: #656d76; }
body.light-mode .tag-sell,
body.light-mode .tag-sell-strong { background: #ffebe9; color: #cf222e; box-shadow: none; }
body.light-mode .tag-flag     { background: #fff8c5; color: #9a6700; }
body.light-mode .toast-success { background: #dafbe1; color: #1a7f37; }
body.light-mode .toast-error   { background: #ffebe9; color: #cf222e; }
body.light-mode .toast-info    { background: var(--bg-elev); }
body.light-mode .toast-warn    { background: #fff8c5; color: #9a6700; border-color: #9a6700; }
body.light-mode .page-login { background: radial-gradient(circle at 30% 20%, #dce8f5 0%, var(--bg) 60%); }

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--text);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

/* ===== Login ===== */
.page-login {
    min-height: 100vh;
    display: grid; place-items: center;
    background: radial-gradient(circle at 30% 20%, #1c2a3f 0%, var(--bg) 60%);
}
.auth-card {
    max-width: 400px; width: calc(100% - 32px); padding: 32px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.auth-title { margin: 0; font-size: 22px; }
.auth-sub { color: var(--muted); margin: 4px 0 24px; }
.auth-forgot { text-align: right; margin: 6px 0 0; font-size: 13px; }
.auth-forgot a { color: var(--muted); display: inline-block; padding: 8px 0; }
.auth-forgot a:hover { color: var(--accent); }
.auth-foot { margin-top: 16px; text-align: center; color: var(--muted); font-size: 12px; }

form label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
form input[type="email"], form input[type="password"], form input[type="text"], form select {
    width: 100%; padding: 10px 12px; margin-top: 4px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; font-size: 16px;
}
form input:focus, form select:focus { outline: 1px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.btn-primary {
    display: block; width: 100%; padding: 11px;
    background: var(--accent); color: #000;
    border: 0; border-radius: 8px; font-weight: 600; cursor: pointer;
    margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
    background: transparent; color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 12px; cursor: pointer; font: inherit;
    height: 38px; display: inline-flex; align-items: center;
    transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.btn-ghost:hover { background: var(--bg-soft); }
.btn-ghost:active { transform: translateY(1px); }

.err { color: var(--red); margin-top: 12px; min-height: 18px; font-size: 13px; }

/* ===== Top bar ===== */
.top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px max(var(--page-pad), calc((100vw - var(--page-max)) / 2 + var(--page-pad)));
    background: rgba(22, 27, 34, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
    gap: 16px;
}
.top-brand {
    font-weight: 700; font-size: 15px; letter-spacing: .2px;
    display: flex; align-items: center; gap: 8px;
}
.top-brand img {
    height: 24px;
    width: auto;
}
/* Theme-aware logo switching */
body.light-mode .logo-dark,
body:not(.light-mode) .logo-light {
    display: none !important;
}
.brand-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0;
    box-shadow: 0 0 6px rgba(88,166,255,.5);
}
.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: space-between;
    min-width: 0;
}
.top-nav-main,
.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.top-nav-main { flex: 1; }
.top-nav-actions { flex-shrink: 0; }
.btn-more {
    gap: 6px;
}
.btn-more-icon {
    font-size: 16px;
    line-height: 1;
}
.btn-more-label {
    font-size: var(--text-sm);
}
.menu-status-line {
    padding: 7px 10px;
    border-top: 1px solid var(--border);
}
.menu-status-line .si-status-pill {
    width: 100%;
    justify-content: flex-start;
}
.user-chip {
    background: var(--bg-soft); border: 1px solid var(--border);
    padding: 5px 10px; border-radius: 999px; font-size: 12px; color: var(--muted);
}
#portfolioSelect {
    min-width: 220px;
    max-width: 460px;
    flex: 1 1 320px;
    padding: 0 10px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; height: 38px;
}
#portfolioSelect:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
    outline-offset: 1px;
}

#siStatusPill, #calStatusPill {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    #btnTheme,
    #btnShortcuts {
        display: none !important;
    }
    #btnHeaderMore {
        width: 36px;
        padding: 0;
        justify-content: center;
    }
    #btnHeaderMore .btn-more-label {
        display: none;
    }
}

@media (max-width: 980px) {
    .top {
        padding: 10px var(--page-pad);
    }
    #btnTheme {
        display: none !important;
    }
    .top-nav {
        gap: 6px;
        justify-content: stretch;
    }
    .top-nav-main { flex: 1; }
    .top-nav-actions { gap: 6px; }
    #portfolioSelect {
        flex-basis: 260px;
    }
}

/* ===== Layout ===== */
.wrap { max-width: var(--page-max); margin: 0 auto; padding: var(--page-pad); display: flex; flex-direction: column; gap: 20px; }

.card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 20px;
    box-shadow: var(--shadow-soft);
}
.card h3 { margin: 0 0 14px; font-size: var(--text-lg); font-weight: 600; letter-spacing: .1px; }

.grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.overview-charts .chart-hero {
    grid-column: 1 / -1;
}
.overview-charts .chart-hero canvas {
    min-height: 280px;
}
.overview-charts .chart-support canvas {
    min-height: 200px;
}
.chart-story {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 10px;
}
.story-pill,
.story-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    font-size: 12px;
    color: var(--muted);
}
.story-pill strong,
.story-note strong { color: var(--text); font-weight: 650; }
.story-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}
.story-dot--warn { background: var(--yellow); }
.story-dot--ok { background: var(--green); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: var(--space-2);
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.tabs::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.tab-btn {
    background: none;
    border: none;
    padding: 11px 16px;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}
.tab-btn:hover { color: var(--text); background: color-mix(in srgb, var(--bg-soft) 70%, transparent); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.tab-content { display: flex; flex-direction: column; gap: 18px; }
.tab-content.hidden { display: none !important; }

/* ===== KPIs ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-top-width: 3px;
    border-radius: var(--radius-md); padding: 16px;
    animation: fadeUp .3s ease both;
    box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}
.kpi:nth-child(2) { animation-delay: .05s; }
.kpi:nth-child(3) { animation-delay: .10s; }
.kpi:nth-child(4) { animation-delay: .15s; }
.kpi:nth-child(5) { animation-delay: .20s; }
.kpi--blue   { border-top-color: var(--accent); }
.kpi--green  { border-top-color: var(--green); }
.kpi--red    { border-top-color: var(--red); }
.kpi--yellow { border-top-color: var(--yellow); }
.kpi .lbl { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .45px; }
.kpi .val { font-size: var(--text-xl); font-weight: 750; margin-top: 4px; line-height: 1.15; }
.kpi .sub { color: var(--muted); font-size: var(--text-xs); margin-top: 3px; }

.briefing-card { border-left: 3px solid var(--accent); }
.briefing-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.briefing-list {
    list-style: disc;
    margin: 8px 0 0 18px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.briefing-list li { color: var(--text); font-size: var(--text-sm); line-height: 1.55; }
.briefing-list li .muted { margin-left: 6px; font-size: 12px; }
.briefing-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.briefing-why-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.briefing-why-btn:hover { color: var(--accent); border-color: var(--accent); }
.briefing-why {
    margin-top: 5px;
    margin-left: 0;
    line-height: 1.45;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--bg-soft) 20%, rgba(255,255,255,.06) 45%, var(--bg-soft) 70%);
    background-size: 240% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}
.kpi-skeleton { min-height: 96px; border-radius: 12px; border: 1px solid var(--border); }
.list-skeleton { height: 14px; border-radius: 6px; margin: 8px 0; }
.skeleton-chart {
    min-height: 220px;
    border-radius: 10px;
    position: relative;
}
.skeleton-chart::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-soft) 20%, rgba(255,255,255,.06) 45%, var(--bg-soft) 70%);
    background-size: 240% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* ===== Entrance Animation ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.card {
    animation: fadeUp .35s ease both;
}
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .10s; }
.card:nth-child(4) { animation-delay: .15s; }

/* ===== Upload ===== */
.upload { display: flex; flex-direction: column; gap: 10px; }
.drop {
    border: 2px dashed var(--border); border-radius: 12px;
    padding: 36px; text-align: center; cursor: pointer;
    background: var(--bg-elev);
    transition: background .2s, border-color .2s;
}
.drop:hover, .drop.drag { background: var(--bg-soft); border-color: var(--accent); }
.drop-icon { font-size: 36px; margin-bottom: 10px; }

/* ===== Table ===== */
.table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child,
th[data-col="symbol"], td[data-col="symbol"],
th[data-col="isin"], td[data-col="isin"],
th[data-col="yield_pct"], td[data-col="yield_pct"] { text-align: left; }
th { font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--bg-elev); }
th.sort-asc::after { content: " ▲"; color: var(--accent); }
th.sort-desc::after { content: " ▼"; color: var(--accent); }
tbody tr:hover { background: var(--bg-soft); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 10px; background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }

.tag { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; display: inline-block; }
.tag-buy-strong { background: #1a3f23; color: var(--green); box-shadow: 0 0 8px rgba(63,185,80,.22); }
.tag-buy        { background: #1a3f23; color: var(--green); box-shadow: 0 0 6px rgba(63,185,80,.12); }
.tag-hold       { background: #31353b; color: var(--muted); }
.tag-sell       { background: #4a1f1f; color: var(--red);   box-shadow: 0 0 6px rgba(248,81,73,.12); }
.tag-sell-strong{ background: #4a1f1f; color: var(--red);   box-shadow: 0 0 8px rgba(248,81,73,.22); }
.tag-flag       { background: #4a3b1f; color: var(--yellow); }
.tag-missing    { background: #31353b; color: var(--muted); font-style: italic; }

/* ===== AAQS Mini-Bar ===== */
.aaqs-cell { display: flex; flex-direction: column; gap: 4px; }
.aaqs-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; width: 44px; }
.aaqs-bar { height: 3px; border-radius: 2px; transition: width .4s ease; }

.asset-name,
.pos-card-name,
.idea-title,
.detail-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.asset-name span:last-child,
.pos-card-name span:last-child,
.idea-title span:last-child,
.detail-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}
.asset-icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-soft) 78%, var(--accent) 22%);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .2px;
    overflow: hidden;
}
.asset-icon--sm {
    width: 24px;
    height: 24px;
}
.asset-icon--lg {
    width: 36px;
    height: 36px;
    font-size: 14px;
}
.asset-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

/* ===== Upside Pill ===== */
.upside-pill {
    display: inline-block; padding: 2px 8px;
    border-radius: 6px; font-weight: 600; font-size: 12px;
}
.upside-pill--pos { color: var(--green); background: rgba(63,185,80,.1); }
.upside-pill--neg { color: var(--red);   background: rgba(248,81,73,.1); }

.green { color: var(--green); }
.red { color: var(--red); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }
ul.plain li:last-child { border-bottom: 0; }

.ideas-card .row-between { align-items: flex-start; }
.ideas-card h3 { margin-bottom: 2px; }
.ideas-card p { margin: 0; }
.ideas-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.idea-card {
    width: 100%;
    text-align: left;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(63,185,80,.16), transparent 38%),
        linear-gradient(145deg, color-mix(in srgb, var(--bg-elev) 82%, var(--green) 18%), var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--border) 72%, var(--green) 28%);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.idea-card:hover {
    transform: translateY(-2px);
    border-color: var(--green);
    box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.idea-main {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}
.idea-main strong,
.idea-main .muted {
    display: block;
}
.idea-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.idea-metrics span {
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: rgba(0,0,0,.08);
}
.idea-metrics b,
.idea-metrics small {
    display: block;
}
.idea-metrics small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.idea-foot {
    min-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ideas-warning {
    grid-column: 1 / -1;
    padding-top: 4px;
}

dialog {
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-elev); color: var(--text);
    padding: 24px; max-width: 420px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
dialog menu button { padding: 8px 14px; background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font: inherit; }
dialog menu button.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }

.import-preview-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.import-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.import-preview-metric {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--bg-soft);
}
.import-preview-metric .lbl {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .35px;
}
.import-preview-metric .val {
    margin-top: 3px;
    font-size: 16px;
    font-weight: 700;
}
.import-warning-list {
    margin: 0;
    padding-left: 18px;
    color: var(--yellow);
    font-size: 13px;
}

/* ===== Position-Detail-Modal ===== */
#modalDetail {
    max-width: 660px; width: 90vw;
    padding: 0; overflow: hidden;
}
.detail-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.detail-header-left { display: flex; flex-direction: column; gap: 6px; }
.detail-title { font-size: 18px; font-weight: 700; margin: 0; }
.detail-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.detail-close {
    background: none; border: 1px solid var(--border); border-radius: 8px;
    color: var(--muted); cursor: pointer; font-size: 16px;
    padding: 4px 10px; flex-shrink: 0; line-height: 1;
}
.detail-close:hover { background: var(--bg-soft); color: var(--text); }

.detail-metrics {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 0; border-bottom: 1px solid var(--border);
}
.detail-metric {
    padding: 14px 20px;
    border-right: 1px solid var(--border);
}
.detail-metric:last-child { border-right: 0; }
.detail-metric .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.detail-metric .val { font-size: 20px; font-weight: 700; margin-top: 4px; }

.detail-chart-wrap { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.detail-chart-wrap h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.detail-chart-wrap canvas { max-height: 160px; }
.detail-no-history { padding: 20px 0; text-align: center; color: var(--muted); font-size: 13px; }

.detail-position { padding: 16px 24px; }
.detail-position h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.detail-pos-row { display: flex; gap: 24px; flex-wrap: wrap; }
.detail-pos-item { display: flex; flex-direction: column; gap: 3px; }
.detail-pos-item .lbl { color: var(--muted); font-size: 11px; }
.detail-pos-item .val { font-size: 14px; font-weight: 600; }

.detail-footer {
    padding: 12px 24px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-soft);
}
.detail-footer .muted { font-size: 11px; }

tbody tr { cursor: pointer; }
tbody tr:active { background: var(--bg-soft); }

/* Chevron-Spalte */
th.col-chevron, td.col-chevron {
    width: 20px; text-align: center; padding: 8px 6px;
    color: var(--border); font-size: 14px; user-select: none;
}
tbody tr:hover td.col-chevron { color: var(--muted); }

/* Upload-Bar Hint-Text */
.upload-bar-hint { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) { .upload-bar-hint { display: none; } }

/* ===== Tooltips ===== */
.tip {
    position: relative; display: inline-flex; align-items: center;
    cursor: default;
}
.tip-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bg-soft); border: 1px solid var(--border);
    color: var(--muted); font-size: 9px; font-weight: 700;
    margin-left: 5px; cursor: help; flex-shrink: 0;
    font-style: normal;
}
.tip-box {
    visibility: hidden; opacity: 0;
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    background: #1f2937; color: #e6edf3;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; line-height: 1.5;
    width: 220px; z-index: 100; pointer-events: none;
    transition: opacity .15s;
    white-space: normal; font-weight: 400;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.tip-box::after {
    content: ''; position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border);
}
.tip:hover .tip-box,
.tip:focus-within .tip-box { visibility: visible; opacity: 1; }

/* Tabellen-Header: z-index für sticky */
th { z-index: 2; }

/* Global Tooltip — position:fixed, ausserhalb overflow-Clipping */
.global-tip-box {
    position: absolute;
    background: #1f2937; color: #e6edf3;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; line-height: 1.5;
    width: 220px; z-index: 9999; pointer-events: none;
    white-space: normal; font-weight: 400;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}

/* ===== Search with Reset ===== */
.search-wrap {
    position: relative; display: inline-flex; align-items: center;
}
.search-wrap input { padding-right: 28px; }
.search-clear {
    position: absolute; right: 8px;
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 14px; padding: 0; line-height: 1;
}
.search-clear:hover { color: var(--text); }
.search-clear.hidden { display: none !important; }

/* ===== Timestamp ===== */
#refreshTimestamp {
    font-size: 11px; color: var(--muted);
    white-space: nowrap;
}

/* ===== Portfolio-Menü ===== */
.portfolio-menu-wrap { position: relative; }
.portfolio-menu {
    position: absolute; top: calc(100% + 6px); left: 0;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow);
    z-index: 30; min-width: 170px; overflow: hidden;
}
.portfolio-menu button {
    display: block; width: 100%; padding: 9px 14px;
    background: none; border: none; cursor: pointer;
    font: inherit; color: var(--text); text-align: left; font-size: 13px;
}
.portfolio-menu button:hover { background: var(--bg-soft); }
.portfolio-menu .danger { color: var(--red); }
.portfolio-menu .menu-divider { height: 1px; background: var(--border); margin: 2px 0; }

/* ===== User-Menü ===== */
.user-menu-wrap { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 10px 5px 6px;
}
.user-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
    line-height: 1;
}
.user-menu-name { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-chevron { font-size: 10px; color: var(--muted); transition: transform .2s; }
.user-menu-btn[aria-expanded="true"] .user-menu-chevron { transform: rotate(180deg); }
#userMenu { right: 0; left: auto; min-width: 190px; }
.user-menu-link {
    display: block; width: 100%; padding: 9px 14px;
    color: var(--text); text-decoration: none; font-size: 13px;
}
.user-menu-link:hover { background: var(--bg-soft); color: var(--text); }
.user-menu-link.danger { color: var(--red); }

/* ===== Spalten-Picker ===== */
.col-picker-wrap { position: relative; }
.col-picker-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow);
    z-index: 30; min-width: 200px; overflow: hidden; padding: 4px 0;
}
.col-picker-menu label {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 14px; cursor: pointer; font-size: 13px;
    color: var(--text); user-select: none;
}
.col-picker-menu label:hover { background: var(--bg-soft); }
.col-picker-menu input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.col-picker-menu .col-picker-divider { height: 1px; background: var(--border); margin: 4px 0; }
.col-picker-menu .col-picker-reset {
    display: block; width: 100%; padding: 7px 14px;
    background: none; border: none; cursor: pointer;
    font: inherit; color: var(--muted); text-align: left; font-size: 12px;
}
.col-picker-menu .col-picker-reset:hover { color: var(--accent); background: var(--bg-soft); }

/* Versteckte Tabellenspalten */
#posTable [data-col].col-hidden { display: none; }

/* ===== Aktive Filter-Chips ===== */
.active-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(88,166,255,.1); border: 1px solid rgba(88,166,255,.25);
    color: var(--accent); font-size: 12px; font-weight: 500;
}
.filter-chip-clear {
    background: none; border: none; cursor: pointer;
    color: var(--accent); font-size: 14px; padding: 0; line-height: 1; opacity: .7;
}
.filter-chip-clear:hover { opacity: 1; }

/* ===== Mobile Positions Cards ===== */
.pos-cards { display: none; flex-direction: column; gap: 10px; }
.pos-card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 16px; cursor: pointer;
    transition: border-color .15s, background .15s, transform .12s ease;
}
.pos-card:hover { border-color: var(--accent); background: var(--bg-soft); }
.pos-card:active { transform: translateY(1px); }
.pos-card-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 10px;
}
.pos-card-name { font-weight: 600; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-card-name span:last-child { white-space: nowrap; }
.pos-card-metrics {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 6px;
}
.pos-card-metric { display: flex; flex-direction: column; gap: 2px; }
.pos-card-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.pos-card-limit { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }

/* ===== Mobile Topbar ===== */
@media (max-width: 720px) {
    .top {
        padding: 10px 14px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .top-brand {
        display: flex;
        justify-content: flex-start;
    }
    .top-brand img {
        height: 20px;
        width: auto;
    }
    .top-nav {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 6px;
        align-items: center;
    }
    .top-nav-main { display: contents; }
    .top-nav-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }
    #portfolioSelect {
        min-width: 0;
        width: 100%;
        grid-column: 1 / 2;
        height: 36px;
        border-radius: 999px;
        border-color: color-mix(in srgb, var(--border) 70%, var(--accent));
        background: color-mix(in srgb, var(--bg-soft) 92%, var(--accent) 8%);
        padding: 0 14px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    }
    #portfolioSelect:focus-visible {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent), inset 0 1px 0 rgba(255,255,255,.05);
    }
    .user-menu-name,
    .user-menu-chevron,
    #refreshTimestamp,
    #siStatusPill,
    #calStatusPill,
    #btnTheme,
    #btnShortcuts,
    #btnHeaderMore {
        display: none !important;
    }
    .menu-status-line { display: none !important; }
    #btnNewPortfolio,
    #btnRefresh,
    #btnUserMenu {
        height: 34px;
        padding: 0 10px;
    }
    #btnNewPortfolio,
    #btnRefresh {
        display: none !important;
    }
    #btnUserMenu {
        min-width: 34px;
        justify-content: center;
        padding: 0;
        grid-column: 2 / 3;
    }
    .wrap { padding: 14px; gap: 14px; }
    #tab-overview .kpi-row {
        position: static;
        top: auto;
        z-index: auto;
        background: transparent;
        padding-bottom: 0;
    }
    .kpi-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .overview-charts {
        gap: 10px;
    }
    .overview-charts .card {
        padding: 14px;
    }
    .overview-charts .card h3 {
        margin-bottom: 8px;
        font-size: 14px;
    }
    .overview-charts .chart-hero canvas {
        min-height: 170px;
        max-height: 190px;
    }
    .overview-charts .chart-support canvas {
        min-height: 130px;
        max-height: 150px;
    }
    .chart-story {
        font-size: 12px;
        padding: 8px 10px;
        margin-bottom: 8px;
    }
    .table-wrap, #posTable { display: none; }
    #posCards { display: flex; }
    .filters { gap: 6px; }
    #btnColPicker { display: none; }
    .briefing-actions { width: 100%; justify-content: space-between; }
    .wrap { padding-bottom: 82px; }
    #dashboardTabs [data-tab="calendar"],
    #tab-calendar {
        display: none !important;
    }
}

@media (max-width: 390px) {
    .top {
        padding-inline: 10px;
    }
    .wrap {
        padding: 10px;
        gap: 10px;
        padding-bottom: 86px;
    }
    .tabs {
        gap: 4px;
        margin-bottom: 12px;
    }
    .tab-btn {
        padding: 9px 10px;
        font-size: 12px;
    }
    .card {
        padding: 14px;
        border-radius: 10px;
    }
    .card h3 {
        margin-bottom: 10px;
        font-size: 14px;
    }
    #tab-overview .kpi-row { gap: 8px; }
    .kpi {
        padding: 12px;
    }
    .kpi .lbl {
        font-size: 10px;
    }
    .kpi .val {
        font-size: 18px;
    }
    .kpi .sub {
        font-size: 11px;
    }
    .briefing-list {
        margin-left: 14px;
        gap: 10px;
    }
    .briefing-line {
        gap: 8px;
    }
    .briefing-why-btn {
        font-size: 10px;
        padding: 2px 7px;
    }
    .pos-card {
        padding: 12px;
        border-radius: 9px;
    }
    .pos-card-head {
        margin-bottom: 8px;
    }
    .pos-card-name {
        font-size: 13px;
    }
    .pos-card-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px 8px;
    }
    .pos-card-lbl {
        font-size: 10px;
    }
    .pos-card-limit {
        margin-top: 8px;
        padding-top: 7px;
        font-size: 11px;
    }
    .filters {
        width: 100%;
    }
    .search-wrap,
    .filters select,
    #exportCsv {
        width: 100%;
    }
    .search-wrap input {
        width: 100%;
    }
    .mobile-action-bar {
        left: 8px;
        right: 8px;
        bottom: 8px;
        padding: 7px;
        gap: 6px;
    }
    .mobile-action-bar .btn-ghost {
        height: 34px;
        font-size: 12px;
        padding: 0 8px;
    }
}

.mobile-action-bar {
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 40;
    display: none;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(10px);
}
.mobile-action-bar .btn-ghost {
    flex: 1;
    justify-content: center;
    height: 36px;
    font-size: 12px;
    padding: 0 8px;
}
.mobile-action-bar .btn-ghost.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(88,166,255,.12);
}
.mobile-action-bar.mobile-action-bar--hidden {
    transform: translateY(120%);
    opacity: .3;
    pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
    .mobile-action-bar {
        transition: transform .2s ease, opacity .2s ease;
    }
}
@media (max-width: 720px) {
    .mobile-action-bar { display: flex; }
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 999; pointer-events: none;
}
.toast {
    padding: 12px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
    max-width: 320px; pointer-events: auto;
    opacity: 0; transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #1a3f23; color: var(--green); border: 1px solid var(--green); }
.toast-error   { background: #4a1f1f; color: var(--red);   border: 1px solid var(--red); }
.toast-info    { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.toast-warn    { background: #4a3b1f; color: var(--yellow); border: 1px solid var(--yellow); }

/* ===== Loading Spinner ===== */
.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 60px 20px; color: var(--muted); gap: 10px;
}
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty State ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }
.empty p { margin: 0 0 24px; }
.btn-primary-lg {
    display: inline-block; padding: 12px 28px;
    background: var(--accent); color: #000;
    border: 0; border-radius: 8px; font-weight: 600;
    font-size: 15px; cursor: pointer; font: inherit;
    font-weight: 600; font-size: 15px;
}
.btn-primary-lg:hover { filter: brightness(1.08); }

/* ===== Compact Upload Bar ===== */
.upload-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-bar:hover { border-color: var(--accent); background: var(--bg-soft); }
.upload-bar input[type="file"] { display: none; }
.upload-bar-icon { font-size: 16px; }
.upload-bar-label { font-size: 13px; color: var(--muted); }
.upload-bar-status { font-size: 12px; margin-left: auto; }
.upload-bar-date { font-size: 12px; }
@media (max-width: 720px) { .upload-bar-date { display: none; } }

.banner {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 12px;
    border: 1px solid var(--yellow); background: rgba(210, 153, 34, 0.12); color: var(--yellow);
}

.api-error-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.api-error-list li {
    display: grid;
    grid-template-columns: 130px 1fr 170px;
    gap: 8px 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
}
.api-error-list li span:last-child {
    grid-column: 1 / -1;
}
@media (max-width: 900px) {
    .api-error-list li {
        grid-template-columns: 1fr;
    }
}

.api-log-box {
    margin: 10px 0 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0b0f14;
    color: #c9d1d9;
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
}

/* ===== Smart Money / Superinvestoren ===== */
/* Tabellenzelle: kompakte Badge-Reihe — letzter Nachname je Investor */
.si-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 220px;
}
.si-badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    white-space: nowrap;
    cursor: default;
}
.si-badge--add  { border-color: var(--green); color: var(--green); background: rgba(63,185,80,.10); }
.si-badge--cut  { border-color: var(--red);   color: var(--red);   background: rgba(248,81,73,.10); }
.si-badge--more { color: var(--muted); }

/* Header-Pill: Datenfrische der SI-Tabellen */
.si-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 12px;
    cursor: default;
}
.si-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px rgba(63,185,80,.55);
}
.si-dot--due { background: var(--yellow); box-shadow: 0 0 6px rgba(210,153,34,.55); }

/* Drawer-Sektion: vollständige Investorenliste */
.detail-superinvestors { margin-top: 14px; }
.detail-superinvestors h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.si-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.si-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    align-items: center;
}
.si-row-name { font-size: 13px; }
.si-row-name a { color: var(--text); }
.si-row-name a:hover { color: var(--accent); }
.si-row-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.si-pct { font-weight: 600; color: var(--text); }
.si-value { font-size: 11px; }
.si-date  { font-size: 11px; }
.si-change {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--bg);
}
.si-change--add { color: var(--green); border-color: var(--green); background: rgba(63,185,80,.10); }
.si-change--cut { color: var(--red);   border-color: var(--red);   background: rgba(248,81,73,.10); }

@media (max-width: 720px) {
    .si-badges { max-width: none; }
    .si-row { grid-template-columns: 1fr; }
    .si-row-meta { justify-content: flex-start; }
}

/* ===== Pipeline (Dividenden + Earnings) ===== */
.pipeline-card .pipeline-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    max-height: 360px;
    overflow-y: auto;
}
.pipeline-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.pipeline-item:hover,
.pipeline-item:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.pipeline-icon { font-size: 18px; text-align: center; opacity: .85; }
.pipeline-name { font-size: 13px; font-weight: 600; }
.pipeline-sub  { font-size: 11px; margin-top: 1px; }
.pipeline-right { text-align: right; min-width: 110px; }
.pipeline-date { font-size: 11px; color: var(--muted); }
.event-days {
    display: inline-block;
    padding: 2px 8px;
    margin-top: 3px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--muted);
}
.event-days--near { color: var(--yellow); border-color: var(--yellow); background: rgba(210,153,34,.10); }
.event-days--soon { color: var(--green);  border-color: var(--green);  background: rgba(63,185,80,.12); }
.pipeline-empty {
    padding: 16px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    background: var(--bg);
}
.pipeline-empty code {
    background: var(--bg-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* ===== Dividend-Yield-Spalte ===== */
.yield-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    cursor: default;
}
.yield-pill--low  { color: var(--muted); }
.yield-pill--mid  { color: var(--yellow); border-color: var(--yellow); background: rgba(210,153,34,.10); }
.yield-pill--high { color: var(--green);  border-color: var(--green);  background: rgba(63,185,80,.12); }
.yield-freq { font-size: 10px; margin-left: 3px; }

/* ===== Risiko-Card ===== */
.risk-card .row-between { margin-bottom: 8px; }
.risk-conc-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 10px 0 18px;
}
.risk-metric {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    border-top: 3px solid var(--border);
}
.risk-metric .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.risk-metric .val { font-size: 22px; font-weight: 700; margin-top: 2px; }
.risk-metric .sub { font-size: 11px; margin-top: 2px; color: var(--muted); }

/* HHI-Ampel-Coding */
.risk-hhi-green  { border-top-color: var(--green); }
.risk-hhi-green  .val { color: var(--green); }
.risk-hhi-yellow { border-top-color: var(--yellow); }
.risk-hhi-yellow .val { color: var(--yellow); }
.risk-hhi-red    { border-top-color: var(--red); }
.risk-hhi-red    .val { color: var(--red); }

.risk-card h4 {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

@media (max-width: 720px) {
    .risk-conc-row { grid-template-columns: repeat(2, 1fr); }
}

/* Drawer · Termine */
.detail-events { margin-top: 14px; }
.detail-events h4 {
    margin: 14px 0 6px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.detail-events h4:first-child { margin-top: 0; }
.ev-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ev-table th, .ev-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.ev-table th { color: var(--muted); font-weight: 600; }
.ev-table .green { color: var(--green); }
.ev-table .red   { color: var(--red); }
.ev-row-future { background: rgba(88,166,255,.06); }
.ev-row-future td:first-child { border-left: 2px solid var(--accent); }

.ev-div-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ev-div-list li {
    display: grid;
    grid-template-columns: 100px 130px 1fr;
    gap: 8px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    align-items: baseline;
}
.ev-div-list li.ev-row-future { background: rgba(88,166,255,.06); border-left: 2px solid var(--accent); padding-left: 6px; }
.ev-div-amount { font-weight: 600; }
.ev-div-meta { font-size: 11px; }

@media (max-width: 720px) {
    .pipeline-item { grid-template-columns: 24px 1fr auto; }
    .ev-div-list li { grid-template-columns: 90px 110px; }
    .ev-div-list .ev-div-meta { grid-column: 1 / -1; }
}

/* ===== Collapsible Cards ===== */
.card-collapse-body.collapsed { display: none; }
.card-toggle-btn {
    padding: 4px 8px; font-size: 13px; line-height: 1;
    transition: transform .2s;
}
.card-toggle-btn[aria-expanded="false"] { transform: rotate(-90deg); }

/* ===== Admin Form Layout ===== */
.form-stack {
    display: flex; flex-direction: column; gap: 8px;
}
.form-stack input,
.form-stack select {
    padding: 8px 10px;
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; width: 100%;
}
.form-stack input:focus,
.form-stack select:focus {
    outline: 1px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.pw-field-wrap {
    display: flex; gap: 6px; align-items: stretch;
}
.pw-field-wrap input  { flex: 1; width: auto; }
.pw-field-wrap .btn-ghost { white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 8px 10px; }

/* ===== Admin API Status ===== */
.api-status-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 15px;
}

/* ===== Admin UX Cleanup ===== */
.admin-hero .admin-title {
    margin: 0 0 6px;
    font-size: 22px;
    letter-spacing: .1px;
}
.admin-quicknav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.admin-quicknav .btn-ghost {
    text-decoration: none;
}
.admin-tab-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(88,166,255,.12);
}
.admin-ops-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.admin-op-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-soft);
}
.admin-op-card .lbl {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .45px;
    text-transform: uppercase;
}
.admin-op-card .val {
    font-size: 24px;
    font-weight: 750;
    line-height: 1.15;
    margin-top: 5px;
}
.admin-op-card .sub {
    font-size: 12px;
    margin-top: 3px;
}
.admin-danger-zone {
    border-color: color-mix(in srgb, var(--red) 45%, var(--border));
    border-top: 3px solid var(--red);
}
.danger-action {
    color: var(--red);
    border-color: color-mix(in srgb, var(--red) 55%, var(--border));
}
.danger-action:hover {
    background: rgba(248,81,73,.10);
}
#sec-api,
#sec-users,
#sec-refresh,
#sec-universe {
    scroll-margin-top: 90px;
}
#apiStatus,
#apiErrors,
#apiLog,
#autoRunResult,
#userCreateResult,
#userPwResult,
#isinRefreshResult,
#universeMeta {
    line-height: 1.55;
}

@media (max-width: 900px) {
    .admin-hero .row-between {
        align-items: flex-start;
    }
    .admin-quicknav {
        width: 100%;
    }
    .admin-ops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .admin-ops-grid {
        grid-template-columns: 1fr;
    }
}
.usage-card {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px;
}
.usage-card h4 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.usage-main { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.usage-val { font-size: 28px; font-weight: 700; color: var(--text); }
.usage-total { color: var(--muted); font-size: 14px; }
.usage-bar-bg { height: 8px; background: var(--bg-elev); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.usage-bar-fill { height: 100%; background: var(--accent); transition: width .4s ease; }
.usage-bar-fill.warn { background: var(--yellow); }
.usage-bar-fill.crit { background: var(--red); }
.usage-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }

.api-error-list { list-style: none; padding: 0; margin: 10px 0 0; }
.api-error-list li {
    display: grid; grid-template-columns: 110px 180px 140px 1fr;
    gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border);
    font-size: 13px;
}
