/* =====================================================================
   KingTamil Chat - app.css
   Mobile-first, 3-column desktop, light + dark theme.
   ===================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Tamil",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- THEME TOKENS ---------- */
.theme-light, body:not(.theme-dark) {
  --bg: #f3f5f8;
  --bg-2: #ffffff;
  --bg-3: #e8ecf2;
  --fg: #1a1f2e;
  --fg-2: #5b6573;
  --muted: #8a93a3;
  --line: #e2e6ee;
  --accent: #1a73e8;
  --accent-2: #0f5fc7;
  --me-bubble: #d9eaff;
  --me-bubble-fg: #102a55;
  --bubble: #ffffff;
  --bubble-fg: #1a1f2e;
  --danger: #d93025;
  --ok: #1ea672;
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .06);
}
.theme-dark {
  --bg: #0f141c;
  --bg-2: #161e28;
  --bg-3: #1d2632;
  --fg: #e6ebf3;
  --fg-2: #b1bccd;
  --muted: #76808f;
  --line: #2a3543;
  --accent: #4a9bff;
  --accent-2: #2f7fe0;
  --me-bubble: #1f3960;
  --me-bubble-fg: #d8e6ff;
  --bubble: #1d2632;
  --bubble-fg: #e6ebf3;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

/* ---------- ANNOUNCEMENT ---------- */
.announcement {
  background: linear-gradient(90deg, #ffd166, #ffb84d);
  color: #2a1a00;
  padding: 8px 14px;
  font-weight: 600;
  text-align: center;
  font-size: 14px;
}

/* ---------- LAYOUT ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.layout > .info-panel[hidden] { display: none; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 300px 1fr; }
  .info-panel { display: none !important; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 50;
    width: 88vw; max-width: 360px;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex !important; }
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.brand {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, #1a73e8, #6d28d9);
  color: white; font-weight: 800;
  display: grid; place-items: center;
  font-size: 14px;
}
.brand-name { font-weight: 700; font-size: 16px; }

/* Logo image used in sidebar / login / public nav */
.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 56px;
  border-radius: 8px;
}
.auth-logo-wrap {
  text-align: center;
  margin: 0 0 12px;
}
.auth-logo {
  display: inline-block;
  max-width: 100%;
  height: auto;
  max-height: 90px;
  border-radius: 10px;
}
.nav-logo {
  display: inline-block;
  height: 36px;
  width: auto;
  vertical-align: middle;
}

.tabs {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--line);
}
.tab {
  background: transparent; border: 0;
  padding: 12px 8px;
  color: var(--fg-2);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; flex: 1; min-height: 0; overflow: auto; padding: 6px; }
.tab-panel.active { display: block; }

.search-row { padding: 8px; }
.search-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg);
  outline: none;
}

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 12px 12px 6px; font-weight: 700;
}

.list { display: flex; flex-direction: column; gap: 2px; }
.list-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px;
  border: 0; background: transparent;
  text-align: left; cursor: pointer;
  border-radius: 10px;
  color: var(--fg);
}
.list-item:hover { background: var(--bg-3); }
.list-item.active { background: var(--accent); color: white; }
.list-item.active .li-sub, .list-item.active .li-count { color: rgba(255,255,255,.85); }
.li-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-3); display: grid; place-items: center;
  font-weight: 700; color: var(--fg-2);
  overflow: hidden;
}
.li-icon img { width: 100%; height: 100%; object-fit: cover; }
.li-body { min-width: 0; display: grid; }
.li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub   { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-count {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-3); color: var(--fg-2);
  min-width: 20px; text-align: center;
}
.list-item.has-unread .li-count { background: var(--accent); color: white; }

/* ---------- ME BAR ---------- */
.me-bar {
  border-top: 1px solid var(--line);
  padding: 10px;
  background: var(--bg-2);
}
.me {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center; gap: 10px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #6d28d9);
  color: white; display: grid; place-items: center;
  font-weight: 700; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 80px; height: 80px; font-size: 28px; }
