/* ============================================================================
   UTC NEXT — ADMIN  ·  admin.css
   Dark broadcast aesthetic (SPEC 16.6): bg #101418, sidebar #171d23, cards
   #1a2026, border #313c46, accent #2fa6ff, IBM Plex Sans Thai, 8px radius,
   120ms transitions, responsive down to tablet. One file, sectioned.
   ========================================================================== */

/* ---- 1. Tokens & reset --------------------------------------------------- */

:root {
  --bg: #101418;
  --bg-deep: #0b0f13;
  --sidebar: #171d23;
  --surface: #1a2026;
  --surface2: #232b33;
  --border: #313c46;
  --border-soft: #27313a;
  --text: #e8edf2;
  --text-dim: #93a1ad;
  --text-faint: #64717d;
  --accent: #2fa6ff;
  --accent-soft: rgba(47, 166, 255, 0.13);
  --accent-glow: rgba(47, 166, 255, 0.28);
  --good: #37ad5f;
  --warn: #e0a63c;
  --bad: #e0483c;
  --bad-soft: rgba(224, 72, 60, 0.14);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 28px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 12px 44px rgba(0, 0, 0, 0.55);
  --font: 'IBM Plex Sans Thai', 'Segoe UI Variable', 'Segoe UI', 'Noto Sans Thai', sans-serif;
  --t: 120ms ease;
  --sidebar-w: 248px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 520px at 78% -140px, rgba(47, 166, 255, 0.07), transparent 62%),
    radial-gradient(800px 500px at -140px 108%, rgba(47, 166, 255, 0.04), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-glow); }

h1, h2, h3, p { margin: 0; }

button, input, select {
  font: inherit;
  color: inherit;
}

a { color: var(--accent); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Slim dark scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

.app-root { height: 100%; }

/* ---- 2. Boot splash ------------------------------------------------------- */

.boot-splash {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  animation: fadeIn 300ms ease;
}

.boot-mark {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.boot-sub {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5em;
  padding-left: 0.5em; /* optically center the tracked-out text */
  color: var(--accent);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- 3. Wordmark ---------------------------------------------------------- */

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.wordmark-main {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.wordmark-main b { font-weight: 700; }

.wordmark-admin {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--accent);
  border: 1px solid var(--accent-glow);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 5px 1px 7px;
  transform: translateY(-1px);
}

.badge-mock {
  background: rgba(224, 166, 60, 0.14);
  border: 1px solid rgba(224, 166, 60, 0.45);
  color: var(--warn);
  letter-spacing: 0.18em;
  font-size: 9.5px;
}

/* ---- 4. Buttons / badges / fields ----------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), transform var(--t), opacity var(--t);
  user-select: none;
}

.btn:hover { border-color: #46545f; background: #2a333c; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #3badff, #1f8ee6);
  border-color: rgba(47, 166, 255, 0.7);
  color: #06121c;
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #55b9ff, #2b9bf2);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 166, 255, 0.25), 0 4px 18px rgba(47, 166, 255, 0.28);
}

.btn-danger {
  background: linear-gradient(180deg, #e35a4f, #c93a2f);
  border-color: rgba(224, 72, 60, 0.7);
  color: #fff;
  font-weight: 600;
}

.btn-danger:hover {
  box-shadow: 0 0 0 1px rgba(224, 72, 60, 0.3), 0 4px 18px rgba(224, 72, 60, 0.3);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

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

.btn-block { width: 100%; }

/* Sign-in submit: give it real height so the label isn't cramped against the
   edges and it balances the taller inputs above it. */
.signin-form .btn-block {
  padding: 13px 18px;
  min-height: 48px;
  font-size: 15px;
  margin-top: 4px;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius);
  line-height: 0;
}

.btn-icon svg { width: 18px; height: 18px; }

.btn-del:hover { color: var(--bad); background: var(--bad-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.badge-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-glow);
}

.badge-you {
  margin-left: 7px;
  font-size: 10px;
  padding: 1px 7px;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-glow);
}

.field { display: block; }

.field + .field { margin-top: 14px; }

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  transition: border-color var(--t), box-shadow var(--t);
}

.field-input::placeholder { color: var(--text-faint); }

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  margin-top: 14px;
  font-size: 13px;
  color: #ff8d84;
  background: var(--bad-soft);
  border: 1px solid rgba(224, 72, 60, 0.4);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.form-error[hidden] { display: none; }

/* ---- 5. Sign-in / gate screens -------------------------------------------- */

.signin-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, #1c232a, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 36px 36px 32px;
  animation: cardIn 260ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.signin-card-slim {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 44px 36px;
}

.signin-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.signin-logo-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow);
  border-radius: 14px;
  box-shadow: 0 0 24px var(--accent-glow);
}

