/* ============================================================
   ROOMLY — Design System
   Futuristic, minimal, warm. Dark-first.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");

:root {
  /* ── Dark palette (default) ──────────────────────────── */
  --bg-0: oklch(0.16 0.01 240);          /* page floor */
  --bg-1: oklch(0.20 0.012 240);         /* card surface */
  --bg-2: oklch(0.235 0.014 240);        /* elevated / input */
  --bg-3: oklch(0.27 0.015 240);         /* hover */
  --bg-inv: oklch(0.97 0.005 90);        /* inverted surface */

  --line-1: oklch(0.30 0.012 240 / 0.55);  /* hairline */
  --line-2: oklch(0.40 0.012 240 / 0.55);  /* stronger hairline */
  --line-strong: oklch(0.55 0.012 240 / 0.7);

  --ink-0: oklch(0.97 0.005 90);         /* primary text */
  --ink-1: oklch(0.85 0.008 90);         /* body text */
  --ink-2: oklch(0.65 0.012 90);         /* muted */
  --ink-3: oklch(0.50 0.015 240);        /* very muted */

  --accent: oklch(0.72 0.13 235);        /* electric blue */
  --accent-strong: oklch(0.78 0.15 235);
  --accent-dim: oklch(0.72 0.13 235 / 0.20);
  --accent-ink: oklch(0.15 0.04 240);    /* text on accent */

  --info: oklch(0.72 0.07 200);          /* muted teal */
  --info-dim: oklch(0.72 0.07 200 / 0.16);

  --success: oklch(0.78 0.12 155);
  --warn: oklch(0.80 0.13 65);
  --danger: oklch(0.68 0.18 25);

  /* Type */
  --font-sans: "Geist", -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Spacing scale (4px) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;

  /* Elevation */
  --elev-1: 0 0 0 1px var(--line-1), 0 6px 24px -8px rgba(0,0,0,0.6);
  --elev-2: 0 0 0 1px var(--line-2), 0 12px 40px -12px rgba(0,0,0,0.7);

  /* Speed */
  --t-fast: 120ms ease;
  --t-base: 200ms cubic-bezier(.2,.7,.2,1);
}

/* ── Light theme override ─────────────────────────────────── */
:root[data-theme="light"] {
  /* warm off-white canvas with cool ink — paper-like */
  --bg-0: oklch(0.98 0.012 240);          /* page floor — soft pale blue tint */
  --bg-1: oklch(1 0 0);                   /* card surface — pure white */
  --bg-2: oklch(0.955 0.014 240);         /* input/elevated */
  --bg-3: oklch(0.92 0.018 240);          /* hover */
  --bg-inv: oklch(0.18 0.012 240);

  --line-1: oklch(0.20 0.012 240 / 0.10);
  --line-2: oklch(0.20 0.012 240 / 0.18);
  --line-strong: oklch(0.20 0.012 240 / 0.32);

  --ink-0: oklch(0.20 0.015 245);         /* near-black with cool tint */
  --ink-1: oklch(0.34 0.014 245);
  --ink-2: oklch(0.50 0.012 245);
  --ink-3: oklch(0.62 0.010 245);

  --accent: oklch(0.52 0.18 248);         /* deeper, more saturated blue */
  --accent-strong: oklch(0.44 0.20 250);
  --accent-dim: oklch(0.52 0.18 248 / 0.10);
  --accent-ink: oklch(1 0 0);

  --info: oklch(0.50 0.10 220);
  --info-dim: oklch(0.50 0.10 220 / 0.10);

  --success: oklch(0.52 0.14 155);
  --warn: oklch(0.62 0.16 60);
  --danger: oklch(0.55 0.20 25);

  --elev-1: 0 0 0 1px var(--line-1), 0 4px 14px -6px rgba(20,30,55,0.10), 0 1px 2px rgba(20,30,55,0.04);
  --elev-2: 0 0 0 1px var(--line-2), 0 18px 50px -16px rgba(20,30,55,0.18);
}