.me-info { min-width: 0; }
.me-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-status select {
  width: 100%; border: 0; background: transparent; color: var(--fg-2); font-size: 12px;
}
.me-actions {
  display: flex; align-items: center; gap: 4px;
}
.me-actions a, .me-actions button {
  background: transparent; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--fg-2); text-decoration: none;
  font-size: 16px;
}
.me-actions a:hover, .me-actions button:hover { background: var(--bg-3); color: var(--fg); }

/* ---------- MAIN ---------- */
.main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--bg);
}
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.hamburger {
  display: none; background: transparent; border: 0;
  font-size: 22px; cursor: pointer; color: var(--fg-2);
}
.chat-head-info { flex: 1; min-width: 0; }
.chat-head-title { font-weight: 700; }
.chat-head-sub   { font-size: 12px; color: var(--muted); }
.chat-head-actions button {
  background: transparent; border: 0; font-size: 18px; cursor: pointer; color: var(--fg-2);
  padding: 6px 10px; border-radius: 8px;
}
.chat-head-actions button:hover { background: var(--bg-3); }

/* ---------- MESSAGES ---------- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--bg);
  scroll-behavior: smooth;
}
.empty-state {
  text-align: center; color: var(--muted);
  padding: 60px 20px;
}
.empty-state h2 { color: var(--fg); margin-bottom: 8px; }

.day-divider {
  text-align: center;
  margin: 14px 0;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.day-divider span {
  background: var(--bg-2);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.msg {
  display: flex; gap: 8px;
  margin: 6px 0;
  animation: msgIn .18s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.msg.me { flex-direction: row-reverse; }
.msg .avatar.sm { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }

.bubble {
  max-width: min(78%, 600px);
  background: var(--bubble);
  color: var(--bubble-fg);
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  word-wrap: break-word;
  position: relative;
}
.msg.me .bubble {
  background: var(--me-bubble);
  color: var(--me-bubble-fg);
}
.bubble .who {
  font-size: 11px; font-weight: 700;
  margin-bottom: 2px;
  color: var(--accent);
}
.bubble .who.role-admin       { color: #d93025; }
.bubble .who.role-super_admin { color: #d93025; }
.bubble .who.role-moderator   { color: #f59e0b; }

.bubble .text { white-space: pre-wrap; word-break: break-word; }
.bubble .text a { color: var(--accent); }
.bubble .meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  display: flex; gap: 6px; align-items: center;
}
.msg.me .bubble .meta { justify-content: flex-end; }
.bubble .meta .ticks { font-size: 12px; }
.bubble .meta .ticks.read { color: var(--accent); }

.bubble.system {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  margin: 4px auto;
  max-width: 90%;
}
.msg.system { justify-content: center; }
.msg.system .avatar.sm { display: none; }

.bubble img.attachment {
  max-width: 280px; max-height: 280px;
  border-radius: 10px;
  display: block;
  margin: 4px 0;
  cursor: zoom-in;
}
.bubble .file-attach {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-3); padding: 8px 10px; border-radius: 10px;
  margin: 4px 0;
  text-decoration: none; color: var(--fg);
}
.bubble .file-attach .icon { font-size: 22px; }
.bubble .file-attach .info { display: grid; }
.bubble .file-attach .name { font-weight: 600; font-size: 13px; }
.bubble .file-attach .size { font-size: 11px; color: var(--muted); }

.bubble audio.voice { margin-top: 4px; max-width: 260px; display: block; }

.bubble .reply-quote {
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  margin-bottom: 4px;
  background: var(--bg-3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-2);
}
.mention {
  background: rgba(26,115,232,.12);
  color: var(--accent);
  padding: 0 4px; border-radius: 4px;
  font-weight: 600;
}
.sys { color: var(--muted); }
.muted { color: var(--muted); font-style: italic; }

.msg-actions {
  position: absolute; top: -10px; right: 8px;
  display: none; gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px;
  box-shadow: var(--shadow);
}
.bubble:hover .msg-actions { display: flex; }
.msg-actions button {
  background: transparent; border: 0;
  font-size: 14px; cursor: pointer;
  width: 26px; height: 26px;
  border-radius: 50%;
}
.msg-actions button:hover { background: var(--bg-3); }

/* ---------- TYPING BAR ---------- */
.typing-bar {
  height: 18px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- COMPOSER ---------- */
/* ----- WhatsApp-style composer ----- */
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: end;
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) 10px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  position: relative;
}
.composer.is-recording { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }

