/* ============================================================
   polish.css — production polish layer
   Loaded after styles.css. Adds:
   - tuned easing curves + motion tokens
   - micro-interactions (hover, press, focus)
   - view-switch + panel-enter animations
   - drag affordances
   - responsive scaling (tablet → phone)
   - a11y focus rings, reduced-motion fallback
   ============================================================ */

:root {
  /* Gentler easings — less abrupt entrance, no overshoot by default. */
  --ease-out: cubic-bezier(0.33, 0.65, 0.4, 1);
  --ease-out-soft: cubic-bezier(0.4, 0.5, 0.25, 1);
  --ease-spring: cubic-bezier(0.4, 0.8, 0.4, 1);
  --ease-in: cubic-bezier(0.55, 0.05, 0.7, 0.35);
  /* Durations: tuned 30% faster than the previous gentle settings. */
  --d-1: 110ms;
  --d-2: 195ms;
  --d-3: 295ms;
  --d-4: 420ms;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg);
  /* Shadows: ~50% lighter than the previous values for subtler depth. */
  --shadow-pop: 0 1px 1px rgba(0,0,0,0.09), 0 4px 12px rgba(0,0,0,0.11);
  --shadow-pop-lg: 0 1px 2px rgba(0,0,0,0.10), 0 9px 24px rgba(0,0,0,0.16);
}

/* Global smoothing for chrome elements that previously had no transition. */
.iconbtn,
/* Topbar buttons never wrap their labels. */
.view-toggle button,
.iconbtn,
.user-pill { white-space: nowrap; }
.view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.view-toggle .vt-icon { flex-shrink: 0; }
.view-toggle .vt-label { white-space: nowrap; }

.view-toggle button,
.chip,
.subtabs button,
.mcs-trigger,
.fb-nav button,
.tb-section button,
.s-tabs button {
  transition:
    background var(--d-1) var(--ease-out),
    border-color var(--d-1) var(--ease-out),
    color var(--d-1) var(--ease-out),
    transform var(--d-1) var(--ease-out),
    box-shadow var(--d-1) var(--ease-out);
}

/* Press feedback — barely-there nudge */
.iconbtn:active,
.view-toggle button:active,
.fb-nav button:active,
.subtabs button:active {
  transform: translateY(0.5px);
}

/* Crisp focus rings (keyboard) */
.iconbtn:focus-visible,
.view-toggle button:focus-visible,
.subtabs button:focus-visible,
.chip:focus-visible,
.search:focus-visible,
.s-tabs button:focus-visible,
.fb-nav button:focus-visible,
.mcs-trigger:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 4px;
}

/* ---------- App boot fade ---------- */
@keyframes app-boot {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: none; }
}
.app { animation: app-boot var(--d-4) var(--ease-out-soft) both; }

/* ---------- View switching ---------- */
@keyframes view-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.canvas > .month,
.canvas > .week,
.canvas > .week-v2,
.canvas > .lanes,
.canvas > .timeline,
.canvas > .tbl,
.canvas > .table-wrap {
  animation: view-in var(--d-3) var(--ease-out-soft) both;
}

/* ---------- Sub-tabs underline glide ---------- */
.subtabs { position: relative; }
.subtabs button { position: relative; }
.subtabs button.on::after,
.subtabs button[aria-current="page"]::after {
  transition: transform var(--d-2) var(--ease-out-soft),
              width var(--d-2) var(--ease-out-soft);
}

/* ---------- Sync pulse refinement ---------- */
.synced .pip {
  animation: sync-pulse 3.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 currentColor;
}
@keyframes sync-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(55, 183, 124, 0.30); opacity: 1; }
  60%  { box-shadow: 0 0 0 5px rgba(55, 183, 124, 0); opacity: 0.7; }
  100% { box-shadow: 0 0 0 0 rgba(55, 183, 124, 0); opacity: 1; }
}

