/* bbtrack — one stylesheet. Tokens first; theme colours are light-dark(light, dark),
   label colours are fixed fills with a paired text colour.
   Theme follows the system unless <html data-theme="light|dark"> overrides it. */

@font-face { font-family: "Plex Sans"; src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Neutrals and accent (Monday-style: cool greys, blue primary) */
  --bg:        light-dark(#F6F7FB, #181B34);
  --surface:   light-dark(#FFFFFF, #292F4C);
  --rule:      light-dark(#D0D4E4, #4B4E69);
  --muted:     light-dark(#676879, #9699A6);
  --text:      light-dark(#323338, #D5D8DF);
  --signal:    light-dark(#006AD6, #6AA8FF);   /* primary blue: buttons, focus, today line */
  --on-signal: light-dark(#FFFFFF, #181B34);
  --danger:    light-dark(#C9314A, #FF7B8A);   /* overdue dates, errors */
  --warn:      light-dark(#A35200, #FFB454);   /* due within a few days */
  --hover:     light-dark(#EEF0F7, #323856);

  /* Status labels: solid fill + text colour, same in both themes. */
  --lbl-new: #C4C4C4;          --lbl-new-ink: #323338;
  --lbl-accepted: #8E4BC8;     --lbl-accepted-ink: #FFFFFF;
  --lbl-in_progress: #FDAB3D;  --lbl-in_progress-ink: #323338;
  --lbl-blocked: #D83A52;      --lbl-blocked-ink: #FFFFFF;
  --lbl-done: #00C875;         --lbl-done-ink: #323338;
  --lbl-wont_do: #757575;      --lbl-wont_do-ink: #FFFFFF;
  /* Priority labels */
  --lbl-low: #6BA6FD;          --lbl-low-ink: #323338;
  --lbl-normal: #5559DF;       --lbl-normal-ink: #FFFFFF;
  --lbl-high: #401694;         --lbl-high-ink: #FFFFFF;
  --lbl-urgent: #323338;       --lbl-urgent-ink: #FFFFFF;
  /* Project group colours (board groups, timeline project bars) */
  --group-1: #579BFC; --group-2: #A25DDC; --group-3: #00C875; --group-4: #FDAB3D;
  --group-5: #E2445C; --group-6: #037F4C; --group-7: #FF642E; --group-8: #66CCFF;

  /* Type */
  --font-sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --t-micro: 500 11px/16px var(--font-mono);
  --t-meta:  400 12px/16px var(--font-sans);
  --t-ui:    400 13px/20px var(--font-sans);
  --t-body:  400 15px/24px var(--font-sans);
  --t-title: 600 18px/24px var(--font-sans);
  --t-page:  600 22px/28px var(--font-sans);

  /* Space, shape, motion */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-0: 0; --r-1: 3px; --r-2: 8px;
  --float: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .12);
  --ease: 120ms ease-out;
  --topbar-h: 44px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; --float: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .5); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: var(--t-ui); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font: var(--t-page); }
h2 { font: var(--t-title); }
h3 { font: 500 13px/20px var(--font-sans); }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code, kbd, .mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.meta { font: var(--t-meta); color: var(--muted); }
.label { font: 500 12px/16px var(--font-sans); color: var(--muted); }
.key { font: 500 12px/16px var(--font-mono); color: var(--muted); letter-spacing: -.01em; }
.prose { font: var(--t-body); max-width: 68ch; }
.prose p + p { margin-top: var(--s3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: var(--r-1); }

kbd {
  display: inline-block; min-width: 18px; padding: 0 4px;
  font: var(--t-micro); text-align: center; color: var(--muted);
  border: 1px solid var(--rule); border-radius: var(--r-1); background: var(--surface);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s6);
  height: var(--topbar-h); padding: 0 var(--s4);
  background: var(--bg); border-bottom: 1px solid var(--rule);
}
.wordmark {
  display: flex; align-items: center; gap: var(--s2);
  font: 500 14px/1 var(--font-mono); text-decoration: none; letter-spacing: -.02em;
}
.wordmark .logo { display: block; flex: none; }
.nav { display: flex; gap: var(--s1); }
.nav a, .nav span {
  padding: 6px var(--s2); border-radius: var(--r-1);
  color: var(--muted); text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--signal); border-radius: 0; }
.nav span[aria-disabled] { opacity: .55; cursor: default; }
.nav .count { font: var(--t-micro); margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; align-items: center; gap: var(--s2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 28px; padding: 0 var(--s3);
  font: 500 13px/1 var(--font-sans); color: var(--text); text-decoration: none;
  background: transparent; border: 1px solid var(--rule); border-radius: var(--r-1);
  cursor: pointer; transition: background var(--ease), border-color var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn-primary:hover { background: var(--signal); border-color: var(--text); }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); border-color: transparent; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-lg { height: 36px; padding: 0 var(--s4); font-size: 14px; }

/* ---------- Form controls ---------- */
.field { display: grid; gap: var(--s1); }
.input, select.input, textarea.input {
  width: 100%; padding: 5px var(--s2);
  font: var(--t-ui); color: var(--text);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-1);
}
textarea.input { font: var(--t-body); min-height: 120px; resize: vertical; }
.input:hover { border-color: var(--muted); }
.input:focus-visible { outline-offset: 0; border-color: var(--signal); }
.field .error { font: var(--t-meta); color: var(--danger); }

/* ---------- Avatar ---------- */
.avatar {
  width: 20px; height: 20px; border-radius: var(--r-1); object-fit: cover;
  background: var(--rule); vertical-align: middle; flex: none;
}
.avatar-sm { width: 16px; height: 16px; }

/* ---------- Labels: status and priority as solid cells ---------- */
.lbl {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 96px; height: 24px; padding: 0 var(--s2);
  font: 500 12px/1 var(--font-sans); white-space: nowrap;
  border-radius: var(--r-1);
}
.lbl-sm { min-width: 0; height: 20px; padding: 0 6px; font-size: 11px; }
.lbl-new { background: var(--lbl-new); color: var(--lbl-new-ink); }
.lbl-accepted { background: var(--lbl-accepted); color: var(--lbl-accepted-ink); }
.lbl-in_progress { background: var(--lbl-in_progress); color: var(--lbl-in_progress-ink); }
.lbl-blocked { background: var(--lbl-blocked); color: var(--lbl-blocked-ink); }
.lbl-done { background: var(--lbl-done); color: var(--lbl-done-ink); }
.lbl-wont_do { background: var(--lbl-wont_do); color: var(--lbl-wont_do-ink); }
/* project and milestone statuses reuse ticket colours */
.lbl-planned { background: var(--lbl-new); color: var(--lbl-new-ink); }
.lbl-active { background: var(--lbl-in_progress); color: var(--lbl-in_progress-ink); }
.lbl-on_hold { background: var(--lbl-accepted); color: var(--lbl-accepted-ink); }
.lbl-closed { background: var(--lbl-done); color: var(--lbl-done-ink); }
.lbl-low { background: var(--lbl-low); color: var(--lbl-low-ink); }
.lbl-normal { background: var(--lbl-normal); color: var(--lbl-normal-ink); }
.lbl-high { background: var(--lbl-high); color: var(--lbl-high-ink); }
.lbl-urgent { background: var(--lbl-urgent); color: var(--lbl-urgent-ink); }
.is-wont_do .title { text-decoration: line-through; color: var(--muted); }

/* ---------- Dates ---------- */
.date { font: var(--t-micro); font-weight: 400; color: var(--muted); white-space: nowrap; }
.date.overdue { color: var(--danger); font-weight: 500; }
.date.due-soon { color: var(--warn); font-weight: 500; }
/* Days left until a project's or milestone's end date */
.days-left { font-size: .75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.days-left.is-soon { color: var(--warn); font-weight: 500; }
.days-left.is-overdue { color: var(--danger); font-weight: 500; }

/* ---------- Page layout ---------- */
.page { padding: var(--s6) var(--s4) var(--s8); max-width: 1120px; }
.page-narrow { max-width: 640px; margin: 0 auto; }
.stack > * + * { margin-top: var(--s4); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: var(--s6) 0; }

/* ---------- Empty state ---------- */
.empty { padding: var(--s8) 0; display: grid; gap: var(--s3); justify-items: start; }
.empty p { color: var(--muted); max-width: 52ch; }

/* ---------- Toasts (floating: rounded + shadow) ---------- */
.toasts {
  position: fixed; bottom: var(--s4); left: 50%; transform: translateX(-50%); z-index: 50;
  display: grid; gap: var(--s2); justify-items: center;
}
.toast {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--text); color: var(--bg);
  border-radius: var(--r-2); box-shadow: var(--float);
}
.toast .btn { color: var(--bg); border-color: transparent; }
.toast.is-error { background: var(--lbl-blocked); color: var(--lbl-blocked-ink); }

/* ---------- Sign-in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; padding: var(--s4); }
.signin-box { width: min(360px, 100%); display: grid; gap: var(--s5); }
.signin-box .wordmark { font-size: 18px; }

/* ---------- Style guide ---------- */
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.sg-grid > div { padding: var(--s3); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: grid; gap: var(--s2); }
.swatch { height: 40px; border: 1px solid var(--rule); }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s6); }


/* ---------- Utilities ---------- */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.count { font: var(--t-micro); color: var(--muted); margin-left: 4px; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.check { display: flex; align-items: center; gap: var(--s2); }
.form-narrow { max-width: 640px; }
.input-lg { height: 40px; font-size: 15px; }
.input-sm { width: auto; padding: 2px var(--s2); }
.error { font: var(--t-meta); color: var(--danger); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.empty-line { color: var(--muted); padding: var(--s3) 0; }
.team-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  font: 500 11px/1 var(--font-sans); color: var(--signal);
  background: color-mix(in srgb, var(--signal) 12%, transparent); border-radius: var(--r-1);
}

/* Segmented control (radio group) */
.seg { display: inline-flex; width: max-content; max-width: 100%; justify-self: start; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: var(--r-1); overflow: hidden; background: var(--surface); }
.seg label[hidden], .field[hidden] { display: none; }
fieldset.field { align-content: start; }  /* no empty band under segmented controls */
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span, .seg button {
  display: block; padding: 4px var(--s3); font: 500 12px/18px var(--font-sans); color: var(--muted);
  border: 0; background: none; border-left: 1px solid var(--rule); cursor: pointer;
}
.seg label:first-child span, .seg button:first-child { border-left: 0; }
.seg input:checked + span, .seg button[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); }
.seg input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: -2px; }
.seg-sm button { padding: 2px var(--s2); }

/* ---------- Portal ---------- */
/* Portal: request form on the left, lists on the right. On a wide window the page fits the
   viewport and each column scrolls on its own; narrower, they stack and the page scrolls. */
.portal { display: grid; gap: var(--s6); max-width: none; }
.portal-lists { display: grid; gap: var(--s8); align-content: start; min-width: 0; }
@media (min-width: 1100px) {
  .portal {
    grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
    height: calc(100vh - var(--topbar-h)); box-sizing: border-box; padding-bottom: var(--s4);
  }
  .portal-ask, .portal-lists { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .portal-ask { align-self: start; max-height: 100%; box-sizing: border-box; }
  .portal-lists { padding-right: var(--s2); }
}
.portal-ask { display: grid; gap: var(--s4); padding: var(--s6); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); }
.portal-list h2 { font: var(--t-title); margin-bottom: var(--s2); }
.more summary { cursor: pointer; color: var(--signal); font-weight: 500; width: max-content; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); margin-top: var(--s4); }

/* ---------- Ticket list ---------- */
.tlist-scroll { overflow-x: auto; }
.tlist { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
.tlist .c-key { width: 84px; }
.tlist .c-status { width: 112px; }
.tlist .c-who { width: 190px; overflow: hidden; text-overflow: ellipsis; }
.tlist .c-due { width: 150px; text-align: right; }
.tlist .c-ago { width: 72px; text-align: right; }
.tlist .c-act { width: 72px; text-align: right; }
.tlist .c-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlist td { padding: 6px var(--s2); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tlist tr:hover td { background: var(--hover); }
.tlist .c-key { white-space: nowrap; }
.tlist .c-title a { text-decoration: none; }
.tlist .c-title a:hover { text-decoration: underline; }
.tlist .c-status, .tlist .c-who, .tlist .c-due, .tlist .c-ago { white-space: nowrap; }
.assignees { display: inline-flex; align-items: center; gap: 2px; }
.assignees .team-chip { margin-left: 4px; }

/* ---------- Generic table (admin) ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); }
.table th { text-align: left; font: 500 12px/16px var(--font-sans); color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); }
.table td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); }
.table tr.is-archived td { color: var(--muted); }
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--rule); }
.tabs a { padding: var(--s2) 0; text-decoration: none; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--signal); }

/* ---------- Side panel (floating: rounded + shadow) ---------- */
.panel {
  position: fixed; z-index: 30; top: calc(var(--topbar-h) + var(--s2)); right: var(--s2); bottom: var(--s2);
  width: min(max(560px, 66.67vw), calc(100vw - var(--s4))); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: var(--float);
}
.panel-inner { display: grid; gap: var(--s5); padding: var(--s4) var(--s5) var(--s8); }
.panel-head { display: flex; align-items: center; gap: var(--s2); position: sticky; top: 0; z-index: 1;
  margin: calc(-1 * var(--s4)) calc(-1 * var(--s5)) 0; padding: var(--s3) var(--s5); background: var(--surface); border-bottom: 1px solid var(--rule); }
.panel-head .key { font-size: 13px; color: var(--text); }
.panel-title .title-text { font: var(--t-title); }
.panel-title .input-title { font: var(--t-title); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-start; }
.escalate { position: relative; }
.escalate summary { list-style: none; }
.escalate summary::-webkit-details-marker { display: none; }
.escalate-form { position: absolute; z-index: 2; top: calc(100% + 4px); left: 0; width: 300px; display: grid; gap: var(--s2);
  padding: var(--s3); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: var(--float); }
.fields { display: grid; grid-template-columns: 96px 1fr; gap: var(--s2) var(--s4); margin: 0; align-items: center; }
.fields dt { font: 500 12px/16px var(--font-sans); color: var(--muted); }
.fields dd { margin: 0; min-height: 28px; display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.dd-assign { gap: var(--s2); flex-wrap: wrap; }
.move-form { display: flex; gap: var(--s2); align-items: center; }
.move-form .input { width: auto; }
.panel-section { display: grid; gap: var(--s3); }
.section-head { display: flex; align-items: center; justify-content: space-between; }

/* Inline-editable value */
.fv { display: flex; flex-direction: column; gap: var(--s2); width: 100%; }
.fv-btn, .fv-static { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: var(--s2); min-height: 28px;
  margin-left: calc(-1 * var(--s2)); padding: 2px var(--s2); border-radius: var(--r-1); }
.fv-btn { cursor: pointer; }
.fv-btn:hover { background: var(--hover); }
.fv-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 0; }
.fv.is-editing select, .fv.is-editing input[type="date"] { width: auto; }
.btn-edit { justify-self: start; width: max-content; }
.assignee-list { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.picker { max-height: 240px; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--r-1); }
.picker-item { display: flex; align-items: center; gap: var(--s2); padding: 4px var(--s2); cursor: pointer; }
.picker-item:hover { background: var(--hover); }
.picker-item[hidden] { display: none; }

/* Activity feed */
.activity { display: grid; gap: var(--s3); }
.act-comment { display: grid; gap: var(--s1); padding: var(--s3); border: 1px solid var(--rule); border-radius: var(--r-1); }
.act-comment header { display: flex; align-items: center; gap: var(--s2); }
.act-comment .prose { font-size: 14px; line-height: 22px; }
.feed.only-comments .act-audit { display: none; }
.comment-form { display: grid; gap: var(--s2); }
.prose a { color: var(--signal); }
.prose pre, .prose code { background: var(--hover); border-radius: var(--r-1); font-size: 13px; }
.prose pre { padding: var(--s2) var(--s3); overflow-x: auto; }
.prose ul, .prose ol { padding-left: var(--s5); margin: var(--s2) 0; }
.prose table { border-collapse: collapse; } .prose td, .prose th { border: 1px solid var(--rule); padding: 2px var(--s2); }

/* ---------- Board shell: filter bar doubles as the page title ---------- */
/* Column, not a 2-row grid: extra rows (e.g. "+ New project") must not take the stretch space. */
.boardpage { display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h)); }
.boardpage > .board { flex: 1; }
.filterbar {
  position: sticky; top: var(--topbar-h); z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4); background: var(--bg); border-bottom: 1px solid var(--rule);
}
.fb-title { font: var(--t-title); margin-right: var(--s2); }
.filterbar select.input-sm { max-width: 180px; }
.fb-search { width: 220px; }
.seg-sm a {
  display: block; padding: 2px var(--s3); font: 500 12px/20px var(--font-sans); color: var(--muted);
  text-decoration: none; border-left: 1px solid var(--rule);
}
.seg-sm a:first-child { border-left: 0; }
.seg-sm a:hover { color: var(--text); background: var(--hover); }
.seg-sm a[aria-current="true"] { background: var(--signal); color: var(--on-signal); }
.board { padding: var(--s4); min-width: 0; }
.board .empty { padding: var(--s8) var(--s2); }

/* Project group colours */
.grp-swatch { display: inline-block; width: 4px; height: 14px; border-radius: 1px; vertical-align: -2px; background: var(--g); }
.grp-1 { --g: var(--group-1); } .grp-2 { --g: var(--group-2); } .grp-3 { --g: var(--group-3); } .grp-4 { --g: var(--group-4); }
.grp-5 { --g: var(--group-5); } .grp-6 { --g: var(--group-6); } .grp-7 { --g: var(--group-7); } .grp-8 { --g: var(--group-8); }

/* ---------- List ---------- */
.list-meta { margin-bottom: var(--s2); }
.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); }
.grid th { text-align: left; font: 500 12px/16px var(--font-sans); color: var(--muted); padding: var(--s2); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.grid th a { color: inherit; text-decoration: none; }
.grid th a:hover { color: var(--text); }
.grid td { height: 32px; padding: 0 var(--s2); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.grid tbody tr:hover td { background: var(--hover); }
.grid .c-key, .grid .c-status, .grid .c-pri, .grid .c-who, .grid .c-due, .grid .c-actions { width: 1%; white-space: nowrap; }
.grid .c-title a { text-decoration: none; }
.grid .c-title a:hover { text-decoration: underline; }
.grid .num { text-align: right; }
.group-row th {
  position: sticky; top: calc(var(--topbar-h) + 46px); z-index: 1;
  padding: var(--s3) var(--s2) var(--s1); background: var(--bg); color: var(--text);
  font: 600 13px/20px var(--font-sans); border-bottom: 1px solid var(--rule);
}
.pager { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s3); }
.cell { display: inline-block; }
.cell-form { margin: 0; }
.cell-select { appearance: none; border: 0; cursor: pointer; text-align: center; padding-right: 6px; }
.cell-select:hover { filter: brightness(1.06); }
.cell-select option { background: var(--surface); color: var(--text); }

/* ---------- Kanban: square columns, hairlines, cards lift only while dragged ---------- */
.kanban { --col: minmax(200px, 1fr); min-width: calc(var(--cols) * 210px); }
/* The kanban scrolls inside its own box (both ways) and fills the window under the filters,
   so the stage header can stay pinned on top while the lanes scroll under it. */
.board-kanban { overflow: auto; min-height: 0; padding-top: 0; overscroll-behavior: contain; }
.boardpage:has(> .board-kanban) { height: calc(100vh - var(--topbar-h)); min-height: 0; }
.kb-head, .kb-row { display: grid; grid-template-columns: repeat(var(--cols), var(--col)); }
/* Pinned to the top of the kanban scroll box; solid background and z-index keep cards under it. */
.kb-head { position: sticky; top: 0; z-index: 6; padding-top: var(--s4); background: var(--bg); border-bottom: 1px solid var(--rule); }
.kb-col-head { display: flex; align-items: center; gap: 6px; padding: var(--s2); font-weight: 500; border-left: 1px solid var(--rule); }
.kb-col-head:first-child { border-left: 0; }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kb-hidden { padding: var(--s2) 0; }
.kb-lane { border-bottom: 1px solid var(--rule); }
.kb-lane-title { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s1) var(--s2); font: 600 13px/20px var(--font-sans); cursor: pointer; }
.kb-sub-title { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s3); color: var(--muted); font-weight: 500; cursor: pointer; }
.kb-cell {
  display: flex; flex-direction: column; gap: var(--s2); min-height: 56px; padding: var(--s2);
  border-left: 1px solid var(--rule); transition: background var(--ease), opacity var(--ease);
}
.kb-cell:first-child { border-left: 0; }
.kb-cell.is-over { background: var(--hover); box-shadow: inset 0 0 0 1px var(--signal); }
.kb-cell.is-refused { opacity: .35; }
.card.is-merge-target { position: relative; }
.card.is-merge-target::after {
  content: attr(data-merge-hint); position: absolute; right: 6px; bottom: 6px; padding: 2px 8px;
  font-size: 12px; font-weight: 600; color: #fff; background: var(--signal); border-radius: 999px;
  pointer-events: none;
}
.card.is-merge-target { box-shadow: 0 0 0 2px var(--signal); background: color-mix(in srgb, var(--signal) 10%, var(--surface, transparent)); }
.card {
  display: grid; gap: var(--s1); padding: var(--s2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-1);
}
.card[draggable="true"] { cursor: grab; }
.card.is-dragging { box-shadow: var(--float); opacity: .9; cursor: grabbing; }
.card-top, .card-foot { display: flex; align-items: center; gap: var(--s2); }
.card-top { justify-content: space-between; }
.card-title { text-decoration: none; line-height: 18px; overflow-wrap: anywhere; }
.card-title:hover { text-decoration: underline; }
.card-foot { min-height: 18px; }
.card.is-wont_do .card-title { text-decoration: line-through; color: var(--muted); }
.lbl-xs { min-width: 0; height: 16px; padding: 0 4px; font-size: 10px; }

