/* ============================================================
   Admin workbench (stage #021) — moderation center, business
   dashboard, IT/Ops dashboard. Dark-gold theme consistent with
   the rest of the app.
   ============================================================ */

/* ---------- shared admin chrome ---------- */
.admin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---------- moderation ---------- */
.mod-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mod-shortcuts {
  margin-left: auto;
}
.mod-shortcuts kbd {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
}
.mod-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mod-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.mod-item.flagged {
  border-color: var(--danger, #c0392b);
  background: color-mix(in srgb, var(--surface) 85%, var(--danger, #c0392b));
}
.mod-item-main {
  min-width: 0;
  flex: 1;
}
.mod-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mod-item-title {
  font-weight: 700;
}
.mod-item-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}
.mod-item-flag {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger, #c0392b);
}
.mod-modal-title-text {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 2px;
}
.mod-warning {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--danger, #c0392b);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 70%, var(--danger, #c0392b));
  color: var(--txt);
}
.mod-warning svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--danger, #c0392b);
}
.mod-warning b {
  color: var(--danger, #c0392b);
}
.mod-warning p {
  margin-top: 4px;
  font-size: 13px;
}
.mod-clean {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
}
.mod-clean svg {
  width: 20px;
  height: 20px;
  color: var(--ok, #27ae60);
}
.mod-player {
  margin-top: 14px;
}
.mod-player video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: var(--r-md);
  margin-top: 10px;
}
.mod-decide {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.mod-override {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.mod-audit {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.mod-audit-title {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}
.mod-audit-row {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.mod-audit-msg {
  margin-top: 4px;
  font-size: 13px;
}
#mod-decide-err {
  margin-top: 12px;
}

/* ---------- business dashboard ---------- */
.am-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.am-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.am-chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
}
.am-chip.on {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.am-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.am-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.am-card-icon {
  color: var(--gold);
  width: 22px;
  height: 22px;
}
.am-card-icon svg {
  width: 22px;
  height: 22px;
}
.am-card-label {
  font-size: 13px;
  color: var(--muted);
}
.am-card-value {
  font-size: 26px;
  font-weight: 800;
}
.am-notes {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- IT/Ops dashboard ---------- */
.om-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.om-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.om-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.om-card h3 {
  margin-bottom: 8px;
}
.om-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.om-row:last-of-type {
  border-bottom: none;
}
.om-row b {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.om-row b.good {
  color: var(--ok, #27ae60);
}
.om-row b.bad {
  color: var(--danger, #c0392b);
}
.om-wide {
  grid-column: 1 / -1;
}
.om-queues {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.om-queue {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 8px);
}
.om-queue.hot {
  border-color: var(--danger, #c0392b);
}
.om-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.om-queue-cols {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.om-queue-cols b {
  color: var(--txt);
}

/* shell.css gives .sheet-backdrop display:flex, which overrides the
   [hidden] attribute — the moderation sheet must actually disappear */
.sheet-backdrop[hidden] {
  display: none !important;
}

/* ============================================================
   Stage #023 corrections — moderation sheet separation,
   admin shell, KPI hierarchy, ops emphasis
   ============================================================ */

/* sheet-backdrop display fix (kept from #022) */
.sheet-backdrop[hidden] {
  display: none !important;
}

/* Admin moderation sheet: SOLID elevated surface + stronger backdrop —
   the review decision must never visually merge with the queue behind
   it (§19-§20). No frosted glass. */
.admin-page .sheet-backdrop {
  background: rgba(0, 0, 0, 0.72);
}
.admin-page .sheet {
  background: #17120b; /* solid, opaque */
  border: 1px solid rgba(244, 176, 33, 0.18);
  border-top-left-radius: var(--r-lg, 20px);
  border-top-right-radius: var(--r-lg, 20px);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.65);
  max-height: 88dvh;
}
.admin-page .sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

/* Mobile moderation: queue as screen → detail as FULL-SCREEN sheet
   (§22) — one pane at a time, never two stacked panes */
@media (max-width: 767px) {
  .admin-page .sheet {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .admin-page .sheet-body {
    max-height: calc(100dvh - 64px);
  }
}

/* Moderation item + warning readability on small screens */
@media (max-width: 767px) {
  .mod-item {
    flex-direction: column;
    align-items: stretch;
  }
  .mod-item > .btn {
    align-self: flex-start;
  }
  .mod-warning {
    flex-direction: column;
  }
}

/* ------------------------------------------------------------
   Business dashboard KPI hierarchy (§23): primary row first and
   prominent, secondary metrics quieter, never 20 identical cards
   ------------------------------------------------------------ */
.am-grid-primary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.am-card.am-primary {
  border-color: rgba(244, 176, 33, 0.28);
}
.am-card.am-primary .am-card-value {
  font-size: 30px;
}
.am-grid-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.am-grid-secondary .am-card {
  padding: 12px 14px;
  opacity: 0.92;
}
.am-grid-secondary .am-card-value {
  font-size: 19px;
}
.am-group-label {
  display: block;
  margin: 16px 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------
   Ops dashboard emphasis (§24): alert states pop, grouping
   ------------------------------------------------------------ */
.om-queue.hot {
  background: rgba(248, 113, 113, 0.07);
  border-left: 3px solid var(--danger, #c0392b);
}
.om-queue.hot .om-queue-head b {
  color: var(--danger, #c0392b);
}
.om-row b.down {
  color: var(--danger, #c0392b);
  font-weight: 800;
}
.om-card.warn {
  border-color: rgba(248, 113, 113, 0.4);
}

/* ---------- admin submissions (full lifecycle view, 2026-09-15) ---------- */
.sub-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sub-select, .sub-search {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--txt); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; min-height: 44px; outline: none;
}
.sub-select { appearance: none; padding-right: 30px; }
.sub-search { flex: 1; min-width: 180px; }
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-item {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.02); padding: 12px 14px;
}
.sub-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub-title { font-weight: 700; font-size: 14px; }
.sub-meta { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.sub-meta code { color: var(--muted); font-size: 11px; }
.sub-expand {
  margin-left: auto; background: none; border: 1px solid var(--line);
  color: var(--muted); border-radius: 8px; width: 32px; height: 32px;
  cursor: pointer; font-size: 13px; flex: none;
}
.sub-detail { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.sub-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sub-detail-grid > div { display: flex; flex-direction: column; gap: 2px; }
.sub-detail-grid span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub-detail-grid b { font-size: 12.5px; font-weight: 600; }
.sub-assets { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 12.5px; }
.sub-assets th, .sub-assets td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.sub-assets th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.sub-flag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.sub-flag-red { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); color: var(--danger); }
.sub-flag-muted { background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--muted); }
.sub-empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 13.5px; }
.sub-more { margin-top: 12px; display: flex; justify-content: center; }

/* status chips (shared with other admin tables where useful) */
.chip { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; flex: none; }
.chip-gold { background: rgba(244, 176, 33, 0.12); border: 1px solid rgba(244, 176, 33, 0.5); color: var(--gold); }
.chip-green { background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.4); color: #4ade80; }
.chip-red { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.4); color: var(--danger); }
.chip-amber { background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.45); color: #fbbf24; }
.chip-muted { background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--muted); }
