/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN RESTAURANTER (A2) — Customer Success Tracker
   prefix: .ar-*
   inspiration: Bloomberg Terminal customer-list × NYT data-visualization
   Aesthetic: Editorial Mission Control (matches A1 family)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ar-editorial: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ar-grid-tone: rgba(14, 14, 12, 0.04);
  /* Health-score gradient — locked tokens for consistent rendering */
  --ar-health-bad:   #D03B1A;  /* score 0-29   */
  --ar-health-warn:  #E8941C;  /* score 30-49  */
  --ar-health-ok:    #C5BE12;  /* score 50-79  */
  --ar-health-good:  #4A8F2A;  /* score 80-100 */
}

:root[data-theme="dark"] {
  --ar-grid-tone: rgba(250, 250, 247, 0.04);
  --ar-health-bad:   #E5563A;
  --ar-health-warn:  #F2A848;
  --ar-health-ok:    #DCD645;
  --ar-health-good:  #6BB342;
}

/* ─── Page scaffolding (mirrors .ao-main) ───────────────────────────────── */
.ar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ar-content {
  padding: var(--sp-6) var(--sp-8) var(--sp-16);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  background-image:
    linear-gradient(var(--ar-grid-tone) 1px, transparent 1px),
    linear-gradient(90deg, var(--ar-grid-tone) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}

/* ─── Topbar (matches A1 .ao-topbar) ────────────────────────────────────── */
.ar-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-8);
  background: var(--surface);
  border-bottom: var(--rule-w) solid var(--rule);
  min-height: var(--topbar-h);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.ar-breadcrumb {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-soft);
}
.ar-breadcrumb-sep    { color: var(--ink-ghost); }
.ar-breadcrumb-current { color: var(--ink); }
.ar-topbar-actions { display: flex; align-items: center; gap: var(--sp-3); }
.ar-search {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface-alt);
  border: var(--rule-w) solid var(--rule-faint);
  border-radius: var(--r-md);
  padding: 6px var(--sp-3);
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-soft);
  min-width: 240px;
}
.ar-search:hover { border-color: var(--ink-soft); }
.ar-search-kbd {
  font-size: 10px; padding: 1px 5px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--rule-faint);
  margin-left: auto; color: var(--ink-faint);
}

/* ─── Hero (matches A1 .ao-hero structure) ─────────────────────────────── */
.ar-hero {
  padding: var(--sp-8) 0 var(--sp-6);
  border-bottom: var(--rule-w) solid var(--rule-faint);
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-6);
  align-items: end;
}
.ar-hero-eyebrow {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--orange);
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.ar-hero-eyebrow-line {
  display: inline-block; width: 32px; height: 1px; background: var(--orange);
}
.ar-hero-h1 {
  font-family: var(--ar-editorial);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 var(--sp-3) 0;
}
.ar-hero-h1 em { color: var(--orange); font-style: italic; }
.ar-hero-sub {
  font-family: var(--font-mono); font-size: var(--t-small);
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.ar-hero-sub .ar-sub-num { color: var(--ink); font-weight: 600; }
.ar-hero-sub .ar-sub-sep { color: var(--ink-ghost); padding: 0 4px; }

/* Period pills (right side of hero) */
.ar-hero-actions {
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-3);
}
.ar-period-pills {
  display: inline-flex; align-items: stretch;
  border: var(--rule-w) solid var(--rule);
  border-radius: var(--r-full); overflow: hidden;
}
.ar-period-pill {
  padding: 7px 14px;
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-soft);
  border-right: var(--rule-w) solid var(--rule);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.ar-period-pill:last-child { border-right: 0; }
.ar-period-pill:hover { background: var(--surface-alt); color: var(--ink); }
.ar-period-pill.is-active {
  background: var(--ink); color: var(--surface);
}
.ar-period-pill.is-active .ar-star { color: var(--orange); }

/* ─── Status strip (6 cells — A1 pattern) ──────────────────────────────── */
.ar-strip {
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-top: var(--rule-w-emph) solid var(--rule);
  border-bottom: var(--rule-w-emph) solid var(--rule);
  margin: var(--sp-6) 0 var(--sp-8);
  background: var(--surface);
}
.ar-strip-cell {
  padding: var(--sp-4) var(--sp-5);
  border-right: var(--rule-w) solid var(--rule-faint);
  display: flex; flex-direction: column; gap: 6px;
}
.ar-strip-cell:last-child { border-right: 0; }
.ar-strip-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-faint);
}
.ar-strip-value {
  font-family: var(--ar-editorial);
  font-weight: 500;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.ar-strip-value .ar-unit {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  font-weight: 400;
  margin-left: 4px; letter-spacing: 0;
}
.ar-strip-sub {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-soft);
}
.ar-strip-sub .ar-pos { color: var(--health-good, var(--ar-health-good)); }
.ar-strip-sub .ar-neg { color: var(--ar-health-bad); }
.ar-strip-cell--accent { background: var(--orange-tint); }

