:root {
  --navy: #0D2B55; --sky: #52C5DB; --orange: #F06522;
  --bg: #F7F8FA; --surface: #FFFFFF; --text: #0D1B2E; --muted: #5B6576; --line: #E6E9EF;
  --primary: var(--navy); --on-primary: #FFFFFF; --soft: #EEF6F9; --warn-bg: #FFF2EA; --warn: #B4440F;
  --radius: 10px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0A1220; --surface: #111B2C; --text: #E8EDF5; --muted: #93A0B4; --line: #223049;
  --primary: var(--sky); --on-primary: #08182F; --soft: #152338; --warn-bg: #2A1A12; --warn: #F79A68;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: inherit; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }

/* header */
header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
[data-theme="dark"] .brand .mark { background: #fff; }
.brand img { width: 26px; height: auto; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
nav { display: flex; gap: 4px; height: 100%; }
nav a { display: flex; align-items: center; padding: 0 12px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text); }
nav a.on { color: var(--text); border-bottom-color: var(--orange); }
.spacer { flex: 1; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--soft); }
.theme-dark, [data-theme="dark"] .theme-light { display: none; }
[data-theme="dark"] .theme-dark { display: block; }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.head p { margin: 2px 0 0; color: var(--muted); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, input[type=search], input[type=file] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; height: 36px; padding: 0 10px; }
input[type=file] { padding: 6px 10px; height: auto; }
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.nav-short { display: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.btn svg { width: 15px; height: 15px; }

/* cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; }
a.kpi:hover { border-color: var(--muted); }
a.kpi.on { border-color: var(--orange); box-shadow: inset 3px 0 0 var(--orange); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; }
tbody tr:hover { background: var(--soft); }
tfoot td { font-weight: 700; border-bottom: 0; }
td code { font-size: 12px; background: var(--soft); padding: 2px 6px; border-radius: 5px; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.new { background: rgba(82,197,219,.18); color: var(--text); }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--orange); background: var(--surface); border-radius: 8px; padding: 12px 14px; margin-bottom: 18px; }
.notice.ok { border-left-color: var(--sky); }
.rates { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; }
.rates b { color: var(--text); font-weight: 600; }
.empty { text-align: center; padding: 56px 16px; }
.empty img { width: 64px; opacity: .9; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) {
  .bar { gap: 12px; padding: 0 14px; } .brand span { display: none; }
  nav a { padding: 0 8px; font-size: 13px; } .nav-long { display: none; } .nav-short { display: inline; } main { padding: 20px 14px 48px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* sign in */
.login { max-width: 380px; padding-top: 10vh; }
.login .brand { margin-bottom: 18px; }
.login h1 { margin: 0; font-size: 20px; }
.login .card-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
.login input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; height: 38px; padding: 0 10px; }
.login input:focus { outline: 2px solid var(--sky); outline-offset: -1px; }
.login .btn { justify-content: center; height: 40px; margin-top: 4px; }
.login .notice { margin: 0; }

/* reconciliation: collapsible lists */
.rec-more { border-top: 1px solid var(--line); }
.rec-more summary { padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--muted); }
.rec-more summary:hover { color: var(--text); }
.rec-more[open] summary { border-bottom: 1px solid var(--line); }
