:root {
  --bg: #061018;
  --panel: rgba(11, 25, 38, 0.78);
  --panel-strong: rgba(15, 34, 51, 0.94);
  --ink: #eef8ff;
  --muted: #9db1c1;
  --soft: rgba(157, 177, 193, 0.16);
  --line: rgba(111, 214, 255, 0.18);
  --cyan: #00e5ff;
  --cyan-2: #54f4ff;
  --violet: #8b5cf6;
  --green: #34d399;
  --amber: #f59e0b;
  --red: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.light {
  --bg: #f4f8fb;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --ink: #0a1722;
  --muted: #5c6d7b;
  --soft: rgba(4, 24, 38, 0.08);
  --line: rgba(3, 113, 142, 0.18);
  --shadow: 0 24px 70px rgba(8, 34, 54, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 229, 255, 0.22), transparent 28%),
    radial-gradient(circle at 78% 0%, rgba(139, 92, 246, 0.22), transparent 30%),
    linear-gradient(135deg, #03080d 0%, var(--bg) 50%, #07131d 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.light body, body.light {
  background:
    radial-gradient(circle at 15% 5%, rgba(0, 229, 255, 0.18), transparent 28%),
    linear-gradient(135deg, #f7fbfd 0%, #edf5f8 100%);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.landing {
  min-height: 100vh;
  padding: 24px;
}

.public-shell {
  max-width: 1380px;
  margin: 0 auto;
}

.public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(6, 16, 24, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.light .public-nav { background: rgba(255, 255, 255, 0.76); }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #041018;
  font-weight: 900;
  box-shadow: 0 0 36px rgba(0, 229, 255, 0.32);
}

.brand-title {
  font-weight: 850;
  font-size: 18px;
  line-height: 1.05;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill, .btn, .ghost, .tab {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  color: #031018;
  font-weight: 850;
  background: linear-gradient(135deg, var(--cyan), #b7f7ff);
  box-shadow: 0 10px 34px rgba(0, 229, 255, 0.22);
}

.ghost:hover, .tab.active, .pill.live {
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.12);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 22px;
  align-items: stretch;
  padding: 32px 0 18px;
}

.hero-copy, .login-card, .panel, .card, .modal, .drawer, .ai-feed, .portal-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  min-height: 520px;
  padding: 42px;
  overflow: hidden;
  position: relative;
}

.hero-copy:after {
  content: "";
  position: absolute;
  inset: auto -20% -35% 25%;
  height: 360px;
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(0, 229, 255, 0.26) 10% 12%, transparent 12% 22%, rgba(139, 92, 246, 0.2) 22% 24%, transparent 24%),
    radial-gradient(circle, rgba(0, 229, 255, 0.18), transparent 68%);
  transform: rotate(-8deg);
}

.eyebrow {
  color: var(--cyan-2);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  font-weight: 800;
}

h1 {
  max-width: 980px;
  margin: 18px 0;
  font-size: clamp(44px, 6vw, 86px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.04;
}

h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
  position: relative;
  z-index: 1;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.metric strong {
  display: block;
  font-size: 30px;
}

.login-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.role {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.role.active {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.14);
}

.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

input, textarea, select {
  width: 100%;
  min-height: 48px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

textarea {
  padding: 14px;
  resize: vertical;
}

.error {
  min-height: 20px;
  color: var(--red);
  font-weight: 700;
}

.public-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 12px 0 24px;
}

.portal-card {
  padding: 24px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(4, 12, 18, 0.84);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.light .sidebar { background: rgba(255, 255, 255, 0.76); }

.side-nav {
  display: grid;
  gap: 8px;
  margin: 28px 0;
}

.side-link {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.side-link.active {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.2), rgba(139, 92, 246, 0.1));
  outline: 1px solid var(--line);
}

.icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--soft);
  color: var(--cyan-2);
  font-weight: 900;
  font-size: 12px;
}

.main {
  min-width: 0;
  padding-bottom: 90px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 16, 24, 0.78);
  backdrop-filter: blur(18px);
}

.light .topbar { background: rgba(255, 255, 255, 0.82); }

