/* =========================================================
   Tidewell Studio — Shared Design System (theme: Graphite & Indigo)
   Extracted from per-page <style> blocks. Pages may override
   any of these rules with their own inline <style> (which
   appears AFTER this <link> in <head>).
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --navy: #18181b;
  --navy-deep: #0c0c0e;
  --navy-soft: #2e2e35;
  --navy-tint: #eeeef2;
  --orange: #4f46e5;
  --orange-deep: #4338ca;
  --orange-soft: #e0e0fc;
  --orange-tint: #f3f3fe;
  /* Accent text and rules on dark (navy) surfaces */
  --orange-light: #a5b4fc;
  /* RGB triplets of the theme colors, for rgba(var(--x-rgb), alpha) */
  --navy-rgb: 24, 24, 27;
  --navy-deep-rgb: 12, 12, 14;
  --navy-soft-rgb: 46, 46, 53;
  --orange-rgb: 79, 70, 229;
  --orange-deep-rgb: 67, 56, 202;
  --bone-rgb: 247, 247, 248;

  --white: #ffffff;
  --bone: #f7f7f8;
  --paper: #efeff2;
  --slate-900: #1a1a22;
  --slate-700: #3a3a45;
  --slate-500: #6b6b78;
  --slate-400: #9a9aa4;
  --slate-300: #c4c4cc;
  --slate-200: #dedee3;
  --slate-100: #ebebef;
  --slate-50:  #f6f6f9;

  --success: #2e7d32;
  --success-soft: #e6f4e8;
  --warning: #f9a825;
  --warning-soft: #fff5dc;
  --danger: #c62828;
  --danger-soft: #fce8e8;
  --info: #1565c0;
  --info-soft: #e3f0fb;
  --purple: #6a1b9a;
  --purple-soft: #f3e5f5;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --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;

  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px;

  --shadow-sm: 0 1px 2px rgba(var(--navy-deep-rgb), 0.05);
  --shadow-md: 0 4px 12px rgba(var(--navy-deep-rgb), 0.06);
  --shadow-lg: 0 12px 32px rgba(var(--navy-deep-rgb), 0.10);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-w: 248px;
  --topbar-h: 68px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--slate-900);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.5s var(--ease-out) both; }
.fade-in.d1 { animation-delay: 0.05s; }
.fade-in.d2 { animation-delay: 0.1s; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--navy);
  color: var(--white);
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 20% 0%, rgba(var(--orange-rgb), 0.14), transparent 60%);
  z-index: -1;
}

.sidebar-logo {
  padding: var(--s-3) var(--s-2) var(--s-6);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo svg { height: 28px; width: auto; display: block; }

.nav-group { margin-bottom: var(--s-5); }
.nav-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 2px;
  position: relative;
  transition: all 0.18s var(--ease);
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--white); }
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--orange);
  border-radius: 0 2px 2px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.nav-soon {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-footer { margin-top: auto; padding-top: var(--s-4); }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.18s var(--ease);
}
.user-card:hover { background: rgba(255, 255, 255, 0.09); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: var(--white);
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.86rem; font-weight: 600; color: var(--white); }
.user-role { font-size: 0.72rem; color: rgba(255, 255, 255, 0.55); }
.user-card svg { width: 14px; height: 14px; color: rgba(255, 255, 255, 0.5); flex-shrink: 0; }

/* ---------- TOPBAR ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(var(--bone-rgb), 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  padding: 0 var(--s-8);
  gap: var(--s-5);
}
.topbar-title h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--navy);
  letter-spacing: -0.01em;
  line-height: 1;
}
.topbar-title p { font-size: 0.78rem; color: var(--slate-500); margin-top: 2px; }

/* ---------- SEARCH ---------- */
.search {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin-left: auto;
}
.search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search input:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(var(--navy-rgb), 0.08); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--slate-400); }
.search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  background: var(--slate-100);
  color: var(--slate-500);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--slate-200);
}

