/* Drone Detect design system — shared tokens and components for every page. */

:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --surface: #0f1528;
  --surface-2: #151c33;
  --surface-3: #1b2440;
  --border: #242d4a;
  --border-strong: #33406a;
  --text: #e8ebf5;
  --text-2: #a3abc6;
  --muted: #7d86a6;
  --accent: #6d74f7;
  --accent-2: #8f95ff;
  --accent-soft: rgba(109, 116, 247, 0.14);
  --detect: #22d3ee;
  --detect-soft: rgba(34, 211, 238, 0.14);
  --neutralize: #fb923c;
  --neutralize-soft: rgba(251, 146, 60, 0.14);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
  --shell-h: 56px;
  color-scheme: dark;

  /* legacy aliases used by older page styles */
  --text2: var(--text-2);
  --surface2: var(--surface-2);
  --panel: var(--surface);
  --card: var(--surface-2);
  --green: var(--success);
  --red: var(--danger);
  --amber: var(--warning);
  --orange: var(--neutralize);
  --blue: #38bdf8;
  --cyan: var(--detect);
  --app-border: var(--border);
  --app-text: var(--text);
  --app-text2: var(--text-2);
  --app-accent: var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
code, kbd { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(109, 116, 247, 0.35); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: 600 0.88rem/1.2 var(--font); cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-warn { background: var(--neutralize); border-color: var(--neutralize); color: #1a0f05; }
.btn-warn:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 22px; font-size: 0.98rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
.input, .select, .textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  font: 0.9rem/1.35 var(--font); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 0.88rem; padding: 3px 0; }
.check small { display: block; color: var(--muted); font-size: 0.75rem; }
.form-error { color: #fca5a5; font-size: 0.82rem; min-height: 1.2em; margin-top: 8px; }
.form-ok { color: #86efac; font-size: 0.82rem; min-height: 1.2em; margin-top: 8px; }

/* ── Surfaces ────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-sm { padding: 14px; border-radius: var(--radius); }
.card h3 { margin-bottom: 6px; }
.callout { border-radius: var(--radius); padding: 12px 14px; font-size: 0.85rem; line-height: 1.5; border: 1px solid var(--border); background: var(--surface-2); }
.callout.info { border-color: rgba(109, 116, 247, 0.35); background: var(--accent-soft); }
.callout.warn { border-color: rgba(245, 158, 11, 0.4); background: var(--warning-soft); color: #fde68a; }
.callout.danger { border-color: rgba(239, 68, 68, 0.4); background: var(--danger-soft); color: #fecaca; }
.callout.ok { border-color: rgba(34, 197, 94, 0.4); background: var(--success-soft); color: #bbf7d0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge.detect { background: var(--detect-soft); color: #67e8f9; border-color: rgba(34, 211, 238, 0.35); }
.badge.neutralize { background: var(--neutralize-soft); color: #fdba74; border-color: rgba(251, 146, 60, 0.35); }
.badge.success { background: var(--success-soft); color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.badge.warn { background: var(--warning-soft); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.badge.danger { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.badge.accent { background: var(--accent-soft); color: #c7caff; border-color: rgba(109, 116, 247, 0.4); }

.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.stat.detect .stat-value { color: var(--detect); }
.stat.neutralize .stat-value { color: var(--neutralize); }
.stat.success .stat-value { color: var(--success); }
.stat.danger .stat-value { color: var(--danger); }

.meter { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.meter.detect > span { background: var(--detect); }
.meter.neutralize > span { background: var(--neutralize); }

.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: rgba(255, 255, 255, 0.015); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Modal & toast ───────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 10000; display: none; place-items: center; padding: 16px; background: rgba(3, 6, 14, 0.7); backdrop-filter: blur(3px); }
.modal-overlay.open { display: grid; }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2, .modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 11000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 0.86rem; animation: toast-in 0.2s ease; }
.toast.ok { border-color: rgba(34, 197, 94, 0.5); }
.toast.err { border-color: rgba(239, 68, 68, 0.6); }
.toast.warn { border-color: rgba(245, 158, 11, 0.6); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── App shell (logged-in header) ────────────────────────────────────── */
.app-shell { position: sticky; top: 0; z-index: 900; height: var(--shell-h); background: rgba(7, 11, 22, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.app-shell-inner { height: 100%; display: flex; align-items: center; gap: 18px; padding: 0 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--detect)); }
.brand-mark svg { width: 17px; height: 17px; }
.shell-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.shell-nav::-webkit-scrollbar { display: none; }
.shell-nav a { padding: 7px 11px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.86rem; font-weight: 500; white-space: nowrap; }
.shell-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.shell-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.shell-nav .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
.shell-user { position: relative; flex-shrink: 0; }
.shell-user-btn { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: 500 0.84rem var(--font); }
.shell-user-btn:hover { border-color: var(--border-strong); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-2); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; }
.shell-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.shell-menu.open { display: block; }
.shell-menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.shell-menu button, .shell-menu a { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--text-2); font: 500 0.86rem var(--font); cursor: pointer; }
.shell-menu button:hover, .shell-menu a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
@media (max-width: 720px) {
  .brand-name { display: none; }
  .shell-user-name { display: none; }
}

/* ── Page layout (non-map tools) ─────────────────────────────────────── */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 20px 60px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header h1 { margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--text-2); max-width: 760px; }
.section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 0 10px; }

/* ── Auth pages ──────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 10% -10%, rgba(109, 116, 247, 0.18), transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(34, 211, 238, 0.12), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { flex: 1; padding: 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font: 600 0.86rem var(--font); cursor: pointer; }
.tabs button.active { background: var(--surface-3); color: var(--text); }

/* ── Product sheet (designer + catalog) ──────────────────────────── */
.sd-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.sd-desc { color: var(--text-2); font-size: 0.88rem; }
.sd-kpis { margin: 12px 0; }
.sd-section { margin-top: 16px; }
.sd-section h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 8px; }
.sd-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.sd-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 10px 6px 0; width: 45%; vertical-align: top; border-bottom: 1px solid var(--border); }
.sd-table td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.sd-list { margin: 0; padding-left: 18px; font-size: 0.84rem; color: var(--text-2); }
.sd-list li { margin: 3px 0; }
.sd-evidence { list-style: none; padding: 0; margin: 0; font-size: 0.84rem; }
.sd-evidence li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.sd-bar { display: grid; grid-template-columns: 60px 1fr 44px; gap: 10px; align-items: center; font-size: 0.8rem; margin: 5px 0; }
.sd-bar .meter { margin: 0; }
.sd-bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