/* ---------- Timeline: range chart ---------- */
.timeline { --tl-label: 260px; --row-h: 28px; display: grid; gap: var(--s2); }
.tl-toolbar { display: flex; align-items: center; gap: var(--s3); }
.tl-frame { display: grid; grid-template-columns: minmax(0, 1fr) 220px; border: 1px solid var(--rule); background: var(--surface); }
.tl-scroll { overflow-x: auto; overflow-y: visible; }
.tl-grid { width: calc(var(--tl-label) + var(--tl-w)); }
.tl-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--rule); }
.tl-corner { position: sticky; left: 0; z-index: 4; flex: none; width: var(--tl-label); background: var(--surface); border-right: 1px solid var(--rule); }
.tl-axis { width: var(--tl-w); }
.tl-months { display: flex; height: 20px; border-bottom: 1px solid var(--rule); }
.tl-month { flex: none; padding: 0 6px; font: var(--t-micro); color: var(--muted); line-height: 20px; border-left: 1px solid var(--rule); overflow: hidden; white-space: nowrap; }
.tl-days { position: relative; height: 20px; }
.tl-day { position: absolute; top: 0; padding-left: 3px; font: var(--t-micro); font-weight: 400; color: var(--muted); line-height: 20px; border-left: 1px solid var(--rule); }
.tl-day.is-today { color: var(--signal); font-weight: 500; }
.tl-body { position: relative; }
.tl-body.is-drop-target { box-shadow: inset 0 0 0 2px var(--signal); }
.tl-bg { position: absolute; top: 0; bottom: 0; left: var(--tl-label); width: var(--tl-w); pointer-events: none; }
.tl-weekend {
  position: absolute; top: 0; bottom: 0;
  background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--rule) 55%, transparent) 4px 5px);
}
.tl-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--signal); z-index: 2; }
.tl-today span { position: absolute; top: 2px; left: 4px; font: var(--t-micro); color: var(--signal); white-space: nowrap; }
.tl-row { display: flex; height: var(--row-h); border-bottom: 1px solid color-mix(in srgb, var(--rule) 50%, transparent); }
.tl-row[hidden] { display: none; }  /* display:flex would otherwise beat the hidden attribute */
.tl-row:hover { background: color-mix(in srgb, var(--hover) 60%, transparent); }
.tl-label {
  position: sticky; left: 0; z-index: 2; flex: none; width: var(--tl-label);
  display: flex; align-items: center; gap: 6px; padding-right: var(--s2);
  background: var(--surface); border-right: 1px solid var(--rule); overflow: hidden; white-space: nowrap;
}
.tl-d0 .tl-label { padding-left: var(--s1); font-weight: 600; }
.tl-d1 .tl-label { padding-left: var(--s4); font-weight: 500; }
.tl-d2 .tl-label { padding-left: 36px; }
.tl-name { overflow: hidden; text-overflow: ellipsis; }
.tl-toggle, .tl-toggle-space { flex: none; width: 16px; }
.tl-toggle { padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; }
.tl-track { position: relative; flex: none; width: var(--tl-w); }
.tl-bar { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 0; }
.tl-bar:focus-visible { outline-offset: 3px; }
.tl-bar-ticket { height: 8px; }
.tl-bar-milestone { height: 12px; margin-top: -6px; background: var(--text); }
.tl-bar-project { height: 14px; margin-top: -7px; background: color-mix(in srgb, var(--g) 18%, transparent); border: 1px solid var(--g); }
.grp-line-1 { --g: var(--group-1); } .grp-line-2 { --g: var(--group-2); } .grp-line-3 { --g: var(--group-3); } .grp-line-4 { --g: var(--group-4); }
.grp-line-5 { --g: var(--group-5); } .grp-line-6 { --g: var(--group-6); } .grp-line-7 { --g: var(--group-7); } .grp-line-8 { --g: var(--group-8); }
/* Tick-mark end caps (├──┤): the visual is the resize handle */
.tl-bar::before, .tl-bar::after { content: ""; position: absolute; top: -4px; bottom: -4px; width: 2px; background: currentColor; opacity: .55; }
.tl-bar::before { left: 0; } .tl-bar::after { right: 0; }
.tl-bar-ticket { color: var(--text); }
.tl-bar-milestone, .tl-bar-project { color: var(--text); }
.tl-bar.is-draggable { cursor: grab; touch-action: none; }
.tl-bar.is-dragging { cursor: grabbing; box-shadow: var(--float); z-index: 3; }
.tl-cap { position: absolute; top: -6px; bottom: -6px; width: 10px; cursor: ew-resize; z-index: 1; }
.tl-cap-s { left: -5px; } .tl-cap-e { right: -5px; }
/* Drift: an overdue ticket's lateness, drawn as length up to the today line */
.tl-drift { position: absolute; top: 50%; height: 0; border-top: 2px dotted var(--danger); }
.tl-drift span { position: absolute; right: 4px; top: -16px; font: var(--t-micro); color: var(--danger); }
.tl-tray { display: grid; align-content: start; gap: var(--s2); padding: var(--s2) var(--s3); border-left: 1px solid var(--rule); }
.tl-tray-title { font: 600 13px/20px var(--font-sans); }
.tl-tray-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.tl-tray-item { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s2); padding: 6px var(--s2); border: 1px solid var(--rule); border-radius: var(--r-1); background: var(--bg); }
.tl-tray-item[draggable="true"] { cursor: grab; }
.tl-tray-item .meta { grid-column: 2; }
.tl-tray-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Milestones page ---------- */
.milestones-page { display: grid; gap: var(--s6); }
.ms-project { display: grid; gap: var(--s3); }
.ms-project-title { display: flex; align-items: center; gap: var(--s2); }
.ms-project-title .meta { margin-left: auto; font-weight: 400; }
.progress { display: inline-block; width: 80px; height: 6px; vertical-align: middle; background: var(--rule); border-radius: 3px; overflow: hidden; margin-right: var(--s2); }
.progress span { display: block; height: 100%; background: var(--lbl-done); }
.ms-edit { position: relative; }
.ms-edit summary { list-style: none; }
.ms-edit summary::-webkit-details-marker { display: none; }
.ms-form {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; width: 280px;
  display: grid; gap: var(--s2); padding: var(--s3);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: var(--float);
}
.ms-add { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.ms-add .input-sm[name="name"] { width: 260px; }

/* ---------- Merge requests (ticket panel) ---------- */
.mr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.mr { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.mr-title { flex: 1 1 200px; min-width: 0; }
.mr-state { font: 500 11px/18px var(--font-sans); padding: 0 6px; border-radius: var(--r-1); }
.mr-opened { background: var(--lbl-in_progress); color: var(--lbl-in_progress-ink); }
.mr-merged { background: var(--lbl-accepted); color: var(--lbl-accepted-ink); }
.mr-closed, .mr-locked { background: var(--lbl-wont_do); color: var(--lbl-wont_do-ink); }
.pipe-failed, .pipe-canceled { color: var(--danger); }
.pipe-success { color: var(--text); }
.mr-link { display: flex; gap: var(--s2); }
.mr-link .input { flex: 1; }
.btn-xs { height: 22px; padding: 0 var(--s2); font-size: 12px; }

/* ---------- Command palette and shortcuts (floating: rounded + shadow) ---------- */
@view-transition { navigation: auto; }  /* smooth Timeline / Kanban / List switches */
.palette-open { gap: var(--s1); }
.palette-open kbd { margin-left: 2px; }
.palette, .shortcuts {
  width: min(560px, calc(100vw - 2 * var(--s4))); margin: 12vh auto auto; padding: var(--s3);
  color: var(--text); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r-2); box-shadow: var(--float);
}
.palette::backdrop, .shortcuts::backdrop { background: rgb(0 0 0 / .25); }
/* Confirmation box: same floating surface as the palette, centred, buttons bottom-right */
.confirm {
  width: min(440px, calc(100vw - 2 * var(--s4))); margin: auto; padding: var(--s6) var(--s6) var(--s5);
  color: var(--text); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r-2); box-shadow: var(--float);
}
.confirm::backdrop { background: rgb(0 0 0 / .35); }
.report-issue { width: min(560px, calc(100vw - 2 * var(--s4))); }
.report-issue textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.ri-label { display: block; margin: var(--s4) 0 var(--s1); font-weight: 500; }
.ri-shot { margin: var(--s3) 0 0; }
.ri-shot img { display: block; max-width: 100%; max-height: 220px; border: 1px solid var(--rule); border-radius: var(--r-2); }
.ri-shot figcaption { margin-top: var(--s1); color: var(--muted); }
.ri-details { margin-top: var(--s3); }
.ri-details pre { max-height: 160px; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ri-error { margin: var(--s3) 0 0; color: var(--danger); }
.attachments { display: flex; flex-wrap: wrap; gap: var(--s2); }
.attachment-thumb { display: block; max-width: 100%; max-height: 160px; border: 1px solid var(--rule); border-radius: var(--r-2); }
.confirm[open] { animation: confirm-in .12s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .confirm[open] { animation: none; } }
.confirm-title { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.confirm-body { margin: var(--s2) 0 0; color: var(--muted); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s6); }
.palette-list { list-style: none; margin: var(--s2) 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s2); border-radius: var(--r-1); cursor: pointer; }
.palette-item[aria-selected="true"] { background: var(--hover); box-shadow: inset 2px 0 0 var(--signal); }
.palette-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: var(--s3) var(--s2); }
.palette-hint { margin-top: var(--s2); display: flex; gap: 4px; align-items: center; }
.shortcut-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s4); margin: var(--s4) 0 0; }
.shortcut-list dt { white-space: nowrap; }
.shortcut-list dd { margin: 0; }
/* j/k selection: signal-coloured left rule */
[data-nav].is-selected { box-shadow: inset 2px 0 0 var(--signal); }
.card.is-selected { box-shadow: 0 0 0 2px var(--signal); }

