/* ── Design tokens ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The browser's own [hidden] rule is display:none, but any author class setting
   display (e.g. .alert-banner { display: flex }) overrides it, leaving elements
   marked hidden fully visible. Restore the attribute's meaning app-wide. */
[hidden] { display: none !important; }

:root {
  /* ── Colour ────────────────────────────────────────────────────────────────
     The 2026 redesign palette. Cool greys throughout, replacing the earlier
     warm neutrals; the accent blue barely moved (#185FA5 → #1d5db8). The role
     names below are ours — the ramps they map onto are the handoff's. */

  /* Neutral ramp */
  --n-100: #ffffff;  --n-200: #eef0f3;  --n-300: #e0e3e8;
  --n-400: #c3c8d0;  --n-500: #9aa1ad;  --n-600: #6b7280;
  --n-700: #4b5563;  --n-800: #374151;  --n-900: #1f2937;

  /* Blue (accent) ramp */
  --a-100: #eff5fd;  --a-200: #dbeafe;  --a-300: #bcd6f7;
  --a-400: #7fb0ec;  --a-500: #3b82d6;  --a-600: #1d5db8;
  --a-700: #1a4b96;  --a-800: #163b74;  --a-900: #122c55;

  /* Green (accent-2) ramp */
  --g-100: #ecfdf5;  --g-200: #d1fae5;  --g-300: #a7ecca;
  --g-400: #5fd3a3;  --g-500: #10b981;  --g-600: #059669;
  --g-700: #047857;  --g-800: #065f46;  --g-900: #064e3b;

  --bg-page:       #f6f7f9;
  --bg-surface:    #ffffff;
  --bg-subtle:     #fbfbfc;
  --bg-hover:      var(--n-200);
  --bg-selected:   var(--a-100);
  --bg-info:       var(--a-200);
  --bg-success:    var(--g-200);
  --bg-warning:    #fde8c8;
  --bg-danger:     #fee2e2;

  --text-primary:  #111827;
  --text-secondary:var(--n-700);
  --text-tertiary: var(--n-600);
  --text-info:     var(--a-700);
  --text-success:  var(--g-700);
  --text-warning:  #92400e;
  --text-danger:   #b91c1c;

  --border:        #e5e7eb;
  /* Lighter than --border, for rules inside a card or list. Referenced in three
     places but never defined until now, which silently dropped those borders. */
  --border-subtle: var(--n-200);
  --border-md:     var(--n-300);
  --border-strong: var(--n-400);

  --accent:        #1d5db8;
  --accent-hover:  var(--a-700);

  /* Radius scale from the 2026 redesign handoff (6 / 10 / 14). */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;

  --font:      'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Shadow scale from the handoff. lg is for slide-overs and modals. */
  --shadow-sm: 0 1px 2px rgba(17,24,39,0.06);
  --shadow-md: 0 2px 8px rgba(17,24,39,0.08);
  --shadow-lg: 0 16px 40px rgba(17,24,39,0.18);

  /* ── Priority semantics ──────────────────────────────────────────────────
     From the handoff. Our domain names the top level Critical and the middle
     one Medium, where the design says Urgent and Normal; the colours carry
     over unchanged. */
  --pri-critical-bg: #FEE2E2;  --pri-critical-fg: #B91C1C;  --pri-critical-bar: #EF4444;
  --pri-high-bg:     #FDE8C8;  --pri-high-fg:     #92400E;  --pri-high-bar:     #F59E0B;
  --pri-medium-bg:   #DBEAFE;  --pri-medium-fg:   #1A4B96;  --pri-medium-bar:   #3B82D6;
  --pri-low-bg:      #EEF0F3;  --pri-low-fg:      #6B7280;  --pri-low-bar:      #C3C8D0;

  /* ── Tokens added for dark mode ───────────────────────────────────────────
     Every one of these replaces a colour literal that sat in a component rule.
     A literal does not flip when the theme does, so a rule with a tokenised
     background and a hard-coded foreground renders one theme's text on the
     other theme's ground — which is the whole failure mode dark mode has.

     Light values are byte-identical to the literals they replace, so this half
     of the change is invisible. */

  /* Foreground on a solid fill — accent, success and danger buttons, the avatar,
     badges on a coloured ground. NOT --n-100 or --bg-surface: those are ground
     roles and invert, which would put dark text on a mid-blue button. */
  --text-on-fill: #ffffff;

  /* 1px rings standing in for borders. Distinct from the shadow scale, which
     carries offset and blur — swapping one for the other turns a crisp hairline
     into a soft drop. */
  --ring-hairline:        rgba(17,24,39,0.05);
  --ring-hairline-md:     rgba(17,24,39,0.06);
  --ring-hairline-strong: rgba(17,24,39,0.12);
  --ring-inset:           rgba(17,24,39,0.12);

  --shadow-sm-hover:  0 1px 3px rgba(17,24,39,0.10);
  --shadow-md-hover:  var(--shadow-md-hover);
  --shadow-popover:   0 6px 20px rgba(0,0,0,0.16);
  --shadow-accent:    var(--shadow-accent);
  --shadow-success:   var(--shadow-success);

  --border-info:           var(--border-info);
  --border-success:        var(--border-success);
  --border-danger-subtle:  var(--border-danger-subtle);
  --border-accent-subtle:  var(--border-accent-subtle);
  --border-focus:          var(--border-focus);
  --ring-focus:            rgba(24,95,165,0.1);

  --bg-warning-subtle: #fef8ee;
  --danger-hover:      #991b1b;

  /* Modal grounds. A scrim tuned for a light page is too weak over a dark one. */
  --scrim:      rgba(17,24,39,0.45);
  --scrim-soft: rgba(15,23,42,0.28);

  /* Light in BOTH themes — the mark is a dark-ink transparent PNG. */
  --logo-ground: #ffffff;
}

/* Headings carry the handoff's tighter tracking. */
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; line-height: 1.12; }

/* Every interactive element gets a visible focus ring — the handoff is explicit
   that the browser default is never acceptable. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Quieter scrollbars throughout, per the handoff. */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-md);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-track { background: transparent; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Shell layout ──────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────
   Three fixed regions: brand, a nav that scrolls on its own, and the user card
   pinned to the floor. The nav scrolls so a long board list can never push the
   user card off screen. */
.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--bg-page);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Same height, background and rule as .topbar, so the brand block and the page
   title read as one continuous white header strip across the top of the app
   rather than two separate panels meeting at a corner. */
.sidebar-logo {
  height: 56px;
  padding: 0 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* The mark is a transparent PNG, so it needs its own white ground now that the
   sidebar sits on the tinted page colour. */
.logo-img {
  width: 34px; height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  /* Tokenised, but NOT to a ground role: the mark is a transparent PNG drawn in
     dark ink, so it needs a light chip behind it in BOTH themes. --bg-surface
     would invert and render the logo invisible on its own background. The dark
     value stays light, just dimmed so it is not the brightest thing on screen. */
  background: var(--logo-ground);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.logo-text {
  font-size: 13.5px; font-weight: 600;
  color: var(--text-primary); letter-spacing: -0.2px;
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-sub {
  font-size: 11px; color: var(--text-tertiary); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  /* A quiet scrollbar — the nav should not look like a scrolling region until
     it actually needs to be one. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-md) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-md); border-radius: 8px;
  border: 2px solid var(--bg-page);
}
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.nav-section {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  margin: 2px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  user-select: none;
  text-decoration: none;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item i {
  font-size: 18px; flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color 0.14s ease;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item:hover i { color: var(--text-secondary); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.nav-item.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--ring-hairline);
}
.nav-item.active i { color: var(--accent); }
/* Marker sits flush against the sidebar edge, aligned to the item's margin. */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

/* Count of boards, sitting at the end of the Boards row. */
.nav-count {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  background: var(--border);
  padding: 1px 7px;
  border-radius: 20px;
}
.nav-item.active .nav-count { color: var(--accent); background: var(--bg-info); }

/* Individual boards nested under the Boards nav item, with a guide rail so the
   nesting reads without relying on indentation alone. */
.nav-group { position: relative; margin: 2px 0 4px; }
.nav-group::before {
  content: "";
  position: absolute;
  left: 31px; top: 2px; bottom: 2px;
  width: 1px;
  background: var(--border-md);
}
.nav-item--sub {
  padding: 6px 12px 6px 34px;
  margin: 1px 10px;
  font-size: 12.5px;
  gap: 8px;
}
.nav-item--sub i { font-size: 9px; color: var(--border-strong); }
.nav-item--sub:hover i { color: var(--text-tertiary); }
.nav-item--sub.active { font-weight: 600; }
.nav-item--sub.active i { color: var(--accent); }
.nav-item--sub.active::before { height: 14px; }

/* The open board's own views, a step further in again. Their icons are real glyphs
   rather than the bullet the board links use, so the two levels stay distinguishable. */
.nav-item--view { padding-left: 46px; font-size: 12px; }
.nav-item--view i { font-size: 14px; color: var(--text-tertiary); }
.nav-item--view.active i { color: var(--accent); }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--text-on-fill);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.6;
}

/* User card, pinned to the floor of the sidebar. */
.sidebar-bottom { margin-top: auto; flex-shrink: 0; padding: 10px; }
.sidebar-user {
  padding: 9px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--ring-hairline-md);
  transition: box-shadow 0.14s ease, background 0.14s ease;
}
.sidebar-user:hover {
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm-hover), 0 0 0 1px var(--ring-hairline-strong);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-on-fill);
  flex-shrink: 0;
}
/* A real photo replaces the initials disc, so it has to fill the same circle rather
   than sit letterboxed inside it. */
.user-avatar--photo { object-fit: cover; background: none; }
.user-id { min-width: 0; flex: 1; }
.user-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role { font-size: 11px; color: var(--text-tertiary); }
.user-signout {
  font-size: 16px; color: var(--text-tertiary); flex-shrink: 0;
  transition: color 0.14s ease;
}
.sidebar-user:hover .user-signout { color: var(--text-danger); }

/* ── Main area ─────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  padding: 0 24px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  /* The three slots — leading controls, title, actions — had nothing between them,
     so on a board the last grouping entry sat flush against the page title. */
  gap: 18px;
}
.page-title {
  font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.2px;
  /* Never breaks: the strip is a fixed height, and a two-line title bulges it. */
  white-space: nowrap;
}

/* Beside the menu toggle, not adrift between it and the search box.
   The topbar is space-between, which was right when the title was the FIRST child —
   it sat on the left edge because there was no free space before it. Adding the menu
   toggle gave space-between a gap to fill ahead of the title, and every titled page
   from the dashboard down had its name floating in the middle of the strip. The auto
   margin claims that space before justify-content can divide it, so the title follows
   the toggle and the search box and the actions stay right. Direct children only: the
   .page-title inside .crumbs is in a flex row of its own, where an auto margin would
   shove the title away from its own chevron. */
