/* SyntraTech — design tokens carried over from the previous build
   (Tinos / Times New Roman serif, slate-950 base, sky accent) */

:root {
  --bg: #020617;
  --bg-soft: #0f172a;
  --panel: rgba(15, 23, 42, .72);
  --panel-solid: #0f172a;
  --border: rgba(148, 163, 184, .18);
  --border-strong: rgba(148, 163, 184, .32);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #0ea5e9;
  --accent-2: #38bdf8;
  --accent-deep: #0284c7;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --font: "Tinos", "Times New Roman", Times, serif;
  --mono: "Courier New", Courier, monospace;
  --shadow: 0 18px 50px -20px rgba(2, 6, 23, .9);
}

/* Light mode — toggled by adding data-theme="light" to <html>.
   Same accent colours, inverted surface/text so contrast stays correct. */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #eef2f7;
  --panel: rgba(255, 255, 255, .82);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .18);
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --shadow: 0 18px 50px -24px rgba(15, 23, 42, .25);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- animated background (kept from current site, made live) ---------- */

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 12% -5%, rgba(14, 165, 233, .18), transparent 60%),
    radial-gradient(900px 500px at 88% 8%, rgba(56, 189, 248, .12), transparent 62%),
    linear-gradient(180deg, #020617 0%, #0b1220 48%, #020617 100%);
}

.bg-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  will-change: transform;
}

.orb-1 { width: 520px; height: 520px; left: -140px; top: -120px;
  background: radial-gradient(circle, rgba(14,165,233,.55), transparent 68%);
  animation: drift-a 26s ease-in-out infinite; }
.orb-2 { width: 460px; height: 460px; right: -120px; top: 12%;
  background: radial-gradient(circle, rgba(56,189,248,.42), transparent 68%);
  animation: drift-b 32s ease-in-out infinite; }
.orb-3 { width: 620px; height: 620px; left: 32%; bottom: -260px;
  background: radial-gradient(circle, rgba(2,132,199,.38), transparent 70%);
  animation: drift-c 38s ease-in-out infinite; }

/* Light mode: same moving orbs, softer opacity so they read as tint, not haze */
:root[data-theme="light"] .bg-stage {
  background:
    radial-gradient(1100px 600px at 12% -5%, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(900px 500px at 88% 8%, rgba(56, 189, 248, .08), transparent 62%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 48%, #f8fafc 100%);
}
:root[data-theme="light"] .bg-stage::after {
  background-image:
    linear-gradient(rgba(15, 23, 42, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .05) 1px, transparent 1px);
}
:root[data-theme="light"] .orb { opacity: .28; }

/* Cursor glow canvas — sits above the orb layer, follows the pointer */
#cursor-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(90px, 70px, 0) scale(1.14); }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.06); }
  50%      { transform: translate3d(-110px, 60px, 0) scale(.92); }
}
@keyframes drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(70px, -80px, 0) scale(1.1); }
}

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

/* ---------- layout primitives ---------- */

