/* Integration only. reference.css is copied verbatim from the supplied HTML. */
[hidden] { display:none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.skip-link { position:fixed; top:8px; left:8px; z-index:100; padding:10px 15px; background:var(--surface); border:1px solid var(--accent); transform:translateY(-180%); }
.skip-link:focus { transform:translateY(0); }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
a.nav-item { text-decoration:none; }
button:disabled, input:disabled, select:disabled { cursor:not-allowed; }
button:disabled { opacity:.55; }
.ref-refresh { cursor:pointer; font:inherit; font-size:10px; }
.ref-empty-cell { text-align:center; color:var(--muted); padding:30px 14px; }
.actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.btn.primary { background:var(--accent); color:var(--on-accent); }
.btn.secondary { background:var(--surface); color:var(--fg); border-color:var(--border-strong); }
.btn.ghost { background:transparent; color:var(--fg); }
.btn.danger { background:var(--danger-soft); color:var(--danger); }
.loading, .load-error { padding:22px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); }
.loading { display:flex; flex-direction:column; gap:14px; min-height:300px; }
.skeleton { height:40px; background:var(--surface-2); border-radius:var(--radius); }
.skeleton-title { width:35%; height:20px; margin-bottom:8px; }
.load-error p { color:var(--muted); margin:12px 0; }
.form-error { padding:10px 12px; margin:12px 0; border:1px solid var(--danger); border-radius:var(--radius); background:var(--danger-soft); color:var(--danger); font-size:12px; }
.client-info { margin:0; }
.client-info > div { display:grid; grid-template-columns:100px minmax(0,1fr); gap:16px; padding:9px 0; border-bottom:1px solid var(--border); }
.client-info dt { color:var(--muted); }
.client-info dd { margin:0; overflow-wrap:anywhere; }
#action-dialog { width:min(580px, calc(100vw - 32px)); max-height:calc(100dvh - 48px); padding:0; margin:auto; background:var(--surface); color:var(--fg); border:1px solid var(--border-strong); border-radius:var(--radius-lg); }
#action-dialog::backdrop { background:rgb(0 0 0 / .35); }
.dialog-head { padding:15px 18px; border-bottom:1px solid var(--border); }
.dialog-head h2 { font-size:14px; margin:0; }
.dialog-body { padding:18px; }
.dialog-body p { overflow-wrap:anywhere; margin:0 0 16px; }
.dialog-body .field { margin-bottom:16px; }
.dialog-body .field > span { color:var(--muted); font-size:11.5px; }
.dialog-body .field small { color:var(--muted); font-size:10.5px; }
.dialog-body input:not([type="checkbox"]):not([type="radio"]), .dialog-body select { background:var(--surface); color:var(--fg); border:1px solid var(--border-strong); border-radius:var(--radius); padding:8px 10px; font:inherit; width:100%; min-width:0; }
.dialog-body .actions input { flex:1; width:0; }
.dialog-body .form-error { margin-bottom:0; }
.dialog-foot { display:flex; justify-content:flex-end; gap:9px; padding:13px 18px; border-top:1px solid var(--border); background:var(--surface-2); }
.ref-source-results { max-height:190px; overflow:auto; margin-bottom:16px; border:1px solid var(--border); }
.ref-source-results > p { padding:12px; margin:0; }
.ref-source-option { display:flex; width:100%; gap:10px; align-items:center; justify-content:space-between; padding:10px; border:0; border-bottom:1px solid var(--border); background:var(--surface); text-align:left; color:var(--fg); cursor:pointer; }
.ref-source-option:hover:not(:disabled) { background:var(--surface-2); }
.ref-source-option b, .ref-source-option small { display:block; }
.ref-source-option small { color:var(--muted); margin-top:3px; }
.notifications { position:fixed; right:20px; bottom:20px; z-index:200; display:flex; flex-direction:column; gap:8px; width:min(420px, calc(100vw - 40px)); }
.notification { display:flex; align-items:flex-start; gap:14px; padding:11px 14px; border:1px solid var(--border-strong); border-left:3px solid var(--accent); border-radius:var(--radius); background:var(--surface); font-size:12px; overflow-wrap:anywhere; }
.notification > span { flex:1; }
.notification.error { border-left-color:var(--danger); }
.notice-close { border:0; background:transparent; color:var(--muted); font:inherit; cursor:pointer; white-space:nowrap; }
#invite-code { overflow-wrap:anywhere; }
.ref-log-pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px 16px; border-top:1px solid var(--border); color:var(--muted); font-size:12px; }
.ref-sources .panel-body > .panel-desc { margin:0; color:var(--muted); font-size:12px; }
.ref-sources .search-form { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:16px 0 0; }
.ref-sources .search-form input { flex:1; min-width:120px; }
.ref-sources input, .ref-sources select { width:100%; min-width:0; padding:8px 10px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--surface); color:var(--fg); font:inherit; }
.ref-sources .field { display:flex; flex-direction:column; gap:6px; }
.ref-sources .field small { color:var(--muted); font-size:11px; }
.ref-sources .client-private-form .grid { margin:16px 0; gap:16px; }
.ref-sources .pagination { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:12px 16px; color:var(--muted); }
.ref-sources .mono { overflow-wrap:anywhere; }
#account-publication { scroll-margin-top:76px; }
.publication-body { display:flex; flex-direction:column; gap:16px; }
.publication-name { color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.publication-summary { display:flex; flex-wrap:wrap; gap:12px 24px; margin:0; }
.publication-summary dt { color:var(--muted); font-size:11px; }
.publication-summary dd { margin:4px 0 0; font-size:12px; }
.publication-actions { display:flex; gap:8px; flex-wrap:wrap; }
.publication-actions .btn { flex:1; }
.publication-body .hint { margin:0; }
.publication-code { padding-top:16px; border-top:1px solid var(--border); }
.source-settings .opt { padding:12px 0; }
.source-settings .field { margin-top:18px; }
.source-settings-account { overflow-wrap:anywhere; }
.account-list-head { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.account-list-head h2 { margin:0; font-size:14px; font-weight:650; }
.account-list-head h2 .panel-desc { margin-left:10px; font-size:12px; font-weight:400; }
.account-list-head p { margin:7px 0 0; font-size:12px; }
.account-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,340px),1fr)); gap:16px; }
.account-card { min-width:0; display:flex; flex-direction:column; padding:18px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); }
.account-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.account-card-head > div { min-width:0; }
.account-card-platform { font-size:11px; color:var(--muted); }
.account-card h3 { margin:5px 0 0; font-size:19px; font-weight:600; overflow-wrap:anywhere; }
.account-card-name { margin:4px 0 0; font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.account-card dl { margin:0; }
.account-card dt { color:var(--muted); font-size:11.5px; }
.account-card dd { margin:0; overflow-wrap:anywhere; }
.account-card .account-card-details { display:grid; gap:7px; margin:18px 0; }
.account-card-details > div { display:grid; grid-template-columns:70px minmax(0,1fr); gap:12px; font-size:12px; }
.account-card .account-card-money { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:16px 0; border-top:1px solid var(--border); }
.account-card-money dd { margin-top:5px; font-size:16px; font-weight:600; }
.account-card .account-card-counts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding-bottom:16px; }
.account-card-counts dd { margin-top:4px; font-size:13px; }
.account-card-foot { margin-top:auto; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding-top:14px; border-top:1px solid var(--border); }
.account-snapshot { color:var(--muted); font-size:10.5px; }
.account-snapshot time { display:block; margin-top:2px; }
.account-empty { grid-column:1 / -1; padding:48px 20px; text-align:center; color:var(--muted); border:1px dashed var(--border-strong); border-radius:var(--radius-lg); }

