/* Copyright © 2026 Pranav Patil. All rights reserved. */

:root {
  --bg:        #050d1a;
  --surface:   #0d1f35;
  --surface2:  #142840;
  --surface3:  #1a3352;
  --border:    #1e4068;
  --border2:   #2a5585;
  --text:      #e8f4fd;
  --muted:     #6b92b8;
  --subtle:    #4a7499;
  --gold:      #f5a623;
  --gold2:     #ffd07a;
  --green:     #00d4aa;
  --green-dim: #004d3d;
  --blue:      #4da6ff;
  --blue-dim:  #0a2a50;
  --purple:    #b57bff;
  --purple-dim:#2a1260;
  --orange:    #ff8c42;
  --orange-dim:#3d1f0a;
  --red:       #ff4d6d;
  --red-dim:   #3d0a14;
  --yellow:    #ffd166;
  --nav-h:     68px;
  --profile-h: 44px;
  --radius:    14px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; /* no grey flash on tap (iOS) */
  overscroll-behavior-y: none;              /* no rubber-band on scroll */
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(29,78,216,0.15), transparent),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(245,166,35,0.05), transparent);
}

#app {
  min-height: 100dvh;
  padding-top: calc(var(--profile-h) + env(safe-area-inset-top));
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* ── Profile bar ─────────────────────────────────── */
#profile-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--profile-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top); /* clears the iPhone notch / Dynamic Island */
  background: rgba(13,31,53,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 99;
  padding-left: 16px;
  padding-right: 16px;
}
.profile-pill {
  padding: 5px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.profile-pill.active {
  background: var(--surface3);
  border-color: var(--gold);
  color: var(--text);
}
.profile-pill:not(.active):hover {
  border-color: var(--border2);
  color: var(--text);
}

/* ── Navbar ──────────────────────────────────────── */
#navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(13,31,53,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 100;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
#navbar::-webkit-scrollbar { display: none; }

.nav-tab {
  flex: 0 0 auto;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
  position: relative;
}
.nav-tab .icon { font-size: 22px; transition: transform 0.2s; }
.nav-tab.active { color: var(--gold); }
.nav-tab.active .icon { transform: scale(1.15); }
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 8px var(--gold);
}

