/* =========================================================================
 * DriftSense -- design system + component styles
 * -------------------------------------------------------------------------
 * Palette: midnight navy background + steel-teal primary + amber warnings.
 * Distinct from every portfolio site (cyan/indigo/violet/emerald/burgundy/amber)
 * -- reads as "watchtower / observatory / cool precision instrument."
 * ========================================================================= */

:root {
  /* Backgrounds -- deep, cool, with subtle blue tint */
  --bg-0: #030710;
  --bg-1: #0a1220;
  --bg-2: #131e30;
  --bg-3: #1a2740;
  --bg-panel: linear-gradient(180deg, #131e30 0%, #0a1220 100%);

  /* Borders */
  --border: #223050;
  --border-hi: #2d3d5f;
  --border-focus: #14b8a6;

  /* Text */
  --text: #e5edf5;
  --text-dim: #96a3b8;
  --text-muted: #6a7a94;

  /* Accents */
  --accent: #14b8a6;              /* Teal -- primary, "sense" color */
  --accent-hi: #2dd4bf;
  --accent-deep: #0f766e;
  --accent-glow: rgba(20, 184, 166, 0.35);

  --accent-warn: #f59e0b;          /* Amber -- drift alert */
  --accent-warn-hi: #fbbf24;

  --accent-danger: #f43f5e;        /* Rose -- critical */
  --accent-danger-hi: #fb7185;

  --accent-ok: #34d399;            /* Emerald -- clean baseline */
  --accent-ok-hi: #6ee7b7;

  --accent-info: #38bdf8;          /* Sky-blue -- info notices */

  /* Typography */
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Sizing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 1000px 600px at 15% 0%, rgba(20, 184, 166, 0.10), transparent 65%),
    radial-gradient(ellipse 900px 500px at 90% 100%, rgba(56, 189, 248, 0.08), transparent 65%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* =========================================================================
 * APP SHELL -- sidebar + main
 * ========================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, #0a1220 0%, #050810 100%);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 8px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-brand .logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  display: grid; place-items: center;
  color: #030710;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.sidebar-brand .name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.sidebar-brand .name .accent { color: var(--accent-hi); }
.sidebar-brand .role {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 2px;
}
.sidebar-section-label {
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 20px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 2px solid transparent;
  transition: color .12s ease, background .12s ease, border-left-color .12s ease;
}
.sidebar-link svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.85; }
.sidebar-link:hover { color: var(--text); background: rgba(255,255,255,.02); }
.sidebar-link.active {
  color: var(--accent-hi);
  background: linear-gradient(90deg, rgba(20, 184, 166, .12), transparent 90%);
  border-left-color: var(--accent);
}
.sidebar-link.active svg { opacity: 1; }

/* Main content area */
.app-main { min-width: 0; }
.topbar {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(10, 18, 32, 0.5);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.topbar-spacer { flex: 1; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
}
.topbar-user .initials {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #030710;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--mono);
}

.app-content {
  padding: 32px 40px 96px;
  max-width: 1400px;
}

/* =========================================================================
 * PAGE HEAD
 * ========================================================================= */
.page-head { margin-bottom: 32px; }
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--accent-hi);
  font-weight: 700;
  padding: 5px 12px;
  background: rgba(20, 184, 166, .10);
  border: 1px solid rgba(20, 184, 166, .30);
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  text-decoration: none;
}
.page-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-hi);
  box-shadow: 0 0 10px var(--accent-hi);
}
.page-title {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 60%, var(--accent-hi) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-subtitle {
  color: var(--text-dim);
  font-size: 14.5px;
  max-width: 780px;
  margin: 0;
}

/* =========================================================================
 * MODULES / CARDS
 * ========================================================================= */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.module {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.module:hover { border-color: var(--border-hi); }
.module-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(20, 184, 166, .03);
}
.module-head .left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.module-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--accent-hi);
  background: rgba(20, 184, 166, .10);
  border: 1px solid rgba(20, 184, 166, .30);
}
.module-title { font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.module-subtitle {
  font-size: 11.5px;
  font-weight: 400;
  color: #b8c5d6;
  margin-left: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  line-height: 1.35;
}
.module-body { padding: 16px; }
.module-body.tight { padding: 0; }

/* Module glow variants */
.module.glow-teal   { box-shadow: 0 0 0 1px rgba(20, 184, 166, .20), 0 0 26px rgba(20, 184, 166, .10); }
.module.glow-amber  { box-shadow: 0 0 0 1px rgba(245, 158, 11, .20), 0 0 26px rgba(245, 158, 11, .10); }
.module.glow-rose   { box-shadow: 0 0 0 1px rgba(244, 63, 94, .20),  0 0 26px rgba(244, 63, 94, .10); }
.module.glow-emerald{ box-shadow: 0 0 0 1px rgba(52, 211, 153, .20), 0 0 26px rgba(52, 211, 153, .10); }
.module.glow-sky    { box-shadow: 0 0 0 1px rgba(56, 189, 248, .20), 0 0 26px rgba(56, 189, 248, .10); }

/* =========================================================================
 * KPI TILES
 * ========================================================================= */
.kpi { padding: 20px 22px; }
.kpi .num {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi .lbl {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 6px;
}
.kpi .sub { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.kpi-teal   .num { color: var(--accent-hi); text-shadow: 0 0 24px rgba(20, 184, 166, .35); }
.kpi-amber  .num { color: var(--accent-warn-hi); text-shadow: 0 0 24px rgba(245, 158, 11, .30); }
.kpi-rose   .num { color: var(--accent-danger-hi); text-shadow: 0 0 24px rgba(244, 63, 94, .30); }
.kpi-emerald .num { color: var(--accent-ok-hi); text-shadow: 0 0 24px rgba(52, 211, 153, .30); }
.kpi-sky    .num { color: var(--accent-info); text-shadow: 0 0 24px rgba(56, 189, 248, .30); }

/* =========================================================================
 * PILLS + STATUS BADGES
 * ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px solid var(--border);
}
.pill-ok    { background: rgba(52, 211, 153, .10); color: #a7f3d0; border-color: rgba(52, 211, 153, .35); }
.pill-warn  { background: rgba(245, 158, 11, .10); color: var(--accent-warn-hi); border-color: rgba(245, 158, 11, .35); }
.pill-bad   { background: rgba(244, 63, 94, .10);  color: var(--accent-danger-hi); border-color: rgba(244, 63, 94, .35); }
.pill-info  { background: rgba(56, 189, 248, .10); color: var(--accent-info); border-color: rgba(56, 189, 248, .35); }
.pill-mute  { background: rgba(255,255,255,.03); color: var(--text-dim); }

/* =========================================================================
 * TABLES
 * ========================================================================= */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
}
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl .mono { font-family: var(--mono); font-size: 12.5px; }
.tbl .dim  { color: var(--text-dim); }

/* =========================================================================
 * BUTTONS
 * ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #030710;
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s ease, box-shadow .1s ease, background .12s ease;
}
.btn:hover { background: var(--accent-hi); box-shadow: 0 4px 14px var(--accent-glow); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-2); border-color: var(--accent); color: var(--accent-hi); }
.btn-danger { background: var(--accent-danger); }
.btn-danger:hover { background: var(--accent-danger-hi); box-shadow: 0 4px 14px rgba(244, 63, 94, .35); }

/* =========================================================================
 * FORMS
 * ========================================================================= */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], textarea, select {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .12s ease;
  color-scheme: dark;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* =========================================================================
 * MISC UTILITIES
 * ========================================================================= */
code {
  background: rgba(20, 184, 166, .10);
  color: var(--accent-hi);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.88em;
  border: 1px solid rgba(20, 184, 166, .20);
}
.mono { font-family: var(--mono); }
.dim  { color: var(--text-dim); }
.muted { color: var(--text-muted); }

/* Banner */
.banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 10px 0;
  border-left: 3px solid;
}
.banner-ok    { background: rgba(52, 211, 153, .08); border-left-color: var(--accent-ok);       color: #a7f3d0; }
.banner-warn  { background: rgba(245, 158, 11, .08); border-left-color: var(--accent-warn);     color: var(--accent-warn-hi); }
.banner-err   { background: rgba(244, 63, 94, .08);  border-left-color: var(--accent-danger);   color: var(--accent-danger-hi); }
.banner-info  { background: rgba(56, 189, 248, .08); border-left-color: var(--accent-info);     color: var(--accent-info); }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 5px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }
