:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: #bfdbfe; text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: white; }
.nav { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.nav a { padding: 0.55rem 0.8rem; border-radius: 999px; color: var(--muted); }
.nav a.active, .nav a:hover { background: var(--panel-2); color: white; text-decoration: none; }

.container { max-width: 1380px; margin: 0 auto; padding: 1.5rem; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1, .hero-card h1 { margin-top: 0; margin-bottom: 0.4rem; }
.hero-card, .card {
  background: linear-gradient(180deg, rgba(31,41,55,0.95), rgba(17,24,39,0.95));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}
.hero-card.narrow { max-width: 720px; margin: 3rem auto; }
.card-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.section-stack { display: grid; gap: 1rem; margin-bottom: 1rem; }

.stat-card .stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; margin: 0.35rem 0; }
.stat-card.warn .stat-value { color: #fde68a; }

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.75);
}
.status-title { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.2rem; }

.form-grid { display: grid; gap: 1rem; }
.form-grid label { display: grid; gap: 0.4rem; }
.form-grid input[type="text"],
.form-grid input[type="password"],
.form-grid input[type="number"],
.form-grid input[type="file"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  padding: 0.85rem 1rem;
}
.checkbox-row { display: flex !important; align-items: center; gap: 0.8rem; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.form-actions.split { justify-content: space-between; }
.btn, .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.link-btn { background: transparent; color: #cbd5e1; border-color: var(--border); }
.btn:hover, .link-btn:hover { opacity: 0.92; text-decoration: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid transparent;
}
.badge-ok { background: rgba(22,163,74,0.16); color: #bbf7d0; border-color: rgba(22,163,74,0.35); }
.badge-warn { background: rgba(245,158,11,0.16); color: #fde68a; border-color: rgba(245,158,11,0.35); }
.badge-error { background: rgba(220,38,38,0.16); color: #fecaca; border-color: rgba(220,38,38,0.35); }

.pill-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}
.pill-ok { background: rgba(22,163,74,0.16); border-color: rgba(22,163,74,0.35); color: #bbf7d0; }
.pill-warn { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.35); color: #fde68a; }
.pill-info { background: rgba(37,99,235,0.16); border-color: rgba(37,99,235,0.35); color: #bfdbfe; }

.callout {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin: 1rem 0;
}
.callout-info { background: rgba(37,99,235,0.12); }
.callout-warn { background: rgba(245,158,11,0.12); }
.callout-error { background: rgba(220,38,38,0.12); }
.no-top-margin { margin-top: 0; }

.flash-stack { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.flash { padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--border); }
.flash-success { background: rgba(22,163,74,0.12); }
.flash-error { background: rgba(220,38,38,0.14); }

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}
.details-grid div {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: rgba(15, 23, 42, 0.45);
}
.details-grid dt { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.3rem; }
.details-grid dd { margin: 0; word-break: break-word; }

.scroll-list {
  max-height: 340px;
  overflow: auto;
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.45);
}
.scroll-list ul { margin: 0; padding-left: 1.1rem; }
.scroll-list li { margin: 0.25rem 0; }
.medium-list { max-height: 280px; }
.tall-list { max-height: 420px; }

.profile-card { position: relative; overflow: hidden; }
.profile-number,
.choice-number {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(37,99,235,0.35);
}
.profile-number {
  position: absolute;
  top: 1rem;
  right: 1rem;
}
.flag-box {
  margin: 1rem 0;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51,65,85,0.6);
  overflow: auto;
}
.flag-box.wide { white-space: pre-wrap; word-break: break-word; }
.log-box {
  min-height: 430px;
  max-height: 430px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  background: #08101d;
  border: 1px solid rgba(51,65,85,0.8);
  white-space: pre-wrap;
  word-break: break-word;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.85rem 0.8rem; border-bottom: 1px solid rgba(51,65,85,0.7); text-align: left; }
th { color: var(--muted); font-weight: 600; }

.plain-list { margin: 0; padding-left: 1.15rem; }
.plain-list li { margin-bottom: 0.6rem; }
.helper-list { margin: 0; padding-left: 1.15rem; }
.helper-list li { margin-bottom: 0.45rem; }
.muted { color: var(--muted); }
.top-gap { margin-top: 1rem; }
.top-gap-small { margin-top: 0.5rem; }

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.mini-stat {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.45);
}
.mini-stat .mini-value { font-size: 1.55rem; font-weight: 800; margin-top: 0.25rem; }
.warn-box .mini-value { color: #fde68a; }

.list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.subpanel {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.25);
}
.subpanel h3 { margin-top: 0; }
.category-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  flex-wrap: wrap;
}
.category-card h2 { margin-bottom: 0.4rem; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.choice-card {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.35);
}
.choice-card h3 { margin-top: 0.75rem; margin-bottom: 0.4rem; }
.profile-highlights {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}
.profile-highlights div {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: rgba(15, 23, 42, 0.45);
}
.profile-highlights p { margin: 0.45rem 0 0; color: #dbe4f0; }

@media (max-width: 1100px) {
  .card-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .container { padding: 1rem; }
  .card-grid.two,
  .card-grid.three,
  .card-grid.four,
  .split-grid,
  .details-grid,
  .status-strip,
  .list-grid { grid-template-columns: 1fr; }
  .topbar { padding: 1rem; }
}