/* ---------- List, monday style: coloured groups, gridded cells, full-cell labels ---------- */
.lgroup { margin-bottom: var(--s6); }
.lgroup-title {
  display: flex; align-items: center; gap: var(--s2); width: max-content;
  padding: var(--s1) 0 var(--s2); list-style: none; cursor: pointer;
  font: 600 16px/24px var(--font-sans); color: var(--accent);
}
.lgroup-title::-webkit-details-marker { display: none; }
.lgroup-chevron { font-size: 12px; transition: transform var(--ease); }
.lgroup:not([open]) .lgroup-chevron { transform: rotate(-90deg); }
.lgroup-scroll { overflow-x: auto; }
.grid-m { min-width: 860px; border-left: 0; border-radius: var(--r-1) 0 0 var(--r-1); }
.grid-m th, .grid-m td { border-left: 1px solid var(--rule); }
.grid-m th { text-align: center; font-weight: 400; }
.grid-m th.c-title { text-align: left; }
.grid-m tr > :first-child { border-left: 6px solid var(--accent); }
.grid-m td { height: 36px; }
.grid-m .c-title { width: 40%; }
.grid-m .c-req, .grid-m .c-who, .grid-m .c-upd, .grid-m .c-due { text-align: center; }
.grid-m .c-fill { width: 130px; min-width: 130px; padding: 0; }
.grid-m .c-fill .cell, .grid-m .c-fill .cell-form { display: block; height: 100%; }
.grid-m .c-fill .cell-select, .grid-m .c-fill .lbl {
  display: flex; width: 100%; height: 36px; min-width: 0; border-radius: 0;
  font-size: 12px; text-align: center; text-align-last: center; justify-content: center;
}
.grid-m .c-fill .cell-select:hover { filter: brightness(1.08); }
.add-row td { height: 34px; padding: 0 var(--s2); background: var(--surface); }
.add-row td:first-child { border-left-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.add-form { margin: 0; }
.add-input {
  width: 100%; border: 0; background: transparent; color: var(--text);
  font: var(--t-ui); padding: 6px 0;
}
.add-input::placeholder { color: var(--muted); }
.add-input:focus { outline: none; }
.add-row:focus-within td { box-shadow: inset 0 0 0 1px var(--signal); }
.sum-row td { height: 28px; border-left-color: transparent; background: var(--bg); border-bottom: 0; }
.sum-row td:first-child { border-left: 6px solid transparent; }
.battery { display: flex; height: 18px; margin: 0 var(--s2); overflow: hidden; border-radius: 2px; background: var(--rule); }
.battery > span { display: block; height: 100%; }

/* ---------- Kanban, monday style: solid column heads, cards with tags ---------- */
.kanban { --col: minmax(240px, 1fr); }
.kb-head { gap: var(--s3); border-bottom: 0; padding-bottom: var(--s2); }
.kb-row { gap: var(--s3); }
.kb-col-head {
  justify-content: flex-start; padding: 6px var(--s3); border: 0;
  border-radius: var(--r-1) var(--r-1) 0 0; font-weight: 600;
}
.kb-count { font-weight: 400; opacity: .85; margin-left: 2px; }
.kb-cell { border-left: 0; background: color-mix(in srgb, var(--rule) 22%, var(--bg)); border-radius: 0 0 var(--r-1) var(--r-1); }
.card { gap: var(--s2); padding: var(--s3); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.card-title { font-weight: 500; }
.card-desc { margin: 0; font: var(--t-meta); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: var(--s1); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 6px;
  font: 400 12px/1 var(--font-sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--tag, var(--muted));
  border-radius: 2px;
}
.tag-plain { --tag: var(--rule); }
.card-foot { gap: var(--s2); }
.card-foot .key { margin-left: var(--s1); }
.card-comments { white-space: nowrap; }

/* ---------- Timeline, monday Gantt style ---------- */
.timeline { --tl-label: 320px; --row-h: 34px; }
.tl-years .tl-month, .tl-q { text-align: center; }
.tl-years { font-weight: 600; }
.tl-q.is-now { color: var(--on-signal); background: var(--signal); border-radius: 999px; margin: 2px 0; line-height: 16px; }
.tl-dates { margin-left: auto; padding-left: var(--s2); font: var(--t-meta); color: var(--muted); white-space: nowrap; }
.tl-k-project .tl-label, .tl-k-group .tl-label { padding-top: var(--s2); }
/* Ticket bars: solid, rounded, with the name beside them */
.tl-bar-ticket { height: 18px; margin-top: -9px; border-radius: 4px; }
.tl-bar::before, .tl-bar::after { display: none; }
.tl-bar-label {
  position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; font: var(--t-meta); color: var(--text); pointer-events: none;
}
/* Project and milestone bars: a thin line with "Name · dates · N days" above it */
.tl-bar-project, .tl-bar-milestone {
  height: 3px; margin-top: 6px; border: 0; border-radius: 2px; background: var(--g, var(--signal));
}
.tl-bar-milestone { --g: var(--muted); }
.tl-bar-project::before, .tl-bar-milestone::before {  /* bigger grab area for a thin line */
  display: block; content: ""; position: absolute; inset: -9px 0; background: transparent; opacity: 1;
}
.tl-bar-caption {
  position: absolute; left: 0; bottom: 6px; white-space: nowrap; pointer-events: none;
  font: 400 11px/14px var(--font-sans); color: var(--muted);
}
.tl-bar-caption strong { color: var(--text); font-weight: 600; }
.tl-today { border-left: 2px solid var(--signal); }
.tl-today::before { content: ""; position: absolute; top: -4px; left: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.tl-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s5); list-style: none; margin: var(--s2) 0 0; padding: 0; font: var(--t-meta); color: var(--muted); }
.tl-legend li { display: flex; align-items: center; gap: 6px; }
.tl-legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Names next to avatars; last-update lines */
.person { display: inline-flex; align-items: center; gap: 4px; margin-right: var(--s2); white-space: nowrap; }
.person-name { font: var(--t-meta); color: var(--text); }
.card-update { margin: 0; font: var(--t-meta); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-update strong, .last-update strong { color: var(--text); font-weight: 500; }
.last-update { font: var(--t-meta); color: var(--muted); display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.panel-title-text { font: var(--t-title); }
.project-edit summary { width: max-content; list-style: none; }
.project-edit summary::-webkit-details-marker { display: none; }

.proj-summary { display: inline-flex; align-items: center; gap: var(--s2); margin-left: var(--s3); font-weight: 400; }

/* Project vs ticket at a glance: projects are tinted in their colour with a thick edge and a
   "Project" tag; tickets are white with a thin edge in their status colour. */
.card-ticket { border-left: 3px solid var(--edge, var(--rule)); }
.card-project {
  background: color-mix(in srgb, var(--g) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--g) 45%, var(--rule)); border-left: 6px solid var(--g);
}
.kind-tag {
  display: inline-block; padding: 0 6px; border-radius: 2px;
  font: 600 10px/16px var(--font-sans); letter-spacing: .02em;
  color: var(--g-ink, var(--surface)); background: var(--g);
}
/* Project tiles are coloured by health (board.project_health), using the status palette:
   green on track, amber at risk, red overdue, grey done. */
.health-ok   { --g: var(--lbl-done);        --g-ink: var(--lbl-done-ink); }
.health-risk { --g: var(--lbl-in_progress); --g-ink: var(--lbl-in_progress-ink); }
.health-late { --g: var(--lbl-blocked);     --g-ink: var(--lbl-blocked-ink); }
.health-done { --g: var(--lbl-new);         --g-ink: var(--lbl-new-ink); }
.health-tag { font: var(--t-meta); font-weight: 600; color: var(--text); white-space: nowrap; }
.health-late .health-tag { color: var(--danger); }
.health-risk .health-tag { color: var(--warn); }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--g); vertical-align: middle; }
.kb-lane-box > .kb-lane-title {
  margin-top: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-1);
  background: color-mix(in srgb, var(--g) 14%, var(--surface)); border-left: 6px solid var(--g);
}
.lgroup-project > .lgroup-title {
  padding: var(--s1) var(--s3); border-radius: var(--r-1);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-left: 6px solid var(--accent);
}
.tl-k-project { background: color-mix(in srgb, var(--g, var(--signal)) 10%, transparent); }
.tl-k-project .tl-label { background: color-mix(in srgb, var(--g, var(--signal)) 14%, var(--surface)); box-shadow: inset 6px 0 0 var(--g, var(--signal)); }