/* ---------- ICON BUTTON ---------- */
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--white);
  border: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-700);
  transition: all 0.18s var(--ease);
}
.icon-btn:hover { border-color: var(--navy); color: var(--navy); }
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--orange);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}

/* ---------- BUTTONS ---------- */
.btn-create {
  height: 38px;
  padding: 0 16px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(var(--orange-deep-rgb), 0.2), 0 4px 12px rgba(var(--orange-deep-rgb), 0.16);
  transition: all 0.18s var(--ease);
  position: relative;
}
.btn-create:hover { background: var(--orange-deep); }
.btn-create svg { width: 14px; height: 14px; }

.btn-primary {
  height: 38px;
  padding: 0 16px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s var(--ease);
}
.btn-primary:hover { background: var(--navy-deep); }
.btn-primary svg { width: 14px; height: 14px; }

.btn-secondary {
  height: 38px;
  padding: 0 14px;
  background: var(--white);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s var(--ease);
}
.btn-secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn-secondary svg { width: 14px; height: 14px; }

.btn-orange {
  height: 38px;
  padding: 0 16px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s var(--ease);
  box-shadow: 0 1px 2px rgba(var(--orange-deep-rgb), 0.2), 0 4px 12px rgba(var(--orange-deep-rgb), 0.16);
}
.btn-orange:hover { background: var(--orange-deep); }
.btn-orange svg { width: 14px; height: 14px; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--slate-200);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s var(--ease);
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger svg { width: 14px; height: 14px; }

/* ---------- DROPDOWN ---------- */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: var(--s-2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.18s var(--ease);
  z-index: 100;
}
.dropdown.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  color: var(--slate-700);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.dropdown-item:hover { background: var(--paper); color: var(--navy); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--slate-500); }
.dropdown-divider { height: 1px; background: var(--slate-100); margin: var(--s-2) 0; }
.dropdown-header {
  padding: var(--s-3);
  border-bottom: 1px solid var(--slate-100);
  margin-bottom: var(--s-2);
}
.dropdown-header .name { font-weight: 600; color: var(--navy); font-size: 0.92rem; }
.dropdown-header .email { font-size: 0.78rem; color: var(--slate-500); margin-top: 2px; }

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main { padding: var(--s-6) var(--s-8) var(--s-12); }

/* ---------- PAGE HEAD (h1 form, used by 6 pages) ---------- */
.page-head {
  margin-bottom: var(--s-6);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.2rem;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.page-head h1 em { font-style: italic; font-weight: 300; color: var(--orange); }
.page-head p { font-size: 0.92rem; color: var(--slate-500); }

/* ---------- KPI STRIP ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); margin-bottom: var(--s-6); }
.kpi-mini {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  padding: var(--s-4);
  position: relative;
  overflow: hidden;
}
.kpi-mini.attn { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-tint); }
.kpi-mini-label {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-500);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-dot { width: 8px; height: 8px; border-radius: 50%; }
.kpi-mini-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; color: var(--navy); letter-spacing: -0.01em; line-height: 1; }
.kpi-mini-sub { font-size: 0.78rem; color: var(--slate-500); margin-top: 4px; }
.kpi-mini-sub.warn { color: var(--danger); font-weight: 500; }
.kpi-mini-sub.good { color: var(--success); font-weight: 500; }

/* ---------- CARD ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-5);
  overflow: hidden;
}
.card-head {
  padding: var(--s-5) var(--s-5) var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  border-bottom: 1px solid var(--slate-100);
}
.card-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.card-head p { font-size: 0.78rem; color: var(--slate-500); margin-top: 2px; }

/* ---------- TABLES (generic) ---------- */
.table-wrap { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--r-lg); overflow: hidden; }

/* ---------- ROW CHECK (table checkbox) ---------- */
.row-check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--slate-300);
  border-radius: 4px;
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.row-check:hover { border-color: var(--navy); }
.row-check.checked { background: var(--success); border-color: var(--success); }
.row-check svg { width: 10px; height: 10px; stroke: white; stroke-width: 3; fill: none; opacity: 0; }
.row-check.checked svg { opacity: 1; }

