/* ─────────────────────────────────────────────────────────────
   KG-Chats — admin panel (Russian, dark, watchers style)
   Palette mirrors widget/styles.css.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #0C0D13;
  --bg-deep: #08090E;
  --fg: #FFFFFF;
  --muted: #6E7180;
  --subtle: #4B4E5C;
  --border: #1E2030;
  --border-strong: #2A2C3D;
  --surface: #171B2E;
  --surface-2: #1E2236;
  --surface-3: #2A2C38;

  --accent: #F84F77;
  --accent-strong: #E11D52;
  --accent-soft: rgba(248, 79, 119, 0.18);
  --accent-gradient: linear-gradient(135deg, #F84F77 0%, #E11D52 100%);

  --danger: #F4365C;
  --danger-bg: rgba(244, 54, 92, 0.14);
  --warning: #F5B544;
  --warning-bg: rgba(245, 181, 68, 0.12);
  --success: #5BD17F;
  --success-bg: rgba(91, 209, 127, 0.14);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 8px 22px rgba(248, 79, 119, 0.45);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease,
    box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 10px 22px rgba(248, 79, 119, 0.55);
  background: var(--accent-gradient);
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(244, 54, 92, 0.35);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(244, 54, 92, 0.22);
  border-color: var(--danger);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--fg);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}
.btn-block {
  width: 100%;
}

/* ─── Inputs ─── */

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.field > input {
  background: var(--bg-deep, var(--bg));
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field > input::placeholder {
  color: var(--muted);
}
.field > input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(248, 79, 119, 0.18);
}

