/* ============================================================
   ADMIN PANEL styles (extends style.css, theme-aware)
   ============================================================ */

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell { width: 100%; max-width: 420px; }
.login-topbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.login-card {
  width: 100%;
  padding: 44px 38px;
  text-align: center;
  animation: fadeUp 0.7s var(--ease) forwards;
}
.login-logo { width: 130px; margin: 0 auto 18px; padding: 6px 9px; background: var(--logo-plate); border-radius: 12px; }
.login-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }
.login-card .field { text-align: left; }
.login-note { min-height: 20px; font-size: 0.85rem; margin-top: 14px; }
.login-note.err { color: #c0392b; }
:root[data-theme="dark"] .login-note.err { color: #ff9b9b; }
.login-note.ok { color: #1a9d5a; }
:root[data-theme="dark"] .login-note.ok { color: #6ee7a8; }
.back-link { display: inline-block; margin-top: 18px; font-size: 0.85rem; color: var(--text-soft); }
.back-link:hover { color: var(--gold); }

/* ---------- Dashboard layout ---------- */
.dash { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; gap: 22px; padding: 22px; }

.dash-side {
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
}
.side-brand { display: flex; align-items: center; gap: 12px; }
.side-brand img { height: 46px; padding: 4px 6px; background: var(--logo-plate); border-radius: 9px; }
.side-brand strong { font-family: var(--font-head); font-size: 1.1rem; display: block; letter-spacing: 1px; color: var(--text-strong); }
.side-brand small { font-size: 0.68rem; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav a { padding: 12px 16px; border-radius: 12px; font-size: 0.92rem; color: var(--text-muted); transition: 0.25s; }
.side-nav a:hover, .side-nav a.active { background: var(--glass-bg-strong); color: var(--text-strong); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.admin-chip { font-size: 0.78rem; color: var(--text-muted); background: var(--glass-bg-strong); border: 1px solid var(--glass-border); padding: 10px 14px; border-radius: 12px; text-align: center; word-break: break-all; }

.dash-main { min-width: 0; padding-bottom: 30px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.dash-head h1 { font-size: 1.8rem; }
.dash-head p { color: var(--text-soft); font-size: 0.9rem; }
.dash-head-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Stats ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-tile { padding: 22px 24px; display: flex; align-items: center; gap: 16px; }
.stat-tile .st-ic { font-size: 1.8rem; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-light), var(--maroon)); }
.stat-tile strong { font-family: var(--font-head); font-size: 1.9rem; display: block; color: var(--gold); }
.stat-tile small { color: var(--text-muted); font-size: 0.82rem; }

/* ---------- Table ---------- */
.table-wrap { padding: 8px; }
.table-scroll { overflow-x: auto; border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  text-align: left; padding: 16px 18px; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 1px; color: var(--gold);
  border-bottom: 1px solid var(--glass-border); font-weight: 600;
}
tbody td { padding: 15px 18px; font-size: 0.9rem; border-bottom: 1px solid var(--divider); color: var(--on-glass); }
tbody tr { transition: background 0.2s; cursor: pointer; }
tbody tr:hover { background: var(--glass-bg); }
tbody tr.unread td:nth-child(2) { font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
td.empty { text-align: center; padding: 40px; color: var(--text-soft); cursor: default; }
tbody tr.empty-row:hover { background: none; }
.status-text { display: none; font-style: normal; }

.badge { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.badge.new { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.badge.read { background: rgba(127,127,127,0.4); }

.row-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 1px solid var(--glass-border); background: var(--glass-bg-strong);
  color: var(--text-strong); width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; font-size: 0.9rem; transition: 0.2s;
}
.icon-btn:hover { background: var(--maroon); color: #fff; }
.icon-btn.view:hover { background: var(--navy-light); color: #fff; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(8,12,26,0.7); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal { width: 100%; max-width: 560px; padding: 38px; position: relative; animation: fadeUp 0.4s var(--ease); }
.modal-close {
  position: absolute; top: 18px; right: 20px; background: none; border: none;
  color: var(--text-soft); font-size: 1.8rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text-strong); }
.modal h2 { font-size: 1.5rem; margin: 6px 0 22px; }
.modal-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.modal-meta small { display: block; font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }
.modal-meta span, .modal-meta a { font-size: 0.94rem; color: var(--on-glass); word-break: break-word; }
.modal-message { background: var(--input-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 18px; margin-bottom: 24px; }
.modal-message small { display: block; font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.modal-message p { font-size: 0.95rem; color: var(--on-glass); white-space: pre-wrap; line-height: 1.7; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
  .side-brand { flex: 1 1 auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; flex-direction: row; align-items: center; gap: 10px; }
  .stats-row { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 640px) {
  .dash { padding: 14px; gap: 16px; }
  .side-nav { display: none; }
  .side-foot { width: 100%; flex-direction: column; align-items: stretch; }
  .admin-chip { flex: none; width: 100%; word-break: break-word; }
  .stats-row { grid-template-columns: 1fr; }
  .modal { padding: 26px; }
  .modal-meta { grid-template-columns: 1fr; }

  /* table -> stacked cards */
  .table-wrap { background: transparent; border: none; box-shadow: none; padding: 0; }
  .table-scroll { overflow: visible; }
  table { min-width: 0; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 14px; margin-bottom: 14px; padding: 6px 4px;
    box-shadow: var(--glass-shadow);
  }
  tbody tr:last-child td { border-bottom: 1px solid var(--divider); }
  tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 10px 16px; border-bottom: 1px solid var(--divider); text-align: right;
  }
  tbody td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label); color: var(--gold); font-size: 0.68rem;
    text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
    flex: 0 0 auto; text-align: left;
  }
  .status-text { display: inline; }
  .row-actions { justify-content: flex-end; }
}
