/* ============================================================
   Vermogensportaal — hoofdstijl
   Palet: dennengroen chrome, koel papier, messing accent
   ============================================================ */

:root {
    /* Bloomberg-terminal-palet: diep zwartblauw, amber accenten, felle pos/neg */
    --ink: #E8ECF3;            /* hoofdtekst */
    --ink-soft: #B9C2CF;
    --paper: #0B0E13;          /* paginaachtergrond */
    --card: #12161E;           /* panelen */
    --panel-deep: #05070B;     /* topbalk */
    --line: #242C39;
    --brass: #F5A623;          /* amber accent */
    --brass-dark: #FFB84D;
    --positive: #1FCE7C;
    --negative: #FF5252;
    --muted: #7C8798;
    --radius: 6px;
}

* { box-sizing: border-box; }

/* Schuifbalkruimte altijd reserveren: voorkomt dat pagina's zonder schuifbalk
   (zoals compacte instellingen) een paar pixels breder ogen en "verspringen" */
html { overflow-y: scroll; scrollbar-gutter: stable; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--paper);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 { color: var(--ink); margin-top: 0; }
h1 { font-size: 23px; }
h2 { font-size: 19px; }
h3 { font-size: 15.5px; margin-bottom: 12px; }
a { color: var(--ink); }

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 20px 60px;
    flex: 1;
}

/* ---------- Topbalk ---------- */

.topbar {
    background: var(--panel-deep);
    border-bottom: 2px solid var(--brass);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    min-height: 56px;
}
.brand {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.3px;
}
.topbar-sub { color: #A9BBB4; font-size: 12.5px; margin-left: 12px; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    padding: 9px 14px;
    border-radius: 6px;
}
.mainnav a:hover { background: rgba(255, 255, 255, 0.09); }
.mainnav a.active { background: rgba(255, 255, 255, 0.16); }

/* ---------- Kaarten & statistieken ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 14px 20px 0; }
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.card-head h3 { margin: 0; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px;
    flex: 1;
    min-width: 170px;
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.pos { color: var(--positive); }
.neg { color: var(--negative); }

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.chart-grid .card { margin-bottom: 0; }
.chart-box { position: relative; height: 260px; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; table-layout: auto; }
th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td {
    padding: 8px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.bold { font-weight: 700; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
td .pct { font-size: 11.5px; margin-left: 6px; opacity: 0.8; }
td.actions { white-space: nowrap; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #1A2029; }
.code { color: var(--brass); font-weight: 600; }

/* ---------- Formulieren ---------- */

label {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 5px;
}
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="file"], select, textarea {
    width: 100%;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0D1118;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--ink-soft);
    outline-offset: 0;
    border-color: var(--ink-soft);
}
textarea { resize: vertical; }
.field { margin-bottom: 14px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}
.form-row { display: flex; gap: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.form-narrow { max-width: 480px; }
@media (max-width: 560px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Knoppen ---------- */

.btn {
    display: inline-block;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    background: var(--ink);
    color: #fff;
    line-height: 1.35;
}
.btn:hover { background: var(--brass-dark); }
.btn-brass { background: var(--brass); }
.btn-brass:hover { background: var(--brass-dark); }
.btn-danger { background: var(--negative); }
.btn-danger:hover { background: #94302F; }
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper); }
.btn-outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.1); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-danger-text { color: var(--negative); }
form.inline { display: inline; }

/* ---------- Flash-berichten ---------- */

.flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid;
}
.flash-ok { background: rgba(31, 206, 124, 0.10); border-color: rgba(31, 206, 124, 0.35); color: var(--positive); }
.flash-error { background: rgba(255, 82, 82, 0.10); border-color: rgba(255, 82, 82, 0.35); color: var(--negative); }

/* ---------- Inlogpagina ---------- */

