/* ============================================================
   Investment Calculator - Light cheerful dashboard
   Paleta: yellow / green / soft blue, biele pozadie
   Layout: summary chips + KPIs + grafy, parametre v modali
   ============================================================ */

:root {
    /* Backgrounds - medium gray-blue so white cards stand out clearly */
    --bg:         #dde3ec;       /* body, medium slate gray-blue */
    --surface:    #ffffff;
    --surface-2:  #f4f6fa;       /* nested / input */
    --surface-3:  #ecf0f5;

    /* Borders */
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    /* Text */
    --text:        #0f172a;
    --text-soft:   #1e293b;
    --text-muted:  #64748b;
    --text-subtle: #94a3b8;

    /* Rich, saturated accents - deeper tones across the board */
    --yellow-100: #fef9c3;
    --yellow-200: #fef08a;
    --yellow-300: #fde047;
    --yellow-400: #facc15;
    --yellow-500: #eab308;

    /* Amber - warmer, more saturated than yellow */
    --amber-100: #fef3c7;
    --amber-200: #fde68a;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --amber-700: #b45309;

    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;

    /* Emerald - deeper green variant */
    --emerald-100: #d1fae5;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;

    --sky-50:  #f0f9ff;
    --sky-100: #e0f2fe;
    --sky-200: #bae6fd;
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;
    --sky-600: #0284c7;
    --sky-700: #0369a1;
    --sky-800: #075985;

    --rose-100: #ffe4e6;
    --rose-200: #fecdd3;
    --rose-500: #f43f5e;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --rose-800: #9f1239;

    /* Violet - for inflation-adjusted series */
    --violet-100: #ede9fe;
    --violet-500: #8b5cf6;
    --violet-600: #7c3aed;
    --violet-700: #6d28d9;

    /* Orange - for fee breakdown distinction */
    --orange-100: #ffedd5;
    --orange-500: #f97316;
    --orange-600: #ea580c;

    /* === Chart-palette tones (match line/donut chart colors) ===
       Used by Detail výpočtu tiles so each tile visually maps to its
       corresponding line/series in the chart. */
    /* Gold (rgb 255,209,62 - "Vložený kapitál" line) */
    --tone-gold-bg:           rgba(255, 209, 62, 0.16);
    --tone-gold-text:         rgb(180, 130, 8);
    --tone-gold-text-strong:  rgb(140, 100, 6);
    --tone-gold-chip-bg:      rgba(255, 209, 62, 0.30);
    --tone-gold-chip-border:  rgba(180, 130, 8, 0.40);
    /* Olive (rgb 148,174,10 - "Investovaný kapitál" line) */
    --tone-olive-bg:          rgba(148, 174, 10, 0.11);
    --tone-olive-text:        rgb(110, 130, 8);
    --tone-olive-text-strong: rgb(85, 105, 4);
    --tone-olive-chip-bg:     rgba(148, 174, 10, 0.18);
    --tone-olive-chip-border: rgba(110, 130, 8, 0.40);
    /* Navy (rgb 17,95,166 - "Hodnota majetku" line/donut) */
    --tone-navy-bg:           rgba(17, 95, 166, 0.08);
    --tone-navy-text:         rgb(17, 95, 166);
    --tone-navy-text-strong:  rgb(11, 70, 130);
    --tone-navy-chip-bg:      rgba(17, 95, 166, 0.13);
    --tone-navy-chip-border:  rgba(17, 95, 166, 0.32);
    /* Emerald (rgb 51,101,5 - "Výnosy" donut color) */
    --tone-emerald-bg:           rgba(51, 101, 5, 0.10);
    --tone-emerald-text:         rgb(51, 101, 5);
    --tone-emerald-text-strong:  rgb(38, 76, 3);
    --tone-emerald-chip-bg:      rgba(51, 101, 5, 0.16);
    --tone-emerald-chip-border:  rgba(51, 101, 5, 0.35);

    /* Promoted tokens - point at the richer shade */
    --primary:        var(--sky-600);
    --primary-hover:  var(--sky-700);
    --success:        var(--green-600);
    --success-deep:   var(--green-700);
    --accent:         var(--amber-500);
    --accent-deep:    var(--amber-600);
    --danger:         var(--rose-600);
    --danger-deep:    var(--rose-700);
    --info:           var(--violet-600);

    --radius:    12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 9999px;
    --shadow-xs: 0 1px 2px rgba(15,23,42,0.06);
    --shadow-sm: 0 2px 6px rgba(15,23,42,0.08);
    --shadow:    0 2px 6px rgba(15,23,42,0.06), 0 8px 20px rgba(15,23,42,0.08);
    --shadow-lg: 0 20px 60px rgba(15,23,42,0.16), 0 6px 14px rgba(15,23,42,0.08);
}

/* ============================================================
   Globals
   ============================================================ */
* { box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    padding: 0;
    margin: 0;
}
.mono, .number, .kpi-value, input.form-control {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ============================================================
   Site header - sticky, logo + nav + actions
   ============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}
