/* Shared shell kit, loaded after app.css by a product that registered its own shell.
   Tokens come from tokens.css. A product that registered no shell never loads this file. */
::selection { background: var(--selection); }
.topbar, .shell-topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.environment.bad::before { background: var(--red); }
.side, .shell-sidebar { display: flex; flex-direction: column; padding: 19px 10px; border-right: 1px solid var(--line); background: linear-gradient(145deg, var(--raised), var(--panel)); }
.navlink[href="/work-orders"] .ic, .navlink[data-nav="work-orders"] .ic { color: var(--yellow); }
.navlink[href="/chat"] .ic, .navlink[data-nav="chat"] .ic { color: var(--link); }
.navlink[href="/runs"] .ic, .navlink[data-nav="runs"] .ic { color: var(--teal); }
.navlink[href="/approvals"] .ic, .navlink[data-nav="approvals"] .ic { color: var(--green); }
.bdg { margin-left: auto; border-radius: var(--r-pill); padding: 0 6px; color: var(--yellow-text); background: var(--yellow-wash); font-size: 12px; }
.banner.ok { background: var(--green-tint); }
.banner.warn { background: var(--yellow-tint); }
.banner.bad { background: var(--red-tint); }
.banner.info { background: var(--link-tint); }
/* A plain note: the banner look without an icon. */
.note { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--edge); border-radius: var(--r-btn); color: var(--secondary); font-size: 12px; }
.note.ok { background: var(--green-tint); }
.note.warn { background: var(--yellow-tint); }
.note.bad { background: var(--red-tint); }
.note.info { background: var(--link-tint); }
.sortbtn { background: none; border: 0; font: inherit; color: var(--secondary); width: 100%; text-align: left; cursor: pointer; padding: 0; }
.sortbtn:hover { color: var(--text); }
th[aria-sort="ascending"] .sortbtn::after { content: " ↑"; }
th[aria-sort="descending"] .sortbtn::after { content: " ↓"; }
.sortbtn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.btn, button:not([class]), input[type="submit"]:not([class]) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; min-height: 36px; padding: 8px 12px; background: linear-gradient(var(--btn-top), var(--btn-bottom)); border: 1px solid var(--btn-edge); border-radius: var(--r-btn); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; box-shadow: var(--btn-shadow); }
.btn.primary { color: var(--white); font-weight: 600; background: var(--indigo); border-color: var(--indigo); }
.btn.good { color: var(--green-text); border-color: var(--green-line); background: var(--green-fill); }
.btn.bad { color: var(--red-text); border-color: var(--red-line); background: var(--red-fill); }
.btn.quiet { background: transparent; color: var(--secondary); box-shadow: none; }
.btn:hover, button:not([class]):hover { border-color: var(--muted); background-image: linear-gradient(var(--sheen), var(--sheen)); color: var(--text); text-decoration: none; }
.msg.u { align-self: flex-end; background: var(--indigo); color: var(--white); border-radius: 12px 12px 3px 12px; }
.msg.u .help, .msg.u .hint, .msg.u a { color: var(--white); }
.msg.e { align-self: flex-start; background: var(--red-fill); border: 1px solid var(--red-line); color: var(--red-text); }
@media (max-width: 860px) {
  .side, .shell-sidebar { flex-direction: row; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .grp, .shell-sidebar .grp, .side-foot { display: none; }
}
@media (max-width: 860px) {
  .topbar, .shell-topbar { flex-wrap: wrap; padding: 8px 16px; }
}
/* Column caps leave room for arguments and results when the card narrows. */
table.toollog { table-layout: fixed; width: 100%; min-width: 0; }
table.toollog th, table.toollog td { overflow-wrap: anywhere; padding-left: 6px; padding-right: 6px; }
table.toollog th:nth-child(1) { width: min(3em, 4%); }
table.toollog th:nth-child(2) { width: min(11em, 17%); }
table.toollog th:nth-child(3) { width: min(16em, 18%); }
table.toollog th:nth-child(4) { width: min(7em, 9%); }
table.toollog th:nth-child(6) { width: min(9em, 10%); }
table.toollog th:nth-child(7) { width: min(16em, 20%); }
table.toollog td:nth-child(2) .stamp { white-space: normal; overflow-wrap: normal; }
table.toollog .pill { max-width: 100%; white-space: normal; }
table.toollog pre { white-space: pre-wrap; max-height: 24em; overflow-y: auto; padding: 8px; }


/* Engagement page: back link, id, status chip and the vertical stage timeline. */
.eng-back, .record-back { margin: 0 0 4px; }
.eng-id, .record-id { margin: 0 0 6px; font-size: 11px; color: var(--muted); font-family: var(--mono); overflow-wrap: anywhere; }
.eng-status, .record-status { margin: 0 0 14px; }
.timeline, .timeline-card { list-style: none; margin: 12px 0; padding: 0; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 0 0 14px; color: var(--secondary); }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tl-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; border: 2px solid var(--control); color: var(--muted); background: var(--panel); }
.tl-item.done .tl-mark { border-color: var(--green); color: var(--green-text); }
.tl-item.running .tl-mark, .tl-item.current .tl-mark { border-color: var(--indigo); color: var(--link); }
.tl-item.problem .tl-mark { border-color: var(--red); color: var(--red-text); }
.tl-item.todo { color: var(--muted); }
.tl-name { font-weight: 600; color: var(--text); }
.tl-item.todo .tl-name { color: var(--muted); }
.tl-words { margin-left: 6px; }
.tl-time { display: block; font-size: 12px; color: var(--muted); }