/* ---------- Month grid: cells & pills ---------- */
.month-cell {
  transition:
    background var(--d-2) var(--ease-out),
    box-shadow var(--d-2) var(--ease-out);
}
.month-cell:hover { background: color-mix(in srgb, var(--bg-1) 70%, transparent); }
.month-cell.drop-target {
  background: color-mix(in srgb, var(--accent, #37B77C) 14%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--accent, #37B77C);
  animation: drop-glow var(--d-3) var(--ease-out) both;
}
@keyframes drop-glow {
  from { box-shadow: inset 0 0 0 0 var(--accent, #37B77C); }
  to   { box-shadow: inset 0 0 0 1px var(--accent, #37B77C); }
}

.quick-add {
  transition:
    opacity var(--d-3) var(--ease-out-soft),
    transform var(--d-3) var(--ease-out-soft);
  transform: scale(0.92);
}
.month-cell:hover .quick-add { transform: scale(1); }

.pill,
.span-bar,
.wevent {
  transition:
    transform var(--d-1) var(--ease-out),
    background var(--d-2) var(--ease-out),
    border-color var(--d-2) var(--ease-out),
    box-shadow var(--d-2) var(--ease-out),
    opacity var(--d-2) var(--ease-out);
  will-change: transform;
}
.pill:hover,
.span-bar:hover,
.wevent:hover {
  transform: translateY(-0.5px);
  box-shadow: var(--shadow-pop);
  z-index: 5;
}
.pill:active,
.span-bar:active,
.wevent:active { transform: none; }

@keyframes pill-in {
  from { opacity: 0; transform: translateY(-1px); }
  to   { opacity: 1; transform: none; }
}
.pill, .span-bar, .wevent {
  animation: pill-in var(--d-3) var(--ease-out-soft) both;
}

/* Drag-into-target visual cue: when another event is hovered over this
   bar during a drag, highlight it as a nest target. */
.span-bar.drop-nest-target,
.pill.drop-nest-target,
.wevent.drop-nest-target,
.week-span-bar.drop-nest-target,
.lane-bar.drop-nest-target,
.tl-bar.drop-nest-target {
  box-shadow:
    inset 0 0 0 2px var(--accent, #37B77C),
    0 0 0 1px color-mix(in srgb, var(--accent, #37B77C) 30%, transparent);
  background: color-mix(in srgb, var(--accent, #37B77C) 12%, var(--bg-2));
}

/* Drag affordances */
.pill, .span-bar, .wevent,
.week-span-bar, .lane-bar, .tl-bar,
.subpill { cursor: grab; }
.pill:active, .span-bar:active, .wevent:active,
.week-span-bar:active, .lane-bar:active, .tl-bar:active,
.subpill:active { cursor: grabbing; }
.pill.dragging,
.span-bar.dragging,
.wevent.dragging,
.week-span-bar.dragging,
.lane-bar.dragging,
.tl-bar.dragging,
.subpill.dragging {
  opacity: 0.35;
  transform: scale(0.98) rotate(-0.4deg);
  box-shadow: var(--shadow-pop-lg);
  transition: none;
}

/* Cell drop-target visual cue — week / lanes / timeline parity with
   month-cell.drop-target. Same green tint + inset border + grow-in. */
.week-v2 .wcol.drop-target,
.lane .lane-canvas .lcol.drop-target,
.tl-row .track .tl-col.drop-target {
  background: color-mix(in srgb, var(--accent, #37B77C) 14%, var(--bg)) !important;
  box-shadow: inset 0 0 0 1px var(--accent, #37B77C);
  animation: drop-glow var(--d-3) var(--ease-out) both;
}
/* Timeline track has no per-day cells — when a sub-task is being dragged
   over the track, paint a virtual column highlight at the cursor's day
   index. Rendered as a positioned overlay div from the JSX. */
.tl-row .track .track-drop-col {
  position: absolute;
  top: 0; bottom: 0;
  background: color-mix(in srgb, var(--accent, #37B77C) 12%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent, #37B77C);
  pointer-events: none;
  z-index: 1;
  animation: drop-glow var(--d-3) var(--ease-out) both;
}

/* Past-due gentle attention — slow ambient glow */
.pill.past-due {
  animation: pill-in var(--d-3) var(--ease-out-soft) both,
             past-due-glow 6s ease-in-out infinite;
}
@keyframes past-due-glow {
  0%, 100% { box-shadow: inset 2px 0 0 var(--danger, #E25C5C); }
  50%      { box-shadow: inset 2px 0 0 var(--danger, #E25C5C),
                         0 0 0 1px color-mix(in srgb, var(--danger, #E25C5C) 20%, transparent); }
}

/* ---------- Detail / Settings panel slide-in ----------
   We animate the panel's *width* from 0 → 460px (and back on close) so
   that the canvas reflows in lockstep with the slide. The inner content
   is held at its natural 460px via `min-width`, so the slide hides it
   under the overflow boundary instead of squishing the layout. */
.detail,
.settings {
  overflow: hidden;
  min-width: 0;
  box-shadow: -12px 0 32px -22px rgba(0,0,0,0.22);
  animation: panel-in var(--d-4) var(--ease-out-soft) both;
}
.detail > *,
.settings > * { min-width: 460px; }

@keyframes panel-in {
  from { width: 0;     opacity: 0; }
  to   { width: 460px; opacity: 1; }
}
@keyframes panel-out {
  from { width: 460px; opacity: 1; }
  to   { width: 0;     opacity: 0; }
}
.detail.is-leaving,
.settings.is-leaving {
  animation: panel-out var(--d-4) var(--ease-out-soft) both;
}

/* Canvas reflow: the parent .main uses flex, and .canvas has flex:1, so
   the canvas naturally grows/shrinks as the panel width changes — no
   explicit transition needed on the canvas itself. */

/* Smooth scroll inside the detail body */
.detail .dt-body,
.settings .s-body { scroll-behavior: smooth; }

/* ---------- Hover-card pop ---------- */
@keyframes hover-pop {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: none; }
}
.hover-card,
[data-hover-card] {
  animation: hover-pop var(--d-3) var(--ease-out-soft) both;
  box-shadow: var(--shadow-pop);
}

/* ---------- Popovers / Selects ---------- */
.popover,
.mcs-popover {
  animation: hover-pop var(--d-3) var(--ease-out-soft) both;
  box-shadow: var(--shadow-pop-lg);
  transform-origin: top left;
}
.mcs-item { transition: background var(--d-1) var(--ease-out); }
/* Color-by control sits on the far right edge — flip the popover so it
   never clips against the viewport. */
.color-by .mcal-select .mcs-popover {
  left: auto;
  right: 0;
  transform-origin: top right;
}

/* Channel lanes bars hide their internal overflow to clip the title, but
   that also clips the past-due "!" badge that sits at top:-7px / left:-7px.
   Let the badge overflow while keeping inner text clipped via its own
   wrapper, which already has its own overflow rules. */
.lane-bar { overflow: visible; }
.lane-bar > * { min-width: 0; }
.lane-bar .lb-title,
.lane-bar .ptitle,
.lane-bar .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Search input focus glow ---------- */
.search {
  transition: border-color var(--d-2) var(--ease-out),
              box-shadow var(--d-2) var(--ease-out),
              background var(--d-2) var(--ease-out);
}
.search:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 12%, transparent);
}

/* ---------- Stage chips: smooth fill transitions ---------- */
.pill .stages i { transition: background var(--d-2) var(--ease-out),
                              border-color var(--d-2) var(--ease-out),
                              transform var(--d-2) var(--ease-spring); }
.pill .stages i.on { transform: scale(1.05); }

/* ---------- Table view ---------- */
.dt-row,
.tbl tr,
.table-wrap tr {
  transition: background var(--d-1) var(--ease-out);
}
.dt-row:hover,
.tbl tbody tr:hover,
.table-wrap tbody tr:hover {
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}

/* Sticky table head when present */
.tbl thead th,
.table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--panel, var(--bg));
  z-index: 2;
}

/* ---------- Loading shimmer ---------- */
.empty-state {
  position: relative;
  overflow: hidden;
}
.empty-state::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--fg) 5%, transparent) 50%,
    transparent 100%
  );
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ---------- Settings drawer tabs underline glide ---------- */
.settings .s-tabs button { transition: color var(--d-1) var(--ease-out); }
.settings .s-tabs button.on::after {
  transition: width var(--d-2) var(--ease-out-soft),
              transform var(--d-2) var(--ease-out-soft);
}

/* ---------- Scrollbars (subtle, themed) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent; }
.canvas::-webkit-scrollbar,
.detail ::-webkit-scrollbar,
.settings ::-webkit-scrollbar,
.dt-body::-webkit-scrollbar { width: 10px; height: 10px; }
.canvas::-webkit-scrollbar-thumb,
.detail ::-webkit-scrollbar-thumb,
.settings ::-webkit-scrollbar-thumb,
.dt-body::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.canvas::-webkit-scrollbar-thumb:hover { background: var(--fg-3); background-clip: padding-box; border: 2px solid transparent; }

/* ============================================================
   Responsive scaling
   The prototype used a fixed width=1440 viewport. Below we let
   the dashboard breathe down to a phone. Calendar grid stays
   strong on desktop; week/lanes/timeline switch to horizontal
   scroll instead of overflow-clipping on smaller screens.
   ============================================================ */

/* Make panels overlay instead of split the canvas under 1100px. */
@media (max-width: 1199px) {
  .main { position: relative; }
  .detail,
  .settings {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(460px, 92vw);
    z-index: 50;
  }
  .canvas { width: 100%; }
}

@media (max-width: 1023px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .filterbar { flex-wrap: wrap; gap: 6px 8px; padding: 8px 12px; }
  .fb-nav { order: -1; }
  .subtabs { overflow-x: auto; }
  .subtabs::-webkit-scrollbar { display: none; }

  /* Calendar widths */
  .week,
  .lanes,
  .timeline { overflow-x: auto; }
  .week { min-width: 920px; }
  .lanes { min-width: 1040px; }
  .timeline { min-width: 1100px; }
}

/* ============================================================
   Mobile (<=767px) — view-first.
   The dashboard's primary mobile use case is "what's happening
   this month?" — not editing or filtering. We collapse the chrome
   so as much vertical space as possible goes to the calendar:
     · single-row topbar (logo + view toggle + theme + new)
     · filterbar reduced to nav + Today + Holidays toggle
     · no filter chips (channel/owner/category/product/stage)
     · no color-by / lanes / timeline group selectors
     · no sub-tab counts; sub-tab labels stay scrollable
     · brand subtitle, sync indicator, search hidden
     · panels (detail / settings) fill the screen
   ============================================================ */
@media (max-width: 767px) {
  :root { font-size: 14px; }

  /* — Topbar: collapse to essentials so everything fits on iPhone 16
     (393px viewport) without horizontal scroll. Safe-area insets push
     content below the dynamic island / notch and away from any rounded
     screen edges in landscape. iOS Safari sometimes computes the inset
     late (the "zoom in/zoom out fixes it" symptom) — the explicit env()
     padding here is applied from first paint so the initial landing
     respects the island. — */
  .topbar {
    height: calc(46px + env(safe-area-inset-top));
    min-height: calc(46px + env(safe-area-inset-top));
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-right: calc(8px + env(safe-area-inset-right));
    padding-bottom: 6px;
    padding-left: calc(8px + env(safe-area-inset-left));
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  /* Mobile: ditch the brand entirely so settings + add-task + profile
     all fit on the right side of the topbar. */
  .brand { display: none; }
  /* Without the brand on the left, the leading grow spacer was the
     only thing pushing the view-toggle into the centre. Drop it so
     Calendar / My Tasks / Table align flush-left, and push the icon
     cluster to the right edge via auto margin. */
  .topbar .tb-section.grow { display: none; }
  .topbar > .tb-section:last-child { margin-left: auto; }
  .tb-section { padding: 0 3px; border-right: none; }
  .tb-section.grow { flex: 1; min-width: 0; }
  /* Hide the dedicated synced section — keep storage running silently. */
  .topbar .tb-section .synced { display: none; }
  /* Mobile keeps the theme toggle (commonly toggled on the go) and
     drops the Settings icon (mostly used on desktop for roster mgmt). */
  .topbar .iconbtn[title="Settings"] { display: none; }

  /* View toggle: text-only on mobile (icons hidden) so the labels
     "Calendar / My Tasks / Table" remain legible alongside the
     utility icons. The brand is hidden above, which frees the
     horizontal room needed. */
  .view-toggle { height: 28px; flex-shrink: 0; }
  .view-toggle .vt-icon { display: none; }
  .view-toggle .vt-label { display: inline; }
  .view-toggle button {
    padding: 0 8px;
    font-size: 10px;
    min-width: 0;
    letter-spacing: 0.02em;
    gap: 0;
  }
  .iconbtn { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
  .user-pill-wrap { margin-left: 2px; height: 28px; }
  .user-pill { width: 28px; height: 28px; }

  /* — Sub-tabs: hide per-mode counts — */
  .subtabs { padding: 0 8px; }
  .subtabs button { font-size: 11px; padding: 8px 8px; }
  .subtabs button .count { display: none; }

  /* — Filter bar: keep nav + search + holidays only — */
  .filterbar {
    padding: 6px 8px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .filterbar::-webkit-scrollbar { display: none; }
  .filterbar .fb-nav { gap: 2px; flex-shrink: 0; }
  .filterbar .fb-nav .label { font-size: 11px; }
  .filterbar .fb-divider { display: none; }

  /* Hide chip-style filters and the color-by + lane/timeline groupers. */
  .filterbar .fc-wrap,
  .filterbar .color-by { display: none; }

  /* Hide search input on mobile to free space — users can open the detail
     panel for any event they need to look at. */
  .filterbar .search { display: none; }

  /* Hide the Holidays chip on mobile — toggle from desktop. */
  .filterbar .chip-wrap { display: none; }

  /* — Fortnight (2-week) grid on mobile: fit entirely in the visible
     canvas — no vertical scroll. Switch to flex distribution so each
     row claims half the available height, overriding the JS-set
     inline min-height that was sized for desktop. Per-row overflow
     hides any pills that don't fit so they don't bleed into the
     adjacent row. `!important` is required because the desktop
     `.month.is-fortnight` rule appears later in the stylesheet (same
     specificity → source-order wins on a mobile viewport without the
     !important). */
  .month.is-fortnight {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
  }
  .month.is-fortnight .month-dows { flex: 0 0 auto; }
  .month.is-fortnight .month-row {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* — Month grid: denser cells, smaller pills — */
  .month-dows .dow { font-size: 9px; padding: 6px 4px; }
  .month-cell { min-height: 80px; padding: 4px; }
  .month-cell .daynum-wrap { margin-bottom: 2px; }
  .month-cell .daynum { font-size: 10.5px; }
  .month-cell .quick-add { display: none; }
  .pill { padding: 2px 4px; min-height: 16px; }
  .pill .ptag,
  .pill .stages,
  .pill > .more-link { display: none; }
  .pill .ptitle { font-size: 11px; }
  .span-bar { padding: 2px 4px; }
  .span-bar .ptag { display: none; }

  /* — Panels overlay fullscreen — */
  .detail, .settings { width: 100vw; }
  .detail > *, .settings > * { min-width: 100vw; }
  @keyframes panel-in {
    from { width: 0;     opacity: 0; }
    to   { width: 100vw; opacity: 1; }
  }
  @keyframes panel-out {
    from { width: 100vw; opacity: 1; }
    to   { width: 0;     opacity: 0; }
  }
}

@media (max-width: 519px) {
  /* Phone: even tighter cells, hide lanes/timeline sub-tabs since they're
     impractical at this width. The calendar-grid views (Month / 2 Weeks /
     Week) stay reachable via the .subtab-dd picker. */
  .subtabs button[data-mode="lanes"],
  .subtabs button[data-mode="timeline"] { display: none; }

  .month-row { grid-auto-rows: minmax(60px, 1fr); }
  .month-cell { min-height: 60px; padding: 3px; }
  .month-dows .dow { font-size: 8.5px; padding: 4px 2px; }
  .pillstack { gap: 2px; }
  .pill { padding: 1px 4px; font-size: 10.5px; }
  .pill .ptitle { font-size: 10.5px; }

  /* Compress filter chip text + view toggle label on very small screens. */
  .filterbar .chip .key { display: none; }
  .filterbar .today-btn { padding: 0 8px; font-size: 10px; }
  .filterbar .fb-nav .label { font-size: 10px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
}

/* ============================================================
   Auth screen + user pill
   ============================================================ */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(60vw 60vw at 20% 20%, rgba(55,183,124,0.06), transparent 70%),
    radial-gradient(50vw 50vw at 80% 80%, rgba(247,81,155,0.05), transparent 70%),
    var(--bg);
  z-index: 100;
  animation: app-boot var(--d-4) var(--ease-out-soft) both;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel, var(--bg-1));
  border: 1px solid var(--border);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.auth-logo {
  height: 28px;
  width: auto;
  margin-bottom: 4px;
  filter: invert(1);
}
[data-theme="light"] .auth-logo { filter: none; }
.auth-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  color: var(--fg);
}
.auth-sub {
  font-size: 12.5px;
  color: var(--fg-2);
  margin: 0 0 12px;
  line-height: 1.5;
}
.auth-sub code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg);
}
.auth-gbtn {
  margin: 4px 0 8px;
  min-height: 40px;
  display: flex;
  justify-content: center;
}
.auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 0 18px;
  height: 42px;
  width: 280px;
  background: #131314;
  color: #fff;
  border: 1px solid #3c4043;
  font-family: 'Roboto', 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.auth-google-btn:hover { background: #1f2023; border-color: #5f6368; }
.auth-google-btn:active { background: #0e0e0f; }
[data-theme="light"] .auth-google-btn { background: #fff; color: #1f1f1f; border-color: #dadce0; }
[data-theme="light"] .auth-google-btn:hover { background: #f8f9fa; border-color: #c4c7c5; }
.auth-loading {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.auth-error {
  margin-top: 8px;
  width: 100%;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--danger, #E25C5C) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger, #E25C5C) 30%, transparent);
  color: var(--fg);
  font-size: 12px;
  text-align: left;
  border-radius: 3px;
}
.auth-foot {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.auth-setup {
  margin-top: 4px;
  padding: 14px;
  width: 100%;
  background: var(--bg-2);
  border: 1px dashed var(--border-strong, var(--border));
  text-align: left;
  font-size: 12px;
}
.auth-setup-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.auth-setup pre {
  background: var(--bg);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: pre;
  overflow-x: auto;
  margin: 6px 0;
  border: 1px solid var(--border);
}
.auth-setup-hint { color: var(--fg-3); font-size: 11px; line-height: 1.45; margin: 8px 0 0; }
.auth-setup-hint a { color: var(--accent, #37B77C); }

/* User pill in topbar */
.user-pill-wrap {
  display: inline-flex;
  align-items: center;
  align-self: center;
  margin-left: 4px;
  height: 30px;
  position: relative;
}
.user-pill {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  transition: border-color var(--d-1) var(--ease-out), transform var(--d-1) var(--ease-out);
}
.user-pill:hover { border-color: var(--fg-3); }
.user-pill img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-initials {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg);
}
.user-pop {
  position: absolute;
  top: calc(100% + 6px);
  /* Override the .popover { left: 0 } default — anchor to the right edge so
     the popover never clips off the viewport on the far-right of the topbar. */
  left: auto !important;
  right: 0;
  min-width: 240px;
  max-width: calc(100vw - 16px);
  background: var(--surface, var(--bg-1));
  border: 1px solid var(--border-strong, var(--border));
  z-index: 100;
  padding: 4px;
  box-shadow: var(--shadow-pop-lg);
}
.user-pop-head { padding: 10px 12px 8px; }
.user-pop-name { font-size: 13px; font-weight: 700; color: var(--fg); }
.user-pop-email {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  word-break: break-all;
}

/* ============================================================
   Mobile: disable hover-card behavior (touch ≠ hover)
   ============================================================ */
@media (hover: none), (pointer: coarse), (max-width: 767px) {
  .hover-card { display: none !important; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .synced .pip { animation: none; }
}

/* ---------- High-DPI typography crispness ---------- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Selection ---------- */
::selection {
  background: color-mix(in srgb, var(--accent, #37B77C) 35%, transparent);
  color: var(--fg);
}

/* ============================================================
   Sub-task inline editor (expanded row)
   ============================================================ */
.subtask-row .st-editor {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  animation: subtask-row-in var(--d-3) var(--ease-out-soft) both;
}
.subtask-row .st-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}
@media (max-width: 767px) {
  .subtask-row .st-editor-grid { grid-template-columns: 1fr; }
  .subtask-row .st-summary { grid-template-columns: auto auto 1fr auto auto; }
  .subtask-row .st-summary .st-date { grid-column: 2 / span 2; }
}
.subtask-row .st-field {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 28px;
}
.subtask-row .st-field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.subtask-row .st-field.is-override .st-field-label { color: var(--fg); }
.subtask-row .st-inherit {
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--fg-4);
  border: 1px dashed var(--border);
  padding: 1px 4px;
  border-radius: 2px;
}
.subtask-row .st-reset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-3);
  width: 18px; height: 18px;
  padding: 0;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--d-1) var(--ease-out), color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out), transform var(--d-1) var(--ease-out);
}
.subtask-row .st-reset:hover { color: var(--fg); border-color: var(--fg-3); transform: rotate(-90deg); }
.subtask-row .st-editor-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}
.subtask-row .st-editor-row.column { grid-template-columns: 1fr; gap: 4px; }
.subtask-row .st-editor-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding-top: 6px;
}
.subtask-row .stage-rail.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.subtask-row .stage-rail.compact .stp {
  font-size: 10px;
  padding: 4px 8px;
}
.subtask-row .dt-textarea { min-height: 56px; }
.subtask-row .dt-input,
.subtask-row .dt-textarea {
  width: 100%;
}
.dt-section--compact { padding: 0; border-top: none; }
.dt-section--compact .media-zone { padding: 8px; }
.media-zone.compact { background: transparent; }

/* ============================================================
   UI audit: spacing / centering / scaling fixes
   ============================================================ */

/* Topbar already uses align-items:stretch + .tb-section.grow flex:1 for
   layout — no override needed. We only add a wrap behavior at small
   viewports (handled in the responsive section above). */

/* View toggle: equal-width buttons, baseline-aligned text */
.view-toggle { display: inline-flex; align-items: stretch; }
.view-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 84px;
  line-height: 1;
}

/* Sub-tabs: equal vertical rhythm, centered text */
.subtabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

/* Filter bar: vertically center every chip + control */
.filterbar { align-items: center; }
.filterbar .chip { display: inline-flex; align-items: center; gap: 6px; line-height: 1.1; }
.filterbar .fb-divider { align-self: center; height: 20px; }

/* Stabilize the date label so switching between "MAY 2026" /
   "MAY 24 — JUN 6" / "MAY 24 — MAY 30" doesn't shift everything to
   the right of fb-nav. */
.filterbar .fb-nav .label {
  min-width: 168px;
  text-align: center;
  display: inline-block;
}

/* Reserve a fixed slot for the Rows / Group selector in the color-by
   strip. Empty for Month / 2 Weeks / Week / Kanban; populated for
   Channels (Rows) and Timeline (Group). Either way the Color picker
   sits at the same x-position across every mode. */
.color-by-mode-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
}

/* Calendar cell numerals: nudge for crisp baseline */
.daynum-wrap { display: flex; align-items: center; justify-content: space-between; }
.daynum-wrap .daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  line-height: 1;
}
/* Off-month days + weekend cells (week + channels views): a faint
   translucent overlay so they read as "secondary" without losing data. */
[data-theme="light"] .month-cell.off,
[data-theme="light"] .wcol.weekend,
[data-theme="light"] .lane .lane-canvas .lcol.weekend,
[data-theme="light"] .lanes-axis .dayrow .d.weekend {
  background: linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)), var(--bg-1) !important;
}
[data-theme="dark"] .month-cell.off,
[data-theme="dark"] .wcol.weekend,
[data-theme="dark"] .lane .lane-canvas .lcol.weekend,
[data-theme="dark"] .lanes-axis .dayrow .d.weekend {
  background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)), var(--bg-1) !important;
}
/* Keep the date numbers fully visible on off-month cells — just slightly
   muted via color, not opacity. */
.month-cell.off .daynum {
  opacity: 1;
  color: var(--fg-3) !important;
}

/* Today cell: a stronger green wash on the whole cell. No badge — the
   tint alone is the "today" indicator. The daynum renders exactly like
   every other cell so it doesn't visually drop or shift. */
.month-cell.today,
.wcol.today,
.lane .lane-canvas .lcol.today {
  background: rgba(55, 183, 124, 0.16) !important;
}
.month-cell.today .daynum-wrap {
  /* Use the same default layout as every other cell — no extra height
     reservation or bottom margin. */
  min-height: 0;
  margin-bottom: 4px;
}
.month-cell.today .daynum-wrap .daynum {
  background: transparent !important;
  color: var(--fg) !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  display: inline-block !important;
  font-weight: 700;
  line-height: inherit;
}

/* Pills: tighter vertical rhythm */
.pill { display: flex; align-items: center; gap: 5px; line-height: 1.15; min-height: 18px; }
.pill .ptitle { display: inline-block; min-width: 0; }
.pill .stages { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.pill .stages i { display: inline-block; }

/* Detail panel: minor rhythm refinements, keeping the original layout intact. */
.dt-row { align-items: center; min-height: 30px; }

/* Stage chip vertical centering */
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

/* Settings drawer header tightening */
.settings .s-head { align-items: center; }

/* Empty state centering */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

/* SVG icons: ensure they don't push siblings off-baseline */
.iconbtn svg, .view-toggle button svg, .chip svg, .subtabs button svg {
  display: block;
  flex-shrink: 0;
}

/* Buttons: prevent layout shift on hover by reserving border space */
button { box-sizing: border-box; }

/* Inputs: consistent height and centering */
input.dt-input, input.search, textarea.dt-textarea {
  box-sizing: border-box;
}

/* Hover card alignment */
.hc-row { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.hc-row .hc-lbl { min-width: 64px; }

/* Table view: cells vertically centered, ellipsis safe */
.tbl td, .table-wrap td { vertical-align: middle; }
.tbl td.ellipsis, .table-wrap td.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quick-add popover anchoring */
.quick-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Lanes axis cells keep their existing stacked layout (ddow over date);
   no override needed. */

/* Universal box-sizing for layout stability */
*, *::before, *::after { box-sizing: border-box; }

/* ============================================================
   Notes display — auto-linked URLs, click to edit
   ============================================================ */
.notes-display {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg);
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid transparent;
  min-height: 48px;
  cursor: text;
  transition: border-color var(--d-1) var(--ease-out);
}
.notes-display:hover { border-color: var(--border); }
.notes-display.empty { color: var(--fg-4); font-style: italic; }
.notes-link {
  color: var(--accent, #37B77C);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent, #37B77C) 40%, transparent);
  padding-bottom: 1px;
  word-break: break-all;
  transition: color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.notes-link:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ============================================================
   Primary / Result link → MediaCard
   ============================================================ */
.link-card-wrap { margin-top: 8px; }

.media-card .mc-head-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  padding: 10px 12px;
  transition: background var(--d-1) var(--ease-out);
}
.media-card .mc-head-link:hover {
  background: color-mix(in srgb, var(--fg) 5%, transparent);
}
.media-card .mc-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--fg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.media-card .mc-head-link:hover .mc-open {
  color: var(--accent, #37B77C);
  border-color: var(--accent, #37B77C);
}

/* Compact variant for hover-cards: smaller, no preview body */
.media-card.compact { background: var(--bg-2); }
.media-card.compact .mc-head-link { padding: 8px 10px; gap: 8px; }
.media-card.compact .mc-icon { width: 24px; height: 24px; font-size: 11px; }
.media-card.compact .mc-title { font-size: 11.5px; }
.media-card.compact .mc-host { font-size: 9.5px; }
.media-card.compact .mc-open { width: 20px; height: 20px; }
.hc-cards { display: flex; flex-direction: column; gap: 6px; }

/* Date-range arrow — give it real horizontal breathing room so
   "MAY 19 → MAY 21" reads cleanly even in tight monospace headers. */
.dr-arrow {
  display: inline-block;
  margin: 0 0.5em;
  color: var(--fg-3);
}

/* ============================================================
   Week view v2 — span-bar layout (multi-day events stretch across
   the day columns they cover, like month / channels / timeline).
   ============================================================ */
.week-v2 {
  display: flex;
  flex-direction: column;
  height: 100%;
  --wev-h: 168px;  /* per-lane card height; lanes stack at this stride */
}
.week-v2 .week-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 4;
}
.week-v2 .whead {
  border-right: 1px solid var(--border);
  padding: 12px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.week-v2 .whead:last-child { border-right: none; }
.week-v2 .whead .wd {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.week-v2 .whead.today .wd { color: var(--accent, #37B77C); }
.week-v2 .whead .wn {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-top: 2px;
}
.week-v2 .whead.today .wn { color: var(--accent, #37B77C); }

.week-v2 .week-body {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  overflow-y: auto;
  min-height: 0;
}
/* Day-column backgrounds: occupy the grid; sub-tasks (single-day) live
   inside .wbody, stacked under the absolutely-positioned span cards. */
.week-v2 .wcol {
  border-right: 1px solid var(--border);
  position: relative;
  min-height: 100%;
}
.week-v2 .wcol:last-child { border-right: none; }
.week-v2 .wcol.today { background: rgba(55, 183, 124, 0.16); }
.week-v2 .wcol .wbody {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Push sub-tasks below the lanes reserved for span cards. The actual
     reservation lives in --week-lane-offset, computed via inline style or
     a CSS var bumped by JS in the future. Default: 0 (no spans). */
  margin-top: var(--week-lane-offset, 0px);
}

/* Thin spanning bars — month-view span-bar style. Sub-tasks live as
   separate pills below, NOT inside the bar. */
.week-v2 .week-body .week-span-bar {
  position: absolute;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--cat-products);
  padding: 4px 8px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  transition: background var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.week-v2 .week-body .week-span-bar:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}
/* TBD watermark — parity with .span-bar.tbd in month view. The diagonal
   stripe + centered "TBD" text overlay reads identically across views. */
.week-v2 .week-body .week-span-bar.tbd {
  background: repeating-linear-gradient(45deg,
    var(--bg-2) 0 6px,
    color-mix(in srgb, var(--danger) 26%, var(--bg-2)) 6px 12px);
}
[data-theme="light"] .week-v2 .week-body .week-span-bar.tbd {
  background: repeating-linear-gradient(45deg,
    #fff 0 6px,
    color-mix(in srgb, var(--danger) 18%, #fff) 6px 12px);
}
.week-v2 .week-span-bar .wsb-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--fg);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

/* Sub-pills below parent bars — match month view's .subpill exactly.
   The base .subpill in styles.css uses padding-left: 14px to make room
   for the ::before "↳" connector arrow at left: 4px. Preserve that here
   so the arrow doesn't overlap the title. */
.week-v2 .week-body .subpill.abs {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px 2px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left-width: 3px;
  font-size: 11px;
  color: var(--fg-2);
  cursor: pointer;
  z-index: 3;
  overflow: hidden;
  transition: background var(--d-1) var(--ease-out);
}
.week-v2 .week-body .subpill.abs:hover { background: var(--bg-3); }
.week-v2 .week-body .subpill.abs .stitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.week-v2 .week-body .subpill.abs.done {
  opacity: 0.5;
  text-decoration: line-through;
}

/* Sub-pills inside Channels (lanes) and Timeline tracks — match the
   base .subpill from styles.css so the ::before "↳" arrow has its 14px
   left-padding lane. */
.lane .lane-canvas .subpill.abs,
.tl-row .track .subpill.abs {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px 2px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left-width: 3px;
  font-size: 11px;
  color: var(--fg-2);
  cursor: pointer;
  z-index: 3;
  overflow: hidden;
  transition: background var(--d-1) var(--ease-out);
}
.lane .lane-canvas .subpill.abs:hover,
.tl-row .track .subpill.abs:hover { background: var(--bg-3); }
.lane .lane-canvas .subpill.abs .stitle,
.tl-row .track .subpill.abs .stitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lane .lane-canvas .subpill.abs.done,
.tl-row .track .subpill.abs.done { opacity: 0.5; text-decoration: line-through; }

/* Channels: 2× the original lane baseline so sub-pills fit comfortably
   under each parent bar. Inline minHeight bumps it further when multiple
   stacked lanes or tall sub-task stacks need more vertical room — so the
   rule must NOT use !important. */
.lane .lane-canvas { min-height: 152px; }

/* Per-cell + button in channels view — positioned in the top-right of
   each .lcol; opacity:0 by default, fades in on row hover. Matches the
   month-view .quick-add styling so the visual language stays consistent. */
.lane .lane-canvas .lcol { position: relative; }
.lane .lane-canvas .lcol .quick-add.lane-add {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
}
.lane:hover .lane-canvas .lcol .quick-add.lane-add { opacity: 1; }

/* Per-day + button in timeline — absolutely positioned across the track
   at each day offset; revealed on row hover only. */
.tl-row .track .quick-add.tl-add {
  z-index: 4;
}
.tl-row:hover .track .quick-add.tl-add { opacity: 1; }

/* Settings drawer: hamburger drag handle for reordering options. The
   button itself is the draggable; the inner span paints a 3-line icon
   so we don't rely on a font glyph. */
.opt-btn.opt-drag {
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.opt-btn.opt-drag:active { cursor: grabbing; }
.opt-btn.opt-drag .opt-drag-icon {
  display: block;
  width: 10px;
  height: 8px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 10px 1.4px no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 10px 1.4px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 10px 1.4px no-repeat;
}
.opt-row.is-dragging {
  opacity: 0.45;
}
.opt-row.is-drop-target {
  box-shadow: inset 0 2px 0 0 var(--accent, #37B77C);
}

/* Auto-grow notes textarea. resize:none lets the JS-driven height own
   the dimension; overflow-y:hidden hides the scrollbar we no longer need
   since scrollHeight is mirrored to height on every keystroke. */
.dt-textarea.auto-grow {
  resize: none;
  overflow-y: hidden;
  min-height: 48px;
}

/* ────────────────────────────────────────────────
   KANBAN — progress board (Ideation / Creation / Ready / Done)
   ──────────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* Mobile kanban — stack all four columns vertically so cards keep
   full detail and the user just scrolls down through Ideation →
   Creation → Ready → Done. With full-width headers there's now room
   for the stage name text alongside the glyph + count. */
@media (max-width: 767px) {
  .kanban {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    gap: 10px;
    padding: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: auto;
    /* The .canvas parent owns the scroll on desktop; on mobile we let
       the kanban scroll inside its own flex slot, but the wrapper
       shouldn't clip. */
    min-height: 100%;
  }
  .kb-col {
    min-width: 0;
    overflow: visible;
  }
  .kb-col-head { padding: 8px 10px; gap: 6px; }
  .kb-col-body {
    padding: 6px;
    /* Body no longer scrolls independently — the whole kanban
       scrolls as one vertical list. */
    overflow-y: visible;
  }
}
.kb-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: background var(--d-2) var(--ease-out), border-color var(--d-2) var(--ease-out);
}
.kb-col.drop-target {
  background: color-mix(in srgb, var(--accent, #37B77C) 8%, var(--bg-1));
  border-color: var(--accent, #37B77C);
}
.kb-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.kb-col-glyph {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.kb-col-name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  font-weight: 700;
  flex: 1;
  min-width: 0;
}
.kb-col-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  padding: 1px 6px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  letter-spacing: 0.04em;
}
/* Use a CSS-drawn cross (same approach as .quick-add) — the font glyph
   "+" sits visually off-center in most fonts and looks crooked inside
   a small square button. The two linear-gradient strokes centered at
   8x8 are pixel-symmetric. */
.kb-col-add {
  width: 22px;
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg-2);
  font-size: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
  transition: background var(--d-1) var(--ease-out), color var(--d-1) var(--ease-out);
}
.kb-col-add::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background:
    linear-gradient(currentColor, currentColor) center / 10px 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.6px 10px no-repeat;
}
.kb-col-add:hover { background: var(--fg); color: var(--bg); }
.kb-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-4);
  text-transform: uppercase;
  text-align: center;
  padding: 24px 0;
}
.kb-card {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--cat-products);
  padding: 8px 10px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Same fade-in keyframe as .pill / .span-bar / .wevent so columns
     don't snap into place on first paint. */
  animation: pill-in var(--d-3) var(--ease-out-soft) both;
  transition:
    transform var(--d-1) var(--ease-out),
    background var(--d-2) var(--ease-out),
    border-color var(--d-2) var(--ease-out),
    box-shadow var(--d-2) var(--ease-out),
    opacity var(--d-2) var(--ease-out);
}
.kb-card:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
  transform: translateY(-0.5px);
  box-shadow: var(--shadow-pop);
}
.kb-card:active { cursor: grabbing; }
.kb-card.dragging {
  opacity: 0.35;
  transform: scale(0.98) rotate(-0.4deg);
  box-shadow: var(--shadow-pop-lg);
  transition: none;
}
.kb-card.tbd {
  background: repeating-linear-gradient(45deg,
    var(--bg-2) 0 6px,
    color-mix(in srgb, var(--danger) 26%, var(--bg-2)) 6px 12px);
}
[data-theme="light"] .kb-card.tbd {
  background: repeating-linear-gradient(45deg,
    #fff 0 6px,
    color-mix(in srgb, var(--danger) 18%, #fff) 6px 12px);
}
.kb-card.past-due {
  border-color: var(--danger);
  border-left-color: var(--danger) !important;
}
.kb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.kb-card-date {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.kb-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  word-break: break-word;
}
.kb-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  text-transform: uppercase;
}

/* Sub-task variant of a kanban card. Dashed left border + a SUBTASK
   badge so it reads as a child, not a top-level workflow item. */
.kb-card.is-subtask {
  background: var(--bg-1);
  border-style: dashed;
  border-left-style: solid;
}
.kb-subtask-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--fg-3);
  flex-shrink: 0;
}

/* Timeline: 3× the original track height + switch from fixed height to
   min-height so inline overrides for taller stacks actually apply. The
   prior CSS used `height: 64px` which clipped any sub-pills below. */
.tl-row .track {
  height: auto !important;
  min-height: 192px;
  /* Match the row's grid: the row header is also affected by the same
     min-height via .tl-row's grid alignment below. */
}
.tl-row {
  min-height: 192px;
}
.tl-row .row-label {
  align-self: stretch;
}

/* Match channels/timeline today-tint exactly */
[data-theme="light"] .week-v2 .wcol.weekend,
[data-theme="light"] .week-v2 .whead.weekend {
  background: linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)), var(--bg-1) !important;
}
[data-theme="dark"] .week-v2 .wcol.weekend,
[data-theme="dark"] .week-v2 .whead.weekend {
  background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)), var(--bg-1) !important;
}

/* Week view: sub-task list inside a multi-day parent card. */
.wev-subs {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wev-subs-h {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-bottom: 2px;
}
.wev-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-2);
}
.wev-sub-date {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--fg-4);
  flex-shrink: 0;
  width: 44px;
}
.wev-sub-glyph { flex-shrink: 0; font-size: 11px; }
.wev-sub-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* MediaCard icon — when the brand glyph is rendered as a real favicon
   image (e.g. Typefully) it should fill the icon box cleanly. */
.media-card .mc-icon .mc-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}
/* Typefully + Google Docs/Sheets/Slides cards: strip the solid color
   background so the real product logo shows on a transparent surface
   (the favicon/product mark already carries its own brand colors). */
.media-card .mc-icon.typefully,
.media-card .mc-icon.doc,
.media-card .mc-icon.sheet,
.media-card .mc-icon.slides {
  background: transparent;
  padding: 0;
}

/* ============================================================
   Segmented toggles + stage rail — instant snap, no transition.
   Animating the .on state asymmetrically (fade out + snap in) feels
   laggy because the eye reads the unselected button's fade as a delay.
   Segmented controls are supposed to snap — that's how iOS / Linear /
   Notion all handle them.
   ============================================================ */
.tbd-toggle button,
.range-toggle button,
.stage-rail .stp {
  cursor: pointer;
  transition: none;
  /* Promote the element so hover/active style changes don't trigger
     layout reflows — keeps even slower devices feeling crisp. */
  will-change: background-color, color;
}
.tbd-toggle button:hover:not(.on),
.range-toggle button:hover:not(.on) { background: var(--bg-2); color: var(--fg-2); }

/* ============================================================
   Primary link + Result link — input + open button + clickable display
   ============================================================ */
.primary-link-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.primary-link-row .dt-input {
  flex: 1;
  min-width: 0;
}
.primary-link-row .iconbtn.sm {
  flex-shrink: 0;
  width: 32px;
  height: auto;
  min-height: 32px;
}
.primary-link-row .iconbtn.sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.primary-link-display {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--accent, #37B77C);
  text-decoration: none;
  word-break: break-all;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent, #37B77C) 35%, transparent);
  padding-bottom: 1px;
  transition: color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.primary-link-display:hover {
  color: var(--fg);
  border-bottom-color: var(--fg);
}
/* "Open ↗" in section header */
.dt-section h4 .h-action {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #37B77C);
  margin-left: auto;
  text-decoration: none;
  transition: color var(--d-1) var(--ease-out);
}
.dt-section h4 .h-action:hover { color: var(--fg); }

/* ============================================================
   Delete-event confirm dialog — matches the rest of the chrome
   ============================================================ */
.confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: overlay-in var(--d-2) var(--ease-out-soft) both;
}
.confirm-card {
  width: min(360px, 90%);
  background: var(--panel, var(--bg-1));
  border: 1px solid var(--border-strong, var(--border));
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: quickadd-in var(--d-3) var(--ease-out-soft) both;
  box-shadow: var(--shadow-pop-lg);
}
.confirm-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--danger, #E25C5C);
  margin-bottom: 2px;
}
.confirm-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.005em;
  line-height: 1.3;
  word-break: break-word;
}
.confirm-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--fg-3);
  line-height: 1.5;
  margin: 4px 0 14px;
}
.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.confirm-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-2);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--d-1) var(--ease-out),
              color var(--d-1) var(--ease-out),
              border-color var(--d-1) var(--ease-out);
}
.confirm-btn:hover { background: var(--bg-2); color: var(--fg); border-color: var(--fg-3); }
.confirm-btn.danger {
  background: var(--danger, #E25C5C);
  border-color: var(--danger, #E25C5C);
  color: #fff;
}
.confirm-btn.danger:hover {
  filter: brightness(1.08);
}

/* ============================================================
   Table view: expandable sub-task rows
   ============================================================ */
.tbl-caret {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-3);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--d-1) var(--ease-out),
              color var(--d-1) var(--ease-out),
              border-color var(--d-1) var(--ease-out);
}
.tbl-caret:hover { color: var(--fg); border-color: var(--fg-3); background: var(--bg-2); }
.tbl-caret-spacer {
  display: inline-block;
  width: 18px;
  flex-shrink: 0;
}
.tbl-subs-count {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--d-1) var(--ease-out), color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.tbl-subs-count:hover { background: var(--bg-2); color: var(--fg); border-color: var(--fg-3); }

.tbl tbody tr.is-expanded { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.tbl tbody tr.is-expanded td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--fg) 30%, transparent); }

