/* ==========================================================================
   GST Invoice — teal theme (Bootstrap 5 overrides + app components)
   ========================================================================== */
:root {
    --teal-950: #062e2b;
    --teal-900: #0b3d39;
    --teal-800: #115e56;
    --teal-700: #0f766e;
    --teal-600: #0d9488;
    --teal-500: #14b8a6;
    --teal-400: #2dd4bf;
    --teal-200: #99f6e4;
    --teal-100: #ccfbf1;
    --teal-50:  #effcf9;
    --amber:    #f59e0b;
    --ink:      #10201f;
    --ink-2:    #3d4f4d;
    --muted:    #74857f;
    --line:     #e5ecea;
    --line-2:   #eef3f1;
    --bg:       #f3f6f5;
    --card:     #ffffff;
    --ok: #0f9f6e;   --ok-bg: #e3f7ee;
    --warn: #b76e00; --warn-bg: #fff3dc;
    --bad: #d93843;  --bad-bg: #fde8ea;
    --info: #1f6fb2; --info-bg: #e5f1fb;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 32, 31, .04), 0 4px 16px rgba(16, 32, 31, .04);
    --rail: 84px;

    --bs-primary: var(--teal-600);
    --bs-primary-rgb: 13, 148, 136;
    --bs-link-color: var(--teal-700);
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: var(--teal-900);
    --bs-link-hover-color-rgb: 11, 61, 57;
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-secondary-color: var(--muted);
    --bs-focus-ring-color: rgba(13, 148, 136, .25);
}

