:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #68736d;
  --line: #dce3de;
  --canvas: #f3f6f3;
  --paper: #ffffff;
  --green: #176b45;
  --green-soft: #e2f3e9;
  --amber: #a45d00;
  --amber-soft: #fff0d8;
  --kshop: #138550;
  --maemanee: #7356b8;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
a { color: inherit; }
button, input, select { font: inherit; }
button, .button { transition: transform .12s ease, border-color .12s ease, background .12s ease; }
button:active, .button:active { transform: translateY(1px); }
.topbar { height: 68px; padding: 0 28px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 34px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 760; text-decoration: none; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: white; background: linear-gradient(140deg, #217c52, #0b4e32); font-size: 25px; box-shadow: 0 10px 24px rgba(17,95,59,.2); }
.brand-mark.small { width: 32px; height: 32px; border-radius: 10px; font-size: 17px; box-shadow: none; }
.nav-links { display: flex; align-self: stretch; align-items: center; gap: 6px; overflow-x: auto; }
.nav-links a { text-decoration: none; color: var(--muted); padding: 10px 12px; border-radius: 9px; font-weight: 650; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: #edf2ee; }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 11px; margin-left: 3px; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.user-menu form { margin: 0; }
.page-shell { max-width: 1440px; margin: 0 auto; padding: 40px 30px 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 2px 0 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--green) !important; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.source-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); padding-bottom: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; background: #9aa39e; }
.dot.kshop { background: var(--kshop); }
.dot.maemanee { background: var(--maemanee); }
.filter-bar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 32px rgba(36,61,47,.04); margin-bottom: 18px; }
.filter-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
input, select { min-width: 150px; height: 40px; padding: 0 11px; border: 1px solid var(--line); background: #fbfcfb; color: var(--ink); border-radius: 9px; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,69,.10); }
.button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 700; }
.button-primary { border-color: var(--green); background: var(--green); color: white; }
.button-primary:hover { background: #105c39; }
.button-quiet { background: transparent; }
.button-quiet:hover { border-color: #aeb8b1; background: #f7f9f7; }
.button-compact { min-height: 32px; padding: 0 11px; font-size: 12px; }
.button-wide { width: 100%; margin-top: 16px; }
.disabled { pointer-events: none; opacity: .4; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.stat-card { min-height: 142px; border: 1px solid var(--line); background: var(--paper); border-radius: 15px; padding: 20px; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(36,61,47,.04); position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: #dbe2dd; }
.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-warn::before { background: var(--amber); }
.stat-card > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; margin: auto 0 4px; }
.stat-card small { color: var(--muted); }
.stat-card small a { color: var(--amber); }
.two-column { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); background: var(--paper); border-radius: 15px; box-shadow: 0 8px 32px rgba(36,61,47,.04); padding: 20px; }
.panel-heading { min-height: 52px; display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 12px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.02em; }
.panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.split-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.compact-table { display: grid; }
.compact-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 14px; align-items: center; padding: 12px 0; border-top: 1px solid #edf0ed; }
.compact-row:first-child { border-top: 0; }
.compact-row strong { font-size: 16px; }
.compact-row small { color: var(--muted); grid-column: 1; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-heading { padding: 20px 20px 8px; }
.result-count { color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 16px; color: var(--muted); background: #f8faf8; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #edf0ed; white-space: nowrap; }
tbody tr:hover { background: #fafcfa; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.amount { color: var(--green); font-size: 16px; font-weight: 800; text-align: right; }
.source-pill, .status { display: inline-flex; align-items: center; width: fit-content; border: 1px solid var(--line); padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; background: white; }
.source-pill.kshop { color: var(--kshop); border-color: rgba(19,133,80,.25); background: rgba(19,133,80,.06); }
.source-pill.maemanee { color: var(--maemanee); border-color: rgba(115,86,184,.25); background: rgba(115,86,184,.06); }
.status.success { color: var(--green); background: var(--green-soft); border-color: transparent; }
.status.warning { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 20px; }
.empty-state { padding: 36px 14px; text-align: center; color: var(--muted); }
.small-empty { padding: 10px; }
.ledger-note { color: var(--muted); text-align: center; font-size: 11px; margin-top: 20px; }
.event-list { display: grid; gap: 14px; }
.event-card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 18px; box-shadow: 0 8px 32px rgba(36,61,47,.04); }
.event-card > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.event-card > header > div { display: flex; align-items: center; gap: 10px; }
.event-card dl { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 18px 0; }
.event-card dl div { min-width: 0; }
.event-card dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.event-card dd { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; }
details { border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; color: var(--green); font-weight: 700; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 10px; background: #f5f7f5; border: 1px solid var(--line); max-height: 360px; overflow: auto; }
.alert { padding: 10px 12px; border-radius: 9px; }
.alert-error { color: #922f26; background: #ffebe8; border: 1px solid #f2c7c1; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #dcece2 0, var(--canvas) 45%); }
.login-card { width: min(420px,100%); background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 24px; padding: 38px; text-align: center; box-shadow: 0 24px 80px rgba(27,67,43,.12); }
.login-card .brand-mark { margin: 0 auto 24px; }
.login-card h1 { margin: 5px 0 9px; font-size: 36px; letter-spacing: -.04em; }
.login-copy, .login-note { color: var(--muted); line-height: 1.6; }
.login-card .alert { margin: 18px 0 0; }
.login-form { display: grid; gap: 13px; margin-top: 24px; text-align: left; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.login-form input { width: 100%; min-width: 0; }
.login-form .button-wide { margin-top: 3px; }
.readonly-field { color: var(--muted); background: #eef2ef; cursor: not-allowed; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; color: var(--muted); font-size: 11px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.login-note { margin: 18px 0 0; font-size: 11px; }
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .two-column { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; gap: 12px; }
  .user-menu > span { display: none; }
}
@media (max-width: 620px) {
  .page-shell { padding: 24px 14px 60px; }
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .nav-links { order: 3; width: 100%; }
  .panel-heading { flex-wrap: wrap; }
  .panel-actions { width: 100%; justify-content: space-between; }
  .stat-grid, .split-panel { grid-template-columns: 1fr; }
  .filter-bar > label { width: calc(50% - 5px); }
  input, select { width: 100%; min-width: 0; }
  .event-card dl { grid-template-columns: 1fr 1fr; }
}
