@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0f14;
  --bg-soft: #0e1620;
  --card: #111a26;
  --card-2: #152235;
  --ink: #e8eef6;
  --muted: #93a4b8;
  --accent: #1cc8a0;
  --accent-2: #ffb25e;
  --danger: #ff6b6b;
  --border: #213244;
  --glow: 0 20px 55px rgba(6, 12, 20, 0.6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sora", "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at -10% -20%, rgba(28, 200, 160, 0.18), transparent 60%),
    radial-gradient(900px 420px at 110% 0%, rgba(255, 178, 94, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 200px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 80px),
    var(--bg);
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.admin-topbar {
  display: none;
}

.nav-overlay {
  display: none;
}

.sidebar {
  padding: 28px 18px;
  background:
    linear-gradient(180deg, rgba(20, 30, 44, 0.7), rgba(10, 15, 22, 0.9)),
    var(--bg-soft);
  border-right: 1px solid var(--border);
  position: relative;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  opacity: 0.6;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-bottom: 26px;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.nav a svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.nav a span.label {
  flex: 1;
}

.nav-pinned {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-pinned a {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 70px;
  padding: 8px 10px;
  font-size: 12px;
  position: relative;
  margin-bottom: 0;
  gap: 6px;
  background: rgba(28, 200, 160, 0.08);
  border-color: rgba(28, 200, 160, 0.25);
}

.nav-pinned a .label { flex: none; }

.status-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.status-dot.on {
  background: #27e08a;
  box-shadow: 0 0 10px rgba(39, 224, 138, 0.7);
}

.status-dot.off {
  background: #ff5a5a;
  box-shadow: 0 0 10px rgba(255, 90, 90, 0.7);
}

.nav a:hover {
  background: rgba(28, 200, 160, 0.12);
  border-color: rgba(28, 200, 160, 0.35);
  color: var(--ink);
  transform: translateX(2px);
}

.nav-main a:hover { transform: translateX(2px); }

.nav-pinned a:hover { transform: translateY(-2px); }

.nav a.active {
  background: rgba(28, 200, 160, 0.18);
  border-color: rgba(28, 200, 160, 0.5);
  color: var(--ink);
}

.content {
  padding: 34px 40px 70px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 160px),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: var(--glow);
  margin-bottom: 18px;
  animation: fadeUp 0.4s ease both;
}

h1, h2, h3 { margin: 0 0 12px; font-family: "Space Grotesk", "Sora", sans-serif; }
h1 { font-size: 28px; letter-spacing: 0.2px; }
h2 { font-size: 20px; color: var(--ink); }

.muted { color: var(--muted); }

.content a:not(.btn):not(.tab):not(.file-pill) {
  color: rgba(28, 200, 160, 0.92);
  text-decoration: none;
}

.content a:not(.btn):not(.tab):not(.file-pill):hover {
  text-decoration: underline;
}

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

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.02);
}

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

.chat-table tbody tr.is-selected td {
  background: rgba(28, 200, 160, 0.12);
}

.chat-table tbody tr.is-duplicate td {
  background: rgba(255, 178, 94, 0.12);
}

.chat-table tbody tr.is-duplicate.is-selected td {
  background: rgba(28, 200, 160, 0.12);
}

.chat-table tbody tr.is-banned td {
  opacity: 0.75;
}

.chat-table tbody tr.is-empty td {
  opacity: 0.55;
  filter: grayscale(1);
}

.select-col {
  width: 40px;
  text-align: center;
}

.select-col input {
  margin: 0;
  width: 16px;
  height: 16px;
}

.chat-list-shell.is-touch .select-col input {
  opacity: 0;
  pointer-events: none;
}

.chat-list-shell.is-touch.selection-active .select-col input {
  opacity: 1;
  pointer-events: auto;
}

