/* ===========================================================
   i3 Sports Fit Vault -- Design tokens
   Direction: "Instrument Panel" -- a cognitive/biometric readout
   aesthetic, light background, colors sampled directly from the
   i3 Sports Fit logo (public/logo.png). Signal color separates
   domains: orange (brand) = business/operations, navy (brand) =
   cognitive/neural data.
   Type: Space Grotesk (display) + JetBrains Mono (data/instrument
   readouts) + Inter (body/forms, for readability).
   =========================================================== */
:root {
  --ink: #F3F5F7;
  --panel: #FFFFFF;
  --panel-raised: #EEF1F4;
  --line: #DDE2E7;
  --line-bright: #C2C9D1;
  --paper: #1B222B;
  --muted: #5C6672;
  --muted-2: #8A93A0;
  --brass: #C2500D;   /* brand orange, derived from logo #F0540C for contrast on white */
  --brass-dim: #963D0A;
  --teal: #2E2EAD;    /* brand navy, brightened for contrast against body text */
  --teal-dim: #1F1F7A;
  --danger: #D9362E;
  --success: #1E9E5A;
  --warn: #C2500D;
  --radius: 6px;
  --shadow: 0 4px 16px rgba(27,34,43,0.08);
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background:
    repeating-linear-gradient(180deg, rgba(27,34,43,0.012) 0px, rgba(27,34,43,0.012) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse 1200px 700px at 15% -10%, rgba(46,46,173,0.04), transparent 60%),
    var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 4px 0;
  color: var(--paper);
  text-transform: uppercase;
}
h1 { font-size: 30px; letter-spacing: 0.02em; }
h2 { font-size: 20px; color: var(--muted); font-weight: 600; }
h3 { font-size: 15px; letter-spacing: 0.06em; color: var(--brass); font-weight: 700; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 2px;
}

/* ---------- Shell layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 6px 22px 6px; }
.brand-logo-card { background: #ffffff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; width: 100%; display: flex; align-items: center; justify-content: center; }
.brand-logo-img { width: 100%; height: auto; display: block; }
.brand-vault-tag { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.18em; color: var(--teal-dim); padding-left: 4px; display: flex; align-items: center; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--brass);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: var(--brass);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px;
  border: 1px solid var(--brass-dim); border-radius: 50%;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; }
.brand-name small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.14em; font-weight: 500; }

.nav-group { margin-top: 14px; }
.nav-label { font-size: 10px; letter-spacing: 0.14em; color: var(--muted-2); padding: 0 10px; margin-bottom: 6px; text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--panel-raised); color: var(--paper); text-decoration: none; }
.nav-link.active { background: rgba(194,80,13,0.1); color: var(--brass); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; flex-shrink: 0; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.6);
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--panel-raised);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--brass); font-size: 13px;
}
.role-badge {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted);
}

.main { flex: 1; min-width: 0; }
.content { padding: 26px 28px 60px 28px; max-width: 1180px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px;}
.page-head p { color: var(--muted); margin: 4px 0 0 0; max-width: 60ch; }

/* ---------- Components ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .sidebar { display: none; } .content { padding: 18px; } }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .stat-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-card .stat-value { font-family: var(--font-mono); font-size: 30px; font-weight: 700; margin-top: 6px; color: var(--paper); letter-spacing: -0.02em; }
.stat-card .stat-accent { color: var(--brass); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-body { padding: 4px 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-raised); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; font-family: var(--font-mono); text-transform: uppercase; }
.badge-active, .badge-resolved, .badge-completed { background: rgba(30,158,90,0.13); color: var(--success); }
.badge-pending, .badge-in_progress, .badge-draft { background: rgba(194,80,13,0.13); color: var(--warn); }
.badge-expired { background: rgba(217,54,46,0.13); color: var(--danger); }
.badge-open { background: rgba(46,46,173,0.13); color: var(--teal); }
.badge-urgent, .badge-high { background: rgba(217,54,46,0.16); color: var(--danger); }
.badge-normal, .badge-low { background: rgba(92,102,114,0.12); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brass); color: #FFF9F0; border: none;
  padding: 9px 16px; border-radius: var(--radius);
  font-weight: 700; font-size: 13px; cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.btn:hover { background: #DB6520; }
.btn-ghost { background: transparent; color: var(--paper); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--panel-raised); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(217,54,46,0.35); }
.btn-danger:hover { background: rgba(217,54,46,0.1); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .brand-mark { margin: 0 auto 14px auto; }

form .field { margin-bottom: 16px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em; }
input, select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line); color: var(--paper);
  padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 18px; }
.alert-error { background: rgba(217,54,46,0.08); color: #A02420; border: 1px solid rgba(217,54,46,0.25); }
.alert-success { background: rgba(30,158,90,0.1); color: var(--success); border: 1px solid rgba(30,158,90,0.3); }

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(180deg, rgba(27,34,43,0.012) 0px, rgba(27,34,43,0.012) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at top, #FFFFFF 0%, var(--ink) 75%);
  padding: 20px;
}
.auth-card { width: 380px; max-width: 100%; }
.auth-mark { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.auth-mark .brand-mark { width: 56px; height: 56px; font-size: 20px; margin-bottom: 12px; }
.auth-mark h1 { font-size: 22px; text-align: center; }
.auth-mark p { color: var(--muted); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.demo-box { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 12px; color: var(--muted); }
.demo-box code { color: var(--teal); font-family: var(--font-mono); }

.progress-track { width: 100%; height: 6px; background: var(--ink); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brass-dim), var(--brass)); }

/* ===========================================================
   Signature elements -- "Instrument Panel" identity
   Used deliberately, not everywhere: the Neural Readiness gauge
   and cognitive-drill stage are the signature moments; the rest
   of the app stays disciplined and quiet around them.
   =========================================================== */