@media (max-width: 767px) {
    .site-header-inner { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--amber-500);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.35);
}
.brand-logo {
    display: block;
    height: 36px;
    width: auto;
    max-width: 220px;
    flex-shrink: 0;
}
@media (max-width: 575px) {
    .brand-logo { height: 30px; max-width: 160px; }
}
.brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
@media (max-width: 575px) {
    .brand-text { display: none; }
}
.main-nav {
    display: flex;
    gap: 2px;
    margin-left: auto;
    align-items: center;
}
.main-nav .nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}
.main-nav .nav-link:hover { background: var(--surface-2); color: var(--text); }
.main-nav .nav-link.active {
    color: var(--sky-700);
    background: var(--sky-100);
    font-weight: 600;
}

/* Nav dropdown (Nástroje) */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}
.nav-dropdown-toggle .nav-chevron {
    width: 10px;
    height: 10px;
    transition: transform 0.2s ease;
    color: var(--text-subtle);
}
.nav-dropdown.is-open .nav-dropdown-toggle .nav-chevron { transform: rotate(180deg); }
.nav-dropdown.is-open .nav-dropdown-toggle { background: var(--surface-2); color: var(--text); }

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    z-index: 110;
}
.nav-dropdown.is-open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
}
.nav-dropdown-section + .nav-dropdown-section {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 6px;
}
.nav-dropdown-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding: 8px 12px 4px;
}
.nav-dropdown-item {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    transition: background-color 0.12s, color 0.12s;
}
.nav-dropdown-item:hover {
    background: var(--surface-2);
    color: var(--sky-700);
}
.nav-dropdown-item.active {
    color: var(--sky-700);
    background: var(--sky-50);
    font-weight: 600;
}
@media (max-width: 575px) {
    .nav-dropdown-menu { min-width: 200px; right: 0; left: auto; }
}
.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}
/* Language switcher (SK / EN pill) */
.lang-switcher {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 2px;
    margin: 0;
}
.lang-switcher .lang-btn {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}
.lang-switcher .lang-btn:hover { color: var(--text); }
.lang-switcher .lang-btn.active {
    background: var(--sky-600);
    color: white;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.30);
}
@media (max-width: 575px) {
    .lang-switcher .lang-btn { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 767px) {
    .header-actions .btn-action { padding: 8px 10px; font-size: 12px; }
}

/* Hide the original BS3 navbar from old base.html (no longer rendered) */
.navbar.header, header.navbar { display: none !important; }
.container[style] { margin-top: 0 !important; }

/* ============================================================
   App layout
   ============================================================ */
.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}
@media (max-width: 767px) {
    .app { padding: 18px 14px 40px; }
}

/* ============================================================
   Page title
   ============================================================ */
.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 22px;
}
.page-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: var(--amber-500);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.35);
}
.page-title h1 {
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ============================================================
   Banking dashboard cards - big rounded white cards with shadow.
   Page bg gray so cards "float". Generous padding.
   ============================================================ */
.summary-card {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px 28px;
    margin: 0 0 18px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    flex: 1 1 auto;
    min-width: 0;
}
.param-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.param-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.param-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.btn-edit-params {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-edit-params:hover {
    background: var(--sky-50);
    border-color: var(--sky-600);
    color: var(--sky-700);
}
.btn-edit-params::before {
    content: "✎";
    font-size: 14px;
}

/* ============================================================
   KPI cards - separate floating banking-style cards
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 0 0 18px 0;
    border: 0;
}
.kpi-card {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: transparent;
}
.kpi-card.kpi-primary::before { background: var(--sky-600); }
.kpi-card.kpi-success::before { background: var(--green-600); }
.kpi-card.kpi-warning::before { background: var(--amber-500); }
.kpi-card.kpi-danger::before  { background: var(--rose-600); }
.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 10px 0;
    text-transform: none;
    letter-spacing: 0;
}
.kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
/* Legacy base.css has `#ifvn { font-size: 24px; padding: 15px; }` which
   ID-specificity-wins over .kpi-value. Override it so Reálna kúpna sila
   matches the other big KPI values in size and rhythm. */
.kpi-card #ifvn {
    font-size: 30px;
    padding: 0;
}
.kpi-card.kpi-primary .kpi-value { color: var(--sky-700); }
.kpi-card.kpi-success .kpi-value { color: var(--green-700); }
.kpi-card.kpi-warning .kpi-value { color: var(--amber-600); }
.kpi-card.kpi-danger  .kpi-value { color: var(--rose-700); }

/* € suffix for currency KPI primary values (not percentages) */
.kpi-card .kpi-value.fvn::after,
.kpi-card .kpi-value.pln::after,
.kpi-card #ifvn::after,
.kpi-card .kpi-value.pvn::after {
    content: " €";
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.55em;
    margin-left: 3px;
    letter-spacing: 0;
}
/* + prefix for the netto profit value in success KPI (only when populated) */
.kpi-card.kpi-success .kpi-value.pln:not(:empty)::before { content: "+"; }
.kpi-card.kpi-success .kpi-value-aux.plpn:not(:empty)::before { content: "+"; }
.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: auto;        /* push to bottom so 3 cards align */
    padding-top: 8px;
}
/* Make the card a vertical column so kpi-sub sticks to the bottom and
   the 3 cards have consistent rhythm even when one has more rows. */
