:root {
  color-scheme: light;
  --bg: #f1ecdf;
  --bg-alt: #e7dbc8;
  --surface: rgba(255, 252, 246, 0.86);
  --surface-strong: rgba(255, 252, 246, 0.98);
  --text: #23221f;
  --muted: #6f685f;
  --border: rgba(42, 34, 24, 0.12);
  --shadow: 0 28px 90px rgba(36, 26, 14, 0.12);
  --accent: #0f5e63;
  --accent-2: #9c5d2e;
  --accent-3: #1c7b53;
  --danger: #a63d4b;
  --warning: #a06a00;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 94, 99, 0.15), transparent 35%),
    radial-gradient(circle at top right, rgba(156, 93, 46, 0.15), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: var(--radius-xl);
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: end;
}

.eyebrow,
.section-label,
.metric-label,
.toolbar-meta,
.editor-status {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-2);
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.6rem, 5.8vw, 4.9rem);
  line-height: 0.95;
  max-width: 11ch;
}

.lede {
  margin: 18px 0 0;
  max-width: 66ch;
  font-size: 1.02rem;
  line-height: 1.62;
  color: var(--muted);
}

.hero-actions {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.button,
.row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover,
.row-button:hover,
.filter-pill:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0b3f43);
  box-shadow: 0 16px 30px rgba(15, 94, 99, 0.24);
}

.button.secondary,
.row-button,
.filter-pill,
.field input,
.search {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.button.ghost {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.microcopy,
.field span,
.summary-card,
.empty-state,
.value-muted {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.metric-value {
  margin: 10px 0 8px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
  font-weight: 700;
}

.metric-subtext {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.workspace {
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  padding: 22px;
  background: rgba(20, 25, 30, 0.04);
  border-right: 1px solid var(--border);
  display: grid;
  gap: 22px;
  align-content: start;
}

.side-stack {
  display: grid;
  gap: 12px;
}

.search {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  padding: 0 14px;
}

.filter-list {
  display: grid;
  gap: 10px;
}

.filter-pill {
  width: 100%;
  border-radius: 18px;
  padding: 12px 14px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.filter-pill strong {
  font-size: 0.95rem;
}

.filter-pill span,
.filter-pill small {
  font-size: 0.8rem;
  color: var(--muted);
}

.filter-pill.is-active {
  background: linear-gradient(135deg, rgba(15, 94, 99, 0.12), rgba(156, 93, 46, 0.12));
  border-color: rgba(15, 94, 99, 0.22);
}

.record-form {
  display: grid;
  gap: 14px;
}

.editor-status {
  margin-top: -4px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field--full {
  grid-column: 1 / -1;
}

.field input {
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
}

.form-actions,
.side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions {
  margin-top: 4px;
}

.panel {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.toolbar-meta {
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.16rem;
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
}

.table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  background: rgba(245, 240, 231, 0.98);
  border-bottom: 1px solid var(--border);
  padding: 14px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.table tbody td {
  border-bottom: 1px solid rgba(42, 34, 24, 0.08);
  padding: 12px 14px;
  vertical-align: top;
  font-size: 0.94rem;
}

.table tbody tr:hover {
  background: rgba(15, 94, 99, 0.045);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.row-button--subtle {
  background: rgba(15, 94, 99, 0.08);
}

.row-button--danger {
  color: var(--danger);
  background: rgba(166, 61, 75, 0.08);
  border-color: rgba(166, 61, 75, 0.2);
}

.badge,
.money {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 700;
}

.badge--ok {
  color: var(--accent-3);
  background: rgba(28, 123, 83, 0.12);
}

.badge--low {
  color: var(--warning);
  background: rgba(160, 106, 0, 0.12);
}

.badge--empty {
  color: var(--danger);
  background: rgba(166, 61, 75, 0.12);
}

.money--positive {
  color: var(--accent-3);
}

.money--negative {
  color: var(--danger);
}

.empty-state {
  padding: 26px;
  border-radius: 18px;
  border: 1px dashed rgba(42, 34, 24, 0.14);
  background: rgba(255, 255, 255, 0.58);
}

.backdrop {
  position: fixed;
  inset: auto;
  width: 44vw;
  height: 44vw;
  max-width: 640px;
  max-height: 640px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(24px);
  opacity: 0.7;
}

.backdrop-a {
  top: -18vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(15, 94, 99, 0.2), transparent 68%);
}

.backdrop-b {
  bottom: -18vw;
  left: -10vw;
  background: radial-gradient(circle, rgba(156, 93, 46, 0.18), transparent 68%);
}

@media (max-width: 1200px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .metrics,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .metrics,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel,
  .sidebar {
    padding: 18px;
  }

  .table {
    min-width: 880px;
  }
}