/* Sub-task rows */
.tbl tbody tr.subtask-tr {
  background: color-mix(in srgb, var(--fg) 2%, transparent);
  font-size: 12px;
  animation: subtask-row-in var(--d-3) var(--ease-out-soft) both;
}
.tbl tbody tr.subtask-tr:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.tbl tbody tr.subtask-tr td { padding-top: 6px; padding-bottom: 6px; }
.tbl tbody tr.subtask-tr .colordot.subtask-dot {
  opacity: 0.55;
  position: relative;
}
.tbl tbody tr.subtask-tr .colordot.subtask-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    rgba(0,0,0,0.18) 3px 4px
  );
}
.tbl tbody tr.subtask-tr .subtask-rail {
  color: var(--fg-4);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
  width: 12px;
  display: inline-block;
  margin-top: 1px;
}
@keyframes subtask-row-in {
  from { opacity: 0; transform: translateY(-1px); }
  to   { opacity: 1; transform: none; }
}

.tbl tbody tr.subtask-add {
  background: transparent;
}
.tbl tbody tr.subtask-add input.editable {
  background: transparent;
  border: 1px dashed var(--border);
  padding: 4px 8px;
  color: var(--fg);
  outline: none;
  transition: border-color var(--d-1) var(--ease-out), background var(--d-1) var(--ease-out);
}
.tbl tbody tr.subtask-add input.editable:focus { border-color: var(--fg-3); background: var(--bg-2); }

