:root {
  --ink: #23201c; --muted: #6f6457; --line: #e7ddcd; --bg: #fbf7f0; --card: #fff;
  --accent: #b4612b; --accent-dark: #8f4a1f; --good: #2f7d4f; --warn: #c9831f; --bad: #c0392b;
  --tint: #fff7ec; /* soft accent wash for highlighted surfaces */
  --radius: 12px; --maxw: 1100px;
  /* type scale */
  --fs-sm: 0.85rem; --fs-base: 1rem; --fs-lg: 1.2rem; --fs-xl: 1.6rem;
  /* spacing steps */
  --sp-1: 0.5rem; --sp-2: 0.75rem; --sp-3: 1rem; --sp-4: 1.5rem;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }

/* utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: var(--sp-3); }
.grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } }
aside { background: #2b261f; color: #f3ece0; padding: 1rem; }
.aside-top { display: flex; align-items: center; justify-content: space-between; }
aside .brand { font-weight: 800; font-size: 1.2rem; color: #fff; display: block; margin-bottom: 1rem; }
aside .brand span { color: var(--accent); }
.navtoggle { display: none; background: transparent; border: 0; color: #f3ece0; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0.25rem 0.4rem; }
aside nav a { display: block; color: #d8cdba; padding: 0.6rem 0.7rem; border-radius: 8px; margin-bottom: 0.2rem; }
aside nav a.active, aside nav a:hover { background: #3a342b; color: #fff; }
aside .plan-badge { margin-top: 1rem; font-size: 0.8rem; background: #3a342b; border-radius: 8px; padding: 0.5rem 0.7rem; }
aside .plan-badge a { color: #f3ece0; text-decoration: underline; }
main { padding: 1.5rem; max-width: var(--maxw); overflow-x: hidden; }
@media (max-width: 760px) {
  .shell { display: block; }
  main { padding: 1rem 0.75rem; }
  aside { padding: 0.55rem 0.9rem; }
  .aside-top { min-height: 40px; }
  aside .brand { margin: 0; font-size: 1.15rem; }
  .navtoggle { display: block; }
  aside nav { display: none; margin-top: 0.6rem; }
  .shell.nav-open aside nav { display: block; }
  aside nav a { padding: 0.7rem 0.6rem; font-size: 1rem; margin-bottom: 0; border-radius: 8px; }
  aside .plan-badge { display: none; }
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* buttons */
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 0.55rem 1rem; border-radius: 8px; font-weight: 600; border: 0; cursor: pointer; font-size: 0.95rem; }
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.sm { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* cards / tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
td input, td select { width: 100%; padding: 0.35rem; border: 1px solid var(--line); border-radius: 6px; font-size: 0.9rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 0.4rem; }

/* forms */
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.6rem 0 0.2rem; }
input, select, textarea { width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; background: #fff; font-family: inherit; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }

/* badges & alerts */
.badge { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; }
.badge.good { background: #e2f0e7; color: var(--good); }
.badge.bad { background: #f7e2df; color: var(--bad); }
.badge.warn { background: #f7eed9; color: var(--warn); }
.alert { background: #f7e2df; border: 1px solid #e9bcb4; color: #7a2218; padding: 0.85rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert.info { background: #f3ece0; border-color: var(--line); color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 2rem; }
.upgrade { background: var(--tint); border: 1px solid #f0d9b5; padding: 1rem; border-radius: 10px; margin-bottom: 1rem; }

/* logo upload */
.logo-field { display: flex; gap: var(--sp-3); align-items: flex-start; margin-top: 0.3rem; }
.logo-preview { width: 76px; height: 76px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; flex-shrink: 0; }
.logo-controls { flex: 1; min-width: 0; }
.logo-controls input[type=file] { font-size: var(--fs-sm); border: 0; padding: 0; background: transparent; }
.logo-controls input[type=url] { margin-top: 0.4rem; }

/* onboarding checklist */
.onboarding .ob-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.ob-step { display: flex; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: var(--sp-1); }
.ob-step.current { border-color: var(--accent); background: var(--tint); }
.ob-step.done { opacity: 0.65; }
.ob-step.done strong { text-decoration: line-through; }
.ob-check input { width: 22px; height: 22px; margin-top: 0.1rem; cursor: pointer; accent-color: var(--accent); }
.ob-body { flex: 1; }
.ob-desc { font-size: var(--fs-sm); margin-top: 0.15rem; }
.ob-reopen { margin-top: 0; }

/* auth */
.auth-wrap { max-width: 420px; margin: 4rem auto; padding: 0 1rem; }
.auth-wrap .card { padding: 2rem; }
.auth-wrap .brand { font-weight: 800; font-size: 1.5rem; display: block; text-align: center; margin-bottom: 1rem; color: var(--ink); }
.auth-wrap .brand span { color: var(--accent); }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tabs button { flex: 1; padding: 0.5rem; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* breakdown */
.breakdown { font-size: 0.85rem; color: var(--muted); }
.breakdown.narrow { max-width: 340px; }
.breakdown div { display: flex; justify-content: space-between; padding: 0.1rem 0; }
.breakdown .total { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); margin-top: 0.2rem; padding-top: 0.3rem; }
.tier-price { font-size: 1.4rem; font-weight: 800; margin: 0.3rem 0; }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #2b261f; color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 520px; width: 92%; }
dialog h2 { margin-top: 0; }
dialog::backdrop { background: rgba(0,0,0,0.4); }
.muted { color: var(--muted); }
.pill-tier { font-size: 0.7rem; text-transform: uppercase; color: var(--accent); letter-spacing: 0.05em; }
.cardrow { display: none; }
@media (max-width: 680px) {
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.6rem; padding: 0.5rem; }
  table.responsive td { display: flex; justify-content: space-between; border: 0; padding: 0.3rem 0.2rem; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; font-weight: 600; }
}
