@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --ink: #0b1220;
    --ink-soft: #5b6b7c;
    --muted: #8a98a8;
    --paper: #e8eef5;
    --paper-2: #f7fafc;
    --surface: #ffffff;
    --line: #d5dee8;
    --line-strong: #b8c5d4;
    --sidebar: #07111f;
    --sidebar-2: #0d1a2c;
    --accent: #0f766e;
    --accent-2: #14b8a6;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --ok: #047857;
    --warn: #b45309;
    --danger: #b91c1c;
    --info: #0369a1;
    --shadow: 0 1px 2px rgba(11, 18, 32, 0.04), 0 12px 32px rgba(11, 18, 32, 0.06);
    --shadow-lg: 0 24px 60px rgba(7, 17, 31, 0.18);
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Manrope', system-ui, sans-serif;
    --display: 'Instrument Serif', Georgia, serif;
}

* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(20, 184, 166, 0.14), transparent 55%),
        radial-gradient(700px 380px at 100% 0%, rgba(3, 105, 161, 0.08), transparent 50%),
        linear-gradient(180deg, #edf2f7 0%, var(--paper) 100%);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ——— Shell ——— */
.impersonation-banner {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center;
    background: #b45309; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 700;
}
.impersonation-banner form { margin: 0; }
.app-shell { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar {
    background:
        radial-gradient(420px 240px at 0% 0%, rgba(20, 184, 166, 0.18), transparent 60%),
        linear-gradient(185deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #d7e0ea;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 14px;
    border-right: 1px solid rgba(255,255,255,.06);
    z-index: 40;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 8px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(145deg, var(--accent-2), var(--accent));
    display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: -.02em;
    box-shadow: 0 10px 24px rgba(15, 118, 110, .35);
}
button:not(.btn-icon)[wire\:click^="removeLine"] {
    width: 34px;
    min-width: 34px;
    padding: 8px;
    overflow: hidden;
    color: #b91c1c;
    font-size: 0;
}
button:not(.btn-icon)[wire\:click^="removeLine"]::before {
    content: "🗑";
    font-size: 16px;
    line-height: 1;
}
.brand b { display: block; font-family: var(--display); font-size: 22px; font-weight: 400; color: #fff; line-height: 1.1; }
.brand small { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 10px; font-weight: 600; }

.org-chip {
    margin: 0 4px; padding: 12px 12px; border-radius: 12px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.org-chip .label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.org-chip strong { color: #fff; font-size: 13px; font-weight: 700; }

.nav { overflow: auto; flex: 1 1 auto; min-height: 0; padding-right: 2px; -webkit-overflow-scrolling: touch; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #7d8b9a; padding: 8px 10px 6px; font-weight: 700; }
.nav a {
    display: flex; gap: 10px; align-items: center;
    padding: 10px 12px; border-radius: 11px; color: #c5d0db;
    font-weight: 600; font-size: 13.5px; margin: 2px 0;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav a .nav-ico {
    width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
    background: rgba(255,255,255,.05); font-size: 13px; flex-shrink: 0;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--accent-soft); color: #fff; box-shadow: inset 0 0 0 1px rgba(20,184,166,.28); }
.nav a.active .nav-ico { background: rgba(20,184,166,.22); color: #5eead4; }

.sidebar-foot {
    margin-top: auto; padding: 12px; border-radius: 12px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); font-size: 12px;
}
.sidebar-foot strong { color: #fff; }
.btn-logout {
    margin-top: 10px; width: 100%; justify-content: center;
    background: transparent; border: 1px solid rgba(255,255,255,.14); color: #e8eef5;
}
.btn-logout:hover { background: rgba(255,255,255,.06); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 16px 28px 10px; position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(10px); background: rgba(232, 238, 245, .78);
    border-bottom: 1px solid rgba(213, 222, 232, .7);
}
.crumb { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.crumb strong { color: var(--ink); }
.user-chip { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.avatar {
    width: 36px; height: 36px; border-radius: 12px;
    background: linear-gradient(145deg, #134e4a, var(--accent-2));
    color: #fff; display: grid; place-items: center; font-weight: 800;
}
.content { padding: 12px 28px 48px; flex: 1; min-width: 0; overflow-x: clip; }

.menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 10px; cursor: pointer; flex-shrink: 0;
}
.menu-toggle-bars {
    display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 18px;
}
.menu-toggle-bars span {
    display: block; height: 2px; width: 100%; background: var(--ink);
    border-radius: 2px; transition: transform .2s ease, opacity .2s ease;
}
.sidebar-close {
    display: none; position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.06); color: #e8eef5; border-radius: 10px;
    cursor: pointer; font-size: 15px; line-height: 1; z-index: 2;
}
.sidebar-close:hover { background: rgba(255,255,255,.12); color: #fff; }
body.nav-locked { overflow: hidden; }
.sidebar-backdrop { display: none; }

/* ——— Page ——— */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head .eyebrow { color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.page-head h1 { margin: 0; font-family: var(--display); font-size: clamp(28px, 3vw, 36px); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.page-head .sub { margin-top: 6px; color: var(--ink-soft); font-size: 14px; }
.muted { color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

/* ——— Buttons ——— */
.btn {
    border: 0; border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 13.5px; line-height: 1; transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 14.5px; }
.btn-primary { background: linear-gradient(180deg, #11968c, var(--accent)); color: #fff; box-shadow: 0 8px 18px rgba(15,118,110,.28); }
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--paper-2); color: var(--ink); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-icon {
    width: 38px; height: 38px; padding: 0; min-height: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-danger-soft {
    color: var(--danger); border: 1px solid rgba(220,38,38,.22); background: #fef2f2;
}
.btn-danger-soft:hover:not(:disabled) { background: #fee2e2; color: #b91c1c; }
.btn-danger-soft:disabled { opacity: .4; cursor: not-allowed; }
.btn-info { background: var(--info); color: #fff; }
.btn[disabled], .btn[wire\:loading][disabled] { opacity: .55; cursor: not-allowed; }
.spinner {
    width: 14px; height: 14px; border: 2px solid rgba(11, 18, 32, .18); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
.btn-primary .spinner, .btn-danger .spinner, .btn-ok .spinner, .btn-warn .spinner, .btn-info .spinner {
    border-color: rgba(255,255,255,.35); border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-busy {
    display: none; align-items: center; gap: 10px; margin-bottom: 14px;
    padding: 10px 14px; border-radius: 12px; background: #0b1220; color: #fff; font-weight: 700; font-size: 13px;
}
.page-busy .spinner { border-color: rgba(255,255,255,.25); border-top-color: #fff; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tenant-actions { flex-wrap: nowrap; white-space: nowrap; min-width: max-content; }
.tenant-actions .btn { flex: 0 0 auto; }
.action-bar {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    padding: 12px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 16px;
}
.action-bar .note-input {
    flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 12px; background: var(--paper-2);
}
.action-bar-spacer { flex: 1 1 auto; min-width: 8px; }

/* ——— Cards / panels ——— */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card, .kpi, .table-wrap, .panel, .stat-tile {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.kpi, .stat-tile { padding: 18px; position: relative; overflow: hidden; }
.kpi::after, .stat-tile::after {
    content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px;
    border-radius: 50%; background: var(--accent-soft); pointer-events: none;
}
.kpi span, .stat-tile span { color: var(--ink-soft); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.kpi strong, .stat-tile strong { display: block; font-size: 26px; margin-top: 10px; letter-spacing: -.02em; }
.kpi em, .stat-tile em { font-style: normal; color: var(--accent); font-size: 12px; font-weight: 700; display: block; margin-top: 6px; }
.kpi a { display: block; }
.kpi a:hover strong { color: var(--accent); }

.dashboard-hero { margin-bottom: 16px; }
.dashboard-actions { justify-content: flex-end; }
.dashboard-filters {
    display: grid; grid-template-columns: minmax(190px, 1.35fr) repeat(3, minmax(145px, .8fr)) auto;
    gap: 12px; align-items: end; padding: 14px 16px;
}
.dashboard-filters > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.filter-eyebrow, .panel-kicker {
    color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.dashboard-filters small { color: var(--ink-soft); font-size: 12px; }
.dashboard-filter { display: flex; flex-direction: column; gap: 5px; }
.dashboard-filter span { color: var(--ink-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.dashboard-filter select { min-width: 0; padding: 9px 10px; }
.dashboard-refresh { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; font-weight: 800; white-space: nowrap; padding-bottom: 10px; }
.dashboard-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 16px; }
.dashboard-kpis .kpi { min-height: 132px; padding: 16px; border-top: 3px solid var(--accent); }
.dashboard-kpis .kpi-revenue { border-top-color: #0f766e; }
.dashboard-kpis .kpi-cash { border-top-color: #16a34a; }
.dashboard-kpis .kpi-outstanding { border-top-color: #2563eb; }
.dashboard-kpis .kpi-approval { border-top-color: #d97706; }
.dashboard-kpis .kpi-gate { border-top-color: #7c3aed; }
.dashboard-kpis .kpi-party { border-top-color: #db2777; }
.platform-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 16px; }
.dashboard-grid-lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-page {
    min-width: 0;
    max-width: 100%;
}
.dashboard-page .dashboard-grid,
.dashboard-page .dashboard-grid-lower {
    min-width: 0;
}
.dashboard-page .dashboard-grid > .panel,
.dashboard-page .dashboard-grid-lower > .panel {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}
.dashboard-chart-panel { min-height: 290px; }
.import-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.import-toolbar .import-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    margin-right: 4px;
}
.import-toolbar .import-copy h2 { margin: 0; }
.import-toolbar input[type=file] {
    width: auto;
    max-width: 280px;
    padding: 6px 8px;
}
.import-toolbar .btn { flex: 0 0 auto; width: auto; }
.panel-head > div { display: flex; flex-direction: column; gap: 3px; }
.panel-head .panel-kicker + h2 { margin-top: 0; }
.chart-caption { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.line-chart { margin: 12px -4px 0; }
.line-chart svg { display: block; width: 100%; height: 188px; overflow: visible; }
.chart-grid-line { stroke: #dbe5eb; stroke-width: 1; stroke-dasharray: 4 5; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.chart-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 4px 10px 0; color: var(--ink-soft); font-size: 10px; text-align: center; }
.chart-empty { min-height: 170px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; color: var(--ink-soft); text-align: center; }
.chart-empty strong { color: var(--ink); }
.document-bars, .aging-list, .top-parties { display: flex; flex-direction: column; gap: 14px; }
.document-bar > div:first-child, .aging-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.document-bar strong, .aging-row strong { color: var(--ink); }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e7eef2; margin-top: 6px; }
.bar-track i { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #2dd4bf); }
.dashboard-mini-stat { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--ink-soft); font-size: 12px; }
.dashboard-mini-stat strong { color: var(--ink); }
.low-stock-widget { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.low-stock-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 8px; }
.low-stock-heading > span, .low-stock-heading strong { display: flex; flex-direction: column; gap: 3px; }
.low-stock-heading strong { font-size: 13px; }
.low-stock-heading a { color: var(--danger); font-size: 12px; font-weight: 800; }
.low-stock-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.low-stock-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.low-stock-row b { color: var(--danger); white-space: nowrap; font-variant-numeric: tabular-nums; }
.change-log { display: flex; flex-direction: column; gap: 12px; }
.change-log-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1.4fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.change-log-body { display: flex; flex-direction: column; gap: 4px; }
.audit-toggle {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.audit-toggle:hover { border-color: var(--accent); color: var(--accent); }
.audit-row.is-open td { background: #f8fafc; }
.audit-detail-row td { background: #f8fafc; padding: 0 14px 14px; }
.audit-detail {
    border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px 16px; margin-top: 4px;
}
.audit-meta {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; font-size: 13px;
}
.audit-meta span { display: block; font-size: 11px; margin-bottom: 2px; }
.audit-change { border-bottom-color: #eef2f7; }
@media (max-width: 900px) {
    .audit-meta { grid-template-columns: 1fr 1fr; }
}
.bar-safe { background: #16a34a !important; }
.bar-info { background: #2563eb !important; }
.bar-warn { background: #d97706 !important; }
.bar-danger { background: #dc2626 !important; }
.top-party { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.top-party .rank { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 900; }
.top-party strong, .top-party small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-party small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.top-party > b { font-size: 12px; white-space: nowrap; }
.dashboard-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-shadow: none;
    border: 0;
}
.dashboard-table table {
    min-width: 480px;
    width: 100%;
}
.dashboard-table th,
.dashboard-table td {
    vertical-align: top;
}
.dashboard-table td:first-child {
    min-width: 140px;
}
.dashboard-table td .muted {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.dashboard-table td.money {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.dashboard-table .badge {
    white-space: nowrap;
}
.report-tax-stack { display: flex; flex-direction: column; gap: 0; }
.report-tax-stack > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.report-tax-stack > div strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.report-tax-stack > .grand { margin-top: 4px; padding-top: 14px; border-top: 2px solid var(--accent); border-bottom: 0; color: var(--ink); font-weight: 800; }
.report-tax-stack > .grand strong { color: var(--accent); font-size: 16px; }
.report-head { flex-direction: column; align-items: stretch; }
.reports-page {
    min-width: 0;
    max-width: 100%;
}
.reports-page .panel {
    overflow: visible;
    min-width: 0;
}
.reports-page .kpi,
.reports-page .stat-tile {
    overflow: hidden;
    min-width: 0;
}
.reports-page .kpi strong,
.reports-page .stat-tile strong {
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: clamp(16px, 1.8vw, 24px);
}
.report-kpis {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.report-mini-kpis {
    margin-bottom: 14px;
}
.report-mini-kpis-3,
.report-mini-kpis-4 {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.report-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.report-filter-hint { margin: 12px 0 0; }
.report-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.report-table {
    box-shadow: none;
    border: 0;
    max-height: 320px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.report-table-tall { max-height: 420px; }
.report-table table { min-width: 520px; width: 100%; }
.report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 16px;
    width: 100%;
    overflow: visible;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.report-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 280px;
}
.report-toolbar-group--end {
    flex: 0 1 auto;
    margin-left: auto;
}
.report-toolbar .btn { flex: 0 1 auto; white-space: nowrap; }
.report-toolbar-label {
    flex: 0 0 auto; font-size: 11px; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted); width: 100%;
}
.report-toolbar-sep { display: none; }
.mail-wizard { width: 100%; }
.mail-wizard-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mail-wizard-step {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-soft);
    border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 800;
}
.mail-wizard-step span {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: #e2e8f0; color: var(--ink); font-size: 11px;
}
.mail-wizard-step.is-active { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.mail-wizard-step.is-active span, .mail-wizard-step.is-done span { background: var(--accent); color: #fff; }
.mail-test-success { margin-bottom: 12px; }
.mail-locked {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    border: 1px solid #a7f3d0; background: #ecfdf5; border-radius: 12px; padding: 16px;
}
.mail-locked-copy { min-width: 0; }
.mail-locked-dl { display: grid; gap: 8px; margin: 12px 0 0; }
.mail-locked-dl > div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; font-size: 13px; }
.mail-locked-dl dt { color: var(--muted); font-weight: 700; }
.mail-locked-dl dd { margin: 0; word-break: break-all; }
.mail-template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.mail-template-card {
    display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line);
    border-radius: 10px; padding: 12px; cursor: pointer; background: var(--paper-2);
}
.mail-template-card input { margin-right: 6px; }
.mail-template-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.mail-template-card span { color: var(--ink-soft); font-size: 12px; }
.otp-emergency {
    font-family: ui-monospace, monospace; font-size: 28px; letter-spacing: .35em;
    margin: 8px 0; font-weight: 800;
}
.stock-list { display: flex; flex-direction: column; gap: 0; max-height: 480px; overflow: auto; }
.stock-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.stock-row strong, .stock-row small { display: block; }
.stock-row strong { font-size: 13px; }
.stock-row small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.stock-row b { color: var(--accent); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-row b.stock-negative { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1.35fr .85fr; gap: 16px; }
.invoice-show-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 0.72fr);
    align-items: start;
}
.invoice-show-grid > .panel,
.invoice-show-grid > .stack {
    min-width: 0;
    max-width: 100%;
}
.invoice-show-page .stack {
    min-width: 0;
    max-width: 100%;
}
.invoice-items-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    box-shadow: none;
    border: 1px solid var(--line);
}
.invoice-items-table table {
    min-width: 620px;
    width: 100%;
    table-layout: auto;
}
.invoice-items-table th,
.invoice-items-table td { padding: 10px 8px; vertical-align: top; }
.invoice-items-table th:first-child,
.invoice-items-table td:first-child { min-width: 160px; width: 34%; }
.invoice-items-table th.num,
.invoice-items-table td.num { text-align: right; white-space: nowrap; width: 1%; }
.invoice-items-table th.num { font-size: 10px; }
.invoice-items-table td.money { font-variant-numeric: tabular-nums; }
.invoice-show-page .panel-payment .form-grid-2,
.invoice-show-page .panel-cancel .field {
    min-width: 0;
}
.invoice-show-page .payment-actions {
    margin-top: 12px;
    width: 100%;
}
.invoice-show-page .payment-actions .btn,
.invoice-show-page .btn-block-mobile {
    width: 100%;
    justify-content: center;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel { padding: 20px; max-width: 100%; overflow-x: clip; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel h2, .panel-head h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.panel .hint { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }

.section-gap { margin-top: 16px; }

/* ——— Tables ——— */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); background: var(--paper-2); font-weight: 700; }
.table-wrap { overflow: auto; }
.table-wrap.is-loading { opacity: 0.45; pointer-events: none; }
.table-wrap table { min-width: 640px; }
.table-wrap tbody tr { transition: background .12s ease; }
.table-wrap tbody tr:hover { background: rgba(15, 118, 110, 0.03); }
.pager-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.pager-size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.pager-size select { width: auto; min-width: 4.5rem; padding: 6px 10px; }
.pager-links { margin-left: auto; }
.pagination-wrap { margin-top: 0; }
.pager-links .pagination,
.pagination-wrap .pagination {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    list-style: none; margin: 0; padding: 0;
}
.pager-links .page-item,
.pagination-wrap .page-item { display: inline-flex; }
.pager-links .page-link,
.pagination-wrap .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--ink); text-decoration: none;
    font-size: 13px; font-weight: 600; line-height: 1;
}
.pager-links .page-item.active .page-link,
.pagination-wrap .page-item.active .page-link {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.pager-links .page-item.disabled .page-link,
.pagination-wrap .page-item.disabled .page-link {
    opacity: .45; pointer-events: none; background: #f8fafc;
}
.pager-links .page-link svg,
.pagination-wrap .page-link svg {
    width: 14px !important; height: 14px !important; max-width: 14px; max-height: 14px;
    display: block;
}
.pager-links .page-link span[aria-hidden],
.pagination-wrap .page-link span[aria-hidden] {
    font-size: 14px; line-height: 1; font-weight: 700;
}
.table-wrap a { font-weight: 700; color: var(--ink); }
.table-wrap a:hover { color: var(--accent); }
.line-editor input, .line-editor select, .table-wrap input, .table-wrap select {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff;
}
.line-editor td { vertical-align: middle; }
.line-item-select--full,
.line-item-custom-input {
    width: 100%;
    min-width: 0;
}
.line-item-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}
.line-item-custom-input { flex: 1 1 auto; }
.line-item-pick {
    flex: 0 0 auto;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
}
.line-thumb { max-width: 52px; max-height: 52px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; display: block; margin-top: 6px; }
.line-editor--compact .line-thumb {
    width: 50px;
    height: 50px;
    max-width: 50px;
    max-height: 50px;
    margin: 0;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    display: block;
}
.line-image-cell { min-width: 88px; }
.line-editor--compact .line-image-cell {
    min-width: 64px;
    width: 64px;
    vertical-align: middle;
}
.line-photo-upload {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}
.line-photo-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 3;
}
.line-photo-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.line-photo-loader {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 8px;
}
.line-photo-loader .spinner {
    width: 22px;
    height: 22px;
    border-width: 2px;
}
.line-photo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 4px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--paper-2);
    font-size: 9px;
    font-weight: 700;
    color: var(--ink-soft);
    text-align: center;
    line-height: 1.15;
    box-sizing: border-box;
}
.line-photo-upload.has-photo {
    border: 1px solid var(--line);
    background: #fff;
}
.line-photo-upload:hover .line-photo-btn,
.line-photo-upload.has-photo:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.line-image-cell .line-thumb {
    margin: 0;
}

/* Quotation line editor — full-width columns on desktop */
@media (min-width: 769px) {
    .table-wrap.line-editor--compact {
        overflow: visible;
    }
    .line-editor--compact table {
        width: 100% !important;
        min-width: 100% !important;
        table-layout: fixed;
    }
    .line-editor--compact col.col-desc { width: 26%; }
    .line-editor--compact col.col-image { width: 64px; }
    .line-editor--compact col.col-hsn { width: 8%; }
    .line-editor--compact col.col-qty { width: 7%; }
    .line-editor--compact col.col-unit { width: 7%; }
    .line-editor--compact col.col-rate { width: 9%; }
    .line-editor--compact col.col-disc { width: 7%; }
    .line-editor--compact col.col-gst { width: 7%; }
    .line-editor--compact col.col-profit { width: 7%; }
    .line-editor--compact col.col-estimate { width: 10%; }
    .line-editor--compact col.col-actions { width: 6%; }
    .line-editor--compact th,
    .line-editor--compact td {
        padding: 8px 6px;
    }
    .line-editor--compact th:first-child,
    .line-editor--compact td.line-item-desc {
        padding-left: 12px;
    }
    .line-editor--compact th:last-child,
    .line-editor--compact td.line-actions {
        padding-left: 4px;
        padding-right: 12px;
        text-align: right;
        vertical-align: middle;
    }
    .line-editor--compact td.line-actions .btn {
        margin-left: auto;
    }
    .line-editor--compact td.line-hsn,
    .line-editor--compact td.line-qty,
    .line-editor--compact td.line-unit,
    .line-editor--compact td.line-rate,
    .line-editor--compact td.line-disc,
    .line-editor--compact td.line-gst,
    .line-editor--compact td.line-profit {
        padding-left: 4px;
        padding-right: 4px;
    }
    .line-editor--compact td.line-estimate {
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }
    .line-editor--compact input,
    .line-editor--compact select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 6px 8px;
        font-size: 13px;
        min-height: 36px;
    }
    .line-editor--compact td.line-hsn input,
    .line-editor--compact td.line-qty input,
    .line-editor--compact td.line-unit select,
    .line-editor--compact td.line-rate input,
    .line-editor--compact td.line-disc input,
    .line-editor--compact td.line-gst input,
    .line-editor--compact td.line-profit input {
        min-height: 36px;
        padding: 6px 8px;
        font-size: 13px;
    }
    .line-editor--compact td.line-image-cell .line-photo-btn {
        width: 50px;
        height: 50px;
        min-height: 50px;
        padding: 4px;
        font-size: 9px;
    }
    .line-editor--compact td.line-image-cell input[type="file"] {
        position: absolute;
        inset: 0;
        opacity: 0;
        width: 100%;
        height: 100%;
    }
}

@media (max-width: 768px) {
    .line-editor {
        border: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    .line-editor table {
        min-width: 0 !important;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0 14px;
    }
    .line-editor thead { display: none; }
    .line-editor tbody,
    .line-editor tr {
        display: block;
        width: 100%;
    }
    .line-editor tr {
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: var(--surface);
        box-shadow: var(--shadow);
    }
    .line-editor td {
        display: block;
        width: 100% !important;
        border: 0 !important;
        padding: 8px 0 !important;
    }
    .line-editor td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--ink-soft);
        margin-bottom: 6px;
    }
    .line-editor td.line-actions {
        margin-top: 4px;
        padding-top: 12px !important;
        border-top: 1px solid var(--line) !important;
    }
    .line-editor td.line-actions::before { display: none; }
    .line-editor td.line-actions .btn { width: 100%; justify-content: center; }
    .line-editor td.money {
        font-size: 17px;
        font-weight: 800;
        color: var(--accent);
        padding-top: 4px !important;
    }
    .line-editor .line-thumb { max-width: 72px; max-height: 72px; }
    .line-editor--compact .line-thumb {
        width: 50px;
        height: 50px;
        max-width: 50px;
        max-height: 50px;
    }
    .line-editor .line-image-cell input[type="file"] { max-width: 100%; }

    .line-editor--compact tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 12px;
        padding-top: 44px;
        position: relative;
    }
    .line-editor--compact td.line-item-desc,
    .line-editor--compact td.line-image-cell,
    .line-editor--compact td.line-hsn,
    .line-editor--compact td.line-estimate {
        grid-column: 1 / -1;
    }
    .line-editor--compact td.line-image-cell {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .line-editor--compact .line-item-select--full,
    .line-editor--compact .line-item-custom {
        width: 100%;
    }
    .line-editor--compact td.line-qty,
    .line-editor--compact td.line-unit,
    .line-editor--compact td.line-rate,
    .line-editor--compact td.line-disc,
    .line-editor--compact td.line-gst,
    .line-editor--compact td.line-profit {
        padding: 6px 0 !important;
    }
    .line-editor--compact td.line-hsn input,
    .line-editor--compact td.line-qty input,
    .line-editor--compact td.line-unit select,
    .line-editor--compact td.line-rate input,
    .line-editor--compact td.line-disc input,
    .line-editor--compact td.line-gst input,
    .line-editor--compact td.line-profit input {
        min-height: 36px;
        padding: 6px 8px;
        font-size: 13px;
    }
    .line-editor--compact td.line-image-cell .line-photo-btn {
        width: 50px;
        height: 50px;
        min-height: 50px;
        padding: 4px;
        font-size: 9px;
    }
    .line-editor--compact td.line-actions {
        position: absolute; top: 10px; right: 10px;
        width: auto !important; margin: 0 !important;
        padding: 0 !important; border: 0 !important;
    }
    .line-editor--compact td.line-actions .btn { width: auto; min-height: 0; }
    .line-editor--compact td.line-estimate {
        margin-top: 4px; padding-top: 10px !important;
        border-top: 1px dashed var(--line) !important;
    }
}

.badge {
    display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px;
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.badge-neutral { background: #e8eef5; color: #334155; }
.badge-warning { background: #ffedd5; color: #9a3412; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ——— Forms ——— */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.form-grid > .address-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.form-grid > .form-row-2 { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; align-items: center; }
.form-grid > .form-row-2.form-row-fields { align-items: stretch; }
.form-grid > .form-row-2 .field-check { margin-top: 0; }
.form-grid > .form-row-4 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.field > .field-check { margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-3, .field-check.span-3 { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.req { color: #dc2626; font-weight: 800; }
.field input, .field select, .field textarea,
.panel input:not([type=checkbox]):not([type=radio]),
.panel select, .panel textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus,
.panel input:focus, .panel select:focus, .panel textarea:focus {
    border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(20,184,166,.15); outline: none;
}
.field textarea, .panel textarea { min-height: 88px; resize: vertical; }
.field.field-check {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}
.field.field-check input[type=checkbox] {
    margin: 0;
}
.field.field-check > label {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    line-height: 1.4;
}
.field.field-check .help-text {
    width: 100%;
    margin: 0;
}
.field-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.field-check input[type=checkbox],
.panel input[type=checkbox],
.field label input[type=checkbox] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.field-check label,
.field > label:has(input[type=checkbox]) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    line-height: 1.4;
}
.field > label:has(input[type=checkbox]) input[type=checkbox] {
    margin: 0;
}
.error { color: var(--danger); font-size: 12px; font-weight: 600; }
.help-text { font-size: 12px; color: var(--muted); }
.form-section-title {
    grid-column: 1 / -1; margin: 6px 0 0; font-size: 12px; font-weight: 800;
    letter-spacing: .06em; text-transform: uppercase; color: var(--accent, #0f766e);
}
.form-row-heading {
    grid-column: 1 / -1;
    margin: 10px 0 -4px;
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
}
.file-preview { display: flex; align-items: center; gap: 10px; min-height: 8px; }
.file-preview img { max-height: 48px; max-width: 120px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; }
.doc-preview-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: block; }
.perm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.perm-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); }
.perm-card strong { display: block; margin-bottom: 8px; font-size: 13px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 4px 0; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }
.org-chip img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; margin-right: 8px; }

.totals-box {
    margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px;
    display: grid; gap: 8px; max-width: 320px; margin-left: auto;
}
.totals-box div { display: flex; justify-content: space-between; gap: 24px; font-size: 13.5px; }
.totals-box .grand { font-size: 16px; font-weight: 800; color: var(--ink); padding-top: 6px; border-top: 1px solid var(--line); }
.gst-bill-summary { margin-left: 0; max-width: 440px; }

/* ——— Flash / empty ——— */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.flash-ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.empty-state {
    text-align: center; padding: 42px 20px; color: var(--ink-soft);
}
.empty-state strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ——— Timeline ——— */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0 0 16px 18px; border-left: 2px solid rgba(15,118,110,.25); position: relative; }
.timeline li:before {
    content: ''; width: 10px; height: 10px; background: var(--accent); border-radius: 50%;
    position: absolute; left: -6px; top: 4px; box-shadow: 0 0 0 3px rgba(15,118,110,.15);
}
.timeline .when { font-size: 12px; color: var(--muted); }

/* ——— Auth ——— */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(800px 420px at 15% 10%, rgba(20,184,166,.22), transparent 55%),
        radial-gradient(600px 360px at 90% 80%, rgba(3,105,161,.18), transparent 50%),
        linear-gradient(160deg, #07111f 0%, #0d1a2c 55%, #102033 100%);
}
.auth-card {
    width: min(1040px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden;
    border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.auth-copy {
    padding: 48px 42px; color: #e8eef5;
    background:
        radial-gradient(500px 280px at 0% 0%, rgba(20,184,166,.25), transparent 60%),
        linear-gradient(165deg, #0b1626, #0f2740);
}
.auth-copy .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-copy .eyebrow { letter-spacing: .16em; text-transform: uppercase; color: #5eead4; font-size: 11px; font-weight: 800; }
.auth-copy h1 { font-family: var(--display); font-size: clamp(32px, 4vw, 42px); margin: 10px 0 14px; font-weight: 400; line-height: 1.1; color: #fff; }
.auth-copy p { color: #b7c4d4; line-height: 1.55; margin: 0 0 18px; }
.auth-copy ul { margin: 0; padding-left: 18px; color: #d5dee8; line-height: 1.7; }
.auth-form { padding: 48px 42px; }
.auth-form h2 { font-family: var(--display); font-size: 32px; margin: 0 0 8px; font-weight: 400; }
.auth-form .btn-primary { width: 100%; margin-top: 8px; }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { width: 100%; padding-right: 72px; }
.password-toggle { position: absolute; right: 8px; border: 0; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 8px; }
.password-toggle:hover { color: var(--ink); }
.demo-box {
    margin-top: 22px; padding: 12px 14px; border-radius: 12px; background: var(--paper-2);
    border: 1px dashed var(--line); font-size: 12px; color: var(--ink-soft);
}
.demo-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); font-weight: 700; }

/* ——— Manual / help ——— */
.manual-page {
    min-width: 0;
    max-width: 100%;
}
.manual-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
    gap: 16px;
    margin-bottom: 16px;
}
.manual-hero-card {
    padding: 22px 24px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #0f766e 0%, #134e4a 55%, #0b3d38 100%);
    color: #fff;
    box-shadow: var(--shadow-lg);
}
.manual-hero-card .eyebrow { color: rgba(255,255,255,.72); margin-bottom: 8px; }
.manual-hero-card h2 { margin: 0 0 8px; font-family: var(--display); font-size: clamp(24px, 3vw, 32px); font-weight: 400; line-height: 1.15; }
.manual-hero-card p { margin: 0; color: rgba(255,255,255,.86); font-size: 14px; line-height: 1.55; max-width: 52ch; }
.manual-hero-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.manual-hero-links a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border-radius: 999px; font-size: 12px; font-weight: 700;
    background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.22);
}
.manual-hero-links a:hover { background: rgba(255,255,255,.22); color: #fff; }
.manual-quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.manual-quick-card {
    padding: 16px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--line); box-shadow: var(--shadow);
}
.manual-quick-card strong { display: block; font-size: 13px; margin-bottom: 4px; }
.manual-quick-card span { color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.manual-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.manual-toc {
    position: sticky; top: 78px; padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.manual-toc-title {
    font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 8px; padding: 0 10px;
}
.manual-toc a { display: block; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.manual-toc a:hover, .manual-toc a.active { background: var(--accent-soft); color: var(--accent); }
.manual-section { scroll-margin-top: 90px; }
.manual-section + .manual-section { margin-top: 16px; }
.manual-section h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.01em; }
.manual-section .section-lead { margin: 0 0 12px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.manual-section ol, .manual-section ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; color: var(--ink-soft); font-size: 13px; }
.manual-section li { margin: 5px 0; }
.manual-section li strong { color: var(--ink); }
.manual-callout {
    margin-top: 14px; padding: 12px 14px; border-radius: 12px;
    background: var(--accent-soft); border: 1px solid rgba(15,118,110,.18);
    color: var(--ink); font-size: 13px; line-height: 1.5;
}
.manual-callout.warn {
    background: #fff7ed; border-color: rgba(217,119,6,.22); color: #9a3412;
}
.manual-feature-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px;
}
.manual-feature {
    padding: 12px 14px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line);
    font-size: 12px; line-height: 1.45; color: var(--ink-soft);
}
.manual-feature b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 4px; }
.manual-kbd {
    display: inline-block; padding: 2px 7px; border-radius: 6px;
    border: 1px solid var(--line); background: #fff; font-size: 11px; font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink);
}
.step-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.step-card { padding: 14px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); }
.step-card b { display: block; margin-bottom: 6px; color: var(--accent); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.workflow-strip {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 0;
}
.workflow-strip .pill {
    padding: 8px 12px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line);
    font-size: 12px; font-weight: 700;
}
.workflow-strip .arrow { color: var(--muted); font-weight: 700; }

.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }

.global-loader { position: sticky; top: 64px; z-index: 50; margin: -4px 0 12px; }
.global-loader-bar {
    height: 3px; width: 100%; border-radius: 999px; overflow: hidden; background: rgba(15,118,110,.12);
}
.global-loader-bar::before {
    content: ''; display: block; height: 100%; width: 40%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    animation: loaderSlide 1s ease-in-out infinite;
}
.global-loader-chip {
    position: absolute; right: 0; top: 10px;
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
    padding: 8px 12px; border-radius: 999px; box-shadow: var(--shadow);
}
.global-loader-chip .spinner { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
@keyframes loaderSlide {
    0% { transform: translateX(-20%); }
    100% { transform: translateX(280%); }
}

@media (max-width: 1100px) {
    .kpis, .step-cards { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-filters { grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(130px, 1fr)); }
    .dashboard-refresh { grid-column: 1 / -1; padding-bottom: 0; }
    .manual-layout { grid-template-columns: 1fr; }
    .manual-hero { grid-template-columns: 1fr; }
    .manual-quick-grid, .manual-feature-grid { grid-template-columns: 1fr; }
    .manual-toc { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
    .manual-toc-title { width: 100%; }
    .reports-page .report-kpis,
    .reports-page .report-mini-kpis-3,
    .reports-page .report-mini-kpis-4 {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    .reports-page .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-105%);
        transition: transform .22s ease; height: 100vh; height: 100dvh;
        padding-top: 48px; box-shadow: 8px 0 32px rgba(0,0,0,.25);
        z-index: 60;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .sidebar-close { display: grid; place-items: center; }
    .app-shell.nav-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(7,17,31,.5); z-index: 55;
        opacity: 0; pointer-events: none; transition: opacity .22s ease;
        backdrop-filter: blur(2px);
    }
    .app-shell.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .sidebar .brand,
    .sidebar .sidebar-foot { flex-shrink: 0; }
    .sidebar .org-chip { display: none; }
    .sidebar .nav {
        flex: 1 1 auto;
        min-height: min(287px, calc(100dvh - 200px));
        max-height: calc(100dvh - 190px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .menu-toggle { display: inline-flex; }
    .crumb { font-size: 12px; line-height: 1.35; max-width: calc(100vw - 120px); }
    .user-chip > div:not(.avatar) { display: none; }
    .topbar { flex-wrap: wrap; gap: 10px; }
    .topbar .actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-head .actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .page-head .actions .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .action-bar .btn, .action-bar .note-input { width: 100%; }
    .action-bar-spacer { display: none; }
    .workflow-strip { flex-direction: column; align-items: flex-start; gap: 6px; }
    .kpis, .grid-2, .grid-3, .form-grid, .form-grid-2, .auth-card, .step-cards, .perm-grid, .dashboard-filters, .dashboard-grid, .dashboard-grid-lower, .dashboard-kpis, .platform-kpis, .mail-log-filters { grid-template-columns: 1fr; }
    .form-grid > .address-pair { grid-template-columns: 1fr; }
    .form-grid > .form-row-2 { grid-template-columns: 1fr; }
    .form-grid > .form-row-4 { grid-template-columns: 1fr 1fr; }
    .reports-page .report-kpis,
    .reports-page .report-mini-kpis-3,
    .reports-page .report-mini-kpis-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .reports-page .report-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .reports-page .report-grid { grid-template-columns: 1fr; }
    .report-toolbar-group { flex: 1 1 100%; }
    .report-toolbar-group--end { margin-left: 0; width: 100%; }
    .invoice-show-grid { grid-template-columns: 1fr; }
    .invoice-show-page .panel,
    .invoice-show-page .stack .panel {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: clip;
    }
    .invoice-show-page .panel .hint {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .table-wrap.invoice-items-table {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
    }
    .table-wrap.invoice-items-table table {
        min-width: 620px !important;
    }
    .invoice-items-table th:first-child,
    .invoice-items-table td:first-child {
        min-width: 140px;
        width: auto;
    }
    .invoice-show-page .panel-payment .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .invoice-show-page .panel-payment .field input,
    .invoice-show-page .panel-payment .field select,
    .invoice-show-page .panel-cancel .field textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .invoice-show-page .payment-actions .btn,
    .invoice-show-page .btn-block-mobile {
        min-height: 44px;
    }
    .field.span-2, .field.span-3, .form-section-title { grid-column: span 1; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .table-wrap { margin: 0 -4px; border-radius: 12px; -webkit-overflow-scrolling: touch; }
    .table-wrap:not(.line-editor) table { min-width: 720px; }
    .line-editor input, .line-editor select { min-height: 40px; font-size: 16px; }
    .line-thumb { max-width: 48px; max-height: 48px; border-radius: 8px; margin-top: 6px; display: block; }
    .line-editor--compact .line-thumb {
        width: 50px;
        height: 50px;
        max-width: 50px;
        max-height: 50px;
    }
    .line-image-cell input[type="file"] { max-width: 120px; font-size: 11px; }
    .panel { padding: 16px; }
    .panel-head { flex-direction: column; align-items: stretch; }
    .panel-head .hint { margin-bottom: 0; line-height: 1.45; }
    .panel-head > .btn { align-self: flex-start; }
    .top-search-form { display: none; }
    .tenant-actions {
        flex-wrap: wrap;
        white-space: normal;
        min-width: 0;
        gap: 6px;
    }
    .tenant-actions .btn { flex: 1 1 calc(50% - 6px); min-width: 0; justify-content: center; }
    .table-wrap td.actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        min-width: 140px;
    }
    .table-wrap td.actions .btn { flex: 1 1 auto; min-width: 0; white-space: normal; text-align: center; }
    .report-toolbar { flex-wrap: wrap; align-items: stretch; }
    .report-toolbar .btn { flex: 1 1 auto; min-width: calc(50% - 8px); justify-content: center; }
    .pager-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .pager-links { margin-left: 0; width: 100%; }
    .pager-links .pagination-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .search-result { grid-template-columns: 1fr; gap: 6px; }
    .doc-meta { flex-direction: column; align-items: flex-start; gap: 6px; }
    .field input, .field select, .field textarea,
    .panel input:not([type=checkbox]):not([type=radio]),
    .panel select, .panel textarea {
        font-size: 16px;
        min-height: 44px;
    }
    .field textarea, .panel textarea { min-height: 96px; }
    .field-check { padding-top: 8px; min-height: auto; align-items: center; }
    .field.field-check { align-items: flex-start; }
    .page-head > .btn { width: 100%; justify-content: center; min-height: 44px; }
    .page-head .sub { font-size: 13px; line-height: 1.45; }
    .auth-card { grid-template-columns: 1fr; }
    .auth-copy { padding: 32px 24px; }
    .auth-form { padding: 32px 24px; }
    .auth-form h2 { font-size: 26px; }
    .dashboard-page .panel-head {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .dashboard-page .panel-head .btn {
        align-self: flex-start;
    }
    .table-wrap.dashboard-table {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
    }
    .table-wrap.dashboard-table table {
        min-width: 420px !important;
    }
    .dashboard-table td .muted {
        max-width: 160px;
    }
    .dashboard-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-actions { justify-content: stretch; width: 100%; }
    .dashboard-actions .btn { flex: 1 1 auto; justify-content: center; }
    .dashboard-hero .page-head { margin-bottom: 12px; }
    .impersonation-banner { font-size: 12px; padding: 10px 12px; text-align: center; }
    .impersonation-banner .btn { width: 100%; justify-content: center; }
    .totals-box { max-width: none !important; margin-left: 0; width: 100%; }
    .gst-bill-summary { max-width: none; }
    .flash { font-size: 13px; padding: 11px 12px; }
    .help-text { font-size: 11px; line-height: 1.4; }
    .panel h2, .panel-head h2 { font-size: 14px; }
    .panel .hint { font-size: 12px; }
    .badge { font-size: 10px; padding: 4px 8px; }
    .change-log-row { grid-template-columns: 1fr; }
    .top-party { grid-template-columns: 24px minmax(0, 1fr); }
    .top-party > b { grid-column: 1 / -1; padding-left: 34px; }
    .stock-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .document-bar > div:first-child, .aging-row > div:first-child { flex-direction: column; align-items: flex-start; gap: 2px; }
    .dashboard-mini-stat { flex-direction: column; align-items: flex-start; gap: 4px; }
    .low-stock-heading { flex-direction: column; align-items: flex-start; }
    .verify-details div { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .content { padding: 10px 12px 32px; }
    .topbar { padding: 12px 12px 8px; }
    .crumb { font-size: 11px; max-width: calc(100vw - 108px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .page-head { margin-bottom: 14px; gap: 10px; }
    .page-head h1 { font-size: 22px; }
    .page-head .eyebrow { font-size: 11px; margin-bottom: 4px; }
    .page-head .sub { font-size: 12.5px; }
    .btn {
        min-height: 44px;
        padding: 11px 14px;
        font-size: 14px;
        white-space: normal;
        text-align: center;
    }
    .btn-sm {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 13px;
    }
    .btn-lg { padding: 12px 16px; font-size: 15px; }
    .actions { width: 100%; gap: 8px; }
    .actions .btn { flex: 1 1 100%; width: 100%; justify-content: center; }
    .page-head .actions .btn { flex: 1 1 100%; }
    .panel { padding: 14px; border-radius: 12px; }
    .panel-head { gap: 10px; margin-bottom: 12px; }
    .panel-head > .btn { width: 100%; align-self: stretch; justify-content: center; }
    .form-grid, .form-grid-2 { gap: 12px; }
    .field label { font-size: 11.5px; }
    .kpi, .stat-tile { padding: 14px; }
    .kpi strong, .stat-tile strong { font-size: 22px; margin-top: 8px; }
    .kpi span, .stat-tile span { font-size: 10px; }
    .table-wrap { margin: 0; border-radius: 10px; }
    .table-wrap:not(.line-editor) table { min-width: 640px; }
    .table-wrap th, .table-wrap td { padding: 10px 8px; font-size: 12.5px; }
    .tenant-actions { flex-direction: column; align-items: stretch; }
    .tenant-actions .btn { flex: 1 1 auto; width: 100%; }
    .report-toolbar { flex-direction: column; gap: 8px; padding: 10px; }
    .report-toolbar .btn { width: 100%; min-width: 0; }
    .report-toolbar-sep { display: none; }
    .report-toolbar-label { width: 100%; }
    .reports-page .report-kpis,
    .reports-page .report-mini-kpis-3,
    .reports-page .report-mini-kpis-4,
    .reports-page .report-filters {
        grid-template-columns: 1fr;
    }
    .reports-page .kpi strong,
    .reports-page .stat-tile strong { font-size: 20px; }
    .action-bar { padding: 10px; gap: 8px; }
    .doc-meta { flex-direction: column; align-items: flex-start; }
    .doc-meta .badge { margin-top: 4px; }
    .file-preview img { max-height: 64px; max-width: 100%; }
    .empty-state { padding: 28px 14px; }
    .empty-state strong { font-size: 15px; }
    .auth-wrap { padding: 16px; }
    .auth-copy { padding: 24px 18px; }
    .auth-copy h1 { font-size: 28px; }
    .auth-form { padding: 24px 18px; }
    .auth-form h2 { font-size: 24px; }
    .search-panel input { font-size: 16px; padding: 14px 16px; }
    .manual-toc a { font-size: 12px; padding: 10px; }
    .manual-section h3 { font-size: 16px; }
    .step-card { padding: 12px; }
    .workflow-strip .pill { font-size: 11px; padding: 7px 10px; }
    .totals-box div { font-size: 13px; gap: 12px; }
    .totals-box .grand { font-size: 15px; }
    .timeline li { padding-left: 16px; }
    .perm-grid { gap: 10px; }
    .perm-card { padding: 10px; }
    .global-loader-chip { font-size: 11px; padding: 6px 10px; right: 8px; }
    .menu-toggle { width: 42px; height: 42px; }
    .avatar { width: 34px; height: 34px; font-size: 13px; }
    .sidebar { width: min(280px, 92vw); }
    .brand b { font-size: 18px; }
    .nav a { font-size: 14px; padding: 11px 12px; min-height: 44px; }
}

.verify-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.verify-card { width: min(100%, 560px); padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); text-align: center; }
.verify-card .brand-row { justify-content: center; text-align: left; }
.verify-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 30px auto 16px; border-radius: 50%; background: rgba(4,120,87,.12); color: var(--ok); font-size: 30px; font-weight: 800; }
.verify-details { margin: 24px 0; padding: 4px 18px; border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.verify-details div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.verify-details div:last-child { border-bottom: 0; }
.verify-details span { color: var(--ink-soft); font-size: 12px; }
.top-search-form {
    display: flex; align-items: center; gap: 4px;
    min-width: 240px; width: min(320px, 30vw);
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); padding: 0 6px 0 14px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.top-search-form:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.top-search-form input {
    flex: 1; min-width: 0; border: 0; background: transparent;
    padding: 8px 4px 8px 0; font-size: 13px; font-weight: 600;
    color: var(--ink); outline: none;
}
.top-search-form input::placeholder { color: var(--ink-soft); font-weight: 500; }
.top-search-form button {
    flex-shrink: 0; width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: transparent; color: var(--ink-soft); cursor: pointer;
    font-size: 15px; line-height: 1;
}
.top-search-form button:hover { color: var(--accent); background: var(--paper-2); }
.search-panel { margin-bottom: 16px; }
.search-panel input { width: 100%; font-size: 18px; padding: 16px 18px; }
.search-results { display: grid; gap: 16px; }
.search-result { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.search-result span:nth-child(2) { color: var(--ink-soft); }

.mail-modal-backdrop {
    position: fixed; inset: 0; background: rgba(32, 33, 36, .32); z-index: 80;
}
.mail-compose {
    position: fixed; z-index: 81; right: 20px; bottom: 0;
    width: min(560px, calc(100vw - 20px));
    max-height: min(680px, 90vh);
    display: flex; flex-direction: column;
    background: #fff; border-radius: 12px 12px 0 0;
    box-shadow: 0 8px 40px rgba(32, 33, 36, .28);
    overflow: hidden;
}
.mail-compose-head {
    display: flex; align-items: center; justify-content: space-between;
    background: #404040; color: #fff; padding: 10px 14px; flex-shrink: 0;
}
.mail-compose-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.mail-compose-x {
    border: 0; background: transparent; color: #fff; font-size: 22px; line-height: 1;
    cursor: pointer; padding: 0 4px;
}
.mail-compose-row {
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid #e8eaed; padding: 0 14px; min-height: 40px; flex-shrink: 0;
}
.mail-compose-row label {
    margin: 0; width: 54px; flex-shrink: 0; color: #5f6368; font-size: 13px; font-weight: 500;
}
.mail-compose-row input,
.mail-compose-split input {
    border: 0 !important; box-shadow: none !important; outline: none; width: 100%;
    background: transparent; padding: 8px 0; font-size: 13.5px;
}
.mail-compose-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0;
}
.mail-compose-split > div {
    display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 40px;
}
.mail-compose-split > div + div { border-left: 1px solid #e8eaed; }
.mail-compose-body {
    border: 0 !important; box-shadow: none !important;
    padding: 12px 16px 4px; font-size: 14px; line-height: 1.55; resize: none; outline: none;
    width: 100%; box-sizing: border-box;
}
.mail-compose-letter {
    flex: 1; min-height: 0; overflow: auto;
}
.mail-compose-intro { min-height: 88px; }
.mail-compose-closing { min-height: 110px; padding-top: 4px; }
.mail-detail-table {
    width: calc(100% - 32px); margin: 4px 16px 10px; border-collapse: collapse;
    font-size: 13px; color: #202124;
}
.mail-detail-table th,
.mail-detail-table td {
    border: 1px solid #dadce0; padding: 7px 10px; text-align: left;
}
.mail-detail-table th { background: #0f766e; color: #fff; font-weight: 700; }
.mail-detail-table td:first-child { width: 40%; color: #5f6368; }
.mail-detail-table td:last-child { font-weight: 600; }
.mail-compose-sign { padding: 4px 16px 8px; color: #3c4043; font-size: 13px; line-height: 1.4; }
.mail-sign-thanks { margin: 0 0 8px; font-weight: 700; }
.mail-sign-name { margin: 0; font-weight: 700; color: #202124; }
.mail-sign-title { margin: 0; color: #5f6368; }
.mail-sign-contacts { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 10px 14px; color: #1a73e8; }
.mail-sign-edit {
    margin-top: 8px; width: 100%; border: 0 !important; background: #f8f9fa; border-radius: 8px;
    padding: 6px 8px; font-size: 12px; color: #5f6368; resize: none;
}
.mail-compose-error { color: #c5221f; font-size: 12px; padding: 4px 16px 0; }
.mail-compose-foot {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px 12px;
    border-top: 1px solid #eee; flex-shrink: 0;
}
.mail-send {
    background: #0b57d0; color: #fff; border: 0; border-radius: 24px;
    padding: 10px 22px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.mail-send:disabled { opacity: .65; cursor: wait; }
.mail-attach-chip {
    font-size: 12px; color: #3c4043; background: #f1f3f4; border-radius: 16px;
    padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%;
}
.mail-compose-hint { margin-left: auto; font-size: 11px; color: #80868b; }
.mail-compose-stack { grid-template-columns: 1fr !important; }
.mail-compose-stack > .field { grid-column: 1 / -1; }
.mail-log-filters { grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr) minmax(120px, 1fr) !important; }
.mail-log-row { cursor: pointer; }
.mail-log-row:hover { background: #f8fafc; }
.mail-log-detail { max-height: min(780px, 92vh); }
.mail-log-detail-body { overflow: auto; flex: 1; min-height: 0; }
.mail-log-body-block { padding: 12px 16px 8px; }
.mail-attach-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.mail-attach-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px;
}
.mail-preview {
    white-space: pre-wrap; word-break: break-word; margin: 0;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 12px 14px; font-family: inherit; font-size: 13px; line-height: 1.5; color: #202124;
}

/* Centered mailbox workspace */
.mailbox-page {
    width: min(820px, 100%);
    margin: 0 auto;
    padding-bottom: 28px;
}
.mailbox-page--wide { width: min(1100px, 100%); }
.mailbox-hero {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 18px; margin-bottom: 18px;
}
.mailbox-hero-copy { max-width: 54ch; }
.mailbox-hero-copy .eyebrow {
    color: var(--accent); font-size: 12px; font-weight: 800;
    letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px;
}
.mailbox-hero-copy h1 {
    margin: 0; font-family: var(--display); font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 400; letter-spacing: -.02em; line-height: 1.1; color: var(--ink);
}
.mailbox-hero-copy p {
    margin: 10px auto 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55;
}
.mailbox-tabs {
    display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px;
    padding: 5px; border-radius: 999px; background: rgba(255,255,255,.78);
    border: 1px solid var(--line); box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}
.mailbox-tab {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 36px; padding: 0 16px; border-radius: 999px;
    color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 700;
}
.mailbox-tab:hover { color: var(--ink); background: var(--paper-2); }
.mailbox-tab.is-active {
    background: linear-gradient(180deg, #11968c, var(--accent));
    color: #fff; box-shadow: 0 6px 14px rgba(15,118,110,.25);
}
.mailbox-shell { width: 100%; }
.mailbox-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    box-shadow: var(--shadow); padding: 22px 24px 18px; overflow: clip;
}
.mailbox-card-head { margin-bottom: 16px; }
.mailbox-card-head--row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.mailbox-card-head h2 {
    margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em; color: var(--ink);
}
.mailbox-card-head .hint { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.mailbox-filters {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(150px, 1fr) minmax(130px, .9fr);
    gap: 12px; margin-bottom: 16px; padding: 14px; border-radius: 14px;
    background: var(--paper-2); border: 1px solid var(--line);
}
.mailbox-table { border-radius: 12px; overflow: auto; border: 1px solid var(--line); }
.mailbox-table table { margin: 0; }
.mailbox-empty { text-align: center; padding: 28px 12px !important; }
.mailbox-pager { margin-top: 14px; }
.mailbox-actions {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.mailbox-actions-left,
.mailbox-actions-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mailbox-actions-right { margin-left: auto; }
.mailbox-send { min-width: 132px; justify-content: center; }
.mailbox-side-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px;
}
.mailbox-side-block {
    border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2);
    padding: 14px 16px;
}
.mailbox-side-block h3 {
    margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .02em;
    text-transform: uppercase; color: var(--ink-soft);
}
.mailbox-merge-list {
    list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
}
.mailbox-merge-list li {
    display: grid; gap: 2px; font-size: 12px; color: var(--ink-soft);
}
.mailbox-merge-list code {
    display: inline-block; width: fit-content; padding: 2px 6px; border-radius: 6px;
    background: #fff; border: 1px solid var(--line); color: var(--accent); font-size: 12px;
}
@media (max-width: 900px) {
    .mailbox-filters { grid-template-columns: 1fr; }
    .mailbox-side-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .mailbox-card { padding: 16px 14px 14px; border-radius: 14px; }
    .mailbox-actions { align-items: stretch; }
    .mailbox-actions-left,
    .mailbox-actions-right { width: 100%; }
    .mailbox-actions-right { margin-left: 0; }
    .mailbox-actions .btn { flex: 1 1 auto; justify-content: center; }
    .mailbox-tabs { width: 100%; }
    .mailbox-tab { flex: 1 1 auto; }
}

.mail-banner {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 95;
    max-width: min(560px, calc(100vw - 24px)); box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
@media (max-width: 640px) {
    .mail-compose { right: 0; width: 100%; border-radius: 12px 12px 0 0; }
    .mail-compose-split { grid-template-columns: 1fr; }
    .mail-compose-split > div + div { border-left: 0; border-top: 1px solid #e8eaed; }
}
