:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #667085;
  --line: #e5eaf2;
  --brand: #2563eb;
  --brand-dark: #143b8f;
  --success: #12805c;
  --warning: #b7791f;
  --danger: #c2410c;
  --sidebar: #101828;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #17233a);
  color: #fff;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f8cff, #9cc3ff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
}

.brand small {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
}

.sidebar-nav {
  gap: 6px;
}

.sidebar-nav .nav-link {
  color: #d0d6e0;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.sidebar-nav span {
  color: #aeb9ca;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 18px;
}

.main-panel {
  padding: 28px;
  min-width: 0;
}

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

.topbar h1 {
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.04em;
  margin: 0;
}

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

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card,
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.metric-card {
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 22px;
  font-weight: 800;
  word-break: break-word;
}

.panel-card {
  padding: 22px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
}

.table {
  margin-bottom: 0;
}

.table td,
.table th {
  vertical-align: middle;
}

.code-panel {
  background: #0f172a;
  color: #d8e4ff;
  border-radius: 16px;
  border: 1px solid #24314d;
  padding: 18px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 68vh;
}

.editor-panel {
  min-height: 560px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
}

.file-list {
  max-height: 70vh;
  overflow: auto;
}

.file-link {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.file-link:hover {
  color: var(--brand);
}

.muted {
  color: var(--muted);
}

.timeline {
  border-left: 2px solid var(--line);
  margin-left: 12px;
  padding-left: 18px;
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand);
  border: 3px solid #dbeafe;
}

.danger-zone {
  border: 1px solid #fed7aa;
  background: #fff7ed;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, #dbeafe, transparent 32%), var(--bg);
}

.login-card {
  width: min(440px, calc(100vw - 32px));
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 32px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-panel {
    padding: 18px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    margin-top: 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
