:root {
  color-scheme: light;
  --canvas: #f7f8f6;
  --surface: #ffffff;
  --ink: #1d2725;
  --muted: #71807a;
  --line: #dce5df;
  --accent: #176b59;
  --accent-strong: #0e5244;
  --accent-soft: #e5f1eb;
  --warm: #e8b56a;
  --danger: #a7443e;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(100%, 720px); margin: 0 auto; padding: 24px 18px 48px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 10px 2px 26px; }
.topbar h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 7vw, 40px); letter-spacing: -0.04em; line-height: 1.05; font-weight: 760; }
h2 { font-size: 22px; letter-spacing: -0.025em; line-height: 1.1; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: .16em; font-weight: 800; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; margin-top: 9px; }
.status-dot { display: block; width: 11px; height: 11px; margin-top: 8px; border-radius: 99px; background: var(--warm); box-shadow: 0 0 0 5px rgba(232,181,106,.17); }
.status-dot.is-ready { background: #32a277; box-shadow: 0 0 0 5px rgba(50,162,119,.16); }
.status-dot.is-error { background: var(--danger); box-shadow: 0 0 0 5px rgba(167,68,62,.14); }

.notice { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; }
.notice.is-error { border-color: #e9b8b2; color: var(--danger); background: #fff9f8; }
.notice.is-success { border-color: #b9dfca; color: var(--accent-strong); background: #f4fbf6; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border: 1px solid var(--line); background: #edf2ef; border-radius: 14px; margin-bottom: 26px; }
.tab { border: 0; border-radius: 10px; padding: 10px; color: var(--muted); background: transparent; font-weight: 700; font-size: 13px; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(25, 46, 38, .08); }
.view[hidden] { display: none; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.section-heading.compact { align-items: flex-start; margin-bottom: 8px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.date-chip { color: var(--accent-strong); font-size: 12px; font-weight: 700; background: var(--accent-soft); border-radius: 999px; padding: 7px 10px; white-space: nowrap; }
.date-control { width: 142px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 9px 10px; font-size: 12px; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field span, .check-row { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); outline: none; padding: 12px 13px; transition: border-color .18s, box-shadow .18s; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(23,107,89,.12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-strip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; border-radius: 14px; background: var(--accent-soft); padding: 14px; }
.calc-strip span { color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.calc-strip strong { color: var(--accent-strong); font-variant-numeric: tabular-nums; font-size: 22px; letter-spacing: -.03em; }
.calc-strip small { grid-column: 1 / -1; color: #5d8b7b; font-size: 11px; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { accent-color: var(--accent); width: 16px; height: 16px; }
.primary-button, .secondary-button { border: 0; border-radius: 12px; padding: 13px 16px; font-size: 13px; font-weight: 800; transition: transform .15s, background .15s; }
.primary-button { background: var(--accent); color: white; box-shadow: 0 6px 16px rgba(23,107,89,.18); }
.primary-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
.secondary-button { width: 100%; margin-top: 18px; color: var(--accent-strong); background: var(--accent-soft); }
.secondary-button.compact-button { width: auto; margin-top: 0; padding: 9px 11px; }
.secondary-button:hover { background: #d8eae1; }

.report-list { display: grid; gap: 10px; }
.report-row { display: grid; gap: 11px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 15px; }
.report-main { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.report-name { font-weight: 750; font-size: 15px; }
.report-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.report-amount { color: var(--accent-strong); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.row-action { border: 0; padding: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 800; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; padding: 38px 18px; font-size: 13px; }
.summary-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; }
.summary-title { font-size: 17px; font-weight: 800; margin-bottom: 15px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.summary-stat { border-radius: 12px; background: #f1f5f2; padding: 12px; }
.summary-stat span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.summary-stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.summary-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.summary-section h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.summary-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13px; }
.summary-line span:last-child { color: var(--accent-strong); font-weight: 750; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 25px; line-height: 1; padding: 0; }
.edit-dialog { width: min(100% - 28px, 520px); border: 0; border-radius: 20px; padding: 20px; background: var(--canvas); color: var(--ink); box-shadow: 0 20px 60px rgba(18, 42, 32, .22); }
.edit-dialog::backdrop { background: rgba(20, 38, 31, .36); }
.history-list { display: grid; gap: 9px; }
.history-item { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px; }
.history-item strong { font-size: 13px; }
.history-item span, .history-item small { color: var(--muted); font-size: 12px; }

@media (max-width: 440px) {
  .shell { padding: 18px 14px 36px; }
  .field-row { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .date-control { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .date-control { flex: 1; }
}

.tabs { display:flex; overflow-x:auto; scrollbar-width:thin; }
.tab { flex:0 0 auto; min-width:62px; white-space:nowrap; }
button:disabled { opacity:.45; cursor:default; transform:none; }
.write-status { padding:10px 14px; margin-bottom:14px; color:var(--accent-strong); background:var(--accent-soft); border-radius:12px; font-size:12px; }
.field select { width:100%; padding:12px 13px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); font:inherit; }
.panel { border:1px solid var(--line); border-radius:var(--radius); padding:16px; margin-top:18px; background:var(--surface); }
.module-list { margin-top:18px; }
.panel h3 { margin:0; font-size:15px; }
.preview-table { width:100%; border-collapse:collapse; font-size:12px; margin-top:12px; }
.preview-table td,.preview-table th { padding:8px 5px; border-bottom:1px solid var(--line); text-align:left; overflow-wrap:anywhere; }
.table-scroll { overflow:auto; }
.raw-text { white-space:pre-wrap; font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.action-row { display:flex; flex-wrap:wrap; gap:12px; }
[hidden] { display:none !important; }
body[data-entry="settlement"] { --accent:#315eab; --accent-strong:#244777; --accent-soft:#eaf0fc; }
body[data-entry="finance"] { --accent:#976427; --accent-strong:#765025; --accent-soft:#faf0df; }
#workspace-description { max-width:38rem; line-height:1.6; }
.entry-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:20px; }
.entry-action { display:flex; flex-direction:column; align-items:flex-start; gap:7px; padding:18px; min-height:104px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink); text-align:left; }
.entry-action strong { font-size:16px; }
.entry-action span { font-size:12px; line-height:1.5; color:var(--muted); }
.entry-action.is-primary { background:var(--accent); color:white; border-color:var(--accent); }
.entry-action.is-primary span { color:#fff; opacity:.85; }
.entry-boundary { padding:14px; border-left:3px solid var(--accent); background:var(--accent-soft); border-radius:0 10px 10px 0; line-height:1.7; }
.query-result { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:13px; line-height:1.8; margin:8px 0 0; }
.danger-button { color:var(--danger); }