.kpi-card {
    display: flex;
    flex-direction: column;
}

/* Aux value under the big primary (e.g. netto % for Výnos card) */
.kpi-value-aux {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-top: 2px;
    min-height: 1.15em;      /* reserve space even if empty (&nbsp;) */
}
.kpi-card.kpi-success .kpi-value-aux { color: var(--green-600); }
.kpi-card.kpi-primary .kpi-value-aux { color: var(--sky-600); }
.kpi-card.kpi-warning .kpi-value-aux { color: var(--amber-600); }

/* Secondary support row (Brutto X € / Nominálne X €) - clean inline groups
   that don't break in awkward places. Each group keeps its pieces together
   via white-space:nowrap, while the line itself can wrap between groups.
   Bumped up font sizes so the brutto/nominálne values feel like a real
   secondary headline, not a footnote. */
.kpi-secondary {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    font-variant-numeric: tabular-nums;
}
.kpi-secondary-group {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.kpi-secondary-tag {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 999px;
    line-height: 1.3;
}
.kpi-secondary-value {
    color: var(--text-soft);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}
.kpi-secondary-value::after {
    content: " €";
    font-weight: 500;
    color: var(--text-subtle);
    font-size: 0.85em;
    margin-left: 1px;
}
.kpi-secondary-pct {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}
.kpi-secondary-pct::before { content: "("; color: var(--text-subtle); }
.kpi-secondary-pct::after  { content: ")"; color: var(--text-subtle); }

/* ============================================================
   Surface - banking card style
   ============================================================ */
.surface {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin: 0 0 18px 0;
    overflow: hidden;
}
.surface-head {
    padding: 22px 28px 0;
    border: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.surface-head > h2 {
    grid-column: 2;
    text-align: center;
    font-size: 19px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
}
.surface-head > .table-view-toggle {
    grid-column: 3;
    justify-self: end;
}
@media (max-width: 575px) {
    .surface-head {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .surface-head > h2,
    .surface-head > .table-view-toggle {
        grid-column: 1;
        justify-self: center;
    }
}
.surface-body { padding: 18px 28px 26px; }

/* Table view-mode toggle (Po obdobiach / Po rokoch) - same pill style
   as the chart-type-toggle so the page reads consistently */
.table-view-toggle {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
}
.table-view-toggle button {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.table-view-toggle button:hover { color: var(--text); }
.table-view-toggle button.active {
    background: var(--sky-600);
    color: white;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.35);
}

/* Chart blocks - same banking card style */
.chart-block {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    padding: 22px 28px 26px;
    box-shadow: var(--shadow);
    margin: 0 0 18px 0;
}
.chart-block h3 {
    font-size: 19px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    text-align: center;
}
.chart-block-head {
    padding: 0 0 18px 0;
    border: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.chart-block-head > h3 { grid-column: 2; }
.chart-block-head > .chart-type-toggle {
    grid-column: 3;
    justify-self: end;
}
@media (max-width: 575px) {
    .chart-block-head {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .chart-block-head > h3,
    .chart-block-head > .chart-type-toggle {
        grid-column: 1;
        justify-self: center;
    }
}
.dashboard-results #chart1, .dashboard-results #chart2 { background: transparent; margin: 0; padding: 0; }
.dashboard-results #chart1 canvas, .dashboard-results #chart2 canvas { background-color: var(--surface) !important; }
.dashboard-results #pcharts {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    padding: 22px 28px 26px;
    box-shadow: var(--shadow);
    margin: 0 0 18px 0;
    width: 100%;
}
.dashboard-results #pcharts > h3 {
    font-size: 19px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding-bottom: 0 !important;
    border: 0 !important;
    margin: 0 0 18px 0 !important;
    text-align: center !important;
}

/* Donut chart grid - clean tile layout */
.dashboard-results #pcharts > .row {
    --bs-gutter-x: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.dashboard-results #pcharts > .row + .row { margin-top: 14px; }
@media (min-width: 768px) {
    /* On desktop force 3 per row for clean 3x2 layout */
    .dashboard-results #pcharts > .row { grid-template-columns: repeat(3, 1fr); }
}
.dashboard-results #pcharts .col-md-4 {
    padding: 14px 12px;
    text-align: center;
    background: var(--surface-2);
    border-radius: var(--radius);
    width: auto;
    max-width: none;
    flex: none;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}
.dashboard-results #pcharts .col-md-4:empty { display: none; }

/* Canvas sized smaller and centered */
.dashboard-results #pcharts canvas {
    max-width: 140px !important;
    max-height: 140px !important;
    width: 140px !important;
    height: 140px !important;
    display: block;
    margin: 0 auto;
}
.dashboard-results #pcharts [id^="chart-canvas"] {
    width: 100%;
    text-align: center;
}

