/* ============================================================
   Project Dashboard – projects.websitereactor.com
   Dual-theme (dark default / light) design system.
   Every colour is a token so the theme flip is a single attribute.
   ============================================================ */

/* ── Dark (default) ─────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  --bg-base:        #08080d;
  --bg-surface:     #0e0f17;
  --bg-card:        #13141f;
  --bg-elevated:    #191b28;
  --bg-input:       #0b0c14;
  --bg-hover:       rgba(255,255,255,0.04);

  --border:         #1e2133;
  --border-strong:  #2a2e47;

  --text-primary:   #e9ebf2;
  --text-secondary: #99a1bf;
  --text-muted:     #5d6482;

  --accent:         #6366f1;
  --accent-bright:  #818cf8;
  --accent-contrast:#ffffff;
  --accent-soft:    rgba(99,102,241,0.14);

  --green:          #22c55e;
  --green-soft:     rgba(34,197,94,0.13);
  --amber:          #f59e0b;
  --amber-soft:     rgba(245,158,11,0.13);
  --red:            #ef4444;
  --red-soft:       rgba(239,68,68,0.13);
  --cyan:           #06b6d4;
  --violet:         #a855f7;
  --rose:           #f43f5e;
  --blue:           #3b82f6;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.5);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:  0 24px 60px rgba(0,0,0,0.6);
  --card-ring:  inset 0 0 0 1px var(--border);

  --aurora-1: rgba(99,102,241,0.30);
  --aurora-2: rgba(6,182,212,0.20);
  color-scheme: dark;
}

/* ── Light ──────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg-base:        #f6f7fb;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-elevated:    #ffffff;
  --bg-input:       #f8f9fc;
  --bg-hover:       rgba(15,23,42,0.04);

  --border:         #e4e7f0;
  --border-strong:  #cdd3e3;

  --text-primary:   #131725;
  --text-secondary: #5a6480;
  --text-muted:     #8e97b0;

  --accent:         #5457e5;
  --accent-bright:  #4f46e5;
  --accent-contrast:#ffffff;
  --accent-soft:    rgba(84,87,229,0.10);

  --green:          #16a34a;
  --green-soft:     rgba(22,163,74,0.11);
  --amber:          #d97706;
  --amber-soft:     rgba(217,119,6,0.12);
  --red:            #dc2626;
  --red-soft:       rgba(220,38,38,0.10);
  --cyan:           #0891b2;
  --violet:         #9333ea;
  --rose:           #e11d48;
  --blue:           #2563eb;

  --shadow-sm:  0 1px 2px rgba(15,23,42,0.06);
  --shadow-md:  0 4px 16px rgba(15,23,42,0.08);
  --shadow-lg:  0 24px 60px rgba(15,23,42,0.16);
  --card-ring:  inset 0 0 0 1px var(--border);

  --aurora-1: rgba(99,102,241,0.22);
  --aurora-2: rgba(6,182,212,0.16);
  color-scheme: light;
}

/* Shared scale tokens */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'Courier New', monospace;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --topbar-h:  62px;
  --content-max: 1440px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* The [hidden] attribute must beat the component rules below that set an
   explicit display (.drawer is display:flex), or a hidden drawer would still
   paint and swallow every click on the page. */
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background-color .16s var(--ease), border-color .16s var(--ease),
              transform .12s var(--ease), box-shadow .16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.btn-primary {
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-bright); }

.btn-ghost { border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-danger-ghost { border-color: var(--border); color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: var(--red); }

.btn-sm { padding: 6px 12px; font-size: .8125rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* Theme toggle shows exactly one glyph per theme */
:root[data-theme="dark"]  #theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"]  #theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] #theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] #theme-toggle .icon-moon { display: block; }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: .8125rem; color: var(--text-muted); }
.hint code {
  font-family: var(--font-mono); font-size: .78em;
  background: var(--bg-hover); padding: 1px 5px; border-radius: 4px;
}

/* Accent swatches */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  background: var(--sw); position: relative;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active {
  border-color: var(--bg-card);
  box-shadow: 0 0 0 2px var(--sw);
}

/* Live switch */
.switch-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; margin-top: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  flex: none; width: 46px; height: 26px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  transition: background-color .2s var(--ease);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease);
}
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
.switch-label { display: flex; flex-direction: column; }
.switch-label strong { font-size: .9375rem; font-weight: 600; }
.switch-label small { font-size: .8125rem; color: var(--text-muted); }