/* ─── Login screen ─── */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
      ellipse at top,
      rgba(248, 79, 119, 0.12),
      transparent 60%
    ),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.login-logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-accent);
}
.login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.login-sub {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.login-err {
  min-height: 18px;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── App layout ─── */

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

/* Sidebar */
.sidebar {
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 22px;
  border-bottom: 1px solid var(--border);
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.nav {
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--fg);
}
.nav-item.active {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.nav-item.active .nav-ico {
  color: var(--accent);
}
.nav-ico {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.15s ease;
}
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
}
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(91, 209, 127, 0.45);
  animation: pulse-dot 1.8s ease-out infinite;
}
.online-label {
  color: var(--muted);
  font-weight: 500;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(91, 209, 127, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(91, 209, 127, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(91, 209, 127, 0);
  }
}

.content {
  padding: 24px 28px 60px;
  flex: 1;
  min-width: 0;
}

/* ─── Cards / panels ─── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card {
  margin-top: 16px;
}
.card-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title-text {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Metric cards (overview) ─── */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.metric:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-sub {
  font-size: 12px;
  color: var(--muted);
}
.metric.metric-accent {
  background: linear-gradient(135deg, rgba(248, 79, 119, 0.12), rgba(225, 29, 82, 0.04));
  border-color: rgba(248, 79, 119, 0.35);
}
.metric.metric-accent .metric-value {
  color: var(--fg);
}
.metric.metric-success .metric-value {
  color: var(--success);
}
.metric.metric-danger .metric-value {
  color: var(--danger);
}
.metric.metric-warning {
  background: linear-gradient(135deg, rgba(245, 181, 68, 0.12), rgba(245, 181, 68, 0.02));
  border-color: rgba(245, 181, 68, 0.32);
}
.metric.metric-warning .metric-value {
  color: var(--warning);
}
/* Clickable metric cards (overview → section navigation). */
.metric-link {
  cursor: pointer;
}
.metric-link:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.metric-link:focus-visible {
  outline: 2px solid var(--accent, #f84f77);
  outline-offset: 2px;
}
/* Arrow affordance, top-right, revealed on hover/focus. */
.metric-link::after {
  content: '↗';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.metric-link:hover::after,
.metric-link:focus-visible::after {
  opacity: 0.8;
}

/* ─── Tables ─── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.table tbody tr {
  transition: background 0.12s ease;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table .col-actions {
  text-align: right;
  white-space: nowrap;
}
.table .row-link {
  cursor: pointer;
}
.table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ─── Empty / loading ─── */

.empty,
.loading {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Filter bar (forms) ─── */

.filterbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}
.filterbar .field {
  flex: 1 1 200px;
  min-width: 180px;
}
.filterbar .filterbar-actions {
  display: flex;
  gap: 8px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  appearance: none;
  width: 34px;
  height: 20px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
}
.toggle input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.15s ease;
}
.toggle input:checked {
  background: var(--accent);
}
.toggle input:checked::after {
  transform: translateX(14px);
}

/* ─── Messages feed (admin view) ─── */

.messages-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.msg-row:hover {
  border-color: var(--border-strong);
}
.msg-row.is-deleted {
  opacity: 0.55;
}
.msg-row.is-hidden {
  opacity: 0.55;
}
/* ─── Say composer (admin "Писать в чат") ─── */

.say-card .filterbar {
  margin-bottom: 12px;
}
.say-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.say-hint {
  color: var(--muted);
  font-size: 12.5px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-row.is-shadowed {
  border-color: rgba(167, 139, 250, 0.45);
}
.msg-row.is-pinned {
  border-color: rgba(248, 79, 119, 0.45);
  background: linear-gradient(180deg, rgba(248, 79, 119, 0.06), transparent 60%), var(--surface);
}
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.msg-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.msg-nick {
  font-weight: 700;
  font-size: 13.5px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-userid {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.msg-time {
  font-size: 11.5px;
  color: var(--muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.msg-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-pin {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-deleted {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-hidden {
  background: rgba(110, 113, 128, 0.22);
  color: var(--fg);
}
.badge-shadowed {
  background: rgba(167, 139, 250, 0.18);
  color: #C4B5FD;
}
.msg-row.is-hidden .msg-text {
  font-style: italic;
}
.nick-shadow-mark {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(167, 139, 250, 0.18);
  color: #C4B5FD;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge-report-open {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-report-resolved {
  background: var(--success-bg);
  color: var(--success);
}

/* ─── Reports view ─── */

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.report-nick {
  font-weight: 700;
  font-size: 13px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-uid {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.reason-label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.row-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.msg-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg-row.is-deleted .msg-text {
  font-style: italic;
}
.msg-quote {
  border-left: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 6px;
  margin: 2px 0 4px;
  font-size: 12.5px;
}
.msg-quote-nick {
  font-weight: 700;
  font-size: 12px;
}
.msg-quote-text {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-attach {
  margin-top: 4px;
}
.msg-attach-image {
  display: inline-block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: filter 0.15s ease;
}
.msg-attach-image:hover {
  filter: brightness(1.08);
}
.msg-attach-sticker {
  display: inline-block;
  width: 80px;
  height: 80px;
  object-fit: contain;
}
.msg-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 220px;
}

/* ─── Sites grid ─── */

.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.site-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.site-name-input {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin: -6px -8px;
  color: var(--fg);
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.site-name-input:hover {
  background: var(--bg);
  border-color: var(--border);
}
.site-name-input:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.site-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  align-self: center;
  white-space: nowrap;
}
.site-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.site-row-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.site-row-value {
  display: flex;
  gap: 6px;
  align-items: center;
}
.site-row-value .input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.site-key-mask {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ─── Theme editor (per-site) ─── */

.theme-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.theme-block-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.theme-token {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-token-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.theme-token-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.theme-color-input {
  width: 36px;
  height: 32px;
  padding: 2px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.theme-color-input::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}
.theme-hex-input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  text-transform: uppercase;
  background: var(--bg-deep);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-hex-input:hover {
  border-color: var(--border-strong);
}
.theme-hex-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-hex-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(244, 54, 92, 0.18);
}
.theme-radius-input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg-deep);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
}
.theme-radius-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
}
.theme-preview-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}
.theme-preview-bubbles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-preview-bubble {
  max-width: 75%;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}
.theme-preview-bubble.is-other {
  align-self: flex-start;
}
.theme-preview-bubble.is-own {
  align-self: flex-end;
}
.theme-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.theme-preview-btn {
  border: 0;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: default;
}
.theme-preview-muted {
  font-size: 11.5px;
}
.theme-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── UI customization editor (G10b) ─── */

.ui-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.ui-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg);
  opacity: 0.85;
}
.ui-section-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}
.ui-texts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ui-text-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
}
.ui-text-row:hover {
  border-color: var(--border);
}
.ui-text-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.ui-text-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--accent);
  background: transparent;
  padding: 0;
}
.ui-text-default {
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.85;
  word-break: break-word;
}
.ui-text-input {
  width: 100%;
  font-size: 12.5px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ui-text-input:hover {
  border-color: var(--border-strong);
}
.ui-text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ui-emoji-default {
  font-size: 14px;
  letter-spacing: 2px;
}
.ui-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
}
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
}
.ui-chip-emoji {
  font-size: 16px;
}
.ui-chip-rm {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
}
.ui-chip-rm:hover {
  color: var(--danger);
  background: rgba(244, 54, 92, 0.08);
}
.ui-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ui-add-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  background: var(--bg-deep);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
}
.ui-add-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ui-font-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ui-font-slider {
  flex: 1;
  min-width: 120px;
}
.ui-font-num {
  width: 72px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg-deep);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
}
.ui-font-num:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ui-font-preview {
  padding: 8px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  line-height: 1.4;
}