/* Compact legend below each donut */
.dashboard-results #pcharts [id^="chart-legend-"] {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-muted);
    margin-top: 10px;
    padding: 0;
    border: 0;
    display: block;
}
.dashboard-results #pcharts [id^="chart-legend-"] > div { margin: 0; }
.dashboard-results #pcharts [id^="chart-legend-"] > div > div {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    text-align: left;
}
.dashboard-results #pcharts .pie-chart-legend {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    font-size: 0 !important;
    flex-shrink: 0;
}

/* Custom HTML tooltip for Chart.js v1 doughnuts - swatch + 2-line text */
#chartjs-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.30), 0 2px 6px rgba(15, 23, 42, 0.18);
    transform: translate(-50%, -100%) translateY(-12px);
    transition: opacity 0.12s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
#chartjs-tooltip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(15, 23, 42, 0.96);
}
#chartjs-tooltip .ct-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
#chartjs-tooltip .ct-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#chartjs-tooltip .ct-label {
    font-weight: 600;
    font-size: 12px;
    color: #fff;
    letter-spacing: 0.01em;
}
#chartjs-tooltip .ct-value {
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    font-weight: 500;
}
#chartjs-tooltip .ct-pct {
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    margin-left: 4px;
}

/* Empty-state placeholder when a donut has no data to show */
.pchart-empty {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px dashed var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-subtle);
    font-size: 11px;
    text-align: center;
    padding: 0 12px;
    line-height: 1.3;
    box-sizing: border-box;
}
.dashboard-results .chart-title {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
/* Chart legend - generated by Chart.js v1 with inline float:left.
   Each item is a clickable toggle (handled by update_data() in tools.js
   which uses fadeTo to opacity 0.33 for disabled). */
.dashboard-results .chart-legend {
    padding: 14px 4px 4px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
}
.dashboard-results .chart-legend [class*="-legend"] {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.dashboard-results .chart-legend [class*="-legend"] > div {
    float: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dashboard-results .chart-legend [class*="-legend"] > div:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}
.dashboard-results .chart-legend [class*="-legend"] span {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    font-size: 0 !important;
    flex-shrink: 0;
}
.dashboard-results .chart-legend [class*="-legend"] a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}
.dashboard-results .chart-legend [class*="-legend"] [style*="clear:both"] { display: none; }
.dashboard-results .chart-legend .legend-disabled {
    background: var(--surface-3) !important;
    border-color: var(--border) !important;
}
.dashboard-results .chart-legend .legend-disabled a { color: var(--text-subtle) !important; text-decoration: line-through; }

/* ============================================================
   Chart type toggle (Line / Bar) above the chart
   ============================================================ */
.chart-type-toggle {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
}
.chart-type-toggle button {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.chart-type-toggle button:hover { color: var(--text); }
.chart-type-toggle button.active {
    background: var(--sky-600);
    color: white;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.35);
}

/* Legacy .number-box (kept as fallback for rent-result) */
.dashboard-results .number-box {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 14px;
    color: var(--text);
}
.dashboard-results .number-box table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}
.dashboard-results .number-box table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.dashboard-results .number-box table tr:last-child td { border-bottom: 0; }
.dashboard-results .number-box .number {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.dashboard-results .number-box .bold { font-weight: 700; }
.dashboard-results .number-box .fl-label {
    margin-top: 18px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sky-600);
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.dashboard-results .number-box .fl-bottom {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 4px;
}

/* ============================================================
   Detail výpočtu - 2x2 grid of tiles + fees block
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 22px;
    border: 0;
}
@media (max-width: 575px) {
    .detail-grid { grid-template-columns: 1fr; }
}
.detail-tile {
    background: var(--surface-2);
    border: 0;
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: background-color 0.15s;
}
/* Chart-palette tones - each detail tile maps to a chart series color */
.detail-tile.tone-gold  { background: var(--tone-gold-bg);  }
.detail-tile.tone-olive { background: var(--tone-olive-bg); }
.detail-tile.primary    { background: var(--tone-navy-bg); }     /* Hodnota majetku → navy */
.detail-tile.success    { background: var(--tone-emerald-bg); }  /* Výnos → emerald */
.detail-tile-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.detail-tile-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
}
.detail-tile-value::after { content: " €"; font-weight: 500; color: var(--text-muted); font-size: 0.7em; margin-left: 2px; }
.detail-tile.tone-gold  .detail-tile-value { color: var(--tone-gold-text-strong); }
.detail-tile.tone-olive .detail-tile-value { color: var(--tone-olive-text-strong); }
.detail-tile.primary    .detail-tile-value { color: var(--tone-navy-text-strong); }
.detail-tile.success    .detail-tile-value { color: var(--tone-emerald-text-strong); }
.detail-tile.success    .detail-tile-value::before { content: "+"; }
.detail-tile-sub {
    font-size: 10px;
    color: var(--text-subtle);
    margin-top: 4px;
}

