/* New session route + the shared composer (items #3519, #3618, Plan #3333).
   Per-view stylesheet, the routed-view convention: loaded from index.html
   after tasks.css so it inherits the entry's token palette. Everything here
   is .mm-sessions* / .mm-ns-* (the route) or .mm-cx-* (the composer, which
   also renders inside the session panel); the sidebar Sessions block and the
   roster chevrons live in chat.css beside the other .mm-roster-* rules.
   Tokens only — no colour here is not one of the entry's own, so both
   themes follow the app. */

.mm-sessions {
  display: flex; flex-direction: column; height: 100%; min-height: 0;
}

/* -- the slim header --------------------------------------------------------- */
/* What this is, and the folder the session will run in — beside the name,
   on the left (#3645); the right side holds nothing. The composer's chips
   carry every other choice. */
.mm-ns-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: 48px; padding: 0 20px; box-sizing: border-box;
  border-bottom: 1px solid var(--border-soft); background: var(--panel);
}
.mm-ns-name { font-size: 14px; font-weight: 650; }
.mm-ns-space { flex: 1; }
.mm-ns-repo {
  display: inline-flex; align-items: center; gap: 6px; max-width: 460px;
  border: 1px solid var(--border); border-radius: 6px; background: none;
  color: var(--text); font: inherit; font-size: 12.5px;
  padding: 4px 10px; cursor: pointer;
}
.mm-ns-repo:hover { border-color: var(--accent); }
.mm-ns-repo-name { flex: none; font-weight: 600; }
/* "· +2 folders" (#3641): the rest of the workspace's set rides the tooltip. */
.mm-ns-repo-more { flex: none; color: var(--text-dim); }

/* -- the stage --------------------------------------------------------------- */
/* The composer sits in the middle of the canvas, the way a first message
   should: the question, the box, and what is up next underneath. */
.mm-ns-stage {
  flex: 1; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 22px; padding: 40px 20px;
}
.mm-ns-title {
  font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 0;
  text-align: center;
}
.mm-ns-composer, .mm-ns-upnext, .mm-ns-requests {
  width: 100%; max-width: 680px;
}

/* -- up next ----------------------------------------------------------------- */
.mm-ns-upnext { display: flex; flex-direction: column; gap: 8px; }
.mm-ns-upnext-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim);
}
.mm-ns-rule { flex: 1; height: 1px; background: var(--border-soft); }
.mm-ns-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-ns-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 12.5px; padding: 5px 10px; cursor: pointer;
}
.mm-ns-chip:hover { border-color: var(--accent); }
.mm-ns-chip.more { border-color: transparent; color: var(--accent-ink); }
.mm-ns-chip-id { flex: none; font-weight: 600; }
.mm-ns-chip-title {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mm-ns-chip-verb { flex: none; font-size: 11px; color: var(--text-dim); }

/* -- the composer ------------------------------------------------------------ */
/* One card: attachments above, the box, the chip row. The SAME component
   renders the running session's reply box (.mm-cx.live), which is why every
   rule here is on .mm-cx rather than on the route. */
.mm-cx {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--panel); padding: 12px 14px;
}
.mm-cx-input {
  width: 100%; box-sizing: border-box; min-height: 48px; max-height: 40vh; resize: none; overflow-y: auto;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.45; padding: 4px 2px;
}
.mm-cx.live .mm-cx-input { min-height: 40px; }
.mm-cx-input:focus { outline: none; }
.mm-cx-input::placeholder { color: var(--text-dim); }
.mm-cx-attached[hidden], .mm-cx-foot[hidden] { display: none; }
.mm-cx-attached { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-cx-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); font-size: 12.5px; padding: 4px 8px;
}
.mm-cx-chip-id { flex: none; font-weight: 600; }
.mm-cx-chip-title {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mm-cx-chip-stage {
  flex: none; font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
}
.mm-cx-chip-x {
  border: 0; background: none; color: var(--text-dim);
  font: inherit; cursor: pointer; padding: 0 2px;
}
.mm-cx-chip-x:hover { color: var(--text); }

.mm-cx-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mm-cx-space { flex: 1; }
.mm-cx-plus {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: none;
  color: var(--muted); font: inherit; font-size: 17px; line-height: 1;
  cursor: pointer;
}
.mm-cx-plus:hover { border-color: var(--accent); color: var(--text); }
.mm-cx-chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px;
  border: 1px solid var(--border); border-radius: 8px; background: none;
  color: var(--muted); font: inherit; font-size: 12px; padding: 0 10px;
  cursor: pointer;
}
.mm-cx-chip-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.mm-cx-chip-btn:disabled { cursor: default; }
/* #3702: an option value with the adapter's own one-liner under its name. */
.mm-cx-opt { display: flex; flex-direction: column; gap: 2px; }
.mm-cx-opt-hint { font-size: 11.5px; color: var(--text-dim); }
.mm-cx-chip-btn.engine { color: var(--text); position: relative; overflow: hidden; }
/* #3643: the plan limit closest to exhaustion, as a 2 px sliver on the
   chip's bottom edge — usageLevel-classed, the name on the SLIVER's own
   title (the chip's title is the not-ready reason, and a disabled chip
   shows no tooltip). Tokens only, no literal colour. */
