﻿/* ========= THEME TOKENS ========= */
:root {
    /* light neutral */
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f9fbff;
    --line: #e5e9f2;
    --text: #1f2a37;
    --muted: #6b7a90;
    --accent: #0a6ed1;
    --accent-2: #0369a1;
    --hover: #eef3fb;
    --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
    --radius: 12px;
    /* chart tokens */
    --ok: #00a46c;
    --loss: #d32f2f;
    /* sidebar sizing */
    --side-collapsed: 64px;
    --side-expanded: 232px;
}

/* ========= BASE ========= */
* {
    box-sizing: border-box
}

html, body {
    height: 100%;
    margin: 0
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========= TOP BAR ========= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text)
}

.brand-text {
    font-weight: 800;
    letter-spacing: .2px
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(10,110,209,.15)
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .06s;
}

    .icon-btn:hover {
        background: var(--hover);
        border-color: #d8e1f0
    }

    .icon-btn:active {
        transform: translateY(1px)
    }

    .icon-btn svg {
        width: 18px;
        height: 18px;
        stroke: var(--text);
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round
    }

.btn {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent-2);
    cursor: pointer;
    box-shadow: var(--shadow);
}

    .btn:hover {
        filter: brightness(1.05)
    }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--hover);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 600;
    font-size: 12px;
    margin-right: 6px;
}

.save-msg {
    color: var(--muted);
    font-weight: 600;
    font-size: 75%;
    margin-left: 6px
}

.shell-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: 10px
}

.profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 10px;
    height: 36px;
    padding: 0 10px;
    cursor: pointer
}

    .profile:hover {
        background: var(--hover)
    }

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--hover);
    border: 1px solid var(--line);
    font-weight: 800;
    color: var(--text);
    font-size: 12px
}

.who {
    font-weight: 600
}

.spacer {
    flex: 1 1 auto
}

/* ========= APP LAYOUT ========= */
/* Sidebar column auto-sizes to its width var; main fills the rest */
.app {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: calc(100vh - 58px)
}

.main {
    position: relative;
    background: var(--bg)
}

/* App content frame (used by the shell + any dynamic route iframes) */
.frame {
    display: block; /* ensure it actually takes space */
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

    /* Hide inactive cached frames (keep-alive router) */
    .frame.hidden {
        display: none !important; /* hard-hide so only one frame is visible */
    }

/* ========= SIDEBAR (icon-only; expand on hover; pin to persist) ========= */
.side {
    position: sticky;
    top: 58px;
    align-self: start;
    height: calc(100vh - 58px);
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: var(--side-collapsed);
    overflow: hidden;
    transition: width .18s ease;
}

    .side:hover {
        width: var(--side-expanded)
    }

.nav-group {
    margin-top: 6px
}

.nav-label {
    color: var(--muted);
    font-size: 12px;
    padding: 8px 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: nowrap;
}

.side:not(:hover) .nav-label {
    display: none
}

.side:not(:hover) .nav .text {
    display: none
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 2px 0;
    font-weight: 600;
    white-space: nowrap;
    transition: background .12s, color .12s;
}

    .nav a:hover {
        background: var(--hover)
    }

    .nav a.active {
        background: #eaf3ff;
        box-shadow: inset 3px 0 0 0 var(--accent)
    }

.nav-ico {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px
}

    .nav-ico svg {
        width: 18px;
        height: 18px;
        stroke: var(--text);
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round
    }

.side:not(:hover) .nav a {
    justify-content: center;
    padding: 10px
}

    /* collapsed tooltips using title attr */
    .side:not(:hover) .nav a[title] {
        position: relative
    }

        .side:not(:hover) .nav a[title]:hover::after {
            content: attr(title);
            position: absolute;
            left: calc(100% + 8px);
            top: 50%;
            transform: translateY(-50%);
            background: #111827;
            color: #fff;
            border-radius: 8px;
            padding: 6px 8px;
            font-size: 12px;
            box-shadow: var(--shadow);
            white-space: nowrap;
            pointer-events: none;
        }

/* ---- Pinned (stays expanded even without hover) ---- */
body.sidebar-pinned .side {
    width: var(--side-expanded)
}

body.sidebar-pinned .nav-label {
    display: block
}

body.sidebar-pinned .nav .text {
    display: inline
}

body.sidebar-pinned .nav a {
    justify-content: flex-start;
    padding: 10px 12px
}

    body.sidebar-pinned .nav a[title]:hover::after {
        display: none
    }

/* ========= PAGE PRIMITIVES (used by inner pages) ========= */
.wrap {
    max-width: 1200px;
    margin: 24px auto;
    padding: 16px
}

    .wrap.wide {
        max-width: 1400px
    }

h1 {
    margin: 0 0 12px;
    font-size: clamp(20px,2.6vw,28px)
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow)
}

.panel {
    padding: 16px
}

.title {
    font-weight: 800;
    margin: 0 0 10px
}

.grid {
    display: grid;
    gap: 16px
}

    .grid.cols-2 {
        grid-template-columns: 1.05fr .95fr
    }

    .grid.cols-2-narrow {
        grid-template-columns: 420px 1fr
    }

@media (max-width:1100px) {
    .grid.cols-2, .grid.cols-2-narrow {
        grid-template-columns: 1fr
    }
}

.grid.cols-2-narrow-right {
    grid-template-columns: 1fr 420px;
}

label {
    display: block;
    color: var(--muted);
    margin: 8px 0 6px;
    font-size: 14px
}

/* text / email / password fields (login) */
input[type=text],
input[type=email],
input[type=password] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #dbe6f7;
    background: #fff;
    color: var(--text);
    outline: none;
}

    input[type=text]:focus,
    input[type=email]:focus,
    input[type=password]:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(10,110,209,.15);
    }