/* Sparkline placeholder for "Avg Health-Score" cell */
.ar-sparkline {
  width: 100%; height: 22px;
  display: flex; align-items: flex-end; gap: 2px;
}
.ar-sparkline-bar {
  flex: 1; background: var(--orange-tint-md);
  border-radius: 1px;
  transition: background var(--dur-base) var(--ease-out);
}
.ar-sparkline-bar.is-current { background: var(--orange); }

/* ─── Filter chips ──────────────────────────────────────────────────────── */
.ar-filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin: 0 0 var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: var(--rule-w) solid var(--rule-faint);
}
.ar-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 6px 12px;
  border: var(--rule-w) solid var(--rule-mid);
  border-radius: var(--r-full);
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.ar-chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.ar-chip.is-active {
  background: var(--ink); color: var(--surface);
  border-color: var(--ink);
}
.ar-chip-count {
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-feature-settings: "tnum";
}
.ar-chip.is-active .ar-chip-count {
  background: var(--orange); color: var(--surface);
}

/* ─── Customer list — main section ─────────────────────────────────────── */
.ar-list-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 var(--sp-3);
}
.ar-list-header-meta {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-faint);
}
.ar-list-header-sort {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-soft);
}
.ar-list-header-sort strong { color: var(--ink); font-weight: 600; }

.ar-list {
  display: flex; flex-direction: column; gap: var(--sp-3);
}

/* ─── Customer row — rich card layout ──────────────────────────────────── */
.ar-row {
  background: var(--surface);
  border: var(--rule-w) solid var(--rule-mid);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto;
  gap: var(--sp-5);
  align-items: start;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.ar-row:hover {
  border-color: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(14, 14, 12, 0.04);
}

/* Identity column (left) */
.ar-row-identity {
  display: flex; flex-direction: column; gap: var(--sp-3);
  min-width: 0;
}
.ar-row-id-top {
  display: flex; align-items: center; gap: var(--sp-3);
}
.ar-avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  background: var(--orange);
  color: var(--surface);
  font-family: var(--font-mono);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.ar-row-name {
  font-family: var(--font-sans);
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  margin: 0;
}
.ar-row-contact {
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-soft);
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  align-items: center;
}
.ar-row-contact-item { display: inline-flex; align-items: center; gap: 4px; }
.ar-row-contact svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none; stroke-width: 1.75;
  opacity: 0.6;
}

/* Status-pill (next to name) */
.ar-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  border-radius: var(--r-full);
  font-weight: 600;
}
.ar-pill--onboarding {
  background: var(--orange-tint); color: var(--orange);
  border: 1px solid var(--orange-tint-md);
}
.ar-pill--healthy {
  background: rgba(74, 143, 42, 0.10);
  color: var(--ar-health-good);
  border: 1px solid rgba(74, 143, 42, 0.30);
}
.ar-pill--at_risk {
  background: rgba(232, 148, 28, 0.12);
  color: var(--ar-health-warn);
  border: 1px solid rgba(232, 148, 28, 0.32);
}
.ar-pill--churning {
  background: rgba(208, 59, 26, 0.10);
  color: var(--ar-health-bad);
  border: 1px solid rgba(208, 59, 26, 0.30);
}
.ar-pill-dot {
  width: 6px; height: 6px; border-radius: var(--r-full);
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: 0.25;
}
.ar-pill--onboarding .ar-pill-dot { animation: ar-pulse 2.4s var(--ease-out) infinite; opacity: 0.3; }
@keyframes ar-pulse {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.6; }
}

/* Health-score gradient bar — A2 signature visual */
.ar-health-bar {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: var(--sp-2);
}
.ar-health-track {
  position: relative;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 3px;
  overflow: hidden;
}
.ar-health-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    var(--ar-health-bad)   0%,
    var(--ar-health-warn) 30%,
    var(--ar-health-ok)   55%,
    var(--ar-health-good) 80%
  );
  border-radius: 3px;
  transform-origin: left center;
  animation: ar-health-grow 600ms var(--ease-out) both;
}
@keyframes ar-health-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.ar-health-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
}
.ar-health-label strong {
  font-family: var(--ar-editorial); font-style: italic;
  font-size: 16px; color: var(--ink); font-weight: 500;
  letter-spacing: 0;
}

/* Metrics grid (middle column) — 4 cells × 2 rows */
.ar-row-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4) var(--sp-4);
  padding: 0 var(--sp-4);
  border-left: var(--rule-w) solid var(--rule-faint);
}
.ar-metric { display: flex; flex-direction: column; gap: 2px; }
.ar-metric-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-faint);
}
.ar-metric-value {
  font-family: var(--ar-editorial);
  font-weight: 500; font-style: italic;
  font-size: 22px; line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.ar-metric-value .ar-em { color: var(--orange); }
.ar-metric-value .ar-mono {
  font-family: var(--font-mono); font-style: normal; font-size: 18px;
  letter-spacing: 0;
}
.ar-metric-sub {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-soft);
}
.ar-metric-sub .ar-warn { color: var(--ar-health-warn); }
.ar-metric--trial .ar-metric-value::after {
  content: ""; display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: var(--orange);
  margin-left: 8px;
  vertical-align: middle;
  animation: ar-trial-pulse 1.8s var(--ease-out) infinite;
}
@keyframes ar-trial-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1.0; transform: scale(1.05); }
}