.mm-cx-chip-sliver {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--border); pointer-events: auto;
}
.mm-cx-chip-sliver-fill { display: block; height: 100%; background: var(--accent-fill); }
.mm-cx-chip-sliver.warn .mm-cx-chip-sliver-fill { background: var(--warn); }
.mm-cx-chip-sliver.danger .mm-cx-chip-sliver-fill { background: var(--danger); }
/* #3637's Brief replies, as the engine popover's last row (#3645): the
   toggle with the appended line beside it, dim. */
.mm-cx-brief {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  width: 100%; max-width: 34ch; box-sizing: border-box; text-align: left;
  border: 0; background: none; color: var(--text); font: inherit; font-size: 12.5px;
  padding: 6px 12px; cursor: pointer; border-radius: 6px;
}
.mm-cx-brief:hover, .mm-cx-brief:focus-visible { background: var(--panel-2); outline: none; }
.mm-cx-brief-mark { flex: none; width: 1em; color: var(--accent); }
.mm-cx-brief.on .mm-cx-brief-name { color: var(--accent); }
.mm-cx-brief-name { flex: none; font-weight: 600; }
.mm-cx-brief-line { flex: 1 1 100%; color: var(--text-dim); font-size: 11.5px; line-height: 1.4; }
.mm-cx-chip-btn.engine.off { border-color: var(--warn); }
.mm-cx-chip-name { flex: none; }
.mm-cx-chip-sub { color: var(--text-dim); }
.mm-cx-caret { flex: none; font-size: 10px; color: var(--text-dim); }
.mm-cx-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--ok);
}
.mm-cx-dot.warn { background: none; border: 1.5px solid var(--text-dim); }
.mm-cx-dot.off { background: var(--text-dim); }
.mm-cx-send {
  width: 32px; height: 32px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px;
  background: var(--accent-fill); color: var(--on-accent);
  font: inherit; font-size: 15px; cursor: pointer;
}
.mm-cx-send:disabled { opacity: .45; cursor: default; }

.mm-cx-foot { display: flex; flex-direction: column; gap: 4px; }
.mm-cx-line.hint { color: var(--muted); }
.mm-cx-link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.mm-cx-link:hover { color: var(--accent-ink); text-decoration: underline; }
.mm-cx-link:disabled { opacity: .55; cursor: default; }
.mm-cx-line { color: var(--text-dim); font-size: 12.5px; }
.mm-cx-line.warn { color: var(--warn); }
.mm-cx-line.error { color: var(--danger); }

/* The post-start fallback: the session is already running, so this is a
   card inside the composer, never a modal. */
.mm-cx-fallback {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--warn); border-radius: 10px;
  padding: 10px 12px; margin-top: 4px;
}
.mm-cx-fallback-head { font-weight: 650; font-size: 13px; }
.mm-cx-fallback p { margin: 0; font-size: 12.5px; }
.mm-cx-fallback .muted { color: var(--text-dim); }
.mm-cx-fallback-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* -- completions (#3650) ------------------------------------------------------ */
/* ONE list, two row shapes, IN FLOW inside the card above the box (never
   absolute: the New session stage scrolls only toward its end, so a list
   rising above the card would be clipped at the stage's top edge). The
   card grows and the stage scrolls, exactly as the attach row does. A
   command row is glyph · name · hint · source tag; a task row is id ·
   title · stage. Focus stays in the textarea; .active is the highlight. */
.mm-cp {
  margin: 0 0 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); overflow: hidden;
}
.mm-cp[hidden] { display: none; }
.mm-cp-list { max-height: min(40vh, 320px); overflow-y: auto; display: flex; flex-direction: column; }
.mm-cp-list[hidden] { display: none; }
.mm-cp-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 12px; border: 0; background: none; color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.mm-cp-row.active, .mm-cp-row:hover { background: var(--panel-2); }
.mm-cp-glyph {
  flex: none; width: 14px; height: 14px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px;
  color: var(--text-dim); background: var(--panel-2);
}
.mm-cp-name { flex: none; font-weight: 600; }
.mm-cp-hint {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-dim);
}
.mm-cp-tag { flex: none; font-size: 11px; color: var(--text-dim); }
.mm-cp-id { flex: none; font-weight: 600; }
.mm-cp-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text);
}
.mm-cp-stage { flex: none; font-size: 11px; color: var(--text-dim); }
.mm-cp-status { padding: 8px 12px; font-size: 12px; color: var(--text-dim); }
.mm-cp-status[hidden] { display: none; }

/* The engine menu (#3777): two zones in one .pop. The pop's own overflow
   is turned off by the modifier class and the SCROLL zone takes it, so the
   PIN zone (Add account…, Engines & accounts…) stays visible at every
   popover height — inside both of .pop's max-height bounds (app.css:
   min(340px, 100vh - 16px)) — and never below the fold. A modifier class,
   not a dom.js change. */
