:root {
  --admin-panel: rgba(16, 22, 28, 0.92);
  --admin-panel-soft: rgba(255, 255, 255, 0.035);
  --admin-line: rgba(255, 255, 255, 0.1);
  --admin-good: #64d8a4;
  --admin-warn: #f5c56b;
  --admin-danger: #ff8383;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  border-right: 1px solid var(--admin-line);
  background: rgba(7, 11, 14, 0.96);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #091015;
  background: var(--accent);
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--text-muted); font-size: 11px; }

.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a, .sidebar-footer a, .text-button {
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.sidebar nav a:hover, .sidebar nav a.active, .sidebar-footer a:hover, .text-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}
.sidebar nav a.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-footer { margin-top: auto; display: grid; gap: 4px; }

main { min-width: 0; padding: 36px clamp(22px, 5vw, 64px) 64px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 36px;
}
.topbar h1 { margin: 5px 0 0; font-size: clamp(30px, 4vw, 48px); }
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.identity {
  padding: 9px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-gate { min-height: 60vh; display: grid; place-items: center; }
.auth-card {
  width: min(460px, 100%);
  padding: 42px;
  border: 1px solid var(--admin-line);
  border-radius: 24px;
  background: var(--admin-panel);
  text-align: center;
}
.auth-card h2 { margin: 10px 0; }
.auth-card p:not(.eyebrow) { color: var(--text-muted); line-height: 1.7; }

.primary-button, .secondary-button, .danger-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 650;
}
.primary-button { color: #071014; background: var(--accent); }
.secondary-button { color: var(--text); background: rgba(255, 255, 255, 0.09); }
.danger-button { color: #240808; background: var(--admin-danger); }
.small-button { padding: 7px 10px; font-size: 12px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.metric, .panel, .opportunity-card {
  border: 1px solid var(--admin-line);
  background: var(--admin-panel-soft);
  border-radius: 16px;
}
.metric { padding: 20px; }
.metric span { color: var(--text-muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 30px; }

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}
.panel { padding: 22px; margin-bottom: 18px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel h2, .panel h3 { margin: 0; }
.muted { color: var(--text-muted); }
.notice {
  border-left: 3px solid var(--admin-warn);
  padding: 12px 14px;
  background: rgba(245, 197, 107, 0.08);
  color: var(--text-muted);
  margin-bottom: 18px;
}

.gate-grid { display: grid; gap: 8px; }
.gate-row { display: grid; grid-template-columns: 90px 1fr 36px; align-items: center; gap: 10px; }
.gate-track { height: 7px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.gate-track i { display: block; height: 100%; min-width: 3px; background: var(--accent); }

.card-list { display: grid; gap: 14px; }
.opportunity-card { padding: 20px; }
.card-head { display: flex; justify-content: space-between; gap: 14px; }
.card-head h3 { margin: 5px 0; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 11px;
}
.badge.good { color: var(--admin-good); }
.badge.warn { color: var(--admin-warn); }
.badge.danger { color: var(--admin-danger); }
.progress { height: 7px; margin: 12px 0 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.card-meta, .button-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.card-meta { color: var(--text-muted); font-size: 12px; }
.button-row { margin-top: 16px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--admin-line); text-align: left; vertical-align: top; }
.data-table th { color: var(--text-muted); font-weight: 600; }
.data-table a { color: var(--accent); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--text-muted); font-size: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
}
textarea { min-height: 92px; resize: vertical; }
details.form-panel > summary { cursor: pointer; font-weight: 700; }
details.form-panel[open] > summary { margin-bottom: 18px; }
.empty { padding: 34px; text-align: center; color: var(--text-muted); }
.loading { padding: 60px 0; text-align: center; color: var(--text-muted); }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border-radius: 12px;
  color: var(--text);
  background: #1b242b;
  border: 1px solid var(--admin-line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--admin-danger); }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .sidebar-footer { grid-template-columns: 1fr 1fr; }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  main { padding: 24px 16px 48px; }
  .sidebar { padding: 18px 14px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .topbar { display: block; }
  .identity { display: inline-block; margin-top: 14px; }
}
