/* ==========================================================================
   Riffzu Control Center
   Loaded after app.css. Denser, calmer and visually distinct from the member
   site, so an administrator always knows which surface they are on.
   ========================================================================== */

:root {
  --admin-rail: 248px;
  --admin-bar: 54px;
}

body.admin {
  background: var(--canvas);
  font-size: 14.5px;
}

/* ------------------------------------------------------------ admin bar -- */

.admin-bar {
  position: sticky; top: 0; z-index: 60;
  height: var(--admin-bar);
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
}
.admin-bar a { color: #fff; }
.admin-bar .admin-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 16px; letter-spacing: -0.01em; text-decoration: none;
}
.admin-bar .admin-brand .mark {
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--brand); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 800;
}
.admin-bar .env {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.9);
}
.admin-bar .spacer { flex: 1; }
.admin-bar .who { font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.admin-bar .who strong { color: #fff; font-weight: 600; }
.admin-bar .btn {
  background: rgba(255, 255, 255, 0.12); color: #fff; border-color: transparent;
  min-height: 32px; padding: 0 12px; font-size: 13px;
}
.admin-bar .btn:hover { background: rgba(255, 255, 255, 0.2); }

/* --------------------------------------------------------- admin shell -- */

.admin-shell {
  display: grid;
  grid-template-columns: var(--admin-rail) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

.admin-rail {
  position: sticky; top: calc(var(--admin-bar) + 18px);
  max-height: calc(100vh - var(--admin-bar) - 36px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px;
}

.admin-rail .group-label {
  padding: 12px 10px 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3);
}
.admin-rail a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none;
}
.admin-rail a:hover { background: var(--surface-2); text-decoration: none; }
.admin-rail a.is-current { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.admin-rail a .pill {
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: var(--radius-pill); background: var(--danger); color: #fff;
}

.admin-main { min-width: 0; display: grid; gap: 16px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 23px; margin: 0 0 3px; }
.page-head .lede { color: var(--ink-3); font-size: 14px; margin: 0; max-width: 68ch; }

.crumbs { display: flex; gap: 7px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-3); }
.crumbs span::before { content: '/'; margin-right: 7px; }

/* ------------------------------------------------------------- filters -- */

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.filters input[type='search'], .filters select { min-height: 36px; width: auto; min-width: 180px; }
.filters .result-count { margin-left: auto; font-size: 13px; color: var(--ink-3); }

/* Inline status control inside a table row. */
.row-form { display: flex; gap: 6px; align-items: center; }
.row-form select { min-height: 30px; padding: 3px 26px 3px 8px; font-size: 13px; min-width: 130px; }
.row-form .btn { min-height: 30px; padding: 0 10px; font-size: 12.5px; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: capitalize; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active, .status-published, .status-sent, .status-healthy, .status-resolved,
.status-visible, .status-fulfilled, .status-verified, .status-completed {
  background: var(--positive-soft); color: var(--positive);
}
.status-pending, .status-retry, .status-reviewing, .status-in_progress, .status-processing,
.status-waiting_customer, .status-warning, .status-scheduled, .status-approved, .status-shipped {
  background: var(--warning-soft); color: var(--warning);
}
.status-failed, .status-suspended, .status-disabled, .status-removed, .status-open,
.status-rejected, .status-critical, .status-hidden { background: var(--danger-soft); color: var(--danger); }

/* -------------------------------------------------------------- panels -- */

.panel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.kpi {
  padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.kpi .k-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-3);
}
.kpi .k-value {
  font-size: 27px; font-weight: 800; letter-spacing: -0.02em;
  margin-top: 3px; font-variant-numeric: tabular-nums;
}
.kpi .k-note { font-size: 12.5px; color: var(--ink-3); }
.kpi.needs-attention { border-color: var(--danger); background: var(--danger-soft); }
.kpi.needs-attention .k-value, .kpi.needs-attention .k-label { color: var(--danger); }

/* Bar chart drawn from real rows, no chart library needed. */
.spark {
  display: flex; align-items: flex-end; gap: 3px;
  height: 96px; padding: 12px 16px 0;
}
.spark .bar {
  flex: 1; min-height: 2px; border-radius: 2px 2px 0 0;
  background: var(--brand); opacity: 0.85;
}
.spark .bar:hover { opacity: 1; }
.spark-axis {
  display: flex; justify-content: space-between;
  padding: 6px 16px 12px; font-size: 11.5px; color: var(--ink-3);
}

.setting-row {
  display: grid; gap: 4px;
  padding: 15px 0; border-bottom: 1px solid var(--line-soft);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .s-label { font-weight: 650; font-size: 14.5px; }
.setting-row .s-help { font-size: 12.5px; color: var(--ink-3); max-width: 66ch; }
.setting-row .s-control { margin-top: 5px; max-width: 460px; }
.setting-row .s-secret-set {
  font-size: 12px; font-weight: 600; color: var(--positive);
  display: inline-flex; align-items: center; gap: 5px;
}

.sticky-actions {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px; margin-top: 4px;
  background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.sticky-actions .note { font-size: 12.5px; color: var(--ink-3); margin-left: auto; }

.perm-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.log-line {
  display: grid; gap: 2px; padding: 10px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.log-line:last-child { border-bottom: 0; }
.log-line .l-meta { font-size: 12px; color: var(--ink-3); }

.mono { font-family: var(--font-num); font-size: 12.5px; }

.ticket-msg { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.ticket-msg.from-admin { background: var(--brand-soft); }
.ticket-msg.is-internal { background: var(--warning-soft); border: 1px dashed var(--warning); }
.ticket-msg .t-who { font-weight: 650; font-size: 13.5px; }
.ticket-msg .t-body { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.asset-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.asset {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.asset .thumb {
  height: 96px; display: grid; place-items: center;
  background: var(--surface-2); padding: 10px;
}
.asset .thumb img { max-height: 100%; width: auto; object-fit: contain; }
.asset .a-meta { padding: 8px 10px; font-size: 12px; }
.asset .a-key { font-weight: 700; }
.asset .a-note { color: var(--ink-3); }

/* Admin login sits on its own dark page, distinct from member sign-in. */
.admin-auth {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px 16px; background: var(--ink);
}
.admin-auth .card { width: 100%; max-width: 400px; }
.admin-auth .lock-note {
  text-align: center; margin-top: 16px;
  font-size: 12.5px; color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 1000px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 56px; }
  .admin-rail { position: static; max-height: none; }
  .admin-rail .nav-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .admin-rail .group-label { display: none; }
  .admin-rail a { white-space: nowrap; }
}

@media (max-width: 720px) {
  .admin-bar .who { display: none; }
  .page-head h1 { font-size: 20px; }
  table.data th, table.data td { padding: 9px 10px; }
}
