/* ==========================================================================
   Sample Dashboard v2 — design kernel.
   Tokens + primitives only. Layout lives in shell.css; per-view compositions
   live in views-*.css. Palette values mirror the site's dark theme tokens
   (see PLAN.md) so the brand reads identical without importing the legacy
   cascade.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #0a0d12;
  --bg-soft: #0e1217;
  --panel: #14181e;
  --panel-2: #1b2027;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Ink */
  --ink: #f3f5f7;
  --muted: #b7bec8;
  --muted-2: #8b929c;

  /* Accent — copper, the only decorative accent */
  --accent: #cc8066;
  --accent-bright: #e7a184;
  --accent-soft: rgba(204, 128, 102, 0.14);
  --accent-line: rgba(204, 128, 102, 0.38);

  /* Semantics */
  --green: #5fd39a;
  --green-soft: rgba(95, 211, 154, 0.12);
  --red: #ef7e72;
  --red-soft: rgba(239, 126, 114, 0.12);
  --blue: #6aa0ff;
  --blue-soft: rgba(106, 160, 255, 0.12);
  --amber: #f4c25a;
  --amber-soft: rgba(244, 194, 90, 0.12);

  /* Type */
  --font-body: "Geist", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Shape & depth */
  --r-sm: 8px;
  --r-md: 14px;
  --r-pill: 999px;
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 22px 44px -26px rgba(0, 0, 0, 0.7);
  --shadow-card-hover: inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 30px 60px -28px rgba(0, 0, 0, 0.8);
  --shadow-cta: 0 14px 40px -16px rgba(204, 128, 102, 0.45);
  --focus-ring: 0 0 0 2px var(--panel), 0 0 0 4px rgba(204, 128, 102, 0.55);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 700ms;
}

/* ---------- Reset-lite ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
a {
  color: inherit;
}
button {
  font: inherit;
  color: inherit;
}
::selection {
  background: rgba(204, 128, 102, 0.35);
}

/* Ambient atmosphere: faint copper bloom top-left + vignette. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(204, 128, 102, 0.07), transparent 62%),
    radial-gradient(1100px 700px at 108% 112%, rgba(106, 160, 255, 0.04), transparent 60%);
  pointer-events: none;
}

/* ---------- Typography ---------- */
.h-display {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.022em;
  line-height: 1.14;
}
.h-card {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.micro {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.body-muted {
  color: var(--muted);
}
.small {
  font-size: 0.8125rem;
}
.num {
  font-variant-numeric: tabular-nums;
}
.accent-text {
  color: var(--accent-bright);
}

/* ---------- Card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  transition: box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.card--hover:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.card--accent {
  border-color: var(--accent-line);
}
.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card__head .micro {
  margin-bottom: 0;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.chip--green {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(95, 211, 154, 0.28);
}
.chip--accent {
  color: var(--accent-bright);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.chip--red {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(239, 126, 114, 0.28);
}
.chip--blue {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(106, 160, 255, 0.28);
}
.chip--amber {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(244, 194, 90, 0.28);
}
.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}
.btn:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  color: #191008;
  font-weight: 650;
  box-shadow: var(--shadow-cta);
}
.btn--primary:hover {
  background: linear-gradient(180deg, #f0b096, var(--accent-bright));
  border-color: transparent;
}
.btn--sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

/* ---------- Metric tiles ---------- */
.metric {
  display: grid;
  gap: 4px;
  align-content: start;
}
.metric__value {
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.metric__value--good { color: var(--green); }
.metric__value--bad { color: var(--red); }
.metric__value--warn { color: var(--amber); }
.metric__value--accent { color: var(--accent-bright); }
.metric__label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}
.metric__sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- Horizontal bars ---------- */
.bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-slow) var(--ease-out);
}
.is-in .bar__fill,
.bar.is-in .bar__fill {
  transform: scaleX(1);
}
.bar__fill--strong {
  background: linear-gradient(90deg, #3f9e72, var(--green));
}
.bar__fill--accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}
.bar__fill--weak {
  background: linear-gradient(90deg, #b45f54, var(--red));
}
.bar__fill--blue {
  background: linear-gradient(90deg, #4f7fd9, var(--blue));
}

/* Staggered bar reveals inside a revealed container */
.is-in .bar:nth-child(1) .bar__fill, .is-in [data-stagger="1"] .bar__fill { transition-delay: 40ms; }
.is-in [data-stagger="2"] .bar__fill { transition-delay: 90ms; }
.is-in [data-stagger="3"] .bar__fill { transition-delay: 140ms; }
.is-in [data-stagger="4"] .bar__fill { transition-delay: 190ms; }
.is-in [data-stagger="5"] .bar__fill { transition-delay: 240ms; }
.is-in [data-stagger="6"] .bar__fill { transition-delay: 290ms; }
.is-in [data-stagger="7"] .bar__fill { transition-delay: 340ms; }

/* ---------- Ring gauge ---------- */
.ring {
  position: relative;
  display: grid;
  place-items: center;
}
.ring__svg {
  transform: rotate(-90deg);
}
.ring__track {
  fill: none;
  stroke: rgba(204, 128, 102, 0.14);
  stroke-width: 10;
}
.ring__progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1100ms var(--ease-out);
  filter: drop-shadow(0 0 14px rgba(204, 128, 102, 0.35));
}
.ring.is-in .ring__progress {
  stroke-dashoffset: var(--ring-offset, 51);
}
.ring__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  place-content: center;
  text-align: center;
  gap: 2px;
}
.ring__value {
  font-size: 52px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ring__caption {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  max-width: 72%;
  white-space: normal;
  line-height: 1.35;
  text-align: center;
}

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: left;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr {
  transition: background var(--dur-fast) var(--ease-out);
}
.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- Pill tabs ---------- */
.pills {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar {
  display: none;
}
.pills__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.pills__btn:hover {
  color: var(--ink);
}
.pills__btn[aria-selected="true"] {
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ---------- Footnote / empty state / misc ---------- */
.footnote {
  font-size: 0.75rem;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.footnote::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-2);
  opacity: 0.6;
  flex: none;
}
.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  padding: 36px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted-2);
  font-size: 0.875rem;
}
.avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}
.you-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #191008;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  translate: -50% 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-card-hover);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out),
    translate var(--dur-base) var(--ease-out);
  z-index: 90;
  pointer-events: none;
}
.toast.is-on {
  opacity: 1;
  translate: -50% 0;
}

/* ---------- Reveal motion ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}
.reveal[data-delay="1"] { transition-delay: 70ms; }
.reveal[data-delay="2"] { transition-delay: 140ms; }
.reveal[data-delay="3"] { transition-delay: 210ms; }
.reveal[data-delay="4"] { transition-delay: 280ms; }

/* ---------- Focus & a11y ---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .ring__progress {
    stroke-dashoffset: var(--ring-offset, 51);
  }
  .bar__fill {
    transform: scaleX(1);
  }
}

/* ---------- Scrollbar (WebKit) ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track {
  background: transparent;
}
