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

:root {
  --navy: #1C1C2E;
  --navy-dark: #0F0F1A;
  --navy-mid: #1A1A2E;
  --gold: #F0A500;
  --gold-hover: #D4900A;
  --green: #22C55E;
  --red: #EF4444;
  --yellow: #F59E0B;
  --blue: #3B82F6;
  --white: #FFFFFF;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-sec: #64748B;
  --text-light: #94A3B8;
  --sb-width: 240px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.16);
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Login ─────────────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-dark);
}
.login-box {
  width: 360px;
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 40px;
  border-radius: var(--radius);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.login-mark {
  width: 48px; height: 48px;
  background: var(--gold);
  color: var(--navy-dark);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  letter-spacing: 0.04em;
  font-family: var(--mono);
  flex-shrink: 0;
}
.login-name { color: var(--white); font-weight: 600; font-size: 15px; }
.login-sub { color: rgba(255,255,255,0.4); font-size: 12px; font-family: var(--mono); margin-top: 2px; }
.login-hint { color: rgba(255,255,255,0.25); font-size: 11px; font-family: var(--mono); margin-top: 24px; text-align: center; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-width);
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 50;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.sb-mark {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--navy-dark);
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  font-family: var(--mono); letter-spacing: 0.04em;
  flex-shrink: 0;
}
.sb-name { color: var(--white); font-weight: 600; font-size: 13px; }
.sb-sub { color: rgba(255,255,255,0.3); font-size: 10px; font-family: var(--mono); }

.sidebar-nav { flex: 1; padding: 4px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 5px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 150ms;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--gold); background: rgba(240,165,0,0.1); }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.sidebar-user { color: rgba(255,255,255,0.4); font-size: 12px; font-family: var(--mono); }

/* ── Main ──────────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sb-width);
  flex: 1;
  min-height: 100vh;
  padding: 32px;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 150ms;
  width: 100%;
  display: block;
}
.btn-primary:hover { background: var(--gold-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  font-family: var(--font);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 150ms;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--navy); color: var(--navy); }
.btn.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-dark); font-weight: 700; }
.btn.btn-gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.btn-red { background: var(--red); border-color: var(--red); color: white; }
.btn.btn-red:hover { background: #DC2626; border-color: #DC2626; }
.btn.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-logout {
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.4); padding: 5px 10px;
  font-size: 11px; font-family: var(--font); border-radius: 4px;
  cursor: pointer; transition: all 150ms;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 24px; }

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11px; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--mono); margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-value.gold { color: var(--gold); }
.stat-value.red { color: var(--red); }
.stat-value.green { color: var(--green); }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sec);
  background: #F8FAFC;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }
.td-actions { display: flex; gap: 8px; }
.cell-title { font-weight: 500; max-width: 320px; }
.cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text-sec); }
.cell-trunc { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Status badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  white-space: nowrap;
}
.badge-green { background: #DCFCE7; color: #166534; }
.badge-gray { background: #F1F5F9; color: #64748B; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-yellow { background: #FEF3C7; color: #92400E; }

/* ── Form fields ───────────────────────────────────────────────────────── */
.field-group { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 150ms;
  outline: none;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--navy);
}
.field-textarea { resize: vertical; min-height: 100px; }
.field-select { cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Login form fields (dark) */
#login-form .field-label { color: rgba(255,255,255,0.4); }
#login-form .field-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: white;
}
#login-form .field-input:focus { border-color: var(--gold); }

/* ── Locale tabs ───────────────────────────────────────────────────────── */
.locale-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.locale-tab {
  padding: 8px 16px;
  font-size: 12px; font-weight: 600;
  font-family: var(--mono);
  color: var(--text-sec);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 150ms;
  background: none; border-top: none; border-left: none; border-right: none;
}
.locale-tab:hover { color: var(--navy); }
.locale-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.locale-pane { display: none; }
.locale-pane.active { display: block; }

/* ── Toggle ────────────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; display: inline-block;
  width: 40px; height: 22px; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 200ms;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform 200ms;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--text); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: none; background: none;
  font-size: 20px; cursor: pointer;
  color: var(--text-sec); border-radius: 4px;
  transition: all 150ms;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #FAFBFC;
}

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toast-in 200ms ease;
}
.toast.success { background: #166534; color: white; }
.toast.error { background: var(--red); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px;
  color: var(--text-sec);
  text-align: center;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-size: 14px; }

/* ── Loader ────────────────────────────────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-sec);
}

/* ── Submission detail ─────────────────────────────────────────────────── */
.sub-detail-grid {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 4px 16px;
}
.sub-detail-key { font-size: 12px; color: var(--text-sec); padding: 6px 0; }
.sub-detail-val { font-size: 13px; color: var(--text); padding: 6px 0; word-break: break-word; }
.sub-message-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 4px;
  white-space: pre-wrap;
  grid-column: 1 / -1;
}