.board-actions { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4) 0; }
.new-project { position: relative; width: max-content; }
.new-project summary { list-style: none; }
.new-project summary::-webkit-details-marker { display: none; }
.new-project-form {
  position: absolute; z-index: 15; top: calc(100% + 4px); left: 0; width: 360px;
  display: flex; gap: var(--s2); padding: var(--s3);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: var(--float);
}

.act-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.act-feed li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; padding: var(--s1) 0; border-bottom: 1px solid var(--rule); }
.act-feed .mono { min-width: 64px; }

.card-people { display: flex; flex-wrap: wrap; gap: var(--s1); }

.rel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.rel { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.rel-title { flex: 1 1 160px; min-width: 0; text-decoration: none; }
.rel-title:hover { text-decoration: underline; }
.rel-link { display: flex; gap: var(--s2); }
.rel-link .input { flex: 1; }

.kb-lane-box > .kb-lane-span { display: block; margin: var(--s2) 0 0; padding: 0; background: none; border: 0; list-style: none; }
.kb-lane-span::-webkit-details-marker { display: none; }
.kb-chevron { font-size: 11px; transition: transform var(--ease); }
.kb-lane-box:not([open]) .kb-chevron { transform: rotate(-90deg); }
.kb-proj-span {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: 6px var(--s3); border-radius: var(--r-1); min-height: 36px;
}
.kb-proj-mix { display: inline-flex; flex-wrap: wrap; gap: var(--s3); margin-left: auto; font: var(--t-meta); color: var(--text); }
.kb-mix-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* Whole rows and cards open their ticket */
[data-nav], .card-project { cursor: pointer; }
.card[draggable="true"] { cursor: grab; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .panel { inset: var(--topbar-h) 0 0 0; width: 100%; border-radius: 0; border: 0; }
  .tlist .c-who, .tlist .c-ago { display: none; }
  .portal-ask { padding: var(--s4); }
  .fields { grid-template-columns: 84px 1fr; }
  .topbar { gap: var(--s3); }
  .nav { display: none; }
  .palette-open { display: none; }
  .page { padding: var(--s4); }
  .filterbar { position: static; }
  .filterbar select.input-sm, .fb-search { max-width: none; width: calc(50% - var(--s1)); }
  .grid .c-who, .grid .c-ms { display: none; }
  .timeline { --tl-label: 150px; }
  .tl-frame { grid-template-columns: 1fr; }
  .tl-tray { border-left: 0; border-top: 1px solid var(--rule); }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Panel: Assigned row actions */
.assign-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s1); }
.assign-add .input { min-width: 180px; }

