:root {
  --bg-main: #0B0C14;
  --bg-elevated: #0F111C;
  --bg-inset: rgba(0, 0, 0, 0.35);

  --primary: #2DB58A;
  --primary-bright: #34CF9C;
  --primary-dim: #1E7D5F;
  --primary-soft: rgba(45, 181, 138, 0.08);
  --primary-glow: rgba(45, 181, 138, 0.35);

  --success: #16A34A;
  --warning: #D97706;
  --warning-bright: #FBBF24;
  --danger: #DC2626;
  --danger-bright: #F87171;
  --info: #60A5FA;

  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.07);

  --border: rgba(45, 181, 138, 0.15);
  --hairline: rgba(45, 181, 138, 0.2);
  --border-muted: rgba(255, 255, 255, 0.06);

  --text-main: #E5E7EB;
  --text-dim: #9CA3AF;
  --text-muted: #6B7280;
  --text-faint: #4B5563;

  --font-mono: 'Space Mono', ui-monospace, 'Cascadia Mono', 'JetBrains Mono', 'Segoe UI Mono', 'Courier New', monospace;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --sidebar-w: 250px;
  --topbar-h: 64px;

  --shadow-glow: 0 0 20px rgba(45, 181, 138, 0.15);
  --shadow-panel: 0 0 40px rgba(0, 0, 0, 0.55);
}

.site-banner { display:flex; gap:18px; align-items:center; width:100%; max-width:none; box-sizing:border-box; margin:0 0 24px; padding:18px 20px; border:1px solid rgba(45,181,138,.35); border-radius:6px; background:linear-gradient(120deg,rgba(19,31,35,.96),rgba(16,20,30,.96)); box-shadow:0 8px 28px rgba(0,0,0,.18); }
.site-banner-image { width:88px; height:88px; object-fit:cover; border-radius:6px; border:1px solid rgba(45,181,138,.35); flex:0 0 auto; }
.site-banner-content { min-width:0; flex:1 1 auto; }
.site-banner h2 { margin:0 0 6px; color:#2db58a; font-size:1rem; }
.site-banner-body { color:var(--text-muted,#9aa3b2); line-height:1.55; }
.site-banner-body p { margin:.25rem 0; }
.site-banner-conditions { margin-top:10px; padding:9px 11px; border-left:2px solid var(--primary); background:var(--primary-soft); color:var(--text-dim); font-size:.82rem; }
.site-banner-conditions strong { display:block; margin-bottom:3px; color:var(--primary-bright); font-size:.78rem; text-transform:uppercase; }
.site-banner-button { display:inline-flex; margin-top:10px; }
.banner-editor-toolbar { display:flex; flex-wrap:wrap; gap:5px; padding:7px; background:var(--bg-inset); border:1px solid var(--border); border-bottom:0; border-radius:var(--radius-sm) var(--radius-sm) 0 0; }
.banner-editor-toolbar button { width:32px; height:30px; border:1px solid var(--border); border-radius:3px; background:var(--surface-2); color:var(--text-main); cursor:pointer; font-family:var(--font-mono); }
.banner-editor-toolbar button:hover { color:var(--primary-bright); border-color:var(--primary); }
.banner-editor { min-height:132px; padding:11px 12px; color:var(--text-main); line-height:1.55; background:var(--bg-elevated); border:1px solid var(--border); border-radius:0 0 var(--radius-sm) var(--radius-sm); outline:none; }
.banner-editor:focus { border-color:var(--primary); box-shadow:0 0 0 2px var(--primary-soft); }
.banner-editor:empty:before { content:attr(data-placeholder); color:var(--text-muted); pointer-events:none; }
.banner-editor p,.banner-editor ul,.banner-editor ol { margin:0 0 8px; }
@media (max-width:600px){ .site-banner{width:100%;padding:15px;gap:12px;align-items:flex-start}.site-banner-image{width:64px;height:64px}.site-banner h2{font-size:1rem} }

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

* {
  margin: 0;
  padding: 0;
  scrollbar-color: rgba(45, 181, 138, 0.3) transparent;
  scrollbar-width: thin;
}

html,
body {
  height: 100%;
}

body {
  background-color: var(--bg-main);
  background-image:
    linear-gradient(rgba(45, 181, 138, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 181, 138, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 50% -25%, rgba(45, 181, 138, 0.1), transparent 55%);
}

::selection {
  background: var(--primary);
  color: #04120C;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(45, 181, 138, 0.22);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 181, 138, 0.45);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #F3F4F6;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

h5 {
  font-size: 1rem;
}

h6 {
  font-size: 0.875rem;
}

p {
  color: var(--text-dim);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-bright);
}

strong,
b {
  font-weight: 700;
  color: var(--text-main);
}

small {
  font-size: 0.75rem;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

i[class^="ri-"],
i[class*=" ri-"] {
  vertical-align: middle;
  line-height: 1;
  display: inline-flex;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--hairline);
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.brand-logo {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 0 6px var(--primary-glow));
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-name span {
  color: var(--primary);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-weight: 700;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--surface);
  color: var(--text-main);
  border-color: var(--border);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--border);
  font-weight: 700;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 22%;
  bottom: 22%;
  width: 2px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: var(--space-3);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) 0;
}

.legal-links a {
  font-size: 0.7rem;
  color: var(--text-faint);
}

.legal-links a:hover {
  color: var(--text-dim);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--hairline);
  background: rgba(11, 12, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-toggle-label {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
  background: var(--surface);
}

.topbar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}

.topbar-spacer {
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.balance-chip i {
  color: var(--primary);
  font-size: 1rem;
}

.balance-chip.is-coins i {
  color: var(--warning-bright);
}

.balance-chip .unit {
  color: var(--text-muted);
  font-weight: 400;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-3) 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.user-chip:hover {
  border-color: var(--primary);
}

.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--hairline);
}

.user-chip .uname {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.content {
  flex: 1;
  padding: var(--space-5);
}

.nav-scrim {
  display: none;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: var(--space-1);
}

.label-caps {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}

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

.dim {
  color: var(--text-dim);
}

.accent {
  color: var(--primary);
}

.mono-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--space-4) 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.panel-tight {
  padding: var(--space-4);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--hairline);
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  border-color: var(--primary);
}