#page-content, .view, .grid > *, .scope-strip > * { min-width:0; }
/* The reference's mobile layout is retained; long real UIDs must fit its cards. */
.pick-title, .pick-meta, .dh-sub, .req-name, .req-meta, .feed-text { overflow-wrap:anywhere; }
@media (max-width:920px) {
  .app { grid-template-columns:minmax(0,1fr); }
  .sidebar { min-width:0; }
}
@media (max-width:600px) {
  .req { flex-wrap:wrap; }
  .req-body { min-width:0; flex-basis:calc(100% - 52px); }
  .req-actions { margin-left:42px; }
  .panel-head { flex-wrap:wrap; }
  .detail-head { flex-wrap:wrap; }
  .detail-head > .dh-actions { margin-left:auto; }
  .detail-tabs { overflow-x:auto; }
  .src-foot { flex-wrap:wrap; }
  #view-requests .grid, #account-publication .grid, .ref-sources .grid { grid-template-columns:minmax(0,1fr) !important; }
}
/* Short dialogs scroll their body while keeping both the title and actions visible. */
#action-dialog[open] { display:flex; flex-direction:column; overflow:hidden; }
#action-dialog > form { display:flex; flex-direction:column; min-height:0; max-height:inherit; }
#action-dialog .dialog-head, #action-dialog .dialog-foot { flex:none; }
#action-dialog .dialog-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.ref-source-option > span { min-width:0; overflow-wrap:anywhere; }
.ref-source-option .pill { flex:none; }