.subtask-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}
.subtask-cell .subtask-cell-content { flex: 1; min-width: 0; }
.subtask-cell.is-override::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent, #37B77C);
  flex-shrink: 0;
}
.subtask-reset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-4);
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--d-1) var(--ease-out),
              color var(--d-1) var(--ease-out),
              border-color var(--d-1) var(--ease-out),
              transform var(--d-2) var(--ease-out);
}
.subtask-cell:hover .subtask-reset,
.subtask-cell.is-override .subtask-reset { opacity: 1; }
.subtask-reset:hover { color: var(--fg); border-color: var(--fg-3); transform: rotate(-90deg); }

/* ============================================================
   Quick-add modal: centered on screen with backdrop
   ============================================================ */
.quickadd-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-in var(--d-2) var(--ease-out-soft) both;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.quickadd.centered {
  position: relative;
  left: auto !important;
  top: auto !important;
  width: 420px;
  max-width: calc(100vw - 32px);
  animation: quickadd-in var(--d-3) var(--ease-out-soft) both;
  box-shadow: var(--shadow-pop-lg);
}
@keyframes quickadd-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   Holiday filter popover — keep dropdown lightweight: no entrance
   animation on the popover itself, no animation on its rows.
   ============================================================ */
.holiday-popover {
  animation: none !important;
}
.holiday-popover * { animation: none !important; }
.holiday-popover .po-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  padding: 4px 12px 2px;
}
.holiday-popover .po-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.holiday-popover .po-item * { cursor: pointer; }
.holiday-popover .po-item:hover { background: var(--bg-2); color: var(--fg); }
.holiday-popover .po-item:active { background: var(--bg-3); }
.holiday-popover .po-item.disabled { opacity: 0.4; pointer-events: none; }
.holiday-popover .po-item input[type="checkbox"] {
  width: 13px; height: 13px;
  accent-color: var(--accent, #37B77C);
  flex-shrink: 0;
  margin: 0;
}
.holiday-popover .po-item .swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}
.holiday-popover .po-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.holiday-popover .po-actions {
  display: flex;
  gap: 6px;
  padding: 6px 12px 10px;
}
.holiday-popover .po-mini {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--d-1) var(--ease-out), color var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.holiday-popover .po-mini:hover:not(:disabled) { background: var(--bg-2); color: var(--fg); border-color: var(--fg-3); }
.holiday-popover .po-mini:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   Holiday rendering — perf-tuned:
   - precomputed rgba values (no color-mix per node)
   - no entrance animation on holiday pills (mass-toggle stays cheap)
   - no hover lift / shadow (avoids paint-on-hover for dozens of nodes)
   - transparent + subtle green tint
   ============================================================ */
