/* Light theme only, on purpose: the legacy client is light and every colour is set here. */
:root {
  --contract: #6d4fd8;
  --contract-soft: #f1edfd;
  /* Neutrals */
  --app-bg: #EEF1F5;
  --chrome: #FFFFFF;
  --chrome-2: #F4F6F9;
  --surface: #FFFFFF;
  --surface-alt: #F7F9FB;
  --line: #DCE2EA;
  --line-soft: #EAEEF3;
  --line-strong: #C3CCD7;
  --text: #121A26;
  --text-2: #4A5565;
  --text-3: #6B7686;
  --text-off: #A3ACB8;
  /* Accent and selection */
  --accent: #2459D6;
  --accent-ink: #1A43A8;
  --accent-soft: #EDF2FD;
  --accent-line: #BCCDF3;
  --sel: #DCE6FB;
  --sel-strong: #2459D6;
  /* Field states: a mandatory field keeps its yellow, as softer amber */
  --mand: #FFF8DC;
  --mand-line: #E6C766;
  --miss: #C7322E;
  --miss-soft: #FCEDEC;
  --ro-bg: #F5F7FA;
  --ro-line: #E1E6ED;
  --static: #3E64A8;
  /* Mode bands */
  --new-bg: #ECF7EF;
  --new-line: #3C9A5F;
  --new-ink: #1C4A2C;
  --display-bg: #F1F4F8;
  --display-line: #8592A3;
  --display-ink: #313B48;
  --maintain-bg: #FFF5E0;
  --maintain-line: #D19A1E;
  --maintain-ink: #5A3D05;
  --info-bg: #EAF1FD;
  --info-line: #8CAEE8;
  --warn-bg: #FDF1E6;
  --warn-line: #DE8A3E;
  /* Depth, shape and focus */
  --scrim: rgba(18, 26, 38, 0.32);
  --shadow: 0 12px 32px rgba(18, 26, 38, 0.18), 0 2px 6px rgba(18, 26, 38, 0.08);
  --shadow-1: 0 1px 2px rgba(18, 26, 38, 0.05), 0 1px 3px rgba(18, 26, 38, 0.06);
  --focus: 0 0 0 3px rgba(36, 89, 214, 0.22);
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 10px;
  --green: #2E8B4A;
  --red: #C7322E;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--app-bg); color: var(--text); font: 12px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
#app { height: 100vh; display: grid; grid-template-rows: 26px 1fr 22px; }

/* Menu bar */
.menubar { display: flex; align-items: stretch; height: 26px; background: var(--chrome); border-bottom: 1px solid var(--line-soft); padding: 0 6px; gap: 2px; position: relative; z-index: 30; }
.menubar .brand { display: flex; align-items: center; gap: 6px; padding: 0 10px 0 2px; color: var(--text-2); font-weight: 600; letter-spacing: 0.1px; }
.brand-mark { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); display: inline-block; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 4px; border-radius: 1px; background: #FFFFFF; }
.menu-wrap { position: relative; display: flex; }
.menu-top { border: 0; background: transparent; padding: 0 10px; margin: 2px 0; cursor: default; border-radius: var(--r-sm); }
.menu-top:hover:not([disabled]), .menu-top.open { background: var(--accent-soft); }
.menu-top[disabled] { color: var(--text-off); }
.menu-drop { position: absolute; left: 0; top: 25px; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 3px 4px; z-index: 40; }
.menu-item { display: flex; align-items: center; width: 100%; border: 0; background: transparent; padding: 4px 12px 4px 24px; border-radius: var(--r-sm); text-align: left; cursor: default; white-space: nowrap; }
.menu-item:hover:not([disabled]), .menu-item.hot:not([disabled]) { background: var(--accent-soft); }
.menu-item[disabled] { color: var(--text-off); }
.menu-item .keys { margin-left: auto; padding-left: 24px; color: var(--text-3); }
.menu-item.checked::before { content: ""; position: absolute; left: 10px; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-top: 1px; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 3px 0; }
.menu-head { padding: 4px 14px 2px 24px; color: var(--text-3); font-size: 11px; }
.menubar .spacer { flex: 1; }
.variant { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.variant-seg { display: flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; height: 20px; margin: auto 0; background: var(--chrome-2); padding: 1px; gap: 1px; }
.variant-seg button { border: 0; background: transparent; padding: 0 10px; cursor: pointer; border-radius: 4px; color: var(--text-2); }
.variant-seg button + button { border-left: 0; }
.variant-seg button.on { background: var(--surface); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-1); }

/* Main area */
.main { display: grid; grid-template-columns: auto 1fr; min-height: 0; }
/* The left navigation takes the new look, as every other screen does (LOOK.md). It keeps the original LeftSpine's parts
   in their order (LeftSpine.cs:529-940): a header naming the tree, the tree, the splitter's grip, the stack of buttons
   and the overflow strip. The tree keeps its lines as quiet guides and its boxes as chevrons; a node shows selected while
   the tree has the focus (HideSelection); no button shows pressed until one is clicked (CheckOnClick, LeftSpine.cs:731). */
.spine-panel { min-height: 0; min-width: 0; display: grid; overflow: hidden; background: var(--chrome); border-right: 1px solid var(--line); }
.spine { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.spine-head { display: flex; align-items: center; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -0.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spine-trees { min-height: 0; overflow: auto; padding: 8px; }
.spine-tree.closed { display: none; }
.tree-note { padding: 8px 10px; color: var(--text-3); white-space: normal; }
.tree-folder, .tree-item { position: relative; display: flex; align-items: center; gap: 6px; height: 30px; padding-right: 10px; border-radius: var(--r-sm); color: var(--text-2); white-space: nowrap; cursor: default; outline: none; }
.tree-folder { padding-left: 2px; color: var(--text); font-weight: 600; }
.tree-item { padding-left: 30px; }
.tree-items { position: relative; margin-bottom: 4px; }
.tree-items::before { content: ''; position: absolute; left: 13px; top: 0; bottom: 6px; width: 1px; background: var(--line); }
.tree-folder:hover, .tree-item:hover { background: var(--chrome-2); }
.tree-folder:focus, .tree-item:focus { background: var(--sel); color: var(--accent-ink); }
.tree-item:focus::before { content: ''; position: absolute; left: 12px; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--accent); }
.tree-label { overflow: hidden; text-overflow: ellipsis; }
.tree-ico { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.tree-folder:focus .tree-ico, .tree-item:focus .tree-ico { color: var(--accent); }
.tree-box { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-sm); color: transparent; font-size: 0; }
.tree-box::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: translate(0, -2px) rotate(45deg); }
.tree-box.shut::before { transform: translate(-2px, 0) rotate(-45deg); }
.tree-box:hover { background: var(--line-soft); }
.spine-grip { position: relative; height: 11px; border-top: 1px solid var(--line-soft); }
.spine-grip::before { content: ''; position: absolute; left: 50%; top: 4px; width: 32px; height: 3px; margin-left: -16px; border-radius: 2px; background: var(--line-strong); }
.spine-buttons { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0 8px; }
.spine-btn { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; text-align: left; cursor: default; white-space: nowrap; }
.spine-btn:hover { background: var(--chrome-2); color: var(--text); }
.spine-btn.on { background: var(--accent-soft); color: var(--accent-ink); }
.spine-btn.on::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.spine-btn svg { width: 20px; height: 20px; flex: none; color: var(--text-3); }
.spine-btn:hover svg { color: var(--text-2); }
.spine-btn.on svg { color: var(--accent); }
.spine-overflow { height: 10px; }

/* Panes and tab strips */
.panes { display: flex; min-width: 0; min-height: 0; gap: 0; position: relative; }
.pane { flex: 1 1 0; min-width: 0; display: grid; grid-template-rows: 28px 1fr; min-height: 0; position: relative; }
.pane + .pane { border-left: 3px solid var(--line); }
.pane.focus .tabstrip { box-shadow: inset 0 -2px 0 var(--accent); }
.tabstrip { display: flex; align-items: flex-end; background: var(--chrome-2); border-bottom: 1px solid var(--line); padding: 0 6px; gap: 2px; overflow: hidden; }
.tab { display: flex; align-items: center; gap: 6px; height: 24px; max-width: 290px; padding: 0 6px 0 10px; border: 1px solid transparent; border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; background: transparent; color: var(--text-2); cursor: default; white-space: nowrap; overflow: hidden; }
.tab:hover:not(.on) { background: var(--line-soft); }
.tab.on { background: var(--surface); color: var(--text); height: 26px; margin-bottom: -1px; border-color: var(--line); box-shadow: inset 0 2px 0 var(--accent); }
.tab .t-ref { font-weight: 600; }
.tab .t-sub { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.tab .t-dirty { color: var(--accent); font-weight: 700; }
.tab .t-wait { width: 7px; height: 7px; border-radius: 50%; background: var(--warn-line); flex: none; }
.tab .t-x { border: 0; background: transparent; width: 16px; height: 16px; line-height: 14px; border-radius: 4px; color: var(--text-3); padding: 0; }
.tab .t-x:hover { background: var(--line-soft); color: var(--text); }
.tab-kind { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tab-kind.k-finder { background: #7E8997; }
.tab-kind.k-quote { background: #3C8A54; }
.tab-kind.k-risk { background: var(--accent); }
.pane-body { min-height: 0; min-width: 0; background: var(--surface); position: relative; overflow: hidden; }

/* Status bar */
.status { display: flex; align-items: center; background: var(--chrome-2); border-top: 1px solid var(--line); padding: 0 8px; gap: 0; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.status > span { padding: 0 10px; border-right: 1px solid var(--line-soft); }
.status > span:first-child { padding-left: 2px; font-weight: 600; color: var(--text); }
.status .msg { border-right: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.status .grow { flex: 1; border-right: 0; }
.sample-mark { border: 1px solid #E6C766; background: #FFF8DC; color: #6B5300; padding: 0 8px; border-radius: 999px; font-size: 11px; line-height: 16px; }

/* Toolbars */
.toolbar { display: flex; align-items: center; gap: 2px; height: 30px; padding: 0 8px; background: var(--chrome); border-bottom: 1px solid var(--line-soft); white-space: nowrap; position: relative; z-index: 6; }
.tb { display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid transparent; background: transparent; border-radius: var(--r-sm); color: var(--text); cursor: default; }
.tb:hover:not([disabled]) { background: var(--accent-soft); color: var(--accent-ink); }
.tb:active:not([disabled]) { background: var(--sel); }
.tb[disabled] { color: var(--text-off); }
.tb[disabled] u, .menu-item[disabled] u { text-decoration: none; }
.tb[disabled] svg { opacity: 0.45; }
.tb svg { width: 16px; height: 16px; flex: none; color: var(--text-2); }
.tb:hover:not([disabled]) svg { color: inherit; }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; }
.tb-flow { font-weight: 600; }
.tb-more-wrap { position: relative; display: flex; }
.tb-more { font-weight: 700; padding: 0 9px; }
.tb-more.open { background: var(--accent-soft); }
.tb-menu { display: none; left: auto; right: 0; }
.tb-menu.open { display: block; }
.tb-drop-wrap { position: relative; display: flex; }
.tb-menu.tb-dropdown { left: 0; right: auto; top: 100%; min-width: 200px; }
.tb-drop.open { background: var(--accent-soft); }
.tb-caret { margin-left: 2px; font-size: 9px; color: var(--text-2); }
.tb.tb-drop.dim { color: var(--text-off); }

/* Record tab */
.rec { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.rec > * { flex: none; }
.rec > .rec-body { flex: 1 1 auto; }
.rec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 20px; padding: 6px 14px 5px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: var(--surface); }
.rec-head .h-item { display: flex; gap: 6px; align-items: baseline; }
.rec-head .h-lbl { color: var(--text-3); font-size: 11px; }
.rec-head .h-val { font-weight: 600; }
.rec-head .h-assured { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.rec-head .h-ref { font-size: 15px; letter-spacing: 0.2px; }
.rec-head .h-ver { color: var(--text-3); font-weight: 400; }
.band { display: flex; align-items: center; gap: 10px; min-height: 24px; padding: 2px 14px; border-left: 3px solid; border-bottom: 1px solid var(--line-soft); }
.band.m-new { background: var(--new-bg); border-left-color: var(--new-line); color: var(--new-ink); }
.band.m-display { background: var(--display-bg); border-left-color: var(--display-line); color: var(--display-ink); }
.band.m-maintain { background: var(--maintain-bg); border-left-color: var(--maintain-line); color: var(--maintain-ink); }
.band .b-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issues-btn { display: flex; align-items: center; gap: 6px; height: 20px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; cursor: default; white-space: nowrap; }
.issues-btn.has { border-color: #EBB4B2; background: var(--miss-soft); color: var(--miss); }
.issues-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: #9BA5B0; }
.issues-btn.has .dot { background: var(--miss); }
.mini { height: 20px; padding: 0 9px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); cursor: default; }
.mini:hover:not([disabled]) { background: var(--accent-soft); }
.mini[disabled], .btn[disabled] { color: var(--text-off); background: var(--chrome-2); border-color: var(--line); }

/* Page strip */
.strip { display: flex; align-items: center; gap: 0; height: 26px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; overflow: hidden; }
.strip .s-lead { color: var(--text-2); margin-right: 8px; }
.strip .s-page { border: 0; background: transparent; padding: 2px 6px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; border-radius: var(--r-sm); cursor: pointer; }
.strip .s-page.cur { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; text-decoration: none; }
.strip .s-arrow { display: inline-flex; align-items: center; margin: 0 6px; color: var(--text-3); }
.strip .s-arrow svg { width: 16px; height: 16px; }
.strip .s-count { display: inline-block; min-width: 16px; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--miss-soft); color: var(--miss); font-weight: 600; font-size: 11px; text-decoration: none; }

/* Issues tray */
.tray { border-bottom: 1px solid #EBC5C3; background: #FFF8F7; padding: 8px 14px 10px; max-height: 168px; overflow: auto; }
.tray-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.tray-head .t-title { font-weight: 600; color: var(--miss); }
.tray-head .t-keys { color: var(--text-3); }
.tray-head .mini { margin-left: auto; }
.tray-cols { display: flex; gap: 28px; align-items: flex-start; }
.tray-col { min-width: 200px; max-width: 640px; }
.tray-page { font-weight: 600; margin-bottom: 2px; }
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, auto); column-gap: 22px; justify-content: start; }
.tray-list li { padding: 1px 6px; margin-left: -6px; border-radius: var(--r-sm); cursor: pointer; }
.tray-list li:hover { background: var(--miss-soft); }
.tray-list li.cur { background: #F8D9D9; }
.tray-empty { color: var(--new-ink); }

/* Record body */
.rec-body { display: flex; min-height: 0; min-width: 0; position: relative; }
.surface { flex: 1; min-width: 0; overflow: auto; background: var(--app-bg); padding: 12px 14px 28px; }
.section-title { position: sticky; top: -12px; z-index: 3; display: flex; align-items: center; gap: 10px; margin: 0 -14px 10px; padding: 6px 14px; background: var(--app-bg); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--text); }
.section-title .st-count { color: var(--miss); font-weight: 600; }
.section + .section { margin-top: 18px; }
.page { position: relative; isolation: isolate; }
.grp { position: absolute; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.grp.untitled-panel { border-color: transparent; background: transparent; }
.grp-title { position: absolute; top: -8px; left: 10px; padding: 0 6px; background: var(--surface); border-radius: 4px; color: var(--text-2); font-weight: 600; line-height: 14px; font-size: 11.5px; white-space: nowrap; }
.lbl { position: absolute; white-space: nowrap; color: var(--text); line-height: 14px; pointer-events: none; }
.lbl.r { text-align: right; }
.lbl.wrap { white-space: normal; line-height: 13px; }
.lbl .ln { display: block; }
.lbl.mand-l { font-weight: 600; }
.static { position: absolute; color: var(--static); white-space: nowrap; line-height: 14px; font-weight: 500; }
.f { position: absolute; height: 22px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); padding: 0 6px; outline: none; min-width: 0; transition: border-color 0.12s, box-shadow 0.12s; }
.f:hover:not([readonly]):not([disabled]):not(:focus) { border-color: #A9B4C2; }
select.f { padding: 0 1px 0 3px; }
textarea.f { padding: 3px 5px; resize: none; line-height: 15px; }
.f:focus { border-color: var(--accent); box-shadow: var(--focus); }
.f.mand { background: var(--mand); border-color: var(--mand-line); }
.f.ro, .f[readonly] { background: var(--ro-bg); border-color: var(--ro-line); color: var(--text); }
.f.ro:focus, .f[readonly]:focus { box-shadow: var(--focus); border-color: var(--accent-line); }
.f.ro.disp { background: var(--surface); border-color: var(--line-strong); }
.f.miss, .cell.miss { box-shadow: inset 3px 0 0 var(--miss); border-color: #E3A09D; }
.f.cur-issue, .grid td .cell.cur-issue { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 1; }
.f.dt { padding: 0 2px; }
.f.flash, .cell.flash { animation: flash 1.2s ease-out 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px rgba(36,89,214,0.45); } 100% { box-shadow: 0 0 0 0 rgba(36,89,214,0); } }
.f.changed { color: var(--accent); }
.chk { position: absolute; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.chk input { margin: 0; width: 13px; height: 13px; accent-color: var(--accent); }
.chk.lf { justify-content: flex-end; }
.decor { position: absolute; height: 22px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); color: var(--text); padding: 0 8px; white-space: nowrap; overflow: hidden; }
.decor:hover:not([disabled]) { background: var(--accent-soft); border-color: var(--accent-line); }
.decor[disabled] { color: var(--text-off); border-color: var(--line); background: var(--chrome-2); }

/* Grids */
.grid { position: absolute; border: 1px solid var(--line); background: #FFFFFF; overflow: auto; border-radius: var(--r-sm); }
.grid table { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 100%; }
.grid th, .grid td { height: 20px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 400; }
.grid thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-alt); color: var(--text-2); font-weight: 600; font-size: 11.5px; padding: 0 6px; border-bottom: 1px solid var(--line); }
.grid th.rh { width: 30px; text-align: right; padding: 0 6px; color: var(--text-3); background: var(--surface-alt); position: sticky; left: 0; z-index: 2; }
.grid thead th.rh { z-index: 3; }
.grid td .cell { width: 100%; height: 19px; border: 0; background: transparent; padding: 0 5px; outline: none; display: block; line-height: 19px; overflow: hidden; text-overflow: ellipsis; }
.grid td select.cell { padding: 0 2px; }
.grid td .cell:focus { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.grid td .cell.mand { background: var(--mand); }
.grid td .cell.ro { color: var(--text); }
/* A grid whose cells wrap (WinForms WrapMode True): a row grows to show its whole text. */
.grid.wrap td { height: auto; white-space: normal; vertical-align: top; }
.grid.wrap td .cell.ro { height: auto; white-space: normal; line-height: 16px; padding-top: 2px; padding-bottom: 2px; overflow-wrap: anywhere; }
.grid td.ck { text-align: center; }
.grid th.gfill, .grid td.gfill { border-right: 0; padding: 0; }
.grid thead th.gfill { background: var(--surface); border-bottom-color: var(--line-soft); }
.grid td.ck input { margin: 3px 0 0; accent-color: var(--accent); }
.grid tr.newrow th.rh { color: #AAB1BA; }
/* WinForms marks a grid's current row with an arrow in its row header. */
.grid tr.cur > th.rh::before { content: "\25B6"; float: left; font-size: 7px; line-height: 20px; color: var(--text); }
.grid tr.newrow td { background: var(--surface-alt); }
.grid.list tbody tr { cursor: default; }
.grid.list tbody tr:hover td { background: var(--accent-soft); }
.grid.list tbody tr.sel td, .grid.list tbody tr.sel th.rh { background: var(--sel); }
.grid.list:focus { outline: none; }
.grid.list:focus tbody tr.sel td, .grid.list:focus tbody tr.sel th.rh { background: var(--sel-strong); color: #FFFFFF; }
.grid.list:focus tbody tr.sel td .cell { color: #FFFFFF; }
.grid.list:focus tbody tr.sel td .cell.mand { background: transparent; }
.grid.list:focus tbody tr.sel td select.cell option { background: #FFFFFF; color: var(--text); }
/* A row an editable grid's row header picked keeps the selection colours over its cells, as a DataGridView draws it. */
.grid:not(.list) tbody tr.sel td, .grid:not(.list) tbody tr.sel th.rh { background: var(--sel-strong); color: #FFFFFF; }
.grid:not(.list) tbody tr.sel td .cell { background: transparent; color: #FFFFFF; }
.grid:not(.list) tbody tr.sel td select.cell option { background: #FFFFFF; color: var(--text); }
.grid .num { text-align: right; }
.grid td.sel-cell { background: var(--sel-strong) !important; color: #FFFFFF; font-weight: 600; }
.grid .frz { position: sticky; left: 32px; z-index: 1; background: #FFFFFF; box-shadow: inset -1px 0 0 var(--line); }
.grid thead th.frz { z-index: 3; background: var(--chrome); }
.grid td.count { text-align: right; padding-right: 10px; cursor: pointer; }
.grid td.count:hover { background: #E6EEFC; }

/* Dock, stage */
.dock { flex: none; border-left: 1px solid var(--line); background: var(--surface); display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.layer-head { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px 0 14px; background: var(--chrome-2); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; min-width: 0; }
.layer-head .lh-title { font-weight: 600; }
.layer-head .lh-cap { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.layer-head .lh-actions { margin-left: auto; display: flex; gap: 4px; }
.dock-body { overflow: auto; padding: 10px 12px 16px; }
.stage { flex: 1; min-width: 0; display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; background: var(--app-bg); }
.stage-body { min-height: 0; overflow: auto; padding: 10px 12px 20px; }
.stage-split { display: grid; grid-template-columns: 340px 1fr; gap: 12px; min-height: 0; overflow: hidden; padding: 10px 12px 12px; }
.pagelist { border: 1px solid var(--line); background: var(--surface); overflow: auto; }
.pagelist-head { padding: 5px 8px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--chrome); display: flex; align-items: center; }
.pagelist-head .mini { margin-left: auto; }
.pagelist .pl-row { display: grid; grid-template-columns: 30px 1fr 52px; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); cursor: default; }
.pagelist .pl-row:hover { background: #F2F6FD; }
.pagelist .pl-row.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.pl-num { font-weight: 700; color: var(--text-2); }
.pl-main { min-width: 0; }
.pl-main div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-sub { color: var(--text-3); }
.pl-share { text-align: right; font-weight: 600; }
.stage-page { overflow: auto; min-width: 0; }
.wtabs { display: flex; gap: 2px; margin: 12px 0 0; border-bottom: 1px solid var(--line); }
.wtab { border: 1px solid var(--line); border-bottom: 0; background: var(--chrome-2); color: var(--text-2); padding: 3px 12px; border-radius: var(--r-sm) var(--r-sm) 0 0; cursor: default; }
.wtab.on { background: var(--surface); color: var(--text); font-weight: 600; margin-bottom: -1px; box-shadow: inset 0 2px 0 var(--accent); }
.wtab-body { background: var(--surface); border: 1px solid var(--line); border-top: 0; padding: 8px; position: relative; }
.flowgrid { position: static; }
.subtitle { color: var(--text-2); font-weight: 600; margin: 8px 0 4px; }

/* Risk Tracking dock form */
.form-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; align-items: center; }
.form-rows label { text-align: right; color: var(--text); }
.form-rows .pair { display: flex; gap: 6px; }
/* Risk Tracking puts each pair side by side, as legacy does: Entered beside Modified, Entry Time beside QC Time. */
.form-rows.two { grid-template-columns: max-content max-content max-content 1fr; }
.inp { height: 22px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0 6px; background: var(--surface); min-width: 0; }
.inp[readonly] { background: var(--ro-bg); border-color: var(--ro-line); }
.inp.mand { background: var(--mand); border-color: var(--mand-line); }
textarea.inp { height: auto; padding: 4px 6px; resize: vertical; line-height: 16px; }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dialogue { display: block; margin-top: 12px; border: 1px solid var(--line); }
.dialogue thead, .dialogue tbody { display: block; }
.dlg-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 82px 52px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.dlg-row:last-child { border-bottom: 0; }
.dlg-row > * { padding: 4px 6px; min-width: 0; border-right: 1px solid var(--line-soft); overflow-wrap: break-word; }
.dlg-row > *:last-child { border-right: 0; }
.dlg-row .d-reason { font-weight: 600; color: var(--text-2); }
.dlg-row.new { background: #FFFDF0; }
.dlg-row.new td:has(> select, > textarea) { padding: 0; }
.dlg-row.new select, .dlg-row.new textarea { margin: 3px; padding: 0 3px; width: calc(100% - 6px); }
.dlg-row.new textarea { padding: 4px 6px; }
/* The headers wrap, as a DataGridView's do, so each shows its whole text in a narrow dock. */
.dlg-row.dlg-head { background: var(--chrome); border-bottom: 1px solid var(--line); font-weight: 600; line-height: 14px; align-items: end; text-align: left; }
.dlg-empty { padding: 6px 8px; color: var(--text-3); }
.note { color: var(--text-3); margin-top: 10px; }

/* Sheets: modal to their tab only */
.sheet-wrap { position: absolute; inset: 0; background: var(--scrim); display: flex; flex-direction: column; align-items: center; padding: 16px 0; z-index: 20; }
/* The room above a sheet, 70 px or below its tab's page strip, gives way first when the sheet is tall. */
.sheet-wrap::before { content: ""; flex: 0 1000 var(--sheet-top, 54px); }
.sheet { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--r-lg); max-width: calc(100% - 40px); outline: none; flex: 0 1 auto; min-height: 0; }
.sheet-title { display: flex; align-items: center; height: 32px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line-soft); font-weight: 600; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.sheet-body { padding: 12px 14px; }
.sheet-body p { margin: 0 0 10px; white-space: pre-line; }
/* A message box's icon sits left of its text, as legacy's panelIcon does. */
.sheet-body.q-body { display: flex; gap: 12px; align-items: flex-start; }
.sheet-body.q-body p { white-space: pre-wrap; }
.sheet-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); background: var(--surface-alt); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.sheet-foot .right { margin-left: auto; display: flex; gap: 8px; }
/* A question over a dialog: the dialog's own scrim already dims the workspace. */
.sheet-wrap.q-over { background: transparent; }
.btn { height: 26px; padding: 0 14px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); cursor: default; white-space: nowrap; font-weight: 500; }
.btn:hover:not([disabled]) { background: var(--accent-soft); }
.btn:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.btn.default, .mini.default { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }
.btn.default:hover:not([disabled]), .mini.default:hover:not([disabled]) { background: var(--accent-ink); }
.sheet .authnotes { margin-top: 10px; color: var(--text-2); }
.sheet .authnotes div { margin: 2px 0; }
.sheet .grid.static-grid { position: relative; }

/* Finders */
.finder { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.finder > * { flex: none; }
.finder > .finder-body { flex: 1 1 auto; }
.finder-body { display: flex; min-height: 0; min-width: 0; overflow: hidden; }
.criteria { flex: none; overflow: auto; border-right: 1px solid var(--line); background: var(--chrome-2); padding: 12px 12px 12px; }
.criteria .crit-title { display: flex; align-items: center; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.criteria .crit-title .mini { margin-left: auto; font-weight: 400; }
.crit-rail { flex: none; width: 26px; border: 0; border-right: 1px solid var(--line); background: var(--chrome); cursor: pointer; padding: 10px 0; display: flex; justify-content: center; }
.crit-rail:hover { background: var(--accent-soft); }
.crit-rail span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 600; color: var(--accent-ink); }
.crit-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.crit-why { color: var(--miss); }
.crit-ok { color: var(--text-3); }
.results { flex: 1; min-width: 0; display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.results-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.results-head .rh-title { font-weight: 600; }
.results-head .rh-sub { color: var(--text-3); }
.results-body { position: relative; min-height: 0; overflow: hidden; padding: 0; }
.results-body .grid { inset: 0; border: 0; }
.results-body.wf-list { display: grid; grid-template-rows: auto 1fr; }
.wf-list .results-head .rh-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.wf-list-grid { position: relative; min-height: 0; overflow: hidden; }
.empty-note { padding: 24px; color: var(--text-3); }
.wf-top { display: flex; gap: 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-alt); align-items: flex-start; }
.wf-top .grid { position: relative; }
.wf-help { color: var(--text-2); max-width: 340px; padding-top: 4px; }
.wf-help b { font-weight: 600; }
.stale { color: var(--warn-line); font-weight: 600; }

/* Landing */
.landing { position: absolute; inset: 0; overflow: auto; padding: 28px 32px; background: var(--surface-alt); }
.landing h2 { font-size: 13px; margin: 22px 0 8px; font-weight: 600; color: var(--text-2); }
.landing .sub { color: var(--text-3); margin-bottom: 14px; }
.lcards { display: grid; grid-template-columns: repeat(3, minmax(0, 290px)); gap: 12px; max-width: 900px; }
.lcard { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 12px 12px 12px 14px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 3px; box-shadow: 0 1px 2px rgba(20, 28, 40, 0.06); }
.lcard:hover, .lcard:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; box-shadow: 0 2px 6px rgba(11, 87, 208, 0.18); }
.lcard:active { transform: translateY(1px); }
.lc-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); }
.lc-icon svg { width: 20px; height: 20px; }
.lc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lc-title { font-size: 13.5px; font-weight: 600; color: var(--accent-ink); }
.lc-opens { color: var(--text-2); }
.lc-detail { color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lc-count b { color: var(--text); font-weight: 600; }
.lc-go { flex: none; font-size: 26px; line-height: 1; color: var(--accent); }
.recent { max-width: 900px; border: 1px solid var(--line); background: var(--surface); border-radius: 3px; overflow: hidden; }
.recent-row { display: grid; grid-template-columns: 170px 1fr 200px 120px 64px; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: center; }
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover, .recent-row:focus-visible { background: var(--accent-soft); outline: none; }
.recent-row:focus-visible { box-shadow: inset 3px 0 0 var(--accent); }
.recent-row .rr-ref { font-weight: 600; color: var(--accent-ink); }
.recent-row:hover .rr-ref { text-decoration: underline; }
.recent-row .rr-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row .rr-when { color: var(--text-3); }
.rr-chip { display: inline-block; padding: 0 7px; border-radius: 9px; border: 1px solid var(--display-line); background: var(--display-bg); color: var(--display-ink); font-size: 11px; line-height: 17px; }
.rr-chip.k-quote, .rr-chip.k-wf-N { border-color: var(--new-line); background: var(--new-bg); color: var(--new-ink); }
.rr-chip.k-wf-E, .rr-chip.k-wf-I, .rr-chip.k-wf-A, .rr-chip.k-wf-R { border-color: var(--maintain-line); background: var(--maintain-bg); color: var(--maintain-ink); }
.recent-row .rr-go { justify-self: end; color: var(--accent); font-weight: 600; opacity: 0.55; }
.recent-row:hover .rr-go, .recent-row:focus-visible .rr-go { opacity: 1; }
.recent-head { font-weight: 600; color: var(--text-3); background: var(--chrome); cursor: default; }
.recent-head:hover { background: var(--chrome); }
.kbd { display: inline-block; padding: 0 4px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 2px; background: var(--surface); font-size: 11px; line-height: 14px; color: var(--text-2); }
.tool { position: absolute; inset: 0; display: flex; flex-direction: column; }
.tool-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 24px; background: var(--surface-alt); }

/* Login */
.login-backdrop { position: fixed; inset: 0; background: #C9D0D9; display: flex; align-items: center; justify-content: center; }
.login { position: relative; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--r-lg); overflow: hidden; }
.login-head { position: absolute; left: 0; top: 0; right: 0; background: linear-gradient(135deg, #1A43A8, #2459D6); color: #FFFFFF; }
.login-head .lg-env { position: absolute; left: 12px; top: 6px; font-size: 11px; color: #BFD0EA; }
.login-head .lg-ver { position: absolute; right: 12px; top: 6px; font-size: 11px; color: #BFD0EA; }
.login-head .lg-name { position: absolute; left: 24px; bottom: 26px; font-size: 30px; font-weight: 300; letter-spacing: 0.5px; }
.login-progress { position: absolute; }
.login-progress > span { position: absolute; }
.login-progress .lg-loading { font-size: 14px; line-height: 22px; color: var(--text-2); white-space: nowrap; }
.login-progress .lg-busy { box-sizing: border-box; border: 3px solid var(--line); border-top-color: #1E3A66; border-radius: 50%; animation: lg-spin 0.9s linear infinite; }
@keyframes lg-spin { to { transform: rotate(360deg); } }
.login-head .lg-sub { position: absolute; left: 26px; bottom: 12px; font-size: 12px; color: #BFD0EA; }
.login .lbl { pointer-events: auto; }
.login-foot { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; color: var(--text-3); font-size: 10.5px; }
.login .btn { position: absolute; padding: 0; }
.f.datebtn { padding: 0; background: var(--chrome); border-color: var(--line-strong); }
.f.datebtn::after { content: ""; position: absolute; left: 50%; top: 8px; margin-left: -4px; border: 4px solid transparent; border-top: 5px solid var(--text-2); }
.f.datebtn.ro::after { border-top-color: #A2A9B2; }
.grid tr.sel .cell.lit { color: #FFFFFF !important; }
.calendar { position: fixed; z-index: 60; width: 190px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); padding: 4px; font-size: 11px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; height: 22px; font-weight: 600; }
.cal-move { width: 20px; height: 20px; border: 1px solid transparent; background: none; padding: 0; color: var(--text-2); }
.cal-move:hover, .cal-day:hover { border-color: var(--line-strong); }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-days > span { color: var(--text-3); height: 18px; line-height: 18px; }
.cal-day { height: 20px; border: 1px solid transparent; background: none; padding: 0; color: var(--text); font: inherit; }
.cal-day.other { color: var(--text-3); }
.cal-day.on { background: var(--sel-strong); color: #FFFFFF; }
.cal-day:disabled { color: var(--line-strong); }
.page.compact { font-size: 11px; }
.page.compact .grp-title { font-size: 11px; }

/* Menus: every dropdown is in the DOM; closed ones are hidden. A submenu opens on hover. */
.menu-drop.closed { display: none; }
.menu-sub { position: relative; }
.menu-sub > .menu-drop.sub { display: none; left: 100%; top: -4px; }
.menu-sub:hover > .menu-drop.sub, .menu-sub:focus-within > .menu-drop.sub { display: block; }
.menu-item.has-sub .keys { padding-left: 16px; }

/* Generic legacy screens: the designer tree in the new-UX look. */
/* 8.25 pt, the legacy dialog font, so designer-sized labels and check boxes fit their boxes. */
.lpage { margin: 0; font-size: 11px; }
.lpage .grp-title { font-size: 11px; }
.lbtn { text-overflow: ellipsis; color: var(--text); }
.lbtn[disabled] { color: var(--text-3); }
.lpanel, .lsplit { position: absolute; }
.ltabs { position: absolute; border: 1px solid var(--line); background: var(--surface); border-radius: 2px; }
.ltab-strip { display: flex; align-items: flex-end; gap: 2px; padding: 0 4px; background: var(--chrome); border-bottom: 1px solid var(--line); overflow: hidden; }
.ltab { height: calc(100% - 3px); border: 1px solid var(--line); border-bottom: 0; background: var(--chrome-2); padding: 0 10px; border-radius: var(--r-sm) var(--r-sm) 0 0; color: var(--text-2); white-space: nowrap; cursor: default; }
.ltab:hover { color: var(--text); }
.ltab.on { background: var(--surface); color: var(--text); font-weight: 600; margin-bottom: -1px; height: calc(100% - 2px); box-shadow: inset 0 2px 0 var(--accent); }
.llist { position: absolute; border: 1px solid var(--line-strong); background: #FFFFFF; overflow: auto; padding: 1px 0; outline: none; }
.llist .li { padding: 1px 6px; white-space: nowrap; cursor: default; line-height: 17px; }
.llist .li.sel { background: var(--sel); }
.llist:focus .li.sel { background: var(--sel-strong); color: #FFFFFF; }
.llist:focus .li.sel .tree-ico, .llist:focus .li.sel .tglyph { color: inherit; }
.lpic { position: absolute; border: 1px dashed var(--line); background: repeating-linear-gradient(45deg, #F7F8FA, #F7F8FA 6px, #EEF1F4 6px, #EEF1F4 12px); }
.lweb { position: absolute; border: 1px solid var(--line-strong); background: #FFFFFF; }
.lstrip { position: absolute; background: var(--chrome); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1px; padding: 0 3px; }
.lstrip .tb { height: calc(100% - 3px); }
.lother { position: absolute; border: 1px solid var(--line-soft); background: var(--surface-alt); }
.lother.lscroll { background: #F0F0F0; border-color: var(--line-soft); display: flex; color: #7A828C; font-size: 7px; }
.lscroll.v { flex-direction: column; }
.lscroll .sb-a { flex: none; display: grid; place-items: center; }
.lscroll.v .sb-a { height: 17px; }
.lscroll.h .sb-a { width: 17px; }
.lscroll .sb-t { flex: 0 1 40px; margin: 2px; background: #CDCDCD; border-radius: 1px; }
.lspin { position: absolute; display: flex; flex-direction: column; }
.lspin button { flex: 1; min-height: 0; border: 1px solid var(--line-strong); background: var(--chrome); padding: 0; font-size: 9px; line-height: 1; color: var(--text-2); }
.lspin button.wd3 { font-family: "Wingdings 3"; font-size: 8px; display: grid; place-items: center; }
.lbtn.wd3 { font-family: "Wingdings 3"; font-size: 9px; }
.msg-icon { width: 32px; height: 32px; display: block; }
.msg-icon.mi-question, .msg-icon.mi-information { color: var(--accent); }
.msg-icon.mi-warning { color: var(--warn-line); }
.msg-icon.mi-error { color: var(--red); }
.lspin button:hover:not([disabled]) { background: var(--accent-soft); }
.lspin button[disabled] { color: #A2A9B2; }
.lspin button + button { border-top: 0; }
.lsheet { display: flex; flex-direction: column; }
.lsheet > .toolbar { flex: none; }
.lsheet-body { flex: 1; min-height: 0; overflow: auto; background: var(--surface-alt); }
.lsheet-mode { margin-left: 10px; font-weight: 400; color: var(--text-3); }
.sheet-title .issues-btn { margin-left: auto; }
.sheet-title .issues-btn + .sheet-x { margin-left: 8px; }
.dock.lscreen .dock-body { background: var(--surface-alt); }
.stage.lscreen .stage-body { background: var(--surface-alt); }

/* Generic screens: what a registration's enable rules disable, its mandatory controls, and the marks Save leaves. */
.f.off, .f.off[readonly] { background: var(--chrome-2); border-color: var(--ro-line); color: var(--text-3); }
.chk.off, .lbl.off { color: var(--static); }
.lgrp.off > .grp-title { color: var(--text-3); }
.ltab.off { color: #A2A9B2; font-weight: 400; }
.ltab[disabled] { cursor: default; }
.grid.off { background: var(--chrome-2); }
.grid.off th, .grid.off td { color: var(--text-3); }
.llist.off { background: var(--chrome-2); color: var(--text-3); }
.grid.mand, .llist.mand { background: var(--mand); border-color: var(--mand-line); }
/* A disabled mandatory control: pale yellow, flat and borderless, as legacy draws it. */
.f.mandoff, .f.mandoff[readonly], .f.mandoff[disabled] { background: var(--mand); border-color: transparent; color: var(--text-3); }
.lbl.lbl-cmd { pointer-events: auto; cursor: default; }
.lpic.painted { background: none; border-style: solid; }
.grid.bare { background: var(--surface); }
.grid td.picked { box-shadow: inset 0 0 0 2px var(--accent); }
/* frmMultiSection groups its headers: section blue, TRIEA yellow, ATIA coral (risk-subscreens.md:169). */
.grid thead th[data-hc="section"] { background: #CFE0F7; }
.grid thead th[data-hc="triea"] { background: #FFF2A8; }
.grid thead th[data-hc="atia"] { background: #F8C4B4; }
.llist.lview { padding-top: 0; }
.llist .lv-head { position: sticky; top: 0; display: flex; background: var(--chrome); border-bottom: 1px solid var(--line); }
.llist .lv-head span { padding: 1px 6px; border-right: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; }
.sheet-title .sheet-x { margin-left: auto; border: 0; background: transparent; font-size: 16px; line-height: 1; padding: 0 4px; color: var(--text-2); cursor: default; }
.sheet-title .sheet-x:hover { background: var(--miss-soft); color: var(--miss); }
.grid.miss, .llist.miss, .chk.miss { box-shadow: inset 3px 0 0 var(--miss); }
.lscreen .tray { flex: none; }
.lscreen .issues-btn { margin-left: auto; }
.layer-head .lh-group { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px 0 6px; border: 1px solid var(--line); border-radius: 2px; }
.layer-head .lh-gt { color: var(--text-3); font-size: 11px; }
/* A label legacy fills at run time keeps its box while empty, as the WinForms label does. */
.lbl, .static { min-height: 14px; }
.f.mono { font-family: Consolas, "Courier New", monospace; font-size: 11.5px; white-space: pre; }
.f.dtp { padding-right: 20px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: right 9px center, right 5px center; background-size: 4px 4px; background-repeat: no-repeat; }
.lweb iframe { width: 100%; height: 100%; border: 0; background: #FFFFFF; }
.lweb-doc { margin: 0; padding: 10px 14px; height: 100%; overflow: auto; font: 11.5px/1.45 Consolas, "Courier New", monospace; white-space: pre-wrap; background: #FFFFFF; }
.ltree .li { display: flex; align-items: center; gap: 3px; }
.ltree .tglyph { display: inline-flex; width: 12px; color: var(--text-3); }
.ltree .tglyph svg { width: 12px; height: 12px; }
.f.total, .f.total[readonly] { border-color: transparent; background: transparent; text-align: right; }
/* A combo that cannot be changed: its arrow stays, greyed. */
.f.cbo-ro { padding-right: 16px; background-image: linear-gradient(45deg, transparent 50%, #A2A9B2 50%), linear-gradient(135deg, #A2A9B2 50%, transparent 50%); background-position: right 9px center, right 5px center; background-size: 4px 4px; background-repeat: no-repeat; text-overflow: ellipsis; }
/* The browser's own list button sits, unseen, over the drawn arrow, so the arrow opens the list and only one shows. */
.f.fcombo::-webkit-calendar-picker-indicator { opacity: 0; width: 12px; margin: 0; padding: 0; cursor: default; }
.f.fcombo { padding-right: 3px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: right 9px center, right 5px center; background-size: 4px 4px; background-repeat: no-repeat; }
.chk.wrap { white-space: normal; line-height: 12px; align-items: center; }
.chk.wrap span { min-width: 0; }
.lbtn.wrap { white-space: normal; line-height: 13px; }

/* The risk pages laid out by their structure (flowPage in app.js, design/LOOK.md): each group a card in a page grid, each element in its
   card's grid, sized and spaced by the design system rather than the designer's pixels. */
.page.flow { display: grid; gap: 12px; align-items: start; width: 100%; font-size: 12.5px; }
.page.flow .fgrp { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 10px 14px 12px; }
.page.flow .fgrp.plain { background: transparent; border-color: transparent; box-shadow: none; padding: 4px 2px; }
.page.flow .fgrp-title { margin: 0 0 8px; font-weight: 600; font-size: 12.5px; color: var(--text); letter-spacing: 0.1px; }
.page.flow .fgrid { display: grid; row-gap: 6px; align-items: center; min-width: 0; }
.page.flow .fgrid > * { position: relative; left: auto; top: auto; min-width: 0; }
.page.flow .f { width: calc(100% - 10px); height: 28px; }
.page.flow textarea.f { min-height: 28px; align-self: stretch; }
.page.flow .lbl { padding-right: 8px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); line-height: 16px; }
.page.flow .lbl.r { justify-self: end; text-align: right; }
.page.flow .lbl.wrap { white-space: normal; }
.page.flow .static { justify-self: start; }
.page.flow .static.shown { color: var(--text); }
.page.flow .chk { height: 28px; padding-right: 10px; }
.page.flow .chk.lf { justify-self: end; }
.page.flow .decor { height: 28px; justify-self: start; max-width: calc(100% - 10px); }
.page.flow .grid { align-self: stretch; width: calc(100% - 10px); }
.page.flow .lspin { height: 28px; width: 18px; }

/* contract slot: panel */
.lcards { grid-template-columns: repeat(4, minmax(0, 260px)); max-width: 1100px; }
.lcard[data-landing="from-contract"] { border-left-color: var(--contract); }
.lcard[data-landing="from-contract"] .lc-icon { background: var(--contract-soft); color: var(--contract); }
.lc-sample { grid-column: 2; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.lc-sample-go { border: 0; background: transparent; padding: 0; font: inherit; color: var(--contract); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lc-sample-go:hover, .lc-sample-go:focus-visible { color: var(--accent-ink); outline: none; }
.lcard[data-landing="from-contract"].drop-on { border: 2px dashed var(--contract); border-left-width: 3px; background: var(--contract-soft); box-shadow: 0 0 0 4px var(--contract-soft); }
.dock.cpanel { grid-template-rows: auto minmax(0, 1fr); background: var(--surface); }
.cp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); color: var(--contract); }
.cp-head > svg { width: 20px; height: 20px; flex: none; }
.cp-htext { flex: 1; display: flex; flex-direction: column; min-width: 0; color: var(--text); }
.cp-htext b { font-size: 14px; font-weight: 600; }
.cp-htext span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-close { border: 0; background: transparent; color: var(--text-3); width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; }
.cp-close:hover { background: var(--chrome-2); color: var(--text); }
.cp-close svg { width: 16px; height: 16px; }
.cp-scroll { min-height: 0; overflow: auto; padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.cp-summary { display: flex; flex-direction: column; gap: 8px; }
.cp-from { font-size: 12px; color: var(--text-3); }
.cp-sum { font-size: 13px; color: var(--text); }
.cp-muted { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.cp-primary { align-self: flex-start; height: 34px; padding: 0 16px; border: 0; border-radius: var(--r-md); background: var(--contract); color: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.cp-primary[disabled] { background: var(--line-strong); cursor: default; }
.cp-secondary { height: 32px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; }
.cp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-done, .cp-stop { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--green); }
.cp-stop { color: var(--red); }
.cp-done svg, .cp-stop svg { width: 16px; height: 16px; flex: none; }
.cp-reading { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.cp-reading b { color: var(--text); font-weight: 600; }
.cp-spin { flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--contract-soft); border-top-color: var(--contract); animation: cp-spin 0.9s linear infinite; }
@keyframes cp-spin { to { transform: rotate(360deg); } }
.cp-failed { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--miss); border-radius: var(--r-md); background: var(--miss-soft); }
.cp-failed p { margin: 0; font-size: 13px; color: var(--text-2); }
.cp-failed .cp-muted { font-size: 12px; color: var(--text-3); }
.cp-ftitle { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--red); }
.cp-ftitle svg { width: 16px; height: 16px; flex: none; }
.cp-group { display: flex; flex-direction: column; gap: 4px; }
.cp-gtitle { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); padding: 4px 0 2px; border-bottom: 1px solid var(--line-soft); }
.cp-group.needs .cp-gtitle { color: var(--text-2); }
.cp-row { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: var(--r-md); border: 1px solid var(--line-soft); background: var(--surface); cursor: pointer; }
.cp-row:hover { border-color: var(--contract); }
.cp-row.entered { border-left: 3px solid var(--contract); }
.cp-row.is-unsure:not(.changed), .cp-row.is-unsure.entered { border-left: 3px solid var(--warn-line); background: var(--warn-bg); }
.cp-row.refused { border-left: 3px solid var(--red); background: var(--miss-soft); }
.cp-row.changed { border-left: 3px solid var(--line-strong); }
.cp-row.waiting:not(.is-unsure) { background: var(--chrome-2); }
.cp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.cp-label { font-size: 12px; color: var(--text-3); }
.cp-value { font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.cp-passage { font-size: 12px; color: var(--text-2); font-style: italic; line-height: 1.4; }
.cp-page { font-style: normal; color: var(--contract); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
a.cp-page:hover { text-decoration: underline; }
.cp-page svg { width: 12px; height: 12px; }
.cp-why { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text-2); line-height: 1.4; }
.cp-why svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.cp-why.bad span { white-space: pre-line; }
.cp-why.wait { color: var(--text-3); }
.cp-chip { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--chrome-2); color: var(--text-3); }
.cp-chip svg { width: 12px; height: 12px; }
.cp-chip.ok { background: var(--contract-soft); color: var(--contract); }
.cp-chip.bad { background: var(--miss-soft); color: var(--red); }
.cp-enter { flex: none; height: 24px; padding: 0 10px; border: 1px solid var(--warn-line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.cp-enter:hover:not([disabled]) { background: var(--warn-bg); }
.cp-enter[disabled] { border-color: var(--line); color: var(--text-off); cursor: default; }

/* contract slot: marks */
/* A value the contract put in has a line along its bottom, amber when Claude was unsure. It is an inset shadow, so the
   background, the left bar and the outline stay with the mandatory, missing and current-issue marks, and focus keeps it. */
.f.from-contract, .cell.from-contract { --contract-line: var(--contract); box-shadow: inset 0 -2px 0 var(--contract-line); }
.f.from-contract.m-unsure, .cell.from-contract.m-unsure { --contract-line: var(--warn-line); }
.f.from-contract.miss, .cell.from-contract.miss { box-shadow: inset 3px 0 0 var(--miss), inset 0 -2px 0 var(--contract-line); }
.f.from-contract:focus { box-shadow: var(--focus), inset 0 -2px 0 var(--contract-line); }
.grid td .cell.from-contract:focus { box-shadow: inset 0 0 0 1px var(--accent), inset 0 -2px 0 var(--contract-line); }
/* The drawing by the label takes no width, so a label that just fits beside its box still fits. It rides in the label's
   right padding, raised beside the end of the text. */
.lbl .cmark { position: absolute; right: 0; top: -4px; width: 10px; height: 10px; color: var(--contract); }