.wrap { width: min(1180px, 92vw); margin: 0 auto; }
.row { display: flex; align-items: center; gap: 14px; }
.row.between { justify-content: space-between; }
.row.wrap-row { flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spacer { flex: 1; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}

/* ---------- typography ---------- */

h1, h2, h3, h4 { font-weight: 700; line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--muted); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.lead { font-size: 1.08rem; color: #cbd5e1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: .86rem; }
.mono { font-family: var(--mono); }
.center { text-align: center; }

.eyebrow {
  display: inline-block;
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
  background: rgba(14, 165, 233, .08);
}

.gradient-text {
  background: linear-gradient(120deg, #e2e8f0 8%, var(--accent-2) 52%, #e2e8f0 92%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: 220% center; } }

/* ---------- header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(2, 6, 23, .72);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 68px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #1e3a8a);
  display: grid; place-items: center; color: #fff; font-size: .95rem;
  box-shadow: 0 0 0 1px rgba(56,189,248,.35), 0 8px 24px -10px rgba(14,165,233,.9);
}

.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a {
  color: var(--muted); padding: 8px 12px; border-radius: 9px; font-size: .95rem;
  transition: background .18s, color .18s;
}
.nav a:hover, .nav a.active { color: #fff; background: rgba(148, 163, 184, .12); text-decoration: none; }

.nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 9px; padding: 7px 11px; cursor: pointer; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: rgba(148,163,184,.1); color: var(--text); cursor: pointer; font-size: 1rem;
  transition: background .15s, transform .15s;
}
.theme-toggle:hover { background: rgba(148,163,184,.2); transform: translateY(-1px); }

/* Active section link — set by scroll position and by click */
.nav a.active {
  color: #fff;
  background: rgba(14,165,233,.16);
}
:root[data-theme="light"] .nav a.active { color: #0c4a6e; }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column;
    background: var(--panel-solid); border-bottom: 1px solid var(--border); padding: 10px 6vw 16px;
  }
  .nav:not(.open) { display: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: .95rem; font-weight: 700;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff;
  box-shadow: 0 10px 30px -12px rgba(14,165,233,.95); }
.btn-ghost { background: rgba(148,163,184,.1); color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(239,68,68,.4); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- cards / panels ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card.hover-lift { transition: transform .2s, border-color .2s; }
.card.hover-lift:hover { transform: translateY(-4px); border-color: rgba(56,189,248,.45); }

.section { padding: 76px 0; }
.section-head { max-width: 720px; margin-bottom: 34px; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.shown { opacity: 1; transform: none; }

.pill {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: rgba(148,163,184,.1); color: var(--muted); text-transform: uppercase;
}
.pill.ok { color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.12); }
.pill.warn { color: #fcd34d; border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.12); }
.pill.accent { color: var(--accent-2); border-color: rgba(56,189,248,.45); background: rgba(14,165,233,.12); }

/* ---------- forms ---------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%; font-family: var(--font); font-size: .98rem; color: var(--text);
  background: rgba(2, 6, 23, .6); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.2);
}
textarea { min-height: 120px; resize: vertical; }
select option { background: var(--panel-solid); }

.otp-input {
  font-family: var(--mono); font-size: 1.7rem; letter-spacing: .6em;
  text-align: center; padding: 14px 10px;
}

.form-note { font-size: .85rem; color: var(--faint); }

.alert { border-radius: 10px; padding: 11px 14px; font-size: .9rem; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.alert-ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: #86efac; }
.alert-info { background: rgba(14,165,233,.12); border-color: rgba(56,189,248,.4); color: #bae6fd; }

/* ---------- auth screen ---------- */

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 40px 6vw; }
.auth-card { width: min(440px, 100%); }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 20px; background: rgba(2,6,23,.5);
  padding: 5px; border-radius: 11px; border: 1px solid var(--border); }
.auth-tabs button {
  flex: 1; background: none; border: none; color: var(--muted); font-family: var(--font);
  font-size: .93rem; font-weight: 700; padding: 8px; border-radius: 8px; cursor: pointer;
}
.auth-tabs button.active { background: rgba(14,165,233,.18); color: #fff; }

/* ---------- dashboard shell (public nav is fully removed here) ---------- */

.app-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  background: rgba(2, 6, 23, .82);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { margin-bottom: 18px; padding: 0 8px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: var(--muted); font-size: .94rem; cursor: pointer; border: none; background: none;
  font-family: var(--font); text-align: left; width: 100%;
}
.side-link:hover { background: rgba(148,163,184,.1); color: #fff; text-decoration: none; }
.side-link.active { background: rgba(14,165,233,.16); color: #fff; border-left: 2px solid var(--accent); }
.side-sep { height: 1px; background: var(--border); margin: 10px 4px; }

.app-main { padding: 26px clamp(16px, 3vw, 34px) 60px; min-width: 0; }
.app-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #1e3a8a); color: #fff; font-weight: 700; font-size: .9rem;
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; gap: 4px; }
  .sidebar .brand, .side-sep { display: none; }
  .side-link { width: auto; white-space: nowrap; }
}

/* ---------- stat tiles ---------- */

.stat { padding: 18px; }
.stat .n { font-size: 1.9rem; font-weight: 700; color: #fff; line-height: 1.1; }
.stat .l { font-size: .82rem; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--faint);
  background: rgba(2,6,23,.55); position: sticky; top: 0; }
tbody tr:hover { background: rgba(148,163,184,.06); }
tbody tr:last-child td { border-bottom: none; }
td select { padding: 6px 9px; font-size: .85rem; }

/* ---------- inbox ---------- */

.inbox { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.thread-list { max-height: 68vh; overflow-y: auto; }
.thread {
  padding: 13px 14px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.thread:hover { background: rgba(148,163,184,.07); }
.thread.active { background: rgba(14,165,233,.12); }
.thread.unread .thread-from { color: #fff; font-weight: 700; }
.thread-from { font-size: .92rem; color: var(--muted); }
.thread-sub { font-size: .86rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-body { white-space: pre-wrap; font-size: .95rem; color: #cbd5e1; }

@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } }

/* ---------- misc ---------- */

.site-footer { border-top: 1px solid var(--border); padding: 40px 0 30px; margin-top: 40px; background: rgba(2,6,23,.6); }
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 90; max-width: 340px;
  padding: 13px 16px; border-radius: 11px; box-shadow: var(--shadow);
  border: 1px solid var(--border-strong); background: var(--panel-solid); font-size: .92rem;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.toast.ok { border-color: rgba(34,197,94,.5); }
.toast.err { border-color: rgba(239,68,68,.5); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, rgba(148,163,184,.08), rgba(148,163,184,.18), rgba(148,163,184,.08));
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