.card-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stat-label i {
  color: var(--primary);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn i {
  font-size: 1.05rem;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #04120C;
}

.btn-primary:hover {
  background: var(--primary-bright);
  border-color: var(--primary-bright);
  color: #04120C;
  box-shadow: var(--shadow-glow);
}

.btn-danger {
  border-color: rgba(220, 38, 38, 0.4);
  color: var(--danger-bright);
}

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-success {
  border-color: rgba(22, 163, 74, 0.45);
  color: var(--primary);
}

.btn-success:hover {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--border);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px var(--space-3);
  font-size: 0.72rem;
}

.btn-lg {
  padding: 14px var(--space-5);
  font-size: 0.92rem;
}

.btn-icon {
  padding: 9px;
  width: 38px;
  height: 38px;
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-main);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px var(--space-3);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.media-products-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.media-admin-legacy-log { display: none; }

.media-products-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.media-product-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.media-product-option:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.media-product-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 104px;
  line-height: 1.6;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232DB58A' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.input-code {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.check-row label {
  font-size: 0.85rem;
  cursor: pointer;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: var(--surface);
}

.table-compact td,
.table-compact th {
  padding: var(--space-2) var(--space-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge-success {
  color: var(--primary);
  border-color: rgba(45, 181, 138, 0.3);
  background: rgba(45, 181, 138, 0.08);
}

.badge-warning {
  color: var(--warning-bright);
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
}

.badge-danger {
  color: var(--danger-bright);
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
}

.badge-info {
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.avatar {
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--hairline);
}

.avatar-sm {
  width: 28px;
  height: 28px;
}

.avatar-md {
  width: 40px;
  height: 40px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
}

.avatar-edit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.avatar-edit-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-edit .buy-msg:empty {
  display: none;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
}

.chat-msg {
  display: flex;
  gap: var(--space-3);
  max-width: 78%;
}

.chat-msg .avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.chat-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chat-author {
  font-weight: 700;
  color: var(--text-dim);
}

.chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.88rem;
  color: var(--text-main);
  word-break: break-word;
}

.chat-bubble img {
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
  max-height: 260px;
  width: auto;
  border: 1px solid var(--hairline);
  cursor: zoom-in;
}

.chat-bubble video {
  display: block;
  max-width: 100%;
  max-height: 360px;
  margin-top: var(--space-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: #000;
}

.chat-msg.is-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg.is-me .chat-meta {
  flex-direction: row-reverse;
}

.chat-read {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
}

.chat-read.is-read {
  color: var(--primary);
}

.ticket-lastseen {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--hairline);
  color: var(--text-muted);
}

.chat-msg.is-me .chat-bubble {
  background: var(--primary-soft);
  border-color: rgba(45, 181, 138, 0.3);
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--hairline);
  background: var(--bg-elevated);
}

.chat-input-bar textarea {
  min-height: 44px;
  max-height: 200px;
  overflow-y: hidden;
  line-height: 1.4;
}

/* ==== Панель шаблонов быстрых ответов (чат тикета) ==== */
.tpl-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) 0;
}
.tpl-bar-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.tpl-mobile-toggle {
  display: none;
}
.tpl-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.tpl-bar-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tpl-cat-filter {
  width: auto;
  min-width: 150px;
  padding: 6px var(--space-2);
  font-size: 0.8rem;
}
.tpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 96px;
  overflow-y: auto;
}
.tpl-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  max-width: 220px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.tpl-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tpl-chip:active {
  transform: scale(0.97);
}
.tpl-chip-cat {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.tpl-chip-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ===== Менеджер шаблонов (админка) ===== */
.tpl-manager-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-height: 52vh;
  overflow-y: auto;
}

.tpl-manager-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tpl-manager-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--hairline);
}

.tpl-manager-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}

.tpl-manager-item-info {
  min-width: 0;
  flex: 1;
}

.tpl-manager-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.tpl-manager-item-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.tpl-manager-item-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Иконка-индикатор «у шаблона есть картинка» в чипе */
.tpl-chip-img {
  color: var(--primary);
  font-size: 0.85rem;
  margin-left: 4px;
  vertical-align: middle;
}

/* Миниатюра картинки в списке менеджера шаблонов */
.tpl-manager-item-thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
}

/* Загрузка картинки в редакторе шаблона */
.tpl-img-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.tpl-img-preview {
  position: relative;
  display: inline-block;
}

.tpl-img-preview img {
  max-height: 72px;
  max-width: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  object-fit: contain;
  display: block;
}

.tpl-img-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

/* ===== Галерея скриншотов + просмотрщик ===== */
.shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

.shot-tile {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  aspect-ratio: 16 / 10;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.shot-tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

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

.shot-tile-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-2) var(--space-2);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
  text-align: left;
}

