:root {
  --bg: #07070f;
  --bg-2: #0b0b18;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0ff;
  --muted: #a0a3bd;
  --muted-2: #747795;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(124, 58, 237, 0.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(34, 211, 238, 0.07), transparent 55%),
    linear-gradient(180deg, #07070f, #080812 60%, #06060d);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

::selection {
  background: rgba(139, 92, 246, 0.35);
  color: #fff;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #080810;
}

::-webkit-scrollbar-thumb {
  background: #262640;
  border-radius: 999px;
  border: 2px solid #080810;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.grad {
  background: linear-gradient(100deg, #a78bfa, #22d3ee 50%, #f472b6);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 7s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ------------------------------------------------------------------ brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 17px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex: none;
}

.brand-text {
  background: linear-gradient(90deg, #ffffff, #cfd0ff 60%, #a5f3fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text small {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  margin-left: 4px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  flex: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a78bfa;
  margin-bottom: 10px;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: transparent;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1 50%, #22d3ee 130%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.32);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.28);
  color: #fda4af;
}

.btn-danger:hover {
  background: rgba(251, 113, 133, 0.18);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* ------------------------------------------------------------------ login */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 1040px;
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  border-radius: 26px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 10, 20, 0.72);
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
}

.login-visual {
  position: relative;
  padding: 44px;
  background:
    radial-gradient(600px 400px at 0% 0%, rgba(124, 58, 237, 0.3), transparent 65%),
    radial-gradient(500px 400px at 100% 100%, rgba(34, 211, 238, 0.12), transparent 60%),
    linear-gradient(160deg, rgba(20, 20, 38, 0.9), rgba(8, 8, 16, 0.95));
  overflow: hidden;
  display: flex;
  align-items: center;
}

.login-visual-inner {
  position: relative;
  z-index: 2;
  max-width: 400px;
}

.login-visual h1 {
  margin: 34px 0 16px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.03;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.login-visual p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 340px;
}

.login-chat {
  display: grid;
  gap: 8px;
  margin-top: 30px;
  max-width: 280px;
}

.login-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.4;
  animation: bubbleIn 0.6s ease both;
}

.login-bubble.in {
  justify-self: start;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.login-bubble.out {
  justify-self: end;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.login-bubble:nth-child(2) { animation-delay: 0.18s; }
.login-bubble:nth-child(3) { animation-delay: 0.36s; }

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.login-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 30px;
}

.login-badges span {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--mono);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.login-orb-1 {
  width: 300px;
  height: 300px;
  right: -120px;
  top: -100px;
  background: rgba(139, 92, 246, 0.35);
}

.login-orb-2 {
  width: 240px;
  height: 240px;
  left: -100px;
  bottom: -100px;
  background: rgba(34, 211, 238, 0.18);
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px;
  background: rgba(8, 8, 16, 0.6);
}

.login-card {
  width: 100%;
  max-width: 340px;
}

.login-card-head h2 {
  font-size: 30px;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
}

.login-card-head p {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 22px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted-2);
}

.login-footer a {
  color: var(--muted);
}

.login-footer a:hover {
  color: var(--text);
}

/* ------------------------------------------------------------------ admin shell */

.admin-body {
  background: var(--bg);
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 258px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--border);
  background: rgba(8, 8, 16, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 0.24s ease;
}

.admin-sidebar > .brand {
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.admin-nav {
  display: grid;
  gap: 3px;
}

.admin-nav a,
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.admin-nav a:hover,
.admin-nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.admin-nav a.active {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.26);
  color: #ddd6fe;
}

.admin-nav form {
  margin: 0;
}

.admin-nav-sep {
  height: 1px;
  background: var(--border);
  margin: 9px 0;
}

.admin-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.admin-user strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.2;
}

.admin-user span {
  display: block;
  font-size: 10.5px;
  color: var(--muted-2);
}

.admin-main {
  flex: 1;
  min-width: 0;
  margin-left: 258px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 7, 15, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.admin-topbar h1 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar-spacer {
  flex: 1;
}

.admin-nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: none;
}

.admin-nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.admin-overlay.show {
  display: block;
  opacity: 1;
}

.admin-content {
  padding: 26px;
  max-width: 1220px;
}

/* ------------------------------------------------------------------ cards / panels */

.admin-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}

.admin-card {
  padding: 17px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
}

.admin-card .label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.admin-card .value {
  margin-top: 7px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(90deg, #fff, #c4b5fd 75%, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.admin-card .value.small {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.admin-card .sub {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted-2);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 15.5px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
}

.panel h2 {
  font-size: 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.quick {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.quick:hover {
  border-color: rgba(139, 92, 246, 0.38);
  background: rgba(139, 92, 246, 0.07);
  transform: translateY(-2px);
}

.quick .icon {
  width: 20px;
  height: 20px;
  color: #a5f3fc;
  margin-bottom: 3px;
}

.quick strong {
  font-size: 13px;
  font-weight: 600;
}

.quick span {
  font-size: 11px;
  color: var(--muted-2);
}

/* ------------------------------------------------------------------ tables */

.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th {
  padding: 9px 11px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

td a {
  color: #ddd6fe;
}

td a:hover {
  color: #fff;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions form {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.ok {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
}

.badge.warn {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
}

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.kv > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.kv span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.kv strong {
  font-size: 13px;
  font-weight: 600;
}

.kv a {
  color: #c4b5fd;
}

/* ------------------------------------------------------------------ forms */

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.form input,
.form textarea,
.form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14);
}

.form textarea {
  resize: vertical;
  min-height: 70px;
}

.form input::placeholder,
.form textarea::placeholder {
  color: #5b5e7a;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-row:has(label:nth-child(3)) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-label {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
  padding-top: 24px;
  font-weight: 500 !important;
}

.check-label input {
  width: auto;
  accent-color: #8b5cf6;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.sticky-actions {
  position: sticky;
  bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.form-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: #c4b5fd;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature-editor,
.faq-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.018);
}

.audit-log {
  margin: 0;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #06060c;
  color: #a5f3fc;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
}

/* ------------------------------------------------------------------ flash */

.flash {
  padding: 11px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.flash-ok {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.09);
  color: #a7f3d0;
}

.flash-err {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.09);
  color: #fecdd3;
}

.muted {
  color: var(--muted-2);
  font-size: 13px;
}

/* ------------------------------------------------------------------ responsive */

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

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

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 460px;
    min-height: 0;
  }

  .login-visual {
    display: none;
  }

  .login-form-side {
    padding: 34px 26px;
  }

  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: none;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-nav-toggle {
    display: flex;
  }

  .admin-content {
    padding: 18px;
  }

  .admin-topbar {
    padding: 12px 18px;
  }

  .admin-topbar .btn {
    display: none;
  }
}

@media (max-width: 640px) {
  .admin-cards {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .form-row,
  .form-row:has(label:nth-child(3)) {
    grid-template-columns: 1fr;
  }

  .check-label {
    padding-top: 0;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .admin-topbar h1 {
    font-size: 15px;
  }
}
