:root {
  --bg: #f4efe6;
  --panel: #fffdf8;
  --panel-strong: #f2e2c4;
  --ink: #1e1e1e;
  --muted: #645e56;
  --line: #d9c8aa;
  --brand: #a84c1d;
  --brand-deep: #6d2f12;
  --success: #276749;
  --danger: #a61b1b;
  --shadow: 0 18px 40px rgba(79, 49, 22, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(168, 76, 29, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f1e4 0%, var(--bg) 100%);
  color: var(--ink);
}

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

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.hero,
.card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--brand);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  margin-bottom: 12px;
}

.hero-copy {
  max-width: 60ch;
  color: var(--muted);
}

.brand-logo {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
  margin-bottom: 14px;
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-actions a,
button {
  text-decoration: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.hero-actions .secondary,
.secondary {
  background: var(--panel-strong);
  color: var(--brand-deep);
}

button:hover,
.hero-actions a:hover {
  transform: translateY(-1px);
}

.stats-grid,
.panel-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 20px 0;
}

.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
}

.tab-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab {
  background: rgba(255, 253, 248, 0.85);
  color: var(--brand-deep);
  border: 1px solid var(--line);
}

.tab.active {
  background: var(--brand-deep);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-grid {
  grid-template-columns: minmax(280px, 360px) 1fr;
}

.panel-grid.single {
  grid-template-columns: 1fr;
}

.card {
  padding: 22px;
}

.form-card,
.callout-card {
  position: sticky;
  top: 20px;
  align-self: start;
}

.form-card label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.form-card input,
.form-card select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
}

.inline-check {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}

.inline-check input {
  width: auto;
  margin: 0;
}

.list-card {
  min-height: 420px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 16px;
}

.helper {
  color: var(--muted);
}

.stack-list {
  display: grid;
  gap: 12px;
}

.summary-stack {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.summary-chip {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: white;
}

.entity-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: white;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.entity-subtitle,
.entity-meta {
  color: var(--muted);
}

.entity-meta {
  font-size: 0.95rem;
}

.entity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.entity-actions button {
  padding: 10px 12px;
}

.entity-actions .danger {
  background: #fde9e7;
  color: var(--danger);
}

.entity-actions .success {
  background: #e5f6ec;
  color: var(--success);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, calc(100vw - 32px));
  background: #1f1f1f;
  color: white;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 920px) {
  .hero {
    flex-direction: column;
  }

  .panel-grid,
  .panel-grid.single {
    grid-template-columns: 1fr;
  }

  .form-card,
  .callout-card {
    position: static;
  }

  .entity-row {
    grid-template-columns: 1fr;
  }

  .entity-actions {
    justify-content: flex-start;
  }
}
