/* Mission Control view (item #3456). Per-view stylesheet — the routed-view
   convention from #3455: loaded from index.html after chat.css so it
   inherits the entry's token palette (chat.css re-values the portal tokens;
   the loud channels --warn/--review/--danger arrive from app.css).

   A TRANSLATION of the portal's wp-mission.css under the mmc- prefix — the
   subset this read-only surface renders (metrics, queue cards, ops rows,
   plan cards, machines/sessions) — re-derived for this host:
   - the view root owns scrolling (#mm-chat is a non-scrolling flex child;
     wp-mission.css assumes the document scrollbar);
   - breakpoints re-derived for content = viewport − 248px sidebar
     (chat.css #mm-side): single column below 1280px viewport, two columns
     from 1280px up.
   Only the .traj-* and .ws-milestone-* base rules copy verbatim (from
   wp-milestones.css:149-171) because the imported trajectory component
   emits those class names. */

.mmc {
  box-sizing: border-box; height: 100%; overflow-y: auto;
  padding: 32px 36px 48px;
  font-family: var(--sans);
}
.mmc-head {
  display: flex; align-items: center; gap: 12px;
  max-width: 1240px; margin: 0 auto 16px;
}
.mmc-title { font-size: 19px; font-weight: 700; margin: 0; flex: 1; }
.mmc-head-link, .mmc-panel-link {
  font-size: 12px; font-weight: 650; color: var(--accent);
  text-decoration: none;
}
.mmc-head-link:hover, .mmc-panel-link:hover {
  text-decoration: underline;
}
.mmc-panel-link { margin-left: auto; font-weight: 400; font-size: 11px; }
.mmc-dim { color: var(--text-dim); }
.mmc-meta { font-size: 11px; color: var(--text-dim); }

/* -- loading + failure (LOCAL names — never the portal's .wm-loading) ------ */
.mmc-loading { padding: 16px; }
.mmc-loading-label {
  display: block; font-size: 12px; color: var(--text-dim);
  margin-bottom: 16px;
}
.mmc-skeleton { display: grid; gap: 12px; }
.mmc-skeleton span {
  display: block; height: 12px; border-radius: 4px;
  background: var(--border); animation: mmc-pulse 1.8s ease-in-out infinite;
}
.mmc-skeleton span:nth-child(2) { width: 82%; }
.mmc-skeleton span:nth-child(3) { width: 58%; }
@keyframes mmc-pulse { 50% { opacity: .4; } }
.mmc-load-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px; font-size: 12px; color: var(--danger);
}
.mmc-retry {
  font: inherit; font-size: 12px; font-weight: 650;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 12px; cursor: pointer;
}
.mmc-retry:hover { border-color: var(--accent); }

