:root {
    --ink: #07111f;
    --ink-2: #101b2e;
    --ink-3: #17263d;
    --paper: #f3f6fb;
    --card: #ffffff;
    --line: #dce4f0;
    --text: #0f172a;
    --muted: #64748b;
    --teal: #14b8a6;
    --teal-2: #2dd4bf;
    --indigo: #6366f1;
    --gold: #f5c16c;
    --rose: #f43f5e;
    --ok: #10b981;
    --shadow: 0 18px 40px rgba(15, 23, 42, .08);
    --radius: 22px;
    --sidebar: 272px;
    --rail: 78px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(900px 420px at 110% -10%, rgba(99, 102, 241, .12), transparent 50%),
        radial-gradient(700px 380px at -10% 110%, rgba(45, 212, 191, .12), transparent 45%),
        var(--paper);
    color: var(--text);
}

h1, h2, h3, .brand h1, .hero h2, .page-head h2 {
    font-family: "Sora", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
    min-height: 100vh;
}
.app-shell .workspace {
    margin-left: var(--rail);
    min-width: 0;
    transition: margin-left .22s ease;
}
.app-shell.is-nav-pinned .workspace,
html.is-nav-pinned .app-shell .workspace {
    margin-left: var(--sidebar);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--rail);
    min-width: 0;
    max-width: var(--rail);
    height: 100vh;
    padding: 18px 12px;
    background:
        linear-gradient(180deg, rgba(45, 212, 191, .08), transparent 28%),
        var(--ink);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden auto;
    z-index: 40;
    transition: width .22s ease .12s, padding .22s ease .12s, box-shadow .22s ease, max-width .22s ease .12s;
}
.sidebar:hover,
.sidebar:focus-within,
.app-shell.is-nav-pinned .sidebar,
html.is-nav-pinned .sidebar {
    width: var(--sidebar);
    max-width: var(--sidebar);
    padding: 22px 18px;
    transition-delay: 0s;
}
.sidebar:hover,
.sidebar:focus-within {
    box-shadow: 18px 0 40px rgba(7, 17, 31, .28);
}
.app-shell.is-nav-pinned .sidebar,
html.is-nav-pinned .sidebar {
    box-shadow: none;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 8px 18px;
    min-height: 70px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(45, 212, 191, .3);
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-kicker {
    margin: 0;
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--teal-2);
}
.brand h1 {
    margin: 2px 0 0;
    font-size: 18px;
    font-weight: 700;
}
.brand-copy,
.nav-label,
.nav-link span,
.nav-link em,
.sidebar-card {
    opacity: 0;
    max-width: 0;
    max-height: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    margin: 0;
    transition: opacity .16s ease, max-width .22s ease, max-height .22s ease;
}
.sidebar:hover .brand-copy,
.sidebar:hover .nav-label,
.sidebar:hover .nav-link span,
.sidebar:hover .nav-link em,
.sidebar:hover .sidebar-card,
.sidebar:focus-within .brand-copy,
.sidebar:focus-within .nav-label,
.sidebar:focus-within .nav-link span,
.sidebar:focus-within .nav-link em,
.sidebar:focus-within .sidebar-card,
.app-shell.is-nav-pinned .brand-copy,
.app-shell.is-nav-pinned .nav-label,
.app-shell.is-nav-pinned .nav-link span,
.app-shell.is-nav-pinned .nav-link em,
.app-shell.is-nav-pinned .sidebar-card,
html.is-nav-pinned .brand-copy,
html.is-nav-pinned .nav-label,
html.is-nav-pinned .nav-link span,
html.is-nav-pinned .nav-link em,
html.is-nav-pinned .sidebar-card {
    opacity: 1;
    max-width: 220px;
    max-height: 220px;
    pointer-events: auto;
}
.sidebar:hover .sidebar-card,
.sidebar:focus-within .sidebar-card,
.app-shell.is-nav-pinned .sidebar-card,
html.is-nav-pinned .sidebar-card {
    max-width: 100%;
    max-height: none;
    white-space: normal;
}
.sidebar:hover .nav-label,
.sidebar:focus-within .nav-label,
.app-shell.is-nav-pinned .nav-label,
html.is-nav-pinned .nav-label {
    margin: 18px 10px 8px;
}