/* Project panel: its open tickets and the quick "New ticket" box */
.proj-ticket-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); max-height: 320px; overflow-y: auto; }
.proj-ticket-list li { display: flex; align-items: center; gap: var(--s2); padding: 6px 0; border-bottom: 1px solid var(--rule); }
.proj-ticket-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.proj-ticket-title:hover { text-decoration: underline; }
.proj-add-ticket { display: grid; gap: var(--s2); }
.proj-add-ticket .row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }

/* API tokens page */
.tokens-page { max-width: 960px; }
.card-box { padding: var(--s5); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); }
.token-form { align-items: flex-end; flex-wrap: wrap; }
.token-new { padding: var(--s4) var(--s5); border: 1px solid var(--signal); border-radius: var(--r-2); background: var(--surface); display: grid; gap: var(--s2); }
.token-new h2 { margin: 0; font-size: 1rem; }
.token-secret { flex: 1; min-width: 0; padding: 6px var(--s2); background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r-1); overflow-wrap: anywhere; user-select: all; }
.table tr.is-dead td { color: var(--muted); }
.skill-howto ol { margin: var(--s2) 0 0; padding-left: 1.25rem; display: grid; gap: var(--s1); }

/* On/off filter buttons (Board: Involving me) */
.btn-toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--signal) 12%, var(--surface)); border-color: var(--signal); color: var(--signal); font-weight: 600; }