/* light-mode photo placeholder */
:root[data-theme="light"] .photo:not(.has-img) {
  background:
    repeating-linear-gradient(135deg, oklch(0.55 0.014 240 / 0.18) 0 1px, transparent 1px 9px),
    linear-gradient(135deg, oklch(0.90 0.012 245), oklch(0.84 0.012 235));
}
:root[data-theme="light"] .top-nav {
  background: oklch(0.98 0.012 240 / 0.85);
  border-bottom: 1px solid var(--line-1);
}
:root[data-theme="light"] .badge { background: oklch(0.20 0.012 240 / 0.05); }
:root[data-theme="light"] .chip { background: var(--bg-1); box-shadow: 0 0 0 1px var(--line-2) inset; }
:root[data-theme="light"] .chip.active { background: var(--ink-0); color: #fff; }
:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .textarea { background: var(--bg-1); }

/* ── Reset ──────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-0);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Typography utilities ──────────────────────────────── */
.t-display-xl { font-size: 56px; line-height: 1.02; letter-spacing: -0.025em; font-weight: 500; }
.t-display-lg { font-size: 44px; line-height: 1.05; letter-spacing: -0.022em; font-weight: 500; }
.t-display    { font-size: 32px; line-height: 1.1; letter-spacing: -0.018em; font-weight: 500; }
.t-h1         { font-size: 24px; line-height: 1.2; letter-spacing: -0.012em; font-weight: 500; }
.t-h2         { font-size: 20px; line-height: 1.25; letter-spacing: -0.008em; font-weight: 500; }
.t-h3         { font-size: 17px; line-height: 1.3; font-weight: 500; }
.t-body       { font-size: 15px; line-height: 1.55; font-weight: 400; }
.t-sm         { font-size: 13px; line-height: 1.45; font-weight: 400; }
.t-xs         { font-size: 12px; line-height: 1.4; font-weight: 400; }
.t-mono       { font-family: var(--font-mono); letter-spacing: -0.01em; }
.t-mono-xs    { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }
.t-mono-sm    { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; }

.muted { color: var(--ink-2); }
.muted-soft { color: var(--ink-3); }
.accent-text { color: var(--accent); }

/* ── Layout helpers ────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 var(--s-8); }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 var(--s-8); }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.gap-8 { gap: var(--s-8); } .gap-10 { gap: var(--s-10); } .gap-12 { gap: var(--s-12); }
.spread { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.grow { flex: 1; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--bg-2); color: var(--ink-0); box-shadow: 0 0 0 1px var(--line-1) inset; }
.btn-secondary:hover { background: var(--bg-3); }
.btn-ghost { color: var(--ink-1); }
.btn-ghost:hover { color: var(--ink-0); background: var(--bg-2); }
.btn-outline { color: var(--ink-0); box-shadow: 0 0 0 1px var(--line-2) inset; }
.btn-outline:hover { box-shadow: 0 0 0 1px var(--line-strong) inset; background: var(--bg-2); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 15px; border-radius: var(--r-md); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--r-full); }

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 1px var(--line-1);
  overflow: hidden;
}
.card-pad { padding: var(--s-6); }
.card:hover.card-hover { box-shadow: 0 0 0 1px var(--line-2), 0 16px 40px -16px rgba(0,0,0,0.5); }

/* ── Inputs ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-2);
  color: var(--ink-0);
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--line-1) inset;
  outline: none;
  transition: box-shadow var(--t-fast), background var(--t-fast);
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 96px; }
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  box-shadow: 0 0 0 1px var(--accent) inset, 0 0 0 4px var(--accent-dim);
  background: var(--bg-1);
}

/* ── Chips & Badges ────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-full);
  background: var(--bg-2);
  box-shadow: 0 0 0 1px var(--line-1) inset;
  font-size: 12px; color: var(--ink-1);
  font-family: var(--font-mono); letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--t-fast);
}
.chip:hover { background: var(--bg-3); }
.chip.active { background: var(--ink-0); color: var(--bg-0); box-shadow: none; }
.chip-static { cursor: default; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-full);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  background: var(--bg-2); color: var(--ink-1);
  box-shadow: 0 0 0 1px var(--line-1) inset;
}
.badge-accent { background: var(--accent-dim); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim) inset; }
.badge-info { background: var(--info-dim); color: var(--info); box-shadow: 0 0 0 1px var(--info-dim) inset; }
.badge-success { background: oklch(0.78 0.12 155 / 0.16); color: var(--success); box-shadow: 0 0 0 1px oklch(0.78 0.12 155 / 0.16) inset; }
.badge-warn { background: oklch(0.80 0.13 65 / 0.16); color: var(--warn); box-shadow: 0 0 0 1px oklch(0.80 0.13 65 / 0.16) inset; }

/* ── Photo placeholder ─────────────────────────────────── */
.photo {
  position: relative;
  background:
    repeating-linear-gradient(135deg, oklch(0.30 0.014 240 / 0.4) 0 1px, transparent 1px 9px),
    linear-gradient(135deg, oklch(0.30 0.018 245), oklch(0.24 0.014 235));
  background-size: cover;
  background-position: center;
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.photo.has-img::after {
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.45) 100%);
}
:root[data-theme="light"] .photo {
  background:
    repeating-linear-gradient(135deg, oklch(0.55 0.014 240 / 0.18) 0 1px, transparent 1px 9px),
    linear-gradient(135deg, oklch(0.85 0.012 245), oklch(0.78 0.012 235));
}
.photo::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 70% 20%, transparent 30%, rgba(0,0,0,0.25) 100%);
  pointer-events: none;
}
.photo-label { position: relative; z-index: 1; opacity: 0.7; }