.shot-tile-user {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot-tile-date {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
}

.shots-foot {
  display: flex;
  justify-content: center;
  margin-top: var(--space-4);
}

.shot-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(2, 3, 8, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.shot-viewer.is-open {
  display: flex;
}

.shot-viewer-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}

.shot-viewer-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(20, 20, 28, 0.8);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.shot-viewer-close:hover {
  background: var(--danger);
}

.shot-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(20, 20, 28, 0.8);
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.shot-viewer-nav:hover {
  background: var(--primary);
}

.shot-viewer-nav.is-prev { left: var(--space-4); }
.shot-viewer-nav.is-next { right: var(--space-4); }

.shot-viewer-nav.is-disabled {
  opacity: 0.25;
  pointer-events: none;
}

.shot-viewer-cap {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: rgba(20, 20, 28, 0.85);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  text-align: center;
}

.shot-viewer-cap-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.shot-viewer-user {
  font-weight: 700;
  color: var(--primary-bright, #fff);
}

.shot-viewer-reason {
  color: #fff;
  font-size: 0.9rem;
}

.shot-viewer-cap-sub {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.shot-viewer-counter {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(2, 3, 8, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.open,
.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel), var(--shadow-glow);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal,
.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-lg {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  color: var(--danger-bright);
  border-color: var(--border);
}

.modal-body {
  padding: var(--space-4);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.flash-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.flash-zone:empty {
  display: none;
  margin: 0;
}

.flash {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text-main);
}

.flash i {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.flash-success {
  border-color: rgba(45, 181, 138, 0.3);
  background: rgba(45, 181, 138, 0.08);
  color: var(--primary);
}

.flash-error,
.flash-danger {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger-bright);
}

.flash-warning {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
  color: var(--warning-bright);
}

.flash-info {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
  color: var(--info);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--text-faint);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: hydra-spin 0.7s linear infinite;
}

@keyframes hydra-spin {
  to {
    transform: rotate(360deg);
  }
}

.grid {
  display: grid;
  gap: var(--space-4);
}

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

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

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

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

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

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.flex-1 {
  flex: 1;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-5 {
  gap: var(--space-5);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-5 {
  margin-top: var(--space-5);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none;
}

.text-green-400 {
  color: var(--primary);
}

.text-yellow-400 {
  color: var(--warning-bright);
}

.text-red-400 {
  color: var(--danger-bright);
}

.text-red-500 {
  color: #EF4444;
}

.text-blue-400 {
  color: var(--info);
}

.text-gray-400 {
  color: #9CA3AF;
}

.text-gray-500 {
  color: var(--text-muted);
}

.text-gray-600 {
  color: var(--text-faint);
}

.text-accentPink {
  color: var(--primary);
}

.text-white {
  color: #fff;
}

.font-light {
  font-weight: 300;
}

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-black {
  font-weight: 900;
}

.italic {
  font-style: italic;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-base {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.border {
  border: 1px solid var(--border);
}

.rounded {
  border-radius: var(--radius-md);
}

.bg-red-500\/10 {
  background-color: rgba(220, 38, 38, 0.1);
}

.bg-green-500\/10 {
  background-color: rgba(45, 181, 138, 0.1);
}

.bg-yellow-500\/10 {
  background-color: rgba(217, 119, 6, 0.1);
}

.border-red-500\/30 {
  border-color: rgba(220, 38, 38, 0.3);
}

.border-green-500\/30 {
  border-color: rgba(45, 181, 138, 0.3);
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  font-size: 1.7rem;
}

.auth-view {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-5) 0;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel), var(--shadow-glow);
  overflow: hidden;
}

.auth-head {
  padding: var(--space-6) var(--space-5) var(--space-4);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.auth-logo {
  height: 46px;
  width: auto;
  margin: 0 auto var(--space-3);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.auth-title {
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: var(--space-2);
}

.auth-body {
  padding: var(--space-5);
}

.auth-foot {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.auth-foot a {
  font-weight: 700;
}

.turnstile-holder {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: var(--space-2) 0 var(--space-4);
}

.reveal {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.reveal > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px var(--space-3);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}

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

.reveal > summary i {
  color: var(--primary);
  font-size: 1rem;
  transition: transform 0.15s ease;
}

.reveal[open] > summary i {
  transform: rotate(90deg);
}

.reveal-body {
  padding: 0 var(--space-3) var(--space-3);
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.consent input {
  margin-top: 2px;
  flex-shrink: 0;
}

.consent a {
  font-weight: 700;
}

.msg-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h) - var(--space-5) * 2);
  padding: var(--space-5) 0;
}

.msg-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-panel);
}

.msg-card--error {
  border-color: rgba(220, 38, 38, 0.25);
  box-shadow: var(--shadow-panel), 0 0 40px rgba(220, 38, 38, 0.12);
}

.msg-card--success {
  border-color: rgba(45, 181, 138, 0.25);
  box-shadow: var(--shadow-panel), 0 0 40px rgba(45, 181, 138, 0.12);
}

.msg-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
}

.msg-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
}

.msg-text {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: var(--space-5);
}

.msg-text b {
  color: var(--text-main);
  font-weight: 700;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0%, rgba(45, 181, 138, 0.14), transparent 45%),
    var(--bg-elevated);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(45, 181, 138, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 181, 138, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(120deg, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(120deg, #000, transparent 70%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  border: 1px solid var(--border);
  background: var(--primary-soft);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
}

.hero-title {
  font-size: 2.4rem;
  line-height: 1.1;
  margin-bottom: var(--space-4);
}

.hero-title span {
  color: var(--primary);
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: var(--space-5);
  max-width: 540px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.feature-card:hover {
  border-color: var(--hairline);
  transform: translateY(-2px);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 1.5rem;
}

.feature-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.feature-text {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.product-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 2.4rem;
}

.discount-flag {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 2;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.45);
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  flex: 1;
}

.product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.product-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.product-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.product-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  white-space: pre-wrap;
}

.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
}

.price-from {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.price-from .label-caps {
  font-size: 0.65rem;
}

.price-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.price-value .cur {
  color: var(--primary);
}

.tariff-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.tariff-opt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tariff-opt:hover {
  border-color: var(--hairline);
}

.tariff-opt input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tariff-opt:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.tariff-days {
  font-weight: 700;
  color: var(--text-main);
}

.tariff-price {
  margin-left: auto;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.buy-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  margin-bottom: var(--space-4);
}

.buy-total {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.buy-total .cur {
  color: var(--primary);
}

.buy-msg {
  font-size: 0.85rem;
  margin-bottom: var(--space-3);
  min-height: 1.2em;
}

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.sub-row + .sub-row {
  margin-top: var(--space-2);
}

.sub-game {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.sub-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.sub-name {
  font-weight: 700;
  color: var(--text-main);
}

.sub-time {
  text-align: right;
  flex-shrink: 0;
}

.sub-time-val {
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.sub-time-exp {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.steps li {
  position: relative;
  padding-left: 40px;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-field {
  display: flex;
  gap: var(--space-2);
}

.copy-field input {
  flex: 1;
}

.ref-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.ref-metric {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  text-align: center;
}

.ref-metric-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.ref-metric-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 2px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:first-child {
  padding-top: 0;
}

.settings-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.settings-info {
  min-width: 0;
}

.settings-title {
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.review-item {
  padding: var(--space-4);
}

.review-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.review-author {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.review-name {
  font-weight: 700;
  color: var(--text-main);
}

.review-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.review-head .stars {
  margin-left: auto;
}

.stars {
  display: inline-flex;
  gap: 2px;
}

.stars i {
  font-size: 0.95rem;
  color: var(--warning-bright);
}

.stars i.empty {
  color: var(--text-faint);
}

.review-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.65;
  word-break: break-word;
}

.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 6px;
}

.star-rating input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.star-rating label {
  font-size: 1.9rem;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 1;
  transition: color 0.12s ease, transform 0.12s ease;
}

.star-rating label:hover {
  transform: scale(1.1);
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: var(--warning-bright);
}

.ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ticket-row + .ticket-row {
  margin-top: var(--space-2);
}

.ticket-row:hover {
  border-color: var(--primary);
  transform: translateX(2px);
}

.ticket-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.ticket-id {
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.ticket-subject {
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-side {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.ticket-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.ticket-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ticket-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - var(--space-5) * 2);
  min-height: 460px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ticket-head {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.ticket-head-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.ticket-head-main > .badge {
  flex-shrink: 0;
}

.ticket-tools-toggle {
  display: none;
}

.ticket-routing-lastseen {
  display: none;
}

.ticket-head.has-routing {
  border-bottom: 0;
}

.ticket-head-info {
  min-width: 0;
  flex: 1;
}

.ticket-head-title {
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-head-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ticket-shell .chat-bubble {
  white-space: pre-wrap;
}

.chat-role {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.chat-closed {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--hairline);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.chat-form {
  flex-shrink: 0;
}

.chat-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chat-file-label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chat-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chat-preview-media {
  display: block;
  max-width: min(320px, 72vw);
  max-height: 120px;
  object-fit: contain;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: #000;
}

.chat-preview-media[hidden] {
  display: none;
}

.chat-send-status {
  min-height: 0;
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: right;
  transition: min-height 0.15s ease, padding 0.15s ease;
}

.chat-form.is-sending .chat-send-status,
.chat-send-status.is-error {
  min-height: 24px;
  padding-bottom: var(--space-2);
}

.chat-send-status.is-error {
  color: var(--danger);
}

.chat-form.is-sending .chat-send-btn i {
  animation: hydra-spin 0.75s linear infinite;
}

.chat-form.is-sending .chat-file-label {
  opacity: 0.55;
  pointer-events: none;
}

.chat-form.is-sending .tpl-bar,
.chat-form.is-sending #chat-preview-clear {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-panel);
  }

  .nav-toggle-input:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }

  .nav-toggle-input:checked ~ .app-shell .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

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

  .nav-toggle-label {
    display: inline-flex;
  }

  .topbar {
    padding: 0 var(--space-4);
  }

  .content {
    padding: var(--space-4);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .balance-chip .unit,
  .user-chip .uname {
    display: none;
  }

  .chat-msg {
    max-width: 92%;
  }
}

@media (max-width: 520px) {
  .topbar-title {
    display: none;
  }

  .balance-chip {
    padding: 6px var(--space-2);
  }

  .page-title {
    font-size: 1.3rem;
  }
}

.topup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-4);
  align-items: start;
}

.pay-fieldset {
  border: none;
  margin-bottom: var(--space-5);
}

.pay-fieldset > legend {
  padding: 0;
  margin-bottom: var(--space-2);
}

.pay-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
}

.pay-method {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.pay-method:hover {
  border-color: var(--hairline);
}

.pay-method input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pay-method:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-glow);
}

.pay-method:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.pay-method-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.3rem;
}

.pay-method-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.pay-method-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.pay-method-fee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.pay-method-mark {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  color: var(--primary);
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pay-method:has(input:checked) .pay-method-mark {
  opacity: 1;
}

.amount-field {
  position: relative;
}

.amount-field input {
  appearance: textfield;
  -moz-appearance: textfield;
  padding: var(--space-3) 46px var(--space-3) var(--space-4);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.amount-field input::-webkit-outer-spin-button,
.amount-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-cur {
  position: absolute;
  top: 50%;
  right: var(--space-4);
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 700;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.topup-summary {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.summary-key {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.summary-val {
  font-weight: 700;
  color: var(--text-main);
}

.summary-total {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.summary-total .cur {
  color: var(--primary);
}

.topup-summary .buy-msg {
  margin: var(--space-3) 0 var(--space-1);
}

.topup-legal {
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: var(--space-3);
}

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

  .topup-summary {
    position: static;
  }
}

.pay-wait-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: start;
}

.pay-wait-main {
  display: flex;
  flex-direction: column;
}

.pay-wait-side {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.qr-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  text-align: center;
}

.qr-block .card-title {
  align-self: flex-start;
  text-align: left;
}

.qr-block .steps {
  align-self: stretch;
  text-align: left;
}

.qr-frame {
  padding: var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: #FFFFFF;
  box-shadow: var(--shadow-glow);
  line-height: 0;
}

.qr-holder canvas,
.qr-holder img {
  display: block;
  width: 216px;
  height: 216px;
}

.qr-holder table {
  border-collapse: collapse;
}

.qr-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 420px;
}

.qr-block .reveal {
  align-self: stretch;
  text-align: left;
  margin-bottom: 0;
}

.pay-code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--text-dim);
  word-break: break-all;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  margin-bottom: var(--space-2);
}

.pay-link-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-self: stretch;
  text-align: left;
}

.wait-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: var(--radius-md);
  background: rgba(217, 119, 6, 0.08);
  color: var(--warning-bright);
  font-size: 0.85rem;
  font-weight: 700;
}

.wait-status.is-paid {
  border-color: rgba(45, 181, 138, 0.3);
  background: var(--primary-soft);
  color: var(--primary);
}

.wait-status.is-expired {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger-bright);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: hydra-pulse 1.4s ease-in-out infinite;
}

.wait-status.is-expired .pulse-dot {
  animation: none;
}

@keyframes hydra-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

.wait-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.wait-timer-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.wait-timer.is-low {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
}

.wait-timer.is-low .wait-timer-val {
  color: var(--danger-bright);
}

.pay-wait-side .buy-msg {
  margin: var(--space-3) 0 var(--space-1);
}

.wait-hint {
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: var(--space-3);
}

.page-leaving {
  opacity: 0;
  transition: opacity 0.4s ease;
}

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

  .pay-wait-side {
    position: static;
  }
}

@media (max-width: 520px) {
  .qr-holder canvas,
  .qr-holder img {
    width: 180px;
    height: 180px;
  }
}

.faq-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.faq-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}

.faq-search > i {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: color 0.15s ease;
}

.faq-search:focus-within > i {
  color: var(--primary);
}

.faq-search .input {
  padding-left: 38px;
}

.faq-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.faq-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 7px var(--space-3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.faq-tag i {
  font-size: 0.9rem;
}

.faq-tag:hover {
  color: var(--text-main);
  border-color: var(--hairline);
  background: var(--surface-2);
}

.faq-tag.is-active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.faq-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.faq-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.95rem;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.faq-group-title i {
  color: var(--primary);
  font-size: 1.05rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.faq-item:hover {
  border-color: var(--hairline);
}

.faq-item[open] {
  border-color: var(--primary);
  background: var(--surface-2);
}

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-q:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.faq-q-text {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-main);
}

.faq-item[open] .faq-q-text {
  color: var(--primary);
}

.faq-q-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 0.9rem;
  transition: transform 0.2s ease, border-color 0.15s ease;
}

.faq-item[open] .faq-q-icon {
  transform: rotate(45deg);
  border-color: var(--primary);
}

.faq-a {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-muted);
  animation: faq-reveal 0.18s ease;
}

.faq-a p {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.faq-a > * + * {
  margin-top: var(--space-3);
}

.faq-a a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@keyframes faq-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-empty {
  margin-top: var(--space-5);
}

.faq-cta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  border-color: var(--hairline);
  background: linear-gradient(135deg, var(--primary-soft), transparent 60%), var(--surface);
}

.faq-cta-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  color: var(--primary);
  font-size: 1.5rem;
}