/* Everything stays inside its card: shortened names, wrapping footers, ellipsis */
.card { min-width: 0; overflow: hidden; }
.card-foot { flex-wrap: wrap; row-gap: 4px; }
.card .assignees { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.person { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title, .card-update { overflow-wrap: anywhere; }
.card-foot .key, .card-top .key { white-space: nowrap; flex: none; }  /* PROJ2-2 never breaks */
.card-foot .card-comments { white-space: nowrap; flex: none; }
.card-foot .assignees { flex: 1 1 auto; }
.add-milestone { margin-top: var(--s1); }
.add-milestone summary { list-style: none; width: max-content; }
.add-milestone summary::-webkit-details-marker { display: none; }
.add-milestone form { margin-top: var(--s2); }
.add-milestone .row { align-items: flex-end; flex-wrap: wrap; }
.dd-requesters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.req-remove { padding: 0 4px; line-height: 1; }
.dd-stakeholders { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }

/* Which project a ticket belongs to: a small chip in the project's colour */
.proj-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0 6px; border-radius: 2px;
  font: var(--t-meta); color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--g) 16%, var(--surface)); border-left: 3px solid var(--g); vertical-align: middle; }
.proj-chip:hover { text-decoration: underline; }
.proj-chip .key { font-size: 11px; }
.card-project-line { display: flex; min-width: 0; margin-bottom: 2px; }

/* Timeline: small marks for a project's tickets on the project's own row */
.tl-track { position: relative; }
.tl-mini { position: absolute; bottom: 3px; height: 4px; border-radius: 2px; background: var(--lbl, var(--muted)); opacity: .9; }
.tl-mini.lbl-new { --lbl: var(--lbl-new); } .tl-mini.lbl-accepted { --lbl: var(--lbl-accepted); }
.tl-mini.lbl-in_progress { --lbl: var(--lbl-in_progress); } .tl-mini.lbl-blocked { --lbl: var(--lbl-blocked); }
.tl-mini.lbl-done { --lbl: var(--lbl-done); } .tl-mini.lbl-wont_do { --lbl: var(--lbl-wont_do); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* A project's team, small, next to its name */
.team-tag { font: var(--t-meta); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Timeline: the project a dragged tray ticket will join */
.tl-row.is-over { box-shadow: inset 0 0 0 2px var(--signal); background: color-mix(in srgb, var(--signal) 8%, transparent); }

/* Portal: pale red, on the right of the top bar */
.btn-portal { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--rule)); }
.btn-portal:hover { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); }
.btn-portal[aria-current="page"] { border-color: color-mix(in srgb, var(--danger) 55%, var(--rule)); }

/* Kanban: a project's tile sits in its own stage; a dotted line runs to where its tickets are */
.kb-lane-span .kb-row { align-items: center; }
.kb-proj-line {
  grid-row: 1; align-self: center; position: relative; display: flex; justify-content: center;
  border-top: 2px dotted color-mix(in srgb, var(--text) 45%, transparent);
  margin: 0 calc(-1 * var(--s3)); min-width: 0;
}
.kb-proj-line-right::after, .kb-proj-line-left::before {
  content: ""; position: absolute; top: -5px; width: 8px; height: 8px; border-radius: 50%;
  background: color-mix(in srgb, var(--text) 45%, transparent);
}
.kb-proj-line-right::after { right: var(--s3); }
.kb-proj-line-left::before { left: var(--s3); }
.kb-proj-line .kb-proj-mix {
  margin: -11px auto 0; padding: 0 var(--s2); background: var(--bg); border-radius: var(--r-1);
}
/* The Inbox lane: tickets that belong to no project */
.kb-lane-inbox { border-bottom: 1px dashed var(--rule); }
.kb-lane-inbox .meta { font-weight: 400; }

/* Ticket repos (merge request section) */
.mr-repos { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s2) 0; }
.mr-repos .chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.chip-x:hover { color: var(--danger); }

.mr-fold > summary { cursor: pointer; padding: 2px 0; }
.mr-fold[open] > summary { margin-bottom: var(--s2); }
.mr-list { max-height: 360px; overflow-y: auto; }

/* Red "!" on high/urgent work */
.hot-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 15px; height: 15px; margin-right: 4px; border-radius: 50%;
  font: 700 11px/1 var(--font-sans); color: #fff; background: var(--danger); vertical-align: middle;
}
.hot-mark.hot-high { background: color-mix(in srgb, var(--danger) 75%, transparent); }

/* Project requirements */
.reqs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.req { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.req.is-done { opacity: .6; }
.add-req form { margin-top: var(--s2); gap: var(--s2); }
.waits-tag {
  font: var(--t-meta); font-size: 11px; white-space: nowrap; padding: 0 6px; border-radius: 999px;
  color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 60%, var(--rule));
}

.requires .rel.is-done { opacity: .6; }

.tag-incident { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); font-weight: 600; }

.tag-needs { color: var(--warn); border-style: dashed; border-color: color-mix(in srgb, var(--warn) 60%, var(--rule)); }

/* Help page */
.help-page { max-width: 760px; }
.help-toc { font: var(--t-meta); color: var(--muted); }
.help-section h2 { margin: var(--s4) 0 var(--s2); }
.help-section ul, .help-section ol { padding-left: 1.2em; display: grid; gap: 4px; }
.help-section code { font-size: 0.92em; }

