:root {
  --ink: #12243c;
  --ink-2: #203751;
  --ink-3: #53657a;
  --paper: #f3f0e9;
  --paper-2: #faf8f3;
  --white: #fffefa;
  --line: #ddd8ce;
  --line-dark: #bdc2c5;
  --accent: #d45239;
  --accent-dark: #ab3b29;
  --accent-soft: #f6ded7;
  --sage: #64887e;
  --sage-soft: #dce9e4;
  --gold: #a98539;
  --gold-soft: #efe6ca;
  --danger: #b83a3a;
  --shadow: 0 16px 44px rgba(26, 37, 50, 0.09);
  --radius: 4px;
  --font-display: "STZhongsong", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --font-body: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-number: Bahnschrift, "DIN Alternate", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font-body); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }
.mobile-only { display: none; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-family: var(--font-number);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 6vw, 76px);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(18,36,60,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18,36,60,.035) 1px, transparent 1px);
  background-size: 42px 42px;
}

.login-panel { width: min(540px, 100%); display: grid; place-items: center; padding: clamp(34px, 5vw, 58px); border: 1px solid var(--line); background: var(--paper-2); box-shadow: var(--shadow); }
.login-card { width: min(390px, 100%); animation: enter .55s ease both; }
.brand-seal { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--accent); border-radius: 50% 50% 50% 12%; font-family: var(--font-number); font-weight: 700; letter-spacing: -.05em; }
.sidebar-brand div { display: flex; flex-direction: column; }
.sidebar-brand b { font-family: var(--font-display); font-size: 18px; letter-spacing: .08em; }
.sidebar-brand small { margin-top: 3px; color: var(--ink-3); font-family: var(--font-number); letter-spacing: .16em; font-size: 9px; }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 600; }
.login-heading > p:last-child { color: var(--ink-3); font-size: 13px; line-height: 1.7; margin: 12px 0 0; }

