/* =====================================================================
   Our Money Budget — site.css
   Mobile-first responsive layout. Dark mode via .dark on <html>.
   ===================================================================== */

:root {
    --color-primary:      #2E7D32;
    --color-primary-dk:   #1B5E20;
    --color-primary-lt:   #4CAF50;
    --color-income:       #1565C0;
    --color-danger:       #C62828;
    --color-warning:      #F57F17;
    --color-success:      #2E7D32;
    --color-success-bg:   #E8F5E9;
    --color-bg:           #F5F5F5;
    --color-surface:      #FFFFFF;
    --color-text:         #212121;
    --color-text-muted:   #757575;
    --color-border:       #E0E0E0;
    --sidebar-width:      260px;
    --topbar-height:      56px;
    --radius:             8px;
    --shadow:             0 2px 8px rgba(0,0,0,.10);
}

html.dark {
    --color-bg:         #121212;
    --color-surface:    #1E1E1E;
    --color-text:       #E0E0E0;
    --color-text-muted: #9E9E9E;
    --color-border:     #333333;
    --shadow:           0 2px 8px rgba(0,0,0,.40);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================================
   APP SHELL
   ===================================================================== */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 16px 16px 12px;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}
.sidebar-logo {
    width: 100px;
    height: 100px;
    border-radius: 24px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-nav a,
.sidebar-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    color: rgba(255,255,255,.85);
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover { background: rgba(255,255,255,.10); text-decoration: none; }
.sidebar-nav a.active { background: rgba(255,255,255,.20); color: #fff; font-weight: 600; }

.sidebar-nav .nav-group-label {
    padding: 16px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(255,255,255,.5);
}

.sidebar-nav .nav-sub a { padding-left: 36px; font-size: 13px; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: 13px;
    color: rgba(255,255,255,.7);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-footer-link {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 0;
}
.sidebar-footer-link:hover { color: #fff; text-decoration: none; }
.sidebar-footer-link.active { color: #fff; font-weight: 600; }

.app-topbar {
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    gap: 12px;
    box-shadow: var(--shadow);
}

.topbar-title { flex: 1; font-size: 16px; font-weight: 600; }

.btn-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    background: none; border: none; cursor: pointer;
    color: var(--color-text);
    font-size: 18px;
}
.btn-icon:hover { background: var(--color-border); }

.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px;
    flex: 1;
}

/* =====================================================================
   CARDS
   ===================================================================== */

.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.card-value { font-size: 28px; font-weight: 700; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* =====================================================================
   FORMS
   ===================================================================== */

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--color-primary); }

.form-helper   { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-error    { font-size: 12px; color: var(--color-danger); margin-top: 4px; }
.form-success  { font-size: 13px; color: var(--color-primary); background: #E8F5E9; border: 1px solid #A5D6A7; border-radius: 6px; padding: 8px 12px; }
html.dark .form-success { background: rgba(46,125,50,.2); border-color: rgba(46,125,50,.4); color: #81C784; }

/* =====================================================================
   BUTTONS
   ===================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s;
    text-decoration: none !important;
}

.btn-primary  { background: var(--color-primary);  color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dk); border-color: var(--color-primary-dk); }
.btn-outline  { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-danger   { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-sm       { padding: 5px 12px; font-size: 13px; }
.btn-xs       { padding: 2px 8px; font-size: 11px; line-height: 1.4; }
.btn-full     { width: 100%; }
.btn-group-xs { display: inline-flex; gap: 2px; }

/* =====================================================================
   BADGES
   ===================================================================== */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-green  { background: #E8F5E9; color: var(--color-primary); }
.badge-red    { background: #FFEBEE; color: var(--color-danger); }
.badge-yellow { background: #FFFDE7; color: var(--color-warning); }
.badge-blue   { background: #E3F2FD; color: var(--color-income); }
.badge-gray   { background: var(--color-border); color: var(--color-text-muted); }

html.dark .badge-green  { background: rgba(46,125,50,.25); }
html.dark .badge-red    { background: rgba(198,40,40,.25); }
html.dark .badge-yellow { background: rgba(245,127,23,.2); }
html.dark .badge-blue   { background: rgba(21,101,192,.25); }

/* =====================================================================
   PROGRESS BARS
   ===================================================================== */

.progress-bar-wrap { background: var(--color-border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--color-primary); transition: width .4s; }
.progress-bar-fill.over-budget { background: var(--color-danger); }

/* =====================================================================
   ESTIMATED / ACTUAL VALUES
   ===================================================================== */

.val-estimated { font-style: italic; color: var(--color-text-muted); }
.val-estimated::before { content: 'Est. '; }
.val-actual::after { content: ' ✓'; color: var(--color-primary); }

/* =====================================================================
   EMPTY STATES
   ===================================================================== */

.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--color-text); margin-bottom: 8px; }

/* =====================================================================
   DIVIDER
   ===================================================================== */

.divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--color-text-muted); font-size: 12px; margin: 12px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--color-border); }

/* =====================================================================
   STEP INDICATOR (Onboarding)
   ===================================================================== */

.step-indicator { display: flex; align-items: center; margin-bottom: 32px; }
.step-indicator .step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-muted); }
.step-indicator .step.active { color: var(--color-primary); font-weight: 600; }
.step-indicator .step.complete { color: var(--color-primary); }
.step-indicator .step-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--color-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.step-indicator .step.active .step-num,
.step-indicator .step.complete .step-num { background: var(--color-primary); color: #fff; }
.step-indicator .step-line { flex: 1; height: 2px; background: var(--color-border); min-width: 32px; }

/* =====================================================================
   MOBILE
   ===================================================================== */

@media (max-width: 768px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
    .app-main { margin-left: 0; padding: 16px; overflow-x: hidden; }
    .app-topbar { left: 0; }
    .card-grid { grid-template-columns: 1fr; }
    .card-value { font-size: 22px; }
}

/* =====================================================================
   UTILITY
   ===================================================================== */

.trend-up   { color: var(--color-primary); }
.trend-down { color: var(--color-danger); }
.text-muted   { color: var(--color-text-muted); }
.text-green   { color: var(--color-primary); }
.text-red     { color: var(--color-danger); }
.text-blue    { color: var(--color-income); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 13px; }
.text-xs      { font-size: 11px; }
.fw-bold      { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* =====================================================================
   PAGE TITLE
   ===================================================================== */

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 0; }

/* =====================================================================
   TABLES
   ===================================================================== */

.table-th {
    padding: 8px 12px 8px 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--color-text-muted);
    text-align: left;
    white-space: nowrap;
}
.table-td { padding: 10px 12px 10px 0; vertical-align: middle; }
.table-row { border-bottom: 1px solid var(--color-border); }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: rgba(0,0,0,.02); }

.row-warning { background: rgba(245,127,23,.08); }

/* =====================================================================
   BADGE ALIASES
   ===================================================================== */

.badge-success { background: #E8F5E9; color: var(--color-primary); }
.badge-info    { background: #E3F2FD; color: var(--color-income); }
.badge-warning { background: #FFFDE7; color: var(--color-warning); }

html.dark .badge-success { background: rgba(46,125,50,.25); }
html.dark .badge-info    { background: rgba(21,101,192,.25); }
html.dark .badge-warning { background: rgba(245,127,23,.2); }
html.dark .color-success-bg { background: rgba(46,125,50,.15); }

/* =====================================================================
   ADDITIONAL BUTTONS
   ===================================================================== */

.btn-ghost {
    background: none;
    border: none;
    color: var(--color-primary);
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius);
}
.btn-ghost:hover { background: var(--color-border); }

/* =====================================================================
   CARD VARIANTS
   ===================================================================== */

.card-highlighted { border: 2px solid var(--color-primary); }
.border-danger    { border: 1px solid var(--color-danger); }

/* =====================================================================
   INPUT WITH ICON (password toggle)
   ===================================================================== */

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 40px; }
.input-icon-btn {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer; font-size: 18px;
    color: var(--color-text-muted);
}

/* =====================================================================
   ADDITIONAL UTILITIES
   ===================================================================== */

.text-warning  { color: var(--color-warning); }
.text-success  { color: var(--color-success); }
.text-primary  { color: var(--color-primary); }
.text-lg       { font-size: 20px; }
.flex-wrap     { flex-wrap: wrap; }
.flex-column   { flex-direction: column; }
.justify-center { justify-content: center; }
.justify-end   { justify-content: flex-end; }
.gap-3         { gap: 24px; }
.ml-1          { margin-left: 8px; }
.align-self-center { align-self: center; }

.journal-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 768px) { .journal-grid { grid-template-columns: 1fr; } }

/* =====================================================================
   SYNCFUSION EJ2 — Fluent theme owns all control styling
   Do NOT add .e- rules below; override nothing inside Syncfusion components.
   ===================================================================== */

/* Grid/chart cards: flush the Syncfusion component edge-to-edge so its own
   outer border and header row land at the card boundary, not indented 20px. */
.card:has(.e-grid),
.card:has(.e-chart) {
    padding: 0;
    overflow: hidden;
}
.card:has(.e-grid) .card-title,
.card:has(.e-chart) .card-title {
    padding: 20px 20px 12px;
}

/* =====================================================================
   RECONCILIATION
   ===================================================================== */

.reconcile-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    align-items: start;
}

.reconcile-stat { display: flex; flex-direction: column; gap: 4px; }

.reconcile-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-text-muted);
}

.reconcile-stat-value { font-size: 22px; font-weight: 700; }

.reconcile-stat-input .form-control { margin-top: 2px; }

@media (max-width: 768px) {
    .reconcile-summary { grid-template-columns: 1fr 1fr; }
}

/* Prevent the global `a { color }` rule from overriding Syncfusion's own
   link colours inside grids, pagers, dropdowns, and popups. */
.e-grid a,
.e-pager a,
.e-popup a,
.e-ddl a {
    color: inherit;
    text-decoration: none;
}