/* Actions column (right) */
.ar-row-actions {
  display: flex; flex-direction: column; gap: var(--sp-2);
  align-items: stretch;
  min-width: 130px;
}
.ar-btn {
  padding: 8px 14px;
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  border: var(--rule-w) solid var(--rule-mid);
  background: var(--surface);
  color: var(--ink);
  transition: all var(--dur-fast) var(--ease-out);
}
.ar-btn:hover { border-color: var(--ink); }
.ar-btn--primary {
  background: var(--ink); color: var(--surface);
  border-color: var(--ink);
}
.ar-btn--primary:hover {
  background: var(--orange); border-color: var(--orange);
}
.ar-btn--ghost {
  background: transparent;
  border-color: var(--rule-faint);
  color: var(--ink-soft);
}
.ar-btn--ghost:hover { color: var(--ink); border-color: var(--ink-soft); }
.ar-row-overflow {
  align-self: center;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--ink-faint);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.ar-row-overflow:hover { background: var(--surface-alt); color: var(--ink); }

/* ─── Empty-slot pipeline row ───────────────────────────────────────────── */
.ar-row--empty {
  background: transparent;
  border-style: dashed;
  border-color: var(--rule-faint);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  opacity: 0.65;
}
.ar-row--empty:hover {
  border-color: var(--rule-mid);
  box-shadow: none;
  opacity: 0.85;
}
.ar-row-empty-slot {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-ghost);
  flex-shrink: 0;
  width: 60px;
}
.ar-row-empty-label {
  font-family: var(--ar-editorial); font-style: italic;
  font-size: 18px;
  color: var(--ink-faint);
  flex: 1;
}
.ar-row-empty-stage {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-ghost);
  padding: 3px 9px;
  border: 1px dashed var(--rule-faint);
  border-radius: var(--r-full);
}

/* ─── Quick actions (3 cards) ──────────────────────────────────────────── */
.ar-quick-actions {
  margin: var(--sp-10) 0 var(--sp-8);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
.ar-action-card {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--surface);
  border: var(--rule-w) solid var(--rule-mid);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
  text-decoration: none;
  color: var(--ink);
}
.ar-action-card:hover {
  border-color: var(--orange);
  background: var(--orange-tint);
}
.ar-action-card[aria-disabled="true"] {
  opacity: 0.55; cursor: default; pointer-events: none;
}
.ar-action-icon {
  font-size: 22px;
  margin-bottom: var(--sp-2);
}
.ar-action-title {
  font-family: var(--font-sans);
  font-size: 16px; font-weight: 600;
  color: var(--ink);
}
.ar-action-desc {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.ar-action-soon-tag {
  font-family: var(--font-mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--ink-ghost);
  font-style: italic;
}

/* ─── Krydshenvisninger (4 cards, A1 pattern) ──────────────────────────── */
.ar-cross {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: var(--rule-w) solid var(--rule-faint);
}
.ar-cross-card {
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface);
  border: var(--rule-w) solid var(--rule-faint);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink);
  transition: all var(--dur-fast) var(--ease-out);
}
.ar-cross-card:hover {
  border-color: var(--ink-soft);
  transform: translateY(-1px);
}
.ar-cross-arrow {
  font-family: var(--font-mono);
  color: var(--orange);
  align-self: flex-end;
  margin-top: var(--sp-2);
  transition: transform var(--dur-fast) var(--ease-out);
}
.ar-cross-card:hover .ar-cross-arrow { transform: translateX(3px); }
.ar-cross-title {
  font-family: var(--font-sans); font-weight: 600; font-size: 15px;
}
.ar-cross-desc {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  line-height: 1.6;
}

/* ─── Section eyebrow (eyebrows above quick-actions etc.) ──────────────── */
.ar-section-eyebrow {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--orange);
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}
.ar-section-eyebrow::before {
  content: ""; display: inline-block;
  width: 24px; height: 1px; background: var(--orange);
}

/* ─── Responsive (mid breakpoint) ─────────────────────────────────────── */
@media (max-width: 1280px) {
  .ar-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; }
  .ar-row-metrics { grid-template-columns: repeat(2, 1fr); }
  .ar-strip { grid-template-columns: repeat(3, 1fr); }
  .ar-strip-cell:nth-child(3) { border-right: 0; }
  .ar-cross { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .ar-hero { grid-template-columns: 1fr; }
  .ar-hero-actions { align-items: flex-start; }
  .ar-row {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
  .ar-row-metrics {
    border-left: 0;
    border-top: var(--rule-w) solid var(--rule-faint);
    padding: var(--sp-3) 0 0 0;
  }
  .ar-row-actions { flex-direction: row; }
  .ar-quick-actions { grid-template-columns: 1fr; }
}

/* ─── Dark theme adjustments ──────────────────────────────────────────── */
:root[data-theme="dark"] .ar-row:hover {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
:root[data-theme="dark"] .ar-strip-cell--accent {
  background: var(--orange-tint);
}
