:root {
  --bg: #eef6f2;
  --bg-2: #f8fbf8;
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --ink: #13221d;
  --muted: #66756f;
  --line: #dce7e1;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --brand-2: #2563eb;
  --gold: #f2b84b;
  --danger: #dc2626;
  --shadow: 0 22px 55px rgba(15, 35, 31, .11);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  background:
    radial-gradient(circle at 9% 12%, rgba(15, 118, 110, .16), transparent 29%),
    radial-gradient(circle at 92% 4%, rgba(37, 99, 235, .12), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2) 58%, #edf7ff);
  color: var(--ink);
  min-height: 100vh;
}
body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, rgba(15, 118, 110, .20), transparent 28%),
    radial-gradient(circle at 83% 82%, rgba(242, 184, 75, .25), transparent 26%),
    linear-gradient(135deg, #e8fbf5, #f8fafc 55%, #eaf3ff);
}
.login-card {
  width: min(440px, 100%);
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 34px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-logo { width: 78px; height: 78px; object-fit: contain; border-radius: 20px; margin-bottom: 14px; background: #fff; padding: 8px; box-shadow: 0 12px 24px rgba(15, 118, 110, .14); }

.app-shell { display: grid; grid-template-columns: 284px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background:
    linear-gradient(180deg, rgba(7, 37, 34, .98), rgba(16, 24, 40, .98)),
    radial-gradient(circle at top left, rgba(47, 189, 176, .25), transparent 36%);
  color: #fff;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 16px 0 40px rgba(16, 24, 40, .12);
}
.sidebar-overlay { display: none; }
.brand {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -.02em;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
}
.brand img { width: 42px; height: 42px; object-fit: contain; border-radius: 14px; background: #fff; padding: 5px; }
.menu-close {
  display: none;
  margin-left: auto;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.1);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d5e4df;
  padding: 12px 13px;
  border-radius: 15px;
  margin: 5px 0;
  font-weight: 800;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.nav-link::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.24);
  box-shadow: 0 0 0 5px rgba(255,255,255,.04);
}
.nav-link:hover { transform: translateX(3px); background: rgba(255,255,255,.10); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, rgba(20, 184, 166, .25), rgba(37, 99, 235, .20)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.nav-link.active::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(242,184,75,.16); }

.main { min-width: 0; }
.topbar {
  min-height: 78px;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(220, 231, 225, .84);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 30px);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 12px; background: #fff; padding: 3px; }
.topbar-subtitle { display: inline-block; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 15px;
  background: var(--brand-dark);
  color: #fff;
  cursor: pointer;
  padding: 11px;
  box-shadow: 0 12px 24px rgba(19, 78, 74, .2);
}
.menu-toggle span { display: block; height: 2px; background: #fff; border-radius: 999px; margin: 5px 0; }
.content { padding: clamp(16px, 3vw, 30px); }

h1 { margin: 0 0 18px; font-size: clamp(28px, 4vw, 42px); line-height: 1.04; letter-spacing: -.045em; }
h3 { margin-top: 0; letter-spacing: -.015em; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.76);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 22px);
  box-shadow: 0 12px 34px rgba(15, 35, 31, .07);
  backdrop-filter: blur(14px);
}
.stats .card { position: relative; overflow: hidden; }
.stats .card::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -22px;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 118, 110, .13), rgba(242, 184, 75, .16));
}
.metric { font-size: clamp(30px, 6vw, 46px); font-weight: 900; margin: 6px 0 0; letter-spacing: -.055em; color: var(--brand-dark); }
.muted { color: var(--muted); }

.btn {
  border: 0;
  border-radius: 13px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn:hover { transform: translateY(-1px); filter: saturate(1.06); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 12px 22px rgba(15, 118, 110, .20); }
.btn-secondary { background: #dff7f3; color: #0f5f58; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-light { background: #f2f6f4; color: #344054; }

.form-control,.form-select,textarea {
  width: 100%;
  border: 1px solid #cfdcd6;
  border-radius: 14px;
  padding: 11px 13px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  font: inherit;
  outline: none;
}
.form-control:focus,.form-select:focus,textarea:focus { border-color: rgba(15, 118, 110, .75); box-shadow: 0 0 0 4px rgba(15, 118, 110, .11); }
label { font-weight: 900; font-size: 13px; margin-bottom: 7px; display: block; color: #263c35; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; align-items: end; }

table { width: 100%; border-collapse: collapse; }
th,td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #52645d; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: rgba(248, 250, 252, .85); }
td { line-height: 1.45; }
code { word-break: break-word; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-bad { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h1 { margin-bottom: 0; }
.alert { padding: 13px 15px; border-radius: 16px; margin-bottom: 14px; border: 1px solid var(--line); background: #fff; }
.alert-success { border-color: #bbf7d0; background: #f0fdf4; }
.alert-danger { border-color: #fecaca; background: #fef2f2; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; }
.table-wrap table { min-width: 680px; }
.code {
  background: linear-gradient(135deg, #0f172a, #102522);
  color: #e5e7eb;
  border-radius: 18px;
  padding: 16px;
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.pagination-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; flex-wrap: wrap; }
.pagination-links { display: flex; gap: 7px; flex-wrap: wrap; }
.branding-preview { width: 116px; min-height: 74px; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; margin-bottom: 8px; background: #f9fafb; padding: 8px; }
.branding-preview img { max-width: 100%; max-height: 64px; object-fit: contain; }
.favicon-preview { width: 56px; min-height: 56px; }
.favicon-preview img { max-width: 32px; max-height: 32px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 330px);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .24s ease;
  }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(12, 20, 18, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    backdrop-filter: blur(3px);
  }
  .menu-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .menu-toggle,.menu-close { display: inline-block; }
  .topbar { align-items: flex-start; }
  .topbar-actions { margin-top: 1px; }
  .dashboard-panels,.form-row { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

@media (max-width: 640px) {
  .login-shell { padding: 16px; }
  .topbar { min-height: auto; flex-wrap: wrap; }
  .topbar-left { width: 100%; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .topbar-subtitle { display: none; }
  .stats { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .toolbar > * { width: 100%; }
  .toolbar .btn { width: 100%; }
  .btn { width: 100%; }
  td .btn, .pagination-links .btn, .topbar-actions .btn { width: auto; }
  .table-wrap table { min-width: 620px; }
  .card { border-radius: 18px; }
}