/* Brutto / Netto pair inside a detail tile */
.detail-pair {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 2px 0 4px;
}
.detail-pair-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.detail-pair-tag {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.4;
    flex-shrink: 0;
}
.detail-pair-tag.is-primary {
    color: var(--tone-navy-text-strong);
    background: var(--tone-navy-chip-bg);
    border-color: var(--tone-navy-chip-border);
}
.detail-pair-tag.is-success {
    color: var(--tone-emerald-text-strong);
    background: var(--tone-emerald-chip-bg);
    border-color: var(--tone-emerald-chip-border);
}
.detail-pair-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
}
.detail-pair-value::after {
    content: " €";
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.7em;
    margin-left: 2px;
}
.detail-pair-value.is-primary { color: var(--tone-navy-text-strong);    font-size: 20px; }
.detail-pair-value.is-success { color: var(--tone-emerald-text-strong); font-size: 20px; }
.detail-pair-value.is-success::before { content: "+"; }
.detail-pair-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-left: -2px;
}
.detail-pair-pct.is-success { color: var(--tone-emerald-text-strong); }
.detail-pair-pct::before { content: "("; color: var(--text-subtle); }
.detail-pair-pct::after { content: ")"; color: var(--text-subtle); }

/* Fees block */
.fees-block {
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.fees-block-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px 0;
}
.fees-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text);
}
.fees-row + .fees-row { border-top: 1px solid var(--border); }
.fees-row.total {
    border-top: 2px solid var(--text);
    padding-top: 10px;
    margin-top: 6px;
    font-weight: 700;
    font-size: 14px;
}
.fees-row .fees-label { color: var(--text); }
.fees-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.fees-value::after { content: " €"; font-weight: 500; color: var(--text-muted); font-size: 0.85em; margin-left: 2px; }
.dashboard-results .green { color: var(--green-600); }
.dashboard-results .pl-box, .dashboard-results .number-box-label,
.dashboard-results .text-box-sublabel,
.dashboard-results .investment-result > .row > .col-md-4,
.dashboard-results .rent-result > .row > .col-md-4 { display: none; }

.calc-result-title h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 14px 0;
    text-align: left;
}

/* ============================================================
   Custom data table - replaces DataTables. Lightweight, no jQuery
   plugin, all strings come from Django templates. Features:
   - Column visibility toggles (checkboxes in toolbar)
   - Page size selector + prev/next pagination
   - Zebra striping + hover, sticky-ish header
   ============================================================ */
.dt-wrap {
    font-size: 13px;
    width: 100%;
}
/* Toolbar above the table - checkboxes for column visibility */
.dt-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 0 0 14px 0;
    padding: 0 0 14px 0;
    border-bottom: 1px solid var(--border);
}
.dt-toolbar-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
}
/* Toggles laid out as columns (top-to-bottom, then next column).
   `.cols-3` (default) → 3 items per column, 3 columns wide.
   `.cols-4` → 2 items per column, 4 columns wide (used by rent table). */
.dt-col-toggles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    gap: 8px 18px;
    width: 100%;
}
.dt-col-toggles.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, auto);
}
@media (max-width: 767px) {
    .dt-col-toggles,
    .dt-col-toggles.cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-flow: row;
    }
}
@media (max-width: 479px) {
    .dt-col-toggles,
    .dt-col-toggles.cols-4 {
        grid-template-columns: 1fr;
    }
}
.dt-col-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text);
    margin: 0;
    user-select: none;
}
.dt-col-toggle input[type="checkbox"] {
    accent-color: var(--sky-600);
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}
.dt-col-toggle.is-off { color: var(--text-subtle); }

/* The table itself */
.dt-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.dt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}
.dt-table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: right;
    white-space: nowrap;
}
/* Left-align the # and date columns */
.dt-table thead th.dt-th-left,
.dt-table tbody td.dt-td-left {
    text-align: left;
}
.dt-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    text-align: right;
    white-space: nowrap;
}
.dt-table tbody tr:nth-child(even) td { background: #f8fafc; }
.dt-table tbody tr:hover td { background: var(--surface-2); }
.dt-table tbody tr:last-child td { border-bottom-color: transparent; }
.dt-table .dt-empty td {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 24px 12px;
    background: var(--surface);
}

/* Footer - page size + info + pagination */
.dt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.dt-page-size-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.dt-page-size {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='%2364748b' d='M2 4l4 4 4-4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
}
.dt-info {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex: 1 1 auto;
    text-align: center;
    min-width: 100px;
}
.dt-pagination {
    display: inline-flex;
    gap: 4px;
}
.dt-pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}
.dt-pagination button:hover:not(:disabled) {
    background: var(--sky-600);
    color: white;
    border-color: var(--sky-600);
}
.dt-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 575px) {
    .dt-footer { flex-direction: column; align-items: stretch; }
    .dt-info { text-align: left; }
    .dt-page-size-wrap, .dt-pagination { justify-content: space-between; }
}

