:root {
  --bg: #f4f8fc;
  --bg-soft: #fbfdff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(245, 250, 255, 0.98);
  --panel-light: rgba(240, 247, 255, 0.9);
  --text: #122033;
  --muted: #60758d;
  --line: rgba(32, 62, 92, 0.1);
  --green: #1ea864;
  --yellow: #d38a12;
  --red: #d2555c;
  --blue: #2c74ff;
  --accent: #11b8e5;
  --shadow: 0 24px 54px rgba(26, 72, 120, 0.12);
}

html[data-theme="dark"] {
  --bg: #07111f;
  --bg-soft: #0d1828;
  --panel: rgba(12, 23, 39, 0.9);
  --panel-2: rgba(17, 30, 50, 0.96);
  --panel-light: rgba(255, 255, 255, 0.06);
  --text: #eef6ff;
  --muted: #8ea4bf;
  --line: rgba(255, 255, 255, 0.08);
  --green: #24d17c;
  --yellow: #f0b43f;
  --red: #f06d74;
  --blue: #61a8ff;
  --accent: #2bd4ff;
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(43, 212, 255, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(76, 125, 255, 0.12), transparent 26%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 480px);
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.logo-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(43,212,255,.2), rgba(76,125,255,.18));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.logo-mark.small {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin-bottom: 0;
}

.logo-eye {
  width: 28px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  position: relative;
}

.logo-eye::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
}

.login-kicker, .eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 34px;
  line-height: 1.05;
  margin: 0 0 12px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 24px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.login-form input,
.search-box input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-light);
  color: var(--text);
  outline: none;
}

.login-form button,
.ghost-btn,
.selector-btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.login-form button {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #f5fbff;
}

.ghost-btn,
.selector-btn {
  background: var(--panel-light);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-btn:hover,
.selector-btn:hover,
.selector-btn.active {
  background: rgba(255,255,255,0.34);
}

html[data-theme="dark"] .ghost-btn:hover,
html[data-theme="dark"] .selector-btn:hover,
html[data-theme="dark"] .selector-btn.active {
  background: rgba(255,255,255,0.14);
}

.login-error {
  color: var(--red);
  min-height: 20px;
  margin-top: 12px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248,252,255,.98), rgba(239,247,255,.94));
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, rgba(6, 14, 26, 0.97), rgba(10, 19, 34, 0.9));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-name {
  font-weight: 800;
  font-size: 20px;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: block;
  margin-bottom: 18px;
}

.menu {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.menu-link,
.project-nav-item {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-light);
  color: var(--text);
  cursor: pointer;
}

.menu-link.active,
.project-nav-item.active {
  background: rgba(255,255,255,0.34);
  box-shadow: inset 0 0 0 1px rgba(17,184,229,.26);
}

html[data-theme="dark"] .menu-link.active,
html[data-theme="dark"] .project-nav-item.active {
  background: rgba(255,255,255,0.14);
}

.sidebar-section-title {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .16em;
  margin: 20px 0 10px;
}

.project-nav {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 4px;
}

.project-nav-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.project-nav-sub {
  color: var(--muted);
  font-size: 13px;
}

.main {
  padding: 28px;
}

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

.topbar h1 {
  margin: 0 0 6px;
  font-size: 34px;
}

.subtitle {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.view { display: none; }
.view.active { display: block; }

.hero-panel,
.panel,
.project-card,
.capacity-card,
.detail-card {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-panel h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.hero-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 720px;
}

.hero-pill,
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.healthy { background: rgba(31,209,107,.14); color: var(--green); }
.warning { background: rgba(243,183,45,.14); color: var(--yellow); }
.critical { background: rgba(238,93,100,.14); color: var(--red); }

.summary-grid,
.capacity-grid,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card,
.capacity-card,
.metric-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-light);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  margin: 10px 0 6px;
}

.metric-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 20px;
  font-weight: 800;
}

.panel-sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

.sparkline-chart svg {
  width: 100%;
  height: 180px;
  display: block;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.project-card,
.detail-card {
  padding: 20px;
}

.project-card-header,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.project-title {
  margin: 0 0 6px;
  font-size: 22px;
}

.project-domain {
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
}

.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.info-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-light);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.info-badge.neutral {
  color: var(--muted);
}

.project-description,
.detail-note,
.reason-list li {
  color: var(--muted);
  line-height: 1.6;
}

.project-stats,
.detail-grid,
.detail-tests,
.project-selector {
  display: grid;
  gap: 12px;
}

.project-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.mini-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-light);
  border: 1px solid var(--line);
}

.mini-value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 8px;
}

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

.detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.detail-tests {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.test-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-light);
}

.test-name {
  font-weight: 700;
}

.test-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.network-card {
  display: grid;
  gap: 12px;
}

.network-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-light);
  border: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .project-nav { max-height: none; }
}

@media (max-width: 820px) {
  .main { padding: 18px; }
  .topbar,
  .hero-panel { flex-direction: column; align-items: flex-start; }
  .summary-grid,
  .capacity-grid,
  .metrics-grid,
  .chart-grid,
  .detail-grid,
  .detail-tests,
  .project-stats { grid-template-columns: 1fr; }
}
