/* ==========================================================================
   Aura Command Center — SPA view styles
   Page-specific CSS for home / scorecard / legend / spend views, plus the
   inline view-panel transition used by assets/app.js.
   CAP-ID: OPS-CC-SPA-001
   ========================================================================== */

/* ---------- SPA view panel swap ---------- */
.view-panel {
  animation: none;
}
.view-panel.view-enter {
  animation: cc-view-enter 0.22s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes cc-view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view-panel.view-enter { animation: none !important; }
}

/* ==========================================================================
   Home view
   ========================================================================== */
.hero-sub { max-width: 46rem; }
.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}
.hub-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.hub-card:active { transform: translateY(-1px); }
.hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.hub-head h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.hub-go {
  color: var(--blue);
  font-size: 0.8rem;
  white-space: nowrap;
  transition: transform 0.16s ease, color 0.16s ease;
}
.hub-card:hover .hub-go { transform: translateX(3px); color: var(--cyan); }
.hub-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
}
.stat .v {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.stat .v.sm { font-size: 0.98rem; }
.stat .k {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}
.mini-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.15rem; }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.83rem;
  padding: 0.32rem 0.55rem;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mini-row .nm { font-weight: 600; text-transform: capitalize; }
.mini-row .vl { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mini-row .sub { color: var(--muted); font-size: 0.72rem; font-weight: 400; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.9rem;
  align-items: start;
}
.divider-note {
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: auto;
}

/* ==========================================================================
   Scorecard view
   ========================================================================== */
.heatmap-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: min(70vh, 640px);
}
.heatmap {
  border-collapse: separate;
  border-spacing: 0;
  min-width: max-content;
  font-size: 0.78rem;
}
.heatmap th, .heatmap td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  min-width: 3.1rem;
  white-space: nowrap;
}
.heatmap th { background: var(--surface-3); position: sticky; top: 0; z-index: 2; }
.heatmap th.corner { left: 0; z-index: 4; text-align: left; min-width: 8.5rem; }
.heatmap td.rowhead, .heatmap th.rowhead {
  position: sticky;
  left: 0;
  z-index: 3;
  text-align: left;
  background: var(--surface-1);
  font-weight: 600;
  min-width: 8.5rem;
}
.heatmap tbody tr:hover td.rowhead { background: var(--surface-2); }
.heatmap tbody tr:hover td { background: none; }
.heatmap td.cell { font-family: var(--mono); font-size: 0.72rem; }
.heatmap td.total, .heatmap th.total { font-weight: 700; background: var(--surface-2); }
.heatmap tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--surface-3);
  font-weight: 700;
  z-index: 2;
}
.heatmap tfoot td.rowhead { z-index: 5; background: var(--surface-3); }