/* ===========================================================
   Contact page — friendly hero header + clean form
   =========================================================== */
.contact-card {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    max-width: 720px;
    margin: 0 auto;
    overflow: hidden;
}
.contact-header {
    text-align: center;
    padding: 40px 32px 28px;
    background: linear-gradient(180deg, var(--sky-50) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}
.contact-header-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: var(--sky-600);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.30);
}
.contact-header-icon svg { width: 32px; height: 32px; }
.contact-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}
.contact-subtitle {
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.5;
    margin: 0;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}
.contact-body { padding: 28px 32px 32px; }

/* Form layout */
.contact-form .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.contact-form .field:last-child { margin-bottom: 0; }
.contact-form .field > label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-soft);
    text-transform: none;
    letter-spacing: 0;
}
.contact-form .form-control {
    height: 42px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.contact-form .form-control:focus {
    border-color: var(--sky-600);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    outline: none;
}
.contact-form textarea.form-control {
    height: auto;
    min-height: 140px;
    padding: 12px 14px;
    line-height: 1.55;
    resize: vertical;
    font-family: inherit;
}
.contact-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 575px) {
    .contact-row-2col { grid-template-columns: 1fr; gap: 0; }
    .contact-header { padding: 32px 22px 22px; }
    .contact-body { padding: 22px 22px 26px; }
    .contact-title { font-size: 21px; }
}

/* Submit button — sky pill with arrow */
.contact-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.contact-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--sky-600);
    color: #fff;
    border: 0;
    padding: 0 24px;
    height: 44px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.30);
    transition: background-color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.contact-submit:hover {
    background: var(--sky-700);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.40);
}
.contact-submit:active { transform: translateY(1px); }
.contact-submit svg {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}
.contact-submit:hover svg { transform: translateX(2px); }

/* Errors */
.field-error {
    color: var(--rose-600);
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}
.contact-error {
    background: var(--rose-100);
    color: var(--rose-700);
    border: 1px solid var(--rose-200);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
}

/* Success state */
.contact-success {
    text-align: center;
    padding: 24px 12px 16px;
}
.contact-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--green-100);
    color: var(--green-700);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.contact-success-icon svg { width: 32px; height: 32px; }
.contact-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px 0;
    letter-spacing: -0.01em;
}
.contact-success p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

/* Floating action stack (bottom-right): share FAB on top, scroll-top below.
   Both share `.floating-btn` baseline; `.scroll-top` is only visible after
   the user has scrolled down, share is always visible. */
.floating-actions {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}
.floating-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sky-600);
    color: #fff;
    border: 0;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35), 0 2px 4px rgba(15, 23, 42, 0.15);
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.floating-btn:hover {
    background: var(--sky-700);
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.45), 0 2px 4px rgba(15, 23, 42, 0.18);
}
.floating-btn svg { width: 22px; height: 22px; display: block; }
@media (max-width: 575px) {
    .floating-actions { right: 14px; bottom: 14px; gap: 8px; }
    .floating-btn { width: 40px; height: 40px; }
    .floating-btn svg { width: 20px; height: 20px; }
}

/* Scroll-to-top — hidden until scrolled */
.scroll-top {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s, background-color 0.15s, box-shadow 0.15s;
}
.scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s, background-color 0.15s, box-shadow 0.15s;
}
.scroll-top:hover svg { transform: translateY(-1px); transition: transform 0.15s ease; }

/* Share FAB + popover */
.share-fab-wrap { position: relative; }
.share-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.10);
    padding: 8px;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
.share-popover.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.share-popover-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px 6px;
}
.share-popover .share-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.12s, color 0.12s;
}
.share-popover .share-item:hover {
    background: var(--surface-2);
    color: var(--sky-700);
}
.share-popover .share-item-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--text-muted);
}
.share-popover .share-item:hover .share-item-icon { color: var(--sky-700); }

/* Toast notification (used for "Link copied" etc.) */
.toast-notify {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.30);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.toast-notify.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Section divider - visually separates major page sections (e.g. the
   "Plán výberu" block from the investment results above). Horizontal
   line with a centered label, like a chapter mark. */
.section-divider {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 40px 0 28px;
}
.section-divider::before,
.section-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border-strong);
}
.section-divider-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0 6px;
    white-space: nowrap;
}