body.login-page { background: var(--panel-deep); justify-content: center; }
.login-wrap { width: 100%; max-width: 400px; margin: 0 auto; padding: 20px; }
.login-brand {
    text-align: center;
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    letter-spacing: 0.3px;
}
.login-sub { text-align: center; color: #A9BBB4; font-size: 13.5px; margin: 6px 0 26px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 26px; }
.login-tabs {
    display: flex;
    gap: 6px;
    background: var(--paper);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.login-tabs a {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    color: var(--ink);
}
.login-tabs a.active { background: var(--card); color: var(--brass); box-shadow: none; border: 1px solid var(--line); }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }
.btn-block { width: 100%; text-align: center; }

/* ---------- Overig ---------- */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head .meta { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-zone { border-color: #E3C6C6; }
.danger-zone h3 { color: var(--negative); }
.help-text { font-size: 13px; color: var(--muted); }
.mono {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    white-space: pre;
}

.pagefoot {
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
}
.pagefoot .container { padding: 14px 20px; }

/* ---------- Autocomplete (symboolzoeker) ---------- */

.ac-wrap { position: relative; }
.ac-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    z-index: 30;
    max-height: 320px;
    overflow-y: auto;
}
.ac-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 10px;
    align-items: baseline;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--paper);
    font-size: 13px;
}
.ac-item:last-child { border-bottom: none; }
.ac-item.active { background: var(--paper); }
.ac-symbol { font-weight: 700; color: var(--brass); white-space: nowrap; }
.ac-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-exchange { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- Transactiebadges & verloopgrafiek ---------- */

.chart-box-wide { height: 300px; }
.tx-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
}
.tx-koop     { background: rgba(31,206,124,0.14); color: var(--positive); }
.tx-verkoop  { background: rgba(255,82,82,0.14); color: var(--negative); }
.tx-dividend { background: rgba(245,166,35,0.14); color: var(--brass); }
.tx-storting { background: rgba(94,150,235,0.16); color: #6EA8FF; }
.tx-opname   { background: rgba(255,255,255,0.08); color: var(--ink-soft); }

/* ---------- DEGIRO-controletabel & dagoverzicht ---------- */

.scroll-y { max-height: 420px; overflow-y: auto; }
.row-warn td { background: rgba(245,166,35,0.08); }
.import-review td { padding: 5px 6px; }
.import-review input[type="text"], .import-review input[type="date"], .import-review select {
    padding: 5px 7px;
    font-size: 12.5px;
}
.import-review .in-ticker { width: 76px; }
.import-review .in-symbol { width: 105px; }
.import-review .in-name { min-width: 150px; }
.import-review .in-num { width: 88px; text-align: right; }
.import-review table { min-width: 1100px; }

/* ---------- Assettypes & nog te verwerken transacties ---------- */

.asset-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--paper);
    color: var(--ink-soft);
    border: 1px solid var(--line);
}
.asset-etf       { background: rgba(94,150,235,0.14); color: #6EA8FF; border-color: rgba(94,150,235,0.35); }
.asset-optie     { background: rgba(245,166,35,0.12); color: var(--brass); border-color: rgba(245,166,35,0.35); }
.asset-fonds     { background: rgba(31,206,124,0.12); color: var(--positive); border-color: rgba(31,206,124,0.35); }
.asset-obligatie { background: rgba(167,130,255,0.14); color: #B79CFF; border-color: rgba(167,130,255,0.35); }
.asset-crypto    { background: rgba(255,140,70,0.14); color: #FF9E5E; border-color: rgba(255,140,70,0.35); }

.card-pending { border-color: #E4D6AE; }
.card-pending .card-head h3 { color: var(--brass-dark); }
.pending-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pending-form input, .pending-form select { padding: 5px 7px; font-size: 12.5px; width: auto; }
.pending-form .in-ticker { width: 80px; }
.pending-form .in-symbol { width: 110px; }

/* Zoeksuggesties boven smalle velden (te-verwerken-regels) */
.ac-list { min-width: 340px; }
.pending-form .ac-wrap { position: relative; display: inline-block; }
.card-pending .table-wrap { overflow: visible; }
.card-pending table { min-width: 0; }
@media (max-width: 980px) {
    .card-pending .table-wrap { overflow-x: auto; }
}

/* ---------- Compacte, responsieve tabellen (geen horizontale scroll) ---------- */

.cell-name { max-width: 220px; }
.mult {
    font-size: 11px;
    color: var(--brass-dark);
    font-weight: 700;
    margin-left: 4px;
}
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn-sm { padding: 4px 9px; font-size: 12px; }
td.actions .btn-sm + .btn-sm,
td.actions form.inline { margin-left: 4px; }
td.actions form.inline { display: inline-block; }

.price-form { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.price-form .in-num { width: 78px; padding: 4px 6px; font-size: 12.5px; text-align: right; }
.price-form .btn-sm { padding: 4px 8px; }

/* Kolommen die op kleinere schermen mogen verdwijnen */
@media (max-width: 1150px) { .hide-lg { display: none !important; } }
@media (max-width: 950px)  { .hide-md { display: none !important; } }
@media (max-width: 760px)  { .hide-sm { display: none !important; } }

/* De controle-tabel van de DEGIRO-import blijft bewust scrollbaar (werk-scherm) */

/* ---------- Pending-melding, groepstotalen en peildatum ---------- */

.flash-warn {
    background: rgba(245,166,35,0.08);
    border-color: #E4D6AE;
    color: var(--brass-dark);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.group-total { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.peildatum-bar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom: 16px; }
.peildatum-bar label { display: inline; font-size: 13px; color: var(--muted); font-weight: 600; }
.card-peildatum { border-color: #C9D6E6; }
.card-peildatum h3 { color: #6EA8FF; }

/* ---------- Submenubalk per cliënt ---------- */

.subnav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 18px;
}
.subnav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink-soft);
}
.subnav a:hover { background: var(--paper); }
.subnav a.active { background: var(--brass); color: #0B0E13; }
.subnav-count {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--paper);
    color: var(--ink-soft);
}
.subnav a.active .subnav-count { background: rgba(255, 255, 255, 0.2); color: #fff; }
.subnav-count-warn { background: rgba(245,166,35,0.2); color: var(--brass); }
.subnav a.active .subnav-count-warn { background: rgba(0,0,0,0.25); color: #0B0E13; }

/* ---------- Uitlijningscorrecties ---------- */

/* Eerste kolom (ticker/datum) nooit afbreken */
tbody td:first-child, thead th:first-child { white-space: nowrap; }

/* Datums en badges niet laten omvallen */
.tx-badge, .asset-badge { white-space: nowrap; }

/* Cellen netjes verticaal centreren, ook bij meerregelige namen */
td { vertical-align: middle; }

/* Statistiektegels: bedragen op één regel */
.stat-value { white-space: nowrap; }
.group-total { white-space: nowrap; }

/* Namen mogen als enige wél afbreken, maar op woordgrenzen */
/* Productnamen: één regel, afkappen met … zodra de kolom vol is.
   Techniek: max-width:0 + kolombreedte op de cel — dé betrouwbare manier voor
   tabelcellen (de cel krijgt zijn deel van de tabel en knipt de inhoud af).
   Puur cosmetisch: de volledige naam blijft in de data en is zichtbaar als tooltip. */
.cell-name {
    width: 30%;
    max-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-name .clip { display: inline; max-width: none; }

/* Notitiekolom in transactielijsten: kleiner aandeel dan de naamkolom */
.cell-note {
    width: 14%;
    max-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Formuliervelden in tabellen compact en rechts uitgelijnd waar het cijfers betreft */
td .in-num { white-space: nowrap; }

/* Als een tabel door nowrap toch breder wordt dan het scherm, scrollt alleen die kaart */
.table-wrap { overflow-x: auto; }

/* ============================================================
   Mobiel-optimalisatie
   ============================================================ */

/* Extra verbergklasse voor telefoons */
@media (max-width: 560px) { .hide-xs { display: none !important; } }

/* Hoofdmenu: horizontaal scrollbaar i.p.v. omvallen */
@media (max-width: 760px) {
    .topbar-inner { flex-wrap: nowrap; gap: 12px; overflow: hidden; }
    .brand { font-size: 16px; white-space: nowrap; }
    .mainnav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mainnav::-webkit-scrollbar { display: none; }
    .mainnav a { white-space: nowrap; padding: 9px 10px; font-size: 13px; }
    .btn-outline-light { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
}

/* Submenubalk: horizontaal scrollbaar op de telefoon */
@media (max-width: 560px) {
    .subnav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .subnav::-webkit-scrollbar { display: none; }
    .subnav a { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
}

/* Statistiektegels: 2 naast elkaar op de telefoon i.p.v. lange stapel */
@media (max-width: 560px) {
    .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { min-width: 0; padding: 12px 14px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11.5px; }
    .stat-sub { font-size: 11.5px; }
}

/* Compactere pagina en tabellen op de telefoon */
@media (max-width: 560px) {
    .container { padding: 16px 12px 40px; }
    h1 { font-size: 20px; }
    .card, .card-flush { border-radius: 8px; }
    .card { padding: 14px; }
    th { padding: 7px 8px; font-size: 11px; }
    td { padding: 7px 8px; font-size: 12.5px; }
    .cell-name { width: 44%; }
    td.actions .btn-sm { padding: 4px 8px; font-size: 11.5px; }
    .chart-box { height: 210px; }
    .chart-box-wide { height: 220px; }
    .scroll-y { max-height: 320px; }
    .page-head .toolbar { width: 100%; }
    .page-head .toolbar .btn { flex: 1; text-align: center; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-row + .stat-row { margin-top: -8px; }
}

/* Klikbare rijen: subtiele feedback */
tr.rowlink:active td { background: #F2F4F1; }

/* ---------- Voortgang handmatige koersupdate ---------- */

.progress-card { margin-bottom: 18px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-head h3 { margin: 0 0 10px; }
.progress-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 14px; }
.progress-track {
    height: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--brass), var(--ink));
    border-radius: 20px;
    transition: width 0.35s ease;
}
.progress-status { margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 18px; }
.mini-log {
    margin-top: 10px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
}
.mini-log:empty { display: none; }
.mini-log-regel { white-space: nowrap; }
.log-fout { color: #A33A2E; }
.progress-card .flash { margin: 12px 0 0; }

/* Badges voor de nieuwe transactietypes */
.tx-rente  { background: rgba(110,168,255,0.14); color: #6EA8FF; }
.tx-kosten { background: rgba(255,158,94,0.14); color: #FF9E5E; }

/* ---------- Koopman Projects logo ----------
   Exact als het origineel: "Koop" zwart óp het beige vlak (het vlak is de
   achtergrond van dat tekstdeel, dus de scheiding is pixelperfect),
   "man Projects" in het wit op het dennengroen, subtitel wit eronder. */

.kp-logo { display: inline-block; line-height: 1; }
.kp-logo .kp-name {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.kp-logo .kp-k {
    display: inline-block;
    background: #D2C2B0;                 /* beige uit het originele logo */
    color: #101012;                      /* zwart, zoals het origineel */
    padding: 0.42em 0.05em 0.20em 0.35em; /* vlak steekt boven, onder en links uit */
    margin: -0.42em 0 -0.20em 0;         /* zonder de regelhoogte te verstoren */
}
.kp-logo .kp-rest { color: #fff; }
.kp-logo .kp-sub {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 1px;
}

/* Inlogpagina: groot en gecentreerd */
.kp-login {
    display: block;
    width: fit-content;
    margin: 0 auto 14px;
    padding-top: 0.42em;
    font-size: 30px;
}
.kp-login .kp-sub { font-size: 0.40em; margin-top: 1.0em; margin-left: 0.1em; }

/* Menubalk: compact */
.kp-bar { font-size: 16px; text-decoration: none; padding-top: 0.42em; margin: 2px 0 4px; }
.kp-bar .kp-sub { font-size: 0.48em; margin-top: 0.85em; color: #F2EBDF; }
.kp-bar:hover .kp-rest { color: #fff; }

@media (max-width: 760px) {
    .kp-bar { font-size: 14px; }
    .kp-bar .kp-sub { display: none; }
    .kp-login { font-size: 24px; }
}

/* ---------- Statistiekenpagina ---------- */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}
.charts-grid .card, .charts-grid .card-flush { margin-bottom: 0; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

.tx-dividendbelasting { background: rgba(255,110,110,0.12); color: #FF8A8A; }

/* Kleine %/€-schakelaar op statistiekkaarten */
.toggle-head { display: flex; align-items: center; justify-content: space-between; }
.mini-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mini-toggle button {
    border: 0; background: var(--card); padding: 3px 12px; font-size: 12.5px; cursor: pointer;
    color: var(--muted); font-weight: 600;
}
.mini-toggle button + button { border-left: 1px solid var(--line); }
.mini-toggle button.active { background: var(--brass); color: #0B0E13; }

/* Inlegpagina en lijfrente */
a.stat-link { text-decoration: none; color: inherit; display: block; cursor: pointer; transition: box-shadow .12s ease; }
a.stat-link:hover { box-shadow: 0 0 0 1px var(--brass); }
.badge-lijfrente {
    display: inline-block; background: var(--brass); color: #0B0E13;
    font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
    padding: 2px 8px; border-radius: 999px; margin-right: 8px; vertical-align: middle;
    text-transform: uppercase;
}
.progress-outer { background: rgba(255,255,255,0.08); border-radius: 999px; height: 14px; overflow: hidden; margin: 6px 0 10px; }
.progress-inner { background: var(--brass); height: 100%; border-radius: 999px; transition: width .3s ease; }

/* Datacheck en koershistorie-status */
.cov-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.cov-dot-ok { background: #1E7A46; }
.cov-dot-warn { background: #C48A4A; }
.cov-dot-err { background: #B23A3A; }
.cov-ok { color: #1E7A46; font-weight: 600; cursor: pointer; list-style: none; }
.cov-ok::-webkit-details-marker { display: none; }
.cov-open-hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 10px; }
.cov-warn { color: #8A5A2F; }
.card-compact { padding: 12px 18px; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }


/* ============================================================
   Terminal-thema (Bloomberg-stijl) — afwerkingslaag
   ============================================================ */

/* Cijfers in monospace met vaste breedte, zoals een terminal */
td.num, th.num, .stat-value, .filter-totals, .group-total, .code {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
}
.stat-value { font-size: 19px; letter-spacing: 0.2px; }
.stat-label {
    text-transform: uppercase;
    letter-spacing: 0.9px;
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 700;
}

/* Panelen: strak, dunne rand, subtiele kop */
.card, .card-flush, .stat { border: 1px solid var(--line); box-shadow: none; }
.card h3, .card-head h3 {
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 12px;
    color: var(--brass);
}
thead th {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 10.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}
tbody td { border-color: var(--line); }
.empty { color: var(--muted); }

/* Formulieren donker */
input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="number"], select, textarea {
    background: #0D1118;
    color: var(--ink);
    border: 1px solid var(--line);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.35);
}
input::placeholder, textarea::placeholder { color: #55606F; }
label { color: var(--ink-soft); }
select option { background: #12161E; }

/* Knoppen: amber primair, ghost met rand */
.btn { background: var(--brass); color: #0B0E13; border: 1px solid var(--brass); font-weight: 700; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); background: transparent; }
.btn-outline-light { border-color: var(--line); }
.btn-outline-light:hover { border-color: var(--brass); color: var(--brass); background: transparent; }

/* Links en focusaccenten */
a { color: var(--ink); }
a:hover { color: var(--brass-dark); }
.mainnav a.active { background: transparent; color: var(--brass); box-shadow: inset 0 -2px 0 var(--brass); border-radius: 0; }
.mainnav a:hover { background: rgba(245, 166, 35, 0.08); }

/* Grafiekpanelen */
.chart-box canvas { filter: none; }

/* Details/summary (koershistorie-kaart) */
details summary { color: var(--ink-soft); }
.cov-ok { color: var(--positive); }
.cov-warn { color: var(--brass); }

/* Autocomplete-lijst */
.ac-list, .ac-item { background: var(--card); color: var(--ink); }
.ac-item:hover, .ac-item.active { background: #1A2029; }

/* ---------- Mobiele navigatie: uitklappen i.p.v. scrollen ---------- */

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 17px;
    line-height: 1;
    padding: 7px 11px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
}
.subnav-toggle { display: none; }

@media (max-width: 760px) {
    /* Topbalk: hamburger + verticaal menu-paneel */
    .nav-toggle { display: inline-block; }
    .topbar .mainnav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--panel-deep);
        border-bottom: 2px solid var(--brass);
        padding: 6px 0 10px;
        z-index: 50;
        overflow: visible;
    }
    .topbar.nav-open .mainnav { display: flex; }
    .topbar .mainnav a {
        display: block;
        width: 100%;
        padding: 12px 20px;
        border-radius: 0;
        font-size: 15px;
    }
    .topbar .mainnav a.active { box-shadow: inset 3px 0 0 var(--brass); background: rgba(245, 166, 35, 0.07); }
    .topbar-inner { position: relative; flex-wrap: wrap; }

    /* Submenu's: knop met huidige pagina, opties onder elkaar */
    .subnav-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        background: var(--card);
        border: 1px solid var(--line);
        color: var(--ink);
        padding: 11px 14px;
        border-radius: 6px;
        font-size: 14.5px;
        font-weight: 600;
        cursor: pointer;
    }
    .subnav-toggle-icon { color: var(--brass); }
    .subnav-wrap { margin-bottom: 16px; }
    .subnav-wrap .subnav {
        display: none;
        flex-direction: column;
        gap: 0;
        overflow: visible;
        background: var(--card);
        border: 1px solid var(--line);
        border-top: 0;
        border-radius: 0 0 6px 6px;
        padding: 4px 0;
        margin: 0;
    }
    .subnav-wrap.open .subnav-toggle { border-radius: 6px 6px 0 0; border-bottom-color: var(--line); }
    .subnav-wrap.open .subnav { display: flex; }
    .subnav-wrap .subnav a {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 11px 16px;
        border-radius: 0;
        font-size: 14.5px;
    }
    .subnav-wrap .subnav a.active { background: transparent; color: var(--brass); box-shadow: inset 3px 0 0 var(--brass); }
}


/* ---------- Instellingenpagina: paginavullend raster ---------- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    align-items: start;
}
.settings-grid .card { margin-bottom: 0; }
.settings-grid .danger-card { border-color: rgba(255, 82, 82, 0.4); }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; cursor: pointer; }
.check-line input { width: auto; }

/* ============================================================
   Klassiek thema (het eerdere lichte ontwerp) — via body-klasse
   ============================================================ */
body.theme-klassiek {
    --ink: #16302B;
    --ink-soft: #3C5650;
    --paper: #F2F4F1;
    --card: #FFFFFF;
    --panel-deep: #16302B;
    --line: #D7DDD8;
    --brass: #9A7B2D;
    --brass-dark: #7E6423;
    --positive: #1E7A46;
    --negative: #B23A3A;
    --muted: #71837D;
}
body.theme-klassiek input[type="text"], body.theme-klassiek input[type="password"],
body.theme-klassiek input[type="email"], body.theme-klassiek input[type="date"],
body.theme-klassiek input[type="number"], body.theme-klassiek input[type="file"],
body.theme-klassiek select, body.theme-klassiek textarea { background: #fff; }
body.theme-klassiek select option { background: #fff; }
body.theme-klassiek .btn { color: #fff; }
body.theme-klassiek .btn-ghost { color: var(--ink); background: #fff; }
body.theme-klassiek .btn-ghost:hover { color: var(--brass-dark); border-color: var(--brass); background: #fff; }
body.theme-klassiek .btn-danger { color: #fff; }
body.theme-klassiek .btn-danger-text { color: var(--negative); }
body.theme-klassiek .subnav a.active { color: #fff; }
body.theme-klassiek .mini-toggle button.active { color: #fff; }
body.theme-klassiek .badge-lijfrente { color: #fff; }
body.theme-klassiek .card h3, body.theme-klassiek .card-head h3 { color: var(--brass-dark); }
body.theme-klassiek .mainnav a.active { color: #fff; box-shadow: inset 0 -2px 0 var(--brass); }
body.theme-klassiek .topbar { border-bottom-color: var(--brass); }
body.theme-klassiek tr.rowlink:hover td { background: #FAFBFA; }
body.theme-klassiek .ac-item:hover, body.theme-klassiek .ac-item.active { background: #F2F4F1; }
body.theme-klassiek .tx-opname { background: #EFEFEF; color: var(--muted); }
body.theme-klassiek .progress-outer { background: #E7EBE8; }
body.theme-klassiek .subnav-toggle { background: #fff; }
@media (max-width: 760px) {
    body.theme-klassiek .subnav-wrap .subnav { background: #fff; }
}


/* ---------- Klikbare filterknoppen (gesloten posities e.d.) ---------- */
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filter-pills .pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); color: var(--ink); font-size: 13px; font-weight: 600;
    text-decoration: none;
}
.filter-pills .pill:hover { border-color: var(--brass); color: var(--brass); }
.filter-pills .pill.active { background: var(--brass); border-color: var(--brass); color: #0B0E13; }
.filter-pills .pill-count {
    font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.10); color: inherit;
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
.filter-pills .pill.active .pill-count { background: rgba(0, 0, 0, 0.18); }
body.theme-klassiek .filter-pills .pill { background: #fff; }
body.theme-klassiek .filter-pills .pill.active {
    background: var(--brass);
    border-color: var(--brass);
    color: #fff;
}
body.theme-klassiek .filter-pills .pill-count { background: rgba(22, 48, 43, 0.08); }
body.theme-klassiek .filter-pills .pill.active .pill-count { background: rgba(255, 255, 255, 0.22); }


@media (max-width: 760px) {
    .filter-pills { gap: 9px; }
    .filter-pills .pill { padding: 9px 15px; font-size: 14px; }
}


/* ---------- Vergrendelde (informatieve) invoervelden ---------- */
input.in-locked, input.in-locked:focus {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink-soft);
    border-style: dashed;
    cursor: default;
    box-shadow: none;
    outline: none;
}
body.theme-klassiek input.in-locked, body.theme-klassiek input.in-locked:focus {
    background: #F5F6F4;
    color: var(--ink-soft);
}


/* ---------- Actiebalk (peildatum + acties): strak uitgelijnd ---------- */
.actionbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.actionbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.actionbar-right { margin-left: auto; }
.actionbar label {
    margin: 0;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    font-weight: 700;
}
.actionbar input[type="date"] { width: 150px; }
.actionbar .btn { white-space: nowrap; }
@media (max-width: 760px) {
    .actionbar-right { margin-left: 0; width: 100%; }
    .actionbar-right .btn, .actionbar-right form { flex: 1 1 auto; }
    .actionbar-right .btn { width: 100%; text-align: center; }
    .actionbar-right form .btn { width: 100%; }
}


/* ============================================================
   UX-verfijning: uitlijning, gelijke hoogtes, mobiel comfort
   ============================================================ */

/* Knoppen overal identiek uitgelijnd: flex-centrering + vaste minimumhoogte.
   Lost ongelijke knophoogtes op (tekst die wrapt, iconen, formulieren). */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    line-height: 1.25;
    text-align: center;
}
.btn-sm { min-height: 30px; }

/* Hamburger: altijd licht op de (altijd donkere) topbalk — was onzichtbaar
   in het klassieke thema (donker icoon op dennengroen) */
.nav-toggle { color: #fff; border-color: rgba(255, 255, 255, 0.35); }

/* KPI-kaarten: label boven, waarde onderaan verankerd — cijfers van
   naastliggende kaarten liggen daardoor altijd op één lijn, ook als een
   label over twee regels loopt ("Ongerealiseerd resultaat") */
.stat {
    display: flex;
    flex-direction: column;
}
.stat .stat-label { margin-bottom: 6px; }
.stat .stat-value { margin-top: auto; }
.stat .stat-sub { margin-top: 4px; }
a.stat-link { display: flex; flex-direction: column; }

@media (max-width: 760px) {
    /* KPI's: strak twee-kolomsraster; een oneven laatste kaart wordt
       paginabreed in plaats van een half gat te laten */
    .stat-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-row > .stat:last-child:nth-child(odd),
    .stat-row > a.stat-link:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .stat { padding: 12px 14px; min-height: 92px; }
    .stat-value { font-size: 16.5px; letter-spacing: 0; }
    .stat-label { font-size: 10px; letter-spacing: 0.6px; }
    .stat-sub { font-size: 11px; }

    /* Paginakop-acties: gelijkmatige knoppen in een raster i.p.v. drie
       losse kaartjes met verschillende hoogtes */
    .page-head .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .page-head .toolbar .btn { width: 100%; }
    .page-head .toolbar .btn:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
    .page-head { flex-direction: column; align-items: stretch; gap: 12px; }

    /* Actiebalk: peildatumveld vult de regel, knoppen eronder gelijkmatig */
    .actionbar-group:first-child { width: 100%; }
    .actionbar-group:first-child input[type="date"] { flex: 1 1 auto; width: auto; min-width: 0; }
    .actionbar-right { display: grid; grid-template-columns: 1fr; gap: 8px; }

    /* Typografie en ademruimte */
    h1 { font-size: 22px; }
    .container { padding-left: 14px; padding-right: 14px; padding-bottom: 48px; }
    .card, .card-flush { margin-bottom: 12px; }
    td, th { font-size: 12.5px; }
    .kp-sub { display: none; } /* ondertitel logo: geen ruimte op mobiel */
}

/* Kleine schermen: kop-actieknoppen onder elkaar zodat niets hoeft te wrappen */
@media (max-width: 430px) {
    .page-head .toolbar { grid-template-columns: 1fr; }
    .page-head .toolbar .btn:first-child:nth-last-child(odd) { grid-column: auto; }
}


/* Kop met schakelknoppen naast de grafiektitel */
.card-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.card-head-row h3 { margin: 0; }
.chart-modes button { min-height: 0; }
@media (max-width: 760px) {
    .card-head-row { flex-direction: column; align-items: stretch; }
    .chart-modes { display: flex; }
    .chart-modes button { flex: 1 1 auto; }
}


/* Cellen met een uitleg-tooltip (bijv. gebruikte wisselkoers op de peildatum) */
td.has-tip { cursor: help; }
td.has-tip > :first-child, td.has-tip { text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; }


/* ============================================================
   KPI-kaarten — Optie A: vaste zones
   Label krijgt een gereserveerde zone van twee regels, daarna het
   bedrag, daarna de subtekst. Bedragen van naast elkaar liggende
   kaarten staan daardoor altijd exact op dezelfde lijn.
   ============================================================ */
.stat, a.stat-link {
    display: grid !important;
    grid-template-rows: minmax(30px, auto) auto;
    grid-auto-rows: min-content;
    align-content: start;
    row-gap: 2px;
}
.stat .stat-label, a.stat-link .stat-label {
    align-self: start;
    margin-bottom: 0;
    line-height: 1.4;
}
.stat .stat-value, a.stat-link .stat-value {
    align-self: end;
    margin-top: 0;
}
.stat .stat-sub, a.stat-link .stat-sub {
    align-self: start;
    margin-top: 2px;
    line-height: 1.35;
}
@media (max-width: 760px) {
    .stat, a.stat-link { grid-template-rows: minmax(28px, auto) auto; }
}


/* ---------- Submenubalk: altijd één regel ----------
   De items blijven op één lijn staan; past het niet, dan schuift de balk
   horizontaal (met een subtiele vervaging aan de rand als hint). De
   beheergereedschappen zitten onder één uitklapknop, zodat de balk kort blijft. */
.subnav {
    flex-wrap: nowrap;
    overflow: visible;          /* anders klipt het uitklappaneel weg */
    align-items: center;
    position: relative;
}
/* Alleen de items schuiven; de Beheer-knop staat daarbuiten en blijft staan */
.subnav-scroll {
    display: flex;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.subnav-scroll::-webkit-scrollbar { display: none; }
.subnav-scroll > a { flex: 0 0 auto; scroll-snap-align: start; }
.subnav > details { flex: 0 0 auto; margin-left: 4px; }
.subnav a { white-space: nowrap; }

.subnav-more { position: relative; }
.subnav-more > summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink-soft);
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}
.subnav-more > summary::-webkit-details-marker { display: none; }
.subnav-more > summary::after {
    content: "▾";
    font-size: 11px;
    opacity: 0.7;
}
.subnav-more > summary:hover { background: var(--paper); }
.subnav-more.active > summary { background: var(--brass); color: #0B0E13; }
.subnav-more[open] > summary { background: var(--paper); }
.subnav-more-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 40;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.subnav-more-panel a { justify-content: space-between; }

/* Mobiel: de balk klapt al uit via de hamburger; de beheergroep wordt daar
   gewoon een blok met een kopje, zonder zwevend paneel. */
@media (max-width: 860px) {
    .subnav-wrap .subnav { overflow: visible; flex-direction: column; align-items: stretch; }
    .subnav-wrap .subnav-scroll { flex-direction: column; overflow: visible; min-width: 0; }
    .subnav-wrap .subnav-more { width: 100%; margin-left: 0; }
    .subnav-wrap .subnav-more > summary { width: 100%; }
    .subnav-wrap .subnav-more-panel {
        position: static;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--line);
        border-radius: 0;
        margin: 2px 0 2px 10px;
        padding: 0 0 0 6px;
        min-width: 0;
    }
}
body.theme-klassiek .subnav-more.active > summary { color: #fff; }


/* ============================================================
   App-modus (telefoon / op het beginscherm)
   ============================================================ */

/* Ruimte voor de notch en de thuisbalk van de iPhone */
.topbar { padding-top: env(safe-area-inset-top, 0px); }

.app-tabbar { display: none; }

@media (max-width: 760px) {
    .app-tabbar {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 60;
        background: var(--card);
        border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    }
    .app-tabbar a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 5px 2px;
        color: var(--muted);
        text-decoration: none;
        font-size: 10.5px;
        font-weight: 600;
        border-radius: 10px;
        -webkit-tap-highlight-color: transparent;
    }
    .app-tabbar a.active { color: var(--brass); }
    .app-tabbar a:active { background: var(--paper); }

    /* Hoofdmenu zit nu onderin: hamburger en topmenu niet meer nodig */
    .topbar .nav-toggle, .topbar .mainnav { display: none !important; }

    /* Inhoud niet achter de tabbalk laten verdwijnen */
    body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
    .pagefoot { display: none; }
}

/* Als geïnstalleerde app: nog iets strakker */
@media (display-mode: standalone) {
    body { -webkit-user-select: none; user-select: none; overscroll-behavior-y: none; }
    input, textarea, select, td, .stat-value { -webkit-user-select: text; user-select: text; }
}

/* Installatietip */
.app-install {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brass);
    border-radius: 12px;
    padding: 11px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    font-size: 13px;
    max-width: 520px;
    margin: 0 auto;
}
.app-install[hidden] { display: none; }
.app-install-tekst { flex: 1; line-height: 1.4; }
.app-install-sluit { background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; padding: 0 4px; }
@media (min-width: 761px) { .app-install { bottom: 18px; } }


/* Portefeuillewissel in de klantheader */
.pf-wissel { margin: 0; }
.pf-wissel select {
    background: rgba(255,255,255,0.10); color: #fff; border: 1px solid rgba(255,255,255,0.30);
    border-radius: 8px; padding: 6px 28px 6px 10px; font-size: 13px; font-weight: 600; max-width: 240px;
}
.pf-wissel select option { color: #16302B; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }


/* ---------- Profielmenu (telefoon) ----------
   Op de telefoon vervangt een rond profielicoon rechtsboven de knoppen
   "Mijn account" en "Uitloggen"; tikken opent een klein menu. */
.profielmenu { display: none; position: relative; margin-left: auto; }
.profielmenu > summary {
    list-style: none; cursor: pointer;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.30);
    -webkit-tap-highlight-color: transparent;
}
.profielmenu > summary::-webkit-details-marker { display: none; }
.profielmenu[open] > summary { background: rgba(255,255,255,0.22); }
.profielmenu-paneel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 80;
    min-width: 190px; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 6px; box-shadow: 0 12px 28px rgba(0,0,0,0.22);
    display: flex; flex-direction: column;
}
.profielmenu-paneel a {
    display: block; padding: 11px 12px; border-radius: 8px;
    color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
}
.profielmenu-paneel a:active, .profielmenu-paneel a:hover { background: var(--paper); }
.profielmenu-paneel .profielmenu-uit { color: var(--negative); border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 8px 8px; }

@media (max-width: 760px) {
    .topbar .topbar-knop { display: none; }
    .profielmenu { display: block; }
}


/* Profielmenu op de telefoon: vast in beeld, boven alles, nooit afgeknipt */
@media (max-width: 760px) {
    .profielmenu > summary { cursor: pointer; }
    .profielmenu-paneel {
        position: fixed; right: 12px; left: auto;
        top: calc(env(safe-area-inset-top, 0px) + 64px);
        z-index: 1000;
    }
    .profielmenu-paneel a { padding: 14px 14px; font-size: 15px; cursor: pointer; }
}

/* ---------- Portefeuillewissel (meerdere portefeuilles) ---------- */
.pf-balk {
    background: var(--card); border-bottom: 1px solid var(--line);
    position: relative; z-index: 30;
}
.pf-balk-inner {
    max-width: 1200px; margin: 0 auto; padding: 9px 20px;
    display: flex; align-items: center; gap: 10px;
    overflow-x: auto; scrollbar-width: none;
}
.pf-balk-inner::-webkit-scrollbar { display: none; }
.pf-balk-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
    color: var(--muted); white-space: nowrap;
}
.pf-balk form { margin: 0; flex: 0 0 auto; }
.pf-chip {
    border: 1px solid var(--line); background: var(--paper); color: var(--ink);
    border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.pf-chip:hover { border-color: var(--brass); }
.pf-chip.actief { background: var(--brass); border-color: var(--brass); color: #fff; cursor: default; }
@media (max-width: 760px) { .pf-balk-inner { padding: 8px 14px; } }

/* Knoppen in de klantbalk rechts uitlijnen (computer) */
.topbar-inner > div + .topbar-knop { margin-left: auto; }
.topbar-inner .topbar-knop + .topbar-knop { margin-left: 8px; }

/* ================================================================
   Cliëntportaal — nieuwe indeling (mobiel eerst)
   ================================================================ */

/* Hero: vermogen groot in beeld */
.hero {
    background: linear-gradient(135deg, #16302B 0%, #1F4139 100%);
    color: #fff; border-radius: 18px; padding: 20px 20px 18px; margin: 4px 0 14px;
    box-shadow: 0 10px 28px rgba(22, 48, 43, 0.18);
}
.hero-kop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-groet { font-size: 13px; opacity: .78; font-weight: 600; }
.hero-label { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; opacity: .62; margin-top: 10px; }
.hero-titel { color: #fff; font-size: 21px; margin: 4px 0 0; line-height: 1.25; }
.hero-bedrag { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 34px; font-weight: 800; letter-spacing: -1px; margin: 4px 0 10px; }
.hero-regels { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-pil { background: rgba(255,255,255,.10); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 700; }
.hero-pil.pos { color: #8BE0AE; } .hero-pil.neg { color: #FFB1A8; }
.hero-pil-sub { font-weight: 500; opacity: .7; margin-left: 2px; color: #fff; }
.prive-knop {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.28);
    background: rgba(255,255,255,.08); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.prive-knop .oog-dicht { display: none; }
.vp-prive .prive-knop .oog-open { display: none; } .vp-prive .prive-knop .oog-dicht { display: inline; }

/* Privémodus: bedragen vervagen */
.vp-prive .bedrag, .vp-prive .stat-value, .vp-prive td.num, .vp-prive .kpi-waarde {
    filter: blur(7px); transition: filter .2s; user-select: none;
}
.prive-tekst-aan { display: none; }
.vp-prive .prive-tekst-aan { display: inline; } .vp-prive .prive-tekst-uit { display: none; }

/* Compacte kerncijfers: 2 kolommen op de telefoon, 4 op de computer */
.kpi-raster { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.kpi-label { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi-waarde { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 17px; font-weight: 800; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) { .kpi-raster { grid-template-columns: 1fr 1fr; } }

/* Uitgelicht */
.uitgelicht { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.uitgelicht-kaart {
    display: flex; flex-direction: column; gap: 3px; background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--ink); min-width: 0;
}
.uitgelicht-kaart:active { transform: scale(.985); }
.uitgelicht-label { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--brass); font-weight: 700; }
.uitgelicht-naam { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uitgelicht-waarde { font-size: 13px; font-weight: 700; color: var(--muted); }
.uitgelicht-waarde.pos { color: var(--positive); } .uitgelicht-waarde.neg { color: var(--negative); }
@media (max-width: 760px) {
    .uitgelicht { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -14px 14px; padding: 0 14px; }
    .uitgelicht::-webkit-scrollbar { display: none; }
    .uitgelicht-kaart { flex: 0 0 72%; scroll-snap-align: start; }
}

/* Verdeling als balkjes */
.verdeling { display: flex; flex-direction: column; gap: 9px; }
.verdeling-rij { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 52px; align-items: center; gap: 10px; font-size: 13.5px; }
.verdeling-naam { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verdeling-balk { height: 9px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.verdeling-balk span { display: block; height: 100%; border-radius: 999px; }
.verdeling-pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.kleur-0 { background: #16302B; } .kleur-1 { background: #9A7B2D; } .kleur-2 { background: #4F7A6E; }
.kleur-3 { background: #C9A85A; } .kleur-4 { background: #7E9C93; } .kleur-5 { background: #B9C7C2; }

/* Posities als kaarten */
.sectie-kop { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 8px; }
.sectie-kop h3 { margin: 0; }
.klein { font-size: 12px; }
.posities { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 760px) { .posities { grid-template-columns: 1fr; } }
.positie-kaart {
    display: flex; flex-direction: column; gap: 5px; background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 13px 14px 11px; text-decoration: none; color: var(--ink); position: relative;
    -webkit-tap-highlight-color: transparent;
}
.positie-kaart:hover { border-color: var(--brass); }
.positie-kaart:active { transform: scale(.99); }
.pk-boven, .pk-onder { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.pk-naam { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-waarde { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-weight: 800; white-space: nowrap; }
.pk-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-res { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pk-gewicht { height: 3px; background: var(--paper); border-radius: 999px; overflow: hidden; margin-top: 3px; }
.pk-gewicht span { display: block; height: 100%; background: var(--brass); border-radius: 999px; }

/* Positiepagina */
.terug-link { display: inline-block; margin: 2px 0 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.grafiek-legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.stip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.stip-koop { background: #1E7A46; } .stip-verkoop { background: #B23A3A; }
.lijn-gak { display: inline-block; width: 18px; border-top: 2px dashed var(--brass); vertical-align: 3px; margin-right: 4px; }
.kaart-grafiek .chart-box { height: 240px; }
@media (max-width: 760px) { .kaart-grafiek .chart-box { height: 210px; } }
.samenvatting-regel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.samenvatting-regel b { font-size: 18px; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.lijst { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lijst-regel { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.lijst-regel:first-child { border-top: 0; }
.lr-links, .lr-rechts { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lr-rechts { text-align: right; align-items: flex-end; font-weight: 600; font-variant-numeric: tabular-nums; }
.lr-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.details-kaart dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.details-kaart dt { color: var(--muted); } .details-kaart dd { margin: 0; font-weight: 600; }

/* "Meer"-paneel */
.meer-achter { position: fixed; inset: 0; background: rgba(10, 20, 18, .35); z-index: 900; opacity: 0; transition: opacity .2s; }
.meer-achter.open { opacity: 1; }
.meer-paneel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 901; background: var(--card);
    border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%); transition: transform .22s ease; max-height: 82vh; overflow-y: auto;
    box-shadow: 0 -10px 30px rgba(0,0,0,.18);
}
.meer-paneel.open { transform: translateY(0); }
.meer-greep { width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 6px; }
.meer-kop { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 14px 4px 6px; }
.meer-item {
    display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; cursor: pointer;
    padding: 13px 10px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 15.5px; text-decoration: none;
}
.meer-item:active, .meer-item.actief { background: var(--paper); }
.meer-uit { color: var(--negative); }
.meer-pf { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px; }
.meer-pf form { margin: 0; }

/* Telefoon: één navigatie (de tabbalk), niets dubbel */
@media (max-width: 760px) {
    .portaal-subnav { display: none !important; }
    body.client-modus .profielmenu, body.client-modus .pf-balk { display: none !important; }
    .hero-bedrag { font-size: 30px; }
}
@media (min-width: 761px) { .meer-paneel, .meer-achter { display: none !important; } }


/* ---------- Telefoon: niets mag breder worden dan het scherm ---------- */
.posities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.positie-kaart, .kpi, .uitgelicht-kaart, .card { min-width: 0; }
.pk-boven, .pk-onder { align-items: baseline; }
.pk-naam {
    flex: 1 1 auto; min-width: 0; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3;
}
.pk-waarde, .pk-res { flex: 0 0 auto; }
.pk-sub { flex: 1 1 auto; min-width: 0; }
@media (max-width: 760px) {
    .posities { grid-template-columns: minmax(0, 1fr); }
    body.client-modus { overflow-x: clip; }   /* clip, géén hidden: hidden breekt de plakkende bovenbalk op iOS */
    body.client-modus .container { padding-left: 14px; padding-right: 14px; }
    .positie-kaart { padding: 12px 13px 10px; }
    .pk-naam { font-size: 15px; }
    .pk-waarde { font-size: 15px; }
    /* Compactere bovenbalk: meer ruimte voor je cijfers */
    body.client-modus .topbar-inner { padding-top: 8px; padding-bottom: 8px; min-height: 0; }
    body.client-modus .kp-logo .kp-name { font-size: 17px; }
    body.client-modus .kp-logo .kp-sub { display: none; }
    .kaart-grafiek .card-head-row { flex-wrap: wrap; gap: 8px; }
    .kaart-grafiek .chart-modes { width: 100%; display: flex; }
    .kaart-grafiek .chart-modes button { flex: 1; }
    .kpi-waarde { font-size: 16px; }
    .kpi { padding: 11px 12px; }
}

/* ---------- Cliëntportaal: niets mag breder worden dan het scherm ----------
   Een raster met "1fr" groeit mee met de langste tekst (bijv. een lange
   fondsnaam); "minmax(0, 1fr)" plus min-width: 0 laat die tekst inkorten. */
body.client-modus .container { overflow-x: clip; }
.posities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-raster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.uitgelicht { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.positie-kaart, .kpi, .uitgelicht-kaart, .hero { min-width: 0; }
.pk-boven, .pk-onder { align-items: baseline; }
.pk-naam, .pk-sub { flex: 1 1 auto; min-width: 0; }
.pk-waarde, .pk-res { flex: 0 0 auto; }
.pk-naam {
    white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-height: 1.3; overflow: hidden;
}
@media (max-width: 760px) {
    .posities { grid-template-columns: minmax(0, 1fr); }
    .kpi-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 11px 12px; }
    .kpi-waarde { font-size: 16px; }
    /* Uitgelicht: kaarten netjes binnen de marge laten beginnen */
    .uitgelicht { scroll-padding-left: 14px; gap: 10px; }
    .uitgelicht-kaart { flex: 0 0 78%; }
    /* Verdeling: meer ruimte voor de naam */
    .verdeling-rij { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 46px; gap: 8px; font-size: 13px; }
    .positie-kaart { padding: 12px 13px 10px; }
    .pk-waarde { font-size: 14.5px; }
}

/* Ademruimte onder lijsten (bijv. aan- en verkopen) vóór de volgende kaart */
.lijst { margin-bottom: 22px; }
.lijst + .sectie-kop { margin-top: 4px; }

/* ---------- Leningen ---------- */
.lening-looptijd { font-size: 16px; }
.lening-kaart .card-head { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 760px) {
    /* Omschrijving (hoofdsom · rente · vorm · looptijd) mag doorlopen */
    .lening-kaart .group-total { flex-basis: 100%; white-space: normal; font-size: 12.5px; line-height: 1.5; }
    /* Cijfers als zachte tegels, twee per rij — geen kader-in-kader */
    .lening-cijfers { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px 6px !important; }
    .lening-cijfers .stat {
        border: 0; box-shadow: none; background: var(--paper); border-radius: 12px;
        padding: 11px 12px; margin: 0; min-width: 0;
    }
    .lening-cijfers .stat-label { font-size: 10.5px; }
    .lening-cijfers .stat-value { font-size: 16px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .lening-cijfers .stat-sub { font-size: 11.5px; line-height: 1.35; }
    .lening-cijfers .lening-looptijd { font-size: 14px; white-space: normal; line-height: 1.3; }
    .lening-cijfers .lening-looptijd .pijl { color: var(--brass); }
    .lening-kaart details { margin: 4px 12px 12px !important; }
}


/* ---------- Alles samen / Box 3 ---------- */
.pf-kaart-form { margin: 0; }
.pf-kaart { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.jaar-keuze { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding-bottom: 2px; }
.jaar-keuze::-webkit-scrollbar { display: none; }
.jaar-keuze .pf-chip { text-decoration: none; flex: 0 0 auto; }
.box3-stappen { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; margin: 0; font-size: 14px; }
.box3-stappen dt { color: var(--ink-soft, var(--muted)); }
.box3-stappen dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.box3-stappen dt.bold, .box3-stappen dd.bold { color: var(--ink); font-weight: 800; border-top: 1px solid var(--line); padding-top: 7px; }
.box3-tip { border-left: 3px solid var(--brass); }
.box3-tabel td:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }


/* ---------- Groepen ---------- */
.groep-tabs { margin-bottom: 14px; }
.pf-chip-groep { border-style: dashed; }
.pf-chip-groep.actief { border-style: solid; }
.groep-verdelingen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-top: 14px; }
@media (max-width: 760px) { .groep-verdelingen { grid-template-columns: minmax(0, 1fr); } }
.groep-leden { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.groep-lid { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.groep-pct { white-space: nowrap; color: var(--muted); font-size: 13px; }
.groep-pct input { width: 64px; text-align: right; padding: 6px 8px; }

.kpi-link { text-decoration: none; color: inherit; display: block; }
.kpi-link:hover { border-color: var(--brass); }

.groep-banner { border-left: 3px solid var(--brass); font-size: 14px; line-height: 1.6; }

/* ---------- Verloop: periodekeuze en periodecijfers ---------- */
.bereik-balk { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 2px 0 10px; }
.bereik-balk::-webkit-scrollbar { display: none; }
.bereik-balk button {
    flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--muted);
    border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.bereik-balk button:hover { border-color: var(--brass); color: var(--ink); }
.bereik-balk button.active { background: var(--brass); border-color: var(--brass); color: #fff; }
.periode-cijfers { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pc-kop { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.pc-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.pc { min-width: 0; }
.pc-label { font-size: 11.5px; color: var(--muted); }
.pc-waarde { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .pc-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pc-waarde { font-size: 14px; } }

.lening-download { margin: 2px 14px 10px; }
@media (max-width: 760px) { .lening-download { margin: 2px 12px 10px; } .lening-download .btn { width: 100%; justify-content: center; } }

.rapport-keuze { display: inline-block; position: relative; }
.rapport-keuze > summary { list-style: none; }
.rapport-keuze > summary::-webkit-details-marker { display: none; }
.rapport-keuze .subnav-more-panel { min-width: 170px; }