.faq-cta-body {
  flex: 1 1 280px;
  min-width: 0;
}

.faq-cta-title {
  font-size: 1rem;
  font-weight: 700;
}

.faq-cta-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.faq-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.legal-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.legal-aside {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
  min-width: 0;
}

.toc {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.toc-title {
  margin-bottom: var(--space-3);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 7px var(--space-2);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-dim);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.toc-link:hover,
.toc-link:focus-visible {
  color: var(--primary);
  background: var(--primary-soft);
  border-left-color: var(--primary);
}

.toc-num {
  flex: none;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-faint);
  transition: color 0.15s ease;
}

.toc-link:hover .toc-num {
  color: var(--primary-dim);
}

.toc-text {
  min-width: 0;
}

.toc-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-muted);
}

.toc-side-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.toc-side-link i {
  font-size: 0.9rem;
}

.toc-side-link:hover {
  color: var(--primary);
}

.legal-content {
  min-width: 0;
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.legal-head {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.legal-eyebrow {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--primary);
}

.legal-title {
  font-size: 1.6rem;
  font-weight: 700;
}

.legal-lead {
  max-width: 72ch;
  margin-top: var(--space-3);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-dim);
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.legal-section {
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.legal-section + .legal-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-muted);
}

.legal-h2 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
}