/* ---------- TASK ROW HELPERS ---------- */
.task-title { font-weight: 500; color: var(--slate-900); font-size: 0.92rem; }
.task-meta { font-size: 0.76rem; color: var(--slate-500); margin-top: 2px; }

/* ---------- OWNER CELL ---------- */
.owner-cell { display: flex; align-items: center; gap: 8px; }
.owner-avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 0.68rem; font-weight: 600; flex-shrink: 0; }
.owner-name { font-size: 0.84rem; color: var(--slate-700); white-space: nowrap; }

/* ---------- DUE CELL ---------- */
.due-cell { font-size: 0.84rem; color: var(--slate-700); white-space: nowrap; }
.due-cell.urgent { color: var(--danger); font-weight: 600; }

/* ---------- PILL ---------- */
.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-block;
}
.pill.gray { background: var(--slate-100); color: var(--slate-700); }
.pill.yellow { background: var(--warning-soft); color: #8a6500; }
.pill.green { background: var(--success-soft); color: var(--success); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }
.pill.navy { background: var(--navy-tint); color: var(--navy); }

/* ---------- ACTIONS BUTTON (table row) ---------- */
.actions-btn {
  background: transparent;
  border: none;
  width: 30px; height: 30px;
  border-radius: 6px;
  color: var(--slate-400);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
}
.actions-btn:hover { background: var(--slate-100); color: var(--navy); }
.actions-btn svg { width: 14px; height: 14px; }

/* =========================================================
   DRAWER (right-side panel for forms)
   ========================================================= */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(var(--navy-deep-rgb), 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  z-index: 200;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0;
  width: 480px; max-width: 100vw;
  height: 100vh;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.32s var(--ease-out);
  display: flex;
  flex-direction: column;
  z-index: 201;
}
.drawer.show { transform: translateX(0); }
.drawer-header {
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-shrink: 0;
}
.drawer-header h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; color: var(--navy); letter-spacing: -0.01em; }
.drawer-header p { font-size: 0.78rem; color: var(--slate-500); margin-top: 2px; }
.drawer-close {
  width: 32px; height: 32px; border-radius: 6px;
  background: transparent; border: none;
  color: var(--slate-500);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s var(--ease);
}
.drawer-close:hover { background: var(--slate-100); color: var(--navy); }
.drawer-close svg { width: 16px; height: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-6); }
.drawer-footer {
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--slate-200);
  display: flex;
  gap: var(--s-3);
  align-items: center;
  flex-shrink: 0;
  background: var(--slate-50);
}
.drawer-footer .grow { margin-left: auto; display: flex; gap: var(--s-2); }