/* photo color variants for visual variety */
.photo.tone-a { background: repeating-linear-gradient(135deg, oklch(0.32 0.04 60 / 0.4) 0 1px, transparent 1px 9px), linear-gradient(135deg, oklch(0.32 0.05 60), oklch(0.24 0.03 50)); }
.photo.tone-b { background: repeating-linear-gradient(135deg, oklch(0.30 0.04 200 / 0.4) 0 1px, transparent 1px 9px), linear-gradient(135deg, oklch(0.30 0.05 200), oklch(0.22 0.03 215)); }
.photo.tone-c { background: repeating-linear-gradient(135deg, oklch(0.30 0.04 145 / 0.4) 0 1px, transparent 1px 9px), linear-gradient(135deg, oklch(0.30 0.04 145), oklch(0.22 0.03 155)); }
.photo.tone-d { background: repeating-linear-gradient(135deg, oklch(0.30 0.03 30 / 0.4) 0 1px, transparent 1px 9px), linear-gradient(135deg, oklch(0.30 0.04 30), oklch(0.22 0.03 20)); }
.photo.tone-e { background: repeating-linear-gradient(135deg, oklch(0.30 0.03 280 / 0.4) 0 1px, transparent 1px 9px), linear-gradient(135deg, oklch(0.28 0.04 280), oklch(0.22 0.03 270)); }

/* ── Top nav ─────────────────────────────────────────── */
.top-nav {
  position: sticky; top: 0; z-index: 50;
  background: oklch(from var(--bg-0) l c h / 0.85);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line-1);
  height: 68px;
  display: flex; align-items: center;
}
.top-nav .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s-6); width: 100%; }

/* Logo */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-weight: 500; font-size: 16px; letter-spacing: 0.02em;
  color: var(--ink-0);
}
.logo-mark {
  width: 28px; height: 28px;
  position: relative; flex: none;
  display: grid; place-items: center;
}
.logo-mark svg { width: 100%; height: 100%; }

/* ── Section heads ──────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); display: inline-block; }

/* ── Divider ─────────────────────────────────────────── */
.divider { height: 1px; background: var(--line-1); border: 0; margin: var(--s-8) 0; width: 100%; }
.v-divider { width: 1px; background: var(--line-1); align-self: stretch; }