.legal-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.legal-section:target .legal-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #04120C;
}

.legal-h3 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: 0.92rem;
  color: var(--text-main);
}

.legal-section p {
  max-width: 78ch;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--text-dim);
}

.legal-section p + p {
  margin-top: var(--space-3);
}

.legal-section .steps {
  margin-top: var(--space-4);
}

.legal-section a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.legal-list li {
  position: relative;
  padding-left: var(--space-4);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.legal-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
}

.legal-list-deny li::before {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.14);
}

.legal-terms {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
}

.legal-terms dt {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.legal-terms dd {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.legal-terms dt,
.legal-terms dd {
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}

.legal-terms dt:last-of-type,
.legal-terms dd:last-of-type {
  padding-bottom: 0;
  border-bottom: none;
}

.legal-note {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left: 2px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-inset);
}

.legal-note-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.legal-note p {
  max-width: none;
  font-size: 0.83rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.legal-note-warning {
  border-left-color: var(--warning);
  background: rgba(217, 119, 6, 0.07);
}

.legal-note-warning .legal-note-title {
  color: var(--warning-bright);
}

.legal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}

.legal-foot .legal-foot-text {
  flex: 1 1 260px;
  max-width: none;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.legal-foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

html:has(.legal-layout) {
  scroll-behavior: smooth;
}

@media (max-width: 1100px) {
  .legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .legal-aside {
    position: static;
  }

  .toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }

  .toc-foot {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}

@media (max-width: 900px) {
  .legal-terms {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }

  .legal-terms dt {
    padding-bottom: 0;
    border-bottom: none;
  }

  .legal-terms dd {
    padding-bottom: var(--space-3);
  }
}

@media (max-width: 520px) {
  .faq-toolbar {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .faq-q {
    padding: var(--space-3);
  }

  .faq-a {
    padding: var(--space-3);
  }

  .faq-cta-actions .btn,
  .legal-foot-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .legal-content {
    padding: var(--space-4) var(--space-3);
  }

  .legal-title {
    font-size: 1.3rem;
  }

  .legal-h2 {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.legal-layout) {
    scroll-behavior: auto;
  }

  .faq-a {
    animation: none;
  }

  .faq-q-icon {
    transition: border-color 0.15s ease;
  }
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  border-color: var(--hairline);
  box-shadow: var(--shadow-glow);
}

.stat-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(45, 181, 138, 0.3);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.45rem;
}

.stat-card-icon.is-warning {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
  color: var(--warning-bright);
}

.stat-card-icon.is-danger {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger-bright);
}

.stat-card-icon.is-info {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
  color: var(--info);
}

.stat-card-body {
  min-width: 0;
  flex: 1;
}

.stat-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-card-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.admin-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.admin-tab i {
  font-size: 1.05rem;
}

.admin-tab:hover {
  color: var(--text-main);
}

.admin-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.admin-tab-count {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.admin-tab.is-active .admin-tab-count {
  color: var(--primary);
  border-color: rgba(45, 181, 138, 0.3);
  background: var(--primary-soft);
}

.admin-tabpane {
  display: none;
}

.admin-tabpane.is-active {
  display: block;
  animation: admin-fade 0.2s ease;
}

.admin-tabpane:focus-visible {
  outline: none;
}

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

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.admin-toolbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.admin-subs-search {
  min-width: 200px;
}

.admin-search {
  position: relative;
  min-width: 220px;
}

.admin-search i {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

.admin-search input {
  padding-left: 38px;
}

.admin-filter {
  width: auto;
  min-width: 160px;
}

.admin-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-user-name {
  font-weight: 700;
  color: var(--text-main);
}

.table-user-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.table-sub-cell {
  font-size: 0.78rem;
  line-height: 1.6;
  min-width: 160px;
}

.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-meter {
  margin-bottom: var(--space-4);
}

.admin-meter:last-child {
  margin-bottom: 0;
}

.admin-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.admin-meter-track {
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  overflow: hidden;
}

.admin-meter-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  transition: width 0.4s ease, background 0.2s ease;
}

.admin-meter-fill.is-warning {
  background: var(--warning-bright);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.4);
}

.admin-meter-fill.is-danger {
  background: var(--danger-bright);
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.admin-result {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
}

.admin-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: var(--space-4);
  transition: color 0.15s ease;
}

.admin-back:hover {
  color: var(--primary);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.admin-avatar-xl {
  width: 88px;
  height: 88px;
}

.admin-profile-info {
  flex: 1;
  min-width: 0;
}

.admin-profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #F3F4F6;
}

.admin-profile-badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.admin-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.admin-meta {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  min-width: 0;
}

.admin-meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
}

.admin-meta-val {
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
  word-break: break-word;
}

.admin-balance-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.admin-actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.admin-actions-row input {
  flex: 1;
  min-width: 140px;
}