.heatmap th.day-head {
  position: relative;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  vertical-align: bottom;
}
.heatmap th.day-head.has-change {
  box-shadow: inset 0 -2px 0 var(--cyan);
}
.chg-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0 auto 0.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: var(--on-accent);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--glow-soft);
}
.chg-tick:hover, .chg-tick:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: var(--glow-accent);
}
.heatmap td.cell.has-change { position: relative; }
.heatmap td.cell.has-change::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--surface-1);
}
.exclusion-star {
  color: var(--amber, #f59e0b);
  font-weight: 700;
  margin-left: 2px;
  cursor: help;
}
.heatmap td.cell.excluded-day { outline: 1px dashed var(--amber, #f59e0b); outline-offset: -1px; }
.chg-popover {
  position: fixed;
  z-index: 40;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-hi);
  background: var(--scrim-pop);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
}
.chg-popover[hidden] { display: none !important; }
.chg-popover .chg-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  margin-bottom: 0.2rem;
}
.chg-popover h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.chg-popover p { margin: 0 0 0.45rem; color: var(--muted); }
.chg-popover .chg-strats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.35rem 0 0.5rem;
}
.chg-popover .chg-strat {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
}
.chg-popover .chg-caps {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.chg-popover .chg-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.chg-popover a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.78rem;
}
.chg-popover a:hover { text-decoration: underline; }
.chg-popover .chg-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}
.chg-list {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.45rem;
}
.chg-list-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.chg-list-item:hover { border-color: var(--border-hi); background: var(--surface-2); }
.chg-list-item .dot-mark {
  flex: 0 0 auto;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: var(--glow-soft);
}
.chg-list-item .body { min-width: 0; }
.chg-list-item .when {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--cyan);
}
.chg-list-item .ttl {
  font-weight: 600;
  font-size: 0.86rem;
}
.chg-list-item .sum {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

/* ==========================================================================
   Legend view
   ========================================================================== */
.filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.legend-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.codename {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow-wrap: anywhere;
}
.oneline {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.how {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.how.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta-line {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.meta-line b { color: var(--text); font-weight: 600; }
.meta-line code {
  font-size: 0.72rem;
  color: var(--cyan);
  word-break: break-all;
}
.alias-note {
  font-size: 0.72rem;
  color: var(--amber);
  font-style: italic;
}
.params-toggle,
.how-toggle {
  cursor: pointer;
  color: var(--blue);
  font-size: 0.78rem;
  user-select: none;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  text-align: left;
  width: fit-content;
}
.params-toggle:hover,
.how-toggle:hover { text-decoration: underline; }
.params {
  display: none;
  margin-top: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
}
.params.open { display: block; }
.params table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  table-layout: fixed;
}
.params td {
  padding: 0.28rem 0.5rem !important;
  border-bottom: 1px solid var(--border) !important;
  vertical-align: top;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
.params tr:last-child td { border-bottom: 0 !important; }
.params td:first-child {
  width: 42%;
  color: var(--muted);
  font-weight: 600;
}
.params td:last-child {
  width: 58%;
  text-align: right;
  font-family: var(--mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.params tbody tr:hover td { background: var(--surface-hover); }
.empty {
  color: var(--muted);
  padding: 2rem 0.5rem;
  text-align: center;
}
@media (max-width: 640px) {
  .grid-wide { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Spend view
   ========================================================================== */
.basis { display: flex; gap: 0.4rem; margin: 0 0 1rem; flex-wrap: wrap; }
.prov {
  font-size: 0.65rem;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.section table td, .section table th { white-space: nowrap; }
.section table td.wrap-ok { white-space: normal; }
.delta-pos { color: var(--amber); }
.section code {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

/* ==========================================================================
   Benefits view — CAP-ID: OPS-CC-BENEFITS-001
   ========================================================================== */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-open, .chip-used {
  font-size: 0.72rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip-open { background: var(--surface-2); color: var(--text); }
.chip-used { background: var(--surface-sunken); color: var(--muted); text-decoration: line-through; }
.sub-card { padding: 0.9rem 1rem; }
.sub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: 0.85rem; }
.sub-nums { font-size: 1.4rem; font-weight: 700; margin: 0.35rem 0; }
.sub-bar { height: 10px; margin-bottom: 0.5rem; }
.sub-card .note { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
details.section > summary { cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }

/* ==========================================================================
   Strategy Factory kanban — CAP-ID: OPS-CC-FACTORY-KANBAN-001
   ========================================================================== */
.factory-legend { padding: 0.9rem 1rem; }
.kanban-board {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 260px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.kanban-col-head {
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.kanban-count {
  font-size: 0.72rem;
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  color: var(--muted);
}
.kanban-col-desc { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.2rem; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.kanban-empty { text-align: center; padding: 0.6rem 0; }
.factory-card { padding: 0.7rem 0.75rem; font-size: 0.8rem; }
.factory-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem; }
.stage-badge {
  font-size: 0.68rem;
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}
.btn-expand {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}
.card-detail { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); }
.card-detail table { width: 100%; }

/* ---------- scorecard leaderboard filter (OPS-CC-SPA-001) ---------- */
.lb-filter { display: flex; align-items: center; }
.lb-filter select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 1.6rem 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  min-height: 32px;
}
.lb-filter select:hover { border-color: var(--border-hi); }
.lb-filter select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
