/* ===========================================================
   Yoxa Masters — Админ-панель
   Палитра бренда: navy #0a1628, gold #f59e0b
   Плотный рабочий интерфейс для 2 администраторов — без лишних
   анимаций, фокус на скорость работы с данными.
=========================================================== */

:root {
  --navy: #0a1628;
  --navy-light: #14253f;
  --navy-lighter: #1d3354;
  --gold: #f59e0b;
  --gold-dark: #d6850a;
  --gold-soft: #fdf0db;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #16202e;
  --text-muted: #6b7585;
  --text-faint: #9aa3b2;

  --success: #1b8a5a;
  --success-soft: #e6f6ee;
  --danger: #c0392b;
  --danger-soft: #fbeae8;
  --warning: #b9770e;
  --warning-soft: #fdf2dd;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(10, 22, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(10, 22, 40, 0.08);

  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* ---------- Layout shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: #ffffff;
  padding: 0 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  display: inline-block;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.68);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
}

.nav-item .icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.75);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
}

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

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--navy);
}

.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ---------- Cards / surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

/* ---------- Stat tiles ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}

.stat-value .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.btn-primary {
  background: var(--navy);
  color: #ffffff;
}
.btn-primary:hover { background: var(--navy-light); }

.btn-gold {
  background: var(--gold);
  color: var(--navy);
}
.btn-gold:hover { background: var(--gold-dark); color: #ffffff; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--navy); }

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

.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td { background: rgba(10, 22, 40, 0.015); }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: #eef0f3; color: var(--text-muted); }
.badge-gold { background: var(--gold-soft); color: var(--gold-dark); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.hidden { display: none !important; }

/* ---------- Login page ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  background-image: radial-gradient(circle at 20% 20%, var(--navy-lighter), var(--navy) 60%);
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- Misc ---------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.gop-chip {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--gold-dark);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
}

.subject-row-disabled { opacity: 0.5; }

.chat-bubble {
  max-width: 70%;
  padding: 9px 13px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.4;
}

.chat-bubble.incoming {
  background: #eef0f3;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.chat-bubble.outgoing {
  background: var(--navy);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  margin-left: auto;
}

.chat-bubble.manual {
  background: var(--gold-soft);
  color: var(--gold-dark);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  margin-left: auto;
  border: 1px dashed var(--gold);
}

.chat-meta {
  font-size: 10.5px;
  opacity: 0.65;
  margin-top: 3px;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 420px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .sidebar { width: 76px; padding: 16px 8px; }
  .sidebar-logo span.label, .nav-item span.label { display: none; }
  .nav-item { justify-content: center; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