/* Desktop windows keep navigation beside the work, including below 920px.
   The source reference stylesheet/templates remain intact. */
@media (min-width:760px) and (max-width:1120px) {
  .reference-console.app { grid-template-columns:184px minmax(0,1fr); }
  .reference-console .sidebar { position:sticky; top:0; height:100vh; overflow-y:auto; padding:10px 8px; }
  .reference-console .brand { padding:4px 6px 12px; }
  .reference-console .side-nav { flex-direction:column; overflow:visible; gap:1px; padding-bottom:8px; }
  .reference-console .side-label { display:block; padding:9px 8px 4px; }
  .reference-console .nav-item { width:100%; padding:7px 8px; white-space:nowrap; }
  .reference-console .nav-item.is-active { box-shadow:inset 2px 0 0 var(--accent); }
  .reference-console .side-foot { margin-top:auto; gap:6px; padding-top:10px; }
  .reference-console .conn { gap:6px; padding:0 4px; font-size:11px; }
  .reference-console .views { padding:14px 12px 24px; }
  .reference-console .topbar { padding:9px 12px; gap:8px; flex-wrap:nowrap; }
  .reference-console .topbar > .tag { display:none; }
  .reference-console .topbar > div:first-child { min-width:0; }
  .reference-console .topbar h1 { font-size:14px; }
  .reference-console .topbar .btn { padding:7px 9px; }
  .reference-console .topbar .icon-btn, .reference-console .ref-refresh { flex:none; }
  .reference-console .grid-2-1, .reference-console .grid-1-1 { grid-template-columns:minmax(0,1fr); }
  .reference-console .task-workspace { grid-template-columns:minmax(0,1fr); }
  .reference-console .task-rail { position:static; }
  .reference-console .task-list { flex-direction:row; overflow-x:auto; padding:9px; }
  .reference-console .task-item { flex:0 0 244px; min-width:0; }
  .reference-console .account-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .reference-console .account-card { padding:14px; }
  .reference-console .account-card-money dd { font-size:15px; }
  .reference-console .account-card-wide-money .account-card-money { grid-template-columns:minmax(0,1fr); }
  .reference-console .panel-head { flex-wrap:wrap; }
  .reference-console .kpi-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:1120px) {
  .panel, .task-workspace > *, .field, .opt > div, .req-meta > span { min-width:0; }
  .input, .select { min-width:0; max-width:100%; }
  .req-meta, .rule-note, .hint { overflow-wrap:anywhere; }
  .req { grid-template-columns:auto minmax(0,1fr); }
  .req-actions { grid-column:2; padding-left:0; margin-left:0; justify-content:flex-start; }
  .pick-summary b, .dh-sub { overflow-wrap:anywhere; }
  .task-list { overscroll-behavior-x:contain; }
  .table-wrap { max-width:100%; }
}
@media (min-width:760px) and (max-width:1120px) {
  .ref-sources table.ds, [data-view="logs"] table.ds { table-layout:fixed; }
  .ref-sources table.ds th, .ref-sources table.ds td,
  [data-view="logs"] table.ds th, [data-view="logs"] table.ds td { white-space:normal; overflow-wrap:anywhere; padding:9px 10px; }
  .ref-sources table.ds th:first-child { width:30%; }
  .ref-sources table.ds th:nth-child(2) { width:20%; }
  .ref-sources table.ds th:nth-child(3) { width:16%; }
  .ref-sources table.ds th:nth-child(4) { width:14%; }
  .ref-sources table.ds th:nth-child(5) { width:20%; }
  [data-view="logs"] table.ds th:nth-child(1) { width:18% !important; }
  [data-view="logs"] table.ds th:nth-child(2) { width:12% !important; }
  [data-view="logs"] table.ds th:nth-child(3) { width:21% !important; }
  [data-view="logs"] table.ds th:nth-child(4) { width:39% !important; }
  [data-view="logs"] table.ds th:nth-child(5) { width:10% !important; }
}
@media (max-width:960px) {
  .reference-console .kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width:759px) {
  .reference-console .brand { padding-bottom:9px; }
  .reference-console .sidebar { padding:8px 12px; }
  .reference-console .side-nav { margin-top:6px; }
  .reference-console .side-nav .nav-item { flex:0 0 auto; width:auto; }
  .reference-console .side-foot { flex-direction:row; flex-wrap:wrap; gap:6px 14px; margin-top:6px; padding-top:6px; }
  .reference-console .brand-sub { display:none; }
  .reference-console .topbar > .tag { display:none; }
  .reference-console .topbar { gap:8px; }
  .reference-console .topbar > div:first-child { margin-right:auto; }
  .reference-console .topbar-spacer { display:none; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none !important; transition:none !important; } }

