/* ========================================================================== *
 * surveillance — self-contained design system (dark control-panel).
 * The look lives here (not in the CDN) so the app renders identically with or
 * without Tailwind, degrades gracefully if the CDN/CSP blocks it, and can be
 * inlined into faithful offline preview files.
 * ========================================================================== */

:root {
  --bg: #0a0e13;
  --panel: #10161e;
  --panel-2: #131b25;
  --elevated: #17212c;
  --border: #223041;
  --border-soft: #1a2431;
  --text: #e6edf3;
  --muted: #93a1b1;
  --faint: #6b7a8c;
  --accent: #22d3ee;
  --accent-2: #38bdf8;
  --accent-ink: #04252b;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.10);
  --danger-bd: rgba(248, 113, 113, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

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

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

code, pre, .mono { font-family: var(--mono); }

/* ---- brand mark --------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__logo { width: 28px; height: 28px; display: block; }
.brand__name {
  font-weight: 700; letter-spacing: 0.04em; color: var(--text);
  font-size: 15px;
}
.brand__name .accent { color: var(--accent); }
.brand__tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint);
}

/* ========================================================================== *
 * LOGIN
 * ========================================================================== */
.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(56, 189, 248, 0.07), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 384px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 30px 28px 24px;
}
.login-card .brand { margin-bottom: 22px; }
.login-title { font-size: 19px; font-weight: 650; margin: 2px 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.field { margin-bottom: 14px; }
.field-label {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.input {
  width: 100%; padding: 11px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.input::placeholder { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--sans);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #3fdcf0; text-decoration: none; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

.login-foot {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft);
  color: var(--faint); font-size: 12px; text-align: center;
}
.login-foot .mono { color: var(--muted); }

/* ---- alerts ------------------------------------------------------------- */
.alert {
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; margin-bottom: 16px; border: 1px solid transparent;
  display: flex; align-items: center; gap: 9px;
}
.alert-error { background: var(--danger-bg); border-color: var(--danger-bd); color: #fecaca; }
.alert-warn { background: rgba(251, 191, 36, 0.10); border-color: rgba(251, 191, 36, 0.3); color: #fde68a; }
.alert__ic { flex: 0 0 auto; }

/* ========================================================================== *
 * APP SHELL
 * ========================================================================== */
.app-shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 4px 8px 0; }
.brand__meta { display: flex; flex-direction: column; line-height: 1.15; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-section {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--faint);
  padding: 12px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--elevated); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--elevated); color: var(--text);
  border-color: var(--border); font-weight: 600;
}
.nav-item.disabled { color: var(--faint); cursor: not-allowed; opacity: 0.7; }
.nav-item .ic { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0.85; }
.sidebar-foot { margin-top: auto; padding: 0 8px; }

/* ---- main --------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 22, 30, 0.7); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-title .crumb { color: var(--faint); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
}

.content { padding: 28px 26px 48px; max-width: 1180px; width: 100%; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; font-weight: 680; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); margin: 0; font-size: 14px; }

/* ---- phase banner ------------------------------------------------------- */
.banner {
  display: flex; align-items: flex-start; gap: 11px;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.06), rgba(34, 211, 238, 0.02));
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 24px;
  font-size: 13.5px; color: #b9e9f2;
}
.banner strong { color: #d7f6fb; }
.banner .ic { flex: 0 0 auto; margin-top: 1px; }

/* ---- status dots -------------------------------------------------------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot-green { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16); }
.dot-amber { background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16); }
.dot-red { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16); }

/* ---- badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg);
  white-space: nowrap;
}
.badge-soon { color: var(--accent); border-color: rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.06); }
.badge-write { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.06); }
.badge-read { color: var(--muted); }

/* ========================================================================== *
 * CARDS (dashboard)
 * ========================================================================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color 0.15s, transform 0.1s;
}
.card:hover { border-color: rgba(34, 211, 238, 0.35); }
.card__accent { height: 3px; border-radius: 3px; margin: -18px -18px 2px; opacity: 0.85; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 16px; font-weight: 650; margin: 0; }
.card-tag { color: var(--muted); font-size: 13px; margin: -4px 0 0; }
.card-url { font-family: var(--mono); font-size: 12px; }

.mini-list { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 0; }
.mini-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 7px 9px; background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.mini-item .mi-title { color: var(--text); font-weight: 500; }
.mi-badges { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }

.text-center { text-align: center; }

.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-foot .count { font-size: 12px; color: var(--faint); font-family: var(--mono); }

/* ========================================================================== *
 * PROJECT PAGE (stubs)
 * ========================================================================== */
.breadcrumb { font-size: 13px; color: var(--faint); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { margin: 0 7px; opacity: 0.6; }

.proj-head { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; }
.proj-head h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.proj-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.proj-sub .card-url { margin-left: 4px; }

.view {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.view-num {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  background: var(--elevated); border: 1px solid var(--border);
  display: grid; place-items: center; font-family: var(--mono);
  font-size: 12px; color: var(--accent);
}
.view-title { font-size: 15.5px; font-weight: 620; margin: 0; }
.view-head .badge { margin-left: 4px; }
.view-desc { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.view-source {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-left: 3px solid rgba(34, 211, 238, 0.5);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: var(--muted); overflow-x: auto;
}
.view-source .lbl { color: var(--faint); text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; display: block; margin-bottom: 4px; }
.view-source code { color: var(--accent-2); }

/* ---- footer ------------------------------------------------------------- */
.footer {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border-soft);
  color: var(--faint); font-size: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ========================================================================== *
 * RESPONSIVE
 * ========================================================================== */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    flex-wrap: wrap; gap: 10px; padding: 12px 14px;
  }
  .sidebar-foot { margin: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-section { display: none; }
  .content { padding: 20px 16px 40px; }
  .card-grid { grid-template-columns: 1fr; }
}

/* Respect users who prefer light — this tool is deliberately dark, but keep a
 * readable fallback if a browser forces color adjustments. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