.nav-label {
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #64748b;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
    border-radius: 14px;
    color: #cbd5e1;
    transition: .2s ease;
}
.sidebar:hover .nav-link,
.sidebar:focus-within .nav-link,
.app-shell.is-nav-pinned .nav-link,
html.is-nav-pinned .nav-link {
    justify-content: flex-start;
    padding: 11px 12px;
}
.nav-link i { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.is-active {
    background: linear-gradient(90deg, rgba(45, 212, 191, .18), rgba(99, 102, 241, .16));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .18);
}
.nav-link.is-soon { opacity: .55; cursor: default; }
.nav-link em {
    margin-left: auto;
    font-style: normal;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(245, 193, 108, .15);
    color: var(--gold);
}

.sidebar-card {
    margin-top: auto;
    position: relative;
    overflow: hidden;
    padding: 0;
    border-radius: 20px;
    background: linear-gradient(180deg, #17263d, #101b2e);
    border: 1px solid transparent;
}
.sidebar:hover .sidebar-card,
.sidebar:focus-within .sidebar-card,
.app-shell.is-nav-pinned .sidebar-card,
html.is-nav-pinned .sidebar-card {
    padding: 18px;
    border-color: rgba(255,255,255,.06);
}
.sidebar-card p { margin: 0 0 6px; font-weight: 700; }
.sidebar-card span { color: #94a3b8; font-size: 13px; display: block; line-height: 1.5; }
.orb {
    position: absolute;
    right: -20px;
    top: -24px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(45, 212, 191, .5), transparent 68%);
}

.workspace { min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
}
.search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 11px 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .03);
}
.search-wrap input {
    border: 0;
    outline: 0;
    width: 100%;
    background: transparent;
}
.search-wrap i, .icon-btn i { width: 18px; height: 18px; color: var(--muted); }
.branch-bar { flex: 1; min-width: 0; }
.branch-switch, .branch-lock {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px 12px;
    width: fit-content;
    max-width: 100%;
}
.branch-switch i, .branch-lock i { width: 16px; height: 16px; color: var(--teal); }
.branch-switch select {
    border: 0;
    outline: 0;
    background: transparent;
    font-weight: 700;
    min-width: 220px;
    max-width: 100%;
}
a.icon-btn { color: inherit; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
}
.pulse-dot {
    position: absolute;
    top: 10px;
    right: 11px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rose);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 6px 12px 6px 6px;
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal), var(--indigo));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: var(--muted); font-size: 12px; }