tr.is-disabled td { opacity: .55; }

/* Timeline: rename milestones in place; drag tickets between milestones */
.tl-ms-name { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: text; text-align: left; }
.tl-ms-name:hover { text-decoration: underline dotted; }
.tl-ms-input { height: 26px; max-width: 220px; }
.tl-label[data-ms-drag] { cursor: grab; }

/* Timeline: tickets without dates, listed under their project with a drag handle */
.tl-undated {
  position: absolute; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font: var(--t-meta); font-size: 11px; color: var(--muted); padding: 1px 8px; border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, var(--rule)); background: var(--surface);
}
.tl-tray-item.tl-undated { display: inline-block; cursor: grab; list-style: none; margin: 0; }

/* Team board settings */
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.team-settings .check { align-items: flex-start; }

form.inline { display: inline; }

/* Ticket panel: details left, updates and activity right when there's room; stacked otherwise */
.panel { container-type: inline-size; }
.panel-cols, .panel-col-main, .panel-col-side { display: grid; gap: var(--s5); align-content: start; }
@container (min-width: 900px) {
  .panel-cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
}

/* Drag the panel's left edge to resize it */
.panel-resize { position: fixed; z-index: 31; width: 8px; cursor: col-resize; touch-action: none; }
.panel-resize::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px;
  border-radius: 2px; background: transparent; transition: background .15s; }
.panel-resize:hover::after, body.is-resizing .panel-resize::after { background: var(--signal); }
body.is-resizing { cursor: col-resize; user-select: none; }

.tag-agent { font-size: 11px; padding: 0 5px; }