.pill.holiday,
.span-bar.holiday,
.wevent.holiday,
.lane-bar.holiday,
.tl-bar.holiday {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(55, 183, 124, 0.08) 0 4px,
      transparent 4px 9px
    ),
    rgba(55, 183, 124, 0.06);
  border-color: rgba(55, 183, 124, 0.22) !important;
  border-left-color: rgba(55, 183, 124, 0.55) !important;
  color: rgba(180, 220, 200, 0.92);
  cursor: default;
  animation: none !important;
  transition: background 80ms linear;
}
[data-theme="light"] .pill.holiday,
[data-theme="light"] .span-bar.holiday,
[data-theme="light"] .wevent.holiday,
[data-theme="light"] .lane-bar.holiday,
[data-theme="light"] .tl-bar.holiday {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(55, 183, 124, 0.10) 0 4px,
      transparent 4px 9px
    ),
    rgba(55, 183, 124, 0.07);
  color: rgba(34, 89, 64, 0.88);
}
.pill.holiday:hover,
.span-bar.holiday:hover,
.wevent.holiday:hover,
.lane-bar.holiday:hover {
  transform: none !important;
  box-shadow: none !important;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(55, 183, 124, 0.12) 0 4px,
      transparent 4px 9px
    ),
    rgba(55, 183, 124, 0.10);
}
.pill.holiday .ptitle,
.span-bar.holiday .ptitle,
.wevent.holiday .title {
  font-style: italic;
  letter-spacing: 0.01em;
}
.pill.holiday::before,
.span-bar.holiday::before {
  content: "✦";
  margin-right: 2px;
  font-size: 9px;
  opacity: 0.65;
}

