:root {
    --navy: #071b3a;
    --navy-2: #0b2854;
    --primary: #3155f5;
    --primary-dark: #2143d9;
    --text: #152033;
    --muted: #667085;
    --line: #e5eaf3;
    --surface: #ffffff;
    --background: #f4f7fb;
    --success: #16a263;
    --warning: #e48a0a;
    --danger: #df3f48;
    --purple: #7838e8;
    --shadow: 0 10px 30px rgba(20, 38, 75, .06);
    --radius: 13px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background: var(--background);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: 248px;
    flex-direction: column;
    overflow-y: auto;
    color: #fff;
    background: linear-gradient(180deg, var(--navy), #06152f 80%);
    box-shadow: 10px 0 30px rgba(4, 17, 40, .08);
}
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 72px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #ff9d38, #7048f5 55%, #21c98b);
    box-shadow: 0 6px 18px rgba(90, 67, 235, .35);
    font-weight: 800;
}
.brand strong, .user-card strong { display: block; font-size: 14px; }
.brand small, .user-card small { display: block; margin-top: 1px; color: #aab8d0; font-size: 10px; }
.nav { display: grid; gap: 4px; padding: 18px 12px; }
.nav a {
    position: relative;
    display: flex;
    min-height: 43px;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    border-radius: 8px;
    color: #d2dced;
    font-size: 13px;
    transition: .18s ease;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.active {
    color: #fff;
    background: linear-gradient(100deg, #2d57f5, #3f66ff);
    box-shadow: 0 8px 20px rgba(46, 85, 245, .28);
}
.nav a > span { width: 20px; color: currentColor; font-size: 17px; text-align: center; }
.nav-count {
    min-width: 22px;
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 20px;
    color: #fff;
    background: #f15a3d;
    font-size: 10px;
    text-align: center;
}
.sidebar-spacer { flex: 1; }
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 16px;
    border-top: 1px solid rgba(255, 255, 255, .09);
}
.user-card > span:nth-child(2) { min-width: 0; flex: 1; }
.user-card > a { color: #aab8d0; font-size: 17px; }
.user-card .logout-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.avatar {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 2px solid rgba(255,255,255,.8);
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(140deg, #ec7a4a, #153f91);
    font-weight: 800;
}
.avatar.small { width: 32px; height: 32px; flex-basis: 32px; border-color: #fff; font-size: 12px; }
.main { width: calc(100% - 248px); min-height: 100vh; margin-left: 248px; }
.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    height: 72px;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
}
.topbar > div, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.month-chip, .summary-chip {
    display: inline-flex;
    align-items: center;
    min-height: 35px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #354052;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
}
.notification { position: relative; color: #26354d; font-size: 21px; }
.notification b { position: absolute; top: 1px; right: -1px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: #f04545; }
.content { padding: 22px 24px 38px; }
.footer { padding: 15px 24px; color: #8a94a8; font-size: 11px; text-align: center; }
.menu-button { display: none !important; }
.sidebar-backdrop { display: none; }

.page-actions {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.page-intro { margin: 0; color: var(--muted); font-size: 13px; }
.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; border-color: var(--primary); background: linear-gradient(135deg, var(--primary), #2448e3); box-shadow: 0 7px 16px rgba(49,85,245,.18); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--primary); border-color: #92a4ff; background: #fff; }
.button.ghost { color: #475467; border-color: var(--line); background: #fff; }
.button.danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.button.danger:hover { background: #c92f3a; }
.button.small { min-height: 31px; padding: 5px 10px; font-size: 11px; }
.button.wide { width: 100%; }
.icon-button {
    display: inline-grid;
    width: 35px;
    height: 35px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    color: #596579;
    background: transparent;
    cursor: pointer;
}
.icon-button:hover { background: #f1f4f9; }

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.alert.success { color: #08734a; border-color: #a8e4ca; background: #eefbf5; }
.alert.warning { color: #885300; border-color: #efd18d; background: #fff8e8; }
.alert.danger { color: #a72935; border-color: #f0bdc3; background: #fff2f3; }
.alert button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 18px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(155px, 1fr)) 1.3fr;
    gap: 12px;
    margin-bottom: 14px;
}
.kpi {
    display: flex;
    min-height: 112px;
    align-items: flex-start;
    gap: 12px;
    padding: 17px 16px;
    border: 1px solid;
    border-radius: var(--radius);
}
.kpi.blue { border-color: #cdd9ff; background: linear-gradient(135deg, #f5f7ff, #edf2ff); }
.kpi.orange { border-color: #f5dcc2; background: linear-gradient(135deg, #fff9f3, #fff4e8); }
.kpi.green { border-color: #cdebd9; background: linear-gradient(135deg, #f4fcf7, #eefaf3); }
.kpi.purple { border-color: #e1d5f7; background: linear-gradient(135deg, #fbf8ff, #f5efff); }
.kpi.budget { border-color: #cbdcf5; background: linear-gradient(135deg, #f7faff, #eef5fd); }
.kpi-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}
.kpi.orange .kpi-icon { background: #f39816; }
.kpi.green .kpi-icon { background: #20ac62; }
.kpi.purple .kpi-icon { background: var(--purple); }
.kpi > div { min-width: 0; flex: 1; }
.kpi small { display: block; margin-bottom: 4px; color: #4d5c72; font-size: 10px; font-weight: 700; }
.kpi strong { display: block; color: #111b2c; font-size: 19px; line-height: 1.2; white-space: nowrap; }
.kpi em { display: block; margin-top: 8px; color: #667085; font-size: 9px; font-style: normal; }
.progress { display: block; height: 5px; margin-top: 8px; overflow: hidden; border-radius: 10px; background: #dbe4f3; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

.dashboard-grid { display: grid; grid-template-columns: 1.08fr 1fr .95fr; gap: 14px; margin-bottom: 14px; }
.panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.panel-heading {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid #edf0f5;
}
.panel-heading h2 { margin: 0; font-size: 14px; }
.panel-heading small { color: var(--muted); font-size: 10px; }
.legend { color: #5d687a; font-size: 10px; }
.legend i { display: inline-block; width: 14px; height: 3px; margin-right: 5px; border-radius: 4px; background: var(--primary); vertical-align: middle; }
.chart-wrap { padding: 7px 14px 4px; }
.line-chart { width: 100%; height: 210px; overflow: visible; }
.line-chart line { stroke: #e8edf5; stroke-width: 1; stroke-dasharray: 3 4; }
.line-chart polyline { fill: none; stroke: var(--primary); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.line-chart circle { fill: #fff; stroke: var(--primary); stroke-width: 3; }
.line-chart text { fill: #778196; font-size: 9px; }
.donut-layout { display: flex; min-height: 220px; align-items: center; gap: 22px; padding: 20px 16px; }
.donut {
    position: relative;
    display: grid;
    width: 145px;
    height: 145px;
    flex: 0 0 145px;
    place-items: center;
    border-radius: 50%;
}
.donut::after { position: absolute; width: 82px; height: 82px; border-radius: 50%; background: #fff; content: ""; }
.donut span { position: relative; z-index: 1; text-align: center; }
.donut small { display: block; color: var(--muted); font-size: 9px; }
.donut strong { display: block; margin-top: 3px; font-size: 12px; }
.category-list { display: grid; flex: 1; gap: 10px; margin: 0; padding: 0; list-style: none; }
.category-list li { display: grid; grid-template-columns: 7px 1fr auto; align-items: center; gap: 7px; font-size: 10px; }
.category-list i { width: 7px; height: 7px; border-radius: 50%; }
.category-list span { color: #536176; }
.category-list strong { font-size: 9px; }
.recent-list { min-height: 204px; }
.recent-list a {
    display: grid;
    grid-template-columns: 35px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-bottom: 1px solid #eff2f6;
}
.recent-list a:hover { background: #fafbfe; }
.recent-list span:nth-child(3) { text-align: right; }
.recent-list strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.recent-list small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.round-icon { display: grid !important; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--primary); background: #eef3ff; }
.panel-link { display: block; padding: 11px 15px; color: var(--primary); font-size: 10px; font-weight: 700; text-align: right; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick-card {
    display: grid;
    min-height: 105px;
    grid-template-columns: 42px 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.quick-card > span { display: grid; width: 42px; height: 42px; grid-row: 1 / 3; place-items: center; border-radius: 11px; color: var(--primary); background: #edf2ff; font-size: 18px; }
.quick-card strong { align-self: end; font-size: 12px; }
.quick-card small { align-self: start; margin-top: 3px; color: var(--muted); font-size: 9px; }
.quick-card.purple > span { color: var(--purple); background: #f5eeff; }
.quick-card.green > span { color: var(--success); background: #edfaf4; }
.quick-card.orange > span { color: var(--warning); background: #fff6e9; }

.tabs {
    display: flex;
    min-height: 49px;
    align-items: end;
    gap: 24px;
    padding: 0 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
}
.tabs a { padding: 16px 1px 12px; color: #687489; border-bottom: 2px solid transparent; font-size: 10px; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.filter-bar {
    display: flex;
    align-items: end;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #eef1f5;
}
.filter-bar.static { align-items: center; justify-content: space-between; }
.filter-bar.payment-page-size { align-items: center; justify-content: space-between; }
.page-size-form { display: flex; align-items: center; margin: 0; }
.filter-bar .page-size-form label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.filter-bar label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; }
.filter-bar input { min-height: 35px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; outline: none; }
.filter-bar select { min-height: 35px; padding: 7px 28px 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; outline: none; }
.search-field { position: relative; min-width: 270px; flex: 1; }
.search-field span { position: absolute; z-index: 1; left: 10px; bottom: 8px; color: #8993a4; font-size: 15px; }
.search-field input { width: 100%; padding-left: 31px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    padding: 10px 13px;
    color: #596579;
    background: #f7f9fc;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .01em;
    text-align: left;
    white-space: nowrap;
}
td {
    padding: 11px 13px;
    border-top: 1px solid #edf0f5;
    color: #354052;
    font-size: 10px;
    vertical-align: middle;
}
tbody tr:hover { background: #fcfdff; }
td small { display: block; margin-top: 3px; color: #8992a2; font-size: 8px; }
td.number, th.number { text-align: right; }
.table-title { display: block; color: #1c2b42; font-weight: 700; }
.table-title:hover { color: var(--primary); }
.row-action { color: var(--primary); font-size: 10px; font-weight: 700; }
.row-actions, .page-button-group, .logout-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.row-actions form, .page-button-group form, .logout-actions form { margin: 0; }
.row-actions .row-action {
    display: inline-grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0;
    transition: .16s ease;
}
.row-actions .row-action:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(28, 43, 66, .12); }
.row-action::before { font-size: 17px; line-height: 1; }
.row-action.view { color: #3155f5; border-color: #bdc9ff; background: #f0f3ff; }
.row-action.view::before { content: "◉"; }
.row-action.edit { color: #7040c7; border-color: #d7c3fa; background: #f7f1ff; }
.row-action.edit::before { content: "✎"; }
.row-action.delete {
    color: var(--danger);
    border-color: #f1bec3;
    background: #fff2f3;
}
.row-action.delete::before { content: "🗑"; font-family: "Segoe UI Symbol", "Segoe UI Emoji", sans-serif; font-size: 16px; }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 21px;
    padding: 3px 7px;
    border: 1px solid;
    border-radius: 20px;
    font-size: 8px;
    font-weight: 700;
}
.badge.success { color: #0b8a55; border-color: #a9e5ca; background: #eafaf2; }
.badge.warning { color: #b26c08; border-color: #f1d49c; background: #fff8e8; }
.badge.danger { color: #c83a45; border-color: #f2bcc2; background: #fff0f1; }
.badge.info { color: #3460c7; border-color: #c4d4f5; background: #eef4ff; }
.pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.pagination { display: flex; gap: 4px; }
.pagination a { display: grid; min-width: 27px; height: 27px; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pagination a.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.pagination .pagination-direction { width: auto; padding: 0 10px; white-space: nowrap; }
.pagination-direction.disabled { display: grid; height: 27px; padding: 0 10px; place-items: center; color: #a7afbd; border: 1px solid #edf0f5; border-radius: 6px; background: #f8f9fb; white-space: nowrap; }
.pagination-ellipsis { display: grid; min-width: 24px; height: 27px; place-items: center; color: var(--muted); }
.no-data { padding: 35px; color: var(--muted); text-align: center; }
.mobile-label { display: none; }
.muted { color: var(--muted); font-size: 9px; }

.form-panel { padding: 2px 20px 20px; }
.existing-expense-picker { margin-bottom: 15px; }
.existing-expense-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; padding: 16px; }
.existing-expense-controls label { display: grid; gap: 6px; color: #3e4b60; font-size: 13px; font-weight: 600; }
.existing-expense-controls select { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #dfe5ef; border-radius: 7px; background: #fff; }
.form-section-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 0; border-bottom: 1px solid var(--line); }
.form-section-heading h2 { margin: 0; font-size: 15px; }
.form-section-heading span { color: var(--muted); font-size: 9px; }
.form-grid, .compact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; padding: 18px 0; }
.form-grid label, .compact-form label, .login-card label {
    display: grid;
    align-content: start;
    gap: 6px;
    color: #3e4b60;
    font-size: 10px;
    font-weight: 600;
}
.form-grid label b { color: var(--danger); }
.form-grid input, .form-grid select, .form-grid textarea,
.compact-form input, .compact-form select, .compact-form textarea,
.login-card input {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid #dfe5ef;
    border-radius: 7px;
    color: var(--text);
    background: #fff;
    outline: none;
    font-size: 11px;
    font-weight: 400;
    transition: .15s ease;
}
.form-grid textarea, .compact-form textarea { resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.compact-form input:focus, .compact-form select:focus, .login-card input:focus {
    border-color: #8aa0ff;
    box-shadow: 0 0 0 3px rgba(49,85,245,.09);
}
.form-grid .full, .compact-form .full { grid-column: 1 / -1; }
.is-hidden { display: none !important; }
.recurring-option {
    padding: 12px 14px;
    border: 1px solid #dce5ff;
    border-radius: 8px;
    background: #f7f9ff;
}
.recurring-option span { display: flex; align-items: center; gap: 9px; }
.form-grid .recurring-option input { width: 16px; min-height: 16px; margin: 0; }
.recurring-option small, .form-grid label > small { color: var(--muted); font-size: 9px; font-weight: 400; }
.recurrence-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; }
.money-input { position: relative; display: block; }
.money-input i { position: absolute; z-index: 1; top: 10px; left: 11px; color: #667085; font-style: normal; }
.money-input input { padding-left: 28px; }
.upload-box {
    position: relative;
    display: grid;
    min-height: 112px;
    place-items: center;
    align-content: center;
    gap: 4px;
    overflow: hidden;
    border: 1px dashed #b8c4d7;
    border-radius: 9px;
    color: #526075;
    background: #fbfcff;
    text-align: center;
}
.upload-box input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-box b { color: var(--primary); font-size: 25px; }
.upload-box strong { font-size: 10px; }
.upload-box small { color: var(--muted); font-size: 8px; }
.upload-box.dragging { border-color: var(--primary); background: #f2f5ff; }
.form-total { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--line); }
.form-total span { color: var(--muted); font-size: 11px; }
.form-total strong { font-size: 20px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.compact-form { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 17px; }
.collapsible { display: none; margin-bottom: 14px; }
.collapsible.open { display: block; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 15px; }
.previous-month-panel { margin-bottom: 15px; border-color: #cad7ff; }
.recurring-history { margin-top: 15px; }
.recurring-history .current-row { background: #f4f7ff; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin: 0; padding: 4px 16px 14px; }
.detail-grid div { padding: 13px 0; border-bottom: 1px solid #edf0f5; }
.detail-grid div:nth-child(odd) { padding-right: 18px; }
.detail-grid dt { margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.detail-grid dd { margin: 0; font-size: 11px; font-weight: 600; }
.remarks { margin: 0 16px 14px; padding: 12px; border-radius: 8px; background: #f7f9fc; }
.remarks.danger { color: #a62c37; background: #fff2f3; }
.remarks strong { font-size: 10px; }
.remarks p { margin: 4px 0 0; color: #536176; font-size: 10px; }
.attachment-link { display: block; margin: 0 16px 18px; color: var(--primary); font-size: 10px; font-weight: 700; }
.amount-card { align-self: start; padding: 18px; }
.amount-card h2 { margin: 0 0 17px; font-size: 14px; }
.amount-card p { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 10px 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 10px; }
.amount-card p strong { color: var(--text); }
.amount-card p.total { margin-bottom: 16px; color: var(--text); font-weight: 700; }
.amount-card p.total strong { font-size: 16px; }

.decision-form { display: flex; min-width: 235px; align-items: center; gap: 5px; }
.decision-form input { width: 130px; min-height: 30px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; }
.decision { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid; border-radius: 7px; cursor: pointer; font-weight: 800; }
.decision.approve { color: #087b4d; border-color: #9ee0c2; background: #eafaf2; }
.decision.reject { color: #c53542; border-color: #efb9bf; background: #fff0f1; }

.report-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 14px; }
.report-card { display: flex; min-height: 95px; align-items: center; gap: 12px; padding: 15px; color: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-decoration: none; transition: .15s ease; }
.report-card:hover { border-color: #c5d0f7; box-shadow: 0 7px 18px rgba(33,51,94,.08); transform: translateY(-1px); }
.report-card > span { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 10px; color: var(--primary); background: #edf2ff; font-size: 18px; }
.report-card strong { display: block; font-size: 11px; }
.report-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.report-card.purple > span { color: var(--purple); background: #f5efff; }
.report-card.green > span { color: var(--success); background: #edfaf3; }
.report-card.orange > span { color: var(--warning); background: #fff6e7; }
.report-filter { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.report-filter .search-field { display: grid; }
.report-filter-actions { display: flex; align-items: end; gap: 8px; }
.report-total-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 14px; }
.report-total-strip div { padding: 15px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.report-total-strip small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.report-total-strip strong { font-size: 18px; }
.report-detail { margin-bottom: 14px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.report-grid > article:last-child { grid-column: 1 / -1; }
.table-wrap.compact { max-height: 350px; overflow-y: auto; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-card { align-self: start; }
.settings-card > form { padding: 17px; }
.settings-card > form label { display: grid; gap: 7px; color: #3e4b60; font-size: 10px; font-weight: 600; }
.settings-card > form input { width: 100%; min-height: 39px; padding: 8px 10px 8px 28px; border: 1px solid #dfe5ef; border-radius: 7px; outline: none; }
.settings-card > form p { margin: 9px 0 15px; color: var(--muted); font-size: 9px; }
.system-counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; padding: 17px; }
.system-counts div { padding: 14px; border-radius: 9px; background: #f5f7fb; }
.system-counts dt, .config-list dt { color: var(--muted); font-size: 9px; }
.system-counts dd { margin: 5px 0 0; font-size: 21px; font-weight: 800; }
.config-list { margin: 0; padding: 10px 17px; }
.config-list div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.config-list dd { margin: 0; font-size: 10px; font-weight: 700; }
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state > span { display: grid; width: 54px; height: 54px; margin: 0 auto 12px; place-items: center; border-radius: 50%; color: var(--danger); background: #fff0f1; font-size: 26px; font-weight: 800; }
.logout-card { max-width: 540px; margin: 8vh auto 0; padding: 38px; text-align: center; }
.logout-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 50%; color: var(--danger); background: #fff0f1; font-size: 27px; font-weight: 800; }
.logout-card h2 { margin: 0 0 9px; font-size: 24px; }
.logout-card p { margin: 0 auto 24px; color: var(--muted); }
.logout-actions { justify-content: center; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { margin: 0 auto 20px; color: var(--muted); }

.login-body { overflow: hidden; background: #fff; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: 1.1fr .9fr; }
.login-showcase {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 45px 7vw;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(65,101,255,.55), transparent 35%),
        radial-gradient(circle at 80% 75%, rgba(20,198,148,.23), transparent 28%),
        linear-gradient(145deg, #071a3a, #0a2859 70%, #0a3565);
}

.login-showcase::after { position: absolute; right: -140px; bottom: -160px; width: 450px; height: 450px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.02); content: ""; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; }
.login-showcase > div { position: relative; z-index: 1; }
.eyebrow { color: #7fa0ff; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.login-showcase h1 { max-width: 680px; margin: 14px 0 18px; font-size: clamp(35px, 4vw, 59px); line-height: 1.04; letter-spacing: -.045em; }
.login-showcase p { max-width: 600px; margin: 0; color: #bdcbe1; font-size: 14px; line-height: 1.7; }
.login-stats { display: flex; gap: 48px; }
.login-stats strong { display: block; font-size: 20px; }
.login-stats span { display: block; margin-top: 4px; color: #9db0ce; font-size: 9px; }
.login-panel { display: grid; min-height: 100vh; place-items: center; padding: 40px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { margin: 0 0 7px; font-size: 29px; letter-spacing: -.03em; }
.login-card > p { margin: 0 0 25px; color: var(--muted); font-size: 12px; }
.login-card label { margin-bottom: 15px; }
.login-card .button { margin-top: 4px; min-height: 44px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 5px;
    display: grid;
    width: 36px;
    height: 34px;
    padding: 0;
    transform: translateY(-50%);
    place-items: center;
    border: 0;
    border-radius: 6px;
    color: #526079;
    background: transparent;
    cursor: pointer;
    font-size: 19px;
}
.password-toggle:hover { color: var(--primary); background: #f0f3ff; }
.password-toggle .eye-closed, .password-toggle.showing .eye-open { display: none; }
.password-toggle.showing .eye-closed { display: inline; }
.demo-credentials { margin-top: 18px; padding: 11px; border-radius: 8px; color: #516076; background: #f5f7fb; font-size: 9px; text-align: center; }
.demo-credentials strong { margin-right: 5px; color: var(--text); }
.mobile-login-logo { display: none; margin-bottom: 17px; }
.otp-card { text-align: center; }
.otp-card > p strong { color: var(--text); }
.otp-card label { text-align: left; }
.otp-shield {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #22ae79);
    box-shadow: 0 10px 24px rgba(49, 85, 245, .2);
    font-size: 24px;
    font-weight: 800;
}
.onscreen-otp { margin: 19px 0; padding: 16px; border: 1px solid #cfd9ff; border-radius: 11px; background: #f5f7ff; }
.otp-caption { display: block; margin-bottom: 10px; color: #53617a; font-size: 12px; font-weight: 700; }
.otp-code { display: flex; justify-content: center; gap: 7px; }
.otp-code b {
    display: grid;
    width: 40px;
    height: 47px;
    place-items: center;
    border: 1px solid #c4d0ff;
    border-radius: 8px;
    color: #18358e;
    background: #fff;
    font-size: 23px;
    box-shadow: 0 4px 12px rgba(34, 66, 160, .06);
}
.onscreen-otp small { display: block; margin-top: 11px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.otp-input { text-align: center; letter-spacing: .35em; font-size: 20px !important; font-weight: 700 !important; }
.otp-secondary-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; font-size: 12px; font-weight: 700; }
.otp-secondary-actions a { color: #596579; }
.otp-secondary-actions form { margin: 0; }
.otp-secondary-actions button { padding: 0; border: 0; color: var(--primary); background: transparent; cursor: pointer; font: inherit; }

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .kpi.budget { grid-column: span 2; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .recent-panel { grid-column: 1 / -1; }
    .recent-list { min-height: auto; }
    .report-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(5,16,37,.48); }
    .sidebar-backdrop.open { display: block; }
    .main { width: 100%; margin-left: 0; }
    .menu-button { display: inline-grid !important; }
    .content { padding: 18px; }
    .topbar { padding: 0 18px; }
    .quick-grid, .report-cards { grid-template-columns: repeat(2, 1fr); }
    .login-shell { grid-template-columns: 1fr; }
    .login-showcase { display: none; }
    .login-panel { min-height: 100vh; }
    .mobile-login-logo { display: grid; }
}

@media (max-width: 680px) {
    body { font-size: 13px; }
    .topbar { height: 62px; }
    .topbar h1 { font-size: 17px; }
    .month-chip, .notification { display: none; }
    .content { padding: 14px 12px 30px; }
    .page-actions { align-items: flex-start; }
    .page-intro { max-width: 65%; font-size: 11px; }
    .button { min-height: 36px; padding: 7px 10px; font-size: 10px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .kpi { min-height: 105px; padding: 13px 11px; }
    .kpi.budget { grid-column: 1 / -1; }
    .kpi-icon { width: 32px; height: 32px; flex-basis: 32px; }
    .kpi strong { font-size: 16px; }
    .dashboard-grid, .quick-grid, .report-cards, .report-grid, .settings-grid, .report-total-strip { grid-template-columns: 1fr; }
    .recent-panel, .report-grid > article:last-child { grid-column: auto; }
    .donut-layout { flex-direction: column; }
    .category-list { width: 100%; }
    .filter-bar { align-items: stretch; flex-wrap: wrap; }
    .search-field { min-width: 100%; }
    .filter-bar label:not(.search-field) { flex: 1; }
    .tabs { gap: 18px; }
    .form-grid, .compact-form, .detail-grid, .recurrence-settings, .existing-expense-controls { grid-template-columns: 1fr; }
    .form-grid .full, .compact-form .full { grid-column: auto; }
    .compact-form { padding: 14px; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-grid div:nth-child(odd) { padding-right: 0; }
    .amount-card { order: -1; }
    .form-actions { flex-wrap: wrap; }
    .form-actions .button { flex: 1; }
    .pagination-row { align-items: flex-start; flex-direction: column; }
    .login-panel { padding: 25px; }

    .table-wrap { overflow: visible; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    tbody { display: grid; gap: 10px; padding: 11px; }
    tbody tr { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
    td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; border: 0; text-align: right !important; }
    td:first-child { padding-top: 0; }
    td:has(.table-title), td:first-child:has(strong) { display: block; margin-bottom: 4px; text-align: left !important; }
    td .table-title { font-size: 12px; }
    td small { text-align: inherit; }
    .mobile-label { display: inline; color: var(--muted); font-size: 9px; }
    .no-data { display: block; padding: 25px; text-align: center !important; }
    .decision-form { width: 100%; min-width: 0; }
    .decision-form input { flex: 1; }
}

/* Readability scale: keep the ERP layout while making text comfortably legible. */
body { font-size: 16px; }
.brand strong, .user-card strong { font-size: 15px; }
.brand small, .user-card small { font-size: 12px; }
.nav a { font-size: 15px; }
.page-intro { font-size: 15px; }
.button, .button.small { font-size: 14px; }
.month-chip, .summary-chip, .alert { font-size: 14px; }
.panel-heading h2 { font-size: 16px; }
.panel-heading small, .legend, .tabs a { font-size: 12px; }
.filter-bar label { font-size: 12px; }
th { font-size: 12px; }
td { font-size: 13px; }
td small { font-size: 11px; }
.row-action { font-size: 12px; }
.badge { font-size: 11px; }
.pagination-row, .muted { font-size: 12px; }
.form-section-heading h2 { font-size: 17px; }
.form-section-heading span { font-size: 12px; }
.form-grid label, .compact-form label, .login-card label { font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea,
.compact-form input, .compact-form select, .compact-form textarea,
.login-card input { font-size: 14px; }
.detail-grid dt { font-size: 12px; }
.detail-grid dd { font-size: 14px; }
.remarks strong, .remarks p, .attachment-link, .amount-card p { font-size: 13px; }
.kpi small { font-size: 12px; }
.kpi em { font-size: 11px; }
.category-list li, .recent-list strong, .panel-link { font-size: 12px; }
.category-list strong, .recent-list small, .quick-card small { font-size: 11px; }
.quick-card strong { font-size: 14px; }

.year-filter label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.year-filter select { min-height: 38px; padding: 7px 30px 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.annual-report-tabs { margin-bottom: 16px; }
.annual-summary { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.monthly-report-summary { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.monthly-expense-details { margin-top: 14px; }
.annual-summary article { padding: 17px; }
.annual-summary small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.annual-summary strong { display: block; margin-top: 7px; font-size: 19px; }
.annual-summary .variance-card { border-color: #efc46a; background: #fffaf0; }
.annual-table-wrap { max-height: calc(100vh - 300px); }
.annual-table { min-width: 2100px; }
.annual-table th { position: sticky; z-index: 2; top: 0; }
.annual-table th:first-child, .annual-table td:first-child { position: sticky; z-index: 1; left: 0; min-width: 300px; background: #fff; }
.annual-table th:first-child { z-index: 3; background: #f7f9fc; }
.annual-table .annual-section-row td { position: static; padding: 9px 13px; color: #fff; background: #183b77; font-weight: 800; text-align: left !important; }
.annual-table td.number { min-width: 112px; white-space: nowrap; }
.annual-table td.variance { color: var(--danger); background: #fff3f4; font-weight: 800; }

@media (max-width: 900px) {
    .annual-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
    .annual-summary { grid-template-columns: 1fr; }
    .annual-table, .annual-table thead, .annual-table tbody { display: table; }
    .annual-table thead { display: table-header-group; }
    .annual-table tbody { padding: 0; }
    .annual-table tr { display: table-row; padding: 0; border: 0; }
    .annual-table th, .annual-table td { display: table-cell; padding: 10px 12px; border-top: 1px solid var(--line); }
    .annual-table td:first-child { display: table-cell; margin: 0; }
}

/* Application-wide UI refresh */
:root {
    --navy: #0b1730;
    --navy-2: #12264a;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #162033;
    --muted: #68758a;
    --line: #e2e8f0;
    --surface: #ffffff;
    --background: #f5f7fb;
    --success: #0f9f6e;
    --warning: #d97706;
    --danger: #dc3545;
    --purple: #7557d9;
    --shadow: 0 8px 24px rgba(15, 23, 42, .055);
    --radius: 14px;
}

body {
    color: var(--text);
    background:
        radial-gradient(circle at 100% 0, rgba(37, 99, 235, .035), transparent 32%),
        var(--background);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.sidebar {
    width: 264px;
    background:
        radial-gradient(circle at 20% 0, rgba(75, 116, 255, .16), transparent 30%),
        linear-gradient(180deg, #0c1c38 0%, #07142a 100%);
    box-shadow: 12px 0 35px rgba(9, 20, 42, .12);
}
.brand { height: 78px; padding: 0 22px; }
.brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, #4f7cff, #7657dd);
    box-shadow: 0 9px 22px rgba(68, 93, 224, .35);
}
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: #8fa3c4; }
.nav { gap: 3px; padding: 14px 13px 22px; }
.nav-section-label {
    display: block;
    margin: 14px 11px 5px;
    color: #7085a8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.nav-section-label:first-child { margin-top: 3px; }
.nav a {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #c6d2e6;
    font-size: 14px;
}
.nav a > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; background: rgba(255,255,255,.045); font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.065); transform: translateX(2px); }
.nav a.active {
    background: linear-gradient(100deg, rgba(54, 102, 236, .95), rgba(61, 93, 206, .9));
    box-shadow: 0 9px 22px rgba(25, 66, 178, .32);
}
.nav a.active > span { background: rgba(255,255,255,.14); }
.user-card { margin: 8px; padding: 13px 11px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); }
.user-card .logout-link { color: #b9c7dc; }

.main { width: calc(100% - 264px); margin-left: 264px; }
.topbar {
    height: 78px;
    padding: 0 28px;
    border-color: rgba(226,232,240,.9);
    background: rgba(255,255,255,.88);
    box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.topbar-title > span { display: block; }
.topbar-title small { display: block; margin-bottom: 1px; color: #8995a8; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { font-size: 22px; font-weight: 750; letter-spacing: -.025em; }
.month-chip { border-radius: 10px; background: #f8fafc; }
.avatar { background: linear-gradient(145deg, #4169d8, #7b5bc7); }
.content { width: 100%; max-width: 1780px; margin: 0 auto; padding: 26px 30px 44px; }
.footer { padding: 20px 24px; color: #95a0b2; }

.page-actions { min-height: 48px; margin-bottom: 18px; }
.page-intro { color: #6f7c91; font-size: 14px; line-height: 1.6; }
.page-button-group { flex-wrap: wrap; }

.panel {
    border: 1px solid rgba(220, 227, 238, .95);
    border-radius: var(--radius);
    background: rgba(255,255,255,.97);
    box-shadow: var(--shadow);
}
.panel-heading {
    min-height: 58px;
    padding: 16px 18px;
    border-bottom: 1px solid #edf1f6;
}
.panel-heading h2 { color: #1c2940; font-size: 16px; letter-spacing: -.01em; }
.panel-heading small { color: #8b96a8; }

.button {
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 9px;
    font-size: 13px;
    letter-spacing: .005em;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(15,23,42,.08); }
.button:active { transform: translateY(0); }
.button.primary { background: linear-gradient(145deg, #316df0, #2455cf); box-shadow: 0 7px 16px rgba(37,99,235,.2); }
.button.secondary { border-color: #bfd0fa; background: #f8faff; }
.button.ghost { border-color: #dfe5ee; background: #fff; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }

.alert { min-height: 46px; padding: 12px 15px; border-radius: 11px; box-shadow: 0 5px 14px rgba(15,23,42,.035); }
.badge { padding: 5px 9px; border-radius: 999px; font-weight: 750; letter-spacing: .01em; }

.filter-bar {
    min-height: 64px;
    padding: 12px 15px;
    border-bottom-color: #edf1f6;
    background: #fbfcfe;
}
.search-field { border-radius: 10px; background: #fff; }
.filter-bar input, .filter-bar select, .page-size-form select { min-height: 39px; border-radius: 9px; }
.summary-chip { border-radius: 999px; color: #385071; background: #f8fafc; }

.form-panel { padding: 3px 24px 24px; }
.form-section-heading { padding: 20px 0 16px; }
.form-section-heading h2 { font-size: 18px; }
.form-grid, .compact-form { gap: 17px 20px; padding: 20px 0; }
.form-grid label, .compact-form label, .login-card label { color: #36455d; font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea,
.compact-form input, .compact-form select, .compact-form textarea,
.login-card input {
    min-height: 44px;
    padding: 10px 12px;
    border-color: #dce3ed;
    border-radius: 10px;
    background: #fff;
}
.form-grid textarea, .compact-form textarea { min-height: 96px; }
.form-grid input:hover, .form-grid select:hover, .form-grid textarea:hover,
.compact-form input:hover, .compact-form select:hover, .compact-form textarea:hover { border-color: #c8d2df; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.compact-form input:focus, .compact-form select:focus, .login-card input:focus {
    border-color: #6e94f4;
    box-shadow: 0 0 0 4px rgba(37,99,235,.09);
}
.existing-expense-picker { overflow: hidden; }
.existing-expense-controls { padding: 18px; background: #fbfcff; }
.existing-expense-controls select { min-height: 44px; border-radius: 10px; }
.previous-month-panel { border-color: #cddcfb; background: linear-gradient(180deg, #fff, #fbfcff); }
.upload-box { min-height: 126px; border-radius: 12px; background: #fafcff; }
.form-total { padding: 17px 0; }
.form-total strong { color: #173463; font-size: 22px; }

table { border-collapse: separate; border-spacing: 0; }
th {
    padding: 12px 14px;
    color: #5d6c82;
    border-bottom: 1px solid #dfe6ef;
    background: #f8fafc;
    font-size: 11px;
    letter-spacing: .045em;
    text-transform: uppercase;
}
td { padding: 13px 14px; border-bottom-color: #edf1f6; vertical-align: middle; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #f8faff; }
.table-title { color: #224fbd; font-weight: 750; }
.row-actions { gap: 6px; }
.row-action { border-radius: 8px; background-color: #f7f9fc; }
.no-data { color: #8490a3; background: #fbfcfe; }

.tabs {
    min-height: 48px;
    gap: 28px;
    padding: 0 4px;
    border-bottom-color: #dfe6ef;
}
.tabs a { padding: 14px 2px 12px; font-size: 13px; }
.tabs a.active { color: #2457d2; border-bottom-width: 3px; }

.kpi-grid { gap: 15px; }
.kpi {
    min-height: 132px;
    padding: 20px;
    border: 1px solid #e1e7f0;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.kpi:hover, .quick-card:hover, .report-card:hover { transform: translateY(-2px); box-shadow: 0 13px 28px rgba(15,23,42,.08); }
.kpi-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; }
.kpi strong { margin-top: 8px; font-size: 23px; letter-spacing: -.02em; }
.dashboard-grid, .quick-grid { gap: 16px; }
.quick-card, .report-card { border-radius: 15px; box-shadow: 0 7px 20px rgba(15,23,42,.045); transition: .18s ease; }
.quick-card { min-height: 108px; }
.recent-list a { padding: 13px 18px; }
.round-icon { border-radius: 10px; }

.detail-layout { gap: 18px; }
.detail-grid { padding: 6px 18px 17px; }
.detail-grid div { padding: 15px 0; }
.detail-grid dt { color: #7e8a9d; }
.detail-grid dd { color: #26354c; }
.amount-card { padding: 21px; border-top: 4px solid #356be1; }
.amount-card p { padding: 12px 0; }
.amount-card p.total strong { color: #214eae; font-size: 19px; }

.report-total-strip div, .annual-summary article {
    border-color: #e0e7f0;
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(15,23,42,.045);
}
.annual-summary strong, .report-total-strip strong { color: #1e437e; }
.pagination a, .pagination span { border-radius: 8px; }
.pagination a.active { box-shadow: 0 5px 12px rgba(37,99,235,.18); }

.login-body { background: #f7f9fc; }
.login-showcase {
    padding: 56px 7vw;
    background:
        radial-gradient(circle at 18% 18%, rgba(72, 112, 232, .45), transparent 32%),
        radial-gradient(circle at 85% 78%, rgba(91, 71, 188, .24), transparent 26%),
        linear-gradient(145deg, #091a36, #102d5a 65%, #163d71);
}
.login-showcase h1 { max-width: 720px; font-size: clamp(38px, 4vw, 62px); }
.login-panel { background: linear-gradient(180deg, #fff, #f8fafc); }
.login-card { width: min(410px, 100%); padding: 32px; border: 1px solid #e2e8f0; border-radius: 20px; background: #fff; box-shadow: 0 24px 65px rgba(15,23,42,.1); }
.login-card h2 { font-size: 31px; }
.login-card .button { min-height: 46px; }
.demo-credentials { padding: 13px; border-radius: 10px; background: #f5f7fb; }

@media (max-width: 900px) {
    .sidebar { width: 270px; }
    .main { width: 100%; margin-left: 0; }
    .content { padding: 22px 18px 38px; }
    .topbar { padding: 0 18px; }
}

@media (max-width: 680px) {
    .topbar { height: 68px; }
    .topbar-title small { display: none; }
    .topbar h1 { font-size: 18px; }
    .content { padding: 16px 12px 32px; }
    .page-actions { align-items: stretch; flex-direction: column; }
    .page-intro { max-width: none; }
    .page-button-group { width: 100%; }
    .page-button-group .button { flex: 1; }
    .panel { border-radius: 12px; }
    .panel-heading { min-height: 54px; padding: 14px; }
    .form-panel { padding: 2px 15px 17px; }
    .kpi { min-height: 112px; padding: 15px; }
    .login-panel { padding: 18px; }
    .login-card { padding: 24px 20px; border-radius: 16px; }
    .tabs { overflow-x: auto; gap: 22px; }
}

/* Compact data-entry controls */
.button.compact {
    width: auto;
    height: 34px;
    min-height: 33px;
    flex: 0 0 auto;
    align-self: flex-start;
    padding: 6px 11px;
    font-size: 12px;
    line-height: 1;
}
.page-actions [data-toggle="categoryForm"] {
    width: auto;
    height: 36px;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1;
}
.compact-form > .form-actions {
    min-height: 36px;
    align-self: start;
    align-items: flex-start;
    padding-top: 23px;
}
.form-grid, .compact-form {
    gap: 12px 16px;
    padding-top: 15px;
    padding-bottom: 15px;
}
.form-grid input, .form-grid select, .form-grid textarea,
.compact-form input, .compact-form select, .compact-form textarea {
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.form-grid textarea, .compact-form textarea { min-height: 78px; }
.existing-expense-controls select { min-height: 36px; }
.year-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.month-comparison-summary { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.month-comparison-summary article { position: relative; overflow: hidden; }
.month-comparison-summary article::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #2563eb;
    content: "";
}
.month-comparison-summary .previous-period-card::before { background: #7557d9; }
.month-comparison-summary span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 900px) {
    .month-comparison-summary { grid-template-columns: 1fr; }
}

/* Common application colour theme */
:root {
    --navy: #102a2d;
    --navy-2: #153b3e;
    --primary: #0f766e;
    --primary-dark: #0b5f59;
    --purple: #b7791f;
    --success: #14845f;
    --warning: #d97706;
    --text: #183033;
    --muted: #687b7d;
    --line: #dce8e7;
    --background: #f3f8f7;
}
body {
    background:
        radial-gradient(circle at 100% 0, rgba(15, 118, 110, .06), transparent 34%),
        var(--background);
}
.sidebar {
    background:
        radial-gradient(circle at 20% 0, rgba(38, 166, 154, .19), transparent 31%),
        linear-gradient(180deg, #123438 0%, #0a2225 100%);
    box-shadow: 12px 0 35px rgba(10, 43, 45, .15);
}
.brand-mark {
    background: linear-gradient(145deg, #16a394, #0f766e);
    box-shadow: 0 9px 22px rgba(15, 118, 110, .32);
}
.nav a.active {
    background: linear-gradient(100deg, #12877e, #0c6963);
    box-shadow: 0 9px 22px rgba(8, 82, 77, .32);
}
.button.primary {
    border-color: #0f766e;
    background: linear-gradient(145deg, #13877e, #0b6862);
    box-shadow: 0 7px 16px rgba(15, 118, 110, .2);
}
.button.secondary {
    color: #0b6862;
    border-color: #acd8d3;
    background: #f3fbfa;
}
.avatar { background: linear-gradient(145deg, #168d83, #0d6660); }
.table-title, .tabs a.active, .panel-link { color: #0f766e; }
.tabs a.active { border-bottom-color: #0f766e; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.compact-form input:focus, .compact-form select:focus, .login-card input:focus {
    border-color: #52aaa2;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .1);
}
.kpi-icon, .round-icon { color: #0f766e; background: #e8f6f4; }
.amount-card { border-top-color: #0f766e; }
.amount-card p.total strong, .annual-summary strong,
.report-total-strip strong, .form-total strong { color: #0b6862; }
.pagination a.active {
    border-color: #0f766e;
    background: #0f766e;
    box-shadow: 0 5px 12px rgba(15, 118, 110, .2);
}
.month-comparison-summary article::before { background: #0f766e; }
.month-comparison-summary .previous-period-card::before { background: #b7791f; }
.login-showcase {
    background:
        radial-gradient(circle at 18% 18%, rgba(31, 154, 142, .4), transparent 32%),
        radial-gradient(circle at 85% 78%, rgba(183, 121, 31, .2), transparent 26%),
        linear-gradient(145deg, #0b292d, #10484a 65%, #17605d);
}

/* In-page logout confirmation */
body.modal-open { overflow: hidden; }
.logout-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: none;
    place-items: center;
    padding: 20px;
}
.logout-modal.open { display: grid; }
.logout-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 25, 27, .62);
    backdrop-filter: blur(3px);
}
.logout-dialog {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 30px;
    border: 1px solid #dbe8e7;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(6, 35, 37, .25);
    text-align: center;
}
.logout-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #697a7c;
    background: #f3f7f7;
    cursor: pointer;
    font-size: 18px;
}
.logout-dialog-icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 50%;
    color: #b4232f;
    background: #fff0f1;
    font-size: 24px;
    font-weight: 800;
}
.logout-dialog h2 { margin: 0 0 8px; color: var(--text); font-size: 22px; }
.logout-dialog p { margin: 0 auto 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.logout-dialog-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.logout-dialog-actions form { margin: 0; }

@media (max-width: 480px) {
    .logout-dialog { padding: 26px 18px 20px; border-radius: 15px; }
    .logout-dialog-actions { align-items: stretch; flex-direction: column-reverse; }
    .logout-dialog-actions form, .logout-dialog-actions .button { width: 100%; }
}