/* Custom kanban columns */
.kb-col-head.has-colour { background: var(--col); color: #fff; }
.col-colour { width: 44px; padding: 2px; height: 30px; }

/* Custom fields */
.custom-fields .field-form { display: inline-flex; gap: var(--s2); align-items: center; }
select.is-label { background: var(--tag); color: #fff; }
.c-cf { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cf-chip { text-decoration: none; }

/* Robot avatars */
.robot-pick { display: flex; flex-wrap: wrap; gap: var(--s2); }
.robot-opt { cursor: pointer; border-radius: 14px; padding: 3px; border: 2px solid transparent; }
.robot-opt input { position: absolute; opacity: 0; }
.robot-opt:has(input:checked) { border-color: var(--signal); }
.robot-opt img { display: block; border-radius: 12px; }

/* Kanban cards: compact by default (title, assignees, requester); the toggle opens the rest. */
.kb-tools { display: flex; justify-content: flex-end; padding: var(--s2) 0 0; }
:is([data-kb-expand], [data-list-expand]) .when-on,
:is([data-kb-expand], [data-list-expand])[aria-pressed="true"] .when-off { display: none; }
:is([data-kb-expand], [data-list-expand])[aria-pressed="true"] .when-on { display: inline; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.list-head .list-meta { margin-bottom: 0; }
.card-more { display: flex; flex-direction: column; gap: var(--s2); }
.card-more > summary { list-style: none; }
.card-more > summary::-webkit-details-marker { display: none; }
.card-people { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; cursor: pointer; min-height: 20px; }
.card-people .person { margin-right: 0; }
.card-req { display: inline-flex; align-items: center; gap: 4px; }
.card-chevron::before { content: "\25B8"; color: var(--muted); font-size: 11px; }
.card-more[open] .card-chevron::before { content: "\25BE"; }

/* Admin → Activity: visitor counts */
.visit-totals { gap: var(--s5); flex-wrap: wrap; }
.visit-totals strong { font-size: 18px; }
.visit-days > summary { cursor: pointer; color: var(--muted); margin-bottom: var(--s2); }
.visit-bar-col { width: 30%; }
.visit-bar { display: block; height: 8px; min-width: 1px; border-radius: 4px; background: var(--accent, #3b82f6); opacity: .7; }

/* Attachments: list, upload, drop target, files on updates, the viewer */
.att-list { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: var(--s2); }
.att { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.att-open { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; flex: 1 1 200px;
  background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.att-open:hover .att-name { text-decoration: underline; }
.att-open .attachment-thumb { max-height: 48px; max-width: 72px; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.att-ext { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 4px;
  border: 1px solid var(--rule); border-radius: var(--r-1); font: 600 10px/1 var(--font-sans); color: var(--ink-2, inherit); }
.att-meta { flex: 0 1 auto; }
.att-upload { display: flex; align-items: center; gap: var(--s2); }
.att-section.is-drop-target, form[data-comment-files].is-drop-target { outline: 2px dashed var(--accent, currentColor); outline-offset: 4px; border-radius: var(--r-2); }
.att-pending, .att-inline { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.att-pending:empty { display: none; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 8px;
  border: 1px solid var(--rule); border-radius: 999px; background: none; color: inherit; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.att-chip img { height: 20px; width: auto; border-radius: 3px; }
.att-viewer { width: min(1000px, 96vw); height: min(90vh, 1000px); padding: 0; border: 1px solid var(--rule); border-radius: var(--r-3, 8px); }
.att-viewer::backdrop { background: rgb(0 0 0 / 45%); }
#att-viewer-body { display: flex; flex-direction: column; height: 100%; }
.att-viewer-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3, 12px); border-bottom: 1px solid var(--rule); }
.att-viewer-head h2 { flex: 1; margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-viewer-content { flex: 1; min-height: 0; overflow: auto; padding: var(--s3, 12px); }
.att-full { display: block; max-width: 100%; margin: 0 auto; }
.att-pdf { width: 100%; height: 100%; min-height: 70vh; border: 0; }
.att-doc img { max-width: 100%; }
.att-sheet { margin-bottom: var(--s3, 12px); overflow-x: auto; }
.att-table { border-collapse: collapse; font-size: 13px; }
.att-table td { border: 1px solid var(--rule); padding: 2px 6px; white-space: nowrap; }
.att-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* Slack message link hover card */
.slack-pop { position: absolute; z-index: 60; width: min(420px, calc(100vw - 16px)); max-height: 60vh; overflow: auto;
  background: var(--paper, var(--bg)); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.slack-card { padding: var(--s2) var(--s3, 12px); display: grid; gap: var(--s2); font-size: 14px; }
.slack-card-text { white-space: pre-wrap; word-break: break-word; }
.slack-card-replies { list-style: none; margin: 0; padding: 0 0 0 var(--s2); border-left: 2px solid var(--rule); display: grid; gap: var(--s2); }

/* A blocked ticket with an update you haven't opened: slow pulse and "!" (seen.py) */
@keyframes news-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px var(--lbl-blocked); }
}
.card.has-news { animation: news-pulse 2.4s ease-in-out infinite; }
tr.has-news > td:first-child { animation: news-pulse 2.4s ease-in-out infinite; }
.news-flag { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--lbl-blocked); color: var(--lbl-blocked-ink); font: 700 11px/1 var(--font-sans); vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) {
  .card.has-news, tr.has-news > td:first-child { animation: none; outline: 2px solid var(--lbl-blocked); outline-offset: -2px; }
}

/* GitLab issues: the bottom part of the Merge requests box */
.mr-issues { margin-top: var(--s3, 12px); padding-top: var(--s3, 12px); border-top: 1px solid var(--rule); }
.mrs > div:first-child > .mr-issues { margin-top: 0; padding-top: 0; border-top: 0; }  /* issues only */
.mr-issues h4 { margin: 0 0 var(--s2); font-size: 13px; }

/* Top bar: Settings menu */
.nav-menu { position: relative; }
.nav-menu > summary { list-style: none; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu-caret::before { content: "\25BE"; font-size: 11px; color: var(--muted); }
.nav-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 260px;
  display: flex; flex-direction: column; padding: var(--s1);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2);
  box-shadow: var(--float);
}
.nav-menu-list a { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s3);
  border-radius: var(--r-1); color: inherit; text-decoration: none; }
.nav-menu-list a:hover, .nav-menu-list a:focus-visible { background: var(--hover, rgba(127,127,127,.12)); }
.nav-menu-list a[aria-current="page"] { font-weight: 600; }
/* Language menu: buttons styled like the menu's links */
.nav-menu-list button { display: block; width: 100%; text-align: left; padding: var(--s2) var(--s3);
  border: 0; border-radius: var(--r-1); background: none; color: inherit; font: inherit; cursor: pointer; }
.nav-menu-list button:hover, .nav-menu-list button:focus-visible { background: var(--hover, rgba(127,127,127,.12)); }
.nav-menu-list button[aria-current="true"] { font-weight: 600; }
form.nav-menu-list { min-width: 160px; }

/* ---------- Graph view (board/_graph.html): a node diagram ---------- */
.graph-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.graph-legend { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; }
.gl { font: var(--t-meta); padding: 2px 8px; border-radius: var(--r-1); }
.gl-line { font: var(--t-meta); color: var(--muted); padding: 0 4px; }
.gl-requires { color: var(--signal); }
.graph-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--rule);
  border-radius: var(--r-2); padding: var(--s2); width: 100%; box-sizing: border-box;
  /* a dotted canvas, like a node editor */
  background-color: var(--bg);
  background-image: radial-gradient(light-dark(rgb(0 0 0 / .09), rgb(255 255 255 / .08)) 1px, transparent 1px);
  background-size: 18px 18px; }
.graph { display: block; font-family: var(--font-sans); cursor: grab; touch-action: none; }
.gr-panning .graph, .gr-panning .graph * { cursor: grabbing; }
.graph-focus { font: var(--t-meta); display: inline-flex; align-items: center; gap: var(--s1); }

/* boxes (projects) */
.gr-box-bg { fill: light-dark(rgb(0 106 214 / .04), rgb(106 168 255 / .06));
  stroke: light-dark(rgb(0 106 214 / .25), rgb(106 168 255 / .3)); stroke-dasharray: 5 4; cursor: grab; }
.gr-box-bg:active { cursor: grabbing; }
.gr-inbox .gr-box-bg { fill: light-dark(rgb(0 0 0 / .03), rgb(255 255 255 / .03)); stroke: var(--rule); }
.gr-box-title { font-size: 13px; font-weight: 600; fill: var(--text); cursor: pointer; }
.gr-box-meta { font-weight: 400; fill: var(--muted); font-size: 11px; }
.gr-fold { font-size: 13px; fill: var(--muted); cursor: pointer; user-select: none; }
.gr-fold:hover, .gr-fold:focus { fill: var(--signal); outline: none; }

/* lines: under the cards */
.gr-links { pointer-events: none; }
.gr-link { fill: none; }
.gr-requires { stroke: var(--signal); stroke-width: 2; opacity: .85; }
.gr-related { stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 5 4; opacity: .55; }
.gr-arrowhead { fill: var(--signal); }

/* cards (tickets) */
.gr-node { cursor: pointer; }
.gr-card { fill: var(--surface); stroke: var(--rule); stroke-width: 1; cursor: move; }
.gr-node:hover .gr-card, .gr-node:focus .gr-card { stroke: var(--signal); stroke-width: 1.5; }
.gr-node text { pointer-events: none; }
.gr-key { font: 600 11px var(--font-mono); fill: var(--text); }
.gr-prio { font: 600 10px var(--font-sans); fill: var(--danger); }
.gr-state { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.gr-title { font-size: 12px; fill: var(--text); }
.gr-who { font-size: 10.5px; fill: var(--muted); }
.gr-port { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.gr-old { opacity: .45; }
.gr-selected .gr-card { stroke: var(--signal); stroke-width: 3; }
/* states: the stripe and the state word on a card, the same colours on the legend chips */
.gl-needs { background: #8B1A1A; color: #FFFFFF; font-weight: 600; }
.gr-needs .gr-stripe { fill: #C9314A; } .gr-needs .gr-state { fill: var(--danger); }
.gr-needs .gr-card { stroke: #C9314A; stroke-width: 2; }
.gl-running { background: var(--lbl-in_progress); color: var(--lbl-in_progress-ink); }
.gr-running .gr-stripe { fill: var(--lbl-in_progress); } .gr-running .gr-state { fill: var(--warn); }
.gl-waiting { background: light-dark(#D5D7DE, #5A5E78); color: var(--text); }
.gr-waiting .gr-stripe { fill: light-dark(#B4B8C6, #7A7E98); } .gr-waiting .gr-state { fill: var(--muted); }
.gl-done { background: var(--lbl-done); color: var(--lbl-done-ink); }
.gr-done .gr-stripe { fill: var(--lbl-done); } .gr-done .gr-state { fill: light-dark(#037F4C, #3DDC97); }
.gl-blocked { background: #F4A261; color: #323338; }
.gr-blocked .gr-stripe { fill: #F4A261; } .gr-blocked .gr-state { fill: light-dark(#A35200, #FFB454); }
.gr-needs .gr-port, .gr-blocked .gr-port { stroke: currentColor; }

/* moving, folding, focusing (static/js/graph.js) */
.gr-is-folded .gr-node, .gr-box-cards.gr-is-folded { display: none; }
.gr-hidden, .gr-folded-link { display: none; }
.gr-fixed, .gr-fixed .gr-box-bg, .gr-fixed .gr-card { cursor: default; }
.gr-fixed .gr-node .gr-card { cursor: pointer; }

/* Graph, Tree layout: board > project > milestone > ticket (static/js/graph.js) */
.gt-edge { fill: none; stroke: var(--muted); stroke-width: 1.4; opacity: .45; }
.gt-card { fill: var(--surface); stroke: var(--rule); stroke-width: 1; }
.gt-board .gt-card { fill: light-dark(#EEF3FD, #2A3358); stroke: light-dark(#9CB8EC, #5671B5); stroke-width: 1.5; }
.gt-project .gt-card { stroke: var(--signal); stroke-width: 1.5; }
.gt-milestone .gt-card { fill: light-dark(#F7F7FA, #262A45); stroke-dasharray: 4 3; }
.gt-item a, .gt-item [data-node] { cursor: pointer; }
.gt-item:hover .gt-card { stroke: var(--signal); stroke-width: 2; }
.gt-label { font-size: 13px; font-weight: 600; fill: var(--text); pointer-events: none; }
.gt-board .gt-label { font-size: 14px; }
.gt-sub { font-size: 11px; fill: var(--muted); pointer-events: none; }
.gt-fold { font-size: 12px; font-weight: 600; fill: var(--signal); cursor: pointer; user-select: none; }
.gt-fold:hover, .gt-fold:focus { text-decoration: underline; outline: none; }
.gt-bar-needs { fill: #C9314A; } .gt-bar-blocked { fill: #F4A261; }
.gt-bar-running { fill: var(--lbl-in_progress); } .gt-bar-waiting { fill: light-dark(#B4B8C6, #7A7E98); }
.gt-bar-done { fill: var(--lbl-done); }
.graph-focus[hidden] { display: none; }

/* ---------- Setting up a new company (platform/setup.html) ---------- */
.setup-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.setup-steps li { display: flex; align-items: center; gap: var(--s2); color: var(--muted); }
.setup-steps li.done, .setup-steps li.busy { color: var(--text); }
.setup-steps li.failed { color: var(--danger); }
.setup-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 50%; border: 2px solid var(--rule); font: 700 12px/1 var(--font-sans); }
.setup-steps li.done .setup-mark { background: var(--lbl-done); border-color: var(--lbl-done); color: var(--lbl-done-ink); }
.setup-steps li.failed .setup-mark { border-color: var(--danger); color: var(--danger); }
.setup-steps li.busy .setup-mark { border-color: var(--rule); border-top-color: var(--signal);
  animation: setup-spin .9s linear infinite; }
@keyframes setup-spin { to { transform: rotate(360deg); } }
.setup-progress { height: 10px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.setup-bar { height: 100%; background: var(--signal); border-radius: inherit; transition: width .9s linear; }
.setup-count { font-variant-numeric: tabular-nums; color: var(--muted); margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .setup-steps li.busy .setup-mark { animation: none; border-color: var(--signal); }
  .setup-bar { transition: none; }
}
/* ---------- Password sign-in and two-factor ---------- */
.signin-or { text-align: center; margin: var(--s2) 0 0; }
.code-input { max-width: 9em; letter-spacing: .2em; font-size: 18px; }
.qr { margin: var(--s2) 0; width: max-content; padding: 8px; background: #fff; border-radius: var(--r-2); }
.qr svg { display: block; width: 200px; height: auto; }
.banner-2fa { margin: 0; padding: var(--s2) var(--s4); background: var(--hover); border-bottom: 1px solid var(--rule); text-align: center; }