.pop.mm-cx-engine-pop {
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
  min-width: 260px;
}
.mm-cx-pop-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px; }
.mm-cx-pop-pin {
  flex: none; padding: 6px; border-top: 1px solid var(--border-soft);
  background: var(--panel);
}
.mm-cx-pop-pin .pop-item { font-size: 12.5px; }
.mm-cx-pop-add { color: var(--accent); }
.mm-cx-menu-head {
  padding: 6px 10px 4px; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim);
}
.mm-cx-menu-fix { padding: 2px 10px 6px; font-size: 12px; color: var(--warn); }
/* One account's radio row: the name, then the worst-window sliver and its
   percent on the right — or "Sign in" for a signed-out account. The meters
   themselves live on the Engines & accounts page. */
.mm-cx-acct { gap: 8px; }
.mm-cx-acct-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mm-cx-acct-usage { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.mm-cx-acct-sliver {
  display: inline-block; width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); overflow: hidden;
}
.mm-cx-acct-sliver-fill { display: block; height: 100%; background: var(--accent-fill); }
.mm-cx-acct-sliver.warn .mm-cx-acct-sliver-fill { background: var(--warn); }
.mm-cx-acct-sliver.danger .mm-cx-acct-sliver-fill { background: var(--danger); }
.mm-cx-acct-pct {
  font-size: 10.5px; min-width: 28px; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text-dim);
}
.mm-cx-acct-pct.warn { color: var(--warn); }
.mm-cx-acct-pct.danger { color: var(--danger); }
.mm-cx-acct-signin { flex: none; font-size: 11.5px; color: var(--accent); }
.mm-cx-acct:disabled { opacity: .55; cursor: default; }

/* -- the honest browser notice ---------------------------------------------- */
.mm-sessions-notice {
  max-width: 560px; margin: 60px auto; text-align: center;
  color: var(--text-dim); font-size: 13.5px;
}
.mm-sessions-download {
  display: inline-block; margin-top: 10px; color: var(--accent);
  text-decoration: none; font-size: 13px;
}
.mm-sessions-download:hover { text-decoration: underline; }
.mm-sessions-empty { color: var(--text-dim); font-size: 12.5px; padding: 6px 2px; }

/* -- blocks (the Requests list) ---------------------------------------------- */
.mm-sessions-block { margin: 0 0 22px; }
.mm-sessions-block-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); padding: 0 2px 6px;
}
.mm-sessions-count {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0 6px; font-size: 11px;
}
.mm-sessions-note { color: var(--text-dim); text-transform: none; letter-spacing: 0; }
.mm-sessions-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px; font-size: 13px;
}
.mm-sessions-row:hover { background: var(--panel-2); }
.mm-sessions-verb {
  flex: none; font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
}
.mm-sessions-age { flex: none; color: var(--text-dim); font-size: 12px; }

/* -- work picker additions (session mode) ------------------------------------ */
.mm-wp-plan {
  flex: none; font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); padding: 1px 6px;
}
/* #3618: the workspace's own up-next rows lead; "My work" follows a head. */
.mm-wp-head {
  padding: 8px 6px 4px; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim);
}

/* -- archive confirm --------------------------------------------------------- */
/* The confirm sheets are the shared modal's body: same inset as .modal-body
   (app.css), so the text lines up under the title instead of hugging the
   card's edge, and the buttons sit in a spaced row rather than the corner. */
.modal-card > .mm-sessions-confirm { padding: 14px 20px 18px; }
.mm-sessions-confirm { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.mm-sessions-confirm p { margin: 0; }
.mm-sessions-confirm .muted { color: var(--text-dim); font-size: 12.5px; }
.mm-sessions-confirm-status { color: var(--text-dim); font-size: 12.5px; min-height: 1em; }
.mm-sessions-confirm-status:empty { display: none; }
.mm-sessions-confirm-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* -- requests (#3343) -------------------------------------------------------- */
/* The only block on this route waiting on a person. Absent entirely without
   the desktop bridge, and absent when there is nothing pending — an empty
   block would be a standing reminder of a thing that is not happening. */
.mm-requests .mm-sessions-block-head { color: var(--accent); }
.mm-request-row { align-items: center; gap: 8px; }
.mm-request-who { flex: none; font-weight: 600; color: var(--text); }
.mm-request-note {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-dim);
}
.mm-request-row .mm-card { flex: 1; min-width: 0; }

/* -- the terminal row's own menu (#3637) ------------------------------------- */
/* Continue, and the link to the session this one was continued in. Sized and
   revealed exactly like the pin and archive buttons it sits beside
   (css/chat.css), which keep their own affordances. */
.mm-session-more {
  width: 18px; height: 18px; border: 0; border-radius: 5px;
  background: none; color: var(--text-dim); font: inherit; font-size: 12px;
  line-height: 1; cursor: pointer;
}
.mm-session-more:hover { background: var(--panel-2); color: var(--text); }