.chat-table input[data-chat-select] {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(15, 23, 36, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chat-table input[data-chat-select]:checked {
  background: rgba(28, 200, 160, 0.2);
  border-color: rgba(28, 200, 160, 0.7);
}

.chat-table input[data-chat-select]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
}

.pill {
  padding: 4px 10px;
  background: var(--card-2);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.group-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(255, 178, 94, 0.2);
  border: 1px solid rgba(255, 178, 94, 0.45);
  font-size: 11px;
  color: var(--ink);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-pill a {
  color: inherit;
  text-decoration: none;
}

.pill-dm {
  background: rgba(255, 178, 94, 0.2);
  color: var(--ink);
  font-weight: 600;
}

.pill-dup {
  background: rgba(255, 178, 94, 0.35);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.pill-dup:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.autocomplete-menu {
  position: fixed;
  z-index: 90;
  background: rgba(16, 24, 36, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  box-shadow: 0 16px 30px rgba(10, 14, 22, 0.35);
  max-height: 240px;
  overflow: auto;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item.active,
.autocomplete-item:hover {
  background: rgba(28, 200, 160, 0.12);
}

.pill-ban {
  background: rgba(255, 107, 107, 0.16);
  color: var(--ink);
}

.group-dm-row td {
  background: rgba(255, 178, 94, 0.08);
}

.chat-table tbody tr.group-dm-row.is-selected td {
  background: rgba(28, 200, 160, 0.12);
}

.btn {
  background: var(--accent);
  color: #051017;
  border: none;
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 20px rgba(28, 200, 160, 0.2);
}

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

.btn.secondary { background: var(--accent-2); color: #20140a; box-shadow: 0 10px 20px rgba(255, 178, 94, 0.18); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); box-shadow: none; }
.btn.danger { background: var(--danger); color: #0b0e14; box-shadow: 0 10px 20px rgba(255, 107, 107, 0.2); }

.btn:focus-visible,
.nav a:focus-visible,
.tab:focus-visible,
.nav-toggle-btn:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(28, 200, 160, 0.9);
  outline-offset: 2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field > label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
}

input, select, textarea {
  background: #0f1724;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(28, 200, 160, 0.7);
  box-shadow: 0 0 0 3px rgba(28, 200, 160, 0.15);
}

textarea { min-height: 140px; }

input[type="file"] {
  padding: 8px;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  background: var(--card-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  margin-right: 10px;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  border-color: rgba(28, 200, 160, 0.6);
}

input::placeholder,
textarea::placeholder {
  color: rgba(147, 164, 184, 0.7);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

.checkbox-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  transform: translateY(-1px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 80;
}

.modal-card {
  width: min(520px, 92vw);
  box-shadow: 0 24px 60px rgba(10, 14, 22, 0.35);
}

.modal-card.force-message {
  width: min(760px, 96vw);
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.modal-card.force-message .modal-head {
  background: var(--card-1);
  padding: 14px 18px;
  border-bottom: 1px solid #1f2a3a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-card.force-message .modal-body {
  padding: 14px 18px 18px;
}

.modal-card.force-message .modal-head h2 {
  margin: 0;
}

.modal-card.force-message .modal-head .muted {
  margin-top: 4px;
}

.modal-card.force-message .modal-close {
  border: none;
  background: rgba(148, 163, 184, 0.12);
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-card.force-message .modal-close:hover {
  background: rgba(148, 163, 184, 0.22);
}

body.modal-open {
  overflow: hidden;
}

ul, ol {
  margin: 8px 0 0;
  padding-left: 18px;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dash-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.kpi {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-top: 8px;
}

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.kpi-split {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 4px;
}

.kpi-row { margin-top: 10px; }

.progress {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 36, 0.65);
  overflow: hidden;
  margin-top: 8px;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 10px 18px rgba(28, 200, 160, 0.22);
}

.progress.warn > span { background: var(--accent-2); box-shadow: 0 10px 18px rgba(255, 178, 94, 0.18); }
.progress.danger > span { background: var(--danger); box-shadow: 0 10px 18px rgba(255, 107, 107, 0.18); }

.pill.good { background: rgba(28, 200, 160, 0.18); color: var(--ink); }
.pill.bad { background: rgba(255, 107, 107, 0.16); color: var(--ink); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(28, 200, 160, 0.18);
  color: var(--ink);
  font-size: 12px;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 12px;
  margin-top: 12px;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
}

.perm-item:hover {
  border-color: rgba(28, 200, 160, 0.4);
  background: rgba(28, 200, 160, 0.06);
}

.perm-item input {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  flex: none;
}

.perm-item span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.note {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 178, 94, 0.12);
  border: 1px solid rgba(255, 178, 94, 0.35);
  margin-bottom: 14px;
}

.login {
  max-width: 420px;
  margin: 80px auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.form-grid {
  display: grid;
  gap: 12px 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.form-grid .field { margin-bottom: 0; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.inline-details {
  display: inline-block;
}

.row-actions > .inline-details {
  flex: 0 0 auto;
}

.row-actions > .inline-details[open] {
  flex: 1 1 100%;
}

.row-actions > .inline-details[open] .details-body {
  width: 100%;
}

.inline-details > summary {
  list-style: none;
}

.inline-details > summary::-webkit-details-marker { display: none; }

.inline-details[open] > summary {
  border-color: rgba(28, 200, 160, 0.45);
}

.details-body {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.details-body form { margin: 0; }

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-toolbar[data-chat-toolbar] { display: none; }
.chat-list-shell.has-selection .chat-toolbar[data-chat-toolbar] { display: flex; }
.chat-toolbar[data-chat-search-wrap] { display: flex; }

.toolbar .spacer {
  flex: 1;
  min-width: 10px;
}

.chat-context-menu {
  position: fixed;
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  padding: 6px;
  background: rgba(17, 26, 38, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--glow);
}

.chat-context-menu.open { display: flex; }

.chat-context-menu button {
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.chat-context-menu button:hover {
  background: rgba(28, 200, 160, 0.12);
}

.chat-context-menu button.danger:hover {
  background: rgba(255, 107, 107, 0.18);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.toggle input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.editor-shell {
  display: grid;
  grid-template-columns: 56px 1fr;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #0b111a;
}

.editor-lines {
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  text-align: right;
  user-select: none;
  overflow: hidden;
}

.editor-lines div {
  padding: 0 12px;
  height: 18px;
}

.editor-shell textarea {
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 18px;
  padding: 10px 12px;
  min-height: 520px;
  resize: vertical;
}

.editor-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.editor-status.ok { color: rgba(39, 224, 138, 0.92); }
.editor-status.err { color: var(--danger); }

.code-block {
  background: #0b111a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 70vh;
  font-size: 13px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 200px),
    var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--glow);
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.modal-card pre {
  border: none;
  border-radius: 0;
  margin: 0;
  flex: 1;
  max-height: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(28, 200, 160, 0.14);
  border: 1px solid rgba(28, 200, 160, 0.3);
  font-size: 12px;
  color: var(--ink);
}

table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

@media (min-width: 769px) {
  tbody tr.ticket-unanswered {
    background: rgba(255, 107, 107, 0.06);
  }

  tbody tr.ticket-unanswered td:first-child {
    border-left: 4px solid rgba(255, 107, 107, 0.85);
  }

  tbody tr.ticket-group {
    background: rgba(255, 178, 94, 0.08);
  }

  tbody tr.ticket-group td:first-child {
    border-left: 4px solid rgba(255, 178, 94, 0.7);
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }

  .admin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px 14px;
    background:
      linear-gradient(180deg, rgba(20, 30, 44, 0.75), rgba(10, 15, 22, 0.92)),
      var(--bg-soft);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }

  .nav-toggle-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  }

  .nav-toggle-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(28, 200, 160, 0.4);
    background: rgba(28, 200, 160, 0.08);
  }

  .nav-toggle-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--ink);
  }

  .admin-topbar-title {
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-size: 14px;
  }

  .admin-topbar-user {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 64px));
    z-index: 4;
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 2;
    background: rgba(5, 8, 12, 0.65);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-overlay { opacity: 1; pointer-events: auto; }

  .content { padding: 20px 16px 60px; }
}

.public-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 22px 90px;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

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

.logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(28, 200, 160, 0.28));
}

.logo-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.logo-sub {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.lang-switch a.active {
  color: var(--ink);
  background: rgba(28, 200, 160, 0.2);
  box-shadow: 0 10px 20px rgba(28, 200, 160, 0.18);
}

@media (max-width: 720px) {
  .public-shell { padding: 22px 16px 70px; }

  .public-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo img {
    width: 44px;
    height: 44px;
  }

  .logo-title { font-size: 16px; }

  .lang-switch {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .support-hero h1 { font-size: 22px; }

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

  .choice-card,
  .choice-card.tall { min-height: 0; }

  .support-note,
  .support-note-wide { max-width: 100%; }

  .support-steps { gap: 6px; }

  .step-line { font-size: 13px; }
}

.support-hero h1 {
  margin-bottom: 6px;
}

.support-hero p {
  color: var(--muted);
  max-width: 720px;
}

.notfound-hero {
  text-align: center;
  margin-top: 30px;
}

.notfound-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 14px;
  background:
    radial-gradient(60px 60px at 30% 20%, rgba(28, 200, 160, 0.35), transparent 70%),
    linear-gradient(160deg, rgba(28, 200, 160, 0.18), rgba(255, 178, 94, 0.08));
  border: 1px solid rgba(28, 200, 160, 0.35);
  box-shadow: 0 20px 60px rgba(6, 12, 20, 0.65);
}

.notfound-path {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 36, 0.6);
  font-size: 13px;
}

.notfound-path code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--ink);
}

.notfound-card {
  max-width: 720px;
  margin: 18px auto 0;
  text-align: center;
}

.notfound-card .row-actions {
  justify-content: center;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 22px;
  border-radius: 22px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(160deg, rgba(28, 200, 160, 0.15), rgba(17, 26, 38, 0.96)),
    var(--card);
  overflow: hidden;
  min-height: 220px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.choice-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(500px 200px at 0% 0%, rgba(28, 200, 160, 0.25), transparent 70%);
  transition: opacity 0.2s ease;
}

.choice-card:hover {
  transform: translateY(-2px);
  border-color: rgba(28, 200, 160, 0.5);
  box-shadow: 0 20px 50px rgba(6, 12, 20, 0.6);
}

.choice-card:hover::after { opacity: 1; }

.choice-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.choice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.choice-card .arrow {
  font-weight: 600;
  color: var(--accent);
}

.choice-card.tall { min-height: 260px; }

.support-form { max-width: 720px; }

.support-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.support-shell.is-focus .support-list {
  display: none;
}

.support-chat {
  position: relative;
}

.support-thread {
  position: relative;
}

.support-back {
  position: absolute;
  left: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 178, 94, 0.22);
  border: 1px solid rgba(255, 178, 94, 0.45);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(255, 178, 94, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 5;
}

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

.support-back.top { top: 12px; }
.support-back.bottom { bottom: 14px; }

.support-back-icon {
  font-size: 20px;
  font-weight: 700;
}

.support-chat-input {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.support-reply-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.support-reply-form .field.inline {
  margin-bottom: 0;
}

.support-reply-form .field.inline.grow {
  flex: 1 1 240px;
}

.ticket-bubble {
  background: linear-gradient(160deg, rgba(255, 178, 94, 0.18), rgba(17, 26, 38, 0.96));
  border: 1px solid rgba(255, 178, 94, 0.35);
}

.ticket-highlight {
  box-shadow: 0 0 0 2px rgba(255, 178, 94, 0.7), 0 0 24px rgba(255, 178, 94, 0.4);
}

.msg-highlight {
  box-shadow: 0 0 0 2px rgba(28, 200, 160, 0.7), 0 0 24px rgba(28, 200, 160, 0.35);
}

.ticket-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(28, 200, 160, 0.18);
  border: 1px solid rgba(28, 200, 160, 0.35);
  color: var(--ink);
  text-decoration: none;
}

.reply-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  text-decoration: none;
}

#support-ticket-menu {
  position: fixed;
  z-index: 300;
  display: none;
}

#support-ticket-menu.open { display: flex; }

.support-note {
  max-width: 720px;
  border: 1px solid rgba(255, 178, 94, 0.35);
  background:
    linear-gradient(160deg, rgba(255, 178, 94, 0.12), rgba(17, 26, 38, 0.96));
}

.support-note h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.support-note-ru {
  border-color: rgba(28, 200, 160, 0.4);
  background:
    linear-gradient(160deg, rgba(28, 200, 160, 0.12), rgba(17, 26, 38, 0.96));
}

.support-note-kz {
  border-color: rgba(255, 178, 94, 0.4);
}

.support-note-wide {
  max-width: 980px;
  margin-top: 8px;
}

.support-steps {
  display: grid;
  gap: 8px;
  margin: 12px 0 8px;
}

.step-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #07131a;
  background: var(--accent);
  flex: none;
}

#support-reply {
  scroll-margin-top: 90px;
}