/* ─── Toasts ─── */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  animation: toast-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.toast-success {
  border-left-color: var(--success);
  background: linear-gradient(90deg, var(--success-bg), transparent 60%), var(--surface);
}
.toast.toast-error {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, var(--danger-bg), transparent 60%), var(--surface);
}
.toast.toast-info {
  border-left-color: var(--accent);
}
.toast.is-leaving {
  animation: toast-out 0.18s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ─── Modal ─── */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 14, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: fade-in 0.15s ease;
  padding: 20px;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: pop-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ─── Badge pills (catalog badges) ─── */

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  color: #FFFFFF;
  line-height: 1.4;
  white-space: nowrap;
}

.msg-user-badges {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── Badges modal ─── */

.modal-badges {
  max-width: 480px;
  gap: 12px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-close {
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--fg);
}
.badges-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.badge-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.badge-toggle-row:hover {
  border-color: var(--border-strong);
}
.badge-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.badge-toggle-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ─── Content publish view ─── */

.content-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  width: fit-content;
}
.content-tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.content-tab:hover {
  color: var(--fg);
}
.content-tab.is-active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px -6px rgba(248, 79, 119, 0.55);
}

.content-form {
  margin-bottom: 16px;
}
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.input.is-invalid {
  border-color: var(--danger, #F84F77);
  box-shadow: 0 0 0 3px rgba(248, 79, 119, 0.18);
}

.poll-options {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poll-option-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.poll-option-row .input {
  flex: 1;
}

.content-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ─── Misc / responsive ─── */

.muted {
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.spacer {
  flex: 1;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-foot {
    display: none;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
  }
  .nav-item {
    flex-shrink: 0;
  }
  .brand {
    padding: 14px 16px;
  }
  .topbar,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }
  .msg-actions {
    min-width: 0;
  }
}

/* ─── Premoderation view ─── */

.premod-tabs {
  flex-wrap: wrap;
  width: 100%;
}

.premod-host {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.premod-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.premod-add-row .input {
  flex: 1;
}

.premod-list {
  min-height: 32px;
}

.premod-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.premod-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--fg);
  max-width: 100%;
}
.premod-chip-val {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.premod-chip-rm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}
.premod-chip-rm:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
}
.premod-chip-rm:disabled {
  opacity: 0.5;
  cursor: default;
}

.premod-bulk {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.premod-bulk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.premod-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.premod-file-input {
  display: none;
}
.premod-bulk-ta {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}
.premod-bulk-foot {
  display: flex;
  justify-content: flex-end;
}

.premod-settings {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.premod-settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.premod-settings-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
  letter-spacing: 0.2px;
}
.premod-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
}
.premod-feature-row {
  justify-content: space-between;
  flex-direction: row-reverse;
  padding: 6px 0;
  color: var(--fg);
  font-size: 13px;
}
.premod-feature-label {
  flex: 1;
}
.premod-esc-hint {
  margin-top: 4px;
}
.premod-settings-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ─── Counter (online) controls ─── */

.counter-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--fg);
  border: 1px solid var(--border);
}
.counter-badge-real {
  background: rgba(91, 209, 127, 0.14);
  color: #5BD17F;
  border-color: rgba(91, 209, 127, 0.35);
}
.counter-badge-range {
  background: rgba(96, 165, 250, 0.14);
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.35);
}

.modal-counter {
  max-width: 420px;
  gap: 12px;
}
.counter-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.counter-range-row.hidden {
  display: none;
}