/* ---------- FORM CONTROLS (drawer / modal) ---------- */
.form-field { margin-bottom: var(--s-4); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-bottom: var(--s-4); }
.form-row-2 .form-field { margin-bottom: 0; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--slate-700); letter-spacing: 0.02em; margin-bottom: 6px; }
.form-label .req { color: var(--orange); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--r-md);
  font-size: 0.92rem;
  color: var(--slate-900);
  background: var(--white);
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(var(--navy-rgb), 0.08); }
textarea.form-control { resize: vertical; min-height: 80px; font-family: inherit; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* =========================================================
   LEGEND (used by blog/social/timeline/raci)
   ========================================================= */
.legend {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 10px var(--s-4);
  margin-bottom: var(--s-3);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  font-size: 0.78rem;
  color: var(--slate-500);
  flex-wrap: wrap;
}
.legend-label { font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.7rem; color: var(--slate-500); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  top: var(--s-6);
  right: var(--s-6);
  background: var(--white);
  border-left: 3px solid var(--navy);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  transform: translateX(120%);
  transition: transform 0.4s var(--ease-out);
  z-index: 300;
  max-width: 420px;
}
.toast.show { transform: translateX(0); }
.toast.info { border-left-color: var(--info); }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.danger { border-left-color: var(--danger); }
.toast svg { flex-shrink: 0; color: inherit; }
.toast strong { display: block; font-weight: 600; margin-bottom: 2px; }

/* =========================================================
   RESPONSIVE — sidebar collapse + reduced motion
   (Page-specific responsive overrides stay inline.)
   ========================================================= */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--s-4); }
  .main { padding: var(--s-5); }
  .search { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Import-from-Claude drawer (shared by blog.html + social.html) ===== */
.imp-step { display: flex; gap: var(--s-4); margin-bottom: var(--s-8); }
.imp-step-num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 0.86rem; font-weight: 600; font-family: var(--font-display); margin-top: 2px; }
.imp-step-content { flex: 1; min-width: 0; }
.imp-step-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; color: var(--navy); margin-bottom: 4px; letter-spacing: -0.005em; }
.imp-step-sub { font-size: 0.84rem; color: var(--slate-500); margin-bottom: var(--s-3); line-height: 1.45; }
.imp-prompt-out, .imp-json-in { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.5; resize: vertical; }
.imp-prompt-out { background: var(--paper); color: var(--slate-700); }
.imp-preview { margin-top: var(--s-3); font-size: 0.86rem; }
.imp-preview-ok { padding: 10px 12px; background: var(--success-soft); color: var(--success); border-radius: var(--r-sm); margin-bottom: 6px; }
.imp-preview-ok strong { font-size: 1rem; }
.imp-preview-warn { padding: 10px 12px; background: var(--warning-soft); color: #856e0a; border-radius: var(--r-sm); margin-bottom: 6px; }
.imp-preview-err { padding: 10px 12px; background: var(--danger-soft); color: var(--danger); border-radius: var(--r-sm); }
.imp-preview-errors { margin: 6px 0 6px 18px; padding: 0; font-size: 0.8rem; color: var(--slate-700); }
.imp-preview-errors li { margin-bottom: 2px; }

/* ===== Guided product tour (tour.js) ===== */
.tour-launch { position: fixed; right: 24px; bottom: 24px; z-index: 900; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border: none; border-radius: 999px; background: var(--navy); color: var(--white); font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow-lg); transition: transform 0.15s var(--ease), background 0.15s var(--ease); }
.tour-launch:hover { background: var(--navy-soft); transform: translateY(-1px); }
.tour-launch svg { width: 16px; height: 16px; }
.tour-launch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.3); }
body.tour-on .tour-launch { display: none; }

.tour-block { position: fixed; inset: 0; z-index: 1000; }
.tour-spot { position: fixed; z-index: 1001; border-radius: var(--r-md); box-shadow: 0 0 0 4px var(--orange), 0 0 0 9999px rgba(var(--navy-deep-rgb), 0.58); pointer-events: none; transition: all 0.3s var(--ease-out); }
.tour-spot.none { box-shadow: 0 0 0 9999px rgba(var(--navy-deep-rgb), 0.58); width: 0 !important; height: 0 !important; left: 50% !important; top: 50% !important; }

.tour-card { position: fixed; z-index: 1002; width: 360px; max-width: calc(100vw - 32px); background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: var(--s-5) var(--s-6) var(--s-4); animation: fadeUp 0.25s var(--ease-out); }
.tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: 440px; animation: none; }
.tour-eyebrow { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-deep); margin-bottom: var(--s-2); }
.tour-x { background: none; border: none; color: var(--slate-400); font-size: 1.2rem; line-height: 1; padding: 2px 4px; }
.tour-x:hover { color: var(--slate-700); }
.tour-card h4 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; color: var(--navy); letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.tour-card p { font-size: 0.9rem; line-height: 1.55; color: var(--slate-700); }
.tour-card p + p { margin-top: var(--s-2); }
.tour-try { margin-top: var(--s-3); padding: 8px 12px; background: var(--orange-tint); border-radius: var(--r-sm); font-size: 0.82rem; color: var(--slate-700); }
.tour-try strong { color: var(--orange-deep); }
.tour-foot { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-4); }
.tour-bar { flex: 1; height: 4px; background: var(--slate-100); border-radius: 2px; overflow: hidden; }
.tour-bar span { display: block; height: 100%; background: var(--orange); border-radius: 2px; }
.tour-btn { height: 34px; padding: 0 14px; border-radius: var(--r-sm); font-size: 0.84rem; font-weight: 600; border: 1px solid var(--slate-200); background: var(--white); color: var(--slate-700); }
.tour-btn:hover { border-color: var(--slate-300); }
.tour-btn.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.tour-btn.primary:hover { background: var(--navy-soft); }
.tour-btn[disabled] { opacity: 0.4; cursor: default; }
.tour-chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: var(--s-4); }
.tour-chapters button { text-align: left; padding: 8px 10px; border: 1px solid var(--slate-200); border-radius: var(--r-sm); background: var(--white); font-size: 0.8rem; color: var(--slate-700); }
.tour-chapters button:hover { border-color: var(--orange); background: var(--orange-tint); }
.tour-chapters b { display: block; color: var(--navy); font-weight: 600; }