.support-form .helper {
  font-size: 12.5px;
  font-family: "Space Grotesk", "Sora", sans-serif;
  letter-spacing: 0.1px;
  color: var(--muted);
  margin-top: -6px;
  margin-bottom: 14px;
}

.support-form input::placeholder,
.support-form textarea::placeholder {
  font-family: "Space Grotesk", "Sora", sans-serif;
  font-size: 13px;
  letter-spacing: 0.1px;
}

.success-card {
  max-width: 720px;
  text-align: center;
}

.success-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(28, 200, 160, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 0 26px rgba(28, 200, 160, 0.35);
}

.success-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
}

.ticket-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(28, 200, 160, 0.12);
  border: 1px solid rgba(28, 200, 160, 0.35);
  margin-top: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.tab .pill {
  font-size: 11px;
  padding: 3px 8px;
}

.tab.active {
  color: var(--ink);
  border-color: rgba(28, 200, 160, 0.5);
  background: rgba(28, 200, 160, 0.18);
}

.helper {
  font-size: 13px;
  font-family: "Space Grotesk", "Sora", sans-serif;
  letter-spacing: 0.1px;
  color: var(--muted);
}

.group-info-card .group-info-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
}

.group-info-card .group-info-settings {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
}

.field.inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.field.inline > label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  user-select: none;
  cursor: pointer;
}

