:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --sidebar: #0b1220;
  --sidebar-text: #cbd5e1;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Hind Siliguri", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.sidebar-brand strong { color: #fff; display: block; }
.sidebar-brand small { color: var(--sidebar-text); font-size: 12px; }

.sidebar-nav { flex: 1; padding: 12px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  margin-bottom: 4px;
  text-decoration: none;
  font-size: 14px;
}

.nav-link:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }

.nav-icon { width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.sidebar-foot a { color: var(--sidebar-text); }
.sidebar-foot .logout { color: #fca5a5; }

.main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
}

.topbar {
  padding: 24px 28px 0;
}

.topbar h1 { font-size: 24px; }
.topbar .muted { color: var(--muted); font-size: 13px; margin-top: 4px; }

.content { padding: 20px 28px 40px; }

.alert {
  margin: 16px 28px 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}

.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--primary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 { font-size: 16px; }
.card-body { padding: 20px; }

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th, table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

table.data tr:hover td { background: #fafcff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-ok { background: #dcfce7; color: #166534; }
.badge-off { background: #f1f5f9; color: #64748b; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.field textarea { resize: vertical; min-height: 80px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: normal; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: #f1f5f9; color: var(--text); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }

.empty { color: var(--muted); text-align: center; padding: 40px 20px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0b1220, #1e3a8a);
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-box h1 { font-size: 22px; margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.msg-preview {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
  max-height: 80px;
  overflow: hidden;
}

.api-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.api-tab {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.api-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.api-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.api-base {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.api-base .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

.api-url {
  background: #0b1220;
  color: #93c5fd;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  word-break: break-all;
}

.api-note { font-size: 13px; color: var(--muted); margin-bottom: 8px; line-height: 1.6; }
.api-note code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.api-list { display: flex; flex-direction: column; gap: 16px; }

.api-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fafcff;
}

.api-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.api-method {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.api-method-get { background: #dcfce7; color: #166534; }
.api-method-post { background: #dbeafe; color: #1e40af; }
.api-method-put { background: #fef3c7; color: #92400e; }
.api-method-delete { background: #fee2e2; color: #991b1b; }

.api-path { font-size: 14px; font-weight: 600; color: var(--text); }

.api-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.api-code-wrap { margin-top: 10px; position: relative; }

.api-code-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.api-code {
  background: #0b1220;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  overflow-x: auto;
  margin: 0 0 8px;
  font-family: Consolas, monospace;
  line-height: 1.5;
}

.api-code-block { white-space: pre-wrap; word-break: break-all; }

.sidebar-web {
  background: linear-gradient(180deg, #0c4a6e 0%, #0b1220 100%);
}

.sidebar-web .brand-icon { background: #0ea5e9; }
.sidebar-web .nav-link.active { background: #0ea5e9; }

.panel-switch {
  display: block;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #93c5fd !important;
  text-decoration: none !important;
}

.panel-switch:hover { background: rgba(255,255,255,0.18); }

.web-tag a { color: var(--primary); }

.web-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  padding: 20px 24px;
  border-radius: 16px;
  margin-bottom: 24px;
}

.web-hero-banner h2 { font-size: 20px; margin-bottom: 4px; }
.web-hero-banner p { font-size: 14px; opacity: 0.9; }
.web-hero-banner a { color: #fff; text-decoration: underline; }

.web-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.web-section-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: #fafcff;
}

.web-section-icon { font-size: 28px; margin-bottom: 8px; }
.web-section-card h3 { font-size: 15px; margin-bottom: 6px; }
.web-section-card p { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }

.panel-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.panel-picker-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.panel-picker-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.panel-picker-card.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.panel-picker-card.panel-web:hover { border-color: #0ea5e9; }

.panel-picker-icon { font-size: 32px; }
.panel-picker-card strong { display: block; font-size: 15px; }
.panel-picker-card p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.panel-picker-arrow { margin-left: auto; font-size: 20px; color: var(--primary); }

@media (max-width: 900px) {
  .sidebar { width: 72px; }
  .sidebar-brand div, .nav-link span:not(.nav-icon), .nav-badge, .sidebar-foot span { display: none; }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .nav-link { justify-content: center; padding: 12px; }
  .main { margin-left: 72px; }
  .topbar, .content, .alert { padding-left: 16px; padding-right: 16px; }
}