/* ── Tags / pill row ─────────────────────────────────── */
.scroll-x {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* ── Icons (stroke utility) ─────────────────────────── */
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 22px; height: 22px; }

/* ── Avatar ────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: var(--r-full);
  background: linear-gradient(135deg, oklch(0.55 0.06 60), oklch(0.42 0.04 30));
  display: grid; place-items: center;
  color: var(--ink-0); font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  box-shadow: 0 0 0 1px var(--line-1);
  flex: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.b2 { background: linear-gradient(135deg, oklch(0.55 0.06 200), oklch(0.40 0.04 220)); }
.avatar.b3 { background: linear-gradient(135deg, oklch(0.55 0.06 150), oklch(0.40 0.04 165)); }
.avatar.b4 { background: linear-gradient(135deg, oklch(0.55 0.07 30), oklch(0.40 0.05 15)); }
.avatar.b5 { background: linear-gradient(135deg, oklch(0.55 0.06 280), oklch(0.40 0.04 270)); }

/* ── Page wrapper ─────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.page-main { flex: 1; }

/* ── Footer ─────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line-1);
  padding: var(--s-12) 0 var(--s-8);
  margin-top: var(--s-20);
  background: var(--bg-0);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-10); }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: var(--s-4); font-weight: 500; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--ink-1); font-size: 14px; }
.footer-col a:hover { color: var(--ink-0); }
.footer-legal { display: flex; justify-content: space-between; align-items: center; padding-top: var(--s-6); margin-top: var(--s-8); border-top: 1px solid var(--line-1); color: var(--ink-2); font-size: 12px; font-family: var(--font-mono); }

/* ── Sidebar (dashboard) ──────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-0);
  border-right: 1px solid var(--line-1);
  padding: var(--s-6) var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-2);
  position: sticky; top: 0; align-self: start; height: 100vh;
}
.sidebar-section { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: var(--s-4) var(--s-3) var(--s-2); }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--ink-1); font-size: 14px;
  cursor: pointer; transition: all var(--t-fast);
}
.sidebar-item:hover { background: var(--bg-2); color: var(--ink-0); }
.sidebar-item.active { background: var(--bg-2); color: var(--ink-0); box-shadow: 0 0 0 1px var(--line-1) inset; }
.sidebar-item.active .i { color: var(--accent); }

/* ── Stat tiles ─────────────────────────────────────── */
.stat-tile { padding: var(--s-5); display: flex; flex-direction: column; gap: 8px; }
.stat-tile .stat-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.stat-tile .stat-value { font-family: var(--font-mono); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; }
.stat-tile .stat-delta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.stat-tile .stat-delta.up { color: var(--success); }
.stat-tile .stat-delta.down { color: var(--danger); }

/* ── Tables ─────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line-1); font-size: 14px; }
.table th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.table tr:hover td { background: var(--bg-1); }

/* ── Misc utilities ─────────────────────────────────── */
.fade-in { animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pill-tab-row {
  display: inline-flex; padding: 4px;
  background: var(--bg-1); border-radius: var(--r-full);
  box-shadow: 0 0 0 1px var(--line-1) inset;
}
.pill-tab {
  padding: 8px 18px; border-radius: var(--r-full);
  font-size: 13px; color: var(--ink-2); cursor: pointer;
  transition: all var(--t-fast);
}
.pill-tab.active { background: var(--bg-3); color: var(--ink-0); box-shadow: 0 0 0 1px var(--line-1); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); flex: none; }
.dot.live { background: var(--success); box-shadow: 0 0 0 4px oklch(0.78 0.12 155 / 0.18); }
.dot.warn { background: var(--warn); }

.kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; background: var(--bg-2); border-radius: 4px; box-shadow: 0 0 0 1px var(--line-1) inset; color: var(--ink-2); }

/* responsive */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .container, .container-wide { padding: 0 var(--s-5); }
}
