@font-face {
  font-family: "UKIJ Tor";
  src: url("/admin/fonts/UKIJTorRegular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

:root {
  --bg: #0d1211;
  --surface: rgba(17, 24, 23, 0.84);
  --surface-strong: rgba(20, 28, 27, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4efe6;
  --muted: #b1bbb5;
  --accent: #7fe0c7;
  --accent-2: #e3b36d;
  --danger: #ff8978;
  --warn: #f2c46c;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
  --radius: 20px;
  --sidebar-w: 280px;
}

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

html {
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #0a0f0e, var(--bg) 50%, #090c0c);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "UKIJ Tor", "Noto Sans Arabic", "Microsoft Uighur", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(127, 224, 199, 0.09), transparent 20%),
    radial-gradient(circle at 90% 0%, rgba(227, 179, 109, 0.08), transparent 25%),
    linear-gradient(180deg, #0d1211, #111816 50%, #0b0f0f);
  overflow-x: hidden;
}

[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
a { color: inherit; }

/* ---------- auth ---------- */

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

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  border-radius: 28px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at top right, rgba(127, 224, 199, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(24, 33, 31, 0.96), rgba(14, 19, 18, 0.98));
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.auth-mark, .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(127, 224, 199, 0.16), rgba(227, 179, 109, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 700;
  font-size: 14px;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.2;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 12px;
}

/* ---------- layout ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 18px;
  width: min(1400px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 32, 31, 0.9), rgba(15, 21, 20, 0.92));
  box-shadow: var(--shadow);
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-brand h2 {
  margin: 0;
  font-size: 1.1rem;
}

.session-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

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

.nav-btn {
  display: block;
  width: 100%;
  text-align: right;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 180ms, border-color 180ms, color 180ms;
}

.nav-btn:hover {
  background: rgba(127, 224, 199, 0.08);
  border-color: rgba(127, 224, 199, 0.18);
}

.nav-btn.is-active {
  background: rgba(127, 224, 199, 0.14);
  border-color: rgba(127, 224, 199, 0.22);
  color: var(--accent);
}

/* ---------- page head ---------- */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.page-head h2 {
  margin: 0;
  font-size: 1.5rem;
}

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

/* ---------- form ---------- */

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field span { color: var(--text); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 10, 10, 0.58);
  color: var(--text);
  min-height: 44px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms;
}

input::placeholder, textarea::placeholder {
  color: rgba(177, 187, 181, 0.6);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(127, 224, 199, 0.5);
  box-shadow: 0 0 0 3px rgba(127, 224, 199, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.75;
}

#release-editor {
  direction: ltr;
  text-align: left;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12.8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.full-width { grid-column: 1 / -1; }

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

button {
  border: 0;
  border-radius: 999px;
  min-height: 40px;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform 120ms, opacity 120ms, background 140ms;
}

button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #4cc4ab);
  color: #05120f;
  box-shadow: 0 8px 20px rgba(127, 224, 199, 0.18);
  font-weight: 700;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-btn:hover { background: rgba(255, 255, 255, 0.07); }
.ghost-btn.small { min-height: 32px; padding: 5px 12px; font-size: 12px; }

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

/* ---------- status text ---------- */

.status-text {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.status-text[data-tone="error"] { color: var(--danger); }
.status-text[data-tone="success"] { color: var(--accent); }

/* ---------- KPI grid ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow-soft);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.kpi-value.warn { color: var(--warn); }

/* ---------- moderation ---------- */

.filter-bar {
  display: flex;
  gap: 10px;
}

.filter-bar select { max-width: 200px; }
.news-review-filters input { max-width: 140px; }

.moderation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.content-list, .review-detail {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 32, 31, 0.9), rgba(15, 21, 20, 0.92));
  padding: 14px;
  min-height: 400px;
  max-height: 80vh;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  align-content: start;
}

.content-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 160ms, background 160ms;
}

.content-card:hover {
  border-color: rgba(127, 224, 199, 0.2);
  background: rgba(127, 224, 199, 0.04);
}

.card-top {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.content-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.snippet {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(127, 224, 199, 0.12);
  color: var(--accent);
  border: 1px solid rgba(127, 224, 199, 0.12);
}

.badge.warn {
  background: rgba(242, 196, 108, 0.12);
  color: var(--warn);
  border-color: rgba(242, 196, 108, 0.12);
}

.badge.danger {
  background: rgba(255, 137, 120, 0.12);
  color: var(--danger);
  border-color: rgba(255, 137, 120, 0.12);
}

.badge.soft {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.06);
}

/* ---------- review detail ---------- */

.review-header {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.review-detail h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.review-media {
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 12px;
}

.review-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
}

.review-body {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.review-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.review-actions {
  display: flex;
  gap: 10px;
}

/* ---------- release ---------- */

.release-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

/* ---------- empty ---------- */

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
}

/* ---------- mobile dock ---------- */

.mobile-dock { display: none; }

/* ---------- scrollbar ---------- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 999px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }

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

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .moderation-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { padding-bottom: 72px; }

  .auth-card, .sidebar, .content-list, .review-detail, .kpi-card {
    border-radius: 16px;
    padding: 14px;
  }

  .admin-shell {
    width: calc(100vw - 16px);
    padding: 10px 0 20px;
    gap: 10px;
  }

  .sidebar { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar select { max-width: 100%; }
  .release-upload { flex-direction: column; align-items: stretch; }

  .mobile-dock {
    display: grid;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 50;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(9, 13, 13, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .mobile-dock .nav-btn {
    min-height: 38px;
    padding: 8px 6px;
    font-size: 12px;
    text-align: center;
  }
}

/* ── CS Chat ── */
.cs-chat-header { padding: 12px 16px; border-bottom: 1px solid rgba(127,224,199,.15); }
.cs-chat-header h3 { margin: 0; color: var(--accent); font-size: 16px; }
.cs-chat-header small { color: rgba(255,255,255,.5); }
.cs-messages { max-height: 420px; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.cs-bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.cs-bubble-sent { align-self: flex-start; background: var(--accent); color: #0d1211; border-bottom-left-radius: 4px; }
.cs-bubble-received { align-self: flex-end; background: rgba(255,255,255,.1); color: #fff; border-bottom-right-radius: 4px; }
.cs-bubble-text { word-break: break-word; }
.cs-bubble-meta { font-size: 11px; margin-top: 4px; opacity: .6; }
.cs-reply-bar { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid rgba(127,224,199,.15); }
.cs-reply-bar input { flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(127,224,199,.2); border-radius: 10px; padding: 8px 14px; color: #fff; font-size: 14px; outline: none; }
.cs-reply-bar input:focus { border-color: var(--accent); }
.cs-reply-bar .primary-btn { min-width: 80px; }
.content-card.is-selected { border-color: var(--accent); background: rgba(127,224,199,.08); }

/* Telegram ops */
.telegram-ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.ops-list {
  display: grid;
  gap: 8px;
}

.ops-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.ops-row span {
  color: var(--muted);
  font-size: 12px;
}

.ops-row strong {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
}

.ops-issue-group {
  display: grid;
  gap: 8px;
}

.ops-issue-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--accent);
}

.ops-issue {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.ops-issue strong {
  font-size: 13px;
}

.ops-issue span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.ops-critical {
  border-color: rgba(255, 137, 120, 0.28);
  background: rgba(255, 137, 120, 0.08);
}

.ops-warning {
  border-color: rgba(242, 196, 108, 0.24);
  background: rgba(242, 196, 108, 0.07);
}

.telegram-audit-workbench {
  margin-top: 14px;
}

.telegram-audit-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 14px;
  align-items: end;
}

.telegram-audit-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 82px auto auto;
  gap: 8px;
}

.telegram-audit-filters input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.telegram-audit-filters input:focus {
  border-color: var(--accent);
}

.telegram-audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.telegram-profile {
  margin-top: 14px;
}

.telegram-profile:empty {
  display: none;
}

.telegram-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.telegram-profile-chats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.telegram-profile-chats .ops-issue {
  cursor: pointer;
}

.telegram-profile-chats .ops-issue:hover {
  border-color: var(--accent);
  background: rgba(127, 224, 199, 0.08);
}

.telegram-audit-grid h4 {
  color: var(--accent);
  margin: 0 0 8px;
}

.telegram-timeline,
.telegram-media-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-left: 4px;
}

.telegram-timeline-item,
.telegram-media-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.telegram-timeline-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.telegram-timeline-item header strong {
  color: var(--text);
  font-size: 14px;
}

.telegram-timeline-item header span,
.telegram-timeline-meta,
.telegram-message-row small,
.telegram-media-body span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.telegram-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.telegram-message-row {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.telegram-message-row.is-outgoing {
  background: rgba(127, 224, 199, 0.08);
}

.telegram-message-row b {
  font-size: 12px;
}

.telegram-message-row p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.telegram-media-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
}

.telegram-media-preview {
  min-height: 96px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.telegram-media-preview img,
.telegram-media-preview video {
  width: 100%;
  height: 100%;
  max-height: 150px;
  object-fit: cover;
}

.telegram-media-preview audio {
  width: 100%;
}

.telegram-media-body {
  display: grid;
  gap: 5px;
}

.telegram-media-body strong {
  color: var(--text);
  font-size: 14px;
}

.telegram-media-body a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

@media (max-width: 900px) {
  .telegram-ops-layout { grid-template-columns: 1fr; }
  .ops-row { grid-template-columns: 1fr; }
  .telegram-audit-head,
  .telegram-audit-grid,
  .telegram-profile-grid,
  .telegram-profile-chats,
  .telegram-media-card {
    grid-template-columns: 1fr;
  }
  .telegram-audit-filters {
    grid-template-columns: 1fr;
  }
}
