:root {
  --bg: #07111f;
  --panel: rgba(255,255,255,.08);
  --panel-strong: rgba(255,255,255,.12);
  --text: #eef6ff;
  --muted: #93a6bd;
  --line: rgba(255,255,255,.12);
  --primary: #41d1ff;
  --primary-dark: #1689d3;
  --danger: #ff4f67;
  --warning: #ffd166;
  --orange: #ff9f1c;
  --green: #34d399;
  --shadow: 0 24px 90px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(65,209,255,.18), transparent 28rem),
    radial-gradient(circle at 85% 20%, rgba(255,159,28,.16), transparent 30rem),
    linear-gradient(135deg, #07111f 0%, #0b1930 45%, #111827 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
code { color: #9ee8ff; background: rgba(255,255,255,.08); padding: .1rem .35rem; border-radius: .35rem; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 280px;
  padding: 24px;
  background: rgba(0,0,0,.24);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  backdrop-filter: blur(20px);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 30px; }
.brand strong { display: block; font-size: 1.25rem; }
.brand span { display: block; color: var(--muted); font-size: .82rem; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #00131f;
  box-shadow: 0 12px 30px rgba(65,209,255,.25);
}
.brand-mark.big { width: 82px; height: 82px; border-radius: 26px; font-size: 1.8rem; }
.nav { display: grid; gap: 8px; }
.nav a {
  padding: 13px 14px;
  border-radius: 14px;
  color: #c9d8e8;
  border: 1px solid transparent;
  transition: .18s ease;
}
.nav a:hover, .nav a.active { background: rgba(65,209,255,.12); border-color: rgba(65,209,255,.22); color: white; }
.logout-form { margin-top: 28px; }
.content { flex: 1; padding: 26px; max-width: 1600px; margin: 0 auto; width: 100%; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 22px;
}
.eyebrow { margin: 0 0 5px; color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.7rem); line-height: .95; letter-spacing: -.05em; }
h2 { margin-bottom: 10px; }
.system-phone {
  min-width: 230px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  box-shadow: var(--shadow);
}
.system-phone span { display: block; color: var(--muted); font-size: .78rem; }
.system-phone strong { font-size: 1.25rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(120px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stat-card span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.stat-card strong { font-size: 2rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(18px);
}
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 18px 0; }
.section-header.compact { margin: 0 0 15px; }
.section-header p, .hint { color: var(--muted); margin-bottom: 0; }
.message-list { display: grid; gap: 12px; }
.message-stripe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 17px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.message-stripe.new { background: linear-gradient(90deg, rgba(255,209,102,.22), rgba(255,255,255,.08)); border-color: rgba(255,209,102,.38); }
.message-stripe.danger { background: linear-gradient(90deg, rgba(255,79,103,.25), rgba(255,255,255,.08)); border-color: rgba(255,79,103,.46); }
.message-stripe.vip { background: linear-gradient(90deg, rgba(255,159,28,.28), rgba(255,255,255,.08)); border-color: rgba(255,159,28,.5); }
.message-main p { font-size: 1.1rem; margin: 10px 0 0; line-height: 1.45; overflow-wrap: anywhere; }
.message-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); }
.message-meta strong { color: #fff; }
.message-meta small { color: var(--muted); }
.flags { color: #ffd5dc; margin-top: 9px; font-size: .85rem; }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255,255,255,.12);
  font-size: .75rem;
  font-weight: 800;
}
.status-pending { background: rgba(255,209,102,.22); color: #ffe6a3; }
.status-queue { background: rgba(52,211,153,.22); color: #b7f7db; }
.status-banned, .status-bad, .status-cooldown { background: rgba(255,79,103,.24); color: #ffd5dc; }
.vip-pill { background: rgba(255,159,28,.25); color: #ffe2b6; }
.auto-pill { background: rgba(65,209,255,.18); color: #b7eeff; }
.btn, .primary-btn, .danger-btn, .orange-btn, .ghost-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 800;
  color: white;
  transition: .16s ease;
  white-space: nowrap;
}
.btn:hover, .primary-btn:hover, .danger-btn:hover, .orange-btn:hover, .ghost-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-btn { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #00131f; }
.danger-btn, .btn.delete, .btn.ban { background: linear-gradient(135deg, #ff4f67, #b91c1c); }
.orange-btn { background: linear-gradient(135deg, var(--orange), #ea580c); color: #1f1200; }
.ghost-btn { background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.btn.approve { background: linear-gradient(135deg, var(--green), #059669); color: #001d13; }
.btn.bad { background: linear-gradient(135deg, #f59e0b, #d97706); color: #211300; }
.small { padding: 7px 10px; font-size: .82rem; }
.flash { border-radius: 16px; padding: 13px 15px; margin: 0 0 15px; background: rgba(52,211,153,.18); color: #c2ffe7; border: 1px solid rgba(52,211,153,.35); }
.flash.danger { background: rgba(255,79,103,.16); color: #ffd5dc; border-color: rgba(255,79,103,.35); }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form.wide input { min-width: min(600px, 100%); flex: 1; }
.inline-form.no-margin { margin: 0; }
.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #dbe8f7; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  color: white;
  padding: 12px 13px;
  outline: none;
}
input:focus, textarea:focus { border-color: rgba(65,209,255,.7); box-shadow: 0 0 0 4px rgba(65,209,255,.12); }
textarea { resize: vertical; }
.check-inline { display: inline-flex; grid-template-columns: auto; align-items: center; gap: 8px; width: auto; color: #dbe8f7; }
.check-inline input { width: auto; }
.setting-check { margin: 4px 0 8px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.table-form input { min-width: 180px; }
.badges-cell { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.vote-card {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.08);
}
.vote-card span { color: var(--muted); display: block; }
.vote-card strong { display: block; font-size: 1.2rem; }
.vote-card b { font-size: 2.4rem; color: var(--primary); }
.vote-card.muted { opacity: .55; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.settings-form label:nth-of-type(6), .settings-form label:nth-of-type(7) { grid-column: span 1; }
.two-col-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chip-list { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.chip { padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.1); color: #dbe8f7; }
.auto-message-list { display: grid; gap: 10px; margin-top: 14px; }
.auto-message-row { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.06); }
.auto-message-row p { margin-bottom: 4px; }
.auto-message-row small { color: var(--muted); display: block; margin-bottom: 8px; }
.analytics-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.small-table table { min-width: 640px; }
.empty-state { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; background: rgba(255,255,255,.04); }

.login-body, .tester-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
  align-items: stretch;
}
.login-hero, .login-card, .tester-panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  border-radius: 34px;
  padding: clamp(24px, 5vw, 50px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}
.login-hero h1 { margin: 24px 0 16px; font-size: clamp(3rem, 9vw, 6rem); }
.login-hero p { color: #c9d8e8; max-width: 680px; font-size: 1.15rem; line-height: 1.65; }
.login-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.login-badges span { padding: 10px 12px; border-radius: 999px; background: rgba(65,209,255,.12); color: #c6f2ff; }
.login-card h2 { font-size: 2rem; }
.login-card p { color: var(--muted); }
.tester-link { display: inline-block; margin-top: 16px; color: var(--primary); font-weight: 800; }
.tester-shell { width: min(1180px, 100%); }
.tester-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.api-output { margin-top: 18px; background: rgba(0,0,0,.35); border: 1px solid var(--line); color: #d7f6ff; border-radius: 18px; padding: 16px; overflow: auto; min-height: 180px; white-space: pre-wrap; }

@media (max-width: 1000px) {
  .app-shell { display: block; }
  .sidebar { width: auto; height: auto; position: static; padding: 16px; }
  .nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .message-stripe { grid-template-columns: 1fr; }
  .message-actions { justify-content: flex-start; }
  .settings-form, .two-col-panel, .login-shell, .tester-grid { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  .system-phone { width: 100%; }
}

@media (max-width: 560px) {
  .nav { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 1.55rem; }
  .message-actions form, .message-actions button { width: 100%; }
  .message-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .inline-form { display: grid; grid-template-columns: 1fr; }
  .login-body, .tester-body { padding: 12px; }
  .login-hero, .login-card, .tester-panel, .panel { border-radius: 22px; }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(65,209,255,.28);
  background: rgba(65,209,255,.12);
  color: #b7eeff;
  font-weight: 900;
  white-space: nowrap;
}
.live-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 20px rgba(65,209,255,.9);
}
.live-badge.ok { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.14); color: #c2ffe7; }
.live-badge.ok::before { background: var(--green); box-shadow: 0 0 20px rgba(52,211,153,.9); }
.live-badge.bad { border-color: rgba(255,79,103,.35); background: rgba(255,79,103,.14); color: #ffd5dc; }
.live-badge.bad::before { background: var(--danger); box-shadow: 0 0 20px rgba(255,79,103,.9); }
button:disabled { opacity: .55; cursor: wait; transform: none !important; }

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  color: white;
  padding: 12px 13px;
  outline: none;
}
select:focus { border-color: rgba(65,209,255,.7); box-shadow: 0 0 0 4px rgba(65,209,255,.12); }
.stats-grid.six { grid-template-columns: repeat(6, minmax(110px,1fr)); }
.sidebar-toggle {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}
.nav a { display: flex; align-items: center; gap: 10px; }
.nav a span { width: 24px; display: inline-grid; place-items: center; flex: 0 0 24px; }
.nav a b { font: inherit; font-weight: 800; }
.app-shell.sidebar-collapsed .sidebar { width: 92px; padding: 20px 14px; }
.app-shell.sidebar-collapsed .brand { justify-content: center; gap: 0; }
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav a b,
.app-shell.sidebar-collapsed .logout-form { display: none; }
.app-shell.sidebar-collapsed .brand-mark { width: 46px; height: 46px; }
.app-shell.sidebar-collapsed .sidebar-toggle { position: absolute; top: 74px; left: 26px; width: 38px; height: 38px; }
.app-shell.sidebar-collapsed .nav { margin-top: 52px; }
.app-shell.sidebar-collapsed .nav a { justify-content: center; padding: 13px 10px; }
.status-cleared { background: rgba(148,163,184,.2); color: #dbeafe; }
.status-hashtag, .queue-type-pill { background: rgba(139,92,246,.22); color: #e9d5ff; text-transform: capitalize; }
.tag-flags { color: #c4b5fd; }
.setting-card { padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.06); }
.setting-card h3 { margin-bottom: 10px; }
.full-span { grid-column: 1 / -1; }

@media (max-width: 1200px) {
  .stats-grid.six { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1000px) {
  .app-shell.sidebar-collapsed .sidebar { width: auto; padding: 16px; }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav a b,
  .app-shell.sidebar-collapsed .logout-form { display: block; }
  .app-shell.sidebar-collapsed .nav a { justify-content: flex-start; }
  .app-shell.sidebar-collapsed .sidebar-toggle { position: static; }
}
@media (max-width: 700px) {
  .stats-grid.six { grid-template-columns: repeat(2, 1fr); }
}

.stats-grid.seven { grid-template-columns: repeat(7, minmax(105px,1fr)); }
.search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  border-radius: 18px;
}
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 10px 13px;
  font-weight: 800;
  color: #dbe8f7;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.pagination-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination-summary { color: var(--muted); }
.pagination { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.page-link, .page-dots {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: #dbe8f7;
  font-weight: 900;
}
.page-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #00131f; border-color: transparent; }
.page-link.disabled { opacity: .4; pointer-events: none; }
.page-dots { border: 0; background: transparent; color: var(--muted); }
.editable-auto-message { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.auto-message-edit-form { display: grid; gap: 8px; }
.auto-message-edit-form textarea { min-height: 70px; }

@media (max-width: 1300px) {
  .stats-grid.seven { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .stats-grid.seven { grid-template-columns: repeat(2, 1fr); }
  .search-form { grid-template-columns: 1fr; }
  .editable-auto-message { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid.seven { grid-template-columns: 1fr 1fr; }
  .pagination-wrap { align-items: stretch; }
  .pagination { width: 100%; }
  .page-link, .page-dots { flex: 1; }
}