.field-label { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.field-label input, .field-label select, .field-label textarea, .table-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field-label input:focus, .field-label select:focus, .field-label textarea:focus, .table-input:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(18,36,60,.08); }
.field-label textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.field-hint { color: #7c8792; font-size: 11px; font-weight: 400; }
.form-error { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 12px; }
.login-ledger-step { margin: 4px 0 13px; padding: 14px 14px 12px; border-left: 3px solid var(--sage); background: #edf3f0; animation: enter .24s ease both; }
.login-ledger-step .field-label { margin-bottom: 10px; color: var(--ink-2); }
.login-ledger-note { margin: 0; display: flex; justify-content: space-between; gap: 12px; color: var(--ink-3); font-size: 9px; }
.login-ledger-note span { font-family: var(--font-number); color: var(--sage); }
.login-ledger-note b { font-weight: 500; }

.button {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: transform .18s, background .18s, color .18s, opacity .18s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-dark { color: white; background: var(--ink); }
.button-dark:hover { background: var(--ink-2); }
.button-secondary { background: #e9e5dc; color: var(--ink); }
.button-ghost { background: transparent; border: 1px solid var(--line); }
.button-danger { color: var(--danger); background: #f6e0dd; }
.button-large { width: 100%; min-height: 48px; margin-top: 8px; justify-content: space-between; padding-inline: 19px; }
.button-small { padding: 7px 10px; font-size: 11px; }
.demo-accounts { margin-top: 27px; border-top: 1px solid var(--line); padding-top: 19px; }
.demo-accounts p { color: var(--ink-3); font-size: 11px; margin: 0 0 10px; }
.demo-accounts div { display: flex; gap: 7px; flex-wrap: wrap; }
.demo-accounts button { border: 1px solid var(--line); background: transparent; border-radius: 20px; padding: 6px 11px; color: var(--ink-3); cursor: pointer; font-size: 11px; }
.demo-accounts button:hover { border-color: var(--accent); color: var(--accent); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #eaf0f4; background: var(--ink); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 25px 23px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand b { color: white; font-size: 16px; }
.sidebar-brand small { color: #718499; }
.sidebar-ledger { position: relative; margin: 14px 13px 0; padding: 11px 12px 12px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.045); }
.sidebar-ledger > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sidebar-ledger > div span { color: #718499; font-size: 8px; letter-spacing: .08em; }
.sidebar-ledger > div b { color: #df8b76; font-family: var(--font-number); font-size: 8px; }
.sidebar-ledger select { width: 100%; padding: 7px 23px 7px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.15); border-radius: 0; outline: 0; color: white; background: transparent; font-family: var(--font-display); font-size: 11px; font-weight: 600; cursor: pointer; text-overflow: ellipsis; }
.sidebar-ledger select option { color: var(--ink); background: var(--white); font-family: var(--font-body); }
.sidebar-ledger select:disabled { cursor: default; opacity: .9; }
.sidebar-ledger > small { display: block; margin-top: 7px; overflow: hidden; color: #718499; font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-ledger.is-switching::after { content: ""; position: absolute; right: 10px; bottom: 12px; width: 9px; height: 9px; border: 1px solid rgba(255,255,255,.25); border-top-color: #e88b75; border-radius: 50%; animation: spin .7s linear infinite; }
.main-nav { padding: 16px 11px 6px; flex: 1; overflow-y: auto; }
.main-nav p { margin: 18px 12px 6px; color: #62778d; font-size: 9px; font-family: var(--font-number); letter-spacing: .14em; }
.main-nav button { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 3px; background: transparent; color: #9babb9; padding: 10px 12px; cursor: pointer; text-align: left; font-size: 12px; transition: color .16s, background .16s; }
.main-nav button > span { font-family: var(--font-number); color: #586e82; font-size: 9px; }
.main-nav button:hover { color: white; background: rgba(255,255,255,.05); }
.main-nav button.is-active { color: white; background: rgba(255,255,255,.09); }
.main-nav button.is-active::before { content: ""; position: absolute; left: -11px; height: 20px; width: 3px; background: var(--accent); }
.main-nav button.is-active > span { color: #e88b75; }
.main-nav button i { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: none; place-items: center; border-radius: 9px; background: var(--accent); color: white; font-style: normal; font-size: 9px; }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr 26px; align-items: center; gap: 10px; padding: 16px 17px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #d7c7a2; color: var(--ink); font-family: var(--font-display); }
.sidebar-user div:nth-child(2) { display: flex; flex-direction: column; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small { color: #6f8397; font-size: 10px; margin-top: 3px; }
.sidebar-user button { border: 0; background: transparent; color: #74879b; cursor: pointer; font-size: 16px; }

.workspace { min-width: 0; background-color: var(--paper); background-image: linear-gradient(rgba(18,36,60,.025) 1px, transparent 1px); background-size: 100% 38px; }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 17px 34px; background: rgba(250,248,243,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-box { display: flex; align-items: center; width: 250px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius); padding: 0 11px; color: var(--ink-3); }
.search-box input { width: 100%; border: 0; background: transparent; outline: 0; padding: 10px 8px; font-size: 12px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius); cursor: pointer; }
.app-content { padding: 27px 34px 54px; max-width: 1720px; width: 100%; margin: 0 auto; animation: enter .32s ease both; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card { min-height: 145px; padding: 19px 20px; background: var(--white); border: 1px solid var(--line); position: relative; overflow: hidden; }
.kpi-card::after { content: attr(data-code); position: absolute; right: 12px; bottom: -12px; font-family: var(--font-number); font-size: 64px; color: rgba(18,36,60,.035); }
.kpi-card.accent { color: white; background: var(--accent); border-color: var(--accent); }
.kpi-card.accent::after { color: rgba(255,255,255,.12); }
.kpi-label { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11px; }
.kpi-card.accent .kpi-label { color: #f9cabe; }
.kpi-value { margin: 22px 0 12px; font-family: var(--font-number); font-size: clamp(25px, 2.3vw, 36px); font-weight: 600; letter-spacing: -.03em; }
.kpi-foot { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 10px; }
.kpi-card.accent .kpi-foot { color: #fff0ec; }
.trend-up { color: var(--sage); }
.kpi-card.accent .trend-up { color: white; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 16px; }
.panel { background: var(--white); border: 1px solid var(--line); box-shadow: 0 4px 20px rgba(20,31,44,.025); }
.panel + .panel { margin-top: 16px; }
.panel-body { padding: 20px; }
.panel-heading { min-height: 62px; padding: 15px 19px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.panel-heading p { margin: 4px 0 0; color: var(--ink-3); font-size: 10px; }
.panel-heading > span, .muted { color: var(--ink-3); font-size: 11px; }

.performance-chart { height: 260px; padding: 20px 22px 14px; display: grid; grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: 14px; align-items: end; border-bottom: 1px solid var(--line); }
.chart-month { height: 100%; display: grid; grid-template-rows: 1fr 20px; align-items: end; gap: 8px; }
.bar-stage { height: 100%; display: flex; align-items: end; justify-content: center; gap: 5px; position: relative; border-bottom: 1px solid #cfd2cf; }
.bar { width: min(24px, 34%); min-height: 2px; transition: height .5s cubic-bezier(.2,.7,.2,1); }
.bar.revenue { background: var(--ink); }
.bar.expense { background: var(--accent); opacity: .86; }
.chart-month small { text-align: center; color: var(--ink-3); font-family: var(--font-number); font-size: 9px; }
.chart-legend { display: flex; gap: 18px; padding: 12px 22px 18px; color: var(--ink-3); font-size: 10px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; background: var(--ink); }
.chart-legend span:last-child i { background: var(--accent); }

.workflow-list { padding: 4px 19px 18px; }
.workflow-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; padding: 15px 0; border-bottom: 1px solid #e9e5dc; }
.workflow-row:last-child { border-bottom: 0; }
.workflow-code { width: 32px; height: 32px; display: grid; place-items: center; background: var(--paper); color: var(--ink-3); font-family: var(--font-number); font-size: 10px; }
.workflow-row b { display: block; font-size: 12px; }
.workflow-row small { color: var(--ink-3); font-size: 10px; }
.workflow-row strong { font-family: var(--font-number); font-size: 17px; }

.activity-list { padding: 0 19px 13px; }
.activity-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid #ebe7df; align-items: center; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.activity-item[data-type="reimbursement"] .activity-dot { background: var(--accent); }
.activity-item b { font-size: 11px; }
.activity-item p { margin: 3px 0 0; color: var(--ink-3); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-item strong { font-family: var(--font-number); font-size: 12px; }

.data-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.segmented { display: inline-flex; gap: 2px; background: #e7e2d8; padding: 3px; border-radius: var(--radius); }
.segmented button { border: 0; background: transparent; color: var(--ink-3); border-radius: 2px; padding: 8px 12px; cursor: pointer; font-size: 11px; }
.segmented button.is-active { background: var(--white); color: var(--ink); box-shadow: 0 2px 8px rgba(18,36,60,.08); }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.filter-select { min-width: 130px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 9px 31px 9px 11px; color: var(--ink-2); font-size: 11px; }
.claim-export-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 18px; margin-bottom: 14px; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); }
.claim-query-fields { display: flex; flex: 1 1 570px; flex-wrap: wrap; align-items: end; gap: 9px; }
.claim-filter-field { display: grid; flex: 1 1 140px; gap: 5px; min-width: 125px; }
.claim-filter-field > span { color: var(--ink-3); font-size: 9px; font-weight: 700; }
.claim-filter-field .filter-input, .claim-filter-field .filter-select { width: 100%; min-width: 0; height: 36px; }
.claim-query-fields > .button { min-height: 36px; white-space: nowrap; }
.claim-export-actions { display: flex; flex: 0 0 auto; align-items: end; gap: 12px; }
.claim-filter-summary { display: grid; gap: 3px; min-width: 126px; text-align: right; }
.claim-filter-summary span { color: var(--ink-3); font-size: 9px; }
.claim-filter-summary b { font-family: var(--font-number); font-size: 16px; }
.claim-export-actions .button { min-height: 36px; white-space: nowrap; }

.table-shell { overflow: hidden; background: var(--white); border: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.data-table th { padding: 12px 14px; color: var(--ink-3); background: #f0ede6; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; letter-spacing: .03em; font-weight: 700; white-space: nowrap; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid #ebe7df; font-size: 11px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: #fbf8f1; }
.data-table td.numeric, .data-table th.numeric { text-align: right; font-family: var(--font-number); font-variant-numeric: tabular-nums; }
.data-table .primary-cell { font-weight: 700; color: var(--ink); }
.data-table .sub-cell { display: block; margin-top: 3px; color: var(--ink-3); font-size: 9px; }
.table-footer { min-height: 48px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 10px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 5px 9px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-posted, .status-paid, .status-reconciled { color: #376d5f; background: var(--sage-soft); }
.status-available { color: #376d5f; background: var(--sage-soft); }
.status-claimed { color: #8a681f; background: var(--gold-soft); }
.status-reimbursed { color: #526171; background: #e4e8ec; }
.status-active { color: #376d5f; background: var(--sage-soft); }
.status-inactive { color: #7b5960; background: #ece3e4; }
.status-unposted, .status-manager_review, .status-finance_review, .status-pending_payment, .status-pending_reconciliation { color: #8a681f; background: var(--gold-soft); }
.status-rejected { color: var(--danger); background: #f5dddd; }
.row-action { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 5px; font-weight: 700; font-size: 11px; }
.amount-positive { color: #397468; }
.amount-negative { color: var(--accent-dark); }

.recon-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.summary-strip { padding: 15px 17px; background: var(--white); border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.summary-strip span { color: var(--ink-3); font-size: 10px; }
.summary-strip strong { font-family: var(--font-number); font-size: 19px; }
.recon-board { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr); gap: 0; align-items: stretch; }
.recon-column { background: var(--white); border: 1px solid var(--line); }
.recon-column .panel-heading { background: #f0ede6; }
.recon-list { padding: 10px; max-height: 520px; overflow: auto; }
.recon-card { width: 100%; border: 1px solid transparent; background: transparent; padding: 13px; text-align: left; cursor: pointer; display: grid; gap: 7px; border-bottom-color: #e7e2d8; }
.recon-card:hover { background: #f8f5ee; }
.recon-card.is-selected { border-color: var(--accent); background: #fff6f3; }
.recon-card header, .recon-card footer { display: flex; justify-content: space-between; gap: 10px; }
.recon-card b { font-size: 11px; }
.recon-card span { color: var(--ink-3); font-size: 9px; }
.recon-card strong { font-family: var(--font-number); color: var(--accent-dark); }
.recon-link { display: flex; align-items: center; justify-content: center; }
.recon-link span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--accent); font-size: 20px; box-shadow: 0 8px 20px rgba(212,82,57,.25); }
.recon-footer { margin-top: 14px; padding: 15px 17px; background: var(--ink); color: white; display: flex; justify-content: space-between; align-items: center; }
.recon-footer p { margin: 0; color: #aeb9c4; font-size: 11px; }
.recon-footer strong { color: white; font-family: var(--font-number); }

.claim-board { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 15px; }
.claim-filters { background: var(--white); border: 1px solid var(--line); padding: 18px; align-self: start; }
.claim-filters h3 { margin: 0 0 17px; font-family: var(--font-display); font-size: 16px; }
.claim-filter { width: 100%; border: 0; background: transparent; display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid #ebe7df; cursor: pointer; color: var(--ink-3); font-size: 11px; }
.claim-filter.is-active { color: var(--accent); font-weight: 700; }
.claim-filter b { font-family: var(--font-number); }
.claim-list { display: grid; gap: 10px; }
.claim-card { padding: 17px 18px; background: var(--white); border: 1px solid var(--line); cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.claim-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c5bfb4; }
.claim-card header { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.claim-card h3 { margin: 3px 0 0; font-family: var(--font-display); font-size: 16px; }
.claim-card .claim-no { color: var(--ink-3); font-family: var(--font-number); font-size: 9px; }
.claim-card .claim-amount { font-family: var(--font-number); font-size: 22px; }
.claim-card footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid #ebe7df; display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); font-size: 10px; }
.claim-meta { display: flex; gap: 16px; margin-top: 10px; color: var(--ink-3); font-size: 10px; }
.invoice-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.admin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.admin-tabs { margin-bottom: 12px; }
.access-intro { margin-bottom: 14px; }
.account-table .data-table { min-width: 1240px; }
.account-identity { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.account-identity > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: white; background: var(--ink); font-family: var(--font-display); font-size: 14px; }
.account-identity b { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.account-identity b em { padding: 2px 5px; color: var(--accent); background: var(--accent-soft); font-size: 7px; font-style: normal; }
.account-identity small { display: block; margin-top: 3px; color: var(--ink-3); font-family: var(--font-number); font-size: 9px; }
.module-chip-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.module-chip-list span { padding: 3px 6px; color: var(--ink-2); background: #ebe7de; border-radius: 2px; font-size: 8px; white-space: nowrap; }
.ledger-chip-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 140px; }
.ledger-chip-list span { padding: 4px 7px; color: #376d5f; background: var(--sage-soft); border-radius: 2px; font-size: 8px; white-space: nowrap; }
.ledger-chip-list em { color: var(--danger); font-size: 9px; font-style: normal; }
.ledger-permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ledger-permission { min-height: 82px; }
.ledger-permission small { line-height: 1.55; }
.default-ledger-field { width: min(420px, 100%); margin-top: 13px; }
.ledger-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 13px; }
.ledger-set-card { min-height: 248px; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); background: var(--white); box-shadow: 0 4px 20px rgba(20,31,44,.025); }
.ledger-set-card.is-current { border-color: var(--sage); box-shadow: inset 4px 0 0 var(--sage); }
.ledger-set-card header { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid #ebe7df; }
.ledger-set-card header h3 { margin: 7px 0 4px; font-family: var(--font-display); font-size: 17px; }
.ledger-set-card header p { margin: 0; color: var(--ink-3); font-size: 9px; line-height: 1.5; }
.ledger-set-card header > em { height: fit-content; padding: 4px 7px; color: var(--accent); background: var(--accent-soft); font-size: 8px; font-style: normal; white-space: nowrap; }
.ledger-set-code { color: var(--accent); font-family: var(--font-number); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.ledger-set-card dl { margin: 17px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ledger-set-card dt { color: var(--ink-3); font-size: 8px; }
.ledger-set-card dd { margin: 6px 0 0; font-family: var(--font-number); font-size: 14px; }
.ledger-set-card footer { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #ebe7df; }
.ledger-set-card footer span { color: var(--ink-3); font-size: 9px; }
.ledger-isolation-note { margin-top: 5px; padding: 13px 14px; display: grid; gap: 5px; border-left: 3px solid var(--sage); background: #edf3f0; }
.ledger-isolation-note b { color: #376d5f; font-size: 10px; }
.ledger-isolation-note span { color: var(--ink-3); font-size: 9px; line-height: 1.6; }
.filter-input { min-width: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 9px 11px; color: var(--ink-2); font-size: 11px; }
.invoice-table { min-width: 980px; }
.invoice-number { font-family: var(--font-number); font-variant-numeric: tabular-nums; white-space: nowrap; }
.source-chip { display: inline-flex; padding: 3px 6px; margin: 1px; color: var(--ink-2); background: #e9e5dc; border-radius: 2px; font-size: 8px; white-space: nowrap; }

.voucher-card { background: var(--white); border: 1px solid var(--line); margin-bottom: 11px; }
.voucher-header { padding: 14px 17px; display: grid; grid-template-columns: 130px 110px minmax(180px, 1fr) 110px auto; gap: 16px; align-items: center; cursor: pointer; }
.voucher-header strong { font-family: var(--font-number); }
.voucher-header p { margin: 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voucher-header small { color: var(--ink-3); font-size: 9px; }
.voucher-total { text-align: right; font-family: var(--font-number); }
.voucher-lines { display: none; border-top: 1px solid var(--line); background: #fbf9f5; padding: 0 17px 15px; }
.voucher-card.is-open .voucher-lines { display: block; }
.voucher-card.is-open .voucher-header { background: #f3efe7; }
.voucher-lines table { width: 100%; border-collapse: collapse; }
.voucher-lines th, .voucher-lines td { padding: 9px 8px; border-bottom: 1px solid #e8e3da; font-size: 10px; text-align: left; }
.voucher-lines td.numeric { text-align: right; font-family: var(--font-number); }

.report-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
.report-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.report-stat { padding: 14px 16px; background: var(--white); border: 1px solid var(--line); }
.report-stat span { color: var(--ink-3); font-size: 9px; }
.report-stat strong { display: block; margin-top: 7px; font-family: var(--font-number); font-size: 19px; }
.balance-pass { color: #3c7668; }
.balance-fail { color: var(--danger); }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.asset-card { background: var(--white); border: 1px solid var(--line); padding: 18px; }
.asset-card header { display: flex; justify-content: space-between; align-items: start; }
.asset-card h3 { margin: 4px 0; font-family: var(--font-display); font-size: 17px; }
.asset-card small { color: var(--ink-3); font-size: 9px; }
.asset-card dl { margin: 17px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset-card dt { color: var(--ink-3); font-size: 9px; }
.asset-card dd { margin: 5px 0 0; font-family: var(--font-number); font-size: 13px; }
.allocation-bar { height: 7px; display: flex; overflow: hidden; background: #e7e3db; margin-bottom: 8px; }
.allocation-bar i:nth-child(1) { background: var(--ink); }
.allocation-bar i:nth-child(2) { background: var(--accent); }
.allocation-bar i:nth-child(3) { background: var(--sage); }

.rule-account { display: flex; flex-direction: column; gap: 3px; }
.rule-account b { font-size: 10px; }
.rule-account small { color: var(--ink-3); font-size: 9px; }
.rule-source { color: var(--ink-3); font-size: 9px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(9,20,33,.63); display: grid; place-items: center; padding: 25px; animation: fade .18s ease both; backdrop-filter: blur(4px); }
.modal { width: min(690px, 100%); max-height: min(900px, calc(100vh - 50px)); overflow: auto; background: var(--paper-2); box-shadow: 0 30px 80px rgba(4,12,22,.35); animation: modalEnter .24s ease both; }
.modal.modal-wide { width: min(960px, 100%); }
.modal-header { position: sticky; top: 0; z-index: 2; min-height: 68px; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; color: white; background: var(--ink); }
.modal-header h2 { margin: 0; font-family: var(--font-display); font-size: 19px; }
.modal-header p { margin: 4px 0 0; color: #9eafbf; font-size: 9px; }
.modal-close { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: white; cursor: pointer; }
.modal-body { padding: 21px; }
.modal-footer { position: sticky; bottom: 0; padding: 14px 20px; display: flex; justify-content: flex-end; gap: 8px; background: rgba(250,248,243,.95); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
.form-grid .span-2 { grid-column: span 2; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.permission-toggle { position: relative; min-height: 74px; padding: 12px 12px 11px 39px; border: 1px solid var(--line); background: var(--white); cursor: pointer; transition: border-color .15s, background .15s; }
.permission-toggle:hover { border-color: #bdb6aa; }
.permission-toggle:has(input:checked) { border-color: var(--sage); background: #f3f8f5; box-shadow: inset 3px 0 0 var(--sage); }
.permission-toggle input { position: absolute; left: 13px; top: 14px; width: 15px; height: 15px; accent-color: var(--sage); }
.permission-toggle input:disabled { opacity: .65; }
.permission-toggle b { display: block; margin-bottom: 5px; font-size: 10px; }
.permission-toggle small { display: block; color: var(--ink-3); font-size: 8px; line-height: 1.45; }
.form-section { margin: 10px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 15px; }
.expense-lines { display: grid; gap: 10px; margin-bottom: 14px; }
.expense-line { padding: 0 12px 12px; border: 1px solid var(--line); background: var(--white); }
.expense-line-head { min-height: 37px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ebe7df; }
.expense-line-head > span { color: var(--ink-3); font-family: var(--font-number); font-size: 9px; letter-spacing: .05em; }
.expense-line-fields { display: grid; grid-template-columns: 108px 142px minmax(125px, 1fr) 148px 92px 176px; gap: 7px; padding: 11px 0 2px; align-items: end; }
.expense-field { min-width: 0; color: var(--ink-3); font-size: 9px; }
.expense-field > span { display: block; margin: 0 0 5px 1px; }
.expense-field input, .expense-field select { width: 100%; min-width: 0; border: 1px solid #ddd8ce; padding: 9px; background: #fffefa; color: var(--ink); font-size: 10px; }
.remove-line { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 9px; }
.expense-item-attachment { min-width: 0; min-height: 37px; padding: 3px 5px; display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; gap: 6px; align-items: center; border: 1px dashed #c5bfb5; background: #f8f6f1; cursor: pointer; transition: border-color .16s, background .16s; }
.expense-item-attachment:hover { border-color: var(--accent); background: #fff9f5; }
.expense-item-attachment input { display: none; }
.expense-ticket-mark { width: 28px; height: 28px; display: grid; place-items: center; color: white; background: var(--sage); font-family: var(--font-display); font-size: 8px; }
.expense-item-attachment b { display: block; margin-bottom: 2px; font-size: 9px; }
.expense-item-attachment small { display: block; max-width: 86px; overflow: hidden; color: var(--ink-3); font-size: 7px; white-space: nowrap; text-overflow: ellipsis; }
.expense-item-attachment em { padding: 4px 5px; color: var(--accent); border: 1px solid #e3b7ad; background: white; font-size: 7px; font-style: normal; }
.expense-form-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.expense-form-footer .form-total { min-width: 230px; }
.reimbursement-note { margin-top: 8px; }
.revision-notice { margin-bottom: 14px; padding: 12px 14px; display: grid; gap: 4px; border-left: 3px solid var(--accent); background: #fff4ef; }
.revision-notice b { color: var(--accent-dark); font-size: 11px; }
.revision-notice span { color: var(--ink-3); font-size: 9px; line-height: 1.55; }
.invoice-risk-panel, .invoice-block-panel { margin: 12px 0; padding: 13px 15px; border-left: 4px solid #bd7a16; background: #fff4d8; color: #5f4516; }
.invoice-block-panel { border-left-color: var(--danger); background: #fff0ed; color: #752d25; }
.invoice-risk-panel strong, .invoice-block-panel strong { display: block; margin-bottom: 5px; font-family: var(--font-display); font-size: 12px; }
.invoice-risk-panel p { margin: 0 0 7px; font-size: 9px; line-height: 1.55; }
.invoice-risk-panel ul, .invoice-block-panel ul { margin: 0; padding-left: 18px; font-size: 9px; line-height: 1.65; }
.reimbursement-note textarea:read-only { border-color: #d49c3d; background: #fff8e8; color: #6f511c; }
.claim-supplement { margin: 12px 0 2px; padding: 12px 14px; border-left: 3px solid #bd7a16; background: #fff8e8; }
.claim-supplement b { display: block; margin-bottom: 5px; font-size: 10px; }
.claim-supplement p { margin: 0; white-space: pre-wrap; color: var(--ink-3); font-size: 9px; line-height: 1.65; }
.form-total { display: flex; justify-content: space-between; align-items: center; padding: 11px 13px; background: var(--ink); color: white; }
.form-total span { color: #aeb9c4; font-size: 10px; }
.form-total strong { font-family: var(--font-number); font-size: 19px; }
.attachment-zone { border: 1px dashed #b8b4ac; background: rgba(255,255,255,.5); padding: 18px; text-align: center; cursor: pointer; color: var(--ink-3); font-size: 11px; }
.attachment-zone input { display: none; }
.item-ticket-list { display: grid; gap: 4px; min-width: 150px; }
.item-ticket-list span { display: flex; justify-content: space-between; gap: 8px; padding: 5px 6px; color: var(--ink); background: #edf2ef; border-left: 2px solid var(--sage); font-size: 9px; }
.item-ticket-list small { color: var(--ink-3); font-family: var(--font-number); white-space: nowrap; }
.item-ticket-list em { color: var(--ink-3); font-size: 9px; font-style: normal; }
.legacy-attachments { margin: 9px 0 0; padding: 9px 11px; color: var(--ink-3); background: #f0ede6; font-size: 9px; }

.import-kind-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; margin-bottom: 18px; }
.import-kind { position: relative; min-height: 94px; padding: 14px; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); background: var(--white); cursor: pointer; transition: border-color .16s, box-shadow .16s, transform .16s; }
.import-kind:hover { transform: translateY(-1px); border-color: #bdb7ad; }
.import-kind:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fffaf7; }
.import-kind input { position: absolute; opacity: 0; pointer-events: none; }
.import-kind > span { width: 27px; height: 27px; display: grid; place-items: center; color: white; background: var(--ink); font-family: var(--font-number); font-size: 9px; }
.import-kind:has(input:checked) > span { background: var(--accent); }
.import-kind b { display: block; margin: 2px 0 6px; font-size: 11px; }
.import-kind p { margin: 0; color: var(--ink-3); font-size: 9px; line-height: 1.55; }
.import-template-panel { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-bottom: 14px; padding: 13px 14px; border: 1px solid #cbd9d4; background: #edf3f0; }
.import-template-mark { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--sage); font-family: var(--font-number); font-size: 9px; font-weight: 700; letter-spacing: .06em; }
.import-template-panel b { display: block; font-size: 11px; }
.import-template-panel p { margin: 4px 0 0; color: var(--ink-3); font-size: 9px; line-height: 1.5; }
.import-template-download { text-decoration: none; white-space: nowrap; }
.import-claim-meta { padding: 15px 16px 5px; margin-bottom: 14px; background: #f0ede6; border: 1px solid var(--line); }
.import-drop { min-height: 84px; padding: 16px 18px; display: flex; gap: 14px; align-items: center; border: 1px dashed #aaa59c; background: rgba(255,255,255,.58); cursor: pointer; }
.import-drop:hover { border-color: var(--accent); background: #fffaf7; }
.import-drop input { display: none; }
.import-drop-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; color: white; background: var(--sage); font-family: var(--font-number); font-size: 10px; }
.import-drop b { display: block; margin-bottom: 4px; font-size: 12px; }
.import-drop p, .selected-file { margin: 0; color: var(--ink-3); font-size: 9px; }
.selected-file { padding: 8px 2px 2px; }
.import-result-head { margin: 18px 0 9px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: white; background: var(--ink); }
.import-result-head span { color: #aeb9c4; font-size: 9px; }
.import-result-head b { display: block; margin-top: 3px; font-family: var(--font-number); font-size: 15px; }
.import-counts { display: flex; gap: 6px; }
.import-counts span, .import-row-status { display: inline-flex; padding: 4px 7px; border-radius: 2px; font-size: 8px; font-weight: 700; white-space: nowrap; }
.import-counts .import-ready, .import-row-status.ready { color: #d8f0e9; background: #376d5f; }
.import-counts .import-warning, .import-row-status.warning { color: #ffedb7; background: #80631e; }
.import-counts .import-error, .import-row-status.error { color: #ffe0db; background: var(--danger); }
.import-preview-table .table-scroll { max-height: 365px; }
.import-preview-table .data-table { min-width: 930px; }
.issue-text { display: block; max-width: 190px; margin-top: 5px; color: var(--ink-3); font-size: 8px; line-height: 1.35; white-space: normal; }

.claim-detail-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.claim-detail-head h3 { margin: 4px 0 8px; font-family: var(--font-display); font-size: 24px; }
.claim-detail-head p { margin: 0; color: var(--ink-3); font-size: 11px; }
.claim-detail-total { text-align: right; }
.claim-detail-total small { color: var(--ink-3); font-size: 9px; }
.claim-detail-total strong { display: block; margin-top: 5px; font-family: var(--font-number); font-size: 28px; }
.timeline { margin-top: 20px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 80px 14px 1fr; gap: 10px; min-height: 56px; }
.timeline-item time { color: var(--ink-3); font-family: var(--font-number); font-size: 9px; }
.timeline-item i { width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; background: var(--accent); position: relative; }
.timeline-item:not(:last-child) i::after { content: ""; position: absolute; left: 3px; top: 9px; width: 1px; height: 43px; background: var(--line-dark); }
.timeline-item b { display: block; font-size: 11px; }
.timeline-item p { margin: 4px 0 0; color: var(--ink-3); font-size: 10px; }

.empty-state { min-height: 250px; display: grid; place-items: center; text-align: center; padding: 35px; color: var(--ink-3); }
.empty-state b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 19px; margin-bottom: 7px; }
.empty-state span { font-size: 11px; }
.loading-state { display: grid; place-items: center; min-height: 300px; color: var(--ink-3); font-size: 12px; }
.loading-state::before { content: ""; width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 10px; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 400px; padding: 13px 15px; color: white; background: var(--ink); border-left: 4px solid var(--sage); box-shadow: var(--shadow); animation: toastEnter .25s ease both; font-size: 11px; }
.toast.error { border-left-color: var(--accent); }
.toast b { display: block; margin-bottom: 3px; }
.toast span { color: #b8c4cf; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalEnter { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastEnter { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-summary { grid-template-columns: repeat(2, 1fr); }
  .invoice-summary { grid-template-columns: repeat(2, 1fr); }
  .admin-summary { grid-template-columns: repeat(3, 1fr); }
  .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .login-view { padding: 18px; }
  .login-panel { padding: 32px 22px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -250px; width: 236px; transition: left .22s; box-shadow: 20px 0 50px rgba(7,16,28,.25); }
  .sidebar.is-open { left: 0; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding-inline: 18px; }
  .app-content { padding: 20px 18px 45px; }
  .search-box { display: none; }
  .claim-board { grid-template-columns: 1fr; }
  .claim-export-toolbar { align-items: stretch; }
  .claim-export-actions { margin-left: auto; }
  .claim-filters { display: flex; overflow-x: auto; gap: 15px; padding: 11px 14px; }
  .claim-filters h3 { display: none; }
  .claim-filter { width: auto; flex: 0 0 auto; gap: 7px; border: 0; }
  .recon-board { grid-template-columns: 1fr; gap: 10px; }
  .recon-link { min-height: 45px; }
  .recon-link span { transform: rotate(90deg); }
  .expense-line-fields { grid-template-columns: 1fr 1fr; }
  .expense-description { grid-column: span 2; }
}

@media (max-width: 640px) {
  .kpi-grid, .recon-summary, .report-summary, .invoice-summary, .admin-summary, .import-kind-grid, .permission-grid, .ledger-permission-grid { grid-template-columns: 1fr; }
  .import-template-panel { grid-template-columns: 40px 1fr; }
  .import-template-download { grid-column: 1 / -1; width: 100%; }
  .kpi-card { min-height: 125px; }
  .topbar-actions { margin-left: auto; }
  .topbar h1 { font-size: 21px; }
  .data-toolbar { align-items: stretch; flex-direction: column; }
  .segmented { overflow-x: auto; }
  .segmented button { flex: 0 0 auto; }
  .toolbar-actions { justify-content: flex-end; }
  .performance-chart { gap: 6px; padding-inline: 12px; }
  .voucher-header { grid-template-columns: 1fr auto; gap: 6px; }
  .voucher-header > *:nth-child(2), .voucher-header > *:nth-child(3) { grid-column: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .expense-line-fields { grid-template-columns: 1fr; }
  .expense-description { grid-column: span 1; }
  .expense-form-footer { align-items: stretch; flex-direction: column; gap: 10px; }
  .expense-form-footer .form-total { width: 100%; min-width: 0; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; }
  .invoice-toolbar .toolbar-actions { width: 100%; }
  .claim-query-fields, .claim-export-actions { width: 100%; }
  .claim-filter-field { flex-basis: 100%; }
  .claim-export-actions { justify-content: space-between; margin-left: 0; }
  .filter-input { min-width: 0; width: 100%; }
  .ledger-set-card dl { grid-template-columns: repeat(2, 1fr); }
}