/* Results hidden until calc */
#investment-result, #rent-result, #i-table-result, #r-table-result, #i-warning { display: none; }
#i-warning .number-box { color: var(--rose-600); }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
#investment-result.fade-in, #rent-result.fade-in,
#i-table-result.fade-in, #r-table-result.fade-in {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Loading */
.results-loading {
    display: none;
    padding: 80px 24px;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 18px;
}
.results-loading.active { display: block; }
.results-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--sky-600);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}
.results-loading .spinner-label { font-size: 13px; font-weight: 600; color: var(--text); }
.results-loading .spinner-sublabel { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Action buttons (Share, Save, Recalc)
   ============================================================ */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.btn-action {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-action:hover {
    background: var(--surface-2);
    border-color: var(--text-muted);
}
.btn-action.primary {
    background: var(--sky-600);
    color: white;
    border-color: var(--sky-600);
    box-shadow: 0 3px 8px rgba(2,132,199,0.35);
}
.btn-action.primary:hover {
    background: var(--sky-700);
    border-color: var(--sky-700);
    color: white;
}

/* ============================================================
   Modal - parameter editor
   ============================================================ */
.modal-content {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.modal-header .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.modal-header .btn-close {
    background: var(--surface-2);
    border-radius: 50%;
    padding: 8px;
    opacity: 0.7;
}
.modal-header .btn-close:hover { opacity: 1; }
.modal-body { padding: 22px; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.modal-dialog { max-width: 860px; }
.modal-dialog-scrollable .modal-content { max-height: 86vh; }
.modal-dialog-scrollable .modal-body { overflow-y: auto; }
@media (max-width: 959px) {
    .modal-dialog { max-width: 92vw; }
}
@media (max-width: 575px) {
    .modal-dialog { margin: 0.5rem; max-width: calc(100vw - 1rem); }
    .modal-content { border-radius: 16px; }
}

/* ============================================================
   Modal tabs - subtle rectangular style, always-visible checkboxes
   ============================================================ */
.modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border: 0;
    margin: 0 0 22px 0;
    padding: 0;
    list-style: none;
}
.modal-tabs .nav-item { flex: 0 1 auto; margin: 0; }
.modal-tabs .nav-link {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}
.modal-tabs .nav-link:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}
.modal-tabs .nav-link.active {
    background: var(--surface-2);
    border-color: var(--text);
    color: var(--text);
    font-weight: 600;
}

/* Custom checkbox - always white bg with gray border, sky fill when checked.
   !important needed to override the global iCheck-bypass rules. */
.modal-tabs .nav-link input[type="checkbox"],
.modal-tabs .nav-link .icheckbox_square-blue > input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 20px !important;
    height: 20px !important;
    border: 1.5px solid var(--border-strong) !important;
    border-radius: 4px !important;
    background: var(--surface) !important;
    cursor: pointer !important;
    position: relative !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: background-color 0.12s, border-color 0.12s;
    accent-color: initial !important;
}
.modal-tabs .nav-link input[type="checkbox"]:hover {
    border-color: var(--text-muted) !important;
}
.modal-tabs .nav-link input[type="checkbox"]:checked {
    background: var(--sky-600) !important;
    border-color: var(--sky-600) !important;
}
.modal-tabs .nav-link input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    top: 2px;
    left: 6px;
}

/* Mobile: slightly larger tap targets */
@media (max-width: 575px) {
    .modal-tabs { gap: 5px; }
    .modal-tabs .nav-link { padding: 9px 12px; font-size: 13px; gap: 8px; }
}

/* Suppress legacy iCheck wrapper if it tries to wrap these checkboxes */
.modal-tabs .nav-link .icheckbox_square-blue {
    background: none !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    display: inline-flex !important;
}
.modal-tabs .nav-link input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--sky-600);
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}
.modal-tabs .nav-link .icheckbox_square-blue,
.modal-tabs .nav-link .iradio_square-blue { flex: 0 0 auto; }

.modal-tab-content {
    min-height: 200px;
}
.modal-tab-content .tab-pane {
    padding: 4px 0;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 16px;
}
.field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal form fields: single column, label LEFT + input RIGHT.
   Stack to column on mobile (label above input). */
