:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1b2333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --sidebar: #0f172a;
  --sidebar-muted: #94a3b8;
  --sidebar-active: #1e293b;
  --success: #166534;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body.admin-body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.admin-sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 18px 12px;
  border-right: 1px solid #111827;
}

.quick-actions {
  width: 100%;
  border: 1px solid #1f2937;
  background: #111827;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  margin-bottom: 10px;
}

.setup-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.setup-card .title {
  font-size: 13px;
  font-weight: 600;
}

.setup-card .progress {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: #1f2937;
  overflow: hidden;
}

.setup-card .progress > span {
  display: block;
  width: 33%;
  height: 100%;
  background: #2563eb;
}

.setup-card .meta {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 12px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  padding: 8px 10px 16px;
  border-bottom: 1px solid #1f2937;
  margin-bottom: 12px;
}

.brand small {
  display: block;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

.menu-group {
  margin: 14px 0;
}

.menu-title {
  color: var(--sidebar-muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  margin: 0 0 4px;
  /* button reset */
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.menu-title:hover { color: #e2e8f0; }

.chevron {
  font-size: 13px;
  display: inline-block;
  transition: transform 0.2s ease;
}
.menu-title:not(.open) .chevron {
  transform: rotate(-90deg);
}

.side-nav {
  display: grid;
  gap: 4px;
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.side-nav.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

.side-nav a,
.side-item {
  color: #e2e8f0;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  display: block;
}

.side-nav a:hover,
.side-nav a.active,
.side-item:hover,
.side-item.active {
  background: var(--sidebar-active);
}

.side-subnav {
  display: grid;
  gap: 3px;
  margin: 4px 0 8px 12px;
  border-left: 1px solid #1f2937;
  padding-left: 8px;
}

.side-subnav a {
  font-size: 13px;
  color: #cbd5e1;
  padding: 7px 8px;
  border-radius: 8px;
}

.admin-main {
  display: grid;
  grid-template-rows: 64px 1fr;
  min-width: 0;
}

.admin-topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.top-page-title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.top-search input {
  width: min(440px, 50vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: #f8fafc;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: #eef2ff; color: #1e3a8a; }
.btn-muted { background: #f3f4f6; color: #111827; }
.btn-danger { background: #fee2e2; color: #991b1b; }

.admin-content {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

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

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}

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

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

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

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e2e8f0;
}

.badge.success { background: #dcfce7; color: var(--success); }
.badge.warn { background: #fef9c3; color: #854d0e; }
.badge.danger { background: #fee2e2; color: #991b1b; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: 0; border-bottom: 1px solid #1f2937; }
  .top-search { display: none; }
  .grid-2,
  .grid-3 { grid-template-columns: 1fr; }
}
