:root {
  --bg: #f2ede3;
  --bg-strong: #e6dcc9;
  --surface: rgba(255, 252, 246, 0.86);
  --surface-strong: #fffaf0;
  --surface-muted: rgba(97, 75, 49, 0.08);
  --text: #2f2418;
  --muted: #685746;
  --line: rgba(74, 55, 34, 0.14);
  --brand: #c9672b;
  --brand-strong: #9d4c1b;
  --accent: #1a7c6f;
  --danger: #b4432a;
  --warn: #946200;
  --shadow: 0 18px 42px rgba(82, 54, 22, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(201, 103, 43, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(26, 124, 111, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f2e8 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 22px;
  background: rgba(255, 247, 235, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.02em;
}

.brand-note,
.section-copy,
.empty-copy,
.helper,
.field-hint,
.small-text {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.nav-link {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(201, 103, 43, 0.12);
  transform: translateX(2px);
}

.sidebar-footer {
  margin-top: 28px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
}

.content {
  padding: 28px;
}

.hero,
.panel,
.metric-card,
.table-wrap,
.detail-card,
.filters,
.login-card,
.toolbar,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 24px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -46% auto;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(201, 103, 43, 0.14), transparent 66%);
}

.hero h1,
.login-card h1,
.panel-title,
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
}

.hero h1,
.login-card h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
  max-width: 10ch;
}

.hero p,
.login-card p {
  max-width: 58ch;
  color: var(--muted);
}

.hero-actions,
.page-actions,
.inline-actions,
.tag-list,
.stats-grid,
.detail-grid,
.field-row,
.filters-grid,
.two-column,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stats-grid {
  margin-top: 18px;
}

.metric-card,
.detail-card {
  padding: 18px;
  min-width: 170px;
  flex: 1 1 180px;
}

.metric-label,
.detail-label,
.badge-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-value,
.detail-value {
  margin-top: 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.layout-grid {
  display: grid;
  gap: 24px;
}

.layout-grid.split {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.8rem;
}

.section-copy {
  margin: 6px 0 0;
}

.button,
.button-ghost,
.button-danger,
.button-inline {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

.button {
  background: var(--brand);
  color: #fff9f2;
}

.button:hover,
.button-ghost:hover,
.button-danger:hover,
.button-inline:hover {
  transform: translateY(-1px);
}

.button[disabled],
.button-ghost[disabled],
.button-danger[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button-ghost,
.button-inline {
  background: rgba(201, 103, 43, 0.1);
  color: var(--brand-strong);
}

.button-danger {
  background: rgba(180, 67, 42, 0.12);
  color: var(--danger);
}

.button-inline {
  padding: 7px 10px;
}

.filters,
.toolbar {
  padding: 18px;
  margin-bottom: 18px;
}

.filters-grid {
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1 1 180px;
}

.field label {
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: rgba(201, 103, 43, 0.05);
}

tbody tr.is-active {
  background: rgba(26, 124, 111, 0.09);
}

.status-badge,
.tag-chip,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.status-badge {
  background: rgba(97, 75, 49, 0.1);
  color: var(--text);
}

.status-preview_ready {
  background: rgba(26, 124, 111, 0.14);
  color: var(--accent);
}

.status-completed,
.status-completed_with_rejections {
  background: rgba(74, 130, 58, 0.14);
  color: #2f6b1f;
}

.status-failed {
  background: rgba(180, 67, 42, 0.12);
  color: var(--danger);
}

.status-received {
  background: rgba(148, 98, 0, 0.12);
  color: var(--warn);
}

.chip,
.tag-chip {
  background: rgba(97, 75, 49, 0.08);
}

.tag-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.amount.inflow {
  color: var(--accent);
  font-weight: 700;
}

.amount.outflow {
  color: var(--danger);
  font-weight: 700;
}

.banner,
.error-banner,
.success-banner {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.banner {
  background: rgba(97, 75, 49, 0.08);
}

.error-banner {
  background: rgba(180, 67, 42, 0.12);
  color: var(--danger);
}

.success-banner {
  background: rgba(26, 124, 111, 0.12);
  color: var(--accent);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(720px, 100%);
  padding: 28px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--brand-strong);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.84rem;
  font-weight: 700;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.mono {
  font-family: "SFMono-Regular", Menlo, monospace;
}

.link-button {
  color: var(--brand-strong);
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.list-clean {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .layout-grid.split {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px;
  }
}