/* ============================================================
   Login
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px; position: relative; overflow: hidden;
}
.login-aurora {
  position: absolute; inset: -30%;
  background:
    radial-gradient(45% 45% at 25% 30%, var(--aurora-1), transparent 70%),
    radial-gradient(40% 40% at 75% 70%, var(--aurora-2), transparent 70%);
  filter: blur(40px);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.1); }
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  padding: 36px 32px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login-mark {
  width: 52px; height: 52px; margin-bottom: 18px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--accent), var(--cyan));
  color: #fff;
}
.login-mark .icon { width: 26px; height: 26px; }
.login-card h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.login-sub { font-size: .875rem; color: var(--text-muted); margin-bottom: 26px; }
.login-error {
  margin-top: 14px; padding: 10px 12px;
  background: var(--red-soft); border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red); font-size: .875rem;
}
.login-foot {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: .8125rem; color: var(--text-muted); text-align: center;
}
.login-foot strong { color: var(--text-secondary); font-weight: 600; }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--content-max); height: 100%; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 22px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--cyan));
}
.brand-mark .icon { width: 17px; height: 17px; }

.constellation { display: flex; gap: 2px; margin-left: 6px; }
.const-link {
  padding: 6px 13px; border-radius: 999px;
  font-size: .875rem; font-weight: 500; color: var(--text-secondary);
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.const-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.const-link.is-current { background: var(--accent-soft); color: var(--accent-bright); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box .icon {
  position: absolute; left: 11px; width: 16px; height: 16px;
  color: var(--text-muted); pointer-events: none;
}
.search-box input {
  width: 210px; padding: 8px 12px 8px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: .875rem;
  transition: width .2s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search-box input:focus {
  outline: none; width: 260px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.user-chip {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--violet));
  color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em;
}

/* ============================================================
   Page head + stats
   ============================================================ */
.app { max-width: var(--content-max); margin: 0 auto; padding: 34px 24px 80px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 26px;
}
.page-head h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.025em; }
.page-sub { font-size: .9375rem; color: var(--text-muted); }
.page-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.filter-pills {
  display: flex; gap: 3px; padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 999px;
}
.pill {
  padding: 6px 14px; border: none; border-radius: 999px;
  background: transparent; color: var(--text-secondary);
  font-size: .8125rem; font-weight: 500; cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.pill:hover { color: var(--text-primary); }
.pill.is-active { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.stat {
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: var(--radius); box-shadow: var(--card-ring), var(--shadow-sm);
}
.stat-label {
  font-size: .6875rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
}
.stat-value {
  font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em;
  line-height: 1.2; margin-top: 4px;
}
.stat-value.is-green { color: var(--green); }
.stat-value.is-amber { color: var(--amber); }

/* ============================================================
   Project cards
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.card {
  --accent-c: var(--blue);
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-ring), var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-ring), var(--shadow-md);
}
/* Accent hairline along the top edge */
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-c), transparent 85%);
}

.card-accent-blue   { --accent-c: var(--blue); }
.card-accent-violet { --accent-c: var(--violet); }
.card-accent-green  { --accent-c: var(--green); }
.card-accent-amber  { --accent-c: var(--amber); }
.card-accent-rose   { --accent-c: var(--rose); }
.card-accent-cyan   { --accent-c: var(--cyan); }

.card-head { padding: 18px 20px 14px; display: flex; align-items: flex-start; gap: 14px; }
.card-title-wrap { flex: 1; min-width: 0; }
.card-title {
  font-size: 1.0625rem; font-weight: 650; letter-spacing: -.015em;
  line-height: 1.35; word-break: break-word;
}
.card-client { font-size: .8125rem; color: var(--text-muted); margin-top: 2px; }