/* Engagement workspace: timeline rail, tabbed panel, assistant column. Used by the
   Solutions Architect engagement page only. Tokens come from tokens.css.
   Workspace sizes, set once on .eng-grid and used by the rules below:
     --eng-rail    width of the timeline rail
     --eng-assist  width of the assistant column
     --eng-gap     space between the columns */
.page-head .eng-back, .page-head .record-back { margin: 0 0 6px; font-size: 12px; }
.page-head .eng-back a, .page-head .record-back a { color: var(--muted); text-decoration: none; }
.page-head .eng-back a::before, .page-head .record-back a::before { content: '\2190\00a0'; }
.page-head .eng-back a:hover, .page-head .record-back a:hover { color: var(--text); }
.header-actions .eng-status, .header-actions .record-status { margin: 22px 0 0; }
.eng-grid { --eng-rail: 176px; --eng-assist: 280px; --eng-gap: 14px; position: relative; display: grid; grid-template-columns: var(--eng-rail) minmax(0, 1fr) var(--eng-assist); gap: var(--eng-gap); align-items: start; }
.eng-grid > .eng-rail { grid-column: 1; grid-row: 1; }
.eng-grid > .eng-main { grid-column: 2; grid-row: 1; }
.eng-grid > .eng-assist { grid-column: 3; grid-row: 1; }
.eng-grid > details.shell-assistant { grid-column: 3; grid-row: 1; }
.eng-grid:has(> .eng-assist:not([open])) { grid-template-columns: 176px minmax(0, 1fr); }
.eng-grid:has(> details.shell-assistant:not([open])) { grid-template-columns: 176px minmax(0, 1fr); }
.eng-rail { min-width: 0; }
.eng-rail > .card { margin: 0; padding: 12px 10px 4px; min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.eng-rail > .card p, .eng-rail > .card li, .eng-rail > .card a { overflow-wrap: anywhere; }
.eng-rail > .card .btn, .eng-rail > .card button, .eng-rail > .card a.btn, .eng-rail > .card .navlink { max-width: 100%; white-space: normal; text-align: left; }
.eng-rail > .card > h3 { margin-bottom: 12px; font-size: 11px; letter-spacing: .9px; text-transform: uppercase; color: var(--dim-text); }
.eng-rail > .card > h3::after { content: ' timeline'; }
.eng-rail .timeline, .eng-rail .timeline-card { margin: 0 0 6px; }
.eng-rail .tl-item { gap: 10px; padding-bottom: 16px; font-size: 12px; }
.eng-rail .tl-name { font-size: 13px; }
.eng-rail .tl-words { margin-left: 4px; color: var(--muted); }
.tl-note { display: block; font-size: 12px; color: var(--secondary); }
/* Compact timeline (narrow rail): line one is the mark and the name, line two the time in small
   monospace (or the state words, then the time), line three an optional note. About 40px a
   step with a time, about 28px without. */
.timeline-compact .tl-item, .eng-rail .timeline-compact .tl-item { gap: var(--s-2); align-items: flex-start; min-height: 28px; padding: 0 0 2px; font-size: 12px; }
.timeline-compact .tl-item:not(:last-child)::before { left: 9px; top: 24px; bottom: -2px; }
.timeline-compact .tl-mark { flex: 0 0 20px; height: 20px; margin-top: 4px; font-size: 11px; }
.timeline-compact .tl-body { flex: 1 1 auto; min-width: 0; display: block; padding-top: 5px; overflow-wrap: anywhere; }
.timeline-compact .tl-name { display: block; font-size: 13px; line-height: 18px; }
.timeline-compact .tl-words, .eng-rail .timeline-compact .tl-words { display: inline; margin-left: 0; font-size: 11px; line-height: 14px; color: var(--muted); }
.timeline-compact .tl-words.sr-only { margin-left: 0; }
.timeline-compact .tl-time { display: block; margin-left: 0; font-size: 11px; line-height: 14px; color: var(--muted); }
.timeline-compact time { font-family: var(--mono); font-size: 11px; }
.timeline-compact .tl-note { display: block; margin-top: 0; padding-bottom: 2px; font-size: 11px; line-height: 14px; }
.eng-main { min-width: 0; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-card); }
.eng-tabs, .record-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.eng-tab, .record-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.eng-tab:hover, .record-tab:hover { color: var(--text); }
.eng-tab[aria-current="page"], .record-tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--indigo); }
.eng-tab-count { padding: 0 6px; border-radius: var(--r-pill); background: var(--active); color: var(--secondary); font-size: 11px; }
.eng-panel, .record-panel { padding: 18px; }
.eng-panel > .card, .record-panel > .card { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.eng-panel > .card + .card, .record-panel > .card + .card { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.eng-assist { min-width: 0; }
details.shell-assistant { min-width: 0; }
.eng-assist > summary { position: absolute; top: -46px; right: 0; display: flex; align-items: center; min-height: 36px; cursor: pointer; list-style: none; }
details.shell-assistant > summary { position: absolute; top: -46px; right: 0; display: flex; align-items: center; min-height: 36px; cursor: pointer; list-style: none; }
.eng-assist:not([open]) { grid-column: 1 / -1; grid-row: 2; height: 0; }
details.shell-assistant:not([open]) { grid-column: 1 / -1; grid-row: 2; height: 0; }
.eng-assist-title { display: none; }
.eng-assist > summary::-webkit-details-marker { display: none; }
details.shell-assistant > summary::-webkit-details-marker { display: none; }
.eng-assist-hide, .eng-assist-show { padding: 5px 10px; border: 1px solid var(--btn-edge); border-radius: var(--r-btn); background: linear-gradient(var(--btn-top), var(--btn-bottom)); box-shadow: var(--btn-shadow); color: var(--text); font-size: 12px; font-weight: 500; text-decoration: none; }
.eng-assist-show, .eng-assist:not([open]) .eng-assist-hide, .eng-assist:not([open]) .eng-assist-title { display: none; }
details.shell-assistant:not([open]) .eng-assist-hide, details.shell-assistant:not([open]) .eng-assist-title { display: none; }
.eng-assist:not([open]) .eng-assist-show { display: inline; }
details.shell-assistant:not([open]) .eng-assist-show { display: inline; }
.shell-assistant-title { display: none; }
.shell-assistant-hide, .shell-assistant-show { padding: 5px 10px; border: 1px solid var(--btn-edge); border-radius: var(--r-btn); background: linear-gradient(var(--btn-top), var(--btn-bottom)); box-shadow: var(--btn-shadow); color: var(--text); font-size: 12px; font-weight: 500; text-decoration: none; }
.shell-assistant-show, details.shell-assistant:not([open]) .shell-assistant-hide, details.shell-assistant:not([open]) .shell-assistant-title { display: none; }
details.shell-assistant:not([open]) .shell-assistant-show { display: inline; }
.eng-agent .eng-instruction, .shell-agent .shell-instruction { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-inset); background: var(--raised); color: var(--text); }
.eng-agent .eng-event, .shell-agent .shell-event { font-family: var(--mono); font-size: 12px; color: var(--link); overflow-wrap: anywhere; }
.handoff-steps, .status-steps { list-style: none; margin: 14px 0 16px; padding: 0; }
.hs-item, .status-step { position: relative; display: flex; gap: 12px; padding: 0 0 14px; color: var(--secondary); }
.hs-item:not(:last-child)::before, .status-step:not(:last-child)::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.hs-mark, .status-step-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; border: 2px solid var(--control); color: var(--muted); background: var(--panel); }
.hs-item.done .hs-mark, .status-step.done .status-step-mark { border-color: var(--green); color: var(--green-text); }
.hs-item.current .hs-mark, .status-step.current .status-step-mark { border-color: var(--indigo); color: var(--link); }
.hs-item.todo, .status-step.todo { color: var(--muted); }
.hs-name, .status-step-name { font-weight: 600; color: var(--text); margin-right: 6px; }
.hs-item.todo .hs-name, .status-step.todo .status-step-name { color: var(--muted); }
.handoff-summary, .status-summary { font-weight: 500; color: var(--text); }
.bot-lanes, .status-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 8px; }
.bot-lane, .status-lane { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-inset); background: var(--bg); }
.bot-head, .status-lane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bot-head h4, .status-lane-head h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }
@media (max-width: 1320px) {
  .eng-grid, .eng-grid:has(> .eng-assist:not([open])) { grid-template-columns: var(--eng-rail) minmax(0, 1fr); }
  .eng-grid:has(> details.shell-assistant:not([open])) { grid-template-columns: var(--eng-rail) minmax(0, 1fr); }
  .eng-grid > .eng-assist { grid-column: 1 / -1; grid-row: 2; }
  .eng-grid > details.shell-assistant { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 860px) {
  .eng-grid, .eng-grid:has(> .eng-assist:not([open])) { grid-template-columns: minmax(0, 1fr); }
  .eng-grid:has(> details.shell-assistant:not([open])) { grid-template-columns: minmax(0, 1fr); }
  .eng-grid > .eng-main, .eng-grid > .eng-rail, .eng-grid > .eng-assist { grid-column: 1; grid-row: auto; }
  .eng-grid > details.shell-assistant { grid-column: 1; grid-row: auto; }
  .eng-assist > summary { position: static; margin-bottom: 10px; }
  details.shell-assistant > summary { position: static; margin-bottom: 10px; }
  .eng-assist:not([open]) { height: auto; }
  details.shell-assistant:not([open]) { height: auto; }
}
.bot-detail, .status-lane-detail { margin-top: 4px; font-size: 12px; color: var(--secondary); }
.bot-detail summary, .status-lane-detail summary { cursor: pointer; color: var(--link); }
.bot-detail ul, .status-lane-detail ul { margin: 2px 0 6px 18px; padding: 0; }
.bot-note, .status-lane-note { margin: 4px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.bot-lane th:first-child, .status-lane th:first-child { width: 26%; }
.bot-lane th:nth-child(3), .status-lane th:nth-child(3) { width: 22%; }
.bot-lane th:nth-child(4), .status-lane th:nth-child(4) { width: 10%; }
.eng-runs-card h3 a { color: var(--link); text-decoration: none; }
.eng-runs-card h3 a:hover { text-decoration: underline; }

/* Kit names for the record header: the title block sits at the left, the state and the actions at the far right. */
.record-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: start; margin-bottom: 20px; }
.record-header > * { grid-column: 1; }
.record-header > .record-status, .record-header > .record-actions { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; }
.record-header > .record-actions { grid-row: 2; }
.record-header > h1 { margin-bottom: 4px; }
.record-header > .record-meta { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 860px) {
  .record-header { grid-template-columns: minmax(0, 1fr); }
  .record-header > .record-status, .record-header > .record-actions { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; }
}
/* Status board lane count: a plain number beside the lane title. */
.status-lane-count { color: var(--muted); font-size: 12px; }
/* Record grid with no rail: the main column and the assistant. Closed, the main column alone. */
.eng-grid.no-rail { grid-template-columns: minmax(0, 1fr) var(--eng-assist); }
.eng-grid.no-rail > .eng-main { grid-column: 1; }
.eng-grid.no-rail > details.shell-assistant, .eng-grid.no-rail > .eng-assist { grid-column: 2; }
.eng-grid.no-rail:has(> details.shell-assistant:not([open])), .eng-grid.no-rail:has(> .eng-assist:not([open])) { grid-template-columns: minmax(0, 1fr); }
.eng-grid.no-rail > details.shell-assistant:not([open]), .eng-grid.no-rail > .eng-assist:not([open]) { grid-column: 1; grid-row: 2; }
/* Room for the Hide control on a page with no rail. The control sits 46px above the columns and is 36px
   high. The page head above has a 20px bottom margin, so the control would land on the head actions.
   46px of top margin (it merges with the 20px, it does not add to it) keeps the control below the head.
   Only a no-rail grid that holds the assistant gets it. */
.eng-grid.no-rail:has(> details.shell-assistant) { margin-top: 46px; }
@media (max-width: 1320px) {
  .eng-grid.no-rail, .eng-grid.no-rail:has(> details.shell-assistant:not([open])), .eng-grid.no-rail:has(> .eng-assist:not([open])) { grid-template-columns: minmax(0, 1fr); }
  .eng-grid.no-rail > details.shell-assistant, .eng-grid.no-rail > .eng-assist { grid-column: 1; grid-row: 2; }
}
@media (max-width: 860px) {
  .eng-grid.no-rail > .eng-main, .eng-grid.no-rail > details.shell-assistant, .eng-grid.no-rail > .eng-assist { grid-column: 1; grid-row: auto; }
}
