/* ==========================================================================
   Nodify - theme tokens & base
   Ultra-minimalist light mode. White surfaces on a cool gray-blue canvas,
   hairline borders, one crisp network-blue accent. No shadows, no gradients.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #F8FAFC;
  --bg-elev: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F8FAFC;
  --hairline: #E2E8F0;
  --hairline-strong: #CBD5E1;

  /* Type */
  --heading: #0F172A;
  --body: #475569;
  --muted: #64748B;

  /* Accents */
  --accent: #0284C7;
  --accent-hover: #0369A1;
  --accent-bright: #0070F3;
  --accent-soft: rgba(2, 132, 199, 0.08);
  --cyan: #06B6D4;
  --cyan-soft: rgba(6, 182, 212, 0.12);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.10);
  --amber: #D97706;
  --red: #DC2626;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Kept so any legacy reference degrades to "flat". */
  --shadow: none;
  --glow: none;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1120px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
h3 { font-size: 1.08rem; }

p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, .mono, kbd {
  font-family: var(--mono);
  font-size: 0.86em;
}

.mono { color: var(--heading); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.muted { color: var(--muted); }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Buttons: compact, low-profile -------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  color: var(--heading);
  font: inherit;
  font-weight: 500;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--body); }
.btn-ghost:hover { border-color: var(--hairline-strong); color: var(--heading); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 0.78rem; }
.btn-block { width: 100%; }

/* ---- Pills / dots ------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  font-size: 0.78rem;
  color: var(--body);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  flex: none;
}

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px;
}
.card:hover { border-color: var(--hairline-strong); }
.glass {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
}

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.82rem; color: var(--body); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--heading);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.6; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); }
/* An input sitting inline with a button (e.g. email + "Send code") takes the
   remaining width and shrinks cleanly instead of forcing a wrap. */
.field .row > .input { flex: 1 1 auto; width: auto; min-width: 0; }

select.input {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: #E2E8F0;
  border: 1px solid var(--hairline-strong); transition: background 0.15s ease, border-color 0.15s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #FFFFFF; border: 1px solid var(--hairline-strong);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); border-color: var(--accent); }

/* ---- Grids -------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Utility ------------------------------------------------------------ */
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }
/* The auth and app sections set display:flex/grid, which would otherwise beat
   the UA rule for the [hidden] attribute and leave them in the page flow. */
[hidden] { display: none !important; }
.center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 28px; } .mt-4 { margin-top: 44px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 28px; }
.small { font-size: 0.84rem; }
.tiny { font-size: 0.76rem; }

/* ---- Toasts ------------------------------------------------------------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-elev); border: 1px solid var(--hairline-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 15px; color: var(--heading); font-size: 0.86rem;
  max-width: 340px; animation: toastIn 0.2s ease;
}
.toast.ok { border-left-color: var(--emerald); }
.toast.err { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Modal -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(15, 23, 42, 0.28);
  padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: block; }
.modal {
  max-width: 720px; margin: 0 auto; background: var(--bg-elev);
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-lg);
  padding: 32px;
}
.modal h2 { margin-top: 0; }
.modal .close { float: right; background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal .legal { color: var(--body); }
.modal .legal h3 { margin-top: 1.6em; }
.modal .legal ul { padding-left: 20px; }