/* ── in-app guide (client only; content is local and never fetched) ─────────── */
.client-guide-link { margin-top: 8px; }
.guide-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.guide-toc { position: sticky; top: 64px; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.guide-toc-title { margin: 0 0 6px; padding: 0 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.guide-toc a { display: block; padding: 6px 8px; border-radius: var(--radius); color: var(--muted); font-size: 12.5px; }
.guide-toc a:hover { background: var(--fg-soft); color: var(--fg); }
.guide-toc a.is-active { background: var(--surface-2); color: var(--fg); font-weight: 650; box-shadow: inset 2px 0 0 var(--accent); }
.guide-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.guide-section { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); scroll-margin-top: 64px; }
.guide-section:focus:not(:focus-visible) { outline: none; }
.guide-section h2 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.guide-section p, .guide-section li { font-size: 13px; line-height: 1.7; }
.guide-section p { margin: 0 0 10px; }
.guide-section ul, .guide-section ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.guide-section li::marker { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.guide-section > *:last-child { margin-bottom: 0; }
.guide-note { padding: 9px 12px; border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent-soft); color: color-mix(in oklch, var(--accent) 62%, var(--fg)); }
.guide-code { margin: 0 0 12px; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-family: var(--font-mono); font-size: 11.5px; }
.guide-code code { font: inherit; }
.guide-section table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.guide-section th, .guide-section td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.guide-section th { color: var(--muted); font-weight: 500; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
.guide-section tbody tr:last-child td { border-bottom: 0; }
.guide-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }
.guide-links a { padding: 4px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--muted); }
.guide-links a:hover { color: var(--fg); border-color: var(--accent); }
@media (max-width: 900px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .guide-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .guide-toc-title { flex-basis: 100%; margin-bottom: 2px; }
  .guide-toc a.is-active { box-shadow: inset 0 -2px 0 var(--accent); }
  .guide-section { scroll-margin-top: 12px; }
}
@media (max-width: 759px) {
  .client-guide-link { margin-top: 6px; }
  .guide-section { padding: 14px; }
}

/* Follow-parameter row: keep the three controls on one baseline and equal width,
   including when the responsive grid collapses to a single column. A bare
   switch used to shrink to its own intrinsic width and pull the row apart. */
#multiplier-panel + .grid,
.task-detail .detail-panes .grid.grid-3 { align-items: end; }
.task-detail .detail-panes .grid.grid-3 > .field { min-width: 0; }
.task-detail .detail-panes .grid.grid-3 .input,
.task-detail .detail-panes .grid.grid-3 .select { width: 100%; }
.task-detail .detail-panes .grid.grid-3 .switch { margin-top: 8px; }