/* Corner-bracket framing, like a viewfinder/targeting reticle --
   signals "this is a live instrument reading" */
.hud-frame {
  position: relative;
  border: 1px solid var(--line-bright);
}
.hud-frame::before, .hud-frame::after,
.hud-frame .hf-tr, .hud-frame .hf-bl {
  content: ""; position: absolute; width: 14px; height: 14px;
  pointer-events: none;
}
.hud-frame::before { top: -1px; left: -1px; border-top: 2px solid var(--brass); border-left: 2px solid var(--brass); }
.hud-frame::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--brass); border-right: 2px solid var(--brass); }
.hud-frame .hf-tr { top: -1px; right: -1px; border-top: 2px solid var(--brass); border-right: 2px solid var(--brass); }
.hud-frame .hf-bl { bottom: -1px; left: -1px; border-bottom: 2px solid var(--brass); border-left: 2px solid var(--brass); }

/* Live/pulse indicator dot -- used next to "generated" or "live" data */
@keyframes signal-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46,46,173,0.35); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(46,46,173,0); }
}
.pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); animation: signal-pulse 2s ease-in-out infinite;
}
.pulse-dot.amber { background: var(--brass); animation-name: signal-pulse-amber; }
@keyframes signal-pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(194,80,13,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(194,80,13,0); }
}

/* Radial readiness gauge -- SVG arc + mono readout, the platform's
   one true signature visual, echoing a biometric/instrument dial */
.gauge-wrap { display: flex; align-items: center; gap: 22px; }
.gauge-ring { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.gauge-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-ring .gauge-track { fill: none; stroke: var(--line); stroke-width: 8; }
.gauge-ring .gauge-fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.gauge-ring .gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.gauge-ring .gauge-number { font-family: var(--font-mono); font-size: 30px; font-weight: 700; line-height: 1; }
.gauge-ring .gauge-unit { font-family: var(--font-mono); font-size: 9px; color: var(--muted); letter-spacing: 0.1em; margin-top: 2px; }
.gauge-ticks { position: absolute; inset: -6px; }

/* Signal divider -- a scan-line style rule used to separate the
   instrument section from standard content */
.signal-divider {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 18px 0;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--muted-2); text-transform: uppercase;
}
.signal-divider::after {
  content: ""; flex: 1; height: 1px;
  background: repeating-linear-gradient(90deg, var(--line-bright) 0, var(--line-bright) 4px, transparent 4px, transparent 8px);
}

/* Instrument test-stage framing for the cognitive drills */
.drill-stage {
  position: relative;
  background:
    repeating-linear-gradient(180deg, rgba(194,80,13,0.05) 0px, rgba(194,80,13,0.05) 1px, transparent 1px, transparent 4px),
    var(--ink);
}
