/* ─────────────────────────────────────────────────────────────────────────────
   Hype Labs UI — the tracker's design system as plain CSS custom properties.
   Drop this file in as-is. Everything downstream reads the variables, so the
   theme switch is one attribute on <html>: <html data-hl-theme="dark">.
   Extracted from the Hype Analytics tracker (app/src/Tracker.jsx).
   ────────────────────────────────────────────────────────────────────────────*/

@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@600;700;800&family=Inter:wght@400;500;600;700&family=Instrument+Serif:ital@1&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* surfaces — cream paper */
  --hl-bg: #e9e4dc;
  --hl-surface: #f4f0e9;
  --hl-surface-alt: #efeae1;
  --hl-surface-raised: #f4f0e9;
  --hl-sunken: #e0dad0;
  --hl-overlay: #f4f0e9;
  --hl-card-hover: #faf7f2;

  /* lines */
  --hl-border: #d3cdc4;
  --hl-border-light: #c2bbaf;
  --hl-border-input: #8c867b;

  /* chrome */
  --hl-sidebar: #e9e4dc;
  --hl-sidebar-hover: #e0dad0;

  /* ink */
  --hl-text: #0d1317;
  --hl-text-secondary: #3a4146;
  --hl-text-muted: #6b6760;

  /* the one accent, and its tint */
  --hl-accent: #c63a1e;
  --hl-accent-soft: #f4d9cf;
  --hl-selected: #f4d9cf;
  --hl-selected-text: #b02f15;

  /* meaning colours — status only, never decoration */
  --hl-blue: #2f5f7f;
  --hl-amber: #a8650a;
  --hl-red: #c63a1e;
  --hl-green: #3b7a4b;
  --hl-purple: #7a4e6b;

  /* interaction states */
  --hl-hover: #0d13170d;
  --hl-pressed: #0d13171a;

  /* radii — 3 controls, 6 cards, 999 pills. nothing else. */
  --hl-radius: 3px;
  --hl-radius-lg: 6px;
  --hl-radius-pill: 999px;

  /* shadows — overlays only; a card gets no shadow */
  --hl-shadow-sm: 0px 1px 0px #0d13171a;
  --hl-shadow-md: 0px 6px 18px #0d131724, 0px 0px 1px #0d131740;
  --hl-shadow-lg: 0px 10px 28px #0d131730, 0px 0px 1px #0d131740;

  /* type */
  --hl-font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", sans-serif;
  --hl-font-display: "Inter Tight", "Inter", ui-sans-serif, sans-serif;
  --hl-font-serif: "Instrument Serif", Georgia, serif;
  --hl-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* density — an 8px grid */
  --hl-topbar: 56px;
  --hl-sidebar-w: 240px;
  --hl-control-h: 32px;
  --hl-tab-h: 40px;
  --hl-gutter: 28px;
}

[data-hl-theme="dark"] {
  --hl-bg: #0e1418;
  --hl-surface: #151d22;
  --hl-surface-alt: #1a242a;
  --hl-surface-raised: #1a242a;
  --hl-sunken: #0a0f12;
  --hl-overlay: #1a242a;
  --hl-card-hover: #1a242a;

  --hl-border: #27323a;
  --hl-border-light: #34424b;
  --hl-border-input: #6c7a83;

  --hl-sidebar: #0e1418;
  --hl-sidebar-hover: #151d22;

  --hl-text: #ede9e3;
  --hl-text-secondary: #b9b5af;
  --hl-text-muted: #8b8f91;

  --hl-accent: #f47a5c;
  --hl-accent-soft: #3a1f19;
  --hl-selected: #3a1f19;
  --hl-selected-text: #f47a5c;

  --hl-blue: #7fb2d0;
  --hl-amber: #e8b04a;
  --hl-red: #f47a5c;
  --hl-green: #7cc48e;
  --hl-purple: #c99bb8;

  --hl-hover: #ede9e30f;
  --hl-pressed: #ede9e31f;

  --hl-shadow-sm: 0px 1px 0px #00000080;
  --hl-shadow-md: 0px 8px 20px #0000008c, 0px 0px 1px #00000080;
  --hl-shadow-lg: 0px 12px 30px #0000009c, 0px 0px 1px #00000080;
}

/* status lozenges — background tint + readable foreground, per theme */
:root {
  --hl-lozenge-default-bg: #d8d2c8;
  --hl-lozenge-default-fg: #3a4146;
  --hl-lozenge-progress-bg: #cfdde6;
  --hl-lozenge-progress-fg: #244b66;
  --hl-lozenge-success-bg: #cfe3d2;
  --hl-lozenge-success-fg: #2c5e3a;
  --hl-lozenge-removed-bg: #f4cfc4;
  --hl-lozenge-removed-fg: #9e2d14;
  --hl-lozenge-moved-bg: #f0ddb0;
  --hl-lozenge-moved-fg: #7a4b05;
  --hl-lozenge-new-bg: #e4d2dc;
  --hl-lozenge-new-fg: #5e3a52;
}
[data-hl-theme="dark"] {
  --hl-lozenge-default-bg: #ede9e31a;
  --hl-lozenge-default-fg: #b9b5af;
  --hl-lozenge-progress-bg: #1e3442;
  --hl-lozenge-progress-fg: #9cc8e2;
  --hl-lozenge-success-bg: #1c3a26;
  --hl-lozenge-success-fg: #8ed6a1;
  --hl-lozenge-removed-bg: #4a1f16;
  --hl-lozenge-removed-fg: #f9a08a;
  --hl-lozenge-moved-bg: #4a3813;
  --hl-lozenge-moved-fg: #efc775;
  --hl-lozenge-new-bg: #3a2633;
  --hl-lozenge-new-fg: #ddb1ce;
}

/* ── base ─────────────────────────────────────────────────────────────────── */
html,
body {
  margin: 0;
  background: var(--hl-bg);
  color: var(--hl-text);
  font-family: var(--hl-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  font-family: var(--hl-font-display);
  letter-spacing: -0.025em;
  margin: 0;
}
button,
input,
textarea,
select {
  font-family: inherit;
}
::selection {
  background: #f2b8a6;
}
[data-hl-theme="dark"] ::selection {
  background: #5a2a1e;
}
:focus-visible {
  outline: 2px solid var(--hl-accent);
  outline-offset: 2px;
}

/* scrollbars: the thumb is a border, the track is nothing */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--hl-border);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--hl-text-muted);
  background-clip: content-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hl-border) transparent;
}
.hl-thin::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

/* ── primitives ───────────────────────────────────────────────────────────── */

/* the space/heading mark: a 3px red rule, never a filled block */
.hl-rule {
  display: inline-block;
  width: 3px;
  height: 18px;
  background: var(--hl-accent);
  flex: none;
}

/* the wordmark */
.hl-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--hl-font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
  color: var(--hl-text);
}
.hl-logo i {
  font-family: var(--hl-font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--hl-accent);
  margin-left: 3px;
  letter-spacing: -0.02em;
}
.hl-logo b {
  display: inline-block;
  width: 3px;
  background: var(--hl-accent);
  margin-left: 3px;
}

/* card: flat paper, one hairline, 6px */
.hl-card {
  background: var(--hl-surface);
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius-lg);
}
.hl-card.is-interactive:hover {
  background: var(--hl-card-hover);
}

/* buttons: 32px, 3px, transparent until hover */
.hl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--hl-control-h);
  padding: 0 12px;
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius);
  background: var(--hl-surface);
  color: var(--hl-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.hl-btn:hover {
  background: var(--hl-hover);
}
.hl-btn:active {
  background: var(--hl-pressed);
}
.hl-btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--hl-text-secondary);
}
.hl-btn--primary {
  background: var(--hl-accent);
  border-color: var(--hl-accent);
  color: #fff;
  font-weight: 600;
}
.hl-btn--primary:hover {
  filter: brightness(1.08);
}
.hl-btn--icon {
  width: 32px;
  padding: 0;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: var(--hl-text-secondary);
}
.hl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* input: 32px, 6px, input-weight border, accent on focus */
.hl-input {
  height: var(--hl-control-h);
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--hl-border-input);
  border-radius: var(--hl-radius-lg);
  background: var(--hl-surface);
  color: var(--hl-text);
  font-size: 14px;
  outline: none;
}
.hl-input::placeholder {
  color: var(--hl-text-muted);
}
.hl-input:hover {
  background: var(--hl-card-hover);
}
.hl-input:focus {
  border-color: var(--hl-accent);
  box-shadow: inset 0 0 0 1px var(--hl-accent);
  background: var(--hl-surface);
}

