:root {
    --navy-950: #071a30;
    --navy-900: #0b2545;
    --navy-800: #123b66;
    --navy-700: #1b4f82;
    --ink: #182230;
    --ink-2: #344054;
    --muted: #667085;
    --line: #e4e7ec;
    --line-soft: #eef1f5;
    --surface: #ffffff;
    --canvas: #f5f6f8;
    --gold: #c6a14a;
    --gold-soft: #fbf5e7;
    --success: #067647;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --info: #175cd3;
    --info-soft: #eff8ff;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
    --radius: 12px;
    --sidebar: 256px;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--navy-900); }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 1.55rem; letter-spacing: -.02em; margin-bottom: .15rem; font-weight: 650; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; }
h3 { font-size: .98rem; }
svg.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: var(--navy-950);
    color: #cbd5e1;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    z-index: 40;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand .brand-logo {
    background: #fff;
    border-radius: 8px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
}
.sidebar-brand img { width: 100%; max-height: 42px; object-fit: contain; display: block; }
.sidebar-brand .brand-fallback { color: #fff; font-weight: 700; letter-spacing: .06em; }
.sidebar-kicker {
    padding: 6px 10px 2px;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #7c8fa8;
    font-weight: 700;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #c6d2e1;
    font-size: .88rem;
    font-weight: 500;
    transition: .15s ease;
    position: relative;
}
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
.side-link.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--gold);
}
.side-link .icon { width: 17px; height: 17px; opacity: .85; }
.side-link .count {
    margin-left: auto;
    font-size: .68rem;
    background: rgba(255, 255, 255, .13);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
}
.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 7px 8px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gold); color: var(--navy-950); font-weight: 700; font-size: .78rem;
    flex: 0 0 auto;
}
.side-user .name { color: #fff; font-size: .83rem; font-weight: 600; line-height: 1.2; }
.side-user .role { color: #8fa2b8; font-size: .72rem; }
.side-user form { margin-left: auto; }
.icon-btn {
    border: 0; background: transparent; color: inherit; cursor: pointer;
    border-radius: 7px; padding: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Main / topbar ---------- */
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 66px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .page-title { font-size: 1.02rem; font-weight: 650; line-height: 1.2; }
.topbar .page-subtitle { font-size: .76rem; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-date {
    font-size: .76rem; color: var(--muted); padding-right: 14px; margin-right: 2px;
    border-right: 1px solid var(--line); text-align: right; line-height: 1.3;
}
.mobile-menu { display: none; }
.content { padding: 26px 28px 44px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- Page primitives ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); font-size: .87rem; margin: .25rem 0 0; max-width: 760px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow {
    font-size: .67rem; text-transform: uppercase; letter-spacing: .11em;
    color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }
.money, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.money { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .gap-3 { gap: 18px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line); background: #fff; color: var(--ink-2);
    border-radius: 8px; padding: 8px 13px; font-size: .82rem; font-weight: 600;
    cursor: pointer; line-height: 1.2; transition: .15s ease; white-space: nowrap;
    font-family: inherit;
}
.btn:hover { border-color: #cdd5df; background: #fafbfc; color: var(--ink); }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn-gold:hover { background: #b78f35; border-color: #b78f35; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #05603a; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-soft); }
.btn-sm { padding: 5px 9px; font-size: .76rem; border-radius: 7px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--navy-700); padding: 0; font: inherit; cursor: pointer; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-head {
    padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: .95rem; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 13px 16px; }
.card-foot { padding: 12px 18px; background: #fbfcfd; border-top: 1px solid var(--line-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px;
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; right: -24px; top: -28px; width: 90px; height: 90px; background: var(--line-soft); border-radius: 50%; opacity: .6; }
.stat .stat-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--navy-900); color: #fff; position: relative; z-index: 1; }
.stat .stat-icon.gold { background: var(--gold-soft); color: #8a6a1f; }
.stat .stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat .stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 2px; position: relative; z-index: 1; }
.stat .foot { font-size: .74rem; color: var(--muted); position: relative; z-index: 1; }
.stat .foot strong { color: var(--ink-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: 86px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: .76rem; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: .71rem; color: var(--muted); line-height: 1.4; }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="search"], input[type="tel"], input[type="file"], select, textarea {
    width: 100%; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff;
    padding: 8px 10px; font-size: .84rem; color: var(--ink); font-family: inherit; min-height: 37px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(27, 79, 130, .1);
}
input[readonly] { background: #f8fafc; color: var(--muted); }
textarea { resize: vertical; min-height: 78px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: .8rem; color: var(--ink-2); cursor: pointer; }
.checkline input[type="checkbox"], .checkline input[type="radio"] { width: 16px; height: 16px; min-height: 0; margin: 2px 0 0; accent-color: var(--navy-800); }
.checkline strong { font-weight: 600; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.radio-card {
    border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer;
    display: flex; gap: 8px; align-items: flex-start; transition: .15s ease; background: #fff;
}
.radio-card:hover { border-color: #b8c4d2; }
.radio-card:has(input:checked) { border-color: var(--navy-700); background: #f5f8fc; box-shadow: 0 0 0 1px var(--navy-700) inset; }
.radio-card input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--navy-800); }
.radio-card .rc-title { font-size: .79rem; font-weight: 650; line-height: 1.3; }
.radio-card .rc-sub { font-size: .69rem; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.errors, .alert-error { background: var(--danger-soft); border: 1px solid #fecdca; color: #912018; border-radius: 8px; padding: 10px 12px; font-size: .8rem; }
.errors ul { margin: 0; padding-left: 18px; }
.invalid { border-color: #f04438 !important; }
.error-text { color: var(--danger); font-size: .71rem; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .81rem; }
table.data th {
    text-align: left; font-size: .68rem; letter-spacing: .055em; text-transform: uppercase;
    color: var(--muted); background: #fafbfc; padding: 9px 12px; border-bottom: 1px solid var(--line);
    font-weight: 700; white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcff; }
table.data .strong { font-weight: 600; color: var(--ink); }
table.data .sub { display: block; font-size: .71rem; color: var(--muted); margin-top: 1px; }
table.data .num, table.data .money { text-align: right; }
.table-total td { background: #f8fafc; font-weight: 700; border-top: 1px solid var(--line); }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 32px; height: 32px; margin-bottom: 8px; color: #98a2b3; }
.empty h3 { color: var(--ink-2); margin-bottom: 4px; font-size: .95rem; }
.empty p { font-size: .81rem; margin-bottom: 14px; }

/* ---------- Badges / pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
    padding: 3px 8px; font-size: .69rem; font-weight: 650; line-height: 1.35;
    background: #f2f4f7; color: #475467; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-primary { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-dark { background: #f2f4f7; color: #344054; }
.badge-gold { background: var(--gold-soft); color: #8a6a1f; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: .72rem; color: var(--ink-2); background: #fff; }

/* ---------- Alerts ---------- */
.flash { display: flex; align-items: flex-start; gap: 9px; border-radius: 9px; padding: 11px 13px; margin-bottom: 16px; font-size: .82rem; border: 1px solid; }
.flash-success { background: var(--success-soft); border-color: #abefc6; color: #05603a; }
.flash-error { background: var(--danger-soft); border-color: #fecdca; color: #912018; }
.flash-info { background: var(--info-soft); border-color: #b2ddff; color: #1849a9; }
.flash .icon { width: 17px; height: 17px; margin-top: 1px; }
.flash .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .6; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
    padding: 8px 12px; border: 0; background: none; color: var(--muted); font-size: .81rem;
    font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy-900); border-bottom-color: var(--navy-900); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Dialog ---------- */
dialog {
    border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 28px));
    box-shadow: 0 24px 70px rgba(16, 24, 40, .25); color: var(--ink);
}
dialog::backdrop { background: rgba(7, 26, 48, .55); backdrop-filter: blur(2px); }
.dialog-head { padding: 17px 20px 0; display: flex; align-items: flex-start; gap: 10px; }
.dialog-head h3 { margin: 0; font-size: 1.02rem; }
.dialog-head p { margin: 3px 0 0; font-size: .8rem; color: var(--muted); }
.dialog-body { padding: 16px 20px; }
.dialog-foot { padding: 13px 20px; background: #fafbfc; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }
.dialog-close { margin-left: auto; }

/* ---------- Detail lists ---------- */
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: .82rem; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--ink); }
.detail-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fcfcfd; }
.detail-block h4 { margin: 0 0 9px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.client-address { font-size: .85rem; line-height: 1.65; }
.client-address .name { font-weight: 700; font-size: .9rem; }

/* ---------- Invoice form ---------- */
.line-table input { min-height: 34px; padding: 6px 8px; font-size: .8rem; }
.line-table select { min-height: 34px; padding: 6px 26px 6px 8px; font-size: .8rem; }
.line-table td { padding: 7px 6px; }
.line-table .line-desc { min-width: 260px; }
.item-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item-lines .table-wrap { overflow: visible; }
.tax-summary { display: flex; flex-direction: column; gap: 7px; font-size: .82rem; }
.tax-summary .row { display: flex; justify-content: space-between; gap: 10px; }
.tax-summary .row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-weight: 700; font-size: 1rem; }
.tax-summary .row .label { color: var(--muted); }
.tax-summary .row.total .label { color: var(--ink); }
.summary-meta { font-size: .76rem; color: var(--muted); line-height: 1.55; }
.tax-box { border: 1px dashed #d0d5dd; background: #fafbfc; border-radius: 9px; padding: 11px; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; gap: 4px; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.pager .meta { font-size: .75rem; color: var(--muted); }
.pager .pages { display: flex; gap: 3px; }
.pager a, .pager span {
    min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 7px; font-size: .77rem; color: var(--ink-2); background: #fff;
}
.pager a:hover { background: var(--line-soft); }
.pager .current { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---------- Misc ---------- */
.kv-inline { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.mono { font-family: "Cascadia Mono", "Courier New", ui-monospace, monospace; }
.invoice-no { font-family: "Cascadia Mono", "Courier New", monospace; font-weight: 700; letter-spacing: .01em; }
.amount-large { font-size: 1.65rem; font-weight: 700; letter-spacing: -.03em; }
.progress { height: 6px; background: #eaecf0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--line-soft); color: var(--ink-2); font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 15px 22px; border-left: 1px solid var(--line); margin-left: 7px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--navy-700); }
.timeline .when { font-size: .7rem; color: var(--muted); }
.timeline .what { font-size: .81rem; color: var(--ink-2); }
.mini-bar { display: flex; align-items: end; gap: 8px; height: 120px; padding: 10px 4px 0; }
.mini-bar .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; height: 100%; gap: 4px; }
.mini-bar .bars { display: flex; align-items: end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.mini-bar .bar { width: 10px; border-radius: 3px 3px 0 0; min-height: 2px; background: var(--navy-800); }
.mini-bar .bar.received { background: var(--gold); }
.mini-bar .lbl { font-size: .64rem; color: var(--muted); }
.legend { display: flex; gap: 12px; font-size: .71rem; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.quick-link { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; color: var(--ink-2); font-size: .82rem; }
.quick-link:hover { background: var(--line-soft); }
.quick-link .icon { color: var(--navy-700); }
.quick-link .arrow { margin-left: auto; color: #98a2b3; }
.note { font-size: .76rem; color: var(--muted); background: #fafbfc; border-left: 3px solid var(--gold); padding: 8px 11px; border-radius: 0 7px 7px 0; }
.callout { background: var(--gold-soft); border: 1px solid #f1e3bc; border-radius: 10px; padding: 12px 14px; font-size: .8rem; color: #6c5315; }
.callout .icon { color: #8a6a1f; }
.page-section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 2px 0 9px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-visual {
    background: radial-gradient(circle at 15% 15%, #1b4f82 0%, transparent 35%), linear-gradient(155deg, #071a30 0%, #0b2545 60%, #123b66 100%);
    color: #fff; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.login-visual::after { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; right: -160px; bottom: -200px; }
.login-visual::before { content: ""; position: absolute; width: 380px; height: 380px; border: 1px solid rgba(198,161,74,.25); border-radius: 50%; right: -80px; bottom: -100px; }
.login-brand { background: #fff; border-radius: 10px; padding: 10px 14px; width: 330px; max-width: 100%; }
.login-brand img { width: 100%; display: block; }
.login-copy { margin-top: auto; position: relative; z-index: 1; max-width: 520px; }
.login-copy h1 { font-size: 2.35rem; line-height: 1.14; letter-spacing: -.035em; margin-bottom: 14px; }
.login-copy p { color: #aebed2; font-size: .95rem; max-width: 440px; }
.login-copy .rule { width: 48px; height: 3px; background: var(--gold); margin-bottom: 19px; }
.login-foot { margin-top: 32px; color: #7f93ab; font-size: .74rem; position: relative; z-index: 1; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 44px; }
.login-card { width: 100%; max-width: 390px; }
.login-card h2 { font-size: 1.6rem; margin-bottom: 6px; letter-spacing: -.025em; }
.login-card .sub { color: var(--muted); font-size: .86rem; margin-bottom: 26px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 10px; margin-top: 6px; }
.login-hint { margin-top: 25px; padding: 11px 13px; background: var(--gold-soft); border: 1px solid #f1e3bc; border-radius: 9px; font-size: .74rem; color: #6c5315; line-height: 1.55; }
.login-hint code { background: rgba(255,255,255,.65); padding: 1px 4px; border-radius: 4px; font-size: .72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 50px rgba(0,0,0,.3); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .mobile-menu { display: inline-flex; }
    .topbar { padding: 0 18px; }
    .content { padding: 20px 18px 36px; }
    .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
    .sticky { position: static; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-form-wrap { min-height: 100vh; padding: 28px; }
}
@media (max-width: 640px) {
    html { font-size: 14px; }
    .stat-grid, .grid-4 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
    .radio-cards { grid-template-columns: 1fr; }
    .topbar-date { display: none; }
    .page-head-actions { width: 100%; }
    .card-body { padding: 14px; }
    .dl { grid-template-columns: 110px minmax(0, 1fr); }
}

@media print {
    .no-print, .sidebar, .topbar, .page-head-actions, .flash { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
}

.sidebar-scrim { display: none; }
@media (max-width: 960px) { body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(7, 26, 48, .45); z-index: 35; } }


/* ---------- Management executive view ---------- */
body.executive-mode { background: #f3f6fa; }
body.executive-mode .content { max-width: 1400px; }
body.executive-mode .topbar .page-title { font-size: 1.12rem; }
.exec-hero {
    background: radial-gradient(circle at 90% 10%, rgba(198,161,74,.22), transparent 30%), linear-gradient(135deg, #0b2545 0%, #123b66 70%, #1b4f82 100%);
    color: #fff; border-radius: 16px; padding: 28px 30px; margin-bottom: 22px;
    box-shadow: 0 10px 30px rgba(11,37,69,.18);
}
.exec-hero .eyebrow { color: #d7c18a; }
.exec-hero h1 { color: #fff; font-size: 2.1rem; margin: 3px 0 5px; letter-spacing: -.04em; }
.exec-hero p { color: #c6d6e8; max-width: 760px; margin-bottom: 18px; font-size: .95rem; }
.exec-periods { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exec-period {
    display: inline-flex; flex-direction: column; min-width: 130px; border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px; padding: 9px 13px; color: #e4edf7; background: rgba(255,255,255,.07);
    font-size: .82rem; font-weight: 600; line-height: 1.25; transition: .15s ease;
}
.exec-period span { font-size: .68rem; font-weight: 400; color: #aebfd2; margin-top: 2px; }
.exec-period:hover, .exec-period.active { background: #fff; color: var(--navy-900); border-color: #fff; }
.exec-period:hover span, .exec-period.active span { color: #667085; }
.exec-custom { display: flex; gap: 6px; align-items: end; flex-wrap: wrap; margin-top: 12px; }
.exec-custom label { font-size: .7rem; color: #c6d6e8; display: flex; flex-direction: column; gap: 3px; }
.exec-custom input { min-height: 33px; padding: 5px 7px; font-size: .78rem; width: 135px; }
.exec-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.exec-kpi {
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px;
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden; min-height: 130px;
}
.exec-kpi::after { content: ""; position: absolute; right: -28px; bottom: -38px; width: 110px; height: 110px; border-radius: 50%; background: var(--line-soft); }
.exec-kpi .k-label { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: .68rem; font-weight: 700; display: flex; align-items: center; gap: 7px; position: relative; z-index: 1; }
.exec-kpi .k-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.04em; margin: 10px 0 3px; color: var(--navy-950); position: relative; z-index: 1; }
.exec-kpi .k-note { font-size: .78rem; color: var(--muted); position: relative; z-index: 1; }
.exec-kpi.attention { border-color: #fecdca; background: #fffbfa; }
.exec-kpi.attention .k-value { color: var(--danger); }
.exec-kpi.good { border-color: #abefc6; background: #fbfffc; }
.exec-kpi.good .k-value { color: var(--success); }
.exec-section { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.exec-section .card-head { padding: 17px 20px; }
.exec-section .card-head h2 { font-size: 1.02rem; }
.exec-section .card-head .sub { font-size: .78rem; }
.exec-table table.data { font-size: .88rem; }
.exec-table table.data th { font-size: .69rem; padding: 11px 14px; }
.exec-table table.data td { padding: 13px 14px; }
.exec-table .money { font-size: .88rem; }
.exec-aging td, .exec-aging th { white-space: nowrap; }
.exec-aging .b-current { color: var(--success); }
.exec-aging .b-late { color: var(--warning); }
.exec-aging .b-old { color: var(--danger); }
.exec-link-row { cursor: pointer; }
.exec-link-row:hover { background: #f7fbff !important; }
.exec-mini-stats { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; padding: 16px 20px 20px; }
.exec-mini-stat { border-radius: 10px; background: #fafbfc; border: 1px solid var(--line-soft); padding: 11px 12px; }
.exec-mini-stat .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.exec-mini-stat .value { font-size: 1.02rem; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.exec-empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.exec-empty h3 { color: var(--ink-2); }
.exec-help { font-size: .82rem; color: var(--muted); line-height: 1.6; }
.exec-help strong { color: var(--ink-2); }
.exec-badge-days { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.exec-print-note { display: none; }
@media (max-width: 1100px) {
    .exec-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .exec-mini-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 640px) {
    .exec-hero { padding: 20px; }
    .exec-hero h1 { font-size: 1.6rem; }
    .exec-kpi-grid, .exec-mini-stats { grid-template-columns: 1fr; }
    .exec-period { min-width: 112px; }
}
@media print {
    .exec-hero { background: #fff !important; color: #000; border: 1px solid #999; box-shadow: none; }
    .exec-hero h1, .exec-hero p, .exec-hero .eyebrow { color: #000; }
    .exec-periods, .exec-custom, .topbar-actions, .no-print { display: none !important; }
    .exec-kpi { break-inside: avoid; border: 1px solid #999; box-shadow: none; }
    .exec-section { break-inside: avoid; box-shadow: none; border: 1px solid #999; }
    .exec-print-note { display: block; font-size: .8rem; color: #444; margin-bottom: 10px; }
}

.card .exec-period { background: #f8fafc; border-color: var(--line); color: var(--ink-2); }
.card .exec-period span { color: var(--muted); }
.card .exec-period:hover, .card .exec-period.active { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.card .exec-period:hover span, .card .exec-period.active span { color: #c6d6e8; }

/* ---------- Forced password change ---------- */
body.password-body { background: radial-gradient(circle at 10% 0%, #e8eef6 0%, #f5f7fa 45%, #fff 100%); }
.password-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.password-card { width: min(540px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px; box-shadow: 0 18px 50px rgba(15,42,74,.10); }
.password-logo img { height: 52px; width: auto; margin-bottom: 18px; }
.password-card h1 { font-size: 1.65rem; margin: 3px 0 8px; letter-spacing: -.035em; }
.password-card .lead { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
@media (max-width: 520px) { .password-card { padding: 22px; } }

/* ---------- Office context ---------- */
.office-switcher { display: flex; align-items: center; gap: 6px; }
.office-switcher label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.office-switcher select { min-height: 34px; font-size: .78rem; max-width: 220px; padding: 5px 28px 5px 8px; }
.office-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: #eef4fb; color: var(--navy-800); font-size: .72rem; font-weight: 650; white-space: nowrap; }
@media (max-width: 900px) { .office-switcher { display: none; } }

/* MIS question/answer alignment */
.detail-list { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr); gap: 8px 18px; align-items: start; }
.detail-list dt { margin: 0; color: var(--muted); font-weight: 600; }
.detail-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 720px) { .detail-list { grid-template-columns: 1fr; gap: 2px; } .detail-list dd { margin-bottom: 8px; } }
