:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f3ed;
  color: #18211f;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 18px clamp(14px, 4vw, 40px);
  background: #ffffff;
  border-bottom: 1px solid #ded7cb;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: 0; }
h2 { font-size: 18px; letter-spacing: 0; }
.eyebrow, small, .note, .empty { color: #655f55; font-size: 13px; }
.top-actions { display: flex; gap: 10px; align-items: center; }

.app-shell { padding: 18px clamp(14px, 4vw, 40px) 48px; display: grid; gap: 16px; }
.command-strip { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: end; }
.search { display: grid; gap: 6px; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfc7ba;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: #18211f;
}

button {
  min-height: 42px;
  border: 1px solid #cfc7ba;
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: #18211f;
  cursor: pointer;
}
.primary { background: #0f766e; border-color: #0f766e; color: #fff; font-weight: 800; }
.ghost { background: transparent; border-color: transparent; color: #0f766e; }
.icon-button { width: 40px; padding: 0; }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.tab, .chip {
  white-space: nowrap;
  min-height: 36px;
  border-color: #ded7cb;
}
.tab.active, .chip.active {
  background: #17211f;
  color: #fff;
  border-color: #17211f;
}

.banner {
  border: 1px solid #d97706;
  background: #fff7ed;
  color: #713f12;
  border-radius: 8px;
  padding: 10px 12px;
}
.banner.muted {
  border-color: #99c8c1;
  background: #ecfdf5;
  color: #14534b;
}

.view { display: none; }
.view.active { display: block; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 16px;
}
.wide { grid-column: 1 / -1; }
.panel {
  background: #fff;
  border: 1px solid #ded7cb;
  border-radius: 8px;
  padding: 16px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge, .status, .ok, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
}
.badge, .status { background: #f59e0b; color: #241500; }
.ok { background: #d1fae5; color: #065f46; }
.pill { background: #ebe7de; color: #3d3932; }

.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eee8dc;
  border-radius: 8px;
  background: #fbfaf7;
}
.row strong { overflow-wrap: anywhere; }
.row small { display: block; margin-top: 4px; }
.amount { font-weight: 900; white-space: nowrap; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }

.inline-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }

dialog { border: 0; border-radius: 8px; padding: 0; width: min(620px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(24, 33, 31, .5); }
.dialog-body { padding: 18px; display: grid; gap: 13px; }
fieldset { border: 1px solid #ded7cb; border-radius: 8px; padding: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { width: auto; min-height: auto; }
.split-editor { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
details > * + * { margin-top: 10px; }
.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 860px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .top-actions, .command-strip, .dashboard-grid, .inline-form { grid-template-columns: 1fr; display: grid; }
  .row { grid-template-columns: 1fr; }
  .card-actions { justify-content: start; }
}