/* ── The LED ── */
.led-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-input); cursor: pointer;
  font-size: .6875rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  transition: border-color .16s var(--ease), color .16s var(--ease), background-color .16s var(--ease);
}
.led-btn:hover { border-color: var(--border-strong); }
.led-btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.led {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--text-muted); opacity: .45;
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease), opacity .2s var(--ease);
}
.led-btn.is-live { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.led-btn.is-live .led {
  background: var(--green); opacity: 1;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent);
  animation: led-pulse 2.4s var(--ease) infinite;
}
@keyframes led-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.card-body { padding: 0 20px; flex: 1; }

.status-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .6875rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--bg-hover); color: var(--text-secondary);
  margin-bottom: 14px;
}
.status-live     { background: var(--green-soft); color: var(--green); }
.status-building { background: var(--accent-soft); color: var(--accent-bright); }
.status-review   { background: var(--amber-soft); color: var(--amber); }
.status-paused   { background: var(--red-soft);   color: var(--red); }

.note-block { margin-bottom: 16px; }
.note-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.note-label .icon { width: 13px; height: 13px; }
.note-text { font-size: .875rem; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

.todo-list { display: flex; flex-direction: column; gap: 5px; }
.todo-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .875rem; color: var(--text-secondary); line-height: 1.5;
}
.todo-dot {
  width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: var(--accent-c); margin-top: .5em; opacity: .8;
}
.todo-more { font-size: .8125rem; color: var(--text-muted); font-style: italic; padding-left: 13px; }

.scratch-peek {
  margin: 0 0 16px;
  padding: 11px 13px;
  background: var(--bg-input);
  border-left: 2px solid var(--accent-c);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
  font-size: .78rem; line-height: 1.55; color: var(--text-muted);
  white-space: pre-wrap;
  max-height: 68px; overflow: hidden;
  position: relative;
}
.scratch-peek::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background: linear-gradient(transparent, var(--bg-input));
}

.card-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 20px; margin-top: auto;
  border-top: 1px solid var(--border);
}
.card-foot .spacer { flex: 1; }
/* Used on both <a> and <button>, so the UA button background/border must be
   reset explicitly — otherwise buttonface grey shows through in dark mode. */
.link-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: .78rem; font-weight: 500;
  color: var(--text-muted);
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.link-chip:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.link-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.link-chip .icon { width: 13px; height: 13px; }

/* ============================================================
   Empty state
   ============================================================ */
.empty { text-align: center; padding: 70px 24px; color: var(--text-muted); }
.empty .icon { width: 40px; height: 40px; margin-bottom: 14px; opacity: .5; }
.empty h2 { font-size: 1.125rem; font-weight: 600; color: var(--text-secondary); }
.empty p { font-size: .9375rem; margin-top: 4px; }

/* ============================================================
   Drawer
   ============================================================ */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: min(560px, 100vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slide-in .26s var(--ease);
}
@keyframes slide-in { from { transform: translateX(100%) } to { transform: none } }
.drawer form { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 1.125rem; font-weight: 650; letter-spacing: -.01em; }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; min-height: 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 9px 15px; border: none; background: transparent;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: .875rem; font-weight: 500; color: var(--text-muted); cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--accent-bright); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade-in .18s var(--ease); }

.scratch-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.save-state { font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.save-state.is-saved { color: var(--green); }

.scratchpad {
  width: 100%; min-height: 380px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .8125rem; line-height: 1.7;
  resize: vertical;
}
.scratchpad:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.drawer-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.drawer-foot .spacer { flex: 1; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; min-width: 230px;
  background: var(--bg-elevated);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  font-size: .875rem;
  animation: toast-in .24s var(--ease);
}
.toast.is-ok    { border-left-color: var(--green); }
.toast.is-error { border-left-color: var(--red); }
.toast.is-out   { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(16px) } to { opacity: 1; transform: none } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(16px) } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .constellation { display: none; }
  .search-box input { width: 150px; }
  .search-box input:focus { width: 190px; }
}
@media (max-width: 640px) {
  .app { padding: 24px 16px 60px; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .search-box { display: none; }
  .grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .filter-pills { overflow-x: auto; max-width: 100%; }
}