.seg-control {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.seg-btn:hover:not(.is-active) {
  color: var(--fg);
}
.seg-btn.is-active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

/* ─── Banners view (G5) ─── */

.banner-name {
  font-weight: 600;
  color: var(--fg);
}
.banner-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.banner-period {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.banner-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.banner-status-active {
  background: var(--success-bg);
  color: var(--success);
}
.banner-status-scheduled {
  background: var(--accent-soft);
  color: var(--accent);
}
.banner-status-ended {
  background: rgba(110, 113, 128, 0.22);
  color: var(--muted);
}
.banner-status-off {
  background: var(--warning-bg);
  color: var(--warning);
}

.modal-banner {
  max-width: 540px;
  gap: 12px;
  max-height: 90vh;
  overflow: hidden;
}
.banner-form-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 65vh;
}
.banner-textarea {
  resize: vertical;
  min-height: 44px;
  font-family: inherit;
}
.banner-form-err {
  min-height: 18px;
  color: var(--danger);
  font-size: 12.5px;
}

/* ─── Popups view (G5) ─── */

.popup-html-textarea {
  resize: vertical;
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre;
}
.popup-preview-modal {
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.popup-preview-frame {
  flex: 1;
  width: 100%;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0C0D13;
}

/* ─── Quizzes (G5) ─── */
.quiz-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.quiz-dist {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 180px;
  max-width: 280px;
}
.quiz-dist-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-deep, rgba(0, 0, 0, 0.18));
  overflow: hidden;
  font-size: 11.5px;
}
.quiz-dist-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent-soft);
  z-index: 0;
  transition: width 0.25s ease;
}
.quiz-dist-label {
  position: relative;
  z-index: 1;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}
.quiz-dist-count {
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--fg);
}
.quiz-option-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.quiz-option-row .input {
  flex: 1;
  min-width: 0;
}
.quiz-option-image {
  max-width: 200px;
}
.quiz-option-correct {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.quiz-option-correct-label {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Login mode tabs ─── */

.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.login-tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.login-tab:hover {
  color: var(--fg);
}
.login-tab.is-active {
  background: var(--surface-2);
  color: var(--fg);
}
.login-mode {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Sidebar identity pill ─── */

.me-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
}
.me-pill-email {
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-pill-role {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Role badge in admins table ─── */

.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.role-badge.role-owner {
  color: #fff;
  background: var(--accent-gradient, #6366f1);
  border-color: transparent;
}
.role-badge.role-moderator {
  color: var(--fg);
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.status-dot.is-active {
  background: var(--success, #22c55e);
}
.status-dot.is-inactive {
  background: var(--muted);
}

/* ─── Analytics (G9b) ─── */

.analytics-chart-card .card-title {
  align-items: center;
}
.analytics-metric-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
}
.analytics-metric-field .field-label {
  margin: 0;
  white-space: nowrap;
}
.analytics-chart {
  width: 100%;
  background: var(--bg-deep, #08090E);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-sizing: border-box;
  overflow: hidden;
}
.analytics-chart-svg {
  display: block;
  width: 100%;
  height: 260px;
}
.analytics-chart-svg rect {
  transition: opacity 0.15s ease;
}
.analytics-chart-svg rect:hover {
  opacity: 1;
}
.analytics-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

/* ─── Media gallery (H1b) ─── */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.media-card {
  background: var(--bg-deep, #08090E);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.media-card-pickable {
  cursor: pointer;
}
.media-card-pickable:hover,
.media-card-pickable:focus-visible {
  border-color: var(--accent, #5BD17F);
  outline: none;
  transform: translateY(-1px);
}
.media-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%) 0 0 / 12px 12px,
    var(--surface, #14151B);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.media-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.media-meta {
  padding: 8px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.media-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-sub {
  font-size: 11px;
  color: var(--muted);
}
.media-actions {
  display: flex;
  gap: 6px;
  padding: 6px 10px 10px;
  flex-wrap: wrap;
}
.media-actions .btn {
  flex: 1 1 auto;
}
.media-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  min-height: 22px;
}
.media-footer-info {
  font-size: 12px;
  color: var(--muted);
}

/* Media picker modal */

.modal-media-picker {
  max-width: 820px;
  max-height: 90vh;
  gap: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-media-picker .media-grid {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 4px;
}
.media-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.media-picker-hint {
  font-size: 12px;
  color: var(--muted);
}
.media-grid-picker .media-card {
  cursor: pointer;
}

/* Picker button next to image URL inputs */

.media-input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.media-input-row .input {
  flex: 1;
  min-width: 0;
}
.media-pick-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
