:root {
  --bg: #f5f3ef;
  --paper: #ffffff;
  --paper-strong: #ffffff;
  --ink: #171a1f;
  --muted: #70757f;
  --line: #e6e8eb;
  --accent: #111827;
  --accent-soft: #f0f2f5;
  --navy: #111827;
  --good: #1f7a5a;
  --warn: #8b6b1b;
  --bad: #b33a2e;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
strong {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #fbfbfa;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav a:hover,
.nav a.active {
  background: var(--accent-soft);
  color: var(--ink);
}

.sidebar-panel {
  margin-top: 24px;
  padding: 18px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.panel-label,
.eyebrow,
label span,
th,
.muted {
  color: var(--muted);
}

.panel-label,
.eyebrow {
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3vw, 3.25rem);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card,
.hero-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px;
}

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

.hero-card h2 {
  margin-bottom: 10px;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.hero-meta {
  min-width: 260px;
  padding: 18px;
  border-radius: 22px;
  background: #f7f8fa;
  color: var(--ink);
  border: 1px solid var(--line);
}

.meta-line {
  display: block;
  margin-bottom: 8px;
}

.stats-grid,
.dashboard-grid,
.split-grid,
.detail-grid,
.help-grid {
  display: grid;
  gap: 20px;
}

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

.dashboard-grid,
.split-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 20px;
}

.detail-grid {
  grid-template-columns: 1.4fr 1fr;
  margin-bottom: 20px;
}

.help-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 20px;
}

.stat-card span {
  display: block;
  margin-bottom: 10px;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.7rem;
}

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

.section-head h2 {
  margin-bottom: 0;
}

.mini-list,
.decision-list {
  display: grid;
  gap: 12px;
}

.mini-row,
.decision-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: #fbfbfb;
  border: 1px solid var(--line);
}

.mini-row.block {
  display: block;
}

.mini-row p,
.decision-item p,
.card p {
  margin-bottom: 0;
}

.mini-metrics {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.decision-topline,
.decision-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.decision-item {
  flex-direction: column;
}

.decision-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.compact .decision-item {
  padding: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  text-transform: capitalize;
  background: #f3f4f6;
}

.badge.light {
  background: #f8f9fb;
}

.badge.dark {
  background: var(--navy);
  color: #fff;
}

.badge.good,
.good {
  color: var(--good);
}

.badge.bad,
.bad {
  color: var(--bad);
}

.badge.active {
  background: rgba(47, 120, 88, 0.12);
  color: var(--good);
}

.badge.paused,
.badge.defend {
  background: rgba(183, 131, 37, 0.16);
  color: #8d661e;
}

.badge.archived,
.badge.cut {
  background: rgba(166, 70, 49, 0.12);
  color: var(--bad);
}

.badge.scale {
  background: rgba(47, 120, 88, 0.14);
  color: var(--good);
}

.badge.explore,
.badge.draft {
  background: rgba(38, 53, 69, 0.1);
  color: var(--navy);
}

.filters,
.form-grid,
.metric-grid {
  display: grid;
  gap: 16px;
}

.filters {
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(90px, 1fr)) auto;
  align-items: end;
}

.grow {
  min-width: 0;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-grid div {
  padding: 14px;
  border-radius: 18px;
  background: #fbfbfb;
  border: 1px solid var(--line);
}

.metric-grid span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.9rem;
  color: var(--muted);
}

.metric-grid strong {
  font-size: 1.1rem;
}

.full {
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-strong);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.filter-card,
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.empty {
  padding: 14px 0;
  color: var(--muted);
  text-align: center;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.flash.success {
  background: rgba(47, 120, 88, 0.1);
  color: #1d5d42;
}

.flash.error {
  background: rgba(166, 70, 49, 0.1);
  color: #7c2f22;
}

.asin-inline {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.asin-inline.large {
  gap: 16px;
}

.asin-thumb {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f4f5f7;
  flex: none;
}

.asin-thumb.large {
  width: 68px;
  height: 68px;
  border-radius: 18px;
}

.asin-thumb.tiny {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

.asin-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.asin-chip-list.stacked {
  margin-top: 8px;
}

.asin-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f9fafb;
  white-space: nowrap;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(221, 209, 194, 0.7);
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .main {
    padding: 18px;
  }

  .hero-card,
  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .mini-row {
    flex-direction: column;
  }

  .mini-metrics {
    justify-items: start;
    text-align: left;
  }
}
