/* Compact administration uses the same theme tokens as the operator workspace. */
input:focus,textarea:focus,select:focus,button:focus-visible,a:focus-visible,.ts-wrapper.focus .ts-control {
  outline:none!important; border-color:var(--accent)!important; box-shadow:none!important;
}
a:focus-visible { text-decoration:underline; }
.compact-actions,.graph-edge-actions { display:flex; align-items:center; gap:6px; }
.icon-button { flex:0 0 32px; width:32px; height:32px; min-height:32px; padding:0; display:inline-grid; place-items:center; }
.icon-button svg { width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:1.7; }
#adminWorkspace .content-section-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
#adminWorkspace .content-section-heading .button { width:auto; }
#adminWorkspace .admin-content-grid { grid-template-columns:1fr; gap:24px; }
#adminWorkspace .product-card { display:grid; grid-template-columns:minmax(180px,1fr) minmax(160px,2fr) auto; align-items:center; gap:12px; padding:12px; min-height:0; height:auto; }
#adminWorkspace .product-card p { margin:0; font-size:.85rem; }
#adminWorkspace .product-card .product-card__meta { font-size:.75rem; }
#adminWorkspace .product-card .button { width:auto; justify-self:end; }
#adminWorkspace .product-card .dialog-actions { grid-column:3; grid-row:1/3; flex-wrap:nowrap; }
.admin-table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:.85rem; }
.admin-table th { text-align:left; font-size:.75rem; color:var(--muted); font-weight:500; }
.admin-table td,.admin-table th { padding:10px 12px; border-bottom:1px solid var(--line); vertical-align:middle; overflow-wrap:anywhere; }
.admin-table td:last-child { text-align:right; }
.admin-table .compact-actions { justify-content:flex-end; }
.admin-table input { width:100%; min-width:0; padding:7px; border:1px solid transparent!important; background:transparent!important; border-radius:4px; }
.admin-table input:hover { border-color:var(--line)!important; }
.admin-table input:focus { border-color:var(--accent)!important; }
#classificationList { display:block; overflow-x:auto; }
#classificationList .admin-table { min-width:680px; }
.admin-stat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
.admin-stat-grid .admin-table td:last-child { width:70px; font-variant-numeric:tabular-nums; }
.script-metadata { display:grid; gap:8px; width:min(650px,70%); }
.script-metadata input { width:100%; min-width:0; }
#scriptEditorTitle { font-size:1.1rem; font-weight:600; }
#scriptNodeList { position:relative; padding:0; }
.script-graph-node { width:260px!important; height:96px!important; min-height:96px!important; box-sizing:border-box; transition:border-color .15s,box-shadow .15s,opacity .18s ease!important; touch-action:none; cursor:grab; }
.script-graph-node:hover,.script-graph-node.is-moving { transform:none!important; }
.script-graph-node.is-moving { cursor:grabbing; }
.script-graph-node__title { cursor:inherit; user-select:none; padding-right:20px; }
.script-graph-node__condition { pointer-events:none; }
.script-graph-edges { overflow:visible; color:var(--accent); }
.script-graph-edge { transition:opacity .18s ease!important; marker-end:url(#script-arrow); }
.script-graph-edge[role=button] { pointer-events:stroke; cursor:pointer; stroke-width:4px; }
.script-graph-edge--preview { pointer-events:none; stroke-dasharray:6 4; }
.script-graph-port--out-bottom { left:auto!important; right:8px!important; top:auto!important; bottom:8px!important; width:16px!important; height:16px!important; border-radius:50%!important; transform:none!important; cursor:crosshair; }
.graph-edge-actions { position:absolute; z-index:5; background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:4px; box-shadow:0 4px 16px #0002; }
.graph-zoom-controls { position:sticky; top:8px; left:8px; width:max-content; display:flex; gap:4px; height:0; overflow:visible; z-index:4; }
.graph-focus-toggle { position:absolute; top:6px; right:6px; width:26px; height:26px; min-height:26px; border-color:transparent; background:transparent; color:var(--muted); border-radius:6px; cursor:pointer; }
.graph-focus-toggle:hover,.graph-focus-toggle[aria-pressed=true] { background:var(--accent-soft); color:var(--accent-text); border-color:var(--accent); }
.script-graph-node.is-focus-root { border-color:var(--accent); box-shadow:0 10px 28px rgb(0 0 0 / 15%); }
.script-graph-node[data-branch-focus=context] { opacity:.95; }
.script-graph-node[data-branch-focus=muted] { opacity:.2; }
.script-graph-node[data-branch-focus=muted]:focus-within { opacity:.65; }
.script-graph-edge[data-branch-focus=active] { opacity:1; }
.script-graph-edge[data-branch-focus=context] { opacity:.9; }
.script-graph-edge[data-branch-focus=muted] { opacity:.08; }
.script-graph-edge[data-branch-focus=muted]:focus { opacity:.65; }
.graph-focus-status { display:flex; align-items:center; gap:8px; height:32px; margin-left:6px; padding-left:10px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--text); box-shadow:0 4px 16px #0001; font-size:12px; }
.graph-focus-status[hidden] { display:none; }
.graph-focus-status>span { max-width:min(240px,calc(100vw - 180px)); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
@media(prefers-reduced-motion:reduce) { .script-graph-node,.script-graph-edge { transition:none!important; } }
.script-editor-toolbar { justify-content:flex-end; }
#scriptNodeDialog { width:min(960px,calc(100vw - 32px)); max-width:960px; }
#scriptNodeForm { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
#scriptNodeForm>div:first-child,#scriptNodeForm>.script-node-editor__criteria,#scriptNodeForm>.dialog-actions { grid-column:1/-1; }
#scriptNodeForm textarea { resize:vertical; }
#scriptNodeForm .field { align-content:start; }
#scriptNodeForm .field>span { font-size:12px; }
#scriptNodeForm input,#scriptNodeForm textarea { font-size:14px; }
#scriptNodeForm input { height:36px; min-height:36px; }
.ts-wrapper { min-width:0; width:100%; font:inherit; }
.ts-control,.ts-wrapper.single.input-active .ts-control,.ts-dropdown { background:var(--surface)!important; color:var(--text)!important; border:1px solid var(--line-strong); border-radius:6px; box-shadow:none; }
.ts-control { min-height:36px; padding:8px 30px 8px 10px!important; align-items:center; }
.ts-control input { color:var(--text)!important; min-height:0!important; padding:0!important; background:transparent!important; border:0!important; }
.ts-control .item { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; max-width:100%; }
.ts-dropdown { z-index:100; padding:4px; box-shadow:0 8px 24px #0002; }
.ts-dropdown .option { padding:8px 10px; border-radius:4px; }
.ts-dropdown .active { background:var(--accent-soft); color:var(--accent-text); }
.ts-wrapper.disabled { opacity:.55; }
.notyf { z-index:2147483647; }
.notyf__toast { border-radius:8px; cursor:pointer; font-size:14px; max-width:min(400px,calc(100vw - 40px)); }
.script-graph-edge:focus-visible { stroke:var(--text); }
#adminProductList .product-card { grid-template-columns:minmax(180px,1fr) minmax(180px,2fr) auto 32px; }
#adminProductList .product-card .icon-button { grid-column:4; grid-row:1; }
@media(max-width:800px) {
 .admin-stat-grid { grid-template-columns:1fr; }
 #scriptNodeForm { grid-template-columns:1fr; }
 #adminWorkspace .product-card { grid-template-columns:minmax(0,1fr) auto; }
 #adminWorkspace .product-card p { grid-column:1; }
 #adminWorkspace .product-card .dialog-actions { grid-column:2; }
}
@media(prefers-reduced-motion:reduce) { .notyf__toast { animation-duration:1ms!important; animation-delay:0s!important; } }
.script-navigation-controls { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; flex: 0 0 auto; }
.script-navigation-controls[hidden] { display: none; }
.script-navigation-controls .icon-button { width: 28px; height: 28px; min-width: 28px; padding: 5px; border-radius: 7px; }
.script-navigation-controls .icon-button:disabled { opacity: .35; cursor: default; }
#scriptConditionRules { grid-column: 1/-1; min-width: 0; }
.script-condition-row { display: flex; flex-wrap: wrap; align-items: start; gap: 8px; min-width: 0; margin-block: 6px; }
.script-condition-row > select,.script-condition-row > input,.script-condition-row > textarea { flex: 1 1 140px; min-width: 0; max-width: 100%; }
.script-condition-group { flex: 1 1 100%; border-left: 2px solid var(--border); padding-left: 12px; }
.history-workspace-bar { display:flex; align-items:center; gap:8px; min-width:0; padding:8px 12px; border-bottom:1px solid var(--line); }
.history-workspace-bar[hidden] { display:none; }
#historyEventLabel { flex:1; font-size:12px; color:var(--muted); }
.transcript-item.is-future { opacity:.38; }
.transcript-item.is-history-trigger { border-color:#368bea; background:color-mix(in srgb,#368bea 9%,var(--surface)); }
.history-graph-dialog { width:calc(100vw - 48px); height:calc(100dvh - 48px); max-width:1800px; max-height:1100px; padding:0; border:1px solid var(--line-strong); border-radius:12px; background:var(--surface); color:var(--text); }
.history-graph-dialog[open] { display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; }
.history-graph-dialog::backdrop { background:#0008; backdrop-filter:blur(3px); }
.history-graph-dialog > header { display:flex; align-items:center; gap:16px; padding:12px 16px; border-bottom:1px solid var(--line); }
.history-graph-legend { flex:1; font-size:12px; color:var(--muted); }
.history-graph-detail { display:grid; gap:6px; padding:12px 16px; border-bottom:1px solid var(--line); font-size:13px; }
.history-graph-detail p { margin:0; white-space:pre-wrap; }
.history-graph-detail small { color:var(--muted); }
.history-graph-viewport { position:relative; overflow:hidden; touch-action:none; background:var(--bg); }
.history-graph-board { position:absolute; transform-origin:0 0; }
.history-graph-lines { position:absolute; overflow:visible; pointer-events:none; }
.history-graph-line { stroke:#8b8b99; stroke-width:2; }
.history-graph-line.is-route { pointer-events:stroke; cursor:pointer; stroke-width:3; }
.history-graph-line[data-color=blue] { stroke:#368bea; }
.history-graph-line[data-color=red] { stroke:#e65f70; }
.history-graph-line.is-selected,.history-graph-line:focus-visible { stroke-width:6; outline:none; }
.history-graph-node { position:absolute; width:260px; height:100px; padding:12px; display:grid; grid-template-rows:1fr auto; gap:8px; border:2px solid #368bea; border-radius:10px; background:var(--surface); }
.history-graph-node[data-color=red] { border-color:#e65f70; }
.history-graph-node strong { font-size:14px; }
.history-graph-node.is-unvisited { opacity:.35; border-color:var(--line-strong); }
.history-graph-line.is-unvisited { opacity:.18; }
.history-graph-line.is-unconfirmed { stroke-dasharray:8 6; opacity:.65; }
.history-graph-visits { display:flex; gap:4px; flex-wrap:wrap; }
.history-graph-visits button { background:var(--surface); color:var(--text); border:1px solid #368bea; border-radius:5px; min-width:26px; padding:2px 5px; cursor:pointer; }
.history-graph-visits button[data-color=red] { border-color:#e65f70; }
.history-graph-visits button.is-selected { background:#368bea; color:white; }
.history-graph-visits button.is-selected[data-color=red] { background:#b9334b; }
.history-graph-tools { position:absolute; left:12px; top:12px; display:flex; gap:6px; }
.history-graph-note { margin:0; padding:8px 16px; font-size:12px; color:var(--muted); border-top:1px solid var(--line); }
@media(max-width:700px) { .history-graph-dialog { width:calc(100vw - 16px); height:calc(100dvh - 16px); } .history-graph-legend { display:none; } }
@media(prefers-reduced-motion:reduce) { .history-graph-dialog * { transition:none!important; } }
.typesafe-thresholds { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; max-width:520px; margin-top:16px; }
.typesafe-thresholds[hidden] { display:none; }
.typesafe-thresholds label { display:grid; gap:6px; min-width:0; }
.typesafe-thresholds input { width:100%; min-width:0; box-sizing:border-box; }
.typesafe-thresholds p { grid-column:1/-1; margin:0; }
@media(max-width:480px) { .typesafe-thresholds { grid-template-columns:1fr; } }
/* LLM history is an ordinal timeline; it deliberately has no static-script edges. */
.history-mode-filter { display: flex; gap: 4px; margin-bottom: 12px; }
.history-graph-dialog.llm-history-dialog[open] { grid-template-rows: auto minmax(0, 1fr) auto; }
.llm-history-dialog { --history-blue:#2878ca; --history-red:#ce4359; }
[data-theme="dark"] .llm-history-dialog { --history-blue:#81b6f4; --history-red:#f68f9c; }
.llm-history-flow { overflow:auto; padding:24px; background:var(--bg); }
.llm-history-board { position:relative; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:80px; row-gap:40px; width:min(1100px,100%); margin:0 auto; }
.llm-history-lanes { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:80px; color:var(--muted); font-size:.75rem; font-weight:600; letter-spacing:.04em; }
.llm-history-lines { position:absolute; top:0; left:0; overflow:visible; pointer-events:none; }
.llm-history-lines > path { fill:none; stroke:#368bea; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; opacity:.8; }
.llm-history-lines > path[data-color="red"] { stroke:#dc5365; }
.llm-history-episode { --episode-color:var(--history-blue); grid-column:1; position:relative; min-width:0; border:1px solid var(--line); border-radius:10px; padding:18px 20px 0; background:var(--surface); box-shadow:0 2px 6px #00000006; transition:border-color .15s ease; }
.llm-history-episode:hover { border-color:var(--line-strong); }
.llm-history-episode[data-lane="aside"] { grid-column:2; }
.llm-history-episode[data-color="red"] { --episode-color:var(--history-red); }
.llm-history-episode.is-selected { border-color:var(--episode-color); }
.llm-history-card-top { display:flex; align-items:center; gap:10px; margin-bottom:12px; font-size:.72rem; font-variant-numeric:tabular-nums; }
.llm-history-kind { color:var(--episode-color); font-weight:500; padding:3px 8px; border-radius:5px; background:color-mix(in srgb,var(--episode-color) 9%,transparent); }
.llm-history-card-top time { margin-left:auto; color:var(--muted); }
.llm-history-heading { display:block; max-width:100%; border:0; background:transparent; padding:0; color:inherit; font:inherit; font-size:.95rem; font-weight:600; text-align:left; cursor:pointer; overflow-wrap:anywhere; }
.llm-history-heading:hover,.llm-history-heading:focus-visible { color:var(--episode-color); text-decoration:underline; text-underline-offset:3px; }
.llm-history-rendered { display:block; margin:12px 0; color:var(--muted); font-size:.7rem; }
.llm-history-cue { font-size:.9rem; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; margin:10px 0 0; }
.llm-history-details { margin:0 -20px; font-size:.8rem; line-height:1.5; border-top:1px solid var(--line); }
.llm-history-details summary { cursor:pointer; padding:12px 20px; font-weight:500; border-radius:0 0 10px 10px; color:var(--muted); }
.llm-history-details summary::marker { color:var(--episode-color); font-size:.75em; }
.llm-history-details[open] summary { color:var(--text); border-radius:0; }
.llm-history-details summary:hover,.llm-history-details summary:focus-visible { background:var(--surface-hover); color:var(--episode-color); }
.llm-history-detail-body { padding:0 20px 6px; }
.llm-history-section { padding:16px 0; border-top:1px solid var(--line); }
.llm-history-section h3 { font-size:.75rem; font-weight:600; color:var(--muted); margin:0 0 12px; }
.llm-history-section p { margin:0; overflow-wrap:anywhere; }
.llm-history-turn { display:grid; grid-template-columns:76px minmax(0,1fr); gap:10px; padding:8px 0; }
.llm-history-role { color:var(--muted); font-size:.72rem; padding-top:2px; }
.llm-history-turn[data-role="customer"] .llm-history-role { color:var(--episode-color); }
.llm-history-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 20px; margin:0 0 14px; padding:12px; border-radius:6px; background:var(--surface-raised); }
.llm-history-metrics > div:first-child { grid-column:1/-1; }
.llm-history-metrics dt { color:var(--muted); font-size:.7rem; }
.llm-history-metrics dd { margin:3px 0 0; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.llm-history-reason { padding-top:12px; border-top:1px solid var(--line); }
.llm-history-muted,.llm-history-source-note { color:var(--muted); }
.llm-history-section .llm-history-source-note { margin-top:12px; font-size:.7rem; }
.llm-history-materials { list-style:none; margin:0; padding:0; }
.llm-history-materials li { display:grid; grid-template-columns:76px minmax(0,1fr); gap:10px; padding:5px 0; overflow-wrap:anywhere; }
@media(max-width:760px) {
  .llm-history-flow { padding:16px; }
  .llm-history-board { grid-template-columns:minmax(0,1fr); row-gap:32px; }
  .llm-history-lanes { display:none; }
  .llm-history-episode,.llm-history-episode[data-lane="aside"] { grid-column:1; grid-row:auto!important; }
}
