:root {
  --bg: #eef3f8;
  --bg-strong: #0f1b2e;
  --surface: #ffffff;
  --surface-soft: #f7fafe;
  --surface-dark: #13233c;
  --line: #d7e2ef;
  --line-strong: #a8bdd7;
  --text: #122138;
  --muted: #61728b;
  --primary: #0d6efd;
  --primary-2: #1f9dfb;
  --danger: #c5363d;
  --shadow: 0 22px 48px rgba(18, 33, 56, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(13, 110, 253, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 18px;
  color: white;
  background: linear-gradient(180deg, #12203a 0%, #0d182b 52%, #09111f 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-top {
  display: grid;
  gap: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #1f9dfb, #0d6efd);
  color: white;
  font-weight: 800;
  font-size: 24px;
  box-shadow: 0 18px 40px rgba(13, 110, 253, 0.28);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
}

.brand-subtitle,
.sidebar-copy,
.nav-caption {
  color: rgba(216, 229, 250, 0.7);
}

.sidebar-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-caption {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.nav-btn,
.sidebar-link,
button {
  transition: 140ms ease;
}

.nav-btn {
  width: 100%;
  border: 1px solid rgba(181, 205, 240, 0.12);
  color: white;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 600;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(120, 170, 233, 0.38);
}

.nav-btn.danger {
  border-color: rgba(255, 120, 120, 0.3);
  color: #ffc7c7;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  color: #d7e7ff;
  font-weight: 700;
}

.main {
  padding: 24px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 254, 0.98));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.panel.compact { padding: 14px 18px; }

.workspace-header,
.section-title-row,
.header-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

h1, h2, h3 { margin: 0 0 10px; }
h1 { font-size: 36px; line-height: 1.08; max-width: 14ch; }
h2 { font-size: 27px; }
h3 { font-size: 18px; }

p, .muted { color: var(--muted); }
.hidden { display: none !important; }

.section-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scope-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--text);
  padding: 12px;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

button {
  border: 1px solid var(--line);
  color: var(--text);
  background: white;
  border-radius: 14px;
  padding: 11px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button.primary {
  border: none;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

button.danger {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #d74c56, var(--danger));
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; margin-bottom: 8px; }
.message { margin-top: 8px; color: #0d7b39; font-size: 13px; font-weight: 700; }
.message.err { color: #b42318; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 82px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  background: #edf3fb;
}

.cards { display: grid; gap: 12px; margin-bottom: 16px; }
.cards.kpi-grid { grid-template-columns: repeat(6, 1fr); }
.cards.four { grid-template-columns: repeat(4, 1fr); }

.kpi {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
  padding: 14px;
}

.kpi .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi .value { margin-top: 8px; font-size: 28px; font-weight: 800; }
.kpi .sub { margin-top: 4px; color: #3c5f8d; font-size: 12px; }

.chart-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; margin-bottom: 16px; }
.chart-grid.two { grid-template-columns: 1fr 1fr; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { padding: 11px; border-bottom: 1px solid #e8eef6; text-align: left; font-size: 13px; }
th { color: #335078; position: sticky; top: 0; background: #f8fbff; z-index: 1; }

.badge-pill { border-radius: 999px; padding: 3px 8px; font-size: 11px; display: inline-block; }
.badge-good { background: rgba(34,197,94,0.14); color: #1d7b46; border: 1px solid rgba(34,197,94,0.3); }
.badge-warn { background: rgba(245,158,11,0.14); color: #b56b00; border: 1px solid rgba(245,158,11,0.3); }
.badge-bad { background: rgba(239,68,68,0.14); color: #b42318; border: 1px solid rgba(239,68,68,0.3); }

.feed-list { display: grid; gap: 10px; }
.feed-item {
  border: 1px solid var(--line);
  background: white;
  border-radius: 18px;
  padding: 14px;
}

.feed-item .row { display: flex; justify-content: space-between; gap: 10px; }
.feed-item .title { font-weight: 800; margin-bottom: 3px; }
.feed-item .meta { color: var(--muted); font-size: 12px; }

.auth-panel {
  max-width: 860px;
}

code {
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 1500px) {
  .cards.kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-grid,
  .chart-grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 1180px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: none; }
  .scope-grid { grid-template-columns: 1fr 1fr; }
  .workspace-header { flex-direction: column; align-items: stretch; }
}

@media (max-width: 760px) {
  .main { padding: 16px; }
  .form-grid,
  .form-grid.three,
  .cards.kpi-grid,
  .cards.four,
  .scope-grid { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
}