.modal-tab-content .input-grid,
#calc-advanced .adv-section .input-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}
.modal-tab-content .field {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    align-items: center;
    gap: 16px;
    flex-direction: row;
}
.modal-tab-content .field > label {
    margin: 0;
    text-align: left;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
/* Advanced settings inside the 2-col grid are narrow, so stack label
   over input for readability instead of forcing a horizontal split. */
#calc-advanced .field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
#calc-advanced .field > label {
    margin: 0;
    text-align: left;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
@media (max-width: 575px) {
    .modal-tab-content .field {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .modal-tab-content .field > label {
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 600;
    }
}
.field .form-control,
.modal .form-control {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.field .form-control:focus,
.modal .form-control:focus {
    border-color: var(--sky-600);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.22);
    outline: none;
}

/* Primary action - amber CTA, saturated */
.btn-calculate {
    background: var(--amber-500);
    border: 0;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 0 26px;
    height: 42px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(217,119,6,0.40);
    transition: background-color 0.12s, transform 0.05s, box-shadow 0.12s;
}
.btn-calculate:hover, .btn-calculate:focus {
    background: var(--amber-600);
    color: #fff;
    box-shadow: 0 5px 16px rgba(180,83,9,0.45);
}
.btn-calculate:active { transform: translateY(1px); }

.btn-secondary-cheer {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    padding: 0 18px;
    height: 42px;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn-secondary-cheer:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }

/* ============================================================
   Advanced settings (inside modal)
   ============================================================ */
/* Rozšírené nastavenia - custom height transition (smooth, no BS5 collapse) */
.calc-advanced-wrap {
    height: 0;
    overflow: hidden;
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: height;
}
#calc-advanced {
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}
@media (max-width: 575px) {
    #calc-advanced { grid-template-columns: 1fr; }
}
.calc-advanced-link a {
    color: var(--sky-600);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.calc-advanced-link a::before { content: "+ "; font-weight: 700; }
.calc-advanced-link a[aria-expanded="true"]::before { content: "− "; }
.calc-advanced-link a:hover { color: var(--sky-600); text-decoration: underline; }

/* Advanced sections - each one is its own small white card inside the
   grey #calc-advanced container, so they read as discrete groups */
.adv-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.adv-section-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.adv-section .input-grid { padding: 0; gap: 8px; }
/* The toggle-rows section ("Zobrazenie výsledkov") - inline two toggles */
.adv-section .toggle-row {
    padding: 6px 0;
    margin: 0;
}
.adv-section .toggle-row + .toggle-row {
    border-top: 1px solid var(--border);
}

/* Segmented control */
.segmented {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
}
/* Inside an .adv-section white card, give segmented a subtle grey bg
   so it visually stands apart from the card surface */
.adv-section .segmented {
    background: var(--surface-2);
}
/* Force a 2-col layout for segmented controls that need to wrap to two
   rows in narrow spaces (e.g. Frekvencia investovania: 4 options) */
.segmented.segmented-2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.segmented-opt {
    margin: 0;
    cursor: pointer;
    display: block;
    position: relative;
}
.segmented-opt input,
.segmented-opt .iradio_square-blue,
.segmented-opt .icheckbox_square-blue {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    pointer-events: none !important;
    background: none !important;
}
.segmented-opt > span {
    display: block;
    padding: 8px 8px;
    text-align: center;
    border-radius: calc(var(--radius) - 4px);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.segmented-opt:hover > span {
    color: var(--text);
    background: var(--surface-2);
}
.segmented-opt > input[type="radio"]:checked ~ span,
.segmented-opt > .iradio_square-blue.checked ~ span {
    background: var(--sky-600);
    color: white;
}

/* Toggle switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    margin: 0;
}
.toggle-row + .toggle-row { border-top: 1px solid var(--border); }
.toggle-row .toggle-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex: 0 0 40px;
}
.toggle-switch input,
.toggle-switch .icheckbox_square-blue {
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    position: absolute !important;
    pointer-events: none !important;
    background: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: 22px;
    transition: background-color 0.2s;
    cursor: pointer;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle-switch input[type="checkbox"]:checked ~ .toggle-slider,
.toggle-switch .icheckbox_square-blue.checked ~ .toggle-slider { background: var(--green-600); }
.toggle-switch input[type="checkbox"]:checked ~ .toggle-slider::before,
.toggle-switch .icheckbox_square-blue.checked ~ .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   TouchSpin - horizontal, light theme
   ============================================================ */
.bootstrap-touchspin {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
}
.bootstrap-touchspin > .input-group-btn {
    display: flex !important;
    align-items: stretch;
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px;
    max-width: 36px;
}
.bootstrap-touchspin > .form-control {
    border-radius: 0 !important;
    border: 1px solid var(--border-strong) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    text-align: right;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
}
.bootstrap-touchspin-down,
.bootstrap-touchspin-up {
    border: 1px solid var(--border-strong) !important;
    background-color: var(--surface-2) !important;
    color: var(--sky-600) !important;
    padding: 0 !important;
    line-height: 1 !important;
    width: 36px;
    height: 40px;
    margin: 0 !important;
    box-shadow: none !important;
    font-size: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}
.bootstrap-touchspin-down::before, .bootstrap-touchspin-up::before {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}
.bootstrap-touchspin-down::before { content: "−"; }
.bootstrap-touchspin-up::before { content: "+"; }
.bootstrap-touchspin-down:hover, .bootstrap-touchspin-up:hover {
    background-color: var(--sky-600) !important;
    color: white !important;
}
.bootstrap-touchspin-down {
    border-top-left-radius: var(--radius) !important;
    border-bottom-left-radius: var(--radius) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.bootstrap-touchspin-up {
    border-top-right-radius: var(--radius) !important;
    border-bottom-right-radius: var(--radius) !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}
.bootstrap-touchspin .glyphicon,
.bootstrap-touchspin-down i, .bootstrap-touchspin-up i,
.bootstrap-touchspin .input-group-addon { display: none !important; }

/* iCheck neutralised */
.icheckbox_square-blue, .iradio_square-blue {
    background: none !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    line-height: 0;
    margin: 0 !important;
}
.icheckbox_square-blue > input, .iradio_square-blue > input {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    margin: 0 !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer;
    accent-color: var(--sky-600);
}