/* ── Screen wrapper ───────────────────────────────── */
.screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 8px;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.screen-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.2s;
}
.card.gold-border {
  border-color: rgba(245,166,35,0.5);
  background: linear-gradient(135deg, rgba(245,166,35,0.08) 0%, var(--surface) 60%);
  box-shadow: 0 4px 32px rgba(245,166,35,0.1), 0 0 0 1px rgba(245,166,35,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* CEO hero card */
.ceo-hero {
  background: linear-gradient(135deg, #0d2340 0%, #0a1a30 50%, #0d2340 100%);
  border: 1px solid rgba(245,166,35,0.4);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(245,166,35,0.12), 0 0 0 1px rgba(245,166,35,0.15);
}
.ceo-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(245,166,35,0.07) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Status badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge::before { content: '●'; font-size: 8px; }
.badge-standby  { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-standby::before { color: var(--subtle); }
.badge-running, .badge-working {
  background: rgba(245,166,35,0.15);
  color: var(--yellow);
  border: 1px solid rgba(245,166,35,0.3);
}
.badge-running::before, .badge-working::before {
  color: var(--yellow);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.badge-success, .badge-done {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(0,212,170,0.3);
}
.badge-success::before, .badge-done::before { color: var(--green); }
.badge-failed {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,77,109,0.3);
}
.badge-failed::before { color: var(--red); }
.badge-stopped {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-stopped::before { color: var(--muted); }
.badge-idle { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-idle::before { color: var(--subtle); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Agent running glow ring */
.agent-running-glow {
  box-shadow: 0 0 0 2px rgba(245,166,35,0.2), 0 0 20px rgba(245,166,35,0.1) !important;
  border-color: rgba(245,166,35,0.4) !important;
}

/* Department chips */
.dept {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dept-ceo       { background: rgba(245,166,35,0.15); color: var(--gold); border: 1px solid rgba(245,166,35,0.3); }
.dept-rnd       { background: rgba(0,212,170,0.12); color: var(--green); border: 1px solid rgba(0,212,170,0.25); }
.dept-mktg, .dept-marketing { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(181,123,255,0.25); }
.dept-dev, .dept-developer  { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(77,166,255,0.25); }
.dept-qa        { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,140,66,0.25); }
.dept-security  { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,77,109,0.25); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #f5a623 0%, #e8900f 100%);
  color: #0d1a00;
  box-shadow: 0 4px 16px rgba(245,166,35,0.35);
}
.btn-primary:hover { box-shadow: 0 4px 24px rgba(245,166,35,0.5); }

.btn-danger {
  background: linear-gradient(135deg, #ff4d6d 0%, #cc2244 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,77,109,0.3);
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border2); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-full { width: 100%; padding: 16px; font-size: 15px; border-radius: 12px; }

/* ── Inputs ───────────────────────────────────────── */
.input, .textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px; /* >=16px stops iOS Safari auto-zooming on focus */
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.12);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }

/* ── Chips ────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--border2); color: var(--text); }
.chip.selected {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245,166,35,0.1);
  box-shadow: 0 0 0 1px rgba(245,166,35,0.2);
}

/* ── Log lines ────────────────────────────────────── */
.log-line {
  padding: 5px 0;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  line-height: 1.5;
}
.log-line.log-err  { color: var(--red); }
.log-line.log-log  { color: #b8d4ef; }
.log-line.log-done { color: var(--green); font-weight: 600; }

/* ── Progress bar ─────────────────────────────────── */
.progress {
  height: 3px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 100%);
  border-radius: 2px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(245,166,35,0.5);
}

/* ── Table ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 10px; text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.table tr:hover td { background: rgba(255,255,255,0.03); cursor: pointer; }
.table tr:last-child td { border-bottom: none; }

/* ── Labels & misc ────────────────────────────────── */
.label {
  font-size: 11px;
  color: var(--subtle);
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 14px;
  line-height: 1.6;
}
.empty::before { display: block; font-size: 36px; margin-bottom: 12px; }

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--surface3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Agent grid (home) ────────────────────────────── */
.agent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.agent-mini {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s;
}
.agent-mini:hover { border-color: var(--border2); }
.agent-mini .emoji { font-size: 22px; }
.agent-mini .info { flex: 1; min-width: 0; }
.agent-mini .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }

/* ── Stats row ────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-card .stat-num { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-card .stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

/* ── Live indicator ───────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: live-pulse 2s ease-in-out infinite;
  margin-right: 6px;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--green); opacity: 1; }
  50% { box-shadow: 0 0 12px var(--green); opacity: 0.7; }
}

/* Legal agent department badges */
.dept-legal            { background: #3b0764; color: #c4b5fd; }
.dept-legal-contract   { background: #1e3a5f; color: #93c5fd; }
.dept-legal-compliance { background: #064e3b; color: #6ee7b7; }
.dept-legal-ip         { background: #78350f; color: #fcd34d; }
.dept-legal-cyber      { background: #450a0a; color: #fca5a5; }

/* Critical severity badge (extends existing badge system) */
.badge-critical { background: #450a0a; color: #ef4444; }

/* Chairman gate banner */
.legal-gate-banner {
  background: #450a0a;
  border: 1px solid #ef4444;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.legal-gate-banner .gate-icon  { font-size: 22px; flex-shrink: 0; }
.legal-gate-banner .gate-title { font-weight: 700; color: #ef4444; margin-bottom: 4px; }
.legal-gate-banner .gate-sub   { font-size: 13px; color: #fca5a5; }

/* Finding cards */
.finding-card              { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.finding-card.sev-critical { border-color: #ef4444; }
.finding-card.sev-high     { border-color: #f97316; }
.finding-card.sev-medium   { border-color: #fbbf24; }
.finding-card.sev-low      { border-color: #60a5fa; }
.finding-header  { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.finding-title   { font-weight: 600; font-size: 14px; }
.finding-desc    { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.finding-source  { font-size: 11px; color: var(--blue); }
.finding-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Splash screen (Background Paths) ─────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(29,78,216,0.18), transparent),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(245,166,35,0.07), transparent);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.splash--out { opacity: 0; transform: scale(1.04); pointer-events: none; }

.splash-bg { position: absolute; inset: 0; pointer-events: none; }
.splash-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.splash-svg path {
  stroke-dasharray: 0.6 0.4;
  animation-name: splash-path;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes splash-path {
  0%   { stroke-dashoffset: 0;  opacity: 0.3; }
  50%  { opacity: 0.7; }
  100% { stroke-dashoffset: -1; opacity: 0.3; }
}

.splash-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  max-width: 900px;
  animation: splash-fade 1.4s ease both;
}
@keyframes splash-fade { from { opacity: 0; } to { opacity: 1; } }

.splash-title {
  font-size: clamp(2.75rem, 11vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin-bottom: 36px;
}
.splash-word { display: inline-block; }
.splash-word:not(:last-child) { margin-right: 0.25em; }
.splash-letter {
  display: inline-block;
  background: linear-gradient(180deg, var(--text), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(100px);
  animation: splash-rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes splash-rise { to { opacity: 1; transform: translateY(0); } }

.splash-btn { padding: 16px 34px; font-size: 17px; border-radius: 16px; gap: 12px; }
.splash-arrow { transition: transform 0.25s ease; }
.splash-btn:hover .splash-arrow { transform: translateX(5px); }

@media (prefers-reduced-motion: reduce) {
  .splash-svg path { animation: none; opacity: 0.4; }
  .splash-letter { animation: none; opacity: 1; transform: none; }
  .splash-content { animation: none; }
}
