/* =========================================================
   MarketLens Desk Accounting — Unified Application Theme
   One global system for navigation, pages, forms and reports
   ========================================================= */

:root {
    --navy-950: #071d29;
    --navy-900: #0b2a3a;
    --navy-800: #123b4d;
    --navy-700: #1a4c5f;
    --teal-700: #08766d;
    --teal-600: #0b8f83;
    --teal-500: #17a99b;
    --teal-100: #dff5f1;
    --teal-50: #effaf8;
    --ink-900: #16313d;
    --ink-800: #244451;
    --ink-700: #395966;
    --ink-600: #58717b;
    --ink-500: #71868e;
    --surface: #ffffff;
    --surface-soft: #f7fafb;
    --surface-muted: #eef4f5;
    --canvas: #f3f7f8;
    --border: #d8e3e6;
    --border-strong: #bdcdd2;
    --success: #16724a;
    --success-bg: #e8f7ef;
    --warning: #9a5a08;
    --warning-bg: #fff4dd;
    --danger: #b42335;
    --danger-bg: #fff0f2;
    --info: #175cd3;
    --info-bg: #eff5ff;
    --text: var(--ink-900);
    --muted: var(--ink-600);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(7, 29, 41, 0.05), 0 6px 18px rgba(7, 29, 41, 0.04);
    --shadow: 0 12px 34px rgba(7, 29, 41, 0.08);
    --sidebar-width: 278px;
    --content-max: 1500px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.menu-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--teal-700);
    text-decoration: none;
}

a:hover {
    color: var(--teal-600);
}