.btn-icon {
  background: transparent; border: 0;
  font-size: 22px; cursor: pointer;
  width: 44px; height: 44px;
  border-radius: 50%;
  color: var(--fg-2);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-3); color: var(--fg); }
.btn-icon.recording {
  color: white; background: var(--danger);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(217,48,37,.4); }
  50%     { box-shadow: 0 0 0 10px rgba(217,48,37,0); }
}

.composer-left {
  display: flex; align-items: end; gap: 2px;
}

.composer-input-wrap {
  background: var(--bg-3);
  border-radius: 22px;
  padding: 4px 12px;
  display: grid; gap: 4px;
  min-height: 44px;
  align-content: center;
}
.reply-preview {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-2);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 4px 0 0;
}
.reply-preview button {
  background: transparent; border: 0; cursor: pointer; color: var(--muted); font-size: 14px;
}
#composer-input {
  width: 100%;
  border: 0; outline: 0;
  background: transparent;
  color: var(--fg);
  resize: none;
  font-family: inherit;
  font-size: 16px;       /* 16px prevents iOS zoom-on-focus */
  line-height: 1.4;
  min-height: 28px;      /* one comfortable line */
  max-height: 120px;     /* ~5 lines max */
  padding: 8px 0;
  overflow-y: auto;
}
.btn-send {
  border: 0; cursor: pointer;
  background: var(--accent); color: white;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px; font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: transform .12s, background .12s;
}
.btn-send:hover:not(:disabled) { background: var(--accent-2); }
.btn-send:active:not(:disabled) { transform: scale(.94); }
.btn-send:disabled { opacity: .5; cursor: not-allowed; }

/* Recording status bar (replaces composer when recording) */
.recording-bar {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
}
.recording-bar .rec-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
  flex-shrink: 0;
}
@keyframes blink { 50% { opacity: .3; } }
.recording-bar .rec-time { font-weight: 600; min-width: 50px; font-variant-numeric: tabular-nums; }
.recording-bar .rec-label { color: var(--fg-2); font-size: 13px; flex: 1; }
.recording-bar button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer;
  display: grid; place-items: center;
  font-size: 20px;
}
.recording-bar .rec-cancel { background: var(--bg-3); color: var(--fg); }
.recording-bar .rec-send   { background: var(--accent); color: white; }

/* Voice playback preview (post-record, before send) */
.voice-preview {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
}
.voice-preview audio { flex: 1; max-width: 100%; }
.voice-preview .vp-cancel,
.voice-preview .vp-send {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; font-size: 20px;
}
.voice-preview .vp-cancel { background: var(--bg-3); color: var(--fg); }
.voice-preview .vp-send   { background: var(--accent); color: white; }


/* ---------- EMOJI PICKER ---------- */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 30;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-width: 280px;
}
.emoji {
  background: transparent; border: 0;
  font-size: 20px; cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
}
.emoji:hover { background: var(--bg-3); }

