/* SHN Platform design system — current Shopify Polaris (2026) tokens.
   Values sourced from polaris-react.shopify.com/tokens/color.
   Shared tokens + components for the admin app; the public site mirrors these. */
:root {
  --shn-brand: #303030;         /* primary action / brand fill (color-bg-fill-brand) */
  --shn-brand-hover: #1a1a1a;   /* color-bg-fill-brand-hover/active */
  --ink: #303030;               /* color-text */
  --ink-subdued: #616161;       /* color-text-secondary */
  --interactive: #005bd3;       /* color-text-link / focus */
  --bg: #f1f1f1;                /* color-bg (page) */
  --surface: #ffffff;           /* color-bg-surface (card) */
  --border: #e3e3e3;            /* color-border */
  --border-secondary: #ebebeb;  /* color-border-secondary */
  --critical: #c70a24;          /* color-bg-fill-critical */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.08);
  --shadow-card: 0 0 0 1px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--interactive); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.muted { color: var(--ink-subdued); font-size: 13px; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.container { max-width: 1040px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--shn-brand); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--shn-brand-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: var(--shadow); }
.btn-secondary:hover { background: #fafafa; text-decoration: none; }

/* Forms (also styles allauth's default markup) */
label { display: block; font-weight: 500; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input:not([type]) {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
}
input:focus { outline: none; border-color: var(--interactive); box-shadow: 0 0 0 2px rgba(0,91,211,.25); }
button[type=submit], input[type=submit] {
  background: var(--shn-brand); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 16px; font-family: inherit;
  font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow);
}
button[type=submit]:hover, input[type=submit]:hover { background: var(--shn-brand-hover); }
.form-row { margin-bottom: 14px; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }

/* ============================================================
   App shell — authenticated area (left sidebar, Shopify-admin style)
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 14px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { font-weight: 600; font-size: 16px; letter-spacing: -.01em; padding: 6px 10px 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: #f6f6f6; text-decoration: none; }
.nav-item.is-active { background: #f1f1f1; color: var(--ink); }
.nav-item.is-active .nav-icon { color: var(--interactive); }
.nav-item.is-disabled { color: #9c9c9c; cursor: default; }
.nav-item.is-disabled:hover { background: transparent; }
.nav-item em { margin-left: auto; font-style: normal; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; color: #9c9c9c; border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
.nav-icon { flex-shrink: 0; color: var(--ink-subdued); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5;
}
.app-topbar-title { font-weight: 600; font-size: 15px; }
.app-content { padding: 24px 28px; max-width: 1180px; width: 100%; }

/* Analytics header: tabs + range picker */
.an-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.an-sub { margin: 6px 0 20px; }
.tabs { display: flex; gap: 4px; background: #eaeaea; padding: 3px; border-radius: var(--radius-sm); }
.tab { padding: 6px 14px; border-radius: 6px; font-weight: 500; font-size: 13px; color: var(--ink-subdued); }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.an-range select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}

/* KPI cards (overview) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 18px; color: var(--ink); display: block;
  transition: box-shadow .15s, border-color .15s;
}
.kpi-card:hover { text-decoration: none; border-color: #d0d0d0; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.kpi-card-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-seg { font-weight: 600; font-size: 14px; }
.kpi-hero { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 10px; }
.kpi-hero .cur { font-size: 14px; font-weight: 500; color: var(--ink-subdued); }
.kpi-hero-label { font-size: 12px; color: var(--ink-subdued); text-transform: uppercase; letter-spacing: .04em; }
.kpi-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 14px;
  border-top: 1px solid var(--border-secondary); padding-top: 12px; }
.kpi-mini > div { display: flex; justify-content: space-between; font-size: 13px; }
.kpi-mini span { color: var(--ink-subdued); }
.kpi-mini b { font-weight: 600; }

/* Deltas */
.delta { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 20px; }
.delta.up { color: #0a6b3b; background: #e3f3ea; }
.delta.down { color: var(--critical); background: #fde7ea; }
.delta.flat { color: var(--ink-subdued); background: #f1f1f1; }

/* Sparkline */
.spark { width: 100%; height: 42px; margin: 14px 0 2px; display: block; }
.spark-line { fill: none; stroke: var(--interactive); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(0,91,211,.08); stroke: none; }
.spark-dot { fill: var(--interactive); }

/* Single-segment detail */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 14px 16px; }
.stat span { display: block; font-size: 12px; color: var(--ink-subdued); text-transform: uppercase; letter-spacing: .04em; }
.stat b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; }
.stat .delta { display: inline-block; margin-top: 6px; }

.chart-card { margin-bottom: 16px; }
.chart-card h2 { margin-bottom: 14px; }
.chart { display: flex; gap: 10px; }
.chart svg { flex: 1; height: 240px; width: 100%; }
.chart-line { fill: none; stroke: var(--interactive); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-area { fill: rgba(0,91,211,.07); stroke: none; }
.grid { stroke: var(--border-secondary); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-yaxis { display: flex; flex-direction: column; justify-content: space-between; width: 46px;
  font-size: 11px; color: var(--ink-subdued); text-align: right; padding: 4px 0; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-subdued); padding: 8px 10px;
  border-bottom: 1px solid var(--border); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border-secondary); }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .sidebar { width: 60px; }
  .sidebar-brand, .nav-item span, .nav-item em { display: none; }
  .nav-item { justify-content: center; }
}