.field.inline > label:hover {
  border-color: rgba(28, 200, 160, 0.4);
  background: rgba(28, 200, 160, 0.06);
}

.note.danger {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
}

.notify-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.notify-main .card {
  margin-bottom: 18px;
}

.notify-side .card {
  position: sticky;
  top: 24px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px;
  align-items: end;
}

.filters-main {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: end;
}

.filters-main .field {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.filters-more {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.filters-more > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
  user-select: none;
}

.filters-more > summary::-webkit-details-marker { display: none; }

.filters-more[open] > summary {
  margin-bottom: 10px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-entry {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 180px),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--glow);
  overflow: hidden;
}

.log-entry summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
}

.log-entry summary::-webkit-details-marker { display: none; }

.log-entry[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(28, 200, 160, 0.06);
}

.log-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.log-main {
  min-width: 0;
}

.log-title {
  font-weight: 700;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

.log-main .muted {
  overflow-wrap: anywhere;
}

.log-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.log-entry pre {
  border: none;
  border-radius: 0;
  margin: 0;
}

.format-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.format-bar button {
  background: var(--card-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 600;
}

.format-bar button:hover {
  border-color: rgba(28, 200, 160, 0.6);
}

.notify-lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.notify-lang-tab {
  background: var(--card-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.notify-lang-tab.active {
  color: var(--ink);
  border-color: rgba(28, 200, 160, 0.6);
  background: rgba(28, 200, 160, 0.16);
}

.notify-lang-panel { display: none; }
.notify-lang-panel.active { display: block; }

.notify-attachments {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.notify-attachments-head label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.notify-attach-toggle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.notify-attach-toggle:hover {
  border-color: rgba(255, 107, 107, 0.7);
  color: var(--danger);
}

.notify-attachments.is-disabled {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
  text-decoration: line-through;
}

.notify-attachments.is-disabled .notify-attachments-body {
  opacity: 0.6;
  text-decoration: line-through;
}

.notify-text-disabled {
  border-color: rgba(255, 107, 107, 0.6);
  color: var(--danger);
  text-decoration: line-through;
}

.lang-block {
  margin-bottom: 10px;
}

.lang-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 4px;
}

.lang-block.is-disabled pre {
  color: var(--danger);
  text-decoration: line-through;
  border-color: rgba(255, 107, 107, 0.4);
}

.file-preview,
.file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  text-decoration: none;
  color: var(--ink);
  font-size: 12px;
}

.file-pill .file-size {
  color: var(--muted);
}

.whatsapp-preview {
  background: #0b111a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  min-height: 220px;
  max-height: 520px;
  overflow-y: auto;
}

.wa-bubble {
  background: #111f2b;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(5, 12, 20, 0.4);
}

.ticket-colored {
  background: linear-gradient(160deg, color-mix(in srgb, var(--ticket-color, #3b82f6) 28%, transparent), rgba(17, 26, 38, 0.96));
  border: 1px solid color-mix(in srgb, var(--ticket-color, #3b82f6) 60%, rgba(17, 26, 38, 0.6));
}

.wa-text {
  font-size: 14px;
  line-height: 1.5;
}

.wa-text code,
.wa-caption code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 4px;
  border-radius: 6px;
  font-family: "Space Grotesk", "Sora", sans-serif;
}

.wa-schedule {
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.wa-schedule-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.wa-schedule-row {
  font-size: 13px;
  color: var(--muted);
}

.wa-caption {
  font-size: 14px;
  line-height: 1.5;
  margin-top: 8px;
}

.wa-attachments {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.wa-attach {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.wa-attach-name { font-weight: 600; }

.wa-attach-size { color: var(--muted); font-size: 11px; }

.wa-hint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.card.mini {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row.between {
  justify-content: space-between;
}

.pill.status {
  text-transform: uppercase;
  font-size: 11px;
}

.pill.status.pending { background: rgba(255, 178, 94, 0.15); }
.pill.status.queued { background: rgba(255, 178, 94, 0.15); }
.pill.status.in_progress { background: rgba(28, 200, 160, 0.15); }
.pill.status.sent { background: rgba(28, 200, 160, 0.25); }
.pill.status.partial { background: rgba(255, 178, 94, 0.2); }
.pill.status.failed { background: rgba(255, 107, 107, 0.2); }

.subheader {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

pre.mono {
  white-space: pre-wrap;
  background: rgba(15, 23, 36, 0.7);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink);
}

.chat-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.chat-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.chat-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  user-select: none;
}

.chat-summary::-webkit-details-marker { display: none; }

.chat-item[open] .chat-summary {
  background: rgba(28, 200, 160, 0.08);
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.chat-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-avatar-fallback {
  font-weight: 700;
  color: var(--ink);
}

.chat-summary-main {
  min-width: 0;
}

.chat-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.chat-sub {
  font-size: 12px;
  word-break: break-all;
}

.chat-body {
  padding: 0 14px 14px;
}

.chat-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  padding-top: 12px;
  font-size: 13px;
}

.chat-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }

  .public-shell { padding: 24px 16px 60px; }
  .public-header { flex-direction: column; align-items: flex-start; }
  .notify-shell { grid-template-columns: 1fr; }
  .notify-side .card { position: static; }
  .chat-meta-grid { grid-template-columns: 1fr; }
  .chat-actions-grid { grid-template-columns: 1fr; }

  .log-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .log-side {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .code-block {
    padding: 12px 12px;
    max-height: 62vh;
  }

  .content { padding: 18px 12px 60px; }
  .card { padding: 16px 16px; border-radius: 16px; }
  h1 { font-size: 24px; }

  .row { flex-wrap: wrap; }
  .row.between { align-items: flex-start; }

  .field.inline { flex-direction: column; align-items: stretch; }

  pre { max-width: 100%; overflow-x: auto; }

  .lang-switch { width: 100%; justify-content: space-between; }
  .lang-switch a { flex: 1; text-align: center; }

  .login { margin: 46px auto; }

  .notfound-path {
    display: flex;
    max-width: 100%;
    width: 100%;
    justify-content: space-between;
  }

  .notfound-path code {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70vw;
  }

  table:not(.table-stack) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  table:not(.table-stack) th,
  table:not(.table-stack) td { white-space: nowrap; }

  table.table-stack,
  table.table-stack tbody,
  table.table-stack tr,
  table.table-stack td {
    display: block;
    width: 100%;
  }

  table.table-stack thead { display: none; }

  table.table-stack {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }

  table.table-stack tr {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.02), transparent 160px),
      var(--card);
    box-shadow: var(--glow);
    margin-bottom: 12px;
  }

  table.table-stack tr.ticket-unanswered {
    border-color: rgba(255, 107, 107, 0.6);
    box-shadow: 0 18px 55px rgba(6, 12, 20, 0.55), 0 0 0 1px rgba(255, 107, 107, 0.14);
  }

  table.table-stack tr.ticket-group {
    border-color: rgba(255, 178, 94, 0.55);
    box-shadow: 0 18px 55px rgba(6, 12, 20, 0.55), 0 0 0 1px rgba(255, 178, 94, 0.14);
  }

  table.table-stack td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: normal;
  }

  table.table-stack td:last-child { border-bottom: none; }

  table.table-stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .row-actions .btn { flex: 1 1 160px; }

  .format-bar { flex-wrap: wrap; }
  .format-bar button { flex: 1 1 140px; }

  .toast { top: 12px; right: 12px; width: min(420px, calc(100vw - 24px)); }
}

@media (max-width: 480px) {
  .admin-topbar { padding: 10px 10px; }
  .admin-topbar-title { font-size: 13px; }
  .admin-topbar-user { display: none; }

  .content { padding: 14px 10px 56px; }
  h1 { font-size: 22px; }

  input, select, textarea {
    font-size: 16px;
    padding: 11px 12px;
    border-radius: 12px;
  }

  .btn,
  .nav a,
  .tab,
  .nav-toggle-btn {
    min-height: 44px;
  }

  .nav a { padding: 12px 14px; }

  .row-actions .btn { flex: 1 1 100%; }
  .inline-actions { width: 100%; }

  .code-block {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  width: min(420px, calc(100vw - 36px));
  background: rgba(17, 26, 38, 0.95);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  box-shadow: var(--glow);
  overflow: hidden;
}

.toast.danger { border-left-color: var(--danger); }

.toast-body {
  padding: 12px 14px;
  font-weight: 600;
}

.toast-timer {
  height: 3px;
  background: linear-gradient(90deg, rgba(28, 200, 160, 0.8), rgba(255, 178, 94, 0.8));
  transform-origin: left;
  animation: toastTimer var(--toast-ms, 4500ms) linear forwards;
}

.toast.danger .toast-timer {
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.95), rgba(255, 178, 94, 0.75));
}

@keyframes toastTimer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.hint-wrap {
  display: inline-flex;
  position: relative;
  margin-left: 8px;
  vertical-align: middle;
}

.hint-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: default;
}

.hint-pop {
  position: absolute;
  top: 26px;
  left: 0;
  min-width: 220px;
  background: rgba(17, 26, 38, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--glow);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.hint-wrap:hover .hint-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.req-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.req {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.req::before {
  content: "✕";
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--danger);
  font-weight: 800;
  font-size: 12px;
}

.req.ok { color: rgba(39, 224, 138, 0.95); }
.req.ok::before {
  content: "✓";
  border-color: rgba(39, 224, 138, 0.45);
  color: rgba(39, 224, 138, 0.95);
}