input[type=number], select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #dbe6f7;
    background: #fff;
    color: var(--text);
    outline: none
}

    input[type=number]:focus, select:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(10,110,209,.15)
    }

.row, .row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.row4 {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 12px
}

.hint {
    font-size: 12px;
    color: var(--muted)
}

.sep {
    height: 1px;
    background: var(--line);
    margin: 12px 0
}

.btn-ghost {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #dbe6f7;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 700
}

.primary {
    background: var(--accent);
    border: 1px solid var(--accent-2);
    color: #fff
}

.btns {
    display: flex;
    gap: 10px;
    margin-top: 16px
}

/* Compact, subtle CTA */
.actions {
    margin-top: 10px;
}
/* spacing from the hint above */
.btn-sm { /* smaller size */
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 12px;
}

.btn-quiet { /* blue/grey, low-emphasis look */
    background: var(--surface-2);
    color: var(--ink-2);
    border: 1px solid var(--line);
    box-shadow: none;
}

    .btn-quiet:hover {
        background: var(--surface-3);
        border-color: var(--accent);
        color: var(--ink);
    }

    .btn-quiet:active {
        transform: translateY(0);
    }

/* tables */
table {
    width: 100%;
    border-collapse: collapse
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px dashed #dbe6f7;
    vertical-align: top
}

th {
    text-align: left;
    color: var(--muted)
}

thead th {
    text-align: right;
    color: var(--text);
    font-weight: 800
}

    thead th:first-child {
        text-align: left
    }

.section td {
    background: #eef3fb;
    color: #2b3b51;
    font-weight: 800
}

.strong {
    font-weight: 800;
    color: #111827
}

.total {
    font-weight: 800
}

.diff-pos {
    color: var(--ok);
    font-weight: 700
}

.diff-neg {
    color: var(--loss);
    font-weight: 700
}

/* ========= REPORT TABS ========= */
.rpt-tabs {
    margin-top: 4px;
}

.rpt-tab-header {
    display: flex;
    gap: 24px;
    padding: 0 0 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.rpt-tab-btn {
    background: none;
    border: 0;
    padding: 4px 0 6px;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    font-weight: 400;
}

    .rpt-tab-btn:hover {
        color: var(--accent-2);
    }

    .rpt-tab-btn.active {
        color: var(--accent);
        font-weight: 700;
        position: relative;
    }

        .rpt-tab-btn.active::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: -3px;
            height: 2px;
            border-radius: 999px;
            background: var(--accent);
        }

/* panels */
.rpt-tab-panels {
    /* container for panels – no extra styling needed for now */
}

.rpt-tab-panel {
    display: none;
    overflow: auto;
}

    .rpt-tab-panel.active {
        display: block;
    }


/* charts */
.chart-wrap {
    width: 100%;
    height: clamp(260px,42vh,560px)
}

    .chart-wrap canvas {
        width: 100% !important;
        height: 100% !important;
        display: block
    }
/* ===== REPORT REWORK: PERSONAL STATEMENT ===== */

/* Big section heading */
.rpt-heading {
    font-size: 18px;
    font-weight: 700;
    padding: 12px 0 6px;
    color: var(--text-strong);
    border-bottom: 2px solid var(--line);
    margin-bottom: 6px;
}

/* Blue income header (Salary + Dividends) */
.rpt-income-header {
    background: var(--accent-1);
    color: var(--accent);
    font-weight: 700;
    padding: 8px 6px;
    border-radius: 4px;
}

/* Subsection label like "Tax calculation – Salary" */
.rpt-subsection {
    font-weight: 600;
    color: var(--muted-strong);
    padding-top: 14px;
    padding-bottom: 6px;
}

/* Payslip final block */
.rpt-payslip {
    background: var(--accent-1);
    padding: 10px;
    border-radius: 6px;
    margin-top: 16px;
}

.rpt-payslip-title {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
}

.rpt-payslip-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.rpt-payslip-total {
    display: flex;
    justify-content: space-between;
    padding: 8px 0 4px;
    font-weight: 800;
    border-top: 2px solid var(--accent);
    margin-top: 6px;
}

/* responsive */
@media (max-width:980px) {
    .topbar {
        padding: 8px 10px
    }

    .side {
        width: var(--side-collapsed)
    }
}

/* ========= AUTH OVERLAY ========= */

.auth-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 56px;
    background: rgba(245,247,251,0.96); /* soft light backdrop */
    z-index: 9999;
}

.auth-card {
    max-width: 460px;
    width: 100%;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden; /* keep footer flush */
}

    /* inner padding for login content */
    .auth-card .panel {
        padding: 28px 28px 20px;
    }

/* "Sign In" */
.auth-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
}

/* "Central IT Prod" */
.auth-subtitle {
    margin: 0 0 24px;
    font-size: 14px;
    color: var(--muted);
}

/* footer bar with Register + Continue */
.auth-footer {
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

/* white "Register" button */
.auth-register-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: #fff;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

    .auth-register-btn:hover {
        background: var(--hover);
    }

/* blue "Continue" button */
.auth-continue-btn {
    height: 36px;
    padding: 0 22px;
    border-radius: 8px;
    border: 1px solid var(--accent-2);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
}

    .auth-continue-btn:hover {
        filter: brightness(1.05);
    }

/* keep for any flex button rows you still use */
.auth-btns {
    justify-content: flex-end;
}

.auth-error {
    min-height: 1.2rem;
    margin-top: 6px;
    color: #d32f2f;
    font-size: 13px;
}

/* generic hidden helper (used for overlay/app toggling) */
.hidden {
    display: none !important;
}