img,
svg {
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4,
strong,
th {
    color: var(--ink-900);
}

small,
.muted,
.block-muted,
.form-hint,
.page-subheading,
.meta,
.notes {
    color: var(--muted);
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    overflow: hidden;
    color: #dce9ed;
    background:
        radial-gradient(circle at 0 0, rgba(23, 169, 155, 0.14), transparent 35%),
        linear-gradient(180deg, var(--navy-950) 0%, #082330 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 18px 14px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 11px;
    color: #ffffff;
}

.brand:hover {
    color: #ffffff;
}

.brand-mark {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 13px;
    background: linear-gradient(145deg, #1cc3b1, #08766d);
    box-shadow: 0 10px 25px rgba(11, 143, 131, 0.28);
}

.brand-mark span {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50% 50% 50% 10%;
    transform-origin: center;
}

.brand-mark span:nth-child(1) { transform: rotate(0deg) translateY(-5px) scale(0.62); }
.brand-mark span:nth-child(2) { transform: rotate(120deg) translateY(-5px) scale(0.62); }
.brand-mark span:nth-child(3) { transform: rotate(240deg) translateY(-5px) scale(0.62); }

.brand-copy {
    display: grid;
    min-width: 0;
}

.brand-copy strong {
    overflow: hidden;
    color: #ffffff;
    font-size: 0.98rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-copy small {
    margin-top: 2px;
    color: #8eabb7;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.03em;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #dce9ed;
    border: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.create-menu {
    position: relative;
    margin: 2px 16px 12px;
}

.create-menu summary {
    display: grid;
    grid-template-columns: 26px 1fr 18px;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    color: #ffffff;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--teal-600), #08766d);
    box-shadow: 0 10px 24px rgba(5, 71, 68, 0.28);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
}

.create-menu summary::-webkit-details-marker,
.accountant-tools summary::-webkit-details-marker {
    display: none;
}

.create-menu[open] summary {
    border-radius: 11px 11px 7px 7px;
}

.create-plus {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.15rem;
    line-height: 1;
}

.create-chevron,
.tools-chevron {
    transition: transform 0.18s ease;
}

.create-menu[open] .create-chevron,
.accountant-tools[open] .tools-chevron {
    transform: rotate(180deg);
}

.create-menu-panel {
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 0;
    border-radius: 0 0 11px 11px;
    background: #0d3140;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
}

.create-menu-panel a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    color: #dce9ed;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 700;
}

.create-menu-panel a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.menu-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #9fb4bc;
}

.income-dot { background: #4dd399; }
.expense-dot { background: #ff8a98; }
.sales-dot { background: #6fb5ff; }
.bill-dot { background: #ffc46b; }

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    padding: 2px 10px 18px;
}

.nav-group {
    margin-top: 18px;
}

.nav-group:first-child {
    margin-top: 4px;
}

.nav-group-title {
    margin: 0 10px 6px;
    color: #7797a4;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 41px;
    margin: 2px 0;
    padding: 8px 10px;
    color: #bdd0d7;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 700;
    transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.065);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(23, 169, 155, 0.23), rgba(23, 169, 155, 0.08));
    box-shadow: inset 3px 0 0 #24c1b0;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    color: #8fb1bc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 0.96rem;
    font-weight: 800;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
    color: #b9fff4;
    background: rgba(23, 169, 155, 0.14);
}

.nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-count {
    min-width: 23px;
    padding: 2px 7px;
    color: #ffffff;
    border-radius: 999px;
    background: var(--teal-600);
    font-size: 0.68rem;
    font-weight: 900;
    text-align: center;
}

.accountant-tools {
    margin: 20px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.accountant-tools summary {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 7px 10px;
    color: #9fb6bf;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 800;
    list-style: none;
}

.accountant-tools summary:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.subnav {
    display: grid;
    gap: 2px;
    margin: 4px 0 0 38px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.subnav a {
    padding: 8px 10px;
    color: #91aab4;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
}

.subnav a:hover,
.subnav a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-footer {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 9px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.09);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 11px;
    background: rgba(23, 169, 155, 0.18);
    font-weight: 900;
}

.user-copy {
    display: grid;
    min-width: 0;
}

.user-copy strong {
    overflow: hidden;
    color: #ecf5f7;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-copy small {
    color: #7999a5;
    font-size: 0.68rem;
}

.signout-button {
    width: 34px;
    height: 34px;
    padding: 0;
    color: #9fb7c0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    font-size: 1.05rem;
}

.signout-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-overlay {
    display: none;
}

/* Main shell */
.main {
    min-width: 0;
    background: var(--canvas);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 94px;
    padding: 18px clamp(22px, 3vw, 44px);
    border-bottom: 1px solid rgba(189, 205, 210, 0.72);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.mobile-menu-toggle {
    display: none;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #ffffff;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 4px 0;
    border-radius: 99px;
    background: var(--navy-900);
}

.page-title-block {
    min-width: 0;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--teal-700);
    font-size: 0.69rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    color: var(--ink-900);
    font-size: clamp(1.45rem, 2.4vw, 2.05rem);
    line-height: 1.18;
    letter-spacing: -0.025em;
}

.page-subheading {
    max-width: 780px;
    margin: 7px 0 0;
    font-size: 0.91rem;
    line-height: 1.55;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    margin-left: auto;
}

.content-area {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 28px clamp(20px, 3vw, 44px) 54px;
}

/* Buttons */
.button,
button.button,
a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 15px;
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--teal-600);
    box-shadow: 0 5px 14px rgba(11, 143, 131, 0.15);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.button:hover,
button.button:hover,
a.button:hover {
    color: #ffffff;
    background: var(--teal-700);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(11, 143, 131, 0.2);
}

.button.primary {
    color: #ffffff;
    background: var(--teal-600);
}

.button.secondary {
    color: var(--ink-800);
    border-color: var(--border-strong);
    background: #ffffff;
    box-shadow: none;
}

.button.secondary:hover {
    color: var(--navy-900);
    border-color: #8eabb5;
    background: var(--surface-soft);
}

.button.danger,
.danger-button {
    color: #ffffff;
    border-color: var(--danger);
    background: var(--danger);
}

.button.small,
.icon-button {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.76rem;
}

.text-button {
    padding: 0;
    color: var(--teal-700);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

/* Panels, cards and metrics */
.panel,
.sheet,
.transaction-form-card,
.report-sheet,
.close-locked-panel,
.reversal-panel,
.danger-zone {
    margin-bottom: 20px;
    padding: clamp(18px, 2.3vw, 26px);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-heading,
.section-heading,
.document-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-heading h2,
.section-heading h2,
.document-heading h2 {
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.kpi-grid,
.metric-grid,
.dashboard-grid,
.report-kpis,
.close-health-grid,
.document-summary-grid,
.transaction-summary-grid,
.report-summary-grid,
.snapshot-grid,
.cash-account-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.kpi,
.metric-card,
.close-status-card {
    min-width: 0;
    padding: 17px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.kpi.accent {
    border-color: rgba(11, 143, 131, 0.28);
    background: linear-gradient(145deg, #ffffff, var(--teal-50));
}

.kpi span,
.metric-card span,
.close-status-card span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.kpi strong,
.metric-card strong,
.close-status-card strong,
.hero-amount,
.transaction-total,
.document-total {
    display: block;
    margin-top: 6px;
    color: var(--ink-900);
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.kpi small,
.metric-card small,
.close-status-card small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    line-height: 1.4;
}

.warning-kpi strong,
.negative-number {
    color: var(--danger) !important;
}

.quick-action-grid,
.report-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.quick-action,
.report-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 4px 12px;
    align-items: center;
    min-height: 108px;
    padding: 17px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-action:hover,
.report-card:hover {
    color: var(--text);
    border-color: rgba(11, 143, 131, 0.45);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.quick-icon,
.report-icon {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--teal-700);
    border-radius: 11px;
    background: var(--teal-50);
    font-size: 1.05rem;
    font-weight: 900;
}

/* Forms */
.stack {
    display: grid;
    gap: 18px;
}

.form-grid,
.filter-grid,
.filter-bar,
.wide-filter,
.report-filter,
.contacts-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    margin-bottom: 18px;
}

.form-grid.two,
.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three,
.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label {
    display: grid;
    gap: 6px;
    color: var(--ink-800);
    font-size: 0.79rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--ink-900);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    outline: none;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(7, 29, 41, 0.03);
    font-size: 0.88rem;
}

textarea {
    min-height: 105px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #91a2a8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal-600);
    box-shadow: 0 0 0 3px rgba(11, 143, 131, 0.13);
}

input:disabled,
select:disabled,
textarea:disabled {
    color: #71838a;
    background: #edf2f3;
    cursor: not-allowed;
}

.form-actions,
.filter-actions,
.actions,
.split-actions,
.sticky-actions,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.form-actions,
.sticky-actions {
    justify-content: flex-end;
}

.file-drop {
    padding: 20px;
    color: var(--muted);
    border: 1px dashed #9bb2ba;
    border-radius: var(--radius);
    background: var(--surface-soft);
    text-align: center;
}

/* Tables */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    background: #ffffff;
    font-size: 0.84rem;
}

th,
td {
    padding: 12px 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--ink-700);
    background: #f2f6f7;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:hover td {
    background: #f8fbfb;
}

tbody tr:last-child td,
tfoot tr:last-child td,
tfoot tr:last-child th {
    border-bottom: 0;
}

tfoot th,
tfoot td,
.total-row td,
.total-row th {
    color: var(--ink-900);
    background: #eef5f5;
    font-weight: 900;
}

.number,
.balance,
.balance-due,
.transaction-line-amount,
.ledger-ending {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.empty,
.empty-state {
    padding: 34px 18px !important;
    color: var(--muted) !important;
    text-align: center !important;
}

/* Badges and alerts */
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 9px;
    color: var(--ink-700);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    font-size: 0.69rem;
    font-weight: 900;
    line-height: 1;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge.posted,
.badge.paid,
.badge.reconciled,
.badge.reviewed,
.badge.closed,
.badge.active,
.badge.income {
    color: var(--success);
    border-color: #b5dfc9;
    background: var(--success-bg);
}

.badge.draft,
.badge.open,
.badge.partial,
.badge.review,
.badge.pending,
.badge.warning,
.badge.expense {
    color: var(--warning);
    border-color: #edd29a;
    background: var(--warning-bg);
}

.badge.overdue,
.badge.reversed,
.badge.inactive,
.badge.danger {
    color: var(--danger);
    border-color: #efb8c0;
    background: var(--danger-bg);
}

.alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px 12px;
    margin-bottom: 18px;
    padding: 13px 15px;
    color: var(--ink-800);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 11px;
    background: #ffffff;
}

.alert strong {
    color: inherit;
}

.alert ul {
    grid-column: 1 / -1;
    margin: 5px 0 0 20px;
}

.alert.success {
    color: var(--success);
    border-color: #b5dfc9;
    border-left-color: var(--success);
    background: var(--success-bg);
}

.alert.warning,
.alert.info {
    color: var(--warning);
    border-color: #edd29a;
    border-left-color: var(--warning);
    background: var(--warning-bg);
}

.alert.danger {
    color: var(--danger);
    border-color: #efb8c0;
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

/* Reports */
.report-tabs,
.report-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.report-tabs a,
.report-navigation a {
    padding: 8px 12px;
    color: var(--ink-700);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 850;
}

.report-tabs a:hover,
.report-navigation a:hover,
.report-tabs a.active,
.report-navigation a.active {
    color: #ffffff;
    border-color: var(--teal-600);
    background: var(--teal-600);
}

.reports-two-column,
.two-column-report,
.aging-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.financial-title {
    display: grid;
    gap: 4px;
    margin: 4px 0 30px;
    text-align: center;
}

.financial-title strong {
    color: var(--ink-900);
    font-size: 1.35rem;
}

.statement-section {
    margin-top: 26px;
}

.statement-section h2 {
    margin: 0;
    padding-bottom: 8px;
    color: var(--ink-900);
    border-bottom: 2px solid var(--navy-900);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.statement-row,
.statement-total,
.statement-grand-total,
.balance-control,
.cash-flow-row,
.opening-row,
.payment-history-item,
.check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 8px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.statement-total,
.report-total,
.ledger-ending {
    color: var(--ink-900);
    border-top: 1px solid var(--navy-900);
    border-bottom: 3px double var(--navy-900);
    font-weight: 900;
}

.statement-grand-total {
    margin-top: 24px;
    padding: 15px;
    color: #ffffff;
    border: 0;
    border-radius: 11px;
    background: var(--navy-900);
    font-weight: 900;
}

.statement-grand-total strong {
    color: #ffffff;
}

.balance-control {
    margin-top: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.control-good,
.receipt-ok {
    color: var(--success);
}

.control-bad,
.receipt-missing {
    color: var(--danger);
}

/* Transaction, invoice and bill layouts */
.transaction-hero,
.document-summary-grid,
.transaction-summary-grid {
    border-color: rgba(11, 143, 131, 0.2);
}

.business-entry-table,
.line-entry-table {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.line-entry-header,
.line-entry-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.1fr) minmax(200px, 1.7fr) 90px 120px 120px 42px;
    gap: 9px;
    align-items: center;
}

.line-entry-header {
    padding: 0 8px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.line-entry-row {
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
}

.document-meta,
.detail-list,
.accounting-details,
.status-list,
.attachment-list,
.compact-stack,
.close-checklist {
    display: grid;
    gap: 9px;
}

.detail-list > div,
.accounting-details > div,
.document-meta > div {
    display: grid;
    grid-template-columns: minmax(140px, 0.45fr) minmax(0, 1fr);
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.attachment-icon {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border-radius: 9px;
    background: var(--teal-100);
}

.danger-zone,
.reversal-panel {
    border-color: #efb8c0;
    background: var(--danger-bg);
}

/* Charts */
.chart {
    min-height: 220px;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-height: 190px;
    padding: 12px 4px 0;
}

.chart-column {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    flex: 1;
    min-width: 28px;
    height: 180px;
}

.bar {
    width: 100%;
    min-height: 3px;
    border-radius: 6px 6px 2px 2px;
    background: var(--teal-600);
}

.bar.expense,
.legend-expense {
    background: #e06a79;
}

.legend-revenue {
    background: var(--teal-600);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 0.76rem;
}

/* Pagination */
.pagination-wrap,
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 6px 10px;
    color: var(--ink-700);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

/* Authentication screens, including legacy class names */
.auth-shell,
.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 28px;
    background:
        radial-gradient(circle at 15% 15%, rgba(23, 169, 155, 0.16), transparent 28%),
        linear-gradient(145deg, #eef7f6, #f8fbfc);
}

.auth-card,
.login-card {
    width: min(100%, 440px);
    padding: 30px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 1250px) {
    .kpi-grid,
    .metric-grid,
    .dashboard-grid,
    .report-kpis,
    .close-health-grid,
    .document-summary-grid,
    .transaction-summary-grid,
    .report-summary-grid,
    .snapshot-grid,
    .cash-account-grid,
    .quick-action-grid,
    .report-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid,
    .filter-grid,
    .filter-bar,
    .wide-filter,
    .report-filter,
    .contacts-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(88vw, 300px);
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 22px 0 50px rgba(7, 29, 41, 0.24);
    }

    .menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close,
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 40;
        display: block;
        visibility: hidden;
        opacity: 0;
        border: 0;
        background: rgba(3, 16, 23, 0.55);
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .menu-open .sidebar-overlay {
        visibility: visible;
        opacity: 1;
    }

    .topbar {
        min-height: 82px;
        padding: 15px 20px;
    }

    .content-area {
        padding: 22px 18px 44px;
    }
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .page-title-block {
        flex: 1;
    }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 52px;
    }

    .top-actions .button {
        flex: 1 1 auto;
    }

    .kpi-grid,
    .metric-grid,
    .dashboard-grid,
    .report-kpis,
    .close-health-grid,
    .document-summary-grid,
    .transaction-summary-grid,
    .report-summary-grid,
    .snapshot-grid,
    .cash-account-grid,
    .quick-action-grid,
    .report-card-grid,
    .reports-two-column,
    .two-column-report,
    .aging-grid,
    .form-grid,
    .filter-grid,
    .filter-bar,
    .wide-filter,
    .report-filter,
    .contacts-filter,
    .form-grid.two,
    .form-grid.three,
    .two,
    .three {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .panel,
    .sheet,
    .transaction-form-card,
    .report-sheet {
        padding: 17px;
        border-radius: 14px;
    }

    .form-actions,
    .sticky-actions {
        justify-content: stretch;
    }

    .form-actions .button,
    .sticky-actions .button {
        flex: 1 1 100%;
    }

    .line-entry-header {
        display: none;
    }

    .line-entry-row {
        grid-template-columns: 1fr;
    }

    .detail-list > div,
    .accounting-details > div,
    .document-meta > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    th,
    td {
        padding: 10px;
    }
}

@media print {
    .sidebar,
    .sidebar-overlay,
    .mobile-menu-toggle,
    .top-actions,
    .report-tabs,
    .report-navigation,
    .filter-bar,
    .filter-grid,
    .report-filter,
    .button,
    .alert {
        display: none !important;
    }

    .app-shell,
    .main {
        display: block;
        background: #ffffff;
    }

    .topbar {
        position: static;
        padding: 0 0 18px;
        border-bottom: 1px solid #999999;
        background: #ffffff;
    }

    .content-area {
        max-width: none;
        padding: 0;
    }

    .panel,
    .sheet,
    .report-sheet {
        border: 0;
        box-shadow: none;
    }
}