/* Read-only detail panel for holidays */
.detail.is-holiday .dt-input,
.detail.is-holiday .dt-textarea,
.detail.is-holiday .editable,
.detail.is-holiday .mcs-trigger,
.detail.is-holiday button:not(.iconbtn-close) {
  pointer-events: none;
  opacity: 0.7;
}
.detail.is-holiday .dt-section--readonly {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--fg) 3%, transparent) 0 6px,
    transparent 6px 12px
  );
  border-radius: 3px;
}
.detail.is-holiday .readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: color-mix(in srgb, var(--fg) 4%, transparent);
  border-bottom: 1px solid var(--border);
}

/* Expanded sub-task rows host popovers (owners picker, etc.) that
   absolutely-positioned themselves below their trigger. The base
   `.subtask-row { overflow: hidden }` was clipping the right edge of
   those popovers. Restore visibility when expanded; the entry animation
   (`subtask-row-in`) lives on `.st-editor`, not on the row itself, so
   relaxing the row's overflow here doesn't affect it. */
.subtask-row.is-expanded { overflow: visible; }
.subtask-row.is-expanded .st-editor { overflow: visible; }

/* Fortnight (2-week) variant of the month grid.
   Fills the canvas exactly (dows + 2 equal-height rows) with NO vertical
   overflow — the same flex layout the mobile rule uses. This is required
   for parity with the 6-week month view: the wheel-to-navigate gesture
   (app.jsx) hijacks the wheel to step the date ±14 days and keeps the view
   fixed in place. If the fortnight grid is allowed to overflow the canvas
   (the previous `display:block; height:auto` block-stack), the canvas
   becomes natively scrollable and sub-threshold wheel deltas leak into
   native scroll — the grid jitters/scrolls instead of staying pinned.
   Each row gets `flex: 1 1 0` so it claims half the height regardless of
   the JS-set inline `min-height` (which was sized for the old scroll
   layout); `min-height: 0 !important` is needed to beat that inline style.
   `overflow: hidden` clips any pills that don't fit so they don't bleed
   into the adjacent row. */