/* ── Recent activity ───────────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); flex-shrink: 0; margin-top: 5px;
}
.activity-dot.blue { background: var(--blue); }
.activity-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.activity-meta { font-size: 11px; color: var(--text-sec); font-family: var(--mono); }

/* ── Unread indicator ──────────────────────────────────────────────────── */
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); display: inline-block; flex-shrink: 0;
}

/* ── Error ─────────────────────────────────────────────────────────────── */
.error-msg { color: var(--red); font-size: 12px; margin-top: 10px; }

/* ── Section separator ─────────────────────────────────────────────────── */
.section-sep { height: 1px; background: var(--border); margin: 24px 0; }

/* ── Password change ───────────────────────────────────────────────────── */
.settings-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-sec);
  margin-bottom: 16px;
}

/* ── Sidebar user row ──────────────────────────────────────────────────────── */
.sb-user-row { display: flex; align-items: center; justify-content: space-between; }

/* ── Language switcher ─────────────────────────────────────────────────────── */
.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
  padding: 3px 9px;
  font-size: 10px; font-weight: 700; font-family: var(--mono);
  letter-spacing: 0.06em;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  background: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer; transition: all 150ms;
}
.lang-btn:hover { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.25); }
.lang-btn.active { color: var(--gold); border-color: var(--gold); background: rgba(240,165,0,0.1); }

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sec);
  font-size: 12px; font-weight: 500;
  font-family: var(--font);
  border-radius: 20px;
  cursor: pointer; transition: all 150ms;
}
.filter-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-btn.active { border-color: var(--navy); background: var(--navy); color: white; }
.filter-count {
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 10px;
  background: rgba(100,116,139,0.12); color: var(--text-sec);
}
.filter-btn.active .filter-count { background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); }

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-wrap { flex: 1; min-width: 200px; max-width: 320px; }
.search-input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px; font-family: var(--font);
  outline: none; background: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' fill='none' stroke='%2394A3B8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.search-input:focus { border-color: var(--navy); }

/* ── Char counter ──────────────────────────────────────────────────────────── */
.char-count {
  text-align: right; font-size: 10px;
  color: var(--text-light); margin-top: 3px;
  font-family: var(--mono);
}

/* ── Copy-from-RU button ───────────────────────────────────────────────────── */
.copy-ru-btn {
  color: var(--gold) !important;
  border-color: rgba(240,165,0,0.4) !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  margin-bottom: 14px;
  background: none !important;
}
.copy-ru-btn:hover { background: rgba(240,165,0,0.08) !important; }

/* ── Image preview ─────────────────────────────────────────────────────────── */
.img-preview-wrap {
  margin-top: 8px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  max-height: 130px; display: none;
}
.img-preview-wrap img {
  width: 100%; max-height: 130px; object-fit: cover; display: block;
}

/* ── Slug hint ─────────────────────────────────────────────────────────────── */
.slug-hint {
  font-size: 11px; color: var(--text-light);
  margin-top: 4px; font-family: var(--mono);
}
.slug-hint a { color: var(--gold); cursor: pointer; }
.slug-hint a:hover { text-decoration: underline; }

/* ── Custom confirm dialog ─────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: toast-in 150ms ease;
}
.confirm-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px 20px;
  width: 340px;
  box-shadow: var(--shadow-lg);
}
.confirm-icon { font-size: 28px; margin-bottom: 12px; }
.confirm-msg { font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 24px; }
.confirm-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Preview link in news form ─────────────────────────────────────────────── */
.preview-link {
  font-size: 11px; color: var(--gold);
  text-decoration: none; font-family: var(--mono);
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: auto;
}
.preview-link:hover { text-decoration: underline; }

/* ── Toast slide-out ───────────────────────────────────────────────────────── */
.toast.hide { animation: toast-out 200ms ease forwards; }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px); } }

/* ── Filter+search bar combined ────────────────────────────────────────────── */
.filter-search-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center;
}

/* ── Bulk actions bar ──────────────────────────────────────────────────────── */
.bulk-bar {
  display: flex; gap: 8px; align-items: center;
  margin-left: auto;
}

/* ── Locale tab hint ───────────────────────────────────────────────────────── */
.locale-tab-hint {
  margin-left: auto;
  font-size: 10px; color: rgba(100,116,139,0.7);
  font-family: var(--mono);
  align-self: flex-end; padding-bottom: 10px;
}