.admin-sub-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.admin-sub-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.admin-sub-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.admin-sub-name {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.admin-sub-time {
  text-align: right;
  min-width: 120px;
}

.admin-hwid {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  word-break: break-all;
}

.admin-kv-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  background: var(--surface);
}

.admin-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.admin-kv:last-child {
  border-bottom: none;
}

.admin-kv-key {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.admin-kv-val {
  color: var(--text-main);
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

@media (max-width: 520px) {
  .admin-profile {
    gap: var(--space-4);
  }

  .admin-avatar-xl {
    width: 64px;
    height: 64px;
  }

  .stat-card-value {
    font-size: 1.4rem;
  }
}

.admin-promo-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-left: 2px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-inset);
}

.admin-promo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.2rem;
}

.admin-promo-code {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--primary);
  word-break: break-all;
}

.admin-ref-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 260px;
  overflow-y: auto;
}

.admin-ref-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.82rem;
}

.admin-ref-item i {
  color: var(--primary);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.admin-ref-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ref-date {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hwid-alert {
  padding: var(--space-4);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-left: 2px solid var(--warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(217, 119, 6, 0.07);
}

.hwid-alert-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.hwid-alert-head .icon-badge {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  font-size: 1.45rem;
}

.hwid-alert-body {
  flex: 1 1 260px;
  min-width: 0;
}

.hwid-alert-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--warning-bright);
}

.hwid-alert-text {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-dim);
  margin-top: 2px;
}

.hwid-alert-btn {
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .admin-promo-code {
    font-size: 1rem;
    letter-spacing: 0.08em;
  }

  .hwid-alert {
    padding: var(--space-3);
  }

  .hwid-alert-btn {
    width: 100%;
    justify-content: center;
  }
}




.admin-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-5);
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + var(--space-4));
    background: var(--bg-elevated);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.admin-sidebar-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.admin-sidebar-mark {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 1.3rem;
}

.admin-sidebar-title {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
}

.admin-sidebar-role {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.admin-nav-link i {
    font-size: 1.1rem;
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.admin-nav-link:hover {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-main);
}

.admin-nav-link.is-active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.admin-nav-count {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--bg-inset);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-muted);
    color: var(--text-muted);
}

.admin-nav-link.is-active .admin-nav-count {
    border-color: var(--primary);
    color: var(--primary);
}

.admin-sidebar-foot {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-muted);
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-live-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-glow);
    animation: hydra-pulse 2s infinite;
}

@keyframes hydra-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.admin-pane {
    display: none;
}

.admin-pane.is-active {
    display: block;
    animation: admin-fade 0.3s ease;
}

/* Commercial analytics and customer history: reuse the compact terminal UI. */
.analytics-funnel { display: grid; gap: var(--space-3); padding-top: var(--space-3); }
.analytics-funnel-step { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); padding:12px; border:1px solid var(--border); background:var(--surface); border-left:3px solid var(--primary); }
.ticket-routing { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.ticket-routing .admin-filter { max-width:150px; font-size:.72rem; padding:6px 8px; }
.ticket-routing-panel { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-2); padding:var(--space-2) var(--space-3); border-bottom:1px solid var(--hairline); background:var(--bg-elevated); }
.ticket-routing-panel .admin-filter { min-width:145px; font-size:.75rem; padding:7px 9px; }
.ticket-routing-panel .label-caps { flex-shrink: 0; }
.ticket-routing-panel .btn { flex-shrink: 0; }
.bot-switch { display:inline-flex; align-items:center; gap:8px; margin-left:auto; cursor:pointer; color:var(--text-secondary); font-size:.8rem; }
.bot-switch input { position:absolute; opacity:0; pointer-events:none; }
.bot-switch-slider { width:38px; height:21px; border-radius:999px; background:var(--hairline); position:relative; transition:.2s; }
.bot-switch-slider:after { content:""; width:17px; height:17px; border-radius:50%; background:#fff; position:absolute; top:2px; left:2px; transition:.2s; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.bot-switch input:checked + .bot-switch-slider { background:var(--success); }
.bot-switch input:checked + .bot-switch-slider:after { transform:translateX(17px); }
.user-timeline { position:relative; display:grid; gap:0; }
.user-timeline-item { display:grid; grid-template-columns:30px minmax(0, 1fr) auto; gap:var(--space-3); align-items:start; padding:10px 0; border-bottom:1px solid var(--border-muted); }
.user-timeline-item:last-child { border-bottom:0; }
.user-timeline-mark { width:26px; height:26px; display:grid; place-items:center; background:var(--primary-soft); color:var(--primary); border:1px solid var(--border); border-radius:var(--radius-sm); }
.user-timeline-item.is-ticket .user-timeline-mark { color:var(--warning-bright); border-color:rgba(217,119,6,.3); background:rgba(217,119,6,.08); }
.user-timeline-item.is-payment .user-timeline-mark { color:var(--info); border-color:rgba(96,165,250,.3); background:rgba(96,165,250,.08); }
.user-timeline-title { font-weight:700; color:var(--text-main); }
@media (max-width: 680px) {
    .ticket-routing { width:100%; }
    .ticket-routing-panel .btn-danger { margin-left:0; }
    .user-timeline-item { grid-template-columns:30px minmax(0,1fr); }
    .user-timeline-item time { grid-column:2; }

    .ticket-head.has-routing {
        border-bottom: 1px solid var(--hairline);
    }

    .ticket-tools-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    .ticket-tools-toggle.is-open {
        color: var(--primary);
        border-color: var(--primary);
        background: var(--primary-soft);
    }

    .ticket-routing-panel {
        display: none;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .ticket-routing-panel.is-open {
        display: grid;
    }

    .ticket-routing-panel .label-caps {
        grid-column: 1 / -1;
        width: auto;
    }

    .ticket-routing-lastseen {
        display: flex;
        align-items: center;
        gap: 6px;
        grid-column: 1 / -1;
        color: var(--text-muted);
        font-size: 0.72rem;
    }

    .ticket-routing-panel .admin-filter,
    .ticket-routing-panel .btn {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .tpl-bar {
        gap: 0;
        padding: var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--hairline);
    }

    .tpl-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 42px;
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface);
        color: var(--text-main);
        font: inherit;
        font-size: 0.8rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        cursor: pointer;
    }

    .tpl-mobile-toggle > span {
        display: inline-flex;
        align-items: center;
        gap: 7px;
    }

    .tpl-mobile-chevron {
        font-size: 1.1rem;
        transition: transform 0.15s ease;
    }

    .tpl-bar.is-open .tpl-mobile-toggle {
        color: var(--primary);
        border-color: var(--primary);
        background: var(--primary-soft);
    }

    .tpl-bar.is-open .tpl-mobile-chevron {
        transform: rotate(180deg);
    }

    .tpl-bar-content {
        display: none;
        padding-top: var(--space-2);
    }

    .tpl-bar.is-open .tpl-bar-content {
        display: flex;
    }

    .tpl-bar-head .tpl-bar-title {
        display: none;
    }

    .tpl-cat-filter {
        width: 100%;
        min-width: 0;
    }

    .tpl-chips {
        max-height: 150px;
    }

    .tpl-chip {
        flex: 1 1 calc(50% - 3px);
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .ticket-head-main {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: var(--space-2);
        row-gap: 4px;
    }

    .ticket-head-main > .btn:first-child {
        grid-column: 1;
        grid-row: 1;
    }

    .ticket-head-info {
        grid-column: 2;
        grid-row: 1;
    }

    .ticket-tools-toggle {
        grid-column: 3;
        grid-row: 1;
    }

    .ticket-head-main > .badge {
        grid-column: 2 / -1;
        grid-row: 2;
        justify-self: start;
        margin-top: 0;
        padding: 3px 7px;
        font-size: 0.62rem;
    }

    .ticket-lastseen {
        display: none;
    }

    .ticket-head {
        padding: 7px var(--space-3);
    }

    .ticket-head-main > .btn:first-child,
    .ticket-tools-toggle {
        width: 40px;
        height: 40px;
    }

    .ticket-head-title {
        font-size: 0.9rem;
    }
}

@keyframes admin-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
    }
    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .admin-nav-link {
        width: auto;
        flex: 1 1 auto;
    }
}


