:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #e4eaf2;
    --line-strong: #d7e0ec;
    --text: #14213d;
    --muted: #66758d;
    --primary: #1557c0;
    --primary-dark: #0e3f94;
    --primary-soft: #eaf2ff;
    --violet: #6f49c8;
    --violet-soft: #f1ecff;
    --green: #15825d;
    --green-soft: #e8f7f1;
    --amber: #a65f00;
    --amber-soft: #fff3dc;
    --red: #c03a47;
    --red-soft: #fff0f2;
    --shadow-sm: 0 8px 24px rgba(29, 55, 90, 0.06);
    --shadow-md: 0 18px 48px rgba(22, 49, 82, 0.11);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --sidebar: 244px;
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 15% 20%, rgba(21,87,192,.11), transparent 26%),
        radial-gradient(circle at 85% 80%, rgba(111,73,200,.10), transparent 28%),
        linear-gradient(135deg, #f8fbff, #eef3fa);
}
.auth-card {
    width: min(450px, 100%);
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(214,225,239,.9);
    border-radius: 24px;
    padding: 36px;
    box-shadow: var(--shadow-md);
}
.install-card { width: min(520px, 100%); }
.auth-card h1 { margin: 32px 0 6px; font-size: 30px; letter-spacing: -.03em; }
.auth-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup > div:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.brand-lockup strong { font-size: 17px; letter-spacing: -.02em; }
.brand-lockup span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 13px;
    display: grid; place-items: center; color: #fff; font-weight: 800;
    background: linear-gradient(145deg, #1c66d7, #0d3e91);
    box-shadow: 0 8px 18px rgba(21,87,192,.25);
}