.search {
  max-width: 560px;
  min-width: 220px;
}

.content {
  padding: 24px;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.panel, .card {
  padding: 20px;
  overflow: hidden;
}

.kpi {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.kpi strong {
  display: block;
  font-size: 32px;
  margin-top: 8px;
}

.spark {
  height: 64px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(139, 92, 246, 0.1)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.06) 18px 19px);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.table th, .table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.scroll-x { overflow-x: auto; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(52, 211, 153, 0.13);
  color: #8df7c7;
  font-size: 12px;
  font-weight: 800;
}

.status:before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

.status.warn { background: rgba(245, 158, 11, 0.14); color: #ffd38a; }
.status.risk { background: rgba(251, 113, 133, 0.14); color: #ffb1bf; }

.agent-card {
  min-height: 220px;
  position: relative;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
  margin: 14px 0 10px;
}

.bar {
  height: 100%;
  width: var(--value, 50%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 350ms ease;
}

.flow {
  display: grid;
  gap: 10px;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--soft);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.flow-step.done .dot {
  background: var(--green);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.8);
}

.flow-step.running .dot {
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.9);
}

.map {
  position: relative;
  min-height: 360px;
  border-radius: 24px;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.12), rgba(139, 92, 246, 0.12)),
    radial-gradient(circle at 20% 30%, rgba(0, 229, 255, 0.2), transparent 24%),
    radial-gradient(circle at 80% 35%, rgba(52, 211, 153, 0.14), transparent 20%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent);
}

.route {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.72), transparent);
  transform-origin: left center;
}

.pin {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255,255,255,0.8);
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.8);
}

.pin-card {
  position: absolute;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(4, 12, 18, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.light .pin-card { background: rgba(255, 255, 255, 0.92); }

.render {
  min-height: 280px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 70%, rgba(0, 229, 255, 0.35), transparent 30%),
    linear-gradient(150deg, rgba(255,255,255,0.12), transparent 40%),
    #07121c;
  position: relative;
  overflow: hidden;
}

.render:before {
  content: "";
  position: absolute;
  left: 15%;
  right: 10%;
  bottom: 25%;
  height: 34%;
  border-radius: 48% 52% 28% 35%;
  background: linear-gradient(90deg, #101b24, #00e5ff 47%, #8b5cf6);
  transform: skewX(-12deg);
  filter: drop-shadow(0 22px 34px rgba(0, 229, 255, 0.24));
}

.render:after {
  content: "";
  position: absolute;
  left: 31%;
  right: 28%;
  bottom: 37%;
  height: 16%;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,0.34);
  transform: rotate(-8deg);
}

.doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.52);
}

.sim-drawer {
  position: fixed;
  right: 20px;
  top: 92px;
  z-index: 55;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 124px);
  overflow: auto;
}

.modal {
  width: min(980px, 100%);
  max-height: min(780px, 92vh);
  overflow: auto;
  padding: 24px;
}

.simulation-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.ai-feed {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 45;
  width: min(440px, calc(100vw - 40px));
  max-height: min(540px, calc(100vh - 120px));
  overflow: hidden;
}

.ai-feed.collapsed {
  width: auto;
  max-height: 60px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.feed-list {
  max-height: 460px;
  overflow: auto;
}

.feed-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.feed-item strong {
  color: var(--cyan-2);
}

.mobile-menu {
  display: none;
}

@media (max-width: 1120px) {
  .hero, .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
  .search { max-width: none; flex: 1; }
}

@media (max-width: 760px) {
  .landing, .content { padding: 14px; }
  .public-nav, .topbar, .view-head, .simulation-head { align-items: stretch; flex-direction: column; }
  .hero-copy { min-height: auto; padding: 26px; }
  .hero-grid, .public-sections, .role-grid { grid-template-columns: 1fr; }
  .topbar { position: relative; }
  .nav-actions { justify-content: flex-start; }
  h1 { font-size: 42px; }
  .ai-feed { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .sim-drawer { top: 12px; left: 12px; right: 12px; width: auto; max-height: calc(100vh - 24px); }
}