.ticket-shell {
    max-width: 900px;
    margin: 0 auto;   
    height: calc(100vh - 120px);
}

.chat-window {
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
}

.chat {
    gap: var(--space-3);
    margin-top: auto;    
}

.chat-msg {
    max-width: 85%; 
}

.chat-msg.is-me .chat-meta {
    justify-content: flex-end; 
}


.admin-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.admin-chart-box {
    position: relative;
    height: 350px; 
    width: 100%;
    margin-top: var(--space-4);
}

.admin-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: var(--space-3);
}

.admin-section-title i {
    color: var(--primary);
}

@media (max-width: 900px) {
    .admin-chart-grid {
        grid-template-columns: 1fr;
    }
    .admin-chart-box {
        height: 280px;
    }
}


.row-menu {
    position: relative;
    display: inline-block;
}

.row-menu-list {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
    min-width: 180px;
    margin-top: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel), var(--shadow-glow);
    display: none; 
    flex-direction: column;
    overflow: hidden;
}

.row-menu.is-open .row-menu-list {
    display: flex;
}

.row-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-muted);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
}

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

.row-menu-item i {
    font-size: 1rem;
    color: var(--primary);
}

.row-menu-item:hover {
    background: var(--surface-2);
    color: var(--text-main);
}

.row-menu-item.is-danger:hover {
    color: var(--danger-bright);
}

.row-menu-item.is-success i { color: var(--primary); }
.row-menu-item.is-warning i { color: var(--warning-bright); }
.row-menu-item.is-danger i { color: var(--danger-bright); }


.mass-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--primary-soft);
    border: 1px solid rgba(45, 181, 138, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}


.mass-bar.is-active {
    display: flex;
    animation: admin-fade 0.2s ease;
}

.mass-bar-count {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.mass-bar-count i {
    font-size: 1.1rem;
}

.mass-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}


@media (max-width: 900px) {
    .mass-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
}


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

.admin-sidebar-head-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-nav-text {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.admin-nav-dot {
    width: 7px;
    height: 7px;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--danger-bright);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.65);
    animation: hydra-pulse 1.6s infinite;
}


.stat-card-value.is-alert {
    color: var(--warning-bright);
}



.admin-tag-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.admin-role-badge {
    --role-color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: var(--bg-inset);
    border: 1px solid var(--role-color);
    border-radius: var(--radius-sm);
    color: var(--role-color);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.admin-role-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--role-color);
    flex-shrink: 0;
}

.admin-status-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

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

.sub-checkbox {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

.row-menu-trigger {
    flex-shrink: 0;
}



.admin-keys-out {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    line-height: 1.7;
}

.admin-key-code {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
}



.admin-color-input {
    width: 100%;
    height: 40px;
    padding: 3px;
    background: var(--bg-inset);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.admin-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.admin-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 1px;
}

.admin-color-input::-moz-color-swatch {
    border: none;
    border-radius: 1px;
}

.admin-role-head {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: var(--space-3);
    align-items: end;
    margin-bottom: var(--space-4);
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.admin-role-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.admin-role-card {
    --role-color: var(--primary);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border-muted);
    border-left: 3px solid var(--role-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease;
}

.admin-role-card:hover {
    border-color: var(--border);
    border-left-color: var(--role-color);
}

.admin-role-card-head {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: var(--space-3);
    align-items: end;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-muted);
}

.admin-role-card-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-muted);
}



.pricing-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.pricing-row {
    display: grid;
    grid-template-columns: 1fr 1fr 40px;
    gap: var(--space-2);
    align-items: center;
}

.pricing-row-del {
    flex-shrink: 0;
}

.admin-product-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.admin-product-card {
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease;
}

.admin-product-card:hover {
    border-color: var(--border);
}

.admin-product-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-muted);
}

.admin-product-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}



.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4);
}

.case-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease;
}

.case-card:hover {
    border-color: var(--border);
}

.case-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-muted);
}

.case-card-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    padding: 4px;
    object-fit: contain;
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
}

.case-card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.case-card-name {
    max-width: 100%;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-card-tools {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.case-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 330px;
    overflow-y: auto;
    padding-right: 4px;
}

.case-item {
    --item-color: var(--info);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-left: 2px solid var(--item-color);
    border-radius: var(--radius-sm);
}

.case-item-img {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    object-fit: contain;
}

.case-item-body {
    flex: 1 1 auto;
    min-width: 0;
}

.case-item-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--item-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-item-sub {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    font-size: 0.66rem;
    color: var(--text-muted);
}

.case-item-tools {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.item-dyn-fields {
    padding: var(--space-3);
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
}

.item-dyn-fields > .form-group:last-child,
.item-dyn-fields .grid:last-child .form-group {
    margin-bottom: 0;
}


.admin-pane .ticket-subject {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow: visible;
    white-space: normal;
}

.ticket-subject-text {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-mode-switch {
    display: inline-flex;
    gap: 0;
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.log-mode-switch .btn {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--text-muted);
}

.log-mode-switch .btn:hover {
    color: var(--text-main);
    background: var(--surface-2);
}

.log-mode-switch .btn.is-active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.log-view {
    display: none;
}

.log-view.is-active {
    display: block;
    animation: admin-fade 0.25s ease;
}

.log-time {
    white-space: nowrap;
    font-size: 0.72rem;
}

.log-details {
    max-width: 380px;
    color: var(--text-dim);
    font-size: 0.76rem;
}

.hwid-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 7px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.35);
    border-radius: var(--radius-sm);
    color: var(--danger-bright);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}



.log-tree {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-2) 0 var(--space-2) var(--space-5);
}