.month.is-fortnight {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.month.is-fortnight .month-dows { flex: 0 0 auto; }
.month.is-fortnight .month-row {
  flex: 1 1 0;
  min-height: 0 !important;
  overflow: hidden;
}

/* ────────────────────────────────────────────────
   NEEDS REVIEW · purple zebra stripes (no text overlay).
   Same shorthand as TBD's pink stripes — the diagonal lines + tint
   carry the meaning, no watermark text needed. */
:root { --needs-review: #9B6FBC; }

.span-bar.needs-review,
.week-v2 .week-body .week-span-bar.needs-review,
.lane-bar.needs-review,
.tl-bar.needs-review,
.wevent.needs-review,
.kb-card.needs-review,
.subpill.abs.needs-review {
  background: repeating-linear-gradient(45deg,
    var(--bg-2) 0 6px,
    color-mix(in srgb, var(--needs-review) 28%, var(--bg-2)) 6px 12px);
}
[data-theme="light"] .span-bar.needs-review,
[data-theme="light"] .week-v2 .week-body .week-span-bar.needs-review,
[data-theme="light"] .lane-bar.needs-review,
[data-theme="light"] .tl-bar.needs-review,
[data-theme="light"] .wevent.needs-review,
[data-theme="light"] .kb-card.needs-review,
[data-theme="light"] .subpill.abs.needs-review {
  background: repeating-linear-gradient(45deg,
    #fff 0 6px,
    color-mix(in srgb, var(--needs-review) 20%, #fff) 6px 12px);
}

/* Inline table row indicator — mirrors .row-tbd */
.tbl .row-needs-review {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--needs-review);
  border: 1px solid var(--needs-review);
  background: color-mix(in srgb, var(--needs-review) 12%, transparent);
  vertical-align: middle;
}

/* Detail-panel Needs Review toggle — mirrors .tbd-toggle */
.needs-review-toggle {
  display: inline-flex;
  border: 1px solid var(--border-2);
  border-radius: 2px;
  overflow: hidden;
}
.needs-review-toggle button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-2);
  color: var(--fg-2);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.needs-review-toggle button:last-child { border-right: none; }
.needs-review-toggle button.on { background: var(--bg-3); color: var(--fg); }
.needs-review-toggle button.nr.on { background: var(--needs-review); color: #fff; }

/* Multi-owner swatch stack — sits in the .mcs-trigger slot where a
   single .mcs-swatch normally lives. */
.mcs-swatch-stack {
  display: inline-flex;
  gap: 2px;
  flex-shrink: 0;
}
.mcs-swatch-stack .mcs-swatch { width: 8px; height: 8px; }

/* Multi-owner chips used in detail panel, table, hover card */
.owners-select {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  padding: 4px 8px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
}
.owners-select:hover { background: var(--bg-3); border-color: var(--border-strong); }
.owners-select.compact { min-height: 24px; font-size: 10px; padding: 2px 6px; }
.owners-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.owner-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 2px;
  white-space: nowrap;
}
.owner-chip.xs { font-size: 9px; padding: 0 5px; }
.owner-chip.more {
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--border-2);
}
.owners-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
}
.cell-owners {
  width: 100%;
  max-width: 160px;
}
.cell-owners-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 4px;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
}
.cell-owners-btn:hover { background: var(--bg-2); border-color: var(--border-2); }