/* lozenge: mono caps, 10px, 16px tall, radius 2 — the only uppercase in the UI */
.hl-lozenge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  padding: 0 5px;
  border-radius: 2px;
  font-family: var(--hl-font-mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--hl-lozenge-default-bg);
  color: var(--hl-lozenge-default-fg);
}
.hl-lozenge--progress {
  background: var(--hl-lozenge-progress-bg);
  color: var(--hl-lozenge-progress-fg);
}
.hl-lozenge--success {
  background: var(--hl-lozenge-success-bg);
  color: var(--hl-lozenge-success-fg);
}
.hl-lozenge--removed {
  background: var(--hl-lozenge-removed-bg);
  color: var(--hl-lozenge-removed-fg);
}
.hl-lozenge--moved {
  background: var(--hl-lozenge-moved-bg);
  color: var(--hl-lozenge-moved-fg);
}
.hl-lozenge--new {
  background: var(--hl-lozenge-new-bg);
  color: var(--hl-lozenge-new-fg);
}

/* tab: 40px, 2px underline in the accent's ink, 600 when current */
.hl-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--hl-tab-h);
  padding: 0 8px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--hl-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.hl-tab:hover {
  color: var(--hl-text);
}
.hl-tab[aria-selected="true"] {
  color: var(--hl-selected-text);
  font-weight: 600;
  border-bottom-color: var(--hl-selected-text);
}

/* nav row: 32px, indent under the space, selected = tint + weight */
.hl-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: var(--hl-control-h);
  padding: 0 8px 0 36px;
  margin-bottom: 1px;
  border: none;
  border-radius: var(--hl-radius);
  background: transparent;
  color: var(--hl-text-secondary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.hl-nav:hover {
  background: var(--hl-hover);
}
.hl-nav[aria-current="page"] {
  background: var(--hl-selected);
  color: var(--hl-selected-text);
  font-weight: 600;
}

/* status pill: the red/green dot and a sentence, 999 */
.hl-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--hl-border);
  border-radius: var(--hl-radius-pill);
  background: var(--hl-surface);
  color: var(--hl-text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.hl-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hl-green);
  box-shadow: 0 0 0 3px rgb(46 125 79 / 0.18);
}
.hl-pill--is-down {
  border-color: #c0392b;
  background: #fdecea;
  color: #8b1e12;
}
.hl-pill--is-down .dot {
  background: #c0392b;
  box-shadow: none;
}

/* table: hairlines only, no zebra, hover warms the row */
.hl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.hl-table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hl-border);
  color: var(--hl-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0.02em;
}
.hl-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hl-border);
  color: var(--hl-text-secondary);
  vertical-align: middle;
}
.hl-table tbody tr:hover td {
  background: var(--hl-card-hover);
}
.hl-table .num {
  text-align: right;
  font-family: var(--hl-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--hl-text);
}

/* KPI: 22px number, 12px label, 10px sub; the icon square carries the meaning colour */
.hl-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.hl-kpi .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 18px;
  flex: none;
}
.hl-kpi .n {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--hl-text);
  font-variant-numeric: tabular-nums;
}
.hl-kpi .l {
  margin-top: 3px;
  font-size: 12px;
  color: var(--hl-text-secondary);
}
.hl-kpi .sub {
  font-size: 10px;
  color: var(--hl-text-muted);
}

/* the top bar: 56px, surface, one hairline */
.hl-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--hl-topbar);
  padding: 0 12px;
  background: var(--hl-surface);
  border-bottom: 1px solid var(--hl-border);
}

/* a callout: tinted by the meaning colour at ~8% with a 33% border */
.hl-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--hl-radius);
  background: color-mix(in srgb, var(--hl-amber) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--hl-amber) 33%, transparent);
}

/* mono label, for a metric caption or a data tag */
.hl-mono {
  font-family: var(--hl-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--hl-text-muted);
}