.log-tree::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 7px;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--border), transparent);
}

.log-tree:empty::before,
.log-tree:has(> .empty-state)::before,
.log-tree:has(> .admin-loading)::before {
    display: none;
}

.log-tree-item {
    position: relative;
    padding-bottom: var(--space-3);
}

.log-tree-node {
    position: absolute;
    top: 18px;
    left: calc(var(--space-5) * -1 + 4px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
    box-shadow: 0 0 0 3px var(--bg-main);
}

.log-tree-item.is-warn .log-tree-node {
    background: var(--warning-bright);
    box-shadow: 0 0 0 3px var(--bg-main), 0 0 8px rgba(251, 191, 36, 0.5);
}

.log-tree-item.is-security .log-tree-node {
    background: var(--danger-bright);
    box-shadow: 0 0 0 3px var(--bg-main), 0 0 8px rgba(248, 113, 113, 0.55);
}

.log-tree-card {
    background: var(--surface);
    border: 1px solid var(--border-muted);
    border-left: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    transition: border-color 0.2s ease;
}

.log-tree-card:hover {
    border-color: var(--border);
}

.log-tree-item.is-warn .log-tree-card {
    border-left-color: var(--warning);
}

.log-tree-item.is-security .log-tree-card {
    border-left-color: var(--danger);
}

.log-tree-head {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.log-tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 1rem;
}

.log-tree-item.is-warn .log-tree-icon {
    border-color: rgba(217, 119, 6, 0.4);
    color: var(--warning-bright);
}

.log-tree-item.is-security .log-tree-icon {
    border-color: rgba(220, 38, 38, 0.4);
    color: var(--danger-bright);
}

.log-tree-headings {
    flex: 1 1 auto;
    min-width: 0;
}

.log-tree-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.log-tree-action {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 400;
    word-break: break-all;
}

.log-tree-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 3px 0 0;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.log-tree-meta i {
    color: var(--text-faint);
}

.log-tree-sep {
    color: var(--text-faint);
}

.log-tree-cat {
    flex-shrink: 0;
    font-size: 0.62rem;
}

.log-tree-details {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.76rem;
    word-break: break-word;
}

.log-tree-arrow {
    position: absolute;
    bottom: -2px;
    left: calc(var(--space-5) * -1 + 2px);
    color: var(--text-faint);
    font-size: 0.85rem;
    line-height: 1;
}



.log-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-muted);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.log-pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}


.log-tooltip-target {
    cursor: help;
}

.log-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 3000;
    max-width: 460px;
    padding: var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel), var(--shadow-glow);
    color: var(--text-dim);
    font-size: 0.72rem;
    line-height: 1.6;
    word-break: break-word;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.log-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
}

.log-tooltip-title {
    margin-bottom: var(--space-2);
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-muted);
    color: var(--danger-bright);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.log-tooltip-table {
    width: 100%;
    border-collapse: collapse;
}

.log-tooltip-table th {
    padding: 2px var(--space-2) 2px 0;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    vertical-align: top;
}

.log-tooltip-table td {
    padding: 2px 0;
    color: var(--text-main);
    vertical-align: top;
}


.toast-stack {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 260px;
    max-width: 380px;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--hairline);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel);
    color: var(--text-main);
    font-size: 0.8rem;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast.is-success {
    border-left-color: var(--primary);
}

.toast.is-success i {
    color: var(--primary);
}

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

.toast.is-error i {
    color: var(--danger-bright);
}


.icon-badge.is-primary {
    background: var(--primary-soft);
    border: 1px solid var(--border);
    color: var(--primary);
}

.icon-badge.is-warning {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.35);
    color: var(--warning-bright);
}

.icon-badge.is-danger {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: var(--danger-bright);
}

.modal.is-critical {
    border-color: rgba(220, 38, 38, 0.45);
    box-shadow: var(--shadow-panel), 0 0 30px rgba(220, 38, 38, 0.18);
}

.critical-note {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: rgba(220, 38, 38, 0.07);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: var(--radius-sm);
    color: var(--danger-bright);
    font-size: 0.72rem;
    line-height: 1.55;
}


@media (max-width: 900px) {
    .admin-role-head,
    .admin-role-card-head {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

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

    .log-details,
    .ticket-subject-text {
        max-width: 220px;
    }

    .log-pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .toast-stack {
        right: var(--space-3);
        left: var(--space-3);
        bottom: var(--space-3);
    }

    .toast {
        min-width: 0;
        max-width: none;
    }

    .log-tooltip {
        max-width: calc(100vw - 32px);
    }
}

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

    .pricing-row {
        grid-template-columns: 1fr 1fr 36px;
        gap: 6px;
    }

    .log-mode-switch {
        width: 100%;
    }

    .log-mode-switch .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .case-card-tools,
    .case-item-tools {
        flex-shrink: 0;
    }

    .log-tree {
        padding-left: var(--space-4);
    }

    .log-tree-node {
        left: calc(var(--space-4) * -1 + 4px);
    }

    .log-tree-arrow {
        left: calc(var(--space-4) * -1 + 2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .admin-nav-dot,
    .admin-live-dot {
        animation: none;
    }

    .toast,
    .log-tooltip,
    .log-view.is-active,
    .admin-pane.is-active {
        animation: none;
        transition: none;
    }
}

.chat-col {
    align-items: flex-start !important; 
}

.chat-msg.is-me .chat-col {
    align-items: flex-end !important; 
}

.chat-bubble {
    display: flex !important; 
    flex-direction: column;
    width: fit-content !important;    
    max-width: 100% !important;       
}


.ticket-shell .chat-bubble {
    white-space: normal !important;
}

.chat-bubble span {
    white-space: pre-wrap !important;
    word-break: break-word;
}
