:root {
  color-scheme: light;
  --navy: #153b66;
  --navy-deep: #102e50;
  --blue: #2878c7;
  --blue-light: #eaf3fc;
  --ink: #1e293b;
  --muted: #718096;
  --line: #e5ebf1;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --green: #21835b;
  --amber: #bd7b19;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.sidebar { width: 248px; background: var(--navy-deep); color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 25px 15px 18px; }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 12px; padding: 0 10px 31px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: #eaf3fc; color: var(--navy); border-radius: 12px; font-size: 22px; font-weight: 800; }
.brand strong, .brand small, .sidebar-user strong, .sidebar-user small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .2px; }
.brand small { color: #a8bfd6; font-size: 11px; margin-top: 3px; }
.main-nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #bfd0e0; text-align: left; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; font-size: 13px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #244d78; color: white; font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 17px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.14); margin-top: 13px; padding: 18px 7px 0; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #dbeafe; color: var(--navy); font-weight: 700; }
.sidebar-user strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: #a8bfd6; font-size: 10px; margin-top: 3px; }
.main-area { margin-left: 248px; min-height: 100vh; padding: 0 38px 50px; max-width: 1600px; }
.topbar { height: 66px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.breadcrumb span { margin: 0 9px; color: #b0bac6; }
.breadcrumb strong { color: #334155; font-weight: 600; }
.local-indicator { display: flex; align-items: center; gap: 7px; color: #718096; }
.local-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #31a46c; }
.prototype-notice { margin: 21px 0 30px; display: flex; align-items: flex-start; gap: 10px; padding: 12px 15px; border: 1px solid #cfe0f2; border-radius: 9px; color: #496987; background: #edf5fc; font-size: 12px; line-height: 1.55; }
.notice-icon { flex: 0 0 17px; width: 17px; height: 17px; border: 1px solid #7da2c5; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; margin-top: 1px; }
.page { display: none; }
.page.active { display: block; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 24px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 10px; letter-spacing: 1.2px; font-weight: 700; }
h1 { margin: 0; color: #172b43; font-size: 27px; letter-spacing: -.5px; }
.subheading { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 0 15px; border-radius: 7px; border: 1px solid transparent; font-size: 12px; font-weight: 650; transition: background .15s, border .15s; }
.button.primary { background: var(--navy); color: #fff; box-shadow: 0 2px 4px #153b6624; }
.button.primary:hover { background: #1d4c7d; }
.button.secondary { background: #fff; border-color: #d9e1e9; color: #425466; }
.button.secondary:hover { background: #f8fafc; }
.button span { font-size: 17px; line-height: 1; }
.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; margin-bottom: 20px; }
.summary-card { position: relative; min-height: 124px; padding: 19px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 6px #23384b08; }
.summary-label { display: block; color: #627185; font-size: 11px; font-weight: 600; }
.summary-card strong { display: block; font-size: 25px; color: #1c3048; letter-spacing: -.5px; margin: 9px 0 3px; }
.summary-card small { font-size: 10px; color: #8a97a7; }
.summary-symbol { position: absolute; top: 18px; right: 18px; display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; font-weight: 700; }
.summary-symbol.blue { color: #236cae; background: #e9f3fc; }
.summary-symbol.green { color: var(--green); background: #e8f5ee; }
.summary-symbol.amber { color: var(--amber); background: #fff4e2; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 6px #23384b08; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid #edf1f5; }
.panel-heading h2 { margin: 0; font-size: 14px; color: #263a52; }
.panel-heading p { margin: 5px 0 0; font-size: 11px; color: #8794a4; }
.text-button { border: 0; color: var(--blue); background: transparent; font-size: 11px; font-weight: 650; }
.text-button span { font-size: 16px; margin-left: 4px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 620px; }
.data-table th { padding: 11px 14px; background: #fbfcfd; color: #78879a; text-align: left; font-size: 10px; font-weight: 650; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-top: 1px solid #edf1f5; color: #435368; vertical-align: middle; }
.data-table td.amount { text-align: right; font-variant-numeric: tabular-nums; color: #263a52; font-weight: 650; white-space: nowrap; }
.data-table th.amount { text-align: right; }
.cell-primary { color: #263a52; font-weight: 650; }
.cell-secondary { display: block; color: #8a97a7; margin-top: 3px; font-size: 10px; }
.status-pill { display: inline-block; padding: 4px 8px; border-radius: 20px; color: #267552; background: #eaf6ef; font-size: 9px; white-space: nowrap; }
.status-pill:where(button) { border: 0; font: inherit; font-size: 9px; cursor: pointer; }
.status-pill.missing { color: #9c6b1d; background: #fff4e1; }
.empty-state { padding: 38px 20px; text-align: center; color: #8290a1; font-size: 12px; }
.empty-state strong { display: block; color: #536479; font-size: 13px; margin-bottom: 6px; }
.quick-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-top: 17px; }
.quick-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: #fff; padding: 14px; border-radius: 10px; text-align: left; }
.quick-card:hover { border-color: #b8cee2; box-shadow: 0 4px 10px #153b6610; }
.quick-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.quick-icon.blue { color: #2672b9; background: #eaf3fc; }
.quick-icon.light-blue { color: #627ca0; background: #eff3f8; }
.quick-card strong, .quick-card small { display: block; }
.quick-card strong { color: #30445c; font-size: 11px; }
.quick-card small { color: #8794a4; font-size: 10px; margin-top: 4px; }
.quick-card b { margin-left: auto; color: #8ea2b5; font-weight: 400; }
.quick-card { min-height: 92px; }
.quick-card strong { font-size: 14px; }
.quick-card small { font-size: 11px; line-height: 1.5; }
.form-panel { padding: 22px 24px 0; }
.form-section-title { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.section-number { flex: 0 0 25px; width: 25px; height: 25px; border-radius: 50%; background: #eaf3fc; color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.form-section-title h2 { margin: 0; color: #263a52; font-size: 14px; }
.form-section-title p { margin: 4px 0 0; color: #8a97a7; font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px 19px; }
.form-grid label, .profile-panel label { display: block; color: #526278; font-size: 11px; font-weight: 650; }
.required { color: #c35e55; }
.form-grid input, .form-grid select, .form-grid textarea, .profile-panel input { width: 100%; margin-top: 7px; min-height: 38px; border: 1px solid #dce4ec; border-radius: 6px; padding: 9px 10px; outline: none; color: #263a52; background: #fff; font-size: 11px; }
.form-grid textarea { resize: vertical; line-height: 1.45; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .profile-panel input:focus, .profile-panel select:focus { border-color: #6da1d1; box-shadow: 0 0 0 3px #2878c71b; }
.form-grid input::placeholder, .form-grid textarea::placeholder, .profile-panel input::placeholder { color: #a9b4c1; }
.full-width { grid-column: 1 / -1; }
.money-input { position: relative; }
.money-input span { position: absolute; top: 18px; left: 11px; color: #8593a4; font-size: 11px; }
.money-input input { padding-left: 26px; }
.date-picker-control { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.date-picker-control input { flex: 1; min-width: 0; margin-top: 0; }
.date-picker-control .button { flex: 0 0 auto; min-height: 38px; padding: 8px 12px; }
.photo-heading { margin-top: 27px; }
.upload-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 119px; border: 1px dashed #b9cadb; border-radius: 8px; background: #fbfdff; text-align: center; cursor: pointer; }
.upload-zone:hover { background: #f4f9fe; border-color: #7fa8ce; }
.upload-icon { color: #3e80ba; border: 1px solid #bfd5e8; border-radius: 50%; display: grid; place-items: center; width: 28px; height: 28px; font-size: 15px; }
.upload-zone strong { color: #3c5c7b; font-size: 11px; }
.upload-zone small { color: #98a4b1; font-size: 9px; }
.upload-zone input { max-width: 220px; color: #7d8b9c; font-size: 9px; margin-top: 2px; }
.file-name { min-height: 17px; color: #4b718f; font-size: 10px; padding-top: 5px; }
.receipt-upload { min-height: 168px; border-color: #87afd3; background: linear-gradient(135deg,#f6fbff,#edf5fc); }
.receipt-upload .upload-icon { width: 44px; height: 44px; font-size: 23px; }
.receipt-upload strong { color: var(--navy); font-size: 14px; letter-spacing: .3px; }
.receipt-upload small { font-size: 11px; }
.ocr-status { margin: 12px 0; padding: 12px 14px; border-radius: 8px; background: #eef4fb; color: #405f7c; font-size: 12px; line-height: 1.5; }
.ocr-status.success { background: #eaf6ef; color: #226a49; }
.ocr-status.error { background: #fff4e3; color: #8a5b13; }
.expense-review { margin: 16px 0 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.expense-review legend { padding: 0; color: #263a52; font-size: 15px; font-weight: 700; }
.review-summary { display: flex; gap: 14px; align-items: center; margin: 12px 0 20px; padding: 12px; border: 1px solid #e4ebf2; border-radius: 9px; background: #fbfdff; }
.review-summary img { width: 70px; height: 70px; object-fit: cover; border-radius: 7px; background: #e9eff5; }
.review-summary strong { color: #263a52; font-size: 12px; }
.review-summary p, .review-summary small { display: block; color: #7f8da0; font-size: 10px; margin: 5px 0 0; line-height: 1.45; }
.expense-review .form-footer { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.voucher-config-hint { margin: 16px 0 0; color: #75859a; font-size: 11px; line-height: 1.5; }
.voucher-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 16px 20px; }
.voucher-result p { margin: 0; color: #40566f; font-size: 12px; }
.home-period-card { margin: 0 0 20px; padding: 17px 20px; }
.home-period-card h2 { margin: 0; color: #263a52; font-size: 14px; }
.home-period-card p { margin: 5px 0 0; color: #7a899b; font-size: 11px; }
.home-period-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.period-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.period-metric { border: 1px solid #e5ebf1; border-radius: 9px; padding: 15px; background: #fbfcfd; }
.period-metric span, .period-metric strong { display: block; }
.period-metric span { color: #718096; font-size: 10px; }
.period-metric strong { margin-top: 7px; color: #203953; font-size: 19px; }
.period-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.period-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 20px; background: #eaf6ef; color: #267552; font-size: 10px; }
.period-status.closed { background: #eef1f5; color: #64748b; }
.period-history { margin-top: 18px; }
.active-period-entry + .active-period-entry { margin-top: 14px; }
.camera-actions { display: flex; gap: 9px; margin-top: 12px; }
.camera-actions .button { min-height: 44px; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.form-footer { margin: 19px -24px 0; border-top: 1px solid #edf1f5; min-height: 64px; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; color: #8592a2; font-size: 10px; }
.form-footer > div { display: flex; gap: 8px; }
.history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 15px 18px; }
.search-box { display: flex; align-items: center; gap: 7px; border: 1px solid #dce4ec; border-radius: 6px; padding: 0 10px; width: min(390px,100%); color: #8091a3; }
.search-box input { border: 0; outline: 0; width: 100%; min-height: 35px; font-size: 11px; color: #34475d; }
.muted { color: #8794a4; font-size: 10px; }
.voucher-history { margin-top: 18px; }
.profile-panel { max-width: 530px; padding: 27px; display: grid; justify-items: start; }
.profile-avatar { width: 54px; height: 54px; background: #e8f1fa; color: var(--navy); border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.profile-panel label { width: 100%; margin-bottom: 15px; }
.profile-panel select { width: 100%; min-height: 38px; margin-top: 7px; border: 1px solid #dce4ec; border-radius: 6px; padding: 9px 10px; outline: none; color: #263a52; background: #fff; font-size: 11px; }
.profile-note { color: #7d8b9b; font-size: 10px; line-height: 1.6; max-width: 430px; margin: 16px 0 0; }
.toast { position: fixed; bottom: 20px; right: 22px; background: #173e66; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 8px 22px #102e5030; opacity: 0; transform: translateY(9px); pointer-events: none; transition: .2s; font-size: 12px; z-index: 10; }
.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 80% 10%, #e4eff8 0, transparent 32%), #f4f7fa; }
.auth-card { width: min(100%, 420px); background: white; border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: 0 14px 40px #153b6610; }
.auth-brand { padding: 0 0 28px; color: var(--navy); }
.auth-brand strong { color: var(--navy); }
.auth-brand small { color: #8294a6; }
.auth-card h1 { font-size: 24px; }
.auth-card .subheading { margin-bottom: 22px; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: block; color: #526278; font-size: 11px; font-weight: 650; }
.auth-form input { width: 100%; min-height: 39px; margin-top: 7px; border: 1px solid #dce4ec; border-radius: 6px; padding: 9px 10px; outline: none; color: #263a52; background: #fff; font-size: 12px; }
.auth-form input:focus { border-color: #6da1d1; box-shadow: 0 0 0 3px #2878c71b; }
.auth-form .button { width: 100%; margin-top: 3px; }
.auth-switch { margin: 2px 0 0; text-align: center; color: #7a8898; font-size: 11px; }
.auth-switch button { border: 0; background: transparent; color: var(--blue); font-size: inherit; font-weight: 650; padding: 0; }
.auth-local-note { border-top: 1px solid #edf1f5; margin: 21px 0 0; padding-top: 14px; color: #8a97a7; font-size: 10px; line-height: 1.6; }
.auth-error { margin: 0; padding: 9px 10px; border-radius: 6px; background: #fff0ef; color: #a5433c; font-size: 11px; }

@media (max-width: 900px) {
  .sidebar { width: 206px; }
  .main-area { margin-left: 206px; padding: 0 22px 35px; }
  .summary-grid { gap: 10px; }
  .summary-card { padding: 16px; }
}
@media (max-width: 680px) {
  .auth-screen { padding: 14px; }
  .auth-card { padding: 22px; }
  .sidebar { width: 62px; padding: 16px 8px; }
  .brand { padding: 0 3px 25px; justify-content: center; }
  .brand > span:last-child, .nav-item:not(.active) { overflow: hidden; }
  .brand > span:last-child, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-icon { font-size: 18px; }
  .sidebar-user { justify-content: center; padding: 15px 0 0; }
  .sidebar-user > span:last-child { display: none; }
  .main-area { margin-left: 62px; padding: 0 14px 25px; }
  .topbar { height: 54px; }
  .local-indicator { font-size: 0; }
  .local-indicator i { width: 8px; height: 8px; }
  .prototype-notice { margin: 14px 0 22px; font-size: 10px; padding: 10px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button { align-self: stretch; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 102px; }
  .quick-actions { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .form-panel { padding: 18px 14px 0; }
  .form-footer { margin-left: -14px; margin-right: -14px; padding: 12px 14px; align-items: flex-start; }
  .form-footer > div { flex-wrap: wrap; justify-content: flex-end; }
  .form-footer .button { padding: 0 10px; }
}

body.is-mobile .sidebar { z-index: 20; top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: calc(66px + env(safe-area-inset-bottom)); padding: 5px 4px env(safe-area-inset-bottom); display: block; border-top: 1px solid #ffffff20; }
body.is-mobile .sidebar > .brand, body.is-mobile .sidebar-bottom { display: none; }
body.is-mobile .main-nav { height: 100%; display: flex; align-items: stretch; justify-content: space-around; gap: 0; }
body.is-mobile .nav-item { flex: 1 1 0; min-width: 0; padding: 5px 2px; gap: 2px; border-radius: 7px; flex-direction: column; justify-content: center; font-size: 9px; line-height: 1.1; text-align: center; white-space: nowrap; }
body.is-mobile .nav-icon { width: auto; font-size: 18px; line-height: 1; }
body.is-mobile .main-area { margin-left: 0; max-width: none; padding: 0 15px calc(95px + env(safe-area-inset-bottom)); }
body.is-mobile .topbar { height: 54px; }
body.is-mobile .period-summary { grid-template-columns: 1fr; }
body.is-mobile .home-period-row, body.is-mobile .voucher-result { align-items: stretch; flex-direction: column; }
body.is-mobile .camera-actions { width: 100%; flex-direction: column; }
body.is-mobile .camera-actions .button { width: 100%; min-height: 48px; }
body.is-mobile .period-actions { width: 100%; flex-direction: column; align-items: stretch; }
body.is-mobile .period-actions .button { width: 100%; }
body.is-mobile .receipt-upload { padding: 16px; }
body.is-mobile input, body.is-mobile select, body.is-mobile textarea { font-size: 16px; }
body.is-mobile .button { min-height: 46px; }
body.is-mobile .form-footer { flex-direction: column; gap: 10px; }
body.is-mobile .form-footer > div { width: 100%; flex-direction: column; }
body.is-mobile .form-footer .button { width: 100%; }