/* =========================================================
   AIWHIRKS DEMO CHROME (not part of the app being demonstrated)
   ========================================================= */
:root { --demo-strip-h: 32px; }
.demo-strip { position: sticky; top: 0; z-index: 950; height: var(--demo-strip-h); background: #2B2F36; color: #E6E9ED; font: 13px/1.4 system-ui, sans-serif; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 16px; }
.demo-strip a { color: #fff; text-decoration: underline; white-space: nowrap; }
.sidebar { top: var(--demo-strip-h); height: calc(100vh - var(--demo-strip-h)); }
.topbar { top: var(--demo-strip-h); }
.app { min-height: calc(100vh - var(--demo-strip-h)); }
@media (max-width: 560px) {
  .demo-strip { position: static; height: auto; padding: 8px 16px; flex-wrap: wrap; }
  .sidebar, .topbar { top: 0; }
}

.demo-pick { background: var(--orange-tint); border: 2px solid var(--orange); border-radius: var(--r-md); padding: 14px; margin: calc(-1 * var(--s-5)) 0 var(--s-6); font-size: 0.9rem; color: var(--slate-700); }
.demo-pick > p:first-child { margin: 0 0 10px; }
.demo-pick b { color: var(--navy); }
.demo-pick-btns { display: grid; gap: 8px; margin-bottom: 10px; }
.demo-pick button { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 8px 14px; line-height: 1.25; text-align: right; background: var(--white); border: 2px solid var(--navy); border-radius: var(--r-md); color: var(--navy); font: 600 1rem/1.25 inherit; cursor: pointer; }
.demo-pick button:hover { background: var(--slate-50); }
.demo-pick button span { font-size: 0.82rem; font-weight: 400; color: var(--slate-500); }
.demo-pick .small { margin: 0; font-size: 0.84rem; color: var(--slate-500); }
/* Keep wide tables scrolling inside their card instead of widening the whole page. */
.app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
@media (max-width: 880px) { .app { grid-template-columns: minmax(0, 1fr); } }
.demo-pick button b { white-space: nowrap; }

/* =========================================================
   THEMES - picked with the "Try another look" switcher (theme.js).
   Graphite & Indigo is the default in :root above; these override
   only the brand tokens. Grays and status colors stay shared.
   ========================================================= */
html[data-theme="plum"] {
  --navy: #3b2350; --navy-deep: #2a1839; --navy-soft: #55346f; --navy-tint: #f1eaf5;
  --orange: #c2410c; --orange-deep: #9a3412; --orange-soft: #fde3d3; --orange-tint: #fff4ec;
  --orange-light: #fdba74;
  --navy-rgb: 59, 35, 80; --navy-deep-rgb: 42, 24, 57; --navy-soft-rgb: 85, 52, 111;
  --orange-rgb: 194, 65, 12; --orange-deep-rgb: 154, 52, 18; --bone-rgb: 250, 247, 245;
  --bone: #faf7f5; --paper: #f4f0ee;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
}
html[data-theme="forest"] {
  --navy: #1f3d33; --navy-deep: #142a23; --navy-soft: #2f5a4b; --navy-tint: #e8f0ec;
  --orange: #b45309; --orange-deep: #92400e; --orange-soft: #fbe7cf; --orange-tint: #fdf6ec;
  --orange-light: #f3c27a;
  --navy-rgb: 31, 61, 51; --navy-deep-rgb: 20, 42, 35; --navy-soft-rgb: 47, 90, 75;
  --orange-rgb: 180, 83, 9; --orange-deep-rgb: 146, 64, 14; --bone-rgb: 248, 247, 242;
  --bone: #f8f7f2; --paper: #f1efe7;
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
}

/* Theme switcher in the demo strip (AIwhirks demo chrome) */
.demo-theme { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.demo-theme-label { color: #E6E9ED; white-space: nowrap; }
.demo-theme button { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 6px; border: 1px solid rgba(255,255,255,.22); border-radius: 100px; background: transparent; color: #E6E9ED; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.demo-theme button:hover { border-color: rgba(255,255,255,.55); color: #fff; }
.demo-theme button[aria-pressed="true"] { background: #fff; border-color: #fff; color: #1d1f24; font-weight: 600; }
.demo-theme-dots { display: inline-flex; }
.demo-theme-dots i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); }
.demo-theme-dots i + i { margin-left: -4px; }
.demo-theme-sheet { margin-left: 4px; }
@media (max-width: 1100px) { .demo-theme-label { display: none; } }

/* =========================================================
   MOBILE + TABLET (below 880px the sidebar is hidden)
   mobile-nav.js adds an iOS-style tab bar and a "More" sheet;
   these rules size the chrome and pages around it.
   ========================================================= */
.demo-strip-short, .tabbar, .sheet, .sheet-backdrop { display: none; }
:root { --tabbar-h: 56px; --tabbar-total: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 880px) {
  /* Demo strip: one compact row that scrolls away; the full text lives in the More sheet. */
  :root { --demo-strip-h: 36px; }
  .demo-strip { position: static; height: var(--demo-strip-h); padding: 0 12px; flex-wrap: nowrap; gap: 8px; font-size: 12px; }
  .demo-strip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .demo-strip-long, .demo-theme-label, .demo-theme-name { display: none; }
  .demo-strip-short { display: inline; }
  .demo-theme { margin-left: auto; width: auto; flex-wrap: nowrap; gap: 4px; }
  .demo-theme button { width: 30px; height: 26px; padding: 0; justify-content: center; }
  .demo-theme button[aria-pressed="true"] { background: rgba(255,255,255,.18); border-color: #fff; }
  .demo-theme-sheet { margin-left: 6px; }
  .demo-strip > a[href="login.html"] { display: none; }
  /* No tab bar (sign-in): leave room so the tour button never covers the form. */
  body:not(.has-tabbar) { padding-bottom: 76px; }
  .sidebar, .topbar { top: 0; }

  /* Top bar as an iOS navigation bar: one-line title, compact actions. */
  .topbar { height: auto; min-height: 56px; padding: 8px 16px; gap: 10px; }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar-title h1 { font-size: 1.2rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .icon-btn { width: 40px; height: 40px; flex-shrink: 0; }
  .topbar .icon-btn svg { width: 20px; height: 20px; }
  .topbar .btn-create { width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 0; gap: 0; flex-shrink: 0; }
  .topbar .btn-create svg { width: 18px; height: 18px; }
  .main { padding: 20px 16px 32px; }

  /* Tab bar */
  body.has-tabbar { padding-bottom: var(--tabbar-total); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 180; height: var(--tabbar-total); padding-bottom: env(safe-area-inset-bottom, 0px); background: rgba(var(--bone-rgb), 0.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid rgba(var(--navy-rgb), 0.18); }
  .tb-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px 4px; background: none; border: 0; color: var(--slate-500); text-decoration: none; font: inherit; -webkit-tap-highlight-color: transparent; cursor: pointer; }
  .tb-icon { position: relative; display: block; width: 26px; height: 26px; }
  .tb-icon svg { width: 26px; height: 26px; stroke-width: 1.8; }
  .tb-label { font-size: 10.5px; font-weight: 500; letter-spacing: .01em; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tb-item.active { color: var(--orange); }
  .tb-item.active .tb-icon svg { stroke-width: 2.2; }
  .tb-item:active .tb-icon { transform: scale(.92); }
  .tb-badge { position: absolute; top: -4px; left: 17px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--bone); }
  .tb-item:focus-visible { outline: 2px solid var(--orange); outline-offset: -4px; border-radius: 10px; }

  /* More sheet */
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 960; background: rgba(0,0,0,.32); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 961; max-height: 88dvh; background: #f2f2f7; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,.18); transform: translateY(105%); transition: transform .38s cubic-bezier(.32,.72,0,1), visibility .38s; padding-bottom: env(safe-area-inset-bottom, 0px); visibility: hidden; }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  body.sheet-open .sheet { transform: translateY(0); visibility: visible; }
  .sheet-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 18px 16px 10px; touch-action: none; }
  .sheet-grabber { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: rgba(60,60,67,.3); }
  .sheet-head h2 { font: 600 17px/1.3 var(--font-body); color: #000; }
  .sheet-done { position: absolute; right: 8px; top: 12px; padding: 8px 10px; background: none; border: 0; font: 600 17px/1.2 var(--font-body); color: var(--orange); cursor: pointer; }
  .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 20px; }
  .ios-group-label { margin: 22px 16px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: rgba(60,60,67,.6); }
  .ios-group { background: #fff; border-radius: 10px; overflow: hidden; }
  .ios-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 16px; background: none; border: 0; font: 400 16px/1.3 var(--font-body); color: #000; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .ios-row + .ios-row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; border-top: 0.5px solid rgba(60,60,67,.29); }
  .ios-row:active { background: #e5e5ea; }
  .ios-row.current .ios-text { font-weight: 600; color: var(--orange); }
  .ios-tile { flex-shrink: 0; width: 30px; height: 30px; border-radius: 7px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; }
  .ios-tile svg { width: 17px; height: 17px; }
  .ios-text { flex: 1; min-width: 0; }
  .ios-badge { min-width: 22px; padding: 1px 7px; border-radius: 11px; background: #ff3b30; color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
  .ios-chevron { width: 14px; height: 14px; color: rgba(60,60,67,.3); flex-shrink: 0; }
  .ios-check { width: 18px; height: 18px; color: var(--orange); flex-shrink: 0; visibility: hidden; }
  .ios-row[aria-checked="true"] .ios-check { visibility: visible; }
  .ios-row .demo-theme-dots { width: 30px; justify-content: center; }
  .ios-row .demo-theme-dots i { width: 16px; height: 16px; border: 0; box-shadow: 0 0 0 1.5px #fff; }
  .ios-row .demo-theme-dots i + i { margin-left: -5px; }
  .ios-danger .ios-text { color: #ff3b30; }
  .ios-danger .ios-tile { background: #ff3b30; }
  .ios-foot { margin: 14px 16px 0; font-size: 13px; line-height: 1.4; color: rgba(60,60,67,.6); }
  .ios-foot a { color: inherit; }

  /* Floating chrome sits above the tab bar; the tour is started from More. */
  body.has-tabbar .tour-launch { display: none; }
  .toast { top: auto; bottom: calc(var(--tabbar-total) + 12px); left: 12px; right: 12px; max-width: none; transform: translateY(200%); }
  body:not(.has-tabbar) .toast { bottom: 16px; }
  .toast.show { transform: translateY(0); }
  .drawer { height: 100dvh; }
}

@media (max-width: 600px) {
  /* The tour card docks to the bottom like a sheet instead of chasing its target. */
  .tour-card, .tour-card.center { left: 10px !important; right: 10px; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; transform: none; max-height: 70dvh; overflow-y: auto; }
  .tour-launch { right: 16px; bottom: 16px; }
}