html, body { min-height: 100%; }
body {
    background: var(--bg);
    font-size: 14px;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
/* soft diagonal shape behind the content, as in the reference */
body.app::before {
    content: "";
    position: fixed;
    inset: auto -10vw -30vh auto;
    width: 70vw; height: 90vh;
    background: linear-gradient(135deg, rgba(20, 184, 166, .10), rgba(45, 212, 191, .02));
    transform: skewX(-24deg);
    border-radius: 60px;
    z-index: -1;
    pointer-events: none;
}
.ic { flex-shrink: 0; vertical-align: -3px; }
a { text-decoration: none; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.text-muted, .form-text, .hint-block { color: var(--muted) !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Rail (left sidebar) ---------- */
.rail {
    position: fixed; inset: 12px auto 12px 12px;
    width: calc(var(--rail) - 12px);
    background: var(--teal-900);
    border-radius: 22px;
    display: flex; flex-direction: column; align-items: center;
    padding: 14px 0;
    z-index: 1030;
}
.rail-logo {
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    background: var(--teal-400); color: var(--teal-950);
    margin-bottom: 18px;
}
.rail-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; width: 100%; align-items: center; }
.rail-link {
    position: relative;
    width: 48px; height: 48px; border-radius: 14px;
    display: grid; place-items: center;
    color: rgba(204, 251, 241, .62);
    transition: background .15s, color .15s;
}
.rail-link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.rail-link.active { background: var(--teal-400); color: var(--teal-950); }
.rail-link .rail-tip {
    position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
    background: var(--teal-950); color: #fff; font-size: 12px; font-weight: 600;
    padding: 5px 10px; border-radius: 8px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .12s;
}
.rail-link:hover .rail-tip, .rail-link:focus-visible .rail-tip { opacity: 1; }
.rail-sep { width: 28px; height: 1px; background: rgba(255,255,255,.12); margin: 8px 0; }
.rail-foot { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.rail-foot button { border: 0; background: none; padding: 0; }

/* ---------- Main shell ---------- */
.shell { margin-left: calc(var(--rail) + 12px); padding: 12px 24px 40px 12px; min-height: 100vh; }
.topbar {
    display: flex; align-items: center; gap: 16px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px 14px 12px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 20px; margin: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .sub { font-size: 12.5px; color: var(--muted); }
.topbar-search {
    flex: 1; max-width: 420px; margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
    padding: 0 14px; height: 42px; color: var(--muted);
}
.topbar-search input { border: 0; background: transparent; outline: none; flex: 1; font-size: 14px; color: var(--ink); min-width: 0; }
.topbar-search:focus-within { border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.user-chip .name { font-weight: 600; font-size: 13px; line-height: 1.1; }
.user-chip .role { font-size: 11.5px; color: var(--muted); }

/* ---------- Cards ---------- */
.card, .panel {
    background: var(--card);
    border: 1px solid transparent;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 20px 22px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 22px 0;
}
.card-head h2, .card-head h3 { font-size: 15.5px; margin: 0; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-flush { padding: 0; overflow: hidden; }
.section-title { font-size: 15.5px; font-weight: 700; margin: 0 0 14px; }

/* KPI cards */
.kpi { position: relative; overflow: hidden; padding: 18px 20px; height: 100%; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi.dark { background: var(--teal-900); color: #fff; }
.kpi.dark .kpi-label, .kpi.dark .kpi-foot { color: rgba(204, 251, 241, .75); }
.kpi.dark .kpi-icon { background: var(--teal-400); color: var(--teal-950); }
.kpi.dark::after {
    content: ""; position: absolute; right: -30px; bottom: -40px; width: 140px; height: 140px;
    border-radius: 50%; border: 22px solid rgba(45, 212, 191, .10); pointer-events: none;
}
.delta {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
    background: var(--line-2); color: var(--muted);
}
.delta-up { background: var(--ok-bg); color: var(--ok); }
.delta-down { background: var(--bad-bg); color: var(--bad); }
.kpi.dark .delta-up { background: rgba(45, 212, 191, .18); color: var(--teal-200); }
.kpi.dark .delta-down { background: rgba(217, 56, 67, .22); color: #ffc2c7; }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: 999px; --bs-btn-padding-x: 16px; --bs-btn-padding-y: 8px; --bs-btn-font-size: 13.5px;
       display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.btn-sm { --bs-btn-padding-x: 12px; --bs-btn-padding-y: 5px; --bs-btn-font-size: 12.5px; }
.btn-primary {
    --bs-btn-bg: var(--teal-600); --bs-btn-border-color: var(--teal-600);
    --bs-btn-hover-bg: var(--teal-700); --bs-btn-hover-border-color: var(--teal-700);
    --bs-btn-active-bg: var(--teal-800); --bs-btn-active-border-color: var(--teal-800);
    --bs-btn-disabled-bg: var(--teal-600); --bs-btn-disabled-border-color: var(--teal-600);
    --bs-btn-focus-shadow-rgb: 13, 148, 136;
}
.btn-dark { --bs-btn-bg: var(--teal-900); --bs-btn-border-color: var(--teal-900); --bs-btn-hover-bg: var(--teal-950); --bs-btn-hover-border-color: var(--teal-950); }
.btn-light, .btn-default, .btn-outline-secondary {
    --bs-btn-bg: #fff; --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: var(--teal-50); --bs-btn-hover-color: var(--teal-800); --bs-btn-hover-border-color: var(--teal-200);
    --bs-btn-active-bg: var(--teal-100); --bs-btn-active-color: var(--teal-900); --bs-btn-active-border-color: var(--teal-200);
}
.btn-soft { --bs-btn-bg: var(--teal-50); --bs-btn-color: var(--teal-800); --bs-btn-border-color: var(--teal-50);
            --bs-btn-hover-bg: var(--teal-100); --bs-btn-hover-color: var(--teal-900); --bs-btn-hover-border-color: var(--teal-100); }
.btn-danger-soft { --bs-btn-bg: var(--bad-bg); --bs-btn-color: var(--bad); --bs-btn-border-color: var(--bad-bg);
                   --bs-btn-hover-bg: #fbd3d7; --bs-btn-hover-color: #b0202b; --bs-btn-hover-border-color: #fbd3d7; }
.btn-wa { --bs-btn-bg: #e3f7ee; --bs-btn-color: #0f7a4f; --bs-btn-border-color: #e3f7ee; --bs-btn-hover-bg: #c9efdc; --bs-btn-hover-color: #0b5e3d; --bs-btn-hover-border-color: #c9efdc; }
.btn-link { --bs-btn-color: var(--teal-700); }
.icon-btn {
    width: 32px; height: 32px; border-radius: 10px;
    display: inline-grid; place-items: center;
    color: var(--muted); background: transparent; border: 0;
}
.icon-btn:hover { background: var(--teal-50); color: var(--teal-700); }
.icon-btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.actions { display: inline-flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.actions form { display: inline; }

/* ---------- Pills / avatars ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-teal { background: var(--teal-100); color: var(--teal-800); }
.pill-neutral { background: var(--line-2); color: var(--ink-2); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-grid; place-items: center; flex-shrink: 0;
    font-size: 12px; font-weight: 700;
}
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.avatar-t0 { background: var(--teal-100); color: var(--teal-800); }
.avatar-t1 { background: #fff1d6; color: #9a5b00; }
.avatar-t2 { background: #e6efff; color: #2b5cb8; }
.avatar-t3 { background: #fde6ef; color: #b1316a; }
.avatar-t4 { background: #ece8ff; color: #5a3fc0; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .t { font-weight: 600; line-height: 1.2; }
.who .s { font-size: 12px; color: var(--muted); }

/* ---------- Tables / grid ---------- */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--teal-50); --bs-table-color: var(--ink); margin: 0; }
.table > :not(caption) > * > * { padding: 13px 14px; border-bottom-color: var(--line-2); }
.table thead th, .table > tbody > tr:first-child > th {
    font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none;
    background: #f8faf9; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table thead th a { color: var(--muted); }
.table thead th:first-child { padding-left: 22px; }
.table tbody td:first-child { padding-left: 22px; }
.table thead th:last-child, .table tbody td:last-child { padding-right: 22px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td { white-space: nowrap; }            /* rows stay one line; .table-responsive scrolls */
.table .who .s { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.table .filters input, .table .filters select { font-size: 13px; }
.doc-no { font-weight: 700; color: var(--ink); }
.doc-no:hover { color: var(--teal-700); }
.grid-view .summary { font-size: 12.5px; color: var(--muted); }
.grid-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.grid-foot:empty { display: none; }
.grid-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--teal-600);
              --bs-pagination-active-border-color: var(--teal-600); --bs-pagination-hover-bg: var(--teal-50); --bs-pagination-focus-box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
              --bs-pagination-font-size: 13px; gap: 4px; margin: 0; }
.pagination .page-link { border-radius: 10px !important; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
a.asc:after, a.desc:after { content: ''; display: inline-block; border: solid 4px transparent; margin: 0 0 1px 4px; }
a.asc:after { border-bottom: solid 5px var(--muted); border-top-width: 0; }
a.desc:after { border-top: solid 5px var(--muted); border-bottom-width: 0; }

/* ---------- Toolbar (filters above tables) ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 22px; }
.tabs { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--teal-800); }
.tabs a.on { background: #fff; color: var(--teal-800); box-shadow: 0 1px 3px rgba(16,32,31,.08); }
.tabs .n { font-size: 11px; color: var(--muted); font-weight: 700; }
.toolbar .form-control, .toolbar .form-select { height: 38px; border-radius: 999px; font-size: 13px; width: auto; }
.toolbar .spacer { flex: 1; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-color: var(--line); border-radius: var(--radius-sm); font-size: 14px; padding: 9px 12px; background-color: #fff;
}
.form-control:focus, .form-select:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.form-label, .control-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-check-input:checked { background-color: var(--teal-600); border-color: var(--teal-600); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--bs-focus-ring-color); border-color: var(--teal-500); }
.form-group, .mb-3.field { margin-bottom: 16px; }
.help-block-error, .invalid-feedback { font-size: 12px; }
.form-section { padding: 22px; }
.form-section + .form-section { border-top: 1px solid var(--line-2); }
.form-section h3 { font-size: 14px; margin: 0 0 4px; }
.form-section .lead-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line-2); background: #fbfcfc; border-radius: 0 0 var(--radius) var(--radius); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.input-prefix > input { padding-left: 26px; }

/* line-item editor */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 8px; background: #f8faf9; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lines th:first-child { padding-left: 22px; }
.lines th:last-child { padding-right: 22px; }
.lines td { padding: 10px 8px; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.lines td:first-child { padding-left: 22px; }
.lines td:last-child { padding-right: 22px; }
.lines .form-control, .lines .form-select { padding: 7px 10px; font-size: 13.5px; }
.lines .line-desc { margin-top: 6px; font-size: 12.5px; }
.lines .line-qty, .lines .line-disc { min-width: 76px; }
.lines .line-price { min-width: 110px; }
.lines .line-tax { min-width: 92px; }
.lines .line-hsn { min-width: 96px; }
.lines .line-total { text-align: right; font-weight: 700; padding-top: 18px; white-space: nowrap; }
.lines .line-tax-note { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.totals { width: 100%; }
.totals td { padding: 7px 0; font-size: 13.5px; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand td { border-top: 1px dashed var(--line); padding-top: 14px; font-size: 18px; font-weight: 800; }
.totals .muted td { color: var(--muted); }
.auto-note { font-size: 12px; color: var(--teal-700); display: flex; gap: 6px; align-items: center; margin-top: 6px; min-height: 18px; }

/* ---------- Document view ---------- */
.doc-hero { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.doc-hero .no { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.doc-meta .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.doc-meta .v { font-weight: 600; }
.party { background: var(--bg); border-radius: 12px; padding: 14px 16px; height: 100%; }
.party .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.party .n { font-weight: 700; margin-bottom: 2px; }
.party .a { font-size: 13px; color: var(--ink-2); }
.progress-slim { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress-slim > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal-500), var(--teal-400)); border-radius: 999px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--teal-50); color: var(--teal-700); }
.timeline .dot.amber { background: var(--warn-bg); color: var(--warn); }
.timeline .t { font-size: 13px; font-weight: 600; line-height: 1.3; }
.timeline .s { font-size: 12px; color: var(--muted); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 290px; }
.donut-wrap { position: relative; width: 190px; height: 190px; margin: 6px auto 14px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 24px; font-weight: 800; display: block; line-height: 1; }
.donut-center span { font-size: 12px; color: var(--muted); }
.gauge-wrap { position: relative; width: 210px; height: 118px; margin: 4px auto 6px; }
.gauge-wrap .donut-center { top: 40px; }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.bar-row .bar { flex: 1; height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--teal-500); border-radius: 999px; }

/* ---------- Alerts ---------- */
.alert { border: 0; border-radius: 12px; font-size: 13.5px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--ok-bg); color: #0b6b4b; }
.alert-danger { background: var(--bad-bg); color: #a2222c; }
.alert-info { background: var(--teal-50); color: var(--teal-800); }
.alert-warning { background: var(--warn-bg); color: #8a5200; }
.alert .btn-close { margin-left: auto; padding: 6px; font-size: 11px; position: static; }
.alert-dismissible { padding-right: 16px; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--teal-50); color: var(--teal-600); }
.empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-brand {
    position: relative; overflow: hidden; color: #fff;
    background: var(--teal-900);
    padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand::before, .auth-brand::after {
    content: ""; position: absolute; border-radius: 60px; transform: skewX(-24deg);
}
.auth-brand::before { width: 60%; height: 120%; right: -18%; top: -10%; background: linear-gradient(160deg, rgba(45,212,191,.35), rgba(45,212,191,.04)); }
.auth-brand::after { width: 30%; height: 70%; right: 30%; bottom: -30%; background: rgba(45,212,191,.10); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand h2 { color: #fff; font-size: 34px; line-height: 1.15; font-weight: 800; max-width: 420px; }
.auth-brand p { color: rgba(204,251,241,.8); max-width: 400px; }
.auth-mock { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 18px; max-width: 360px; backdrop-filter: blur(4px); }
.auth-mock .row-l { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; color: rgba(204,251,241,.85); }
.auth-mock .big { font-size: 26px; font-weight: 800; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .inner { width: 100%; max-width: 360px; }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-mark .b { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-400); color: var(--teal-950); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .topbar-search { display: none; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}
@media (max-width: 767.98px) {
    :root { --rail: 0px; }
    .rail {
        inset: auto 8px 8px 8px; width: auto; height: 64px;
        flex-direction: row; padding: 0 8px; border-radius: 18px;
    }
    .rail-logo, .rail-sep, .rail-foot, .rail-tip { display: none; }
    .rail-nav { flex-direction: row; overflow-x: auto; gap: 4px; justify-content: flex-start; scrollbar-width: none; }
    .rail-link { width: 46px; height: 46px; flex-shrink: 0; }
    .shell { margin-left: 0; padding: 12px 16px 96px; }
    .topbar { padding: 10px 12px 10px 16px; }
    .user-chip .name, .user-chip .role { display: none; }
    .topbar .btn .lbl { display: none; }
    .kpi-value { font-size: 22px; }
    .card-body, .form-section { padding: 16px; }
    .table thead th:first-child, .table tbody td:first-child, .lines th:first-child, .lines td:first-child { padding-left: 16px; }
}
@media print {
    .rail, .topbar, .no-print { display: none !important; }
    .shell { margin: 0; padding: 0; }
    body.app::before { display: none; }
}

/* ---------- Public pay pages ---------- */
.pay-body { background: var(--bg); }
.pay-shell { max-width: 520px; margin: 0 auto; padding: 32px 16px 24px; }
.pay-card { background: #fff; border-radius: 22px; box-shadow: 0 10px 40px rgba(11, 61, 57, .12); overflow: hidden; }
.pay-head { position: relative; overflow: hidden; background: var(--teal-900); color: #fff; padding: 24px 24px 22px; }
.pay-head::after { content: ""; position: absolute; width: 60%; height: 200%; right: -22%; top: -50%; transform: skewX(-24deg);
                   background: linear-gradient(160deg, rgba(45,212,191,.28), rgba(45,212,191,.03)); border-radius: 40px; pointer-events: none; }
.pay-head > * { position: relative; z-index: 1; }
.pay-head .brand-mark { font-size: 16px; }
.pay-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: contain; background: #fff; padding: 4px; }
.pay-amount { margin-top: 22px; }
.pay-amount .lbl { display: block; font-size: 12.5px; color: rgba(204, 251, 241, .75); font-weight: 600; }
.pay-amount b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.pay-body-inner { padding: 22px 24px 24px; }
.pay-options { display: grid; gap: 10px; }
.pay-option { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px;
              border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; transition: border-color .15s, background .15s; }
.pay-option:hover { border-color: var(--teal-400); background: var(--teal-50); color: var(--ink); }
.pay-option > span:nth-child(2) { flex: 1; }
.pay-option .small { color: var(--muted); }
.pay-option .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); flex-shrink: 0; }
.pay-option.primary { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }
.pay-option.primary:hover { background: var(--teal-700); color: #fff; }
.pay-option.primary .ico { background: rgba(255,255,255,.16); color: #fff; }
.pay-option.primary .small { color: rgba(255,255,255,.8); }
.qr-panel { margin-top: 14px; padding: 18px; border-radius: 16px; background: var(--bg); }
.qr-box { display: grid; place-items: center; min-height: 220px; background: #fff; border-radius: 12px; padding: 12px; }
.qr-box img { width: 100%; max-width: 240px; height: auto; image-rendering: pixelated; }
.pay-state { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; background: var(--line-2); color: var(--ink-2); }
.pay-state.ok { background: var(--ok-bg); color: #0b6b4b; }
.pay-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
.result-ico { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: var(--teal-50); color: var(--teal-700); }
.result-ico.ok { background: var(--ok-bg); color: var(--ok); }
.result-ico.bad { background: var(--bad-bg); color: var(--bad); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; }
.link-box input { border: 0; background: transparent; flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); outline: none; }

/* ---------- Fiscal year switcher ---------- */
.fy-switch { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 12px; border-radius: 999px;
             background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-100); }
.fy-switch select { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 13px; color: var(--teal-900); outline: none; cursor: pointer; padding-right: 2px; }
.fy-switch:focus-within { box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
@media (max-width: 767.98px) { .fy-switch { padding: 0 4px 0 8px; } .fy-switch .ic { display: none; } }

/* ---------- Inline invoice editor ---------- */
.inline-on .inl-view { display: none !important; }
.inl-edit { display: none !important; }
.inline-on .inl-edit { display: revert !important; }
.inline-on td.inl-edit, .inline-on th.inl-edit { display: table-cell !important; }
.inline-bar { position: sticky; top: 8px; z-index: 20; display: none; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px;
              background: var(--teal-900); color: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(11,61,57,.25); }
.inline-on .inline-bar { display: flex; }
.inline-bar .msg { flex: 1; font-size: 13px; color: var(--teal-100); }
.inline-bar .msg.err { color: #ffc2c7; }
.inline-on .editable-card { outline: 2px dashed var(--teal-200); outline-offset: 3px; }
.inl-input { width: 100%; min-width: 60px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13.5px; background: #fff; }
.inl-input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.inl-input.num { text-align: right; }
.inl-line td { vertical-align: top; }
.email-preview { width: 100%; height: 640px; border: 0; border-radius: 12px; background: var(--bg); }

.topbar .btn { white-space: nowrap; }
@media (max-width: 1100px) { .topbar .btn-link { display: none; } }
@media (max-width: 767.98px) {
    .topbar { flex-wrap: wrap; row-gap: 10px; }
    .topbar-title { flex: 1 1 100%; }
    .topbar-actions { flex: 1 1 100%; flex-wrap: wrap; gap: 8px; }
    .topbar-actions .user-chip { margin-left: auto; }
    .inline-bar { flex-wrap: wrap; top: 4px; }
    .inline-bar .msg { flex: 1 1 calc(100% - 30px); font-size: 12px; }
    .inline-bar .btn { flex: 1; }
    .doc-hero > div:first-child { flex-wrap: wrap; }
}

@media (min-width: 1200px) { .email-preview-card { position: sticky; top: 12px; } }
