/* admin.css — Operator (TBG) portal. Loaded after main.css. */
/* Visually identical to the tenant portal: reuses ALL main.css variables/classes.
   Only colors via existing CSS variables — no new color values introduced. */

/* Grouped sidebar section header (display only — not a link). */
.nav-group { padding: 14px 12px 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.nav-group:first-child { padding-top: 4px; }

/* PST import — upload progress, processing status, review table (existing tokens only). */
.pst-bar { height: 22px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.pst-bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.pst-pct { font-size: 26px; font-weight: 700; }
.pst-pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pstPulse 1.1s ease-in-out infinite; vertical-align: middle; margin-right: 8px; }
@keyframes pstPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.65); } }
.pst-stats { display: flex; gap: 28px; flex-wrap: wrap; margin: 12px 0 2px; }
.pst-stat .pst-stat-n { font-size: 24px; font-weight: 700; display: block; }
.pst-stat .pst-stat-l { color: var(--text-muted); font-size: 12px; }
.pst-card-ok { border-color: var(--green) !important; }
.pst-card-err { border-color: var(--red) !important; }
.pst-mini { padding: 3px 10px !important; font-size: 12px !important; border-radius: 6px !important; }
table.pst-table { table-layout: fixed; }
table.pst-table th, table.pst-table td { vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
table.pst-table tbody tr:nth-child(even) td { background: var(--bg-secondary); }
.pst-count { display: inline-block; min-width: 22px; text-align: center; padding: 2px 8px; border-radius: 999px; background: var(--bg-secondary); border: 1px solid var(--border); font-weight: 600; font-size: 12px; }
.pst-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Retrigger live progress: phase indicator + heartbeat log */
.pst-phases { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.pst-phase { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-secondary); white-space: nowrap; }
.pst-phase.done { color: var(--teal); border-color: var(--teal); }
.pst-phase.active { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pst-phase-arrow { color: var(--text-muted); font-size: 12px; }
.pst-beats { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 10px; }
.pst-beat { line-height: 1.7; }

.admin-banner {
  background: rgba(79,140,255,.12);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: var(--gap);
  color: var(--text-primary);
}
.stub-note { color: var(--text-muted); font-style: italic; }

/* Stat cards (admin standing rule: min-height 160, padding 18, radius 12). */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: var(--gap); }
.stat-card {
  min-height: 160px; padding: 18px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
}
.stat-card .metric { font-size: 30px; font-weight: 700; }

/* Slide-in detail panel (factories / rfqs). Uses only existing variables. */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; z-index: 40; }
.panel-overlay.open { display: block; }
.slide-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 92vw;
  background: var(--bg-secondary); border-left: 1px solid var(--border);
  padding: 24px; overflow-y: auto; transform: translateX(100%); transition: transform .2s ease; z-index: 50;
}
.slide-panel.open { transform: translateX(0); }
.panel-close { float: right; background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.panel-close:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Filter row */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row input, .filter-row select { max-width: 240px; }

/* Roadmap kanban */
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.board-col { flex: 0 0 240px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.board-col h4 { margin: 4px 6px 8px; display: flex; justify-content: space-between; }
.rm-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: grab; }
.rm-card:hover { border-color: var(--accent); }
.rm-card .pill { font-size: 11px; padding: 1px 8px; }
.col-drop.dragover { outline: 1px dashed var(--accent); border-radius: 8px; }
.add-input { margin-top: 6px; font-size: 13px; }

/* Competitive matrix */
.matrix-cell { text-align: center; cursor: pointer; font-size: 16px; user-select: none; }
.matrix-cell.mkii { background: rgba(79,140,255,.16); }
.matrix-cell.no { color: var(--text-muted); }
.logic-gotcha { border-left: 3px solid var(--yellow); }

/* Embedded admin page inside a Settings tab */
.embed-frame { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); }

/* Dashboard taxonomy log — compact scrollable widget (title stays fixed above) */
#taxonomy { max-height: 200px; overflow-y: auto; }
#taxonomy table th { position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
#taxonomy th, #taxonomy td { padding: 4px 10px; }