.page { padding: 6px 28px 36px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 22px;
}
.page-head p, .eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.page-head h2 { margin: 0; font-size: 30px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    cursor: pointer;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
}
.btn i { width: 16px; height: 16px; }
.btn-primary {
    color: #06201c;
    background: linear-gradient(135deg, #5eead4, #2dd4bf);
    box-shadow: 0 10px 24px rgba(20, 184, 166, .28);
}
.btn-ghost {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
}
.btn-dark {
    background: #101b2e;
    border: 1px solid #101b2e;
    color: #f8fafc;
}
.btn-dark:hover { background: #17263d; }
.btn-danger { background: #fff1f2; color: var(--rose); }

.hero {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 22px;
    margin-bottom: 22px;
}
.hero-copy, .card, .stat, .table-wrap, .form-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.hero-copy {
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(20, 184, 166, .12), rgba(99, 102, 241, .1)),
        #0e1a2e;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.hero-copy h2 { font-size: 34px; margin: 0 0 10px; max-width: none; }
.hero-copy p { color: #cbd5e1; max-width: 720px; line-height: 1.6; }
.hero-copy img {
    position: absolute;
    right: -20px;
    bottom: -48px;
    width: 420px;
    opacity: .9;
}
.hero-art {
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-art .passport-photo {
    width: 100%;
    height: 100%;
    min-height: 240px;
    object-fit: cover;
    object-position: 62% 16%;
    border-radius: 16px;
    display: block;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat { padding: 18px 20px; }
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    background: #ecfeff;
    color: #0f766e;
}
.stat.indigo .stat-icon { background: #eef2ff; color: var(--indigo); }
.stat.gold .stat-icon { background: #fff7e8; color: #b45309; }
.stat.rose .stat-icon { background: #fff1f2; color: var(--rose); }
.stat b { display: block; font-size: 28px; font-family: Sora, sans-serif; }
.stat span { color: var(--muted); font-size: 13px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 16px;
}
.card { padding: 20px; }
.card h3 { margin: 0 0 14px; }
.mini-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}
.mini-row:last-child { border-bottom: 0; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge-ok { background: #ecfdf5; color: #047857; }
.badge-off { background: #f1f5f9; color: #475569; }
.badge-due { background: #fff7ed; color: #c2410c; }
.badge-overdue { background: #fff1f2; color: #e11d48; }

.table-wrap { overflow-x: auto; }
.table-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.table-tools-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
    min-width: 280px;
}
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    background: #f8fafc;
}
.table-tools-actions input,
.table-tools input[data-table-search] {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    background: #f8fafc;
    width: min(280px, 100%);
    flex: 1;
    max-width: 320px;
}
.btn-excel {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    padding: 10px 12px;
    white-space: nowrap;
}
.btn-pdf {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    padding: 10px 12px;
    white-space: nowrap;
}
.field input:focus, .field select:focus, .field textarea:focus, .table-tools input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
    background: #fff;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; font-size: 14px; }
th {
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    background: #f8fafc;
}
tr:not(:last-child) td { border-bottom: 1px solid var(--line); }
.row-actions { display: flex; gap: 8px; }
.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.layout-split {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    align-items: start;
}
.layout-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 16px;
}
.form-grid-4 .field { margin-bottom: 0; }
.form-grid-4 .span-2 { grid-column: span 2; }
.form-grid-4 .span-3 { grid-column: span 3; }
.form-grid-4 .span-4 { grid-column: 1 / -1; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.field-fk select {
    background: #fff4d6;
    border-color: #f5c16c;
    font-weight: 700;
    color: #7c4a03;
}
.field-fk select:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 4px rgba(245, 193, 108, .28);
    background: #ffefc2;
}
.form-card,
.form-grid-4,
.field-fk {
    overflow: visible;
}
.field-fk:focus-within {
    z-index: 8;
}
.search-select {
    position: relative;
    z-index: 1;
}
.search-select.is-open {
    z-index: 40;
}
.search-select-input {
    width: 100%;
    border: 1px solid #f5c16c;
    border-radius: 12px;
    padding: 11px 36px 11px 12px;
    outline: none;
    background: #fff4d6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237c4a03' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat right 12px center;
    background-size: 16px 16px;
    font-weight: 700;
    color: #7c4a03;
    text-transform: uppercase;
}
.search-select-input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 4px rgba(245, 193, 108, .28);
    background-color: #ffefc2;
}
.search-select-list {
    display: none;
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow: auto;
    background: #fffef8;
    border: 1px solid #f5c16c;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
}
.search-select-list.is-open { display: block; }
.search-select-option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    color: #7c4a03;
    cursor: pointer;
}
.search-select-option:hover,
.search-select-option.is-active {
    background: #2563eb;
    color: #fff;
}
.search-select-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
}
.form-card { padding: 22px; }
.form-card h3 { margin: 0 0 4px; }
.form-card .hint { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
}
.field small { color: var(--muted); font-weight: 500; }
.field textarea { min-height: 88px; resize: vertical; }
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.readonly {
    background: #eef2ff !important;
    font-weight: 700;
    letter-spacing: .08em;
}
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.purchase-page-head { margin-bottom: 12px; }
.purchase-page-head h2 { font-size: 24px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }
a.btn.is-disabled,
a.btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: .45;
}
.purchase-form { padding: 14px 18px 16px; }
.purchase-form h3 { font-size: 16px; margin-bottom: 2px; }
.purchase-form .hint { margin: 0 0 10px; }
.purchase-form .form-grid-4 { gap: 10px 12px; }
.purchase-form .field label { margin-bottom: 4px; }
.purchase-form input,
.purchase-form select {
    padding: 9px 12px;
}
.field-amount label { color: #083344; }
.field-amount small { color: #0e7490 !important; font-weight: 700; }
.field-amount input,
.field-amount input.readonly {
    background: #062a32 !important;
    color: #22f3ee !important;
    border: 1px solid #22d3ee;
    border-radius: 8px;
    letter-spacing: .04em;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
}
.field-amount input.is-flash {
    animation: amount-flash .45s ease;
}
@keyframes amount-flash {
    0% {
        box-shadow: 0 0 0 5px rgba(34, 211, 238, .45);
        background: #0e4a55 !important;
    }
    100% {
        box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
    }
}
.purchase-form .field-save {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.purchase-form .field-save-label {
    visibility: hidden;
}
.purchase-form .field-save .btn {
    width: 100%;
    justify-content: center;
    height: 42px;
    border-radius: 8px;
}
.uppercase { text-transform: uppercase; }

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 600;
}
.toast i { width: 18px; height: 18px; }
.toast-success { background: #ecfdf5; color: #047857; }
.toast-error { background: #fff1f2; color: #be123c; }

.install-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(600px 300px at 20% 20%, rgba(45, 212, 191, .2), transparent),
        radial-gradient(600px 300px at 80% 80%, rgba(99, 102, 241, .18), transparent),
        #07111f;
}
.install-card {
    width: min(560px, 100%);
    background: #fff;
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.install-card h1 { margin: 8px 0 8px; }
.install-card p { color: var(--muted); }
.install-card:has(.login-head) { width: min(680px, 100%); }
.login-head {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 8px;
}
.login-head > div { flex: 1; min-width: 0; }
.login-head p:last-child { margin-bottom: 0; }
.login-portrait {
    width: 132px;
    height: 168px;
    flex: 0 0 auto;
    object-fit: cover;
    object-position: 62% 14%;
    border-radius: 18px;
    display: block;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.menu-toggle { display: grid; }

.coa-banner {
    background: linear-gradient(90deg, #12203a, #1d4ed8);
    color: #fff;
    text-align: center;
    font-family: Sora, sans-serif;
    font-size: 22px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}
.coa-board {
    display: grid;
    grid-template-columns: .92fr 1.18fr;
    gap: 16px;
    align-items: start;
}
.coa-col { display: flex; flex-direction: column; gap: 16px; }
.coa-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.coa-panel-head {
    background: #0e1a2e;
    color: #e2e8f0;
    font-weight: 700;
    padding: 10px 14px;
}
.coa-entry, .coa-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    align-items: end;
}
.coa-entry label, .coa-details label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}
.coa-entry input, .coa-entry select, .coa-details input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
    font-weight: 600;
}
.coa-entry .span-2, .coa-details .span-2 { grid-column: span 2; }
.coa-check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.coa-check input { width: auto; }
.coa-entry-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-save, .icon-new, .coa-mini {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.icon-save { background: #ecfdf5; color: #047857; }
.icon-new { background: #eef2ff; color: var(--indigo); }
.coa-mini { width: 32px; height: 32px; background: #fff1f2; color: var(--rose); }
.coa-table-wrap { max-height: 230px; overflow: auto; }
.coa-table-tall { max-height: 280px; }
.coa-table { width: 100%; border-collapse: collapse; }
.coa-table th {
    position: sticky;
    top: 0;
    background: #0e1a2e;
    color: #cbd5e1;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 8px 10px;
    text-align: left;
}
.coa-table td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.coa-table tr { cursor: pointer; }
.coa-table tr.is-selected td { background: #fff4d6; font-weight: 700; }
.coa-table tr:hover td { background: #f1f5f9; }
.coa-table tr.is-selected:hover td { background: #ffe8a3; }
.coa-empty { padding: 18px; color: var(--muted); text-align: center; }
.coa-legend { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

.stock-sheet {
    width: min(920px, 100%);
    margin: 0 auto;
    background: #fff;
    color: #111;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 36px 42px 48px;
    box-shadow: var(--shadow);
    font-family: Arial, Helvetica, sans-serif;
}
.stock-sheet h2 {
    margin: 0 0 28px;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0;
}
.stock-printed {
    margin: 0 0 22px;
    text-align: right;
    font-size: 15px;
}
.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.stock-table th {
    background: #d9d9d9;
    font-weight: 700;
    text-align: left;
    padding: 7px 10px;
    border-bottom: 2px solid #111;
}
.stock-table th.num,
.stock-table td.num { text-align: right; }
.stock-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #111;
}
.stock-table .code { width: 14%; }
.stock-table .qty { width: 18%; }
.stock-table .rate { width: 18%; }
.stock-empty td {
    text-align: center;
    color: #64748b;
    border-bottom: 1px solid #111;
}
.stock-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    margin-top: 16px;
    font-weight: 700;
}
.stock-total span {
    background: #d9d9d9;
    padding: 8px 16px;
    min-width: 88px;
    text-align: center;
}
.stock-total .label { min-width: 180px; }

.stock-ledger-open {
    border: 1px solid #111;
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
}
.stock-ledger-open b { font-size: 16px; }
.stock-ledger-product {
    display: flex;
    gap: 28px;
    margin: 0 0 12px;
    font-size: 15px;
}
.stock-ledger-product b { font-size: 16px; }
.stock-ledger-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-ledger-table th {
    background: #d9d9d9;
    text-align: left;
    padding: 7px 8px;
    border-bottom: 2px solid #111;
}
.stock-ledger-table td {
    padding: 7px 8px;
    border-bottom: 1px dashed #111;
    vertical-align: top;
}
.stock-ledger-table .num, .stock-ledger-table th.num { text-align: right; }
.stock-ledger-table .in { font-weight: 700; }
.stock-ledger-table .out { font-weight: 700; }
.stock-ledger-table tfoot td {
    background: #d9d9d9;
    font-weight: 800;
    border-bottom: 0;
}

@media print {
    .sidebar, .topbar, .page-head, .toast { display: none !important; }
    .app-shell .workspace,
    .app-shell.is-nav-pinned .workspace,
    html.is-nav-pinned .app-shell .workspace { margin-left: 0 !important; }
    body, .workspace, .page { background: #fff !important; }
    .page { padding: 0 !important; }
    .stock-sheet {
        width: auto;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    @page { size: A4 landscape; margin: 14mm 16mm; }
}

.ledger-filters { margin-bottom: 18px; }
.ledger-filters .btn { margin-top: 14px; }
.ledger-sheet {
    background: #fff;
    color: #111;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px 24px 32px;
    font-family: "Manrope", sans-serif;
}
.ledger-sheet h2 { margin: 0; text-align: center; font-size: 26px; }
.ledger-meta, .ledger-party, .ledger-open {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
}
.ledger-meta { margin: 8px 0 18px; font-size: 14px; }
.ledger-party { margin-bottom: 14px; }
.ledger-party strong { display: block; font-size: 22px; }
.ledger-party small, .ledger-open span { display: block; color: #334155; }
.ledger-open { text-align: right; }
.ledger-open b { font-size: 18px; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger-table th { background: #d9d9d9; text-align: left; padding: 7px 8px; }
.ledger-table td { padding: 7px 8px; border-bottom: 1px solid #111; vertical-align: top; }
.ledger-table .debit { color: #dc2626; font-weight: 700; }
.ledger-table .credit { color: #15803d; font-weight: 700; }
.daybook-table .debit { color: #15803d; font-weight: 700; }
.daybook-table .credit { color: #dc2626; font-weight: 700; }
.ledger-table tfoot td { font-weight: 800; background: #f8fafc; }
.ledger-empty { text-align: center; color: #64748b; }
.daybook-previous { text-align: right; margin: 0 0 8px; font-weight: 700; }
.daybook-previous b { font-size: 20px; margin-left: 12px; }
.daybook-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.daybook-table th { background: #e5e7eb; text-align: left; padding: 7px 8px; border-bottom: 2px solid #111; }
.daybook-table td { padding: 7px 8px; border-bottom: 1px solid #111; vertical-align: top; }
.daybook-split { width: 8px; background: #fff; border-left: 2px solid #111; border-right: 2px solid #111; padding: 0; }
.daybook-table tfoot td { font-weight: 800; background: #f8fafc; }
@media print {
    .ledger-filters, .page-head { display: none !important; }
    .ledger-sheet { border: 0; padding: 0; }
}

.aging-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.aging-table th { background: #d9d9d9; text-align: left; padding: 7px 8px; }
.aging-table td { padding: 7px 8px; border-bottom: 1px solid #111; vertical-align: top; }
.aging-table .num, .aging-table th.num { text-align: right; }
.aging-party td {
    background: #ecfdf5;
    border-bottom: 1px solid #0f766e;
    font-size: 14px;
}
.aging-party strong { margin-right: 10px; }
.aging-party span { color: #334155; margin-right: 16px; }
.aging-party b { margin-right: 16px; font-weight: 800; }
.aging-late td:last-child { color: #b91c1c; font-weight: 800; }
.aging-table tfoot td { font-weight: 800; background: #f8fafc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.balance-sheet {
    background: #fff;
    color: #111;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px 24px 32px;
    font-family: Arial, Helvetica, sans-serif;
}
.balance-title {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}
.balance-title h2 {
    margin: 0;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 28px;
    font-weight: 700;
}
.balance-date { text-align: right; font-size: 16px; font-weight: 700; }
.balance-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}
.balance-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.balance-table th {
    background: #d9d9d9;
    text-align: left;
    padding: 6px 8px;
    font-weight: 700;
}
.balance-table th.num, .balance-table td.num { text-align: right; }
.balance-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #111;
    vertical-align: top;
}
.balance-table .debit-amt { color: #dc2626; font-weight: 700; }
.balance-table tfoot td {
    background: #d9d9d9;
    font-weight: 800;
    border-bottom: 0;
}
.balance-empty { text-align: center; color: #64748b; }
@media print {
    .balance-sheet { border: 0; padding: 0; }
}
@media (max-width: 860px) {
    .balance-cols { grid-template-columns: 1fr; }
}

.cp-sheet {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: visible;
    box-shadow: var(--shadow);
    padding: 22px;
    font-family: "Manrope", sans-serif;
}
.cp-master {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.cp-master label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}
.cp-master input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    background: #f8fafc;
    color: var(--text);
    font: 600 14px/1.4 "Manrope", sans-serif;
}
.cp-master input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
    background: #fff;
    outline: none;
}
.cp-body {
    display: grid;
    grid-template-columns: minmax(0, 10fr) minmax(180px, 2fr);
    gap: 16px;
    align-items: start;
}
.cp-main { min-width: 0; }
.cp-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 16px;
    background: linear-gradient(180deg, #f8d0dc 0%, #f3b7c8 100%);
    border: 1px solid #e8a0b6;
    border-radius: 18px;
    padding: 14px;
}
.cp-side .btn { width: 100%; justify-content: center; }
.cr-bills {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff7f9;
    border: 1px solid #e7a8bc;
    border-radius: 16px;
    padding: 12px;
    max-height: 280px;
    overflow: auto;
}
.cr-bills > span {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9f1239;
}
.cr-bills p { margin: 0; color: var(--muted); font-size: 13px; }
.cr-bill {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    width: 100%;
    text-align: left;
    border: 1px solid #f3c1d3;
    background: #fff;
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
}
.cr-bill span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.cr-bill b { color: #9f1239; }
.cr-bill.is-selected { border-color: #be185d; background: #fff1f5; }
.btn-primary kbd,
.cp-side kbd {
    font-family: "Manrope", sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(6, 32, 28, .12);
}
.cp-total-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff7f9;
    border: 1px solid #e7a8bc;
    border-radius: 16px;
    padding: 14px;
}
.cp-total-box span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9f1239;
}
.cp-total-box strong {
    font-size: 26px;
    line-height: 1.1;
    color: #881337;
    text-align: right;
}
.cp-grid-wrap { overflow: visible; }
.cp-grid {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.cp-grid th {
    background: #0f766e;
    color: #f0fdfa;
    text-align: left;
    font-family: "Manrope", sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 12px 10px;
}
.cp-grid th:first-child { border-radius: 12px 0 0 12px; }
.cp-grid th:last-child { border-radius: 0 12px 12px 0; }
.cp-grid td {
    border-bottom: 1px solid var(--line);
    padding: 6px 8px;
    vertical-align: middle;
    background: #fff;
}
.cp-grid .cp-x { width: 42px; text-align: center; }
.cp-grid .cp-sno { width: 64px; text-align: center; font-weight: 700; }
.cp-grid th.cp-sno { color: #f0fdfa; background: #0f766e; }
.cp-grid td.cp-sno { color: #134e4a; }
.cp-grid .cp-amt { width: 150px; }
.cp-grid input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
    padding: 10px 12px;
    font: 600 14px/1.4 "Manrope", sans-serif;
    color: var(--text);
    outline: none;
}
.cp-grid input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
    background: #fff;
}
.cp-grid .cp-amount { text-align: right; }
.cp-remove {
    border: 0;
    background: #fff1f2;
    color: var(--rose);
    font-weight: 800;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
}
.cp-footer { padding-top: 14px; }
.cp-sheet .toast { margin-bottom: 14px; }

@media (max-width: 1100px) {
    .stats, .hero, .grid-2, .layout-split, .coa-board { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
    .form-grid-4 .span-2,
    .form-grid-4 .span-3 { grid-column: 1 / -1; }
    .hero-copy img { display: none; }
    .hero { grid-template-columns: 1fr; }
    .hero-art .passport-photo { min-height: 280px; max-height: 360px; }
    .coa-entry, .coa-details { grid-template-columns: 1fr 1fr; }
    .cp-body { grid-template-columns: 1fr; }
    .cp-side { position: static; }
}
@media (max-width: 860px) {
    .form-grid-4, .coa-entry, .coa-details { grid-template-columns: 1fr; }
    .app-shell .workspace,
    .app-shell.is-nav-pinned .workspace,
    html.is-nav-pinned .app-shell .workspace { margin-left: 0; }
    .sidebar,
    .sidebar:hover,
    .sidebar:focus-within,
    .app-shell.is-nav-pinned .sidebar,
    html.is-nav-pinned .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar);
        max-width: var(--sidebar);
        padding: 22px 18px;
        transform: translateX(-105%);
        z-index: 20;
        box-shadow: none;
        transition: transform .25s ease;
    }
    .sidebar.is-open { transform: none; box-shadow: 18px 0 40px rgba(7, 17, 31, .28); }
    .brand-copy,
    .nav-label,
    .nav-link span,
    .nav-link em,
    .sidebar-card {
        opacity: 1;
        max-width: 180px;
        max-height: 160px;
        pointer-events: auto;
    }
    .nav-label { margin: 18px 10px 8px; }
    .nav-link {
        justify-content: flex-start;
        padding: 11px 12px;
    }
    .sidebar-card {
        padding: 18px;
        border-color: rgba(255,255,255,.06);
    }
    .page, .topbar { padding-left: 16px; padding-right: 16px; }
    .user-chip small, .user-chip strong { display: none; }
}