/* ---------- INFO PANEL ---------- */
.info-panel {
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
}
.info-panel h3 { margin-top: 0; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow);
  z-index: 100;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- AUTH PAGES ---------- */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1a73e8 0%, #6d28d9 100%);
  padding: 20px;
  overflow: auto;
}
.auth-card {
  background: var(--bg-2);
  width: 100%; max-width: 420px;
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-brand { margin: 0 0 4px; font-size: 26px; }
.auth-tag   { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.auth-tabs {
  display: flex; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.auth-tab {
  flex: 1; background: transparent; border: 0;
  padding: 12px 8px; cursor: pointer;
  color: var(--muted); font-weight: 700;
  border-bottom: 2px solid transparent;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-pane { display: none; }
.auth-pane.active { display: grid; gap: 12px; }
.auth-pane label {
  display: grid; gap: 4px; font-size: 13px; color: var(--fg-2);
}
.auth-pane input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px; outline: 0;
}
.auth-pane input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent); color: white;
  border: 0; padding: 12px;
  border-radius: 10px; font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent; border: 1px solid var(--line);
  padding: 10px; border-radius: 10px; cursor: pointer;
  color: var(--fg);
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: white; color: #1a1f2e;
  border: 1px solid #ddd;
  padding: 10px; border-radius: 10px;
  text-decoration: none; font-weight: 600;
}
.btn-google span {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #ea4335);
  color: white; display: grid; place-items: center; font-weight: 800;
}
.auth-msg {
  font-size: 13px; min-height: 18px;
  color: var(--danger);
}
.auth-msg.ok { color: var(--ok); }
.auth-foot {
  margin-top: 16px;
  font-size: 12px; color: var(--muted);
  text-align: center;
}
.auth-foot a { color: var(--muted); text-decoration: none; margin: 0 4px; }
.auth-foot a:hover { color: var(--accent); }

/* ---------- PAGE (profile, public) ---------- */
.page {
  background: var(--bg);
  min-height: 100vh; min-height: 100dvh;
  overflow: auto;
}
.page-head {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
}
.page-head .back { color: var(--accent); text-decoration: none; }
.page-head h1 { margin: 0; font-size: 18px; }
.page-body {
  max-width: 720px; margin: 24px auto; padding: 0 16px;
  display: grid; gap: 16px;
}
.card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card form { display: grid; gap: 8px; }
.card input[type="text"],
.card input[type="password"],
.card input[type="email"] {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font-size: 15px; outline: 0;
}
.card label { display: grid; gap: 4px; font-size: 13px; color: var(--fg-2); }
.avatar-row {
  display: grid; grid-template-columns: 80px 1fr; gap: 16px; align-items: center;
}
.kv { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.kv li {
  display: grid; grid-template-columns: 130px 1fr;
  border-bottom: 1px solid var(--line); padding: 6px 0;
  font-size: 14px;
}
.kv span { color: var(--muted); }
.msg { font-size: 13px; color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- PUBLIC SEO PAGES ---------- */
.public-page {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh; min-height: 100dvh;
  font-size: 16px; line-height: 1.6;
}
.public-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.public-nav .brand-link { font-weight: 700; }
.public-nav a { color: var(--fg-2); text-decoration: none; }
.public-nav a:hover { color: var(--accent); }
.public-main {
  max-width: 800px; margin: 30px auto; padding: 0 20px;
}
.public-main h1 { font-size: 28px; }
.public-main h2 { font-size: 20px; margin-top: 28px; }
.public-foot {
  margin-top: 40px; padding: 20px;
  text-align: center; color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

/* ---------- ADMIN ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh; min-height: 100dvh;
}
.admin-side {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 12px;
}
.admin-side h1 {
  font-size: 16px; padding: 8px 10px; margin: 0 0 8px;
  color: var(--accent);
}
.admin-side a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--fg);
  border-radius: 8px;
  margin: 2px 0;
}
.admin-side a:hover { background: var(--bg-3); }
.admin-side a.active { background: var(--accent); color: white; }
.admin-main { padding: 24px; overflow: auto; }
.admin-main h1 { margin-top: 0; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-2);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}
.data-table th { background: var(--bg-3); color: var(--fg-2); font-weight: 700; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .actions a, .data-table .actions button {
  margin-right: 6px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.data-table .actions .danger { color: var(--danger); border-color: var(--danger); }
@media (max-width: 700px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--line); }
}
