/* Visual treatment only. Board layout and interaction rules remain in their modules. */
:root {
  color-scheme: dark;
  --bg: var(--theme-bg); --panel: var(--theme-panel); --panel2: var(--theme-panel); --line: var(--theme-line);
  --fg: var(--theme-fg); --muted: var(--theme-muted); --accent: var(--theme-primary); --accent2: var(--theme-primary);
  --ok: var(--theme-good); --warn: var(--theme-warn); --bad: var(--theme-bad); --purple: var(--theme-purple);
  --radius: 10px;
}
body { font-size: 14px; line-height: 1.5; }
input, select, textarea, button { border-radius: 8px; }
input::placeholder, textarea::placeholder { color: var(--theme-muted); opacity: 1; }
button { font-weight: 500; }
button:hover { border-color: var(--theme-edge); }
button:active { transform: none; }
button.primary { background: var(--accent2); border-color: var(--accent2); }
button.primary:hover { background: var(--theme-primaryHover); }
.uiIcon { width: 16px; height: 16px; display: inline-block; flex-shrink: 0; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.type { display: inline-flex; align-items: center; color: var(--theme-muted); }
.icon-epic { color: var(--purple); }
.icon-story, .icon-unlock { color: var(--ok); }
.icon-bug, .icon-blocked { color: var(--bad); }
.icon-chore, .icon-clock { color: var(--warn); }
.icon-rework { color: var(--purple); }
header#top { background: var(--panel); border-color: var(--theme-line); }
#top .iconBtn, #newBtn, #bellBtn, #settingsBtn, #logout { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#top .iconBtn .uiIcon, #bellBtn .uiIcon, #settingsBtn .uiIcon, #newBtn .uiIcon { width: 19px; height: 19px; }
#top .iconBtn, #bellBtn, #settingsBtn, #logout { background: transparent; }
#top .iconBtn:hover, #bellBtn:hover, #settingsBtn:hover, #logout:hover { background: var(--panel2); }
.views { gap: 3px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.views button, .views button:first-child, .views button:last-child { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); }
.views button.on, .views button.on:hover { background: var(--surface-selected); border-color: var(--border-selected); color: var(--theme-fg); }
.board { gap: 14px; }
/* Measured chrome includes wrapped rows. Keep column headers and the horizontal scrollbar
   inside the viewport; ticket stacks own their vertical scrolling. */
@media (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (pointer: fine) {
  .board {
    height: calc(100dvh - var(--topH, 0px) - var(--meterH, 0px));
    min-height: 0; overflow: auto; align-items: stretch;
  }
  .board .col { min-height: 0; max-height: 100%; }
  .board .col > h2 { flex-shrink: 0; }
  .board .stack { min-height: 0; flex: 1; overscroll-behavior-y: contain; }
  .board .stack > * { flex-shrink: 0; }
}
/* Recess the lanes so the cards carry the visual weight. */
.col { background: var(--surface-recessed); border-color: var(--theme-line); }
.col > h2 { font-size: 11px; font-weight: 650; letter-spacing: .07em; padding: 13px 14px; border-color: var(--theme-line); }
.col .stack { padding: 9px; gap: 9px; }
.cardItem { background: var(--surface-brand); border-color: var(--theme-line); border-left-width: 2px; border-radius: 9px; padding: 12px; transition: border-color 140ms ease, background-color 140ms ease; }
.cardItem .t { margin: 9px 0 12px; font-size: 14px; line-height: 1.55; font-weight: 500; letter-spacing: -.1px; color: var(--fg); }
.cardItem .meta { gap: 7px; font-size: 11px; min-width: 0; }
.cardItem .k { color: var(--theme-fg); font-size: 11px; }
.cardItem .meta > .chip:not(.pts) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Keep the estimate and assignee anchored independently of wrapping status badges. */
.cardItem { container-type: inline-size; }
.cardItem .cardHeader { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: start; }
.cardItem .cardHeader:has(.cardContext) { grid-template-columns: minmax(0, max-content) minmax(36px, 1fr) max-content; }
.cardItem .cardIdentity { flex-wrap: nowrap; min-width: 0; min-height: 24px; }
.cardItem .cardIdentity > .pickTarget, .cardItem .cardIdentity > .type { flex-shrink: 0; }
.cardItem .cardIdentity > .k { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cardItem .cardAssignment { display: grid; grid-template-columns: max-content 20px; align-items: center; gap: 7px; min-height: 24px; }
.cardItem .cardAssignment .pts { white-space: nowrap; }
.cardItem .ptsUnit { font-size: 9px; font-weight: 500; }
.cardItem .cardAssignee { display: grid; place-items: center; }
/* Tags start beside the key. Extra tags wrap within this column, leaving assignment fixed. */
.cardItem .cardContext { flex-direction: row; flex-wrap: wrap; align-content: start; min-height: 24px; padding-block: 2px; }
.cardItem .cardContext > .chip { flex-shrink: 0; }
/* Narrow board columns keep key and tag together without squeezing out the key. */
@container (max-width: 240px) {
  .cardItem .cardHeader, .cardItem .cardHeader:has(.cardContext) { grid-template-columns: minmax(0, max-content) minmax(36px, 1fr); }
  .cardItem .cardAssignment { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
  .cardItem .cardIdentity { grid-column: 1; grid-row: 2; }
  .cardItem .cardContext { grid-column: 2; grid-row: 2; }
}
.cardItem:focus-within .pick { opacity: 1; }
.chip { border-radius: 6px; border-color: var(--line); padding: 2px 7px; font-size: 11px; line-height: 1.4; background: var(--panel); color: var(--muted); }
.chip .uiIcon { width: 12px; height: 12px; vertical-align: -2px; }
.chip.epic, .chip.rework { color: var(--theme-purple); background: var(--theme-purpleTint); border-color: var(--theme-purpleTint); }
.chip.unblocks, .chip.pr { color: var(--theme-good); background: var(--theme-goodTint); border-color: var(--theme-goodTint); }
.chip.blocked { color: var(--theme-bad); background: var(--theme-badTint); border-color: var(--theme-badTint); }
.chip.pts.none { border-color: transparent; color: var(--theme-muted); background: transparent; }
.avatar { background: var(--theme-edge); font-weight: 600; }
.cardItem .pick { appearance: none; width: 16px; height: 16px; padding: 0; border: 1.5px solid var(--theme-muted); border-radius: 4px; background: var(--theme-panel); position: relative; cursor: pointer; }
.cardItem .pick:checked { background: var(--accent2); border-color: var(--theme-muted); }
.cardItem .pick:checked::after { content: ''; position: absolute; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; left: 4px; top: 1px; transform: rotate(45deg); }
@media (hover: hover) and (pointer: fine) {
  .cardItem:hover { background: var(--surface-brand-hover); border-block-color: var(--theme-edge); border-inline-end-color: var(--theme-edge); transform: none; }
}
/* Each fully colored slice remains a full-height touch target. */
.meter { gap: 4px; }
.meter .bar { height: 44px; border: 0; background: transparent; border-radius: 10px; overflow: hidden; }
.meter .seg { position: relative; min-height: 44px; padding: 0; color: var(--theme-bg); background: transparent; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; transition: opacity 140ms ease; }
.meter .seg::after { display: none; }
.meter .seg.ready { background: var(--ok); }
.meter .seg.active { background: var(--warn); }
.meter .seg.held { background: var(--muted); }
.meter .seg.blocked { background: var(--bad); }
.meter .seg:hover { color: var(--theme-bg); filter: brightness(1.08); }
.meter .seg.picked { box-shadow: inset 0 0 0 2px var(--theme-bg); color: var(--theme-bg); }
.meter .seg.empty { visibility: hidden; }
.meter .seg:focus-visible { outline-offset: -3px; }
/* Popovers share a header and stay scrollable without blurring the whole board. */
.bell, .mobileMenu { background: var(--surface-overlay); border-color: var(--line); border-radius: 14px; box-shadow: 0 14px 44px var(--theme-scrim); overscroll-behavior: contain; }
.bell > header, .popoverHead { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); background: var(--panel); text-transform: none; letter-spacing: 0; color: var(--fg); font-size: 14px; position: sticky; top: 0; z-index: 1; }
.bell > header strong, .popoverHead strong { flex: 1; min-width: 0; }
.popoverClose { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; flex-shrink: 0; background: transparent; border-color: transparent; }
#bellRead { font-size: 12px; color: var(--accent); background: transparent; border-color: transparent; }
#bellList { padding: 8px; display: grid; gap: 8px; }
.notif { grid-template-columns: auto minmax(0, 1fr); padding: 13px 14px; gap: 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.notif.unread { background: var(--surface-brand); }
@media (hover:hover) { .notif:hover { background: var(--surface-brand-hover); } }
.notif .what { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.notif .muted { min-width: 0; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.5; }
.mobileMenu { padding: 8px; gap: 4px; }
.mobileMenu .popoverHead { padding: 4px 4px 10px; background: var(--surface-overlay); }
.mobileMenu > button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-color: transparent; background: transparent; }
.mobileMenu > button:hover { background: var(--panel2); }
.mobileMenu > button .uiIcon { color: var(--theme-muted); }
.mobileAccount { padding: 12px; margin: 4px 0 8px; background: var(--surface-brand); border: 1px solid var(--line); border-radius: 8px; }
.mobileOrganization { padding: 12px 12px 6px; }
#mobileLogout { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  #newBtn { font-size: 14px; }
  #newBtn > span { display: none; }
  #newBtn::before, #mobileMenuBtn::before { content: none; }
  #mobileMenuBtn { display: inline-flex !important; }
  .views { gap: 3px; border-radius: 10px; padding: 3px; background: var(--bg); box-shadow: 0 4px 16px var(--theme-scrim); }
  .views button, .views button:first-child, .views button:last-child { flex-direction: column; gap: 4px; border: 1px solid transparent; border-radius: 7px; font-size: 11px; }
  .views button.on, .views button.on:hover { color: var(--theme-fg); background: var(--surface-selected); border-color: var(--border-selected); box-shadow: none; }
  .views .uiIcon { width: 19px; height: 19px; }
  .boardTabs { gap: 4px; padding: 6px 10px; }
  .boardTabs button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 13px; }
  .boardTabs button.on { color: var(--theme-fg); background: var(--surface-selected); border-color: var(--border-selected); }
  .statusCount { font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 5px; background: var(--panel2); font-variant-numeric: tabular-nums; }
  .boardTabs button.on .statusCount { color: var(--theme-fg); background: var(--theme-hover); }
  .meterMobileRow { gap: 12px; }
  .meterMobileRow button { border-color: transparent; background: transparent; color: var(--muted); }
  .cardItem { padding: 12px; }
  .cardItem .t { font-size: 15px; margin: 6px 0 10px; }
  .cardItem .pick { width: 18px; height: 18px; }
  .cardItem .pick:checked::after { left: 5px; top: 2px; }
  .pickTarget { margin: -12px 0 -12px -12px; }
  .cardItem > .meta:last-child { position: relative; padding-right: 68px; min-height: 44px; align-content: center; }
  .cardMove { position: absolute; inset: 0 -4px 0 auto; margin: auto 0; height: 44px; min-height: 44px; background: transparent; border-color: transparent; color: var(--theme-fg); padding: 5px 10px; }
  .cardMove:hover { background: var(--surface-selected); }
  .bell, .mobileMenu {
    width: auto; max-width: 480px; max-height: min(70dvh, calc(100dvh - var(--mobileNavH) - var(--safeTop) - 24px));
    inset: auto calc(10px + var(--safeRight)) calc(var(--mobileNavH) + 10px) calc(10px + var(--safeLeft));
    margin: 0 auto; border-radius: 16px; overflow-y: auto;
  }
  .bell::backdrop, .mobileMenu::backdrop { background: var(--theme-scrim); }
  .popoverClose { min-width: 44px; min-height: 44px; }
  .mobileMenu > button { min-height: 48px; }
  .notif { grid-template-columns: minmax(0, 1fr); }
  .notif .k { grid-area: 1 / 1; }
  .notif .what { grid-area: 2 / 1; }
  .notif .muted { grid-area: 3 / 1; }
}
@media (min-width: 420px) and (max-width: 700px) {
  .views button, .views button:first-child, .views button:last-child { flex-direction: row; gap: 7px; font-size: 12px; }
  .views .uiIcon { width: 16px; height: 16px; }
}
@media (forced-colors: active) {
  .cardItem .pick { appearance: auto; }
  .cardItem .pick:checked::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .meter .seg, .cardItem { transition: none; } }

.treeRow { position: relative; }
.treeRow:has(button.fold) { padding-right: 64px; min-height: 62px; }
.treeRow .fold.ghost { display: none; }
.treeRow button.fold { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--theme-fg); }
.treeRow button.fold:hover { background: var(--surface-brand-hover); border-color: var(--theme-muted); }
.treeRow button.fold .uiIcon { width: 20px; height: 20px; }
.treeRow button.fold[aria-expanded='true'] .uiIcon { transform: rotate(90deg); }
.boardEmpty { padding: 16px; margin: 8px 0; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  .treeRow:has(button.fold) { padding-right: 12px; }
  .treeRow:has(button.fold) > .type { min-height: 44px; }
  .treeRow:has(button.fold) > .k { margin-right: 52px; }
  .treeRow .t { flex: 1 0 100%; }
  .treeRow .treeProg { margin-left: 0; min-width: 0; }
}

.treeBar button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.treeBar button .uiIcon { width: 18px; height: 18px; }

/* Ticket surfaces carry the tint; their surrounding views stay charcoal. */
.treeRow,.mini,.node { background:var(--surface-brand); }
.sheetHead { background:var(--surface-header); }