.signin-logo-mark svg { width: 27px; height: 27px; }
.signin-logo-img {
  width: auto;
  max-width: 260px;
  height: auto;
  max-height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.45));
}

.signin-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 6px 0 22px;
}

.google-area { margin-bottom: 4px; }

.google-box {
  min-height: 44px;
  display: flex;
  justify-content: center;
}

.google-fail {
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
  padding: 8px 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 12px;
  margin: 16px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* denied */

.denied-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.denied-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--warn);
  background: rgba(224, 166, 60, 0.12);
  border: 1px solid rgba(224, 166, 60, 0.4);
  border-radius: 14px;
}

.denied-icon svg { width: 28px; height: 28px; }

.denied-title { font-size: 19px; font-weight: 600; }

.denied-msg { color: var(--text-dim); font-size: 13.5px; max-width: 30em; }

.denied-user {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  margin-top: 2px;
}

.denied-mail { font-size: 13px; color: var(--text-dim); }

.denied-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---- 6. App shell ---------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  animation: fadeIn 200ms ease;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.side-nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  transition: background var(--t), color var(--t), border-color var(--t);
}

.nav-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.nav-link.active {
  color: var(--text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.nav-link.active .nav-icon { color: var(--accent); }

.nav-icon { line-height: 0; color: var(--text-faint); transition: color var(--t); }

.nav-icon svg { width: 20px; height: 20px; }

.sidebar-foot {
  border-top: 1px solid var(--border-soft);
  padding: 14px 12px;
}

.me-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 9px 10px;
}

.me-text { flex: 1; min-width: 0; }

.me-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-mail {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(16, 20, 24, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 17px; font-weight: 600; letter-spacing: 0.01em; }

.content {
  padding: 26px 28px 60px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.view-enter { animation: viewIn 180ms ease; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---- 7. Stat tiles --------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, #1d242b, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}

.stat-tile:hover {
  border-color: #40505d;
  transform: translateY(-1px);
}

.tile-icon {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow);
  border-radius: 12px;
  box-shadow: 0 0 20px var(--accent-glow), inset 0 0 12px rgba(47, 166, 255, 0.08);
}

.tile-icon svg { width: 23px; height: 23px; }

.tile-alt .tile-icon {
  color: #6ec1ff;
  box-shadow: 0 0 16px rgba(47, 166, 255, 0.18), inset 0 0 12px rgba(47, 166, 255, 0.06);
}

.tile-text { min-width: 0; }

.tile-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  transition: color var(--t);
}

.stat-tile:not(.loaded) .tile-value { color: var(--text-faint); }

.tile-error .tile-value { color: var(--text-faint); }

.tile-label {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- 8. Cards & tables ----------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card + .card { margin-top: 22px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.view-count { font-size: 12.5px; font-weight: 500; color: var(--text-faint); }

.card-tools { display: flex; align-items: center; gap: 10px; }

.card-body { min-height: 120px; }

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

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(11, 15, 19, 0.5);
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--t); }

.table tbody tr:hover { background: rgba(47, 166, 255, 0.045); }

.table tbody tr:last-child td { border-bottom: none; }

.cell-dim { color: var(--text-dim); font-size: 13px; white-space: nowrap; }

.cell-right { text-align: right; white-space: nowrap; }

.row-disabled .user-cell { opacity: 0.55; }

.row-busy { opacity: 0.45; pointer-events: none; }

/* groups drill-down */

.row-group { cursor: pointer; }

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

.group-name { font-weight: 600; }

.btn-chevron svg { transition: transform var(--t); }

.row-open .btn-chevron svg { transform: rotate(90deg); }

.row-open td { border-bottom-color: transparent; }

.row-detail { background: rgba(11, 15, 19, 0.45); }

.row-detail:hover { background: rgba(11, 15, 19, 0.45) !important; }

.row-detail > td { padding: 6px 16px 14px 44px; }

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px 10px 4px 5px;
}

.member-mail { font-size: 12.5px; }

/* ---- 9. User cell / avatar / switch / selects ------------------------------ */

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  user-select: none;
  overflow: hidden;
}
.avatar.avatar-photo { background: var(--surface3, #232b33); }
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }

.user-cell-text { min-width: 0; }

.user-cell-mail {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.user-cell-verify { margin-top: 3px; }
.user-cell-verify .badge { font-size: 10.5px; padding: 1px 7px; }
.badge-ic { display: inline-flex; width: 11px; height: 11px; }
.badge-ic svg { width: 100%; height: 100%; }
.badge-verified {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
  border-color: color-mix(in srgb, var(--good) 40%, transparent);
}
.badge-unverified {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

.user-cell-name {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}

.role-select:hover:not(:disabled) { border-color: #46545f; }

.role-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.role-select:disabled { opacity: 0.5; cursor: default; }

.role-select option { background: var(--surface); }

/* toggle switch (ใช้งาน/ระงับ) */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: var(--good);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  transition: background var(--t);
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: left var(--t);
}

.switch.off .switch-track { background: var(--bad); }

.switch.off .switch-track::after { left: 2px; }

.switch input:focus-visible ~ .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch input:disabled ~ .switch-track { opacity: 0.45; }

.switch input:disabled ~ .switch-text { opacity: 0.45; }

.switch-text { font-size: 12.5px; color: var(--text-dim); min-width: 40px; }

.switch.off .switch-text { color: #ff9a92; }

/* search */

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  transition: border-color var(--t), box-shadow var(--t);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon { line-height: 0; color: var(--text-faint); }

.search-icon svg { width: 16px; height: 16px; }

.search-input {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 0;
  width: 220px;
}

.search-input:focus { outline: none; }

.search-input::placeholder { color: var(--text-faint); }

/* ---- 10. Dialogs (styled — never native) ----------------------------------- */

.dlg-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 14, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 140ms ease;
}

.dlg-overlay.open { opacity: 1; }

.dlg {
  width: 100%;
  max-width: 430px;
  background: linear-gradient(180deg, #1e252c, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 24px 24px 20px;
  transform: translateY(8px) scale(0.97);
  transition: transform 140ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.dlg-overlay.open .dlg { transform: none; }

.dlg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dlg-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow);
}

.dlg-danger .dlg-icon {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: rgba(224, 72, 60, 0.4);
}

.dlg-icon svg { width: 20px; height: 20px; }

.dlg-title { font-size: 16.5px; font-weight: 600; }

.dlg-body {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 20px;
  overflow-wrap: break-word;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- 11. Toasts (bottom-right) --------------------------------------------- */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #212931, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 11px 16px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toast.show { opacity: 1; transform: none; }

.toast-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.toast-success .toast-dot { background: var(--good); box-shadow: 0 0 10px rgba(55, 173, 95, 0.4); }

.toast-error .toast-dot { background: var(--bad); box-shadow: 0 0 10px rgba(224, 72, 60, 0.45); }

.toast-msg { font-size: 13.5px; }

/* ---- 12. Spinner / empty state ---------------------------------------------- */

.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 44px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
}

.spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 46px 20px;
  color: var(--text-faint);
}

.empty-icon { line-height: 0; opacity: 0.7; }

.empty-icon svg { width: 34px; height: 34px; }

.empty-msg { font-size: 13.5px; color: var(--text-dim); }

/* ---- 13. Responsive (down to tablet) ---------------------------------------- */

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 940px) {
  :root { --sidebar-w: 76px; }

  .sidebar-brand { padding: 20px 10px 16px; display: flex; justify-content: center; }

  .wordmark { flex-direction: column; align-items: center; gap: 4px; }

  .sidebar .wordmark-main { font-size: 12px; letter-spacing: 0.04em; }

  .sidebar .wordmark-admin { letter-spacing: 0.14em; padding: 1px 4px; }

  .sidebar .badge-mock { display: none; }

  .nav-link { justify-content: center; padding: 12px 8px; border-left-width: 0; border-radius: var(--radius); }

  .nav-link .nav-label { display: none; }

  .nav-link.active { box-shadow: inset 0 0 0 1px var(--accent-glow); }

  .me-card { flex-direction: column; padding: 10px 6px; gap: 8px; }

  .me-text { display: none; }

  .content { padding: 20px 18px 48px; }

  .topbar { padding: 0 18px; }
}

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: 1fr; }

  .card-head { flex-wrap: wrap; }

  .search-input { width: 150px; }

  .toast-host { left: 20px; align-items: stretch; }

  .toast { max-width: none; }
}

/* ---- User compositions: download panel (Feature A) ------------------------ */
.btn-sm {
  padding: 5px 11px;
  font-size: 13px;
  gap: 5px;
}
.btn-ic { display: inline-flex; line-height: 0; }
.btn-ic svg { width: 15px; height: 15px; }

.cell-comps { white-space: nowrap; }
.comps-toggle .comps-chevron { display: inline-flex; line-height: 0; transition: transform var(--t); }
.comps-toggle .comps-chevron svg { width: 14px; height: 14px; }
.comps-toggle.open { color: var(--text); background: var(--surface2); }
.comps-toggle.open .comps-chevron { transform: rotate(90deg); }

.comps-detail-row > td { padding: 0; background: var(--bg-deep); }
.comps-panel {
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.comps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.comps-count { color: var(--text-dim); font-size: 13px; font-weight: 500; }
.comps-list { display: flex; flex-direction: column; gap: 6px; }
.comps-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
.comps-name { font-weight: 500; flex: 1 1 auto; overflow-wrap: anywhere; }
.comps-date { flex: 0 0 auto; font-size: 12.5px; }