/* PST live worker log — dark terminal-style box, monospace green, auto-scrolled by the JS */
.pst-log {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
  background: #0a0e14;
  border: 1px solid #1b2430;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #3ddc84;
}
.pst-log-line { white-space: pre-wrap; word-break: break-word; }

/* --- Milestone tracker --- */
.m-pill-row { display: flex; gap: 12px; flex-wrap: wrap; }
.m-pill { flex: 1; min-width: 130px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.m-pill .metric-label { font-size: 13px; }
.m-pill .metric { font-size: 24px; font-weight: 700; }
.m-progress { height: 8px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.m-progress-fill { height: 100%; background: var(--accent); transition: width .25s ease; }
.m-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .m-grid { grid-template-columns: 1fr; } }
.m-col { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.m-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.m-col-head h3 { margin: 0; font-size: 15px; }
.m-tier { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 12px 0 4px; }
.m-feature { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border-left: 3px solid transparent; }
.m-feature:hover { background: var(--bg-secondary); }
.m-feature.critical { border-left-color: #f39c12; }
.m-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.m-feature-title { font-size: 13px; }

/* ── Sub-module card grid: global standard ── */
.sub-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 10px;
  margin: 12px 0 1.25rem;
}
.swg-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 1rem !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  min-height: unset !important;
  height: auto !important;
}
.swg-card:hover { border-color: var(--text-muted); }
.swg-card.active { border-color: var(--accent); }
.swg-icon {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 9px !important;
  background: #0B0F1A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px !important;
  flex-shrink: 0;
}
.swg-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--text);
  margin: 4px 0 0;
  line-height: 1.3;
}
.swg-sub {
  font-size: 11px !important;
  color: var(--text-muted);
  margin: 0;
}
/* Hide big stat number on ALL swg cards */
.swg-stat { display: none !important; }

/* swg-card urgency borders + glow (green/yellow/red) */
.swg-card.status-ok      { border-color: #2ecc71 !important; box-shadow: 0 0 0 1px #2ecc71, 0 0 10px rgba(46,204,113,.30) !important; }
.swg-card.status-soon    { border-color: #f1c40f !important; box-shadow: 0 0 0 1px #f1c40f, 0 0 12px rgba(241,196,15,.40) !important; }
.swg-card.status-due     { border-color: #e74c3c !important; box-shadow: 0 0 0 1px #e74c3c, 0 0 14px rgba(231,76,60,.45) !important; }
.swg-card.status-overdue { border-color: #e74c3c !important; animation: pulse-red 1.2s ease-in-out infinite; }

/* .card elements inside sub-widget-grid — match swg-card sizing */
.sub-widget-grid .card {
  padding: 1rem;
  border-radius: 12px;
  border: 1.5px solid #2a2f3e;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.2s;
  text-decoration: none;
  background: #0d1117;
  min-height: unset;
}
.sub-widget-grid .card:hover { border-color: #6b7280; }
.sub-widget-grid .card.active { border-color: #7c3aed; }

/* urgency borders for .card variants inside sub-widget-grid */
.sub-widget-grid .card.status-ok       { border-color: #2ecc71 !important; }
.sub-widget-grid .card.status-soon     { border-color: #f1c40f !important; }
.sub-widget-grid .card.status-due      { border-color: #e74c3c !important; }
.sub-widget-grid .card.status-overdue  { border-color: #e74c3c !important; animation: pulse-red 1.2s ease-in-out infinite; }

/* dcard urgency borders */
.dcard { border: 1px solid var(--border); transition: border-color 0.2s, box-shadow 0.2s; }
.dcard.status-ok      { border-color: #2ecc71 !important; }
.dcard.status-soon    { border-color: #f1c40f !important; }
.dcard.status-due     { border-color: #e74c3c !important; }
.dcard.status-overdue { border-color: #e74c3c !important; animation: pulse-red 1.2s ease-in-out infinite; }

@keyframes pulse-red {
  0%, 100% { border-color: #e74c3c; box-shadow: 0 0 0 0 rgba(231,76,60,0); }
  50%       { border-color: #ff6b6b; box-shadow: 0 0 0 4px rgba(231,76,60,0.15); }
}