/* ────────────────────────────────────────────────
   MY TASKS VIEW */
.mytasks {
  padding: 20px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1000px;
}
.mytasks-empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
  padding: 32px;
  border: 1px dashed var(--border-2);
  text-align: center;
}
.mytasks-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.mytasks-section-head h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  margin: 0;
}
.mytasks-section-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
}
.mytasks-card {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--cat-products);
  cursor: pointer;
  transition: background var(--d-1) var(--ease-out), border-color var(--d-1) var(--ease-out);
}
.mytasks-card:hover { background: var(--bg-3); border-color: var(--border-strong); }
.mytasks-card.is-subtask { padding-left: 32px; }
.mytasks-card.is-subtask::before {
  content: "↳";
  position: absolute;
  left: 14px;
  color: var(--fg-4);
  font-family: var(--font-mono);
  font-size: 12px;
}
.mytasks-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-2);
  text-transform: uppercase;
}
.mytasks-body {
  min-width: 0;
}
.mytasks-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.mytasks-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}
.mytasks-meta .sep { color: var(--fg-4); }
.mytasks-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mytasks-card.needs-review {
  background: repeating-linear-gradient(45deg,
    var(--bg-2) 0 6px,
    color-mix(in srgb, var(--needs-review) 28%, var(--bg-2)) 6px 12px);
}
.mytasks-card.tbd {
  background: repeating-linear-gradient(45deg,
    var(--bg-2) 0 6px,
    color-mix(in srgb, var(--danger) 26%, var(--bg-2)) 6px 12px);
}
[data-theme="light"] .mytasks-card.needs-review {
  background: repeating-linear-gradient(45deg,
    #fff 0 6px,
    color-mix(in srgb, var(--needs-review) 20%, #fff) 6px 12px);
}
[data-theme="light"] .mytasks-card.tbd {
  background: repeating-linear-gradient(45deg,
    #fff 0 6px,
    color-mix(in srgb, var(--danger) 18%, #fff) 6px 12px);
}

/* GTM Team box · Settings → Owners. Drop owners here to scope the
   @mention dropdown to just this subset. */
.gtm-team-box {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px dashed var(--border-2);
  background: var(--bg-2);
  transition: border-color var(--d-1) var(--ease-out), background var(--d-1) var(--ease-out);
}
.gtm-team-box.is-drop-target {
  border-color: var(--accent, #37B77C);
  border-style: solid;
  background: color-mix(in srgb, var(--accent, #37B77C) 6%, var(--bg-2));
}
.gtm-team-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.gtm-team-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--fg);
}
.gtm-team-hint {
  font-size: 11.5px;
  color: var(--fg-3);
  line-height: 1.45;
  flex: 1;
  min-width: 180px;
}
.gtm-team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  align-items: center;
}
.gtm-team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 8px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-left-width: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg);
}
.gtm-team-chip-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--border-2);
  display: inline-block;
}
.gtm-team-chip-x {
  background: transparent;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
}
.gtm-team-chip-x:hover { color: var(--danger, #F7519B); }
.gtm-team-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-4);
}

/* @mention autocomplete popup — appears under any title / notes input
   while the user is typing an `@<letters>` token. */
.mention-input-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.mention-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  max-width: 320px;
  z-index: 200;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border-strong, var(--border-2));
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--fg);
}
.mention-item.on,
.mention-item:hover { background: var(--bg-2); }
.mention-swatch {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 1px solid var(--border-2);
}
.mention-name { flex: 1; }

/* Roster RPC setup card · shown in Settings → Owners */
.roster-setup {
  margin: 8px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
}
.roster-setup.warn { border-color: #F5AF94; background: color-mix(in srgb, #F5AF94 8%, var(--bg-2)); }
.roster-setup.ok { border-color: #6DD0A9; background: color-mix(in srgb, #6DD0A9 6%, var(--bg-2)); }
.roster-setup-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
}
.roster-setup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.roster-setup-dot.ok { background: #37B77C; }
.roster-setup-dot.warn { background: #F5AF94; }
.roster-setup-dot.idle { background: var(--fg-3); }
.roster-setup-sub {
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.5;
}
.roster-setup-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.roster-setup-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.roster-setup-btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.roster-setup-btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.roster-setup-btn.primary:hover { background: var(--fg-2); color: var(--bg); }
.roster-setup-sql {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--fg-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre;
}