.topbar > .page-title,
.topbar > .crumbs { margin-right: auto; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.13s, transform 0.1s;
  border: 1px solid transparent;
  font-family: var(--font);
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-md);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: var(--text-on-fill);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-success {
  background: var(--g-700);
  color: var(--text-on-fill);
  box-shadow: var(--shadow-success);
}
.btn-success:hover { background: var(--g-800); }
.btn-danger {
  background: var(--text-danger);
  color: var(--text-on-fill);
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn i { font-size: 15px; }

/* ── SLA summary cards ─────────────────────────────────────────────────────── */
.sla-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.sla-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.sla-card-label {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sla-card-label i { font-size: 14px; }
.sla-card-value { font-size: 24px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.5px; }
.sla-card-value.plan { font-size: 15px; margin-top: 2px; }
.sla-card-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.sla-bar-track { height: 5px; background: var(--bg-page); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.sla-bar-fill  { height: 100%; border-radius: 99px; }
.sla-card-link { text-decoration: none; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s; }
.sla-card-link:hover { box-shadow: var(--shadow-md-hover); transform: translateY(-1px); }

/* ── Ticket list card ──────────────────────────────────────────────────────── */
.tickets-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.tickets-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.tickets-head-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 500;
  text-decoration: none;
  background: none;
  font-family: var(--font);
}
.pill:hover { background: var(--bg-hover); text-decoration: none; color: var(--text-primary); }
.pill.active {
  background: var(--bg-info);
  color: var(--text-info);
  border-color: var(--border-accent-subtle);
}

/* ── Ticket rows ───────────────────────────────────────────────────────────── */
.ticket-row {
  display: flex;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--bg-hover); text-decoration: none; }

.priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.p-critical { background: var(--pri-critical-bar); }
.p-high     { background: var(--pri-high-bar); }
.p-medium   { background: var(--pri-medium-bar); }
.p-low      { background: var(--pri-low-bar); }

.ticket-id {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  width: 72px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.ticket-info { flex: 1; min-width: 0; }
.ticket-subject {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-open     { background: var(--bg-info);    color: var(--text-info); }
.badge-inprogress { background: var(--bg-warning); color: var(--text-warning); }
.badge-softclose { background: var(--bg-success); color: var(--text-success); }
.badge-closed   { background: var(--bg-subtle);   color: var(--text-secondary); border: 1px solid var(--border-md); }
/* Struck through rather than merely grey. Cancelled sits beside Closed in every list,
   and the two must not be told apart only by reading the word — a glance should say
   "ended without being done". */
.badge-cancelled {
  background: var(--bg-subtle); color: var(--text-tertiary);
  border: 1px dashed var(--border-md); text-decoration: line-through;
}
.badge-danger   { background: var(--bg-danger);   color: var(--text-danger); }

/* ── Detail / three-column layout ─────────────────────────────────────────── */
.detail-shell {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-width: 0;
}
/* Wider than a plain sidebar: this column now carries the activity timeline,
   which is unreadable in the 296px the panel used to be. */
.detail-panel {
  width: 400px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-tid  { font-size: 11px; color: var(--text-secondary); margin-bottom: 5px; font-family: var(--font-mono); }
.detail-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.detail-badges { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.detail-meta {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}
.meta-row { display: flex; justify-content: space-between; align-items: center; }
.meta-label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.meta-label i { font-size: 13px; }
.meta-value { font-size: 12.5px; color: var(--text-primary); font-weight: 500; }

/* ── SLA gauges ────────────────────────────────────────────────────────────── */
.gauge-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gauge-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.gauge-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 3px; }
.gauge-label i { font-size: 12px; }
.gauge-value { font-size: 12px; font-weight: 600; }
.gauge-value.warn  { color: var(--text-danger); }
.gauge-value.ok    { color: var(--text-success); }
.gauge-value.amber { color: var(--text-warning); }
.gauge-track { height: 8px; background: var(--bg-page); border-radius: 99px; overflow: hidden; }
.gauge-fill  { height: 100%; border-radius: 99px; }
.gauge-fill-blue  { background: var(--a-500); }
.gauge-fill-amber { background: var(--pri-high-bar); }
.gauge-fill-red   { background: var(--pri-critical-bar); }
.gauge-fill-green { background: var(--g-600); }
.gauge-stats {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Timeline ──────────────────────────────────────────────────────────────── */
.timeline-wrap { flex: 1; overflow-y: auto; padding: 14px 16px; }
.timeline-heading {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.tl-item { display: flex; gap: 10px; margin-bottom: 16px; }
.tl-spine { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 3px;
  flex-shrink: 0;
}
.tl-dot.muted { background: var(--border-strong); }
.tl-dot.success { background: var(--g-600); }
.tl-dot.danger  { background: var(--pri-critical-bar); }
.tl-line { flex: 1; width: 1px; background: var(--border); margin-top: 4px; min-height: 10px; }
.tl-body { flex: 1; }
.tl-author { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.tl-role   { font-weight: 400; color: var(--text-secondary); }
.tl-msg    { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.55; }
.tl-time   { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* ── Reply / action box ────────────────────────────────────────────────────── */
.reply-box {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-subtle);
}
.reply-input {
  width: 100%;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  resize: none;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reply-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring-focus);
}
.reply-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.reply-hint { font-size: 11px; color: var(--text-tertiary); }
.reply-file-zone { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.reply-file-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--accent); cursor: pointer; padding: 3px 8px;
  border: 1px dashed var(--border); border-radius: 5px; transition: background .15s;
}
.reply-file-label:hover { background: var(--bg-subtle); }
.reply-file-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Ticket description block ──────────────────────────────────────────────── */
/* ── Ticket hero (internal detail, centre column) ───────────────────────────
   The ticket's own identity — number, subject, state and the headline facts.
   Lives at the top of the centre column so it reads as the page's subject
   rather than as sidebar metadata. */
.ticket-hero {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.ticket-hero-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.ticket-hero-num {
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 600; color: var(--accent);
}
.ticket-hero-line {
  font-size: 12px; color: var(--text-secondary);
  padding-left: 10px; border-left: 1px solid var(--border-md);
}
.ticket-hero-badges { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.ticket-hero-title {
  font-size: 23px; font-weight: 600; line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 16px;
}

/* Headline facts as a stat row, not label:value rows — this is a header, and
   a header should scan horizontally. */
.ticket-facts { display: flex; flex-wrap: wrap; gap: 12px 30px; }
.ticket-fact { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fact-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.fact-value {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
}
.fact-value i { font-size: 14px; color: var(--text-tertiary); }
.fact-value.is-warning { color: var(--text-warning); }
.fact-value.is-muted {
  font-family: var(--font-mono); font-size: 12px;
  font-weight: 400; color: var(--text-tertiary);
}

/* Shared section wrapper for the right panel's stacked blocks. */
.panel-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-tertiary);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}

.ticket-description-block {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}
/* The description in a surface box of its own. pre-wrap matters: customers type
   line breaks and lists, and those were being collapsed into one run-on
   paragraph. Capped in height so a long one scrolls rather than pushing the
   checklist and the action buttons below the fold. */
.ticket-description-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow-y: auto;
}
.ticket-description-block h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.ticket-description-block p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Action banners (soft-close, etc.) ─────────────────────────────────────── */
.action-banner {
  margin: 14px 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-banner--success { background: var(--bg-success); border: 1px solid var(--border-success); color: var(--text-success); }
.action-banner--info    { background: var(--bg-info);    border: 1px solid var(--border-info); color: var(--text-info); }
.action-banner-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.action-banner-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ── Alert banner (top of content) ────────────────────────────────────────── */
.alert-banner {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-banner--success { background: var(--bg-success); color: var(--text-success); border: 1px solid var(--border-success); }
.alert-banner--error   { background: var(--bg-danger);  color: var(--text-danger);  border: 1px solid var(--border-danger-subtle); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-state i { font-size: 36px; color: var(--text-tertiary); }
.empty-state p { font-size: 13px; }
/* The second line of an empty state: what to DO about it, set quieter than the
   statement above so the two do not compete. Capped in width because a centred
   sentence running the full width of a board page is hard to read back. */
.empty-state-hint {
  max-width: 44ch;
  font-size: 12px !important;
  color: var(--text-tertiary);
}

/* ── New ticket form ───────────────────────────────────────────────────────── */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  max-width: 720px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.form-control {
  padding: 8px 11px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  font-size: 13px;
  width: 100%;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring-focus);
}
.form-control select, select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6A65' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.field-error { font-size: 11.5px; color: var(--text-danger); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.validation-summary-valid { display: none !important; }
.validation-summary-errors {
  display: block !important;
  background: var(--bg-danger);
  border: 1px solid var(--border-danger-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--text-danger);
  font-size: 13px;
}
.validation-summary-errors ul { list-style: none; margin: 0; padding: 0; }
.validation-summary-errors ul li + li { margin-top: 4px; }

/* ── Auth pages (login / accept invitation) ────────────────────────────────── */
.auth-page {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; padding: 24px;
  background: var(--bg-page);
}
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.auth-card__title { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 4px; }
.auth-card__subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.auth-card__footer { margin-top: 20px; font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ── Kanban board ──────────────────────────────────────────────────────────── */
/* .content is not a flex column, so the wrap takes an explicit bounded height
   to give each column its own vertical scroll without touching global layout. */
.kanban-wrap {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  height: calc(100vh - 140px);
  padding-bottom: 8px;
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.kanban-column.kanban-backlog {
  border-style: dashed;
  border-color: var(--border-md);
}

.kanban-column-accent { height: 3px; background: var(--accent); flex-shrink: 0; }

.kanban-column-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-column-head > span:first-child {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-column-heading {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.kanban-column-name {
  display: flex; align-items: center; gap: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Sprint date range under the column name. */
.kanban-column-sub {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 400;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.kanban-column-sub i { font-size: 11px; }
.kanban-active-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-success);
  flex-shrink: 0;
}
.kanban-column-count {
  flex-shrink: 0;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px; font-weight: 500;
}

.kanban-column-add {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  text-decoration: none;
}
.kanban-column-add i { font-size: 14px; }
.kanban-column-add:hover { background: var(--bg-hover); color: var(--accent); }

.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 80px;
}
.kanban-column-body.is-drop-target {
  background: var(--bg-selected);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

.kanban-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .12s ease;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.is-dragging { opacity: .45; }
.kanban-card.is-saving { opacity: .5; pointer-events: none; }

/* Chip row — priority, product line, then the key set hard right in mono. */
.kanban-card-top {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 7px; flex-wrap: wrap;
}
.kanban-card-num {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  color: var(--text-tertiary);
}

/* Priority pill. Semantics from the redesign handoff — a filled pill states the
   level outright, where the old 8px dot needed a tooltip to be read at all. */
.pri-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  white-space: nowrap;
}
.pri--critical { background: var(--pri-critical-bg); color: var(--pri-critical-fg); }
.pri--high     { background: var(--pri-high-bg);     color: var(--pri-high-fg); }
.pri--medium   { background: var(--pri-medium-bg);   color: var(--pri-medium-fg); }
.pri--low      { background: var(--pri-low-bg);      color: var(--pri-low-fg); }

.chip {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600;
  white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip--muted { background: var(--pri-low-bg); color: var(--pri-low-fg); }

.kanban-card-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
  text-wrap: pretty;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
  text-decoration: none;
}

/* Which customer the work is for. */
.kanban-card-customer {
  margin-top: 5px;
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Checklist progress bar on the card face. */
.kanban-card-progress {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.kcp-track {
  flex: 1; height: 6px; border-radius: 999px;
  background: var(--pri-low-bg); overflow: hidden;
}
.kcp-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}
.kcp-fill.is-done { background: var(--text-success); }
.kcp-label {
  font-size: 10.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

/* SLA chip, derived from the scheduled date. Red and amber, deliberately — the
   handoff's own notes reject the prototype's blue for this. */
.sla-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  white-space: nowrap;
}
.sla-chip i { font-size: 12px; }
.sla--overdue { background: var(--pri-critical-bg); color: var(--pri-critical-fg); }
.sla--today   { background: var(--pri-high-bg);     color: var(--pri-high-fg); }
.sla--soon    { background: var(--pri-low-bg);      color: var(--pri-low-fg); }
.sla--later   { background: var(--pri-low-bg);      color: var(--pri-low-fg); }

/* An overdue card earns a border, so it is findable without reading chips. */
.kanban-card.is-overdue { border-color: var(--pri-high-bar); }

.kanban-card-signals {
  display: flex; align-items: center; gap: 5px;
  flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end;
}
.kanban-card-title:hover { color: var(--accent); text-decoration: underline; }

/* ── Card title row: complete circle · title · delete ──────────────────────────
   These rules were written into site.css, which only _Layout loads — every
   internal page uses _InternalLayout and this file, so none of them applied and
   both controls rendered unstyled.

   align-items:flex-start, not center: the title wraps to two lines and centring
   would float both controls to the middle of a tall title instead of aligning
   them with its first line. */
.task-card-actions {
  display: flex; align-items: flex-start; gap: 6px;
}
.task-card-actions > .task-card-title {
  flex: 1;
  min-width: 0;   /* or a long unbroken subject pushes the delete button off the card */
}

/* Shared icon button for the row. Quiet by default — a destructive control on
   every card should not compete with the subject for attention — and only takes
   its danger colour on hover, so intent is visible before the click.
   Deliberately NOT revealed on hover: a delete button that appears under a
   moving cursor is one a cursor can land on by accident. */
.task-card-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-tertiary); font-size: 14px; cursor: pointer;
}
.task-card-icon-btn:hover { background: var(--bg-danger); color: var(--text-danger); }
.task-card-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-card-delete { margin: 0; flex-shrink: 0; }

/* Cancel takes amber on hover where Delete takes red. Both end the record, and the
   difference is worth seeing before the click: cancelling keeps it and its reason,
   deleting destroys both. Identical hover colours would make the two one gesture apart
   with nothing to tell them apart. */
.task-card-cancel:hover { background: var(--bg-warning); color: var(--text-warning); }

/* The completion circle. 22px to match the row's other control and the checklist's
   icon buttons — the first version was 32px with a 24px glyph, half again the
   height of the title beside it.

   Hover and completed must not look alike. The first version gave :hover and
   :disabled the same green fill, so passing the cursor over an unfinished task
   made it look done. Hover is now neutral; green is reserved for actually
   complete, and the icon itself changes to a filled check as well as colour, so
   the state does not rest on colour alone. */
.task-complete-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0;
  background: none; border: none; border-radius: 50%;
  color: var(--text-tertiary); font-size: 16px; cursor: pointer;
}
.task-complete-circle:hover:not(:disabled) {
  background: var(--bg-hover); color: var(--text-primary);
}
.task-complete-circle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-complete-circle:disabled {
  color: var(--text-success); background: none; cursor: default;
}

/* A day cell gives a card a fifth of a column's height, so the row tightens. */
.cal-card .task-card-actions { gap: 4px; }
.cal-card .task-complete-circle,
.cal-card .task-card-icon-btn { width: 18px; height: 18px; font-size: 13px; }

.task-complete-dialog { width: min(380px, calc(100vw - 32px)); }

/* Assignee row and inline assign popover. */
.kanban-card-foot {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.kanban-assignee { flex: 1; min-width: 0; display: flex; align-items: center; }

.kanban-assign { position: relative; flex-shrink: 0; }
.kanban-assign-toggle {
  list-style: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.kanban-assign-toggle::-webkit-details-marker { display: none; }
.kanban-assign-toggle:hover { background: var(--bg-hover); color: var(--accent); }
.kanban-assign[open] .kanban-assign-toggle { background: var(--bg-selected); color: var(--accent); }

/* An absolutely-positioned child of a closed <details> still generates boxes in
   Chrome, so the popover must be hidden explicitly rather than relying on the
   element's default collapse behaviour. */
.kanban-assign:not([open]) .kanban-assign-form { display: none; }

/* Fixed, not absolute: the column body scrolls (overflow-y:auto) and would clip an
   absolutely-positioned popover, forcing the user to scroll to reach the fields.
   Fixed escapes that clipping; board.js places it against the toggle button. */
.kanban-assign-form {
  position: fixed; z-index: 100;
  width: 210px; padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.kanban-assign-form label {
  display: block; margin-bottom: 3px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em;
}
.kanban-assign-form select,
.kanban-assign-form input {
  width: 100%; margin-bottom: 8px; padding: 5px 7px;
  font-family: inherit; font-size: 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
.kanban-assign-form select:focus,
.kanban-assign-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Quick-create task popup ───────────────────────────────────────────────
   Same recipe as the assign popover above, including the explicit hide: an
   absolutely-positioned child of a closed <details> still generates boxes in
   Chrome. Wider, because it holds a people picker rather than a plain select. */
.kanban-quick-add:not([open]) .kanban-quick-add-form { display: none; }
.kanban-quick-add > summary { list-style: none; cursor: pointer; }
.kanban-quick-add > summary::-webkit-details-marker { display: none; }

.kanban-quick-add-form {
  position: fixed; z-index: 100;
  width: 260px; padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  /* Expanded, the form can outgrow a short viewport. Scroll inside it rather than
     letting it run off the bottom — board.js clamps the position, not the height. */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.kanban-quick-add-form label {
  display: block; margin-bottom: 3px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em;
}
.kanban-quick-add-form input[type="text"],
.kanban-quick-add-form input[type="date"] {
  width: 100%; margin-bottom: 9px; padding: 6px 8px;
  font-family: inherit; font-size: 12.5px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
.kanban-quick-add-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.kanban-quick-add-form .people-picker { margin-bottom: 9px; }
.kanban-quick-add-form textarea,
.kanban-quick-add-form select {
  width: 100%; margin-bottom: 9px; padding: 6px 8px;
  font-family: inherit; font-size: 12.5px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
.kanban-quick-add-form textarea { resize: vertical; min-height: 54px; }
.kanban-quick-add-form select:focus,
.kanban-quick-add-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* "More options" — expands the popup in place rather than sending the user to a
   separate page and losing what they had already typed. */
.kanban-quick-more { margin: 2px 0 10px; }
.kanban-quick-more > summary {
  list-style: none; cursor: pointer;
  padding: 4px 0;
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary);
  user-select: none;
}
.kanban-quick-more > summary::-webkit-details-marker { display: none; }
.kanban-quick-more > summary::before {
  content: "▸"; display: inline-block; width: 12px;
  transition: transform .12s ease;
}
.kanban-quick-more[open] > summary::before { transform: rotate(90deg); }
.kanban-quick-more > summary:hover { color: var(--accent); }
.kanban-quick-more[open] > summary { color: var(--accent); }

/* ── Editable record fields on the ticket detail page ──────────────────────
   The field IS the control. Each one is styled to read exactly as the value it
   replaced, so the page looks unchanged until you interact with it — no edit mode,
   no second copy of the layout to drift. Borders and background appear on hover and
   focus, which is what tells you it can be typed into. */

.hero-edit,
.hero-edit-title,
.planning-edit,
.meta-edit {
  font: inherit; color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background .12s ease, border-color .12s ease;
}
.hero-edit:hover,
.hero-edit-title:hover,
.planning-edit:hover,
.meta-edit:hover {
  background: var(--bg-surface);
  border-color: var(--border-md);
}
.hero-edit:focus,
.hero-edit-title:focus,
.planning-edit:focus,
.meta-edit:focus {
  background: var(--bg-surface);
  outline: 2px solid var(--accent); outline-offset: -1px;
}

/* Read-only on a closed record: no affordance, because there is nothing to do. */
.hero-edit[disabled], .hero-edit-title[readonly],
.planning-edit[readonly], .meta-edit[disabled] {
  cursor: default;
}
.hero-edit[disabled]:hover, .hero-edit-title[readonly]:hover,
.planning-edit[readonly]:hover, .meta-edit[disabled]:hover {
  background: transparent; border-color: transparent;
}

/* The subject, still the page's headline. */
.hero-edit-title {
  display: block; width: 100%;
  margin: 0 0 2px; padding: 2px 6px 2px 4px;
  margin-left: -4px;
}

/* Product line, sitting in the hero's top row where the plain text was. */
.hero-edit--line {
  padding: 2px 4px;
  font-size: 12px; color: var(--text-secondary);
  max-width: 220px;
}

/* Type and priority, shaped like the badges beside them. */
.hero-edit--badge {
  padding: 2px 6px;
  font-size: 11px; font-weight: 600;
  border-radius: 999px;
  -webkit-appearance: none; appearance: none;
}
.hero-edit--badge:hover, .hero-edit--badge:focus { border-radius: 999px; }

/* Description: the box itself, now typeable. Keeps the bordered look it already had. */
.ticket-description-edit {
  width: 100%; min-height: 88px; resize: vertical;
  font: inherit; color: inherit;
}

.planning-edit {
  width: 130px; padding: 2px 6px;
  font-size: 15px; font-weight: 600;
}

.meta-edit { width: 100%; padding: 2px 4px; font-size: 12px; }

/* Validation from the record form, shown where the description ends rather than
   floating at the top of a long page. */
.ticket-edit-errors {
  margin: 0 18px 12px; padding: 8px 10px;
  font-size: 12px; color: var(--text-danger);
  background: var(--bg-danger); border-radius: var(--radius-sm);
}
.ticket-edit-errors ul { margin: 0; padding-left: 16px; }
.kanban-card-meta {
  margin-top: 7px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-secondary);
}

/* ── Checklist on a board card ─────────────────────────────────────────────
   The summary is the 2/5 progress badge; opening it reveals the steps, which can
   be ticked, owned, and added without leaving the board. Expands inline rather
   than as a fixed popover — a list of steps wants the card's full width. */
.kanban-checklist-panel { margin-top: 7px; }
.kanban-checklist {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; cursor: pointer; list-style: none;
  background: var(--bg-subtle); color: var(--text-secondary);
}
.kanban-checklist::-webkit-details-marker { display: none; }
.kanban-checklist i { font-size: 11px; }
.kanban-checklist.is-done { background: var(--bg-success); color: var(--text-success); }
/* No steps yet: a quiet affordance, not a 0/0 badge on every card. */
.kanban-checklist.is-empty { background: none; color: var(--text-tertiary); padding: 1px 2px; }
.kanban-checklist.is-empty:hover { color: var(--accent); }

.kcl-body {
  margin-top: 7px; padding: 7px 8px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface);
}
.kcl-track {
  height: 3px; margin-bottom: 7px; border-radius: 99px;
  background: var(--border-md); overflow: hidden;
}
.kcl-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.kcl-fill.is-done { background: var(--text-success); }

.kcl-list { list-style: none; margin: 0; padding: 0; }
.kcl-row {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 0;
}
.kcl-tick-form { flex-shrink: 0; line-height: 1; }
.kcl-tick {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 15px; line-height: 1; color: var(--text-tertiary);
}
.kcl-tick:hover { color: var(--accent); }
.kcl-row.is-done .kcl-tick { color: var(--text-success); }

.kcl-text {
  flex: 1; min-width: 0;
  font-size: 11.5px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kcl-row.is-done .kcl-text { text-decoration: line-through; color: var(--text-tertiary); }

/* Read-only because another record owns the work. The static tick keeps the row's
   alignment identical to an interactive one, so a locked step does not make the
   list look ragged. */
.kcl-tick.is-static { cursor: default; opacity: 0.75; }
.kcl-row.is-split .kcl-text { color: var(--text-secondary); }
.kcl-split {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--accent); text-decoration: none;
}
.kcl-split:hover { text-decoration: underline; }

.kcl-owner-form { flex-shrink: 0; }
.kcl-owner-form select {
  max-width: 78px;
  padding: 1px 3px;
  font-family: inherit; font-size: 10.5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text-secondary);
}

.kcl-add {
  display: flex; align-items: center; gap: 4px;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}
.kcl-add input[type="text"] { flex: 1; min-width: 0; }
.kcl-add input,
.kcl-add select {
  padding: 3px 5px;
  font-family: inherit; font-size: 11px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
.kcl-add select { max-width: 62px; }
.kcl-add-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 22px; height: 22px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text-secondary);
  cursor: pointer; font-size: 13px;
}
.kcl-add-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.kcl-open {
  display: block; margin-top: 6px;
  font-size: 10.5px; color: var(--text-tertiary); text-decoration: none;
}
.kcl-open:hover { color: var(--accent); }

/* Bucket + sprint tags — always shown, whichever way the board is grouped. */
.kanban-card-tags {
  margin-top: 7px;
  display: flex; gap: 5px; flex-wrap: wrap;
}
.kanban-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10.5px; font-weight: 500;
  white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.kanban-tag i { font-size: 11px; flex-shrink: 0; }
.kanban-tag--bucket { background: var(--bg-info);    color: var(--text-info); }
.kanban-tag--sprint { background: var(--bg-success); color: var(--text-success); }
.kanban-tag--board  { background: var(--bg-warning); color: var(--text-warning); }

/* ── Colour labels ─────────────────────────────────────────────────────────
   The palette. Each entry is a matched pair — a tinted background and a
   foreground dark enough to read on it — exactly as the priority pills are
   built, because a label is likewise a chip with text inside it.

   🔴 Hand-mirrored against LabelPalette.All in
   src/SIROCo.HelpDesk.Domain/Labels/LabelPalette.cs. Adding a key there
   without a rule here renders an unstyled chip; adding a rule here that the
   C# list does not know about makes it unreachable. Change one, change the
   other — the same standing arrangement as window.SirocoAvatars against
   _AvatarStack.cshtml. */
:root {
  --lbl-slate-bg:   #EEF0F3;  --lbl-slate-fg:   #4B5563;
  --lbl-rose-bg:    #FFE4E6;  --lbl-rose-fg:    #9F1239;
  --lbl-red-bg:     #FEE2E2;  --lbl-red-fg:     #B91C1C;
  --lbl-orange-bg:  #FFEDD5;  --lbl-orange-fg:  #C2410C;
  --lbl-amber-bg:   #FDE8C8;  --lbl-amber-fg:   #92400E;
  --lbl-lime-bg:    #ECFCCB;  --lbl-lime-fg:    #4D7C0F;
  --lbl-green-bg:   #D1FAE5;  --lbl-green-fg:   #047857;
  --lbl-teal-bg:    #CCFBF1;  --lbl-teal-fg:    #0F766E;
  --lbl-cyan-bg:    #CFFAFE;  --lbl-cyan-fg:    #155E75;
  --lbl-blue-bg:    #DBEAFE;  --lbl-blue-fg:    #1A4B96;
  --lbl-violet-bg:  #EDE9FE;  --lbl-violet-fg:  #6D28D9;
  --lbl-magenta-bg: #FAE8FF;  --lbl-magenta-fg: #A21CAF;
}

.lbl--slate   { background: var(--lbl-slate-bg);   color: var(--lbl-slate-fg); }
.lbl--rose    { background: var(--lbl-rose-bg);    color: var(--lbl-rose-fg); }
.lbl--red     { background: var(--lbl-red-bg);     color: var(--lbl-red-fg); }
.lbl--orange  { background: var(--lbl-orange-bg);  color: var(--lbl-orange-fg); }
.lbl--amber   { background: var(--lbl-amber-bg);   color: var(--lbl-amber-fg); }
.lbl--lime    { background: var(--lbl-lime-bg);    color: var(--lbl-lime-fg); }
.lbl--green   { background: var(--lbl-green-bg);   color: var(--lbl-green-fg); }
.lbl--teal    { background: var(--lbl-teal-bg);    color: var(--lbl-teal-fg); }
.lbl--cyan    { background: var(--lbl-cyan-bg);    color: var(--lbl-cyan-fg); }
.lbl--blue    { background: var(--lbl-blue-bg);    color: var(--lbl-blue-fg); }
.lbl--violet  { background: var(--lbl-violet-bg);  color: var(--lbl-violet-fg); }
.lbl--magenta { background: var(--lbl-magenta-bg); color: var(--lbl-magenta-fg); }

/* A label chip reuses .kanban-tag's shape and only carries its own weight; the
   colour arrives from the .lbl--{key} class beside it. Deliberately a modifier
   rather than a new base class, so a label chip cannot drift from the bucket
   and sprint pills it sits next to. */
.kanban-tag--label {
  font-weight: 600;
  /* A flex item will not shrink below its content width without this, so a long
     name would push the chip past the card instead of truncating inside it. */
  min-width: 0;
}

/* `.kanban-tag` sets overflow/text-overflow, but it is `display: inline-flex`, and
   text-overflow does not apply to a flex container's own children — the text
   becomes an anonymous flex item and the ellipsis is ignored, leaving a hard clip
   mid-word and a chip whose rounded edge is sheared flat. Bucket and sprint names
   are short enough never to hit it; a label name is free text an admin types, so
   it hits it often. The fix is to give the text its own block container. */
.kanban-tag-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The "+2" pill standing in for labels beyond the third. Cards show three so a
   heavily labelled record cannot make its column ragged next to its
   neighbours; the rest are named in the pill's own tooltip. */
.kanban-tag--overflow {
  background: var(--bg-hover);
  color: var(--text-tertiary);
  font-weight: 600;
  cursor: default;
}

/* The card's own label row, above the bucket/sprint tags. */
.kanban-card-labels {
  margin-top: 7px;
  display: flex; gap: 5px; flex-wrap: wrap;
}

/* Calendar cards get dots instead of chips — a day cell has no room for label
   text, the same reason its assignee stack carries no names. */
.cal-card-labels {
  display: flex; gap: 3px; flex-wrap: wrap;
  margin-bottom: 3px;
}
.cal-label-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  /* The palette classes set background AND color; the dot wants the readable
     foreground, which is the one that stays visible on a white day cell. */
  background: currentColor;
}

/* A label's colour beside its checkbox in the filter pane, so the facet and the
   card can be matched up by eye. Same trick as the calendar dot: the palette
   class supplies both halves and the dot takes the readable one. */
.bf-swatch {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Colour picker (Admin → Labels) ────────────────────────────────────────
   Radio buttons wearing their own colour. The native control is hidden rather
   than removed, so the group stays keyboard-navigable and screen-readable. */
.lbl-swatches {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.lbl-swatch {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 99px;
  border: 2px solid transparent;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.lbl-swatch input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.lbl-swatch-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
/* currentColor is the swatch's own foreground, so the selected ring matches
   whichever colour it belongs to without twelve more rules. */
.lbl-swatch:has(input:checked) { border-color: currentColor; }
.lbl-swatch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lbl-swatch:hover { filter: brightness(0.97); }

/* The same swatch control as a checkbox list, for picking a record's labels.
   Column rather than wrap, because these carry real label names and a wrapped
   row of long names is far harder to scan than a list. */
.lbl-picker {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 240px; overflow-y: auto;
}
.lbl-picker .lbl-swatch { justify-content: flex-start; }
/* Unchecked reads as an outline so ticked state is obvious at a glance — the
   admin picker is a radio group where exactly one is always on, so it needs no
   such distinction. */
.lbl-picker .lbl-swatch:not(:has(input:checked)) {
  background: transparent;
  border-color: var(--border-md);
}

/* ── Checklist panel (internal ticket detail) ──────────────────────────────
   Sits between the planning fields and the timeline. Capped in height with its
   own scroll so a long breakdown cannot squeeze the timeline out of the view. */
.checklist-block {
  flex-shrink: 0;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  max-height: 42vh;
  overflow-y: auto;
}
.checklist-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.checklist-head i { font-size: 13px; }
.checklist-title { letter-spacing: .07em; }
.checklist-count {
  margin-left: auto;
  font-size: 12px; font-weight: 700; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.checklist-count.is-done { color: var(--text-success); }

.checklist-track {
  margin-top: 8px; height: 4px; border-radius: 99px;
  background: var(--border-md); overflow: hidden;
}
.checklist-fill {
  height: 100%; border-radius: 99px;
  background: var(--accent);
  transition: width .2s ease;
}
.checklist-fill.is-done { background: var(--text-success); }

.checklist-list { list-style: none; margin: 10px 0 0; padding: 0; }
.checklist-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.checklist-row:last-child { border-bottom: none; }

.checklist-tick-form { flex-shrink: 0; line-height: 1; margin-top: 1px; }
/* Circular checkbox from the redesign handoff: an empty ring that fills green
   with a white tick. Reads as a control, where the old square glyph read as an
   icon and gave no affordance that it could be clicked. */
.checklist-box {
  width: 19px; height: 19px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0; cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.checklist-box i {
  font-size: 12px; color: var(--text-on-fill); opacity: 0;
  transition: opacity .14s ease;
}
.checklist-box:hover { border-color: var(--accent); }
.checklist-box.is-static { cursor: default; }
.checklist-box.is-done {
  background: var(--text-success);
  border-color: var(--text-success);
}
.checklist-box.is-done i { opacity: 1; }

.checklist-main { flex: 1; min-width: 0; }
.checklist-text { font-size: 13px; line-height: 1.4; word-break: break-word; }
.checklist-row.is-done .checklist-text {
  text-decoration: line-through;
  color: var(--text-tertiary);
}
.checklist-sub {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 2px;
  font-size: 11px; color: var(--text-secondary);
}
.checklist-owner.is-empty { color: var(--text-tertiary); }

/* ── Split steps ───────────────────────────────────────────────────────────
   A step whose work another record owns. Read-only here, so it is dimmed
   rather than struck through: struck-through already means "done", and a
   split step that is still open is neither done nor editable. */
.checklist-select {
  flex-shrink: 0;
  width: 13px; height: 13px;
  margin: 0 2px 0 0;
  cursor: pointer;
  accent-color: var(--accent);
}
/* Holds the column open on rows with no box, so no text shifts left. */
.checklist-select.is-static { display: inline-block; }

.checklist-row.is-split { background: var(--bg-subtle, transparent); }
.checklist-row.is-split .checklist-text { color: var(--text-secondary); }

.checklist-split-link {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--accent); text-decoration: none; font-weight: 500;
}
.checklist-split-link:hover { text-decoration: underline; }

.checklist-split-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--border-sm, var(--border-md));
}
.checklist-split-bar[hidden] { display: none; }
.checklist-split-hint { font-size: 11px; color: var(--text-tertiary); }

.checklist-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.checklist-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-tertiary); font-size: 14px;
  list-style: none;
}
.checklist-icon-btn::-webkit-details-marker { display: none; }
.checklist-icon-btn:hover { background: var(--border-md); color: var(--text-primary); }

.checklist-menu { position: relative; }
/* position:fixed, with left/top set by popover.js against the toggle.
   Absolute positioning kept it inside .checklist-block, whose max-height and
   overflow-y:auto clipped it — the menu was cut off and the panel scrolled instead
   of the menu overflowing it. Fixed is the same escape the board card's popovers
   use, and the reason they are position:fixed too. */
.checklist-menu-body {
  position: fixed; z-index: 120;
  width: 220px; padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
}
.checklist-menu-body label {
  display: block; margin-bottom: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.checklist-menu-body input,
.checklist-menu-body select {
  width: 100%; margin-bottom: 6px; padding: 5px 7px;
  font-family: inherit; font-size: 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
/* The owner picker inside the Edit step menu shows its matches without a scrollbar
   of its own. The list is the board's roster, not the whole directory, and the
   type-ahead caps results at eight — so there is little to scroll, and a scrollbar
   inside a 220px popup that already sits inside the checklist panel's own scroll
   reads as three nested scrolling regions. */
.checklist-menu-body .pp-list { max-height: none; overflow-y: visible; }

/* The picker replaces a full-width select, so it should fill the menu the same way. */
.checklist-menu-body .people-picker { margin-bottom: 6px; }

.checklist-menu-body form + form { margin-top: 8px; }
.checklist-menu-sep { height: 1px; margin: 9px 0; background: var(--border); }
.checklist-danger { color: var(--text-danger); }

.checklist-add {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
}
.checklist-add input[type="text"] { flex: 1; min-width: 0; }
.checklist-add input,
.checklist-add select {
  padding: 5px 8px;
  font-family: inherit; font-size: 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}
.checklist-add select { max-width: 140px; }
.checklist-empty { margin-top: 8px; font-size: 12px; color: var(--text-tertiary); }

/* Column grouping toggle in the topbar. */
.group-toggle {
  display: inline-flex;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.group-toggle-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: none; cursor: pointer;
}
.group-toggle-btn + .group-toggle-btn { border-left: 1px solid var(--border-md); }
.group-toggle-btn:hover { background: var(--bg-hover); }
.group-toggle-btn.active { background: var(--accent); color: #fff; }
/* The planning switcher uses anchors rather than submit buttons — it navigates instead
   of re-posting a grouping — so the underline the global link rule adds has to go. */
a.group-toggle-btn, a.group-toggle-btn:hover { text-decoration: none; }

.kanban-empty-col {
  padding: 14px 8px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* ── Avatar stack (shared by the board cards and the ticket grid) ──────────── */
.avatars { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.avatars-name {
  font-size: 11.5px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatars.is-unassigned .avatars-name { color: var(--text-tertiary); font-style: italic; }

.avatar {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-on-fill);
  /* Ring in the surface colour so overlapping avatars stay visually separate. */
  box-shadow: 0 0 0 1.5px var(--bg-surface);
}
.avatar--photo { object-fit: cover; background: var(--bg-hover); }
.avatar--empty { background: var(--bg-hover); color: var(--text-tertiary); }
.avatar--more { background: var(--border-strong); color: var(--text-primary); font-size: 9px; }
.avatar--xs { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }

/* ── People picker ─────────────────────────────────────────────────────────
   A type-ahead over a real <select>, which stays the form control. Sits with the
   avatars because it is built entirely out of them. */

/* Hidden with position/opacity rather than display:none, so browser validation
   still fires and can still focus the field it is complaining about. */
/* Hidden only once people-picker.js has enhanced the field. It stays in the layout
   rather than display:none so browser validation can still focus it — a required
   control with display:none blocks submission with no visible message.

   Before enhancement the native select is the control, and the shell and listbox
   are hidden instead. Without this split a page that omits people-picker.js renders
   an invisible select behind a dead text box, and the field cannot be used at all. */
.people-picker.is-enhanced .pp-native {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.people-picker:not(.is-enhanced) .pp-shell,
.people-picker:not(.is-enhanced) .pp-list { display: none; }
.people-picker:not(.is-enhanced) .pp-native {
  width: 100%; min-height: 32px; padding: 4px 6px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
  font-family: inherit; font-size: 12.5px;
}

.people-picker { position: relative; }

.pp-shell {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  min-height: 32px; padding: 4px 6px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface);
}
.pp-shell:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }

.pp-tokens { display: contents; }
.pp-token {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 4px 2px 2px;
  background: var(--bg-selected); border-radius: 999px;
  font-size: 11.5px; color: var(--text-primary);
}
.pp-token-remove {
  border: 0; background: none; cursor: pointer;
  padding: 0 3px; line-height: 1;
  font-size: 13px; color: var(--text-tertiary);
}
.pp-token-remove:hover { color: var(--text-danger); }

.pp-input {
  flex: 1; min-width: 90px;
  border: 0; outline: none; background: none;
  font-family: inherit; font-size: 12.5px; color: var(--text-primary);
  padding: 3px 2px;
}

.pp-list {
  position: absolute; z-index: 110; left: 0; right: 0;
  margin: 3px 0 0; padding: 4px; list-style: none;
  max-height: 210px; overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.pp-option {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 6px; border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-primary); cursor: pointer;
}
.pp-option:hover,
.pp-option.is-active { background: var(--bg-selected); }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }
/* Later avatars sit under earlier ones, so the stack reads left-to-right. */
.avatar-stack .avatar:nth-child(1) { z-index: 4; }
.avatar-stack .avatar:nth-child(2) { z-index: 3; }
.avatar-stack .avatar:nth-child(3) { z-index: 2; }
.avatar-stack .avatar:nth-child(4) { z-index: 1; }
.avatar-stack:hover .avatar { margin-left: 1px; }
.avatar-stack .avatar { transition: margin-left .12s ease; }

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .12s;
}
a.kpi:hover { box-shadow: var(--shadow-md); }
.kpi--info    { border-left-color: var(--text-info); }
.kpi--danger  { border-left-color: var(--text-danger); }
.kpi--warning { border-left-color: var(--text-warning); }
.kpi--success { border-left-color: var(--text-success); }
.kpi-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500; color: var(--text-secondary);
}
.kpi-value { font-size: 27px; font-weight: 600; line-height: 1.2; margin: 4px 0 2px; }
.kpi-sub { font-size: 11px; color: var(--text-tertiary); }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.dash-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dash-card--wide { grid-column: span 2; }
@media (max-width: 900px) { .dash-card--wide { grid-column: span 1; } }

.dash-card-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
}
.dash-card-title { font-size: 13px; font-weight: 600; }
.dash-card-note { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
.dash-card-body { padding: 14px 15px; flex: 1; }
.dash-card-body--flush { padding: 0; }

/* Opened vs closed columns */
/* stretch, not flex-end: a percentage height only resolves against a parent with a
   definite one. With flex-end each week shrank to its label, leaving .trend-bars a few
   pixels tall, so every bar collapsed to its 2px minimum and the chart read as empty. */
.trend { display: flex; align-items: stretch; gap: 5px; height: 140px; }
.trend-week {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
/* min-height:0 lets this shrink inside the column; without it the label can push the
   plot area past the 140px and the bars scale against the wrong height. */
.trend-bars {
  flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: flex-end; justify-content: center; gap: 2px;
}
.trend-bar { width: 44%; min-height: 2px; border-radius: 2px 2px 0 0; }
.trend-bar--opened { background: var(--accent); }
.trend-bar--closed { background: var(--text-success); }
.trend-label {
  font-size: 9.5px; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.chart-legend {
  display: flex; gap: 14px; margin-top: 10px;
  font-size: 11.5px; color: var(--text-secondary);
}
.chart-legend .swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px;
}
.swatch--opened { background: var(--accent); }
.swatch--closed { background: var(--text-success); }

/* Horizontal bar rows */
.bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-name {
  width: 96px; flex-shrink: 0; font-size: 11.5px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { flex: 1; height: 8px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; min-width: 2px; }
.bar-value {
  width: 30px; text-align: right; flex-shrink: 0;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.stat-big { display: flex; align-items: baseline; gap: 5px; }
.stat-big-value { font-size: 32px; font-weight: 600; line-height: 1; }
.stat-big-unit { font-size: 13px; color: var(--text-secondary); }
.stat-caption { font-size: 11.5px; color: var(--text-tertiary); margin-top: 3px; }

.stat-split {
  display: flex; gap: 10px; margin: 14px 0;
  padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.stat-split > div { flex: 1; }
.stat-split-value { font-size: 18px; font-weight: 600; }
.stat-split-label { font-size: 11px; color: var(--text-tertiary); }

.hours-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; padding: 3px 0; color: var(--text-secondary);
}
.hours-row strong { font-variant-numeric: tabular-nums; color: var(--text-primary); }
.hours-row.is-over strong { color: var(--text-danger); }
.hours-row.is-under strong { color: var(--text-success); }

.attn-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; font-size: 12.5px;
}
.attn-row:last-child { border-bottom: none; }
.attn-row:hover { background: var(--bg-hover); }
/* Two stacked lines now — subject over customer — so the cell is a column rather than
   a single truncating line. Both lines truncate independently. */
.attn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attn-subject {
  font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attn-sub {
  font-size: 11.5px; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attn-meta { color: var(--text-secondary); font-size: 11.5px; white-space: nowrap; }
.attn-flag {
  color: var(--text-danger); font-size: 11px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}

.dash-footnote { font-size: 11px; color: var(--text-tertiary); padding: 2px 2px 16px; }

/* ── Data grid (All Tickets) ───────────────────────────────────────────────── */
.grid-filters {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.grid-filter-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.grid-filter-row .form-control { flex: 1; min-width: 140px; font-size: 12.5px; padding: 6px 9px; }
.grid-filter-row select[multiple] { padding: 4px; min-width: 120px; flex: 0 0 auto; }
.grid-filter-label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .05em;
}

.grid-meta { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 8px; }

.grid-scroll {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: calc(100vh - 330px);
}

.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-md);
  padding: 9px 11px;
  text-align: left; font-weight: 600; white-space: nowrap;
  color: var(--text-secondary);
}
.grid tbody td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.grid tbody tr:hover { background: var(--bg-hover); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .is-over { color: var(--text-danger); font-weight: 600; }

.grid-subject {
  max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
.grid-link {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--accent); text-decoration: none;
}
.grid-link:hover { text-decoration: underline; }

.grid-sort { color: inherit; text-decoration: none; }
.grid-sort:hover { color: var(--accent); }
.grid-sort.is-active { color: var(--accent); }

.grid-pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 0;
}

/* First/Previous on page one, and Next/Last on the last page. Rendered as a span, so
   there is nothing to click and nothing to focus — an anchor with a class is still a
   working link to the keyboard. Kept in place rather than removed so the row does not
   reflow and move Next out from under the cursor at the end of a long grid. */
.grid-pager .is-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ══ Planning views ═══════════════════════════════════════════════════════════
   Sprint Planning, the Sprint Cockpit and the Timeline. All three reuse the
   board's vocabulary — the priority ramp, .avatar, .chip, .badge, .kpi and
   .dash-card — so only what is genuinely new to them is defined here. */

/* The sprint picker in the topbar, sized to match .group-toggle beside it. */
.plan-sprint-switch select {
  padding: 5px 10px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12.5px;
}

/* ── Sprint Planning ───────────────────────────────────────────────────────── */
.plan-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 16px;
}
.plan-col, .plan-sprint, .plan-capacity {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.plan-col-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.plan-col-title { font-size: 13.5px; font-weight: 600; }
.plan-col-note { margin-left: auto; font-size: 11.5px; color: var(--text-tertiary); }
.plan-col-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}

.plan-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}
.plan-item:hover { border-color: var(--border-strong); }
.plan-item-bar { width: 3px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.plan-item-bar.pri--critical { background: var(--pri-critical-bar); }
.plan-item-bar.pri--high     { background: var(--pri-high-bar); }
.plan-item-bar.pri--medium   { background: var(--pri-medium-bar); }
.plan-item-bar.pri--low      { background: var(--pri-low-bar); }
.plan-item-main { flex: 1; min-width: 0; }
.plan-item-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.plan-item-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary); }
.plan-item-title {
  display: block;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-item-title:hover { color: var(--accent); text-decoration: none; }
.plan-item-meta {
  font-size: 11px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.plan-dot { opacity: .6; }
.plan-hours {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--text-info); background: var(--a-100);
  padding: 2px 8px; border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}
/* An estimate is what capacity is computed from, so its absence is worth seeing. */
.plan-hours.is-missing { color: var(--text-tertiary); background: var(--n-200); }
.plan-item-action { flex-shrink: 0; display: flex; }
.plan-move-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-secondary);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.plan-move-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.plan-side { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.plan-sprint { flex-shrink: 0; border-color: var(--a-300); }
.plan-sprint.is-over { border-color: var(--pri-critical-bar); }
.plan-sprint-head { padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--a-100); }
.plan-sprint.is-over .plan-sprint-head { background: var(--bg-danger); }
.plan-sprint-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.plan-sprint-dates { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--text-secondary); }
.plan-sprint-figures { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.plan-sprint-value { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.plan-sprint-of { font-size: 12px; color: var(--text-secondary); }
.plan-sprint-figures .badge { margin-left: auto; }
.plan-bar-track { height: 7px; background: var(--n-200); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.plan-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.plan-bar-fill.is-over { background: var(--pri-critical-bar); }
.plan-sprint-body {
  max-height: 320px; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 7px;
}
.plan-drop-hint {
  border: 1.5px dashed var(--a-400); border-radius: var(--radius-md);
  padding: 14px; text-align: center;
  font-size: 12px; color: var(--text-info); background: var(--a-100);
}
.plan-planned {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.plan-planned-title {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 500; color: var(--text-primary); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-planned-title:hover { color: var(--accent); text-decoration: none; }

.plan-capacity { flex: 1; min-height: 0; }
.plan-capacity-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.cap-row + .cap-row { margin-top: 13px; }
.cap-who { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.cap-name { font-size: 12.5px; }
.cap-figure {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary);
}
.cap-figure.is-over { color: var(--text-danger); font-weight: 500; }
/* Two segments side by side: this sprint, then whatever the same person is carrying
   on other boards across the same dates. flex so the second starts where the first
   ends without any position arithmetic. */
.cap-track {
  height: 7px; background: var(--n-200); border-radius: 99px; overflow: hidden;
  display: flex;
}
.cap-fill { height: 100%; background: var(--g-600); }
.cap-fill.is-tight { background: var(--accent); }
.cap-fill.is-over { background: var(--pri-critical-bar); }
/* Hatched rather than another solid colour: it is load the planner cannot move from
   this screen, so it should read as occupied ground rather than as a third status. */
.cap-fill--elsewhere {
  background: repeating-linear-gradient(
    135deg,
    var(--border-strong) 0 3px,
    var(--n-200) 3px 6px);
}
.cap-note { font-size: 10.5px; color: var(--text-success); margin-top: 3px; }
.cap-note.is-over { color: var(--text-danger); }
.cap-note--elsewhere { color: var(--text-tertiary); }

/* ── Sprint Cockpit ────────────────────────────────────────────────────────── */
.cockpit-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  flex-shrink: 0;
}
.cockpit-figures { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.cockpit-figures .kpi { margin: 0; }

.burndown { width: 100%; height: 210px; display: block; }
.bd-grid   { stroke: var(--border); stroke-width: 1; }
.bd-axis   { font-family: var(--font-mono); font-size: 9px; fill: var(--text-tertiary); }
.bd-ideal  { stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 4 4; }
.bd-actual {
  fill: none; stroke: var(--accent); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.bd-today  { stroke: var(--pri-high-bar); stroke-width: 1.5; }
.bd-dot    { fill: var(--accent); stroke: var(--bg-surface); stroke-width: 2; }
.swatch--actual { background: var(--accent); }
.swatch--ideal  { background: var(--border-strong); }

.cockpit-lanes { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.lane-head, .lane {
  display: grid;
  grid-template-columns: 168px repeat(4, minmax(0, 1fr));
}
.lane-head {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.lane-head span {
  padding: 8px 12px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.lane-head span + span { border-left: 1px solid var(--border); }
.lane { border-bottom: 1px solid var(--border); min-height: 88px; }
.lane:last-child { border-bottom: none; }
.lane-who { padding: 12px 14px; display: flex; align-items: flex-start; gap: 9px; }
.lane-id { min-width: 0; }
.lane-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-load { font-size: 10.5px; color: var(--text-tertiary); margin-top: 1px; }
.lane-load.is-over { color: var(--text-danger); }
.lane-track { height: 4px; width: 72px; background: var(--n-200); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.lane-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.lane-fill.is-over { background: var(--pri-critical-bar); }
.lane-cell {
  border-left: 1px solid var(--border);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.lane-card {
  display: block;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  background: var(--bg-surface);
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
}
.lane-card:hover { border-color: var(--border-strong); border-left-color: inherit; text-decoration: none; }
.lane-card.pri--critical { border-left-color: var(--pri-critical-bar); }
.lane-card.pri--high     { border-left-color: var(--pri-high-bar); }
.lane-card.pri--medium   { border-left-color: var(--pri-medium-bar); }
.lane-card.pri--low      { border-left-color: var(--pri-low-bar); }
.lane-card.is-done { opacity: .7; }
.lane-card.is-done .lane-card-title {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.lane-card-title { display: block; font-size: 11.5px; font-weight: 500; line-height: 1.3; }
.lane-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.lane-card-num { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-tertiary); }
.lane-card-hours {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 9.5px; color: var(--text-tertiary);
}
.lane-card-foot .sla-chip { margin-left: auto; }
.lane-card-progress { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.lane-card-progress .kcp-track { flex: 1; }

/* ── Timeline ──────────────────────────────────────────────────────────────── */
.tl-wrap {
  flex: 1; min-height: 0; overflow: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.tl-grid { min-width: 900px; }
.tl-row { display: grid; grid-template-columns: 186px minmax(0, 1fr); border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: none; }
.tl-row--unassigned { background: var(--bg-subtle); }
.tl-gutter { padding: 12px 14px; display: flex; align-items: flex-start; gap: 9px; }
.tl-gutter--head {
  padding: 9px 14px; align-items: center;
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-tertiary);
  background: var(--bg-subtle);
}
.tl-who { min-width: 0; }
.tl-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-load { font-size: 10.5px; color: var(--text-tertiary); margin-top: 1px; }
.tl-load.is-over { color: var(--text-danger); }
.tl-load-track { height: 4px; width: 74px; background: var(--n-200); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.tl-load-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.tl-load-fill.is-over { background: var(--pri-critical-bar); }

/* The track is a positioning context for bars and a grid for the week guides. */
.tl-track { position: relative; display: grid; grid-template-columns: repeat(var(--tl-cols), 1fr); }
.tl-track--head { background: var(--bg-subtle); }
.tl-guide { border-left: 1px solid var(--border); }
/* Tints the whole current-week column behind its bars. Deliberately paler than the
   header's --bg-warning so bars sitting on it stay legible. */
.tl-guide.is-current { background: var(--bg-warning-subtle); }
.tl-week {
  padding: 9px 12px; border-left: 1px solid var(--border);
  font-size: 11px; color: var(--text-secondary); white-space: nowrap;
}
.tl-week.is-current { background: var(--bg-warning); color: var(--text-warning); font-weight: 600; }
.tl-row--sprints .tl-track { min-height: 32px; }
.tl-sprint {
  padding: 8px 12px;
  border-left: 2px solid var(--border-strong);
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-sprint.is-active {
  border-left-color: var(--a-500);
  background: var(--a-100);
  color: var(--text-info);
}

.tl-bar {
  position: absolute; height: 24px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 9px;
  border-left: 3px solid;
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600;
  text-decoration: none;
  overflow: hidden;
}
.tl-bar:hover { text-decoration: none; filter: brightness(.96); }
.tl-bar.pri--critical { background: var(--pri-critical-bg); border-left-color: var(--pri-critical-bar); color: var(--pri-critical-fg); }
.tl-bar.pri--high     { background: var(--pri-high-bg);     border-left-color: var(--pri-high-bar);     color: var(--pri-high-fg); }
.tl-bar.pri--medium   { background: var(--pri-medium-bg);   border-left-color: var(--pri-medium-bar);   color: var(--pri-medium-fg); }
.tl-bar.pri--low      { background: var(--pri-low-bg);      border-left-color: var(--pri-low-bar);      color: var(--pri-low-fg); }
/* Unplaced work reads as an outline: it occupies the slot but nobody owns it yet. */
.tl-bar.is-unassigned { background: var(--bg-surface); border: 1.5px dashed var(--border-strong); border-left-width: 3px; }
.tl-bar.is-overdue { box-shadow: inset 0 0 0 1.5px var(--pri-critical-bar); }
.tl-bar-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-bar-hours { font-family: var(--font-mono); font-size: 9.5px; opacity: .85; flex-shrink: 0; }

/* ── Form section headings ─────────────────────────────────────────────────────
   Replaces the inline style the New Task form used to carry on its one Placement
   heading, now that the form has two sections to separate. */
.form-section-label {
  margin: 18px 0 10px;
  font-size: 10px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: .07em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.form-section-label:first-of-type { margin-top: 0; }
.form-section-note {
  margin-left: auto;
  text-transform: none; letter-spacing: 0;
  font-size: 11px; font-weight: 500;
  color: var(--text-info);
  display: flex; align-items: center; gap: 4px;
}

/* ══ My Tasks ═════════════════════════════════════════════════════════════════
   Two layouts over one card set, modelled on Planner's My Tasks: a flat grid and a
   board whose columns come from the chosen grouping. Both live inside .kanban-wrap so
   board-filters.js drives them, which means the kanban's own wrap/column/card rules
   have to be neutralised rather than inherited. */

.mt-controls { display: flex; align-items: center; }
.mt-groupby {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-secondary);
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  padding: 4px 10px;
}
.mt-groupby select {
  border: none; background: none; outline: none;
  font-family: var(--font); font-size: 12.5px; font-weight: 500;
  color: var(--text-primary); cursor: pointer;
}

/* A filtered-out card must not leave a gap where it was, in either layout. */
.mt-wrap .kanban-card.is-filtered-out { display: none; }

/* ── Grid layout ───────────────────────────────────────────────────────────────
   A table built from divs: each row has to stay a .kanban-card so the filter pane
   can hide it, and a display:none <tr> still holds its track in a real <table>.
   One shared column template keeps the header and the rows in step. */
.mt-wrap--grid { display: block; overflow: visible; gap: 0; }

.mt-table {
  /* check · name · type · board · customer · bucket · sprint · due · priority · status · look */
  --mt-cols: 34px minmax(200px, 2.2fr) 72px minmax(140px, 1fr) minmax(130px, 1fr)
             minmax(100px, .8fr) minmax(100px, .8fr) 92px 108px 150px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* A record type reads as a quiet chip, not a badge competing with Status and
   Priority beside it — those are things you act on, this is what the row IS. */
.mt-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-surface);
  white-space: nowrap;
}
.mt-type--ticket { color: var(--brand, #2563eb); border-color: color-mix(in srgb, var(--brand, #2563eb) 35%, transparent); }

.mt-thead, .mt-tr {
  display: grid;
  grid-template-columns: var(--mt-cols);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.mt-thead {
  height: 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: .04em; text-transform: uppercase;
}
.mt-tr {
  min-height: 46px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.mt-tr:last-child { border-bottom: none; }
.mt-tr:hover { background: var(--bg-hover); }
/* Rows the filter pane has hidden must not hold their grid track. */
.mt-tr.is-filtered-out { display: none; }

.mt-td { min-width: 0; display: flex; align-items: center; gap: 7px; }
.mt-td--check { justify-content: center; color: var(--border-strong); }
.mt-td--check i { font-size: 17px; }
.mt-tr.is-done .mt-td--check { color: var(--accent); }

.mt-name {
  font-weight: 500; color: var(--text-primary); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mt-name:hover { color: var(--accent); text-decoration: none; }
.mt-tr.is-done .mt-name {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
  color: var(--text-secondary);
}

/* Plan badge: deterministic colour per board, matching the avatar helper's hash so a
   board reads the same here as its people do elsewhere. */
.mt-plan { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mt-plan-badge {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; color: var(--text-on-fill);
  letter-spacing: .02em;
}
.mt-plan-badge--none { background: var(--n-300); color: var(--text-tertiary); }
.mt-plan-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-plan--none .mt-plan-name { color: var(--text-tertiary); }

.mt-cell-sub { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-cell-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* An overdue date is outlined rather than merely coloured — the same treatment the
   board cards give it, so "late" looks the same wherever it appears. */
.mt-due-cell { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mt-due-cell.is-late {
  color: var(--text-danger);
  background: var(--bg-danger);
  border: 1px solid var(--pri-critical-bar);
  border-radius: var(--radius-sm);
  padding: 1px 7px;
  font-weight: 500;
}

.mt-status-icon { font-size: 16px; color: var(--border-strong); flex-shrink: 0; }
.mt-status-icon.is-done { color: var(--accent); }

/* Three controls live here now — labels, open, cancel — so they need to sit apart
   rather than touch. */
.mt-td--look { display: flex; align-items: center; justify-content: center; gap: 10px; }
.mt-look { color: var(--text-tertiary); display: inline-flex; }
.mt-look:hover { color: var(--accent); }

/* The class was written for <a>, which has no chrome of its own. A <button> carries the
   UA's background, border, padding and font, so a cancel control using this class
   rendered as a grey bordered box among flat icon links. */
button.mt-look {
  background: none; border: none; padding: 0;
  font: inherit; cursor: pointer; line-height: 1;
}
button.mt-look:hover { color: var(--text-warning); }
button.mt-look:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mt-addnew {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 12px; padding: 8px 4px;
  font-size: 13px; font-weight: 500; color: var(--accent);
  text-decoration: none;
}
.mt-addnew:hover { text-decoration: none; color: var(--accent-hover); }

/* The grid sheds its least load-bearing columns before it starts truncating names.
   Each block hides one more and restates the track list to match what is left —
   a display:none cell leaves grid flow, so the two must always agree. */
@media (max-width: 1500px) {
  /* − sprint */
  .mt-table { --mt-cols: 34px minmax(200px, 2.2fr) 72px minmax(140px, 1fr) minmax(130px, 1fr) minmax(100px, .8fr) 92px 104px 148px 40px; }
  .mt-td--sprint { display: none; }
}
@media (max-width: 1280px) {
  /* − bucket */
  .mt-table { --mt-cols: 34px minmax(190px, 2.2fr) 72px minmax(130px, 1fr) minmax(120px, 1fr) 88px 100px 144px 40px; }
  .mt-td--bucket { display: none; }
}
@media (max-width: 1080px) {
  /* − customer, − status, − type. Board stays: it is the grouping everything else
     hangs off, and the row still carries its type as an icon beside the name. */
  .mt-table { --mt-cols: 34px minmax(180px, 2.4fr) minmax(120px, 1fr) 84px 96px 40px; }
  .mt-td--customer, .mt-td--status, .mt-td--type { display: none; }
}

/* ── Customer portal ticket grid ───────────────────────────────────────────────
   The portal reuses .mt-table wholesale — same rows, same header, same filtering —
   but shows a different, shorter column set: board, bucket, sprint, assignee and
   every effort figure are internal and never reach a customer.

   The track list therefore has to be restated. It MUST come after the internal
   media queries above, which each rewrite --mt-cols with the full ten-column list
   and would otherwise corrupt a seven-column row at narrow widths. That is also why
   the portal's own responsive steps below repeat the whole track list rather than
   relying on the internal ones. */
.mt-table--portal {
  /* check · ticket · product · raised by · opened · priority · status · look */
  --mt-cols: 34px minmax(220px, 2.4fr) minmax(130px, 1fr) minmax(130px, 1fr)
             110px 108px 190px 40px;
}
/* Without the Raised by column — an ordinary portal user sees only their own
   tickets, so naming the person on every row says nothing. */
.mt-table--portal-solo {
  --mt-cols: 34px minmax(220px, 2.4fr) minmax(130px, 1fr) 110px 108px 190px 40px;
}

/* The portal's own column-shedding, mirroring the internal grid's steps.

   Every rule here is scoped to .mt-table--portal*. That is not tidiness: the
   modifier classes above only change --mt-cols, so a bare `.mt-td--priority
   { display: none }` would shed that column from the ENGINEERS' grid at the same
   width, where its own track list still reserves room for it. */
@media (max-width: 1280px) {
  /* − raised by */
  .mt-table--portal,
  .mt-table--portal-solo { --mt-cols: 34px minmax(200px, 2.4fr) minmax(120px, 1fr) 104px 100px 180px 40px; }
  .mt-table--portal .mt-td--who { display: none; }
}
@media (max-width: 1080px) {
  /* − product, − priority. Status stays: it is the whole point of a customer's list. */
  .mt-table--portal,
  .mt-table--portal-solo { --mt-cols: 34px minmax(180px, 2.6fr) 100px 170px 40px; }
  .mt-table--portal .mt-td--pl,
  .mt-table--portal-solo .mt-td--pl,
  .mt-table--portal .mt-td--priority,
  .mt-table--portal-solo .mt-td--priority { display: none; }

  /* The internal grid drops Status at this width, and that rule is unscoped, so it
     reaches these tables too — leaving five tracks and four cells, with everything
     after the gap landing in the wrong column. Put it back. */
  .mt-table--portal .mt-td--status,
  .mt-table--portal-solo .mt-td--status { display: flex; }
}

/* The ticket number under the subject, and the Project chip beside it. */
.mt-td--name .mono { font-size: 10.5px; letter-spacing: .02em; }

/* Anything waiting on the customer is coloured — soft-close and the awaiting-reply
   sub-status are both their move, and the list should say so at a glance. */
.mt-status-icon.is-waiting { color: var(--text-warning); }

/* A closed ticket in the collapsed section keeps the grid's own card chrome; the
   panel supplies the spacing, so the inner table needs none of its own. */
.done-body .mt-table { border: none; box-shadow: none; border-radius: 0; }

/* ── Board layout ──────────────────────────────────────────────────────────────
   The board view renders the board pages' own markup and card, so it inherits their
   styling wholesale. Only the wrapper differs: My Tasks columns grow with their
   content and the page scrolls, rather than each column scrolling inside a fixed
   viewport height the way a dedicated board page does. */
.mt-wrap--board { display: block; overflow: visible; }
.mt-board {
  display: flex; gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}
/* overflow too, not just max-height: the base column clips at its own bounds, so an
   expanding Completed panel toggled open but stayed invisible behind the clip. Here
   the column grows with its content and the page scrolls, Planner-style. */
.mt-board .kanban-column { max-height: none; overflow: visible; }
.mt-board .kanban-column-body { overflow: visible; }

/* ── Completed section ─────────────────────────────────────────────────────────
   Shared by the My Tasks board and every kanban column. Finished work, collapsed,
   shown for reference rather than for working on. */
.done-section { margin-top: 4px; }
.done-section > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 4px;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; list-style: none;
}
.done-section > summary::-webkit-details-marker { display: none; }
.done-section > summary:hover { color: var(--text-primary); }
.done-chev { font-size: 14px; transition: transform .15s; }
.done-section[open] > summary .done-chev { transform: rotate(90deg); }
.done-count { margin-left: auto; font-size: 11px; color: var(--text-tertiary); }
.done-body { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }


.tasklist-none {
  padding: 40px 24px; text-align: center; color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.tasklist-none i { font-size: 30px; color: var(--text-tertiary); }
.tasklist-none p { font-size: 13px; }

/* ══ Calendar grouping ════════════════════════════════════════════════════════
   A month grid built from the board's own .kanban-* elements, so drag-and-drop and
   the filter pane work untouched. Everything below is layout: the kanban's column
   rules are overridden rather than replaced. */

/* The calendar's controls, on a line of their own. A bordered bar rather than a bare
   row, so the options read as a toolbar and the grid below reads as the calendar
   itself — the two were previously one undifferentiated strip. */
.cal-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.cal-toolbar-nav { display: flex; align-items: center; gap: 8px; }
.cal-scale { margin-left: auto; }
/* Inside the wrap the flex gap already separates the toolbar from the grid; the margin
   would stack on top of it and open twice the space My Tasks needs versus the board. */
.cal-wrap > .cal-toolbar { margin-bottom: 0; }

/* The grid, as its own surface below the toolbar. Scrolls sideways itself rather than
   clipping: seven readable day columns do not fit a narrow window, and hiding the
   overflow would simply cut Thursday off. */
.cal-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  overflow-x: auto;
}
/* The grid draws its own frame, which would double up inside the section. */
.cal-section .cal-grid { border: none; border-radius: var(--radius-md); }


.cal-month {
  font-size: 16px; font-weight: 600; letter-spacing: -0.02em;
  min-width: 168px;
}
.cal-nav {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
}
.cal-nav:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.cal-today {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 5px 11px; text-decoration: none;
}
.cal-today:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }

/* The wrap is a kanban wrap, but stacked rather than scrolled sideways. */
/* A calendar stacks: toolbar, then grid, then the unscheduled tray. Every declaration
   here exists to undo .kanban-wrap, which lays its children out as a horizontal row of
   fixed-width columns — the wrong shape entirely for a calendar. */
.cal-wrap {
  display: flex; flex-direction: column; gap: 14px;
  flex: 1; min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  /* .kanban-wrap pins a viewport-relative height for its scrolling columns; the
     calendar sizes to the content area it sits in instead. */
  height: auto;
  align-items: stretch;
}
/* Children must fill the width rather than shrink to their content, which is what a
   flex row would otherwise do to them. */
.cal-wrap > * { width: 100%; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
/* Seven cells instead of thirty-five, so each can hold a real day's work rather than
   two cards and a scrollbar. */
.cal-grid--week .cal-cell { min-height: 460px; }

.cal-dow {
  background: var(--bg-subtle);
  padding: 8px 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-tertiary);
  text-align: center;
}
.cal-dow.is-off { color: var(--border-strong); }

/* A day cell IS a .kanban-column, so the column rules have to be neutralised. */
.cal-cell {
  flex: none;
  background: var(--bg-surface);
  border: none;
  border-radius: 0;
  min-height: 122px;
  max-height: none;
  display: flex; flex-direction: column;
}
.cal-cell.is-outside { background: var(--bg-subtle); }
.cal-cell.is-outside .cal-daynum { color: var(--text-tertiary); }
.cal-cell.is-off { background: var(--bg-subtle); }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }

.cal-cell-head {
  padding: 6px 8px 4px;
  border-bottom: none;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.cal-cell.is-today .cal-daynum {
  background: var(--accent); color: #fff;
  min-width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
}
/* Rendered only because board.js writes into it without checking it exists, and both
   scripts would throw or mis-tally without it. A day cell shows its handful of cards
   plainly enough that a number on top of them is noise, so it is hidden outright. */
.cal-cell .kanban-column-count { display: none; }

.cal-cell-body {
  flex: 1; min-height: 0;
  padding: 0 6px 6px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
/* board.js appends "Drop cards here" to every empty droppable column. Across a month
   grid that is thirty-odd repetitions of the same hint, so it is suppressed here. */
.cal-wrap .kanban-empty-col { display: none; }

/* ── My checklist steps inside a calendar day ─────────────────────────────────────
   A strip hanging off the record it belongs to, so the relationship IS the layout.
   Deliberately not a .kanban-card: board.js drags that class and a step cannot move —
   it has no date of its own, it inherits its parent's. */
.cal-steps-toggle { display: flex; justify-content: flex-end; margin: 6px 0 -2px; }
.cal-steps-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); padding: 5px 10px; text-decoration: none;
}
.cal-steps-btn:hover { border-color: var(--border-strong); }
.cal-steps-btn.is-on { background: var(--a-100); border-color: var(--a-400); color: var(--a-700); }
.cal-steps-state { font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }

.cal-step-strip {
  border-left: 3px solid var(--a-300);
  background: var(--a-100);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 4px 6px;
  /* Pulled up against the card above it, so the two read as one unit rather than as two
     neighbours that happen to be adjacent. */
  margin-top: -2px;
}
/* Detached from the faded stand-in above, which already carries the rounding. */
.cal-step-strip.is-detached { margin-top: -1px; }

.cal-step-strip-head {
  display: flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--a-700); margin-bottom: 3px;
}

.cal-step-row {
  display: flex; align-items: flex-start; gap: 5px;
  padding: 2px 0; text-decoration: none;
  color: var(--text-secondary);
}
.cal-step-row + .cal-step-row { border-top: 1px dotted var(--a-300); }
.cal-step-row:hover .cal-step-text { color: var(--a-700); text-decoration: underline; }
.cal-step-row > .ti { font-size: 11px; color: var(--a-600); line-height: 1.35; flex: none; }
.cal-step-text {
  font-size: 10.5px; line-height: 1.35;
  /* Two lines then ellipsis. A month cell cannot afford a step that wraps to five, and
     the full text is in the row's title attribute. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The stand-in for a record that is not on this engineer's calendar — somebody else's
   ticket, one step of which is theirs. A label for the strip, not a copy of the card:
   quieter, and not draggable, because dragging it would move a record they do not own. */
.cal-step-parent {
  display: block; text-decoration: none;
  background: var(--bg-surface);
  border: 1px dashed var(--border-md);
  border-left: 3px solid var(--n-400);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 4px 7px 3px;
  opacity: .82;
}
.cal-step-parent:hover { opacity: 1; border-color: var(--a-400); }
.cal-step-parent.pri--critical, .cal-step-parent.pri--high { border-left-color: #dc2626; }
.cal-step-parent.pri--medium { border-left-color: #f59e0b; }
.cal-step-parent.pri--low { border-left-color: var(--a-500); }
.cal-step-parent-num {
  display: block; font-family: var(--font-mono);
  font-size: 9px; color: var(--text-tertiary);
}
.cal-step-parent-subj {
  display: block; font-size: 10.5px; font-weight: 600; line-height: 1.3;
  color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Completed panel inside a kanban column ───────────────────────────────────── */
.kanban-done { border-top: 1px solid var(--border); padding-top: 2px; }
/* On a real board the column scrolls, so the panel must not force it wider or taller —
   it simply becomes more content for that scroll. */
.kanban-done .done-body { max-height: none; }
.kanban-done > summary { padding: 8px 2px; }
/* Finished cards read as settled: quieter, struck through, and plainly not draggable. */
.kanban-done .kanban-card {
  opacity: .68;
  cursor: default;
  box-shadow: none;
}
.kanban-done .kanban-card:hover { opacity: .85; }
/* Both title classes: a calendar day cell has its own tighter type scale and uses
   .cal-card-title, so listing only the board's left finished cards on the calendar —
   and in the tray's own done panel — reading as though they were still open. */
.kanban-done .kanban-card-title,
.kanban-done .cal-card-title {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
/* The controls on a finished card would all act on work that is already done.
   The attach panel goes with them: the wrapper stays, but an empty flex row is
   zero-height, so nothing is left behind. */
.kanban-done .kanban-assign,
.kanban-done .kanban-attach-panel,
.kanban-done .kanban-checklist-panel { display: none; }
.kanban-done .kanban-card-tools { margin-top: 0; }

/* ── Calendar card ─────────────────────────────────────────────────────────── */
.cal-card {
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 3px;
  cursor: grab;
}
.cal-card.pri--critical { border-left-color: var(--pri-critical-bar); }
.cal-card.pri--high     { border-left-color: var(--pri-high-bar); }
.cal-card.pri--medium   { border-left-color: var(--pri-medium-bar); }
.cal-card.pri--low      { border-left-color: var(--pri-low-bar); }
.cal-card.is-overdue { background: var(--bg-danger); }
.cal-card-title {
  font-size: 11.5px; font-weight: 500; line-height: 1.25;
  color: var(--text-primary); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cal-card-title:hover { color: var(--accent); text-decoration: none; }
.cal-card-foot { display: flex; align-items: center; gap: 5px; }
.cal-card-board {
  font-size: 9.5px; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-card-who { margin-left: auto; flex-shrink: 0; }
/* Names would not fit a day cell; the stack alone carries who owns the work. */
.cal-card-who .avatars-name { display: none; }

/* ── Unscheduled tray ──────────────────────────────────────────────────────── */
.cal-tray {
  flex: none;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  max-height: none;
}
.cal-tray-head { display: flex; align-items: center; gap: 8px; }
.cal-tray-hint { margin-left: auto; font-size: 11px; color: var(--text-tertiary); }
.cal-tray-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
  max-height: 190px;
}
/* The tray lays its cards out on a grid, not in a column, so the done panel needs both
   of these: a full-width row of its own rather than one 190px cell, and the tray's track
   sizing on its own cards. Without them .done-body keeps its default vertical flex and
   stacks every finished record into a single narrow strip. */
.cal-tray-body > .done-section { grid-column: 1 / -1; }
.cal-tray-body > .done-section > .done-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}

@media (max-width: 1024px) {
  /* Seven readable columns do not fit; .cal-section scrolls sideways rather than
     crushing them, so only the grid's own minimum is needed here. */
  .cal-grid { min-width: 860px; }
}

/* ══ New Task dialog ══════════════════════════════════════════════════════════
   Raising a task should not cost you the page you were reading, so the form opens
   over it. The markup inside is the same partial the full page renders. */
.fdlg {
  /* margin:auto is what centres a modal <dialog>, and the global `* { margin: 0 }`
     reset at the top of this file strips it — which pinned the dialog to the top-left
     corner. Restored explicitly rather than by weakening the reset. */
  margin: auto;
  width: min(680px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  overflow: hidden;
}
.fdlg::backdrop { background: var(--scrim); }
.fdlg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.fdlg-title { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.fdlg-close {
  margin-left: auto;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
}
.fdlg-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.fdlg-body { padding: 18px; overflow-y: auto; max-height: calc(86vh - 56px); }
/* The form carries its own card chrome for the standalone page; inside the dialog the
   dialog IS the card, so that second frame has to go. */
.fdlg-body .form-card {
  max-width: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
.fdlg-busy { padding: 28px; text-align: center; font-size: 13px; color: var(--text-secondary); }

/* Standalone-page width for the New Task form. A class rather than an inline style,
   so the dialog rule above can widen it to the dialog's own bounds. */
.form-card--newtask { max-width: 620px; }

/* ── Quick assign ──────────────────────────────────────────────────────────────
   The queue's per-row assign dialog: who, how long and when up front, with the
   placement fields folded away behind More details. */
.mt-assign { color: var(--accent); }
.mt-assign:hover { color: var(--accent-hover); }

.qa-form.form-card {
  border: none; border-radius: 0; box-shadow: none; padding: 0; background: transparent;
  max-width: none;
}
/* The record being assigned, so the dialog is never ambiguous about its subject. */
.qa-subject {
  padding: 10px 12px; margin-bottom: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 2px;
}
.qa-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary); }
.qa-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.qa-customer { font-size: 11.5px; color: var(--text-secondary); }

.qa-more { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.qa-more > summary {
  cursor: pointer; list-style: none;
  font-size: 12.5px; font-weight: 500; color: var(--accent);
  padding: 4px 0; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.qa-more > summary::-webkit-details-marker { display: none; }
/* A caret that turns, so the section reads as expandable before it is touched. */
.qa-more > summary::before {
  content: "\ea61"; font-family: "tabler-icons"; font-size: 14px;
  transition: transform .15s;
}
.qa-more[open] > summary::before { transform: rotate(90deg); }
.qa-more > summary:hover { color: var(--accent-hover); }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .detail-panel { display: none; }
  .sla-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Planning and the cockpit stack rather than squeeze: a 440px capacity panel and a
     burndown beside it both stop being readable well before the viewport does. */
  .plan-shell { grid-template-columns: minmax(0, 1fr); }
  .cockpit-top { grid-template-columns: minmax(0, 1fr); }
  .cockpit-figures { grid-template-rows: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .sla-row { grid-template-columns: 1fr; }
}

/* ── Admin screens ──────────────────────────────────────────────────────────
   Shared by the five configuration pages. One page per lookup table: a create
   row on top, then the table with an inline editor behind each name. */
.admin-page { display: flex; flex-direction: column; gap: 14px; }

.admin-intro {
  background: var(--bg-info);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  font-size: 12.5px; line-height: 1.55;
  color: var(--text-info);
  max-width: 900px;
}
.admin-intro strong { font-weight: 700; }

/* Divides a page that maintains two related tables rather than one. Only the sprint
   screen does this today — sprints and the phases they roll up into — and they share a
   screen deliberately: a phase exists to be picked from the sprint form beside it. */
.admin-section-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.admin-create {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.admin-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; }
/* Full width in both containers it is used in: flex-basis for .admin-create, which is
   a flex row, and grid-column for .admin-form-grid, where flex-basis does nothing.
   Without the second half a full-width field in the create grid silently stayed one
   column wide. */
.admin-field--wide { flex-basis: 100%; grid-column: 1 / -1; }
.admin-field label,
.admin-edit-form label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.admin-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-secondary); white-space: nowrap;
}

.admin-create-panel > summary {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; list-style: none; width: fit-content;
}
.admin-create-panel > summary::-webkit-details-marker { display: none; }
.admin-form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.admin-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.admin-table { width: 100%; border-collapse: collapse; }
/* Type and weight follow the My Tasks grid header (.mt-thead) rather than sitting a
   size and a weight apart from it: the settings screens and the work screens are the
   same application, and a heavier, tighter header here read as a different product. */
.admin-table th {
  text-align: left; padding: 0 14px; height: 40px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.admin-table tr:last-child td { border-bottom: none; }
/* The same row feedback the work grids give. Header excluded: it is not a row you
   are pointing at, and highlighting it reads as a selection. */
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table .mono { font-family: var(--font-mono); font-size: 12px; }
.admin-table .muted { color: var(--text-tertiary); }
/* A retired row stays legible but visibly out of service. */
.admin-table tr.is-retired td { opacity: .58; }

/* Weight matches .mt-name, so a record opens the same way in settings as in the
   work grids. */
.admin-edit > summary {
  cursor: pointer; font-weight: 500; list-style: none;
  color: var(--text-primary);
}
.admin-edit > summary::-webkit-details-marker { display: none; }
.admin-edit > summary:hover { color: var(--accent); }
.admin-edit[open] > summary { color: var(--accent); }
.admin-edit-form {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 10px; padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 260px;
}
.admin-edit-form .form-control { margin-bottom: 4px; }
.admin-edit-form button { margin-top: 8px; }

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-danger { color: var(--text-danger); }
.admin-chips { display: flex; gap: 5px; flex-wrap: wrap; }

.swatch {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 3px; margin-right: 6px;
  vertical-align: -1px;
  box-shadow: inset 0 0 0 1px var(--ring-inset);
}
.kcp-fill.is-over { background: var(--pri-critical-bar); }

/* ── Board filter pane (Planner-style) ─────────────────────────────────────
   A right-hand slide-out over the board, with collapsible facet groups. All the
   filtering happens in the browser — see wwwroot/js/board-filters.js. */

/* Toolbar: keyword box and the Filters button, beside the grouping toggle. */
.bf-search {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; min-width: 210px;
  border-bottom: 1px solid var(--border-md);
  color: var(--text-tertiary);
}
.bf-search input {
  flex: 1; border: 0; outline: none; background: none;
  font-family: inherit; font-size: 12.5px; color: var(--text-primary);
}
.bf-search:focus-within { border-bottom-color: var(--accent); }

.bf-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
}
.bf-toggle:hover { background: var(--bg-hover); }
.bf-toggle.is-active { border-color: var(--accent); color: var(--accent); }
.bf-toggle-count { font-weight: 600; }

/* Scrim: dims the board and gives a click-anywhere-to-close target. */
.bf-scrim {
  position: fixed; inset: 0; z-index: 190;
  background: var(--scrim-soft);
}

.bf-pane {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 200;
  width: 340px; max-width: 92vw;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-md);
  box-shadow: var(--shadow-lg);
}

.bf-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.bf-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; }
.bf-clear {
  border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 12.5px; color: var(--accent);
}
.bf-clear:hover { text-decoration: underline; }
.bf-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; cursor: pointer;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-secondary);
}
.bf-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.bf-body { flex: 1; overflow-y: auto; padding: 6px 0 20px; }

/* Each facet group is a <details>, so collapsing needs no script. */
.bf-group { border-bottom: 1px solid var(--border); }
.bf-group > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  padding: 13px 16px;
  font-size: 13.5px; font-weight: 500; color: var(--text-primary);
  background: var(--bg-subtle);
}
.bf-group > summary::-webkit-details-marker { display: none; }
.bf-chev {
  margin-left: auto; font-size: 15px; color: var(--text-tertiary);
  transition: transform .12s ease;
}
.bf-group[open] .bf-chev { transform: rotate(180deg); }
.bf-group > summary:hover { background: var(--bg-hover); }
.bf-count { color: var(--text-tertiary); font-size: 12.5px; }
.bf-group.has-selection > summary { color: var(--accent); }
.bf-group.has-selection .bf-count { color: var(--accent); font-weight: 600; }

.bf-options { padding: 4px 0 10px; }

/* The checkbox itself is hidden: the row is the control, and a tick on the right
   marks the selection — the same shape Planner uses. */
.bf-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer;
  font-size: 13px; color: var(--text-primary);
}
.bf-opt:hover { background: var(--bg-hover); }
.bf-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.bf-opt > span { flex: 1; }
.bf-opt > .ti-check { visibility: hidden; color: var(--accent); font-size: 16px; }
.bf-opt input:checked ~ .ti-check { visibility: visible; }
/* Keyboard focus has to land somewhere visible, since the input is hidden. */
.bf-opt input:focus-visible ~ span { outline: 2px solid var(--accent); outline-offset: 2px; }

.bf-person { display: flex; align-items: center; gap: 9px; }

/* A column emptied by filtering reads as "nothing matches", not as an empty bucket.
   It stays a drop target. */
.kanban-card.is-filtered-out { display: none; }
.kanban-column.is-filtered-empty { opacity: .55; }

/* ══════════════════════════════════════════════════════════════════════════════
   Shell, 2026 pass: a topbar that earns its height, one account menu, Settings
   behind a disclosure, board views as tabs, and global search.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
.crumbs { display: flex; align-items: center; gap: 7px; min-width: 0; }
.crumbs a {
  font-size: 13px; color: var(--text-tertiary); text-decoration: none;
  white-space: nowrap;
}
.crumbs a:hover { color: var(--text-primary); text-decoration: none; }
.crumbs > i { font-size: 14px; color: var(--border-strong); flex-shrink: 0; }
.crumbs .page-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Topbar search ─────────────────────────────────────────────────────────────
   A button, not an input: the typing happens in the palette. Sized to sit between
   the title and the actions and to give way to both — the actions row on a board
   is long, so this collapses to its icon before anything else wraps. */
.topbar-search {
  flex: 1 1 auto;
  min-width: 34px;
  max-width: 420px;
  margin-left: 8px;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 11px;
  background: var(--bg-page);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-family: var(--font); font-size: 13px;
  cursor: text;
  transition: border-color .13s, background .13s;
}
.topbar-search:hover { border-color: var(--border-strong); background: var(--bg-surface); }
.topbar-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.topbar-search i { font-size: 15px; flex-shrink: 0; }
.topbar-search-label {
  flex: 1; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-search-kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: 5px; padding: 1px 5px;
  flex-shrink: 0;
}
/* Below this the label is noise — the icon alone is the affordance, and the topbar
   actions need the room more than the placeholder does. */
@media (max-width: 1100px) {
  .topbar-search { max-width: 34px; padding: 0; justify-content: center; }
  .topbar-search-label, .topbar-search-kbd { display: none; }
}

/* ── Settings disclosure in the nav ────────────────────────────────────────── */
.nav-fold { margin-top: 10px; }
.nav-fold > summary { list-style: none; cursor: pointer; }
.nav-fold > summary::-webkit-details-marker { display: none; }
.nav-fold-summary { font-weight: 500; }
.nav-fold-chev {
  margin-left: auto;
  font-size: 15px !important;
  transition: transform .14s ease;
}
.nav-fold[open] > summary .nav-fold-chev { transform: rotate(90deg); }
/* The nested items indent so the group reads as a group. */
.nav-fold > .nav-item { padding-left: 34px; }

/* ── Account menu ──────────────────────────────────────────────────────────────
   Replaces the sidebar user card, whose entire surface was wired to sign-out. */
.usermenu { position: relative; flex-shrink: 0; }
.usermenu-trigger {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  padding: 3px 5px 3px 3px;
  border-radius: 999px;
  transition: background .13s;
}
.usermenu-trigger::-webkit-details-marker { display: none; }
.usermenu-trigger:hover { background: var(--bg-hover); }
.usermenu-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.usermenu-trigger .user-avatar { width: 30px; height: 30px; font-size: 11.5px; }
.usermenu-chev { font-size: 15px; color: var(--text-tertiary); }
.usermenu[open] .usermenu-chev { transform: rotate(180deg); }

/* position:fixed, placed by popover.js — the topbar is a flex row that would
   otherwise clip it, the same reason the card popovers are fixed. */
.usermenu-panel, .popmenu-panel {
  position: fixed;
  z-index: 60;
  width: 268px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.usermenu-id {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}
.usermenu-id .user-avatar { width: 36px; height: 36px; font-size: 13px; }
.usermenu-who { min-width: 0; }
.usermenu-name {
  font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usermenu-role { font-size: 11.5px; color: var(--text-tertiary); }

.usermenu-item, .popmenu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px; color: var(--text-secondary);
  text-decoration: none;
}
.usermenu-item:hover, .popmenu-item:hover {
  background: var(--bg-hover); color: var(--text-primary); text-decoration: none;
}
.usermenu-item i, .popmenu-item i { font-size: 17px; color: var(--text-tertiary); }
.usermenu-item--danger:hover { background: var(--bg-danger); color: var(--text-danger); }
.usermenu-item--danger:hover i { color: var(--text-danger); }

.usermenu-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 10px;
}
.usermenu-row > i { font-size: 17px; color: var(--text-tertiary); }
.usermenu-row-label { font-size: 13px; color: var(--text-secondary); flex: 1; }

.theme-toggle {
  display: inline-flex; align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  padding: 2px; gap: 2px;
}
.theme-toggle button {
  border: none; background: none; cursor: pointer;
  font-family: var(--font); font-size: 11.5px; color: var(--text-tertiary);
  padding: 3px 8px; border-radius: 6px;
}
.theme-toggle button:hover { color: var(--text-primary); }
.theme-toggle button.is-on {
  background: var(--bg-surface); color: var(--text-primary); font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ── Board header: identity, views, layout ────────────────────────────────────
   One row, inside the 56px topbar. There used to be two: this strip carried the
   board's name and its views, and the topbar above it carried eight grouping
   chips. The two levels were the wrong way round — the upper strip described how
   ONE of the five views was laid out — so on Planning, Burndown, Timeline and
   Library it was a control that could only take you off the page you were on.

   Now the left of the topbar says who and where (.boardnav), the right says what
   you can do, and the grouping controls render on the kanban and the grid alone.
   See _BoardViewTabs.cshtml and _BoardGroupMenu.cshtml. */
.boardnav {
  /* Stretches the full 56px so the tabs can carry their underline on the
     topbar's own bottom border rather than floating mid-strip. The topbar is
     align-items:center, which would otherwise shrink this to its content. */
  align-self: stretch;
  display: flex; align-items: stretch; gap: 10px;
  min-width: 0;
}

/* The board's name IS the menu for the board: Edit, pin, and the way back to all
   boards. Those were two topbar buttons whose meaning depended on which board
   happened to be open. */
.boardnav-menu { position: relative; align-self: center; min-width: 0; flex: 0 1 auto; }
.boardnav-trigger {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  padding: 4px 7px 4px 4px;
  border-radius: var(--radius-md);
  min-width: 0;
  transition: background .13s;
}
.boardnav-trigger::-webkit-details-marker { display: none; }
.boardnav-trigger:hover { background: var(--bg-hover); }
.boardnav-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.boardnav-name {
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.2px;
  color: var(--text-primary);
  /* Gives way before the tabs do: the tabs are navigation, the name is a label,
     and a long board name must not push Library off the row. */
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.boardnav-chev { font-size: 14px; color: var(--text-tertiary); flex-shrink: 0; }
.boardnav-menu[open] .boardnav-chev { transform: rotate(180deg); }

.boardnav-rule {
  align-self: center;
  width: 1px; height: 20px;
  background: var(--border-md);
  flex-shrink: 0;
}

.viewtabs {
  display: flex; align-items: stretch; gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.viewtabs::-webkit-scrollbar { display: none; }

.viewtab {
  display: flex; align-items: center; gap: 7px;
  padding: 0 12px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  /* Sits on the topbar's bottom border, so the active tab is joined to the page
     it opens rather than underlined somewhere in the middle of the strip. */
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.viewtab:hover { color: var(--text-primary); text-decoration: none; }
.viewtab i { font-size: 16px; }
.viewtab.is-on {
  color: var(--accent); font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ── Grouping menu and layout switch ──────────────────────────────────────────
   Eight topbar chips became one menu and a two-way switch. The chips all answered
   "grouped by what", except Grid, which answered "shown as what" — a different
   question wearing the same clothes, which is why it reads as a ninth grouping.
   See _BoardGroupMenu.cshtml. */
.groupmenu { position: relative; flex-shrink: 0; }
.groupmenu-trigger {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  white-space: nowrap;
}
.groupmenu-trigger::-webkit-details-marker { display: none; }
.groupmenu-trigger:hover { background: var(--bg-hover); }
.groupmenu-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.groupmenu-trigger i { font-size: 15px; }
/* Lit when a grouping is in force, the way the chip for it used to be. The grid
   leaves it unlit: nothing is grouped there, and the switch says so. */
.groupmenu-trigger.is-set { border-color: var(--accent); color: var(--accent); }
.groupmenu-chev { font-size: 13px; color: var(--text-tertiary); }
.groupmenu-trigger.is-set .groupmenu-chev { color: inherit; }
.groupmenu[open] .groupmenu-chev { transform: rotate(180deg); }

.layoutswitch {
  display: inline-flex; flex-shrink: 0;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.layoutswitch-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 32px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  text-decoration: none;
}
.layoutswitch-btn + .layoutswitch-btn { border-left: 1px solid var(--border-md); }
.layoutswitch-btn:hover { background: var(--bg-hover); text-decoration: none; }
.layoutswitch-btn i { font-size: 16px; }
.layoutswitch-btn.is-on { background: var(--bg-hover); color: var(--text-primary); }

/* ── Shared popover menu ──────────────────────────────────────────────────────
   The account menu's panel and rows, under names that do not claim to be about
   an account: the board menu and the grouping menu use the same look, and the
   alternative was a second copy of it. Placement is popover.js's. */
.popmenu-head {
  padding: 6px 10px 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.popmenu-sep { height: 1px; background: var(--border-subtle); margin: 5px 8px; }
.popmenu-note {
  margin-left: auto;
  font-size: 10.5px; color: var(--text-tertiary);
  white-space: nowrap;
}
.popmenu-tick { margin-left: auto; color: var(--accent) !important; }
.popmenu-item.is-on { background: var(--bg-info); color: var(--accent); font-weight: 600; }
.popmenu-item.is-on i { color: var(--accent); }
/* The pin is a <button> in a list of links, so it needs the parts a button does
   not inherit. Without these it renders with the browser's own chrome beside
   rows that have none. */
button.popmenu-item {
  width: 100%; border: 0; background: none;
  font-family: inherit; text-align: left; cursor: pointer;
}

/* ── Command palette ──────────────────────────────────────────────────────────
   The app had no search at all; a record was found by filtering the All grid. */
.cmdp {
  width: min(620px, calc(100vw - 32px));
  max-height: min(72vh, 620px);
  margin: 12vh auto auto;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-family: var(--font);
  overflow: hidden;
}
.cmdp[open] { display: flex; flex-direction: column; }
.cmdp::backdrop { background: var(--scrim); }

.cmdp-field {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cmdp-field > i { font-size: 19px; color: var(--text-tertiary); }
.cmdp-input {
  flex: 1; min-width: 0;
  border: none; background: none; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--text-primary);
}
.cmdp-input::placeholder { color: var(--text-tertiary); }
/* The browser's own clear button duplicates Escape and lands on the Esc hint. */
.cmdp-input::-webkit-search-cancel-button { display: none; }
.cmdp-kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary);
  border: 1px solid var(--border-md); border-radius: 5px; padding: 1px 5px;
}

.cmdp-scopes {
  display: flex; gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.cmdp-scopes button {
  border: 1px solid transparent; background: none; cursor: pointer;
  font-family: var(--font); font-size: 12px; color: var(--text-tertiary);
  padding: 4px 10px; border-radius: 999px;
}
.cmdp-scopes button:hover { color: var(--text-primary); background: var(--bg-hover); }
.cmdp-scopes button.is-on {
  background: var(--bg-selected); color: var(--text-info);
  border-color: var(--border-md); font-weight: 600;
}

.cmdp-results { flex: 1; overflow-y: auto; padding: 6px; }
.cmdp-group {
  padding: 10px 10px 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.cmdp-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  text-decoration: none; color: inherit;
  scroll-margin: 8px;
}
.cmdp-row:hover, .cmdp-row.is-active {
  background: var(--bg-selected); text-decoration: none;
}
.cmdp-row > i { font-size: 18px; color: var(--text-tertiary); flex-shrink: 0; }
.cmdp-row.is-active > i { color: var(--accent); }
.cmdp-row-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cmdp-row-title {
  font-size: 13.5px; font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmdp-row-sub {
  font-size: 11.5px; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmdp-empty {
  padding: 28px 16px; text-align: center;
  font-size: 13px; color: var(--text-tertiary);
}

.cmdp-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 11px; color: var(--text-tertiary);
  flex-shrink: 0;
}
.cmdp-foot kbd {
  font-family: var(--font-mono); font-size: 10px;
  border: 1px solid var(--border-md); border-radius: 4px;
  padding: 0 4px; margin-right: 2px;
}
.cmdp-count { margin-left: auto; }

/* ══════════════════════════════════════════════════════════════════════════════
   Dark theme
   ══════════════════════════════════════════════════════════════════════════════

   Only tokens are redefined here — never component rules. If a screen renders
   wrong in dark, the fix is a literal still sitting in a component rule above,
   not another override in this block.

   Three states, and the order matters:
     :root                                  light, always defined (above)
     @media (prefers-color-scheme: dark)     the OS preference, when no choice is stored
       :root:not([data-theme="light"])       …so an explicit Light still wins over it
     :root[data-theme="dark"]                an explicit Dark, whatever the OS says

   The guard on the media block is what makes the toggle work in both directions.
   Without it, a user on a dark OS who picks Light gets dark anyway.

   The palette keeps the app's cool-grey direction rather than a neutral black:
   the greys are pulled from the same hue family as --n-*, so the two themes read
   as one product. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --n-100: #10151c;  --n-200: #1b222c;  --n-300: #262e3a;
    --n-400: #37414f;  --n-500: #5b6674;  --n-600: #8b949f;
    --n-700: #aab2bc;  --n-800: #cbd1d9;  --n-900: #e8eaee;

    /* The accent lightens: #1d5db8 on a dark ground fails contrast for text,
       though it stays fine as a fill. --accent is used for both, so it moves to
       a mid tone that works either way, and the fills below keep their weight. */
    --a-100: #14202f;  --a-200: #1a2c42;  --a-300: #234163;
    --a-400: #2f5c8d;  --a-500: #4a8ad4;  --a-600: #6ba5e6;
    --a-700: #8dbcf0;  --a-800: #b3d3f6;  --a-900: #d6e8fb;

    --g-100: #0e1c17;  --g-200: #12291f;  --g-300: #1a4032;
    --g-400: #226b4f;  --g-500: #10b981;  --g-600: #34d399;
    --g-700: #6ee7b7;  --g-800: #a7f3d0;  --g-900: #d1fae5;

    --bg-page:       #0e1319;
    --bg-surface:    #161d26;
    --bg-subtle:     #131922;
    --bg-hover:      #1e2631;
    --bg-selected:   #1a2c42;
    --bg-info:       #1a2c42;
    --bg-success:    #12291f;
    --bg-warning:    #33240f;
    --bg-danger:     #3a1719;

    --text-primary:  #e8eaee;
    --text-secondary:#aab2bc;
    --text-tertiary: #8b949f;
    --text-info:     #8dbcf0;
    --text-success:  #6ee7b7;
    --text-warning:  #fbbf24;
    --text-danger:   #f87171;

    --border:        #242c37;
    --border-subtle: #1e2631;
    --border-md:     #2e3844;
    --border-strong: #3d4855;

    --accent:        #4a8ad4;
    --accent-hover:  #6ba5e6;

    /* Shadows on a dark ground come from black at higher alpha — a 6% ink shadow
       is invisible here, which is why every one of these was a literal problem. */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.60);
    --shadow-sm-hover: 0 1px 3px rgba(0,0,0,0.50);
    --shadow-md-hover: 0 4px 16px rgba(0,0,0,0.50);
    --shadow-popover:  0 6px 20px rgba(0,0,0,0.55);
    --shadow-accent:   0 1px 3px rgba(0,0,0,0.45);
    --shadow-success:  0 1px 3px rgba(0,0,0,0.45);

    /* Rings invert: a dark hairline on a dark ground has no contrast, so these
       become low-alpha light instead. */
    --ring-hairline:        rgba(255,255,255,0.06);
    --ring-hairline-md:     rgba(255,255,255,0.08);
    --ring-hairline-strong: rgba(255,255,255,0.14);
    --ring-inset:           rgba(255,255,255,0.10);

    --border-info:          rgba(107,165,230,0.28);
    --border-success:       rgba(110,231,183,0.24);
    --border-danger-subtle: rgba(248,113,113,0.26);
    --border-accent-subtle: rgba(107,165,230,0.32);
    --border-focus:         rgba(107,165,230,0.65);
    --ring-focus:           rgba(107,165,230,0.22);

    --bg-warning-subtle: #241a0d;
    --danger-hover:      #dc4a4a;

    --scrim:      rgba(0,0,0,0.66);
    --scrim-soft: rgba(0,0,0,0.50);

    /* Light in both themes: the logo is a dark-ink transparent PNG. Dimmed so it
       is not the brightest thing on the screen. */
    --logo-ground: #d8dce2;

    /* Priority pills: the light values are pale tints that become unreadable
       ground here, so each becomes a deep tint with a light foreground. The bar
       colours are identity — they stay put. */
    --pri-critical-bg: #3a1719;  --pri-critical-fg: #fca5a5;
    --pri-high-bg:     #33240f;  --pri-high-fg:     #fcd34d;
    --pri-medium-bg:   #1a2c42;  --pri-medium-fg:   #93c5fd;
    --pri-low-bg:      #1e2631;  --pri-low-fg:      #9aa1ad;

    /* The label palette, same treatment. These are the twelve keys mirrored in
       Domain/Labels/LabelPalette.cs — change one, change the other. The hue is
       what identifies a label, so each keeps its hue and only the lightness
       swaps: deep ground, light text. */
    --lbl-slate-bg:   #1e2631;  --lbl-slate-fg:   #cbd1d9;
    --lbl-rose-bg:    #3d1523;  --lbl-rose-fg:    #fda4af;
    --lbl-red-bg:     #3a1719;  --lbl-red-fg:     #fca5a5;
    --lbl-orange-bg:  #3a2010;  --lbl-orange-fg:  #fdba74;
    --lbl-amber-bg:   #33240f;  --lbl-amber-fg:   #fcd34d;
    --lbl-lime-bg:    #22300f;  --lbl-lime-fg:    #bef264;
    --lbl-green-bg:   #12291f;  --lbl-green-fg:   #6ee7b7;
    --lbl-teal-bg:    #0f2b2a;  --lbl-teal-fg:    #5eead4;
    --lbl-cyan-bg:    #0e2833;  --lbl-cyan-fg:    #67e8f9;
    --lbl-blue-bg:    #1a2c42;  --lbl-blue-fg:    #93c5fd;
    --lbl-violet-bg:  #241e3f;  --lbl-violet-fg:  #c4b5fd;
    --lbl-magenta-bg: #331338;  --lbl-magenta-fg: #f0abfc;
  }
}

/* An explicit Dark, whatever the OS is set to. Same values as the block above —
   duplicated rather than shared because CSS has no way to apply one declaration
   block to two selectors across a media boundary. Change one, change the other. */
:root[data-theme="dark"] {
  --n-100: #10151c;  --n-200: #1b222c;  --n-300: #262e3a;
  --n-400: #37414f;  --n-500: #5b6674;  --n-600: #8b949f;
  --n-700: #aab2bc;  --n-800: #cbd1d9;  --n-900: #e8eaee;

  --a-100: #14202f;  --a-200: #1a2c42;  --a-300: #234163;
  --a-400: #2f5c8d;  --a-500: #4a8ad4;  --a-600: #6ba5e6;
  --a-700: #8dbcf0;  --a-800: #b3d3f6;  --a-900: #d6e8fb;

  --g-100: #0e1c17;  --g-200: #12291f;  --g-300: #1a4032;
  --g-400: #226b4f;  --g-500: #10b981;  --g-600: #34d399;
  --g-700: #6ee7b7;  --g-800: #a7f3d0;  --g-900: #d1fae5;

  --bg-page:       #0e1319;
  --bg-surface:    #161d26;
  --bg-subtle:     #131922;
  --bg-hover:      #1e2631;
  --bg-selected:   #1a2c42;
  --bg-info:       #1a2c42;
  --bg-success:    #12291f;
  --bg-warning:    #33240f;
  --bg-danger:     #3a1719;

  --text-primary:  #e8eaee;
  --text-secondary:#aab2bc;
  --text-tertiary: #8b949f;
  --text-info:     #8dbcf0;
  --text-success:  #6ee7b7;
  --text-warning:  #fbbf24;
  --text-danger:   #f87171;

  --border:        #242c37;
  --border-subtle: #1e2631;
  --border-md:     #2e3844;
  --border-strong: #3d4855;

  --accent:        #4a8ad4;
  --accent-hover:  #6ba5e6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.45);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.60);
  --shadow-sm-hover: 0 1px 3px rgba(0,0,0,0.50);
  --shadow-md-hover: 0 4px 16px rgba(0,0,0,0.50);
  --shadow-popover:  0 6px 20px rgba(0,0,0,0.55);
  --shadow-accent:   0 1px 3px rgba(0,0,0,0.45);
  --shadow-success:  0 1px 3px rgba(0,0,0,0.45);

  --ring-hairline:        rgba(255,255,255,0.06);
  --ring-hairline-md:     rgba(255,255,255,0.08);
  --ring-hairline-strong: rgba(255,255,255,0.14);
  --ring-inset:           rgba(255,255,255,0.10);

  --border-info:          rgba(107,165,230,0.28);
  --border-success:       rgba(110,231,183,0.24);
  --border-danger-subtle: rgba(248,113,113,0.26);
  --border-accent-subtle: rgba(107,165,230,0.32);
  --border-focus:         rgba(107,165,230,0.65);
  --ring-focus:           rgba(107,165,230,0.22);

  --bg-warning-subtle: #241a0d;
  --danger-hover:      #dc4a4a;

  --scrim:      rgba(0,0,0,0.66);
  --scrim-soft: rgba(0,0,0,0.50);

  --logo-ground: #d8dce2;

  --pri-critical-bg: #3a1719;  --pri-critical-fg: #fca5a5;
  --pri-high-bg:     #33240f;  --pri-high-fg:     #fcd34d;
  --pri-medium-bg:   #1a2c42;  --pri-medium-fg:   #93c5fd;
  --pri-low-bg:      #1e2631;  --pri-low-fg:      #9aa1ad;

  --lbl-slate-bg:   #1e2631;  --lbl-slate-fg:   #cbd1d9;
  --lbl-rose-bg:    #3d1523;  --lbl-rose-fg:    #fda4af;
  --lbl-red-bg:     #3a1719;  --lbl-red-fg:     #fca5a5;
  --lbl-orange-bg:  #3a2010;  --lbl-orange-fg:  #fdba74;
  --lbl-amber-bg:   #33240f;  --lbl-amber-fg:   #fcd34d;
  --lbl-lime-bg:    #22300f;  --lbl-lime-fg:    #bef264;
  --lbl-green-bg:   #12291f;  --lbl-green-fg:   #6ee7b7;
  --lbl-teal-bg:    #0f2b2a;  --lbl-teal-fg:    #5eead4;
  --lbl-cyan-bg:    #0e2833;  --lbl-cyan-fg:    #67e8f9;
  --lbl-blue-bg:    #1a2c42;  --lbl-blue-fg:    #93c5fd;
  --lbl-violet-bg:  #241e3f;  --lbl-violet-fg:  #c4b5fd;
  --lbl-magenta-bg: #331338;  --lbl-magenta-fg: #f0abfc;
}

/* Tells the browser to theme its own furniture — form controls, scrollbars, the
   caret — so a dark app does not get a light native select dropped into it. */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"]  { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

/* Stands in for the withheld search trigger, so the page title does not stretch
   across the whole strip on pages that carry their own keyword filter. */
/* No longer grows. Flex grow/shrink is resolved before auto margins get a look in, so
   a growing spacer ate the free space the title's margin-right:auto needs and left the
   title adrift on exactly the pages that use it — My Tasks, All Tasks, the queue. The
   title's own auto margin now does this job; the spacer is just the gap. */
.topbar-spacer { flex: 0 0 auto; min-width: 8px; }

/* The topbar left slot. Shrinks before the right side does — the board's name and
   its view tabs can scroll within themselves, whereas New Task and the account
   menu cannot give way.

   Full height, not centred: it holds the board's view tabs, whose active underline
   has to land on the topbar's own bottom border rather than float mid-strip.

   LEFT, not centred horizontally either. The topbar is space-between, and on a board
   there are exactly three children — the menu toggle, this, and the actions — so the
   free space was split either side of this slot and the board's name floated into the
   middle of the strip, half a window from the toggle it follows. The auto margin takes
   that free space before justify-content can distribute any of it, which pins the name
   beside the toggle and leaves the actions at the right edge. Done here rather than by
   changing the topbar's justify-content, which every other page's title/search/actions
   arrangement is built on. */
.topbar-leading {
  align-self: stretch;
  display: flex; align-items: stretch; gap: 8px;
  min-width: 0; flex: 0 1 auto;
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-leading::-webkit-scrollbar { display: none; }

/* ── Quick-create panel ───────────────────────────────────────────────────────
   Was three stacked fields plus a "More options" disclosure over eight more. Now
   the subject is the form, and everything optional is a chip that reveals its own
   control. See wwwroot/js/quick-create.js for the pairing. */
.kanban-quick-add-form { width: 320px; }

.qc-head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 11px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.qc-where {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; font-size: 12px; color: var(--text-tertiary);
}
.qc-where i { font-size: 14px; }
.qc-where b {
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qc-board { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-close {
  margin-left: auto; flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); padding: 2px; line-height: 0;
  border-radius: var(--radius-sm);
}
.qc-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* No box: the subject is the panel's one required field, so it reads as the thing
   you type into rather than one control among several. */
.qc-subject {
  width: 100%; box-sizing: border-box;
  font-family: var(--font); font-size: 16px; font-weight: 500;
  letter-spacing: -0.2px; color: var(--text-primary);
  background: none; border: none;
  border-bottom: 2px solid var(--border-md);
  border-radius: 0;
  padding: 4px 2px 9px;
  transition: border-color .13s;
}
.qc-subject::placeholder { color: var(--text-tertiary); font-weight: 400; }
.qc-subject:focus { outline: none; border-bottom-color: var(--accent); }

.qc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.qc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: 12.5px; font-weight: 500;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  /* Dashed while empty: the chip is an invitation, not a value. */
  border: 1px dashed var(--border-strong);
  background: none; color: var(--text-tertiary);
  max-width: 100%;
  transition: background .12s, border-color .12s, color .12s;
}
.qc-chip:hover { border-color: var(--accent); color: var(--text-secondary); }
.qc-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qc-chip i { font-size: 14px; flex-shrink: 0; }
.qc-chip [data-qc-label] {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qc-chip.is-open { border-style: solid; border-color: var(--accent); color: var(--accent); }
.qc-chip.is-set {
  border-style: solid; border-color: transparent;
  background: var(--bg-selected); color: var(--text-info);
  padding-right: 6px;
}
/* Only a chip holding a value can be cleared, so the × appears with the value. */
.qc-chip-x { display: none; opacity: .6; }
.qc-chip-x:hover { opacity: 1; }
.qc-chip.is-set .qc-chip-x { display: inline-flex; }

.qc-fields { display: flex; flex-direction: column; gap: 10px; }
.qc-fields:not(:empty) { margin-top: 12px; }
.qc-field { display: flex; flex-direction: column; gap: 6px; }
.qc-field--pair { gap: 7px; }
.qc-field > input,
.qc-field > select,
.qc-field > textarea {
  width: 100%; box-sizing: border-box;
}

.qc-commit {
  display: flex; align-items: center; gap: 8px;
  margin-top: 15px; padding-top: 13px;
  border-top: 1px solid var(--border);
}
.qc-hint {
  margin-left: auto; font-family: var(--font-mono);
  font-size: 10.5px; color: var(--text-tertiary);
}

/* The panel is wider than the 300px column it hangs off, so on a narrow viewport it
   would otherwise reach past the edge. popover.js clamps the position; this clamps
   the width. */
@media (max-width: 420px) {
  .kanban-quick-add-form { width: calc(100vw - 32px); }
}

/* Assign and Scheduled date sit above the chip row rather than behind chips: they
   are most of what a task needs beyond its name, so a click in front of them to
   save one on the six rarer fields is the wrong trade. */
.qc-always {
  display: flex; flex-direction: column; gap: 11px;
  margin-top: 14px;
}
.qc-always + .qc-chips {
  margin-top: 14px; padding-top: 13px;
  border-top: 1px dashed var(--border);
}

/* The quick-create panel while its create is in flight — greyed out, the way a
   turned-off control looks. quick-create.js also sets `inert`, which is what
   genuinely blocks focus and clicks; pointer-events is the floor for engines that
   ignore the attribute.

   The grey is an inset shadow rather than an overlay element, because the panel is
   position:fixed and placed by popover.js — giving it position:relative to hang a
   ::after off would break its placement outright. The inset paints over the panel
   background and under its content, so the ground goes grey without a second box. */
.kanban-quick-add-form.is-busy {
  pointer-events: none;
  cursor: progress;
  box-shadow: var(--shadow-md), inset 0 0 0 9999px var(--bg-hover);
}

/* Every control follows the ground, so nothing is left looking live on a dead panel. */
.kanban-quick-add-form.is-busy .qc-subject,
.kanban-quick-add-form.is-busy input,
.kanban-quick-add-form.is-busy select,
.kanban-quick-add-form.is-busy textarea {
  background: var(--bg-hover);
  color: var(--text-tertiary);
  border-color: var(--border-md);
}
.kanban-quick-add-form.is-busy .qc-chip {
  background: none;
  border-color: var(--border-md);
  color: var(--text-tertiary);
}
.kanban-quick-add-form.is-busy .btn-primary {
  background: var(--border-strong);
  color: var(--bg-surface);
}
.kanban-quick-add-form.is-busy .qc-head,
.kanban-quick-add-form.is-busy .qc-hint { color: var(--text-tertiary); }

/* A card mid-delete. Same treatment as the quick-create panel: greyed out and dead,
   never transparent. card-actions.js also sets `inert`, which is what actually blocks
   the second click; pointer-events is the floor for engines that ignore it.

   A card is position:static, so this one can use a plain background rather than the
   inset-shadow trick the fixed-position panel needs. */
.kanban-card.is-busy,
.mt-tr.is-busy {
  pointer-events: none;
  cursor: progress;
  background: var(--bg-hover);
  box-shadow: none;
}
.kanban-card.is-busy .kanban-card-title,
.kanban-card.is-busy .cal-card-title,
.mt-tr.is-busy {
  color: var(--text-tertiary);
}

/* ── Board avatar ─────────────────────────────────────────────────────────────
   A board's logo, or its initials — the same shape and the same fallback an
   engineer gets from .avatar, so a board and a person read as one family. Sized
   by modifier rather than by context, so the same partial serves the sidebar,
   the board header and the board list. */
.bav {
  /* The default size, which is the board header — where the logo is the first thing
     identifying the screen, so it carries real presence rather than sitting as a
     marker beside the name. */
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-on-fill);
  overflow: hidden;
}
/* A logo is artwork with its own edges, so it is contained rather than cropped and
   sits on a light chip in both themes — most logos are drawn for white.

   Only 1px of padding at this size: a logo is the reason someone set one, so it
   should fill its chip rather than float in it. */
.bav--logo {
  object-fit: contain;
  background: var(--logo-ground);
  padding: 1px;
}
/* Sidebar rows: bigger than the bullet it replaced, but still bound by the row's
   own height — a taller chip would space the whole nav out. */
.bav--sm { width: 26px; height: 26px; font-size: 9.5px; border-radius: var(--radius-sm); }
/* The board header and the form preview, where the board is the subject of the
   screen rather than a marker in a list. */
.bav--lg { width: 64px; height: 64px; font-size: 22px; border-radius: var(--radius-lg); }

/* The sidebar row: the avatar replaces the bullet, so the gap tightens to keep the
   row's text on the same rhythm as the rest of the nav. */
.nav-item--board { gap: 9px; }

/* ── Finding and pinning boards in the left menu ──────────────────────────────
   The nav grows by a row per board, and an engineer works two or three of them.
   Pinned boards move to the top; the box filters the rest by name. Both are
   driven by board-nav.js and render hidden until it runs. */

/* Pinned boards sit above the box, so they read as the shortlist the search exists
   to avoid needing. Separated by a rule rather than a heading: a "Pinned" label
   would cost a row in a nav that is already tight, to say what the filled pins
   beside each board already say. */
.nav-group--pinned {
  margin: 2px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-search {
  display: flex; align-items: center; gap: 7px;
  margin: 2px 10px 4px 10px;
  padding: 5px 10px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}
.nav-search i { font-size: 13px; color: var(--text-tertiary); }
.nav-search input {
  flex: 1; min-width: 0;
  border: 0; outline: none; padding: 0;
  background: none;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-primary);
}
.nav-search:focus-within { border-color: var(--accent); }

/* Says "no match", not "no boards". An empty list under a search box has already
   been read as lost access to every board. */
.nav-search-empty {
  margin: 2px 10px 6px 34px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* The link and its pin sit side by side: a button inside an anchor is invalid, and
   browsers recover by closing the anchor early — which breaks the board link. */
.nav-board-row { display: flex; align-items: center; }
.nav-board-row .nav-item--board { flex: 1; min-width: 0; }
.nav-board-row .nav-item--board span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-pin {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  margin-right: 12px;
  border: 0; border-radius: var(--radius-sm);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  /* Out of the way until wanted. Hidden by opacity rather than display so the row
     does not change width on hover and shift the board name under the cursor. */
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.nav-pin i { font-size: 14px; }
.nav-board-row:hover .nav-pin,
.nav-pin:focus-visible { opacity: 1; }
.nav-pin:hover { background: var(--border); color: var(--text-primary); }

/* A pinned board's pin stays visible: it is the only thing saying why that board is
   at the top, and a reader who cannot see it reads the order as arbitrary. */
.nav-board-row.is-pinned .nav-pin { opacity: 1; color: var(--accent); }

/* The logo field on the board form — preview beside the input, so a paste shows
   its effect immediately and a broken URL reads as a broken image. */
.logo-field { display: flex; align-items: center; gap: 10px; }
.logo-field .form-control { flex: 1; min-width: 0; }
.logo-field-preview { display: inline-flex; flex-shrink: 0; }

/* ── Grid multi-select ────────────────────────────────────────────────────────
   Shared by both grids: All Tasks is a real table, My Tasks a div grid. */
.grid-check { width: 34px; text-align: center; }
.grid-check input, .row-check { cursor: pointer; accent-color: var(--accent); }

/* The status dot and the checkbox share My Tasks' first cell. The dot steps aside
   on hover or once the row is selected, so the checkbox is what you aim at. */
.mt-td--check { position: relative; justify-content: center; }
.mt-td--check .row-check { opacity: 0; position: absolute; }
.mt-td--check:hover .row-check,
.mt-tr:hover .mt-td--check .row-check,
.mt-tr.is-selected .mt-td--check .row-check,
.mt-td--check .row-check:focus-visible,
.mt-td--check .row-check:checked { opacity: 1; position: static; }
.mt-tr:hover .mt-td--check > i,
.mt-tr.is-selected .mt-td--check > i,
.mt-td--check .row-check:checked ~ i { display: none; }

tr.is-selected, .mt-tr.is-selected { background: var(--bg-selected); }

/* Fixed to the viewport, not to the grid: a bar inside a scrolling table scrolls
   away from the rows it acts on. */
.bulkbar {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
}
.bulkbar[hidden] { display: none; }
.bulkbar-count {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.bulkbar-form { display: inline-flex; }
.bulkbar-clear {
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; color: var(--text-tertiary);
  padding: 4px 6px; border-radius: var(--radius-sm);
}
.bulkbar-clear:hover { color: var(--text-primary); background: var(--bg-hover); }

/* The logo picker on the board form: preview, buttons, and the hidden field that
   actually carries the picture. */
.logo-field { display: flex; align-items: center; gap: 14px; }
.logo-field-actions { display: flex; align-items: center; gap: 8px; }
/* A label wrapping a hidden file input — clicking it opens the picker, so it has to
   look and behave like the button it is standing in for. */
.logo-pick { cursor: pointer; margin: 0; }
.logo-field-note { display: block; font-size: 11.5px; color: var(--text-secondary); }
.logo-field-note.is-error { color: var(--text-danger); }

/* "New" on a planning column header. Quiet until hovered — planning is mostly moving
   work that already exists, so raising more should be available without competing
   with the lists either side of it. */
.plan-col-add {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 3px 9px;
  border: 1px solid var(--border-md);
  border-radius: 999px;
}
.plan-col-add:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.plan-col-add i { font-size: 14px; }

/* The assign popover sitting in the record's "Assigned to" fact. The card's own
   toggle is sized for a card corner; here it sits inline after the avatar stack. */
.fact-assign { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.fact-assign .kanban-assign-toggle { cursor: pointer; }

/* ── Email Configuration: the master switch ──────────────────────────────────
   A panel rather than another table row: it governs everything below it, and a
   control that silences every customer email in the system should not look like
   the eleven controls it overrules. */
.admin-master-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.admin-master-switch.is-on { border-color: rgba(59, 109, 17, 0.35); background: var(--bg-success); }
.admin-master-switch.is-off { border-color: rgba(163, 45, 45, 0.30); background: var(--bg-danger); }

.ams-state { display: flex; align-items: flex-start; gap: 11px; min-width: 260px; flex: 1; }
.ams-state > i { font-size: 21px; margin-top: 1px; }
.admin-master-switch.is-on .ams-state > i { color: var(--text-success); }
.admin-master-switch.is-off .ams-state > i { color: var(--text-danger); }

.ams-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.ams-detail { font-size: 12px; color: var(--text-secondary); margin-top: 3px; max-width: 62ch; }

/* Dimmed while sending is off. Deliberately not pointer-events:none — the per-type
   switches still work, because setting them up before turning mail on is a
   reasonable order to do things in. */
.admin-table-wrap.is-muted { opacity: 0.62; }

/* Required-field marker. A class rather than an inline colour on every asterisk,
   so "required" is one decision rather than a literal repeated per field. */
.req { color: var(--text-danger); font-weight: 700; }

/* Two fields sharing a line inside an edit form — first/last name, the two phone
   numbers. They collapse to one column below the narrow breakpoint rather than
   squeezing two inputs into a phone's width. */
.admin-field-pair { display: flex; gap: 10px; }
.admin-field-pair > * { flex: 1; min-width: 0; }
@media (max-width: 560px) { .admin-field-pair { flex-direction: column; } }

/* A table cell carrying a name, an explanation and sometimes a caveat — the Email
   Configuration rows. Sizes track .admin-table's own 13px body rather than being
   chosen per page, so a settings row reads the same wherever it appears. */
.admin-cell-title { font-weight: 500; color: var(--text-primary); }
.admin-cell-note { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.admin-cell-warn { font-size: 11.5px; color: var(--text-warning); margin-top: 4px; }
.admin-cell-meta { font-size: 12px; color: var(--text-secondary); }

/* ── Mid-action: the record is being changed ─────────────────────────────────
   The quick-create panel's treatment, generalised to any card. An inset shadow
   rather than an overlay element, because the popovers on a card are
   position: fixed and placed against their toggle — giving the card a
   positioned ancestor would move them.

   `inert` on the element is what actually disables it; pointer-events is the
   floor for engines that ignore the attribute. */
.kanban-card.is-busy {
  pointer-events: none;
  cursor: progress;
  box-shadow: inset 0 0 0 9999px var(--bg-hover);
}
.kanban-card.is-busy .kanban-card-title,
.kanban-card.is-busy .task-card-title { color: var(--text-tertiary); }
.kanban-card.is-busy .kanban-tag,
.kanban-card.is-busy .badge {
  background: none;
  border-color: var(--border-md);
  color: var(--text-tertiary);
}
.kanban-card.is-busy .avatar,
.kanban-card.is-busy img { filter: grayscale(1); opacity: .7; }

/* ── A board's document library ──────────────────────────────────────────────
   A view of the board in its own right, alongside Board, Planning, Sprint and
   Timeline. It began as a collapsed disclosure above the columns, which gave a
   file manager a fraction of the width it needed and put it in front of the work
   people came for. The disclosure chrome that went with it — the chevron, the
   count badge, the summary row — went with it too. */
.board-library {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 12px 14px 14px;
}

/* Breadcrumb on the left, the tools that act on the folder it names on the
   right, so "where am I" and "do something here" read as one row. Wraps rather
   than shrinking: the upload control has a native file input in it and there is
   no useful narrow version of that. */
.board-files-head-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.board-files-head-row .board-files-crumbs {
  margin: 0; padding: 0; border: 0;
}
.board-files-head-row .board-files-tools {
  margin: 0; padding: 0; border: 0;
}

/* The library is a table now, not a flex list — see .board-files-table below,
   which owns the row padding, borders and column widths.
   .board-files-row used to carry display:flex here. Left in place it applied to
   the new <tr>, turning every row into a flex container and blockifying its
   cells, so the columns silently stopped lining up with their headers. */
.board-files-icon { color: var(--text-tertiary); font-size: 15px; flex: none; }
.board-files-name {
  color: var(--text-primary); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.board-files-name:hover { color: var(--accent); text-decoration: underline; }

.board-files-empty { color: var(--text-tertiary); padding: 6px 0 10px; }

.board-files-problem {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px; margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-danger);
  color: var(--text-danger);
}
/* A missing grant is a setup step, not a fault — amber rather than red, so it
   does not read as something broken. */
.board-files-problem.is-permission { background: var(--bg-warning); color: var(--text-warning); }

.board-files-upload { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.board-files-input { max-width: 260px; }
.board-files-hint { color: var(--text-tertiary); font-size: 11.5px; }

/* ── The All Tasks filter pane ───────────────────────────────────────────────
   The same pane the boards use, but its contents are a real form. The form has
   to become the flex column, or .bf-body stops being the thing that scrolls and
   the pane grows past the viewport instead. */
.bf-pane > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Pinned below the scrolling body: Apply must stay reachable with a long list of
   facets open, and a submit button that scrolls away reads as a pane that cannot
   be applied. */
.bf-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* Groups whose controls are selects rather than checkboxes, because the server
   takes one value for them. Stacked with their own labels — a bare select in a
   list of ticked facets gives no clue what it narrows. */
.bf-selects { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 14px; }
.bf-field { display: flex; flex-direction: column; gap: 4px; }
.bf-field > span {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-tertiary);
}

/* The toolbar above the grid: keyword, the pane toggle, and Clear. */
.grid-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.grid-keyword { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; }
.grid-keyword .bf-search { flex: 1; }

/* ── Checklist steps assigned to you (My Tasks) ────────────────────────────────
   A panel under the grid rather than rows inside it: a step is not a record, and
   putting one in the grid would give it a completion circle and a bulk-select
   checkbox that no handler on that screen knows how to honour. */
.mt-steps {
  margin-top: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.mt-steps-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.mt-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
}

.mt-step:last-child { border-bottom: 0; }
.mt-step:hover { background: var(--surface-2, rgba(127, 127, 127, .07)); }
.mt-step > .ti { color: var(--text-secondary); flex: none; }

/* The step text is the row's subject and takes the space; its parent trails it,
   quieter, because it is context rather than the thing itself. */
.mt-step-text { flex: 1 1 auto; min-width: 0; }

.mt-step-parent {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  max-width: 45%;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.mt-step-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Narrow: the parent's subject is the first thing to go — the number still
   identifies the record, and the step text is what the row is for. */
@media (max-width: 900px) {
  .mt-step-subject { display: none; }
  .mt-step-parent { max-width: none; }
}

/* ── Steps grouped under their record ─────────────────────────────────────
   The record is stated once, in the head; the steps under it carry only what
   is theirs. Before this, every step repeated its parent's number, subject,
   board, sprint, customer and date, so a list of six steps across four
   records printed the same facts two and three times. */
.mt-stepgroup { border-bottom: 1px solid var(--border); }
.mt-stepgroup:last-child { border-bottom: 0; }

.mt-stepgroup-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 14px;
  background: var(--bg-subtle, rgba(127, 127, 127, .045));
  font-size: 12.5px;
}

.mt-stepgroup-ref {
  display: flex; align-items: baseline; gap: 7px;
  min-width: 0;
  color: inherit; text-decoration: none; font-weight: 600;
}
.mt-stepgroup-ref .mono { color: var(--accent); flex: none; }
.mt-stepgroup-ref:hover .mt-stepgroup-subject { text-decoration: underline; }

.mt-stepgroup-subject {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mt-stepgroup-facts {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-left: auto; flex: none;
  font-size: 11px; color: var(--text-tertiary); font-weight: 400;
}
.mt-stepgroup-facts .is-late { color: var(--text-danger); font-weight: 600; }
.mt-stepgroup-priority { display: inline-flex; align-items: center; gap: 5px; }

.mt-steplist { list-style: none; margin: 0; padding: 0; }

.mt-steprow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 28px;
  border-top: 1px solid var(--border-sm, rgba(127, 127, 127, .12));
  font-size: 13px;
}
.mt-steprow:hover { background: var(--surface-2, rgba(127, 127, 127, .07)); }

.mt-steptext { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A real control now — this used to be an <i class="ti ti-square"> inside the
   row's link, so the most tickable-looking thing on the page opened a record. */
.mt-steptick { flex: none; line-height: 1; }
.mt-stepbox {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0;
  background: var(--bg-surface); border: 1.5px solid var(--border-md, var(--border));
  border-radius: 4px; cursor: pointer;
  color: transparent; font-size: 11px; line-height: 1;
}
.mt-stepbox:hover { border-color: var(--accent); color: var(--accent); }
/* Static twin on a split step, so the column stays aligned and the list does
   not read as ragged where a tick is withheld. */
.mt-stepbox.is-static { cursor: default; border-style: dashed; opacity: .6; }

.mt-steprow.is-split .mt-steptext { color: var(--text-secondary); }
.mt-stepsplit {
  flex: none;
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--accent); text-decoration: none;
}
.mt-stepsplit:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .mt-stepgroup-facts { margin-left: 0; width: 100%; }
}

/* ── Engineer performance report ─────────────────────────────────────────── */
.report-access { display: inline-flex; align-items: center; gap: 6px; color: var(--text-tertiary); font-size: 12px; }
/* Every top-level block on this page is a flex item of .content, which is a flex
   column. flex: none on each keeps them at their natural height instead of sharing
   out the viewport — the panels below carry overflow:hidden, which is what makes
   the crushing possible in the first place. */
.report-filters {
  flex: none;
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.report-filters label { display: flex; flex-direction: column; gap: 5px; min-width: 190px; }
.report-filters label > span { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-tertiary); }
.report-context { flex: none; display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; color: var(--text-secondary); font-size: 12px; }
.report-context > div:first-child { display: flex; gap: 8px; align-items: baseline; }
.report-context strong { color: var(--text-primary); }
.report-context-rule { text-align: right; }
.report-kpis { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-kpi { padding: 14px 15px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.report-kpi.is-good { border-left: 3px solid var(--text-success); }
.report-kpi.is-warning { border-left: 3px solid var(--text-warning); }
.report-kpi.is-danger { border-left: 3px solid var(--text-danger); }
.report-kpi-label { color: var(--text-secondary); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.report-kpi-value { margin: 5px 0 2px; color: var(--text-primary); font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.report-kpi-note { color: var(--text-tertiary); font-size: 11.5px; }
/* flex: none is load-bearing. .content is a flex column, so every panel here is a
   flex item — and `overflow: hidden` removes the automatic min-height that would
   otherwise stop one being crushed. Without this the three panels collapse to empty
   slivers while the KPI grid above them, which has no overflow, renders normally. */
.report-panel { flex: none; margin-bottom: 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.report-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.report-panel-head h2 { margin: 0 0 2px; color: var(--text-primary); font-size: 14px; }
.report-panel-head p { margin: 0; color: var(--text-tertiary); font-size: 11.5px; }
.report-legend { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 11px; }
.report-legend span { width: 8px; height: 8px; border-radius: 2px; margin-left: 8px; }
.report-legend .opened, .report-trend-bars .opened { background: var(--accent); }
.report-legend .completed, .report-trend-bars .completed { background: var(--text-success); }
.report-trend-scroll { padding: 16px; overflow-x: auto; }
.report-trend { display: flex; height: 180px; gap: 6px; align-items: stretch; }
.report-trend-week { display: flex; flex: 1 0 40px; min-width: 40px; flex-direction: column; align-items: center; }
.report-trend-bars { display: flex; flex: 1; width: 26px; gap: 3px; align-items: end; }
.report-trend-bars span { width: 11px; min-height: 2px; border-radius: 2px 2px 0 0; }
.report-trend-week small { margin-top: 5px; color: var(--text-tertiary); font-size: 9px; white-space: nowrap; }
.report-table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th { padding: 9px 12px; color: var(--text-tertiary); background: var(--bg-subtle); font-size: 9.5px; text-align: left; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.report-table td { padding: 10px 12px; border-top: 1px solid var(--border-subtle); color: var(--text-secondary); white-space: nowrap; }
.report-table tbody tr:hover { background: var(--bg-subtle); }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table a { color: inherit; text-decoration: none; }
.report-engineer { display: flex; align-items: center; gap: 8px; }
.report-engineer img, .report-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.report-avatar { display: grid; place-items: center; color: var(--text-info); background: var(--bg-info); font-size: 11px; font-weight: 700; }
.report-engineer > span:last-child { display: flex; flex-direction: column; }
.report-engineer strong { color: var(--text-primary); font-weight: 600; }
.report-engineer small, .report-table td small { color: var(--text-tertiary); font-size: 10px; }
.report-pill { display: inline-flex; padding: 2px 7px; border-radius: 999px; background: var(--bg-subtle); }
.report-pill.is-good { color: var(--text-success); background: var(--bg-success); }
.report-pill.is-warning { color: var(--text-warning); background: var(--bg-warning); }
.report-pill.is-danger { color: var(--text-danger); background: var(--bg-danger); }
.report-subject { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; color: var(--text-tertiary); font-size: 10.5px; }
.report-empty { display: flex; align-items: center; gap: 8px; padding: 22px 16px; color: var(--text-success); }
.report-method { flex: none; display: flex; gap: 10px; padding: 13px 15px; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: 11.5px; }
.report-method > .ti { margin-top: 1px; color: var(--accent); font-size: 17px; }
.report-method strong { color: var(--text-primary); }
.report-method p { margin: 3px 0 0; line-height: 1.5; }
.text-danger { color: var(--text-danger) !important; }
.text-warning { color: var(--text-warning) !important; }

@media (max-width: 1100px) {
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .report-kpis { grid-template-columns: 1fr; }
  .report-filters label { min-width: 100%; }
  .report-context { flex-direction: column; }
  .report-context-rule { text-align: left; }
}

/* The step and its parent's facts stack; the priority and any badge stay on the
   right, where the grid above also keeps them. */
.mt-step-main { flex: 1 1 auto; min-width: 0; }

.mt-step-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* One fact about the parent — customer, board, sprint, date. Icon-led so the line
   scans without labels, which at this size would be most of the width. */
.mt-step-fact { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.mt-step-fact .ti { font-size: 13px; opacity: .75; }

.mt-step-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Narrow: the parent's subject goes first — the number still identifies the record,
   and the facts after it are what the panel was widened for. */
@media (max-width: 900px) {
  .mt-step-priority > span:last-child { display: none; }
}

/* ── Attachments on a board card ───────────────────────────────────────────
   A paperclip beside the checklist badge, styled to match it so the two read as
   one row of card affordances rather than two unrelated controls. Its own
   disclosure, not part of the checklist: a step and a file are different things,
   and folding them together would make the checklist count mean two things. */
/* Both panels share one row while shut. An OPEN one takes the whole row back:
   .kcl-body and .kal-body need the card width, and a half-width checklist step
   would wrap to three lines. */
.kanban-card-tools {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 6px; margin-top: 7px;
}
.kanban-card-tools > details { flex: 0 0 auto; margin-top: 0; min-width: 0; }
/* 1 1 100%, not 1 0 100%: the checklist row holds a text field, an owner select and
   an add button, whose combined min-content width is wider than a column. With
   flex-shrink 0 the panel refuses to go below that and spills out past the card. */
.kanban-card-tools > details[open] { flex: 1 1 100%; }
/* Pushed to the right end of the row, away from the checklist badge. The two
   answer different questions — how much is left to do, and what came with it —
   and side by side they read as one run of numbers. */
.kanban-attach-panel { margin-top: 7px; margin-left: auto; }
.kanban-attach {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; cursor: pointer; list-style: none;
  /* Blue, where the checklist badge is grey and goes green when finished. A card
     carrying files is the thing worth spotting from across a column, and it must
     not be mistaken for progress — this is not a count of work done. Both tokens
     have dark-mode values, so the badge follows the theme. */
  background: var(--bg-info); color: var(--text-info);
}
.kanban-attach::-webkit-details-marker { display: none; }
.kanban-attach i { font-size: 11px; }
/* Nothing attached yet: a quiet affordance, exactly as the empty checklist badge
   does, so a board of untouched cards is not a wall of blue pills. */
.kanban-attach.is-empty {
  background: none; color: var(--text-tertiary); padding: 1px 2px;
  font-weight: 400;
}
.kanban-attach.is-empty:hover { color: var(--accent); }

.kal-body {
  margin-top: 7px; padding: 7px 8px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface);
  /* The panel is inside an inline-block summary; give it the card's width back. */
  min-width: 190px;
}
.kal-add { display: flex; flex-direction: column; gap: 6px; }
.kal-open {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--accent); text-decoration: none;
}
.kal-open:hover { text-decoration: underline; }

/* ── Choosing files ────────────────────────────────────────────────────────
   The native file input is unstyleable and its button text is set by the
   browser and the OS locale, so it is hidden and a label stands in for it —
   the label IS the control, so clicking it opens the picker with no script.
   Shared shape between the card panel and the record page's own panel. */
.kal-pick,
.attach-pick {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border: 1px dashed var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 11.5px; color: var(--text-secondary);
  cursor: pointer;
}
.kal-pick:hover,
.attach-pick:hover { border-color: var(--accent); color: var(--accent); }
/* Once a file is picked this span holds its name, which can be far wider than the
   panel. Truncate rather than let the label stretch the card or the sidebar. */
.kal-pick > span,
.attach-pick > span {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* A chosen file is a committed state, not a prompt — the dashed border says
   "nothing here yet", so it goes solid once something is. Driven by a class from
   upload.js rather than :has(input:valid), which would match always: a file input
   that is not required is :valid while empty. */
.kal-pick.is-picked,
.attach-pick.is-picked {
  border-style: solid; border-color: var(--accent); color: var(--text-primary);
}
/* Not display:none — a hidden input is skipped by keyboard navigation, which
   would leave the control unreachable without a mouse. Clipped instead, so it
   still takes focus and the label still reads as its name. */
.kal-pick input[type="file"],
.attach-pick input[type="file"] {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.kal-pick:focus-within,
.attach-pick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg-subtle); }

/* ── Attachments on the record page ───────────────────────────────────────── */
.attach-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attach-hint { font-size: 10.5px; color: var(--text-tertiary); }

/* The download link and the delete button are siblings, not nested: a button
   inside an anchor is invalid HTML, and the click would follow the link too. */
.attach-row {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.attach-link {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  padding: 5px 0; font-size: 12px;
  color: var(--accent); text-decoration: none;
}
.attach-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { color: var(--text-tertiary); flex-shrink: 0; font-size: 11px; }
.attach-del-form { flex-shrink: 0; display: flex; }
.attach-del {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-tertiary);
  font-size: 13px; cursor: pointer;
}
/* Red only on approach. A column of red bins down the side of the file list
   reads as a warning about the files rather than an action available on them. */
.attach-del:hover { background: #fee2e2; color: #dc2626; }
.attach-del:focus-visible { outline: 2px solid #dc2626; outline-offset: 1px; }

/* ── A panel mid-request ───────────────────────────────────────────────────
   Applied by checklist.js while a step is being added or ticked. inert does the
   real work in current engines; pointer-events is the floor for older ones, so a
   second click cannot fire a second command either way. */
#checklist.is-busy { opacity: .55; pointer-events: none; transition: opacity .12s; }

/* ── Uploading an attachment ───────────────────────────────────────────────
   Covers the page while a file POST is in flight. An overlay rather than a set
   of disabled controls, because a disabled input is not serialised — disabling
   the file field to show it was busy would submit a form with no file in it.
   This blocks the second click without touching what gets sent. */
.upload-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 32, .45);
  /* Backdrop blur is progressive: engines without it just get the tint. */
  backdrop-filter: blur(2px);
  animation: upload-in .12s ease-out;
}
@keyframes upload-in { from { opacity: 0; } to { opacity: 1; } }

.upload-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-width: 240px; max-width: min(400px, calc(100vw - 32px));
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  text-align: center;
}

.upload-spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: upload-spin .7s linear infinite;
}
@keyframes upload-spin { to { transform: rotate(360deg); } }

.upload-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  /* A long filename must wrap rather than stretch the box off screen. */
  overflow-wrap: anywhere;
}
.upload-detail { font-size: 11.5px; color: var(--text-secondary); }

/* Respecting a stated preference: the spinner is the only thing here that moves,
   and someone who has asked for less motion still needs to know it is working. */
@media (prefers-reduced-motion: reduce) {
  .upload-overlay { animation: none; }
  .upload-spinner { animation-duration: 2.4s; }
}

/* ── Files chosen but not yet uploaded ─────────────────────────────────────
   The native input is visually hidden, so this list and the label above it are
   the only things saying what was picked. Written by upload.js; empty and
   therefore invisible until a selection is made. */
.attach-chosen:empty { display: none; }
.attach-chosen {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px;
}
.attach-chosen-row {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 11px; color: var(--text-secondary);
}
.attach-chosen-name {
  flex: 1; min-width: 0;
  /* Truncated at the END, not with an ellipsis in the middle: two builds of the
     same export differ in their last few characters, and that is the part worth
     keeping. The title attribute is not set here, so the full name stays in the
     label above when only one file is chosen. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-chosen-size {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}
/* Over the limit. Red on the size rather than the whole row, because the name is
   how you find the file again and it must stay readable. */
.attach-chosen-row.is-over .attach-chosen-size { color: #dc2626; font-weight: 600; }
.attach-chosen-row.is-over .attach-chosen-name { text-decoration: line-through; }
.attach-chosen-note { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

/* ── Managing a board's SharePoint library ─────────────────────────────────
   The panel is now a small file manager rather than a read-only glance, so it
   grows a breadcrumb, per-row actions and a folder control. Everything still
   lives inside the collapsed Documents disclosure. */
.board-files-crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 3px;
  margin-bottom: 8px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
}
.board-files-crumb {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); text-decoration: none;
  padding: 1px 3px; border-radius: var(--radius-sm);
}
.board-files-crumb:hover { background: var(--bg-hover); }
/* The folder you are in is not a link to itself. */
.board-files-crumb.is-current { color: var(--text-primary); font-weight: 600; }
.board-files-crumb-sep { color: var(--text-tertiary); font-size: 12px; }

/* Actions sit at the end of the row and stay out of the way until approached —
   a rename pencil and a delete bin beside every file is a threatening list. */
.board-files-actions {
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0; margin-left: 6px;
  opacity: 0; transition: opacity .1s;
}
.board-files-row:hover .board-files-actions,
.board-files-actions:focus-within { opacity: 1; }
/* Touch has no hover, so there is nothing to reveal them with — always on. */
@media (hover: none) { .board-files-actions { opacity: 1; } }

.board-files-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-tertiary);
  font-size: 13px; cursor: pointer; list-style: none;
}
.board-files-btn::-webkit-details-marker { display: none; }
.board-files-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.board-files-danger:hover { background: #fee2e2; color: #dc2626; }
.board-files-del-form { display: flex; }

/* Rename and New folder share one popover shape. position:fixed is placed by
   popover.js, so the panel's own scroll cannot clip it. */
.board-files-menu-body {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 210px; padding: 10px;
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}
.board-files-menu-body label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-tertiary);
}
.board-files-menu-body input[type="text"] {
  width: 100%; padding: 6px 8px; font-size: 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
}

.board-files-tools {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--border-subtle);
}
.board-files-tools .board-files-upload {
  display: flex; align-items: center; gap: 6px; margin: 0;
  flex: 1; min-width: 200px;
}

/* Visually hidden, still read aloud. Not display:none, which removes it from the
   accessibility tree along with everything else. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── The library, as a columned grid ───────────────────────────────────────
   Laid out like SharePoint's own All Documents view — Name, Modified, Modified
   By — so the panel and the library it mirrors read the same way round. */
.board-files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.board-files-table thead th {
  padding: 5px 8px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-md);
  white-space: nowrap;
}
.board-files-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.board-files-table tbody tr:last-child td { border-bottom: 0; }
.board-files-table tbody tr:hover { background: var(--bg-subtle); }

/* Fixed layout with the three narrow columns sized explicitly, so Name takes
   whatever is left and a long filename truncates inside it.
   Auto layout cannot do this: the column width is then derived from the content,
   so one long filename widens the table past the panel — and the usual
   "width:100% + max-width:0" trick for that collapses the body cells to nothing
   the moment the table itself has a constrained width. Fixed layout is the only
   version of this that behaves the same at every panel width. */
.board-files-table { table-layout: fixed; }
.board-files-table .bft-name { width: auto; }
.board-files-table .bft-when { width: 96px; }
.board-files-table .bft-who { width: 180px; }
.board-files-table .bft-act { width: 56px; padding-left: 0; }

/* The ellipsis lives on the link, which is the element holding the text — the
   icon beside it must not be clipped with it.
   The cell stays display:table-cell: making it a flex container would take it
   out of the table layout and the columns would stop lining up. With fixed
   layout the cell has a real resolved width, so the link's percentage max-width
   resolves against something — which is exactly what it could not do while the
   cell was max-width:0. */
.board-files-table .bft-name { white-space: nowrap; }
.board-files-table .bft-name .board-files-name {
  display: inline-block; vertical-align: middle;
  max-width: calc(100% - 26px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.bft-name .board-files-icon { margin-right: 7px; font-size: 15px; vertical-align: -2px; }
/* SharePoint's folders are gold; ours were the same grey as a file, which made a
   column of folders and files one undifferentiated list. */
.bft-name .board-files-icon.is-folder { color: #eab308; }

.bft-name .board-files-name {
  color: var(--text-primary); text-decoration: none;
}
.bft-name .board-files-name:hover { color: var(--accent); text-decoration: underline; }

.bft-when { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* The person chip from the screenshot: a name on a soft pill, so a column of
   them reads as one kind of thing rather than as more body text. */
.bft-person {
  display: inline-block;
  max-width: 190px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}

/* The panel can be narrower than four columns deserve. Modified By is the first
   to go: it is the least often the question, and the name is still in the row's
   tooltip in SharePoint itself. */
@media (max-width: 720px) {
  .board-files-table .bft-who { display: none; }
}

/* ── Topbar density ───────────────────────────────────────────────────────────
   The strip is a fixed 56px, so anything that wraps to a second line is clipped
   or bulges the row. A board carries the most of anything in here, and it used
   to carry far more: eight grouping chips, a keyword box, Filters, New Task,
   Edit and All boards, with "New Task" and "All boards" breaking across two
   lines at ordinary laptop widths. Five tabs, two menus, a switch and two
   actions fit where thirteen chips and four buttons did not — but nothing in
   here wraps even so; it gives way in the order below. */
.btn, .group-toggle-btn, .bf-toggle, .groupmenu-trigger { white-space: nowrap; }

/* 1 · The keyword box yields first, before anything loses a word. It was a hard
   210px floor, which is what pushed the row over the edge in the first place. */
.bf-search { min-width: 0; flex: 0 1 200px; }

/* 2 · Then the grouping menu drops its value and runs on the icon alone. The
   chosen grouping is still in the tooltip, and the menu itself still names it. */
@media (max-width: 1280px) {
  .groupmenu-value { display: none; }
  .groupmenu-trigger { padding: 6px 8px; }
}

/* 3 · Then Filters drops its word and keeps the funnel. The count badge stays:
   that is the part of it people actually read. */
@media (max-width: 1100px) {
  .topbar-right .btn-ghost span { display: none; }
  .topbar-right .btn-ghost { padding: 5px 8px; }
}

/* 4 · Last, the view tabs drop their labels. The board's name keeps its menu and
   New Task keeps its word — those are the two things people come here to press,
   and an icon-only New Task is a plus sign that could mean anything. Each tab
   keeps its title, and the tab strip scrolls within itself below this. */
@media (max-width: 920px) {
  .viewtab span { display: none; }
  .viewtab { padding: 0 10px; }
}

/* ── The Completed panel says what it holds ───────────────────────────────────
   These panels carry a WINDOW, not every record the board has ever closed — see
   GetBoardDetailQueryHandler.CompletedWindowDays. A column reading "Completed
   tasks 2" beside a grid showing eleven of them looks like records going missing,
   which is how it was reported. The label states the rule; the link says where
   the rest is. */
.done-window {
  font-size: 10.5px; font-weight: 400;
  color: var(--text-tertiary);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.done-more {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 2px; padding: 5px 2px;
  font-size: 11.5px; color: var(--text-secondary);
}
.done-more:hover { color: var(--accent); text-decoration: none; }

/* ── Sortable and resizable columns ───────────────────────────────────────────
   Shared by every grid: the record tables, the card grid (.mt-table) and the
   admin and report tables. Driven by wwwroot/js/grid-tools.js, which decides per
   grid whether sorting is safe to do in the browser — All Tasks is paged, so it
   sorts on the server and takes only the resizing from here. */

/* The header cell becomes the positioning context for its resize handle. */
.grid thead th.has-resizer,
.admin-table th.has-resizer,
.report-table th.has-resizer,
.mt-thead .mt-td.has-resizer { position: relative; }

/* The whole header label is the sort control, so the target is the width of the
   column rather than a word inside it. */
.grid-sortbtn {
  display: inline-flex; align-items: center; gap: 5px;
  /* The cell already pads; the button fills it so the hit area is the cell. */
  margin: -2px -4px; padding: 2px 4px;
  width: calc(100% + 8px);
  border: 0; border-radius: 5px;
  background: none; cursor: pointer;
  font: inherit; color: inherit;
  letter-spacing: inherit; text-transform: inherit; text-align: inherit;
}
.grid-sortbtn:hover { color: var(--accent); background: var(--bg-hover); }
.grid-sortbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
/* The numeric columns are right-aligned, so their control has to be too, or the
   label detaches from the figures underneath it. */
.num > .grid-sortbtn { justify-content: flex-end; }

/* Dim until the column is sorted or hovered: twelve arrows at full strength read
   as decoration and stop saying anything about which column is in force. */
.grid-sortbtn [data-sort-icon] {
  font-size: 13px;
  opacity: 0;
  flex-shrink: 0;
  transition: opacity .12s;
}
.grid-sortbtn:hover [data-sort-icon],
.grid-sortbtn:focus-visible [data-sort-icon] { opacity: .55; }
th.is-sorted .grid-sortbtn,
.mt-td.is-sorted .grid-sortbtn { color: var(--accent); }
th.is-sorted .grid-sortbtn [data-sort-icon],
.mt-td.is-sorted .grid-sortbtn [data-sort-icon] { opacity: 1; }

/* The resize handle. Invisible until the header is hovered, because a column rule
   on every boundary is a lot of furniture for something used occasionally. */
.grid-resizer {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 7px; padding: 0;
  border: 0; background: none;
  cursor: col-resize;
  /* Above the sort button, which fills the cell. */
  z-index: 2;
  /* Touch: the browser must not claim the gesture as a scroll before the drag
     starts, or the handle only works with a mouse. */
  touch-action: none;
}
.grid-resizer::after {
  content: "";
  position: absolute;
  top: 20%; bottom: 20%; left: 3px;
  width: 1px;
  background: var(--border-strong);
  opacity: 0;
  transition: opacity .12s;
}
th:hover > .grid-resizer::after,
.mt-td:hover > .grid-resizer::after,
.grid-resizer:hover::after { opacity: 1; }
.grid-resizer:focus-visible::after { opacity: 1; background: var(--accent); width: 2px; }
.grid-resizer:focus-visible { outline: none; }

/* Dragging: the pointer owns the gesture, so nothing under it should highlight as
   if it were being selected or clicked. */
.is-resizing { user-select: none; cursor: col-resize; }
.is-resizing .mt-tr:hover,
.is-resizing tbody tr:hover { background: inherit; }

/* A resized table is wider than its container by design, so every grid that can be
   resized needs a scroller. .grid-scroll and .report-table-wrap already had one. */
.admin-table-wrap { overflow-x: auto; }

/* The card grid is a CSS grid, not a table: the track list lives in --mt-cols and
   grid-tools.js rewrites it. minmax() tracks collapse below their minimum when the
   total exceeds the container, so the grid itself has to be allowed to overflow. */
.mt-wrap--grid .mt-table { overflow-x: auto; }

/* ── Hiding the left menu ─────────────────────────────────────────────────────
   Three states, set on <html> — see wwwroot/js/nav-toggle.js. No attribute means
   the media queries decide, which is why "shown" has to be storable separately
   from having made no choice: on a phone the two differ. */
html[data-nav="hidden"] .sidebar { display: none; }

.shell-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  flex-shrink: 0;
  /* Pulled left into the topbar's own padding so the icon lines up with the page
     content below it rather than sitting a button's worth further in. */
  margin-left: -6px;
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-tertiary);
  cursor: pointer;
}
.shell-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.shell-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shell-toggle i { font-size: 19px; }

/* Only ever visible when the menu is over the page, which is a phone. */
.nav-scrim {
  position: fixed; inset: 0;
  z-index: 69;
  background: rgba(17, 24, 39, 0.42);
}
.nav-scrim[hidden] { display: none; }

@media (max-width: 640px) {
  /* Asked for explicitly on a screen too narrow to give it a column: it opens over
     the page instead. Before this the menu was display:none here with nothing
     anywhere to open it, so a phone had no navigation at all. */
  html[data-nav="shown"] .sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 244px;
    z-index: 70;
    box-shadow: var(--shadow-lg);
  }
}