.stack-form { display: grid; gap: 17px; margin-top: 26px; }
.stack-form label, .form-grid label, .split-grid label { display: grid; gap: 7px; color: #33435b; font-size: 13px; font-weight: 700; }
input, select, textarea {
    width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--text);
    border-radius: 10px; padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { border-color: #6e9ee1; box-shadow: 0 0 0 3px rgba(21,87,192,.10); }
.muted { color: var(--muted); margin: 0; }
.alert { border-radius: 12px; padding: 12px 14px; margin-top: 20px; font-size: 14px; }
.alert-danger { background: var(--red-soft); color: #9b2432; border: 1px solid #ffd7dc; }
.alert-success { background: var(--green-soft); color: #0d684a; border: 1px solid #cceede; }
.alert-info { background: var(--primary-soft); color: #164b93; border: 1px solid #d5e5ff; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; border: 1px solid transparent; border-radius: 10px;
    padding: 10px 16px; font-size: 14px; font-weight: 750; transition: .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(180deg, #1d68d7, #1557c0); box-shadow: 0 8px 18px rgba(21,87,192,.20); }
.btn-primary:hover { background: linear-gradient(180deg, #175fcb, #104da9); }
.btn-secondary { background: #fff; color: #2f415e; border-color: var(--line-strong); }
.btn-secondary:hover { border-color: #aebdd0; background: #fbfdff; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ocr { width: 100%; background: #122e62; color: #fff; margin-top: 14px; }
.btn-block { width: 100%; }

.app-body { min-width: 320px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
    background: #0f2853; color: #fff; padding: 22px 16px;
    display: flex; flex-direction: column; box-shadow: 8px 0 30px rgba(8,25,53,.08);
}
.brand-sidebar { padding: 0 8px 23px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand-sidebar .brand-mark { background: #fff; color: #154fAD; box-shadow: none; }
.brand-sidebar strong { color: #fff; }
.brand-sidebar span { color: rgba(255,255,255,.58); }
.sidebar-nav { display: grid; gap: 6px; margin-top: 20px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: rgba(255,255,255,.74); border-radius: 10px; font-size: 14px; font-weight: 650; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 #72a8ff; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid rgba(255,255,255,.10); display: grid; gap: 13px; }
.security-chip { font-size: 11px; color: rgba(255,255,255,.58); display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #47d19e; box-shadow: 0 0 0 4px rgba(71,209,158,.10); display: inline-block; }
.logout-link { color: rgba(255,255,255,.72); font-size: 13px; }
.logout-link:hover { color: #fff; }

.main-area { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; height: 74px; padding: 0 28px;
    display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 16px; font-weight: 800; }
.topbar-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-menu > div:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.user-menu strong { font-size: 13px; }
.user-menu span { color: var(--muted); font-size: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 23px; color: var(--text); }

.content { padding: 28px; flex: 1; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: clamp(25px, 2.2vw, 34px); letter-spacing: -.04em; line-height: 1.15; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.dashboard-heading { margin-bottom: 24px; }

.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.entity-card {
    position: relative; overflow: hidden; min-height: 210px; border-radius: var(--radius-lg); padding: 24px;
    color: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-md);
}
.entity-card::after { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; right: -65px; bottom: -95px; background: rgba(255,255,255,.09); }
.entity-blue { background: linear-gradient(145deg, #185fc9, #0c3d8f); }
.entity-violet { background: linear-gradient(145deg, #7655d3, #503398); }
.entity-card-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.72); }
.entity-symbol { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.15); color: #fff; font-size: 13px; font-weight: 900; }
.entity-symbol.small { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.entity-card h2 { margin: 18px 0 0; max-width: 78%; font-size: 20px; letter-spacing: -.03em; }
.entity-amount { margin-top: auto; display: flex; flex-direction: column; }
.entity-amount span { font-size: 11px; color: rgba(255,255,255,.68); }
.entity-amount strong { font-size: 27px; letter-spacing: -.03em; margin-top: 2px; }
.entity-card a { margin-top: 15px; color: #fff; font-size: 12px; font-weight: 750; position: relative; z-index: 2; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.stat-card { min-height: 112px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 13px; }
.stat-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 900; }
.stat-card:nth-child(2) .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-card:nth-child(3) .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card:nth-child(4) .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card > div:last-child { min-width: 0; display: grid; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { font-size: 20px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card small { color: #8b98aa; font-size: 10px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-header h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-header a { font-size: 12px; font-weight: 750; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(280px,.75fr); gap: 18px; margin-top: 18px; }
.recent-panel { margin-top: 18px; }

.bar-chart { height: 236px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; align-items: end; padding: 8px 6px 0; }
.bar-item { height: 100%; display: grid; grid-template-rows: 20px minmax(0,1fr) 22px; gap: 4px; text-align: center; }
.bar-value { color: var(--muted); font-size: 10px; align-self: end; }
.bar-track { height: 100%; border-radius: 8px; background: #f1f5fa; display: flex; align-items: end; overflow: hidden; }
.bar-fill { width: 100%; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #5f93e2, #1557c0); min-height: 8px; }
.bar-item span { color: var(--muted); font-size: 10px; }
.rank-list { display: grid; gap: 10px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eff2f6; }
.rank-row:last-child { border: 0; }
.rank-no { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; }
.rank-row > div { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 8px; }
.rank-row strong { font-size: 12px; }
.rank-row small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.empty-mini, .empty-row { color: var(--muted); text-align: center; font-size: 13px; padding: 28px 12px !important; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.data-table th { padding: 10px 12px; background: #f7f9fc; color: #69778b; border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .02em; text-align: left; white-space: nowrap; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid #edf1f6; font-size: 12px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdff; }
.data-table td > strong, .data-table td > small { display: block; }
.data-table td > small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.align-right { text-align: right !important; }
.compact-table td { padding-top: 11px; padding-bottom: 11px; }
.entity-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.entity-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 7px; font-size: 9px; font-weight: 850; letter-spacing: .03em; }
.tag-hkget { background: var(--primary-soft); color: var(--primary); }
.tag-mf { background: var(--violet-soft); color: var(--violet); }
.status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.status-confirmed { background: var(--green-soft); color: var(--green); }
.status-pending { background: var(--amber-soft); color: var(--amber); }
.status-missing_info { background: var(--red-soft); color: var(--red); }
.icon-link { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-soft); color: var(--primary); }

.ocr-status { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px; font-size: 11px; font-weight: 800; }
.ocr-status.is-live { background: var(--green-soft); color: var(--green); }
.ocr-status.is-demo { background: var(--amber-soft); color: var(--amber); }
.ocr-status.is-demo .dot { background: #e2a025; box-shadow: 0 0 0 4px rgba(226,160,37,.12); }
.upload-layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.65fr); gap: 18px; align-items: start; }
.upload-panel { padding: 0; overflow: hidden; }
.stepper { display: grid; grid-template-columns: repeat(3,1fr); background: #f7f9fc; border-bottom: 1px solid var(--line); }
.step { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 10px; color: var(--muted); font-size: 11px; font-weight: 750; border-right: 1px solid var(--line); }
.step:last-child { border-right: 0; }
.step span { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; background: #e9eef5; font-size: 10px; }
.step.active { color: var(--primary); background: #fff; }
.step.active span { background: var(--primary); color: #fff; }
.expense-form { padding: 0 22px 24px; }
.form-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 15px; font-size: 15px; }
.entity-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.entity-choice { position: relative; display: flex; gap: 12px; align-items: center; border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px; cursor: pointer; transition: .15s; }
.entity-choice:hover { border-color: #9ab7dc; }
.entity-choice input { position: absolute; opacity: 0; pointer-events: none; }
.entity-choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,87,192,.08); background: #fbfdff; }
.choice-violet:has(input:checked) { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(111,73,200,.08); }
.choice-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 40px; background: var(--primary-soft); color: var(--primary); font-weight: 900; font-size: 12px; }
.choice-violet .choice-mark { background: var(--violet-soft); color: var(--violet); }
.entity-choice > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.entity-choice strong { font-size: 12px; line-height: 1.35; }
.entity-choice small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.split-toggle { margin-top: 14px; display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); font-weight: 650; }
.split-toggle input { width: 16px; height: 16px; }
.drop-zone { min-height: 174px; border: 1.5px dashed #9eb3ce; border-radius: 16px; background: #f9fbfe; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-glyph { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.drop-zone strong { font-size: 14px; }
.drop-zone small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.file-name { color: var(--primary); font-size: 10px; font-weight: 750; margin-top: 9px; }
.ocr-progress { margin-top: 12px; border-radius: 12px; background: var(--primary-soft); padding: 12px; color: var(--primary-dark); font-size: 11px; }
.ocr-progress span { display: block; height: 4px; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 200% 100%; animation: scan 1.2s linear infinite; }
.ocr-progress p { margin: 8px 0 0; }
@keyframes scan { to { background-position: -200% 0; } }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.confidence-badge { padding: 5px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 9px; font-weight: 800; }
.confidence-badge.good { background: var(--green-soft); color: var(--green); }
.confidence-badge.warn { background: var(--amber-soft); color: var(--amber); }
.confidence-badge.low { background: var(--red-soft); color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.full-field { grid-column: 1 / -1; }
.form-grid label { font-size: 11px; }
.form-grid input, .form-grid select, .form-grid textarea, .split-grid input { font-size: 12px; font-weight: 500; }
.split-panel { margin-top: 16px; border: 1px solid #dfd5fb; background: #faf8ff; border-radius: 14px; padding: 16px; }
.split-panel h4 { margin: 0 0 12px; font-size: 13px; color: #5a3b9f; }
.split-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-hint { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-message { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 12px; }
.form-message.success { background: var(--green-soft); color: var(--green); }
.form-message.error { background: var(--red-soft); color: var(--red); }
.receipt-preview-panel { position: sticky; top: 94px; }
.receipt-preview { min-height: 420px; background: #f6f8fb; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.receipt-preview img, .receipt-preview iframe { width: 100%; height: 100%; min-height: 420px; object-fit: contain; border: 0; background: #fff; }
.preview-note { margin-top: 14px; background: #f8fafc; border-radius: 12px; padding: 13px; }
.preview-note strong { font-size: 11px; }
.preview-note p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }

.filter-bar { display: grid; grid-template-columns: minmax(240px,1fr) 180px 180px auto auto; gap: 10px; align-items: center; margin-bottom: 18px; }
.filter-bar select, .filter-bar input { height: 42px; font-size: 12px; }
.search-box { position: relative; display: block; }
.search-box span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); z-index: 1; }
.search-box input { padding-left: 34px; }

.report-callout { display: flex; align-items: flex-start; gap: 13px; border: 1px solid #d5e5ff; background: #f3f7ff; border-radius: 14px; padding: 15px; margin-bottom: 18px; }
.callout-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 900; flex: 0 0 28px; }
.report-callout strong { font-size: 12px; }
.report-callout p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.report-grid, .settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.report-span { grid-column: 1 / -1; }
.summary-list { display: grid; gap: 0; }
.summary-list > div { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 11px 0; border-bottom: 1px solid #edf1f6; }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list span { color: #44536a; font-size: 11px; }
.summary-list strong { font-size: 12px; }
.summary-total { margin-top: 5px; padding-top: 14px !important; font-weight: 800; }
.category-bars { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 28px; }
.category-bar-row > div:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.category-bar-row strong { font-size: 10px; }
.category-track { height: 7px; border-radius: 999px; background: #edf2f8; margin-top: 8px; overflow: hidden; }
.category-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #76a5e8, #1557c0); }
.setting-list { display: grid; gap: 10px; }
.setting-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid #edf1f6; }
.setting-row:last-child { border-bottom: 0; }
.setting-row > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.setting-row strong { font-size: 11px; }
.setting-row span:not(.status) { color: var(--muted); font-size: 9px; }
.system-status { display: flex; align-items: center; gap: 14px; min-height: 92px; }
.system-status-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 20px; font-weight: 900; flex: 0 0 48px; }
.system-status-icon.ok { background: var(--green-soft); color: var(--green); }
.system-status-icon.warn { background: var(--amber-soft); color: var(--amber); }
.system-status strong { font-size: 13px; }
.system-status p { color: var(--muted); font-size: 10px; margin: 4px 0 0; }
.project-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.project-card { border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: grid; align-items: start; justify-items: start; gap: 7px; }
.project-card strong { font-size: 11px; }
.project-card small { color: var(--muted); font-size: 9px; }
.checklist-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px 20px; }
.checklist-grid label { display: flex; align-items: center; gap: 9px; color: #495970; font-size: 11px; }
.checklist-grid input { width: 16px; height: 16px; }

.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 16px 28px; border-top: 1px solid var(--line); color: #8995a6; font-size: 9px; background: #fff; }

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .filter-bar { grid-template-columns: minmax(240px,1fr) 160px 160px; }
    .filter-bar .btn { width: 100%; }
    .project-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 920px) {
    :root { --sidebar: 220px; }
    .dashboard-grid, .upload-layout { grid-template-columns: 1fr; }
    .receipt-preview-panel { position: static; }
    .receipt-preview { min-height: 300px; }
    .receipt-preview img, .receipt-preview iframe { min-height: 300px; }
    .entity-grid { grid-template-columns: 1fr; }
    .report-grid, .settings-grid { grid-template-columns: 1fr; }
    .report-span { grid-column: auto; }
    .category-bars { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .app-shell { display: block; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: 250px; }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .mobile-menu { display: block; }
    .topbar { height: 66px; padding: 0 16px; }
    .user-menu > div:last-child { display: none; }
    .content { padding: 18px 14px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
    .page-heading .btn { width: 100%; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { min-height: 98px; padding: 13px; }
    .stat-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
    .stat-card strong { font-size: 16px; }
    .entity-card { min-height: 190px; padding: 20px; }
    .entity-card h2 { max-width: 100%; font-size: 18px; }
    .panel { padding: 16px; }
    .form-grid, .split-grid, .entity-choice-grid { grid-template-columns: 1fr; }
    .full-field { grid-column: auto; }
    .step { font-size: 9px; padding: 13px 5px; }
    .step span { width: 20px; height: 20px; }
    .expense-form { padding: 0 16px 20px; }
    .filter-bar { grid-template-columns: 1fr; }
    .project-grid, .checklist-grid { grid-template-columns: 1fr; }
    .app-footer { flex-direction: column; padding: 14px 16px; }
}

@media (max-width: 450px) {
    .stat-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 14px; }
    .bar-chart { gap: 8px; height: 210px; }
    .entity-amount strong { font-size: 24px; }
}

/* v1.3 OCR provider status */
.settings-grid code,
.form-hint code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
    background: rgba(15, 23, 42, .06);
    border-radius: 6px;
    padding: 2px 5px;
}