/* -- metrics strip --------------------------------------------------------- */
.mmc-metrics {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px; max-width: 1240px; margin: 0 auto 22px;
}
.mmc-metric {
  position: relative; min-width: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.mmc-metric-link { display: block; color: inherit; text-decoration: none; }
.mmc-metric-link:hover .mmc-metric-label { color: var(--accent-ink); }
.mmc-metric-label {
  font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mmc-metric-value {
  display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.5px;
  line-height: 1.25; margin: 3px 0 0; font-variant-numeric: tabular-nums;
}
.mmc-metric .mmc-loading { padding: 8px 0 0; }
.mmc-metric .mmc-loading-label { margin: 0; }
.mmc-metric .mmc-skeleton { display: none; }
.mmc-metric .mmc-load-error { padding: 8px 0 0; }
.mmc-microchart {
  display: flex; align-items: end; gap: 3px;
  position: absolute; right: 12px; top: 32px; height: 24px; width: 44px;
}
.mmc-microchart span {
  flex: 1; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--ok);
}
.mmc-microchart .zero { background: var(--border); }

/* -- the two-column grid ---------------------------------------------------
   Content width = viewport − 248px sidebar (chat.css): a 1280px viewport
   leaves ~1032px of content, enough for queue + rail side by side. Below
   that, one column — panels stack in DOM order. */
.mmc-grid {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 18px; align-items: start; max-width: 1240px; margin: 0 auto;
}
.mmc-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (min-width: 1280px) {
  .mmc-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

/* -- zones (panels) --------------------------------------------------------- */
.mmc-zone {
  min-width: 0; margin: 0; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel);
}
.mmc-zone-head, .mmc .section-head {
  min-height: 48px; display: flex; align-items: center; gap: 9px;
  flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border);
  margin: 0;
}
.mmc-zone-label, .mmc .section-title {
  margin: 0; font: 600 14px var(--sans); color: var(--text);
  letter-spacing: 0; text-transform: none;
}
.mmc-zone-num {
  font-size: 12px; padding: 1px 6px; border-radius: 4px;
  background: var(--panel-2);
}
.mmc-colhint { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.mmc-zone-body { padding: 4px 16px 12px; }
.mmc-ops-body { padding: 0; }
.mmc-empty { padding: 18px 0; font-size: 13px; line-height: 1.6; }
.mmc-ops-body .mmc-empty { padding: 18px 16px; }
.mmc-empty-big { color: var(--text); font-weight: 500; margin-bottom: 4px; }
.mmc-empty-boards { margin-top: 10px; font-size: 12px; }
.mmc-board-link { color: var(--accent); text-decoration: none; }
.mmc-board-link:hover { text-decoration: underline; }
.mmc-more {
  background: none; border: 0; font: inherit; font-size: 12px;
  padding: 8px 0; color: var(--accent-ink); cursor: pointer; text-align: left;
}
.mmc-more:hover { text-decoration: underline; }

/* -- pills + bars ----------------------------------------------------------- */
.mmc-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 1px 7px; border-radius: 4px; font: 11px/1.7 var(--sans);
  white-space: nowrap; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border);
}
.mmc-pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.mmc-pill.review { color: var(--review); background: var(--review-soft); border-color: transparent; }
.mmc-pill.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.mmc-pill.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.mmc-pill.ok, .mmc-pill.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.mmc-pill.neutral, .mmc-pill.muted { color: var(--muted); }
.mmc-pill.sm { font-size: 10px; padding: 0 6px; }
.mmc-bar {
  display: block; height: 5px; min-width: 65px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.mmc-bar-fill {
  display: block; height: 100%; background: var(--accent-ink);
  border-radius: inherit; transition: width .2s;
}

/* -- Needs you: decision cards (read-only) ---------------------------------- */
.mmc-scope {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px 0; font-size: 12px;
}
.mmc-scope-btn {
  font: inherit; font-size: 11.5px; font-weight: 650;
  color: var(--text-dim); background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 10px; cursor: pointer;
}
.mmc-scope-btn:hover { border-color: var(--accent); color: var(--text); }
.mmc-scope-btn[aria-pressed="true"] {
  color: var(--on-accent); background: var(--accent-fill);
  border-color: var(--accent-fill);
}
.mmc-card { min-width: 0; line-height: 1.5; }
.mmc-decision { padding: 13px 0; border-bottom: 1px solid var(--border); }
.mmc-decision:last-child { border-bottom: 0; }
.mmc-decision-copy { min-width: 0; }
.mmc-card-title {
  display: inline-block; font: 500 13px/1.5 var(--sans); color: var(--text);
  text-decoration: none; overflow-wrap: anywhere;
}
button.mmc-card-title:hover { color: var(--accent-ink); }
.mmc-card-meta {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px;
  min-width: 0; white-space: normal; overflow-wrap: anywhere;
  margin-top: 4px; font-size: 11px; color: var(--text-dim);
}
.mmc-kind { font-weight: 500; }
.mmc-kind.warn { color: var(--warn); }
.mmc-kind.review { color: var(--review); }
.mmc-kind.danger { color: var(--danger); }
.mmc-card-detail {
  font-size: 12px; margin-top: 4px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mmc-crit { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.mmc-crit.ok { color: var(--ok); }
.mmc-unassigned summary {
  font-size: 12px; color: var(--text-dim); cursor: pointer; padding: 8px 0;
}
.mmc-queue-footer {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  font-size: 11px; padding-top: 8px;
}
.mmc-queue-footer > span { margin-right: auto; }

/* -- Live operations -------------------------------------------------------- */
.mmc-ops + .mmc-ops { border-top: 1px solid var(--border); }
.mmc-ops-summary {
  display: grid;
  grid-template-columns: minmax(140px, .7fr) minmax(0, 2fr) minmax(130px, .7fr);
  gap: 18px; align-items: center; padding: 14px 16px;
  cursor: pointer; list-style: none;
}
.mmc-ops-summary::-webkit-details-marker { display: none; }
.mmc-ops-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mmc-ops-person > span { display: grid; font-size: 12px; min-width: 0; }
.mmc-ops-person strong { font-size: 13px; font-weight: 500; }
.mmc-ops-task {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: 10px; align-items: baseline;
}
.mmc-ops-title {
  font: 500 13px/1.5 var(--sans); color: var(--text); text-decoration: none;
  overflow-wrap: anywhere;
}
button.mmc-ops-title:hover { color: var(--accent-ink); }
.mmc-ops-beacon {
  display: inline-block; flex: none; width: 7px; height: 7px;
  border-radius: 50%; background: currentColor;
}
.mmc-ops-status.is-working .mmc-ops-beacon {
  animation: mmc-breathe 2s ease-in-out infinite;
}
@keyframes mmc-breathe {
  0%, 100% { opacity: 1; } 50% { opacity: .3; }
}
.mmc-ops-progress {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px;
  font-size: 11px;
}
.mmc-ops-progress > span:first-child { flex: 1; min-width: 90px; }
.mmc-expand-label { color: var(--text-dim); }
.mmc-ops[open] .mmc-expand-label::after { content: " ▴"; }
.mmc-ops-detail {
  border-top: 1px solid var(--border); padding: 12px 16px 14px;
  background: var(--panel-2); font-size: 12px; overflow-wrap: anywhere;
}
.mmc-ops-detail p { margin: 0 0 8px; color: var(--text); }
.mmc-ops.quiet { border-left: 3px solid var(--danger); }

/* -- Plans in progress ------------------------------------------------------ */
.mmc-plan { padding: 14px 0; border-bottom: 1px solid var(--border); }
.mmc-plan:last-child { border-bottom: 0; }
.mmc-plan-top {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 5px;
}
.mmc-plan-top .mmc-meta { flex: 1; white-space: normal; }
.mmc-plan-title {
  display: inline-block; font: 500 14px/1.5 var(--sans); color: var(--text);
  text-decoration: none; overflow-wrap: anywhere;
}
button.mmc-plan-title:hover { color: var(--accent-ink); }
.mmc-plan-progress {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 8px;
}
.mmc-plan-progress .mmc-bar { flex: 1; }
.mmc-plan-progress .mmc-bar-fill { background: var(--ok); }
.mmc-plan-tasks summary {
  font-size: 11px; color: var(--text-dim); cursor: pointer; padding: 3px 0;
}
.mmc-plan-child {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; border-top: 1px solid var(--border);
  font: 12px/1.5 var(--sans); padding: 10px 0;
}
.mmc-plan-child-title {
  min-width: 0; overflow-wrap: anywhere; color: var(--text);
  text-decoration: none;
}
button.mmc-plan-child-title:hover { color: var(--accent-ink); }
.mmc-plan-child .mmc-pill { flex-shrink: 0; }

/* -- item titles open the reader (#3465) -----------------------------------
   Every item title is a button (the reader opens in-app through the hash);
   the ↗ chip beside it is the portal link. The button reset keeps each
   title reading exactly as the anchor did; the wrapper keeps title + chip
   on one baseline and lets the title shrink before the chip does. */
.mmc-item-title {
  display: inline-flex; align-items: baseline; gap: 6px; min-width: 0;
  max-width: 100%;
}
button.mmc-card-title, button.mmc-ops-title, button.mmc-plan-title,
button.mmc-plan-child-title, button.mmc-session-task {
  font-family: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; text-align: left; min-width: 0;
}
button.mmc-session-task { display: block; }
.mmc-open-portal {
  flex: none; font-size: 11px; line-height: 1.6; color: var(--accent);
  text-decoration: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 0 6px; opacity: .8;
}
.mmc-open-portal:hover { border-color: var(--accent); opacity: 1; }

/* -- Milestones: the imported trajectory component --------------------------
   Base rules verbatim from wp-milestones.css:149-171 (+ the shared bar,
   :75-79), scoped under .mmc — the component emits .traj-* and .ws-milestone-*
   class names. The panel restyle below re-expresses wp-mission.css:184-191
   against the mmc- zone chrome. */
.mmc .traj-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 2px; }
.mmc .traj-row {
  width: 100%; text-align: left; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); color: var(--text); text-decoration: none;
}
.mmc .traj-row:hover { border-color: var(--accent); background: var(--panel-2); }
.mmc .traj-row.at-risk { border-color: var(--warn); }
.mmc .traj-top { display: flex; align-items: baseline; gap: 10px; }
.mmc .traj-name { flex: 1; min-width: 0; font-weight: 550; }
.mmc .traj-count {
  font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mmc .traj-count.overdue, .mmc .traj-row.at-risk .traj-count { color: var(--warn); font-weight: 600; }
.mmc .traj-bar { flex: none; }
.mmc .traj-meta { font-size: 12px; }
.mmc .traj-row.at-risk .traj-meta { color: var(--warn); }
.mmc .traj-unbucketed {
  display: inline-block; margin-top: 8px; font-size: 12.5px;
  color: var(--muted); text-decoration: none;
}
.mmc .traj-unbucketed:hover { color: var(--accent); }
.mmc .ws-milestone-bar {
  display: block; width: 100%; height: 4px; border-radius: 3px;
  background: var(--border); overflow: hidden;
}
.mmc .ws-milestone-fill { display: block; height: 100%; background: var(--ok); }
.mmc-traj .traj-list { padding: 8px 16px 4px; }
.mmc-traj .traj-unbucketed { margin: 0; padding: 8px 16px 14px; }
.mmc .muted { color: var(--text-dim); }
/* Manage… (#3466): the milestones registry modal, can_manage only. Sits
   in the section head before the "All milestones" portal link. */
.mmc-manage {
  margin-left: auto; font: inherit; font-size: 11px; font-weight: 650;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 10px; cursor: pointer;
}
.mmc-manage:hover { border-color: var(--accent); }
.mmc-manage + .mmc-panel-link { margin-left: 0; }

/* -- Your machines ---------------------------------------------------------- */
.mmc-machines .mmc-zone-body { padding: 4px 16px 8px; }
.mmc-machine-list { display: flex; flex-direction: column; }
.mmc-machine-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 28px;
  gap: 4px 10px; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.mmc-machine-row:last-child { border-bottom: 0; }
.mmc-machine-copy { min-width: 0; display: grid; gap: 2px; }
.mmc-machine-name {
  font-size: 13px; font-weight: 500; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.mmc-machine-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
}
.mmc-machine-row.revoked .mmc-machine-name { color: var(--muted); }
.mmc-machine-row.revoked .mmc-pill { opacity: .85; }
.mmc-machine-row.revoked .mmc-machine-sessions { opacity: .85; }
.mmc-card-menu {
  width: 28px; height: 28px; background: none; border: 0; border-radius: 4px;
  color: var(--muted); cursor: pointer; font-size: 17px;
}
.mmc-card-menu:hover { background: var(--panel-2); }
.mmc-machine-sessions {
  grid-column: 1 / -1; border-top: 1px dashed var(--border-soft);
  padding-top: 8px; margin-top: 2px;
}
.mmc-sessions-label {
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: 6px;
}
.mmc-session-list { display: grid; gap: 6px; }
/* #3702: the fold under a machine's lead sessions — the .mmc-more look, tighter. */
.mmc-sessions-older { padding: 6px 0 0; font-size: 11.5px; }
.mmc-session-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: 8px; align-items: baseline;
}
.mmc-session-copy { min-width: 0; display: grid; gap: 1px; }
.mmc-session-task {
  font-size: 12px; color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.mmc-session-task:hover { color: var(--accent-ink); }
.mmc-session-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
}

/* -- rename modal fields ---------------------------------------------------- */
.mmc-modal-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 18px; }
.mmc-modal-label { font-size: 12px; font-weight: 600; }
.mmc-modal-input {
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; padding: 7px 10px;
}
.mmc-modal-help { font-size: 11.5px; line-height: 1.4; }
.mmc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
