:root,
[data-theme='light'] {
  /* Interior Design portal palette: #00A3E8 blue + #726F6F warm gray + black/white.
     Sales Tracker light mode = blues and grays derived from these four. */
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-surface-2: #eaeef2;
  --color-surface-offset: #d6dce2;
  --color-folder: #5b7a8c;
  --color-folder-deep: #3c5a6e;
  --color-accent: #00a3e8;
  --color-accent-hover: #0086c2;
  --color-heading-blue: #00a3e8;
  --color-heading-blue-hover: #0086c2;
  --color-heading-blue-deep: #006a99;
  --color-text: #1a1a1a;
  --color-text-muted: #726f6f;
  --color-text-faint: #9aa0a6;
  --color-border: color-mix(in oklab, #726f6f 28%, transparent);
  --shadow-sm: 0 1px 2px oklch(0.32 0.02 240 / 0.08);
  --shadow-md: 0 12px 26px oklch(0.32 0.02 240 / 0.12);
  --shadow-lg: 0 24px 60px oklch(0.32 0.02 240 / 0.16);
}

[data-theme='dark'] {
  --color-bg: #0f1d26;
  --color-surface: #172936;
  --color-surface-2: #203543;
  --color-surface-offset: #2a4351;
  --color-folder: #d49a42;
  --color-folder-deep: #a76e25;
  --color-accent: #9dbfb4;
  --color-accent-hover: #c0ddd4;
  --color-heading-blue: #7896b7;
  --color-heading-blue-hover: #95aecb;
  --color-heading-blue-deep: #526f91;
  --color-text: #eee5d8;
  --color-text-muted: #c0b29f;
  --color-text-faint: #8b9aa0;
  --color-border: color-mix(in oklab, #d8cbb8 17%, transparent);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.24);
  --shadow-md: 0 12px 26px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 24px 60px oklch(0 0 0 / 0.38);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body, Calibri, 'Segoe UI', Arial, sans-serif);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--color-folder) 18%, transparent), transparent 32rem),
    radial-gradient(circle at top right, color-mix(in oklab, var(--color-accent) 10%, transparent), transparent 28rem),
    var(--color-bg);
}

@font-face {
  font-family: 'Highland Gothic Local';
  src: url('./assets/fonts/HighlandGothicLightFLF.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Highland Gothic Local';
  src: url('./assets/fonts/HighlandGothicFLF.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Highland Gothic Local';
  src: url('./assets/fonts/HighlandGothicFLF-Bold.ttf') format('truetype');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: 'Highland Gothic Local', 'Highland Gothic', 'HighlandGothic', 'Copperplate Gothic Light', 'Copperplate', Calibri, 'Segoe UI', Arial, sans-serif;
  --font-heading: 'Highland Gothic Local', 'Highland Gothic', 'HighlandGothic', 'Copperplate Gothic Light', 'Copperplate', Calibri, 'Segoe UI', Arial, sans-serif;
  --font-body: Calibri, 'Segoe UI', Arial, sans-serif;
  --font-highland-gothic: 'Highland Gothic Local', 'Highland Gothic', 'HighlandGothic', 'Copperplate Gothic Light', 'Copperplate', Calibri, 'Segoe UI', Arial, sans-serif;
  --section-heading-size: 1.12rem;
  --field-label-size: 0.785rem;
  --field-control-size: 0.905rem;
  --text-xs: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  --text-sm: clamp(1rem, 0.925rem + 0.35vw, 1.125rem);
  --text-base: clamp(1.125rem, 1.075rem + 0.25vw, 1.25rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 10;
  transform: translateY(-150%);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  color: var(--color-surface);
  background: var(--color-accent);
  text-decoration: none;
  transition: transform var(--transition-interactive);
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: var(--space-6);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.brand-mark {
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 auto;
  color: var(--color-accent);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.08;
  text-wrap: balance;
  text-transform: uppercase;
}

/* Sales Tracker typography convention: anything rendered in ALL CAPS uses
   Highland Gothic; everything else uses Calibri (the body default). This
   universal rule catches every element that CSS-uppercases its text so we
   don't have to remember to set font-family on each one individually. */
[style*="text-transform: uppercase"],
[style*="text-transform:uppercase"],
.header-tracker-stone::after,
.eyebrow,
.team-section-banner,
.team-member-card-header span,
.template-task-item strong,
.template-task-item small,
.template-subtask-list,
.task-template-filter-panel label,
.template-task-form label,
.template-task-form button,
.filter-panel label,
.board-search-label,
.stats span,
.rename-folder-form input,
.large-folder span,
.folder-meta dt,
.notes-card h2,
.ownership-card h3,
.timeline-marker-number,
.abandon-popover-header h3,
.stones-total-label {
  font-family: var(--font-heading);
}

h1 {
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
}

.header-tracker-bar {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  width: min(42rem, 58vw);
  height: 0.72rem;
  margin-top: var(--space-2);
  border: 1px solid color-mix(in oklab, var(--color-border) 72%, transparent);
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  box-shadow:
    inset 0 1px 3px oklch(0 0 0 / 0.18),
    0 6px 14px color-mix(in oklab, var(--color-accent) 10%, transparent);
  overflow: visible;
}

.header-tracker-stone {
  position: relative;
  min-width: 0;
  height: 100%;
  background: var(--stone-color);
  cursor: help;
}

.header-tracker-stone:first-child {
  border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.header-tracker-stone:last-child {
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.header-tracker-stone + .header-tracker-stone {
  border-left: 1px solid color-mix(in oklab, #ffffff 46%, #000000 16%);
}

.header-tracker-stone:hover,
.header-tracker-stone:focus-visible {
  z-index: 4;
  box-shadow:
    inset 0 0 0 2px color-mix(in oklab, #ffffff 55%, transparent),
    0 0 0 2px color-mix(in oklab, #000000 22%, transparent);
}

.header-tracker-stone::after {
  content: attr(data-stone-description);
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: min(20rem, 72vw);
  padding: 0.45rem 0.62rem;
  transform: translate(-50%, -0.25rem);
  border: 1px solid color-mix(in oklab, #000000 20%, var(--stone-color));
  border-radius: var(--radius-md);
  color: var(--stone-text);
  background: var(--stone-color);
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--transition-interactive),
    transform var(--transition-interactive);
}

.header-tracker-stone::before {
  content: '';
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 50%;
  z-index: 21;
  width: 0.62rem;
  height: 0.62rem;
  transform: translate(-50%, 0.1rem) rotate(45deg);
  background: var(--stone-color);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--transition-interactive),
    transform var(--transition-interactive);
}

.header-tracker-stone:hover::after,
.header-tracker-stone:focus-visible::after,
.header-tracker-stone:hover::before,
.header-tracker-stone:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0) rotate(0deg);
}

.header-tracker-stone:hover::before,
.header-tracker-stone:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

h2 {
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
}

.eyebrow {
  color: var(--color-folder-deep);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

[data-theme='dark'] .eyebrow {
  color: var(--color-folder);
}

.theme-toggle,
.text-button,
.primary-action {
  min-height: 44px;
  border-radius: var(--radius-full);
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    transform var(--transition-interactive);
}

.theme-toggle {
  min-width: 44px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(420px, 2fr);
  gap: var(--space-5);
  align-items: start;
}

.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: color-mix(in oklab, var(--color-surface) 92%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.controls-panel,
.folders-panel,
.detail-panel,
.sales-tracker-panel {
  padding: var(--space-5);
}

.sales-tracker-panel {
  grid-column: 1 / -1;
}

.sales-tracker-panel:has(.phase-column.is-click-expanded) {
  position: relative;
  z-index: 1000;
}

.section-heading {
  margin-bottom: var(--space-5);
}

.section-heading.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.tracker-count {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.needs-attention-panel {
  display: grid;
  gap: var(--space-2);
}

.needs-attention-list {
  display: grid;
  gap: 0.38rem;
  max-height: clamp(6.5rem, 18vh, 9rem);
  overflow-y: auto;
  padding-right: 0.2rem;
  overscroll-behavior: contain;
}

.needs-attention-bar {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  padding: 0.46rem 0.58rem;
  border: 1px solid color-mix(in oklab, #000000 24%, var(--attention-color));
  border-radius: calc(var(--radius-md) + 1px);
  color: var(--attention-text);
  background: var(--attention-color);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.needs-attention-bar.is-client-review-urgent,
.needs-attention-bar.is-stale {
  border-color: color-mix(in oklab, #1d2433 38%, var(--attention-color));
  animation: needsAttentionPulse 4.8s ease-in-out infinite;
  will-change: box-shadow, transform, filter;
}

.needs-attention-bar span {
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.08;
}

.needs-attention-bar small {
  color: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  opacity: 0.9;
}

.needs-attention-empty {
  padding: 0.58rem 0.68rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  font-weight: 800;
}

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  margin-bottom: var(--space-4);
}

.board-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.18rem;
  margin-left: auto;
}

.stones-board-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.stones-board-button {
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  transition:
    border-color var(--transition-interactive),
    background var(--transition-interactive),
    color var(--transition-interactive),
    transform var(--transition-interactive);
}

.stones-board-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--color-accent) 34%, var(--color-border));
  color: var(--color-text);
}

.stones-board-button.is-active {
  border-color: var(--color-accent);
  color: var(--color-surface);
  background: var(--color-accent);
}

/* --- Details toggle (Show / Hide task details) --- */
.details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  transition:
    border-color var(--transition-interactive),
    background var(--transition-interactive),
    color var(--transition-interactive),
    transform var(--transition-interactive);
}

.details-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--color-accent) 34%, var(--color-border));
  color: var(--color-text);
}

.details-toggle[aria-pressed="true"] {
  border-color: var(--color-accent);
  color: var(--color-surface);
  background: var(--color-accent);
}

.details-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* When details are collapsed, hide subpoint lists across all views. */
body.details-collapsed .task-subpoints,
body.details-collapsed .stone-task-subpoints {
  display: none !important;
}

.phase-tracker {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) var(--space-1) var(--space-3);
  scroll-snap-type: x proximity;
}

.phase-tracker.is-stone-board {
  grid-auto-flow: row;
  grid-auto-columns: unset;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
  padding: var(--space-2) var(--space-1);
  scroll-snap-type: none;
}

.phase-tracker.is-task-board {
  grid-auto-flow: row;
  grid-auto-columns: unset;
  grid-template-columns: minmax(0, 1fr);
  max-height: clamp(34rem, 78vh, 58rem);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: none;
}

.active-files-main[hidden] {
  display: none;
}

.project-files-board {
  display: grid;
  width: min(100%, 100%);
  min-width: min(100%, 64rem);
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface));
  box-shadow: var(--shadow-sm);
  scroll-snap-align: start;
}

.board-folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.board-empty-state {
  margin-top: 0;
}

.team-board-section {
  display: grid;
  gap: var(--space-4);
  width: 100%;
  min-width: min(100%, 64rem);
  padding: var(--space-2) var(--space-1) var(--space-3);
  scroll-snap-align: start;
}

.team-member-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  align-items: start;
  gap: var(--space-3);
  width: 100%;
}

.team-member-card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 13.7rem;
  min-height: 13.7rem;
  max-height: 13.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface));
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

.team-member-card:hover {
  border-color: color-mix(in oklab, #2f5363 52%, var(--color-border));
  box-shadow: var(--shadow-md);
}

.team-member-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 3.25rem;
  padding: 0.62rem 0.72rem;
  border: 0;
  border-bottom: 1px solid color-mix(in oklab, #1d3745 78%, #000000);
  color: #f2f7f8;
  background: #2f5363;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive);
}

.team-member-card-header:hover {
  background: #3b6273;
}

.unassigned-category-card.is-internal-queue .team-member-card-header {
  border-bottom-color: color-mix(in oklab, #634238 72%, #000000);
  color: #fff6ef;
  background: #83574b;
}

.unassigned-category-card.is-internal-queue .team-member-card-header:hover {
  background: #95695a;
}

.unassigned-category-card.is-client-queue .team-member-card-header {
  border-bottom-color: color-mix(in oklab, #4c4354 72%, #000000);
  color: #fff7f0;
  background: #65566b;
}

.unassigned-category-card.is-client-queue .team-member-card-header:hover {
  background: #75647b;
}

.assigned-team-section,
.unassigned-team-section {
  display: grid;
  gap: var(--space-3);
}

.unassigned-team-section {
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.team-section-banner {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.52rem 0.75rem;
  border: 1px solid color-mix(in oklab, #2f5363 44%, var(--color-border));
  border-radius: var(--radius-md);
  color: #fffaf0;
  background:
    linear-gradient(135deg, color-mix(in oklab, #2f5363 88%, #fffaf0 12%), #243f4c);
  box-shadow: inset 0 1px 0 color-mix(in oklab, #fffaf0 16%, transparent);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.unassigned-team-board {
  grid-template-columns: repeat(4, minmax(10.5rem, 1fr));
}

.team-section-empty {
  grid-column: 1 / -1;
  padding: var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface-2) 72%, transparent);
  font-size: 0.78rem;
  font-weight: 800;
}

.unassigned-category-header {
  cursor: pointer;
}

.unassigned-category-header:hover {
  background: #3b6273;
}

.team-member-card-header:focus-visible {
  outline: 2px solid #8eb0bc;
  outline-offset: -4px;
}

.team-member-card-header span {
  color: #f2f7f8;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.12;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.team-member-card-header:hover span {
  color: #f2f7f8;
}

.team-member-card-header small {
  display: grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  border-radius: var(--radius-full);
  color: #243f4c;
  background: #fffaf0;
  font-size: 0.72rem;
  font-weight: 900;
}

.team-assignment-list {
  display: grid;
  align-content: start;
  gap: 0.42rem;
  max-height: 10.3rem;
  padding: 0.68rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.team-assignment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.team-assignment-bar {
  min-height: 2.1rem;
  padding: 0.5rem 0.58rem;
  color: var(--assignment-text);
  background: var(--assignment-color);
  border-color: color-mix(in oklab, #000000 22%, var(--assignment-color));
  box-shadow: inset 4px 0 0 color-mix(in oklab, #000000 18%, transparent);
  font-size: 0.72rem;
  line-height: 1.15;
}

.team-assignment-bar.is-client-review-urgent,
.team-assignment-bar.is-stale {
  animation: clientReviewPulse 4.8s ease-in-out infinite;
}

@keyframes needsAttentionPulse {
  0%,
  100% {
    box-shadow: var(--shadow-sm);
    filter: saturate(1);
    transform: translateY(0);
  }

  50% {
    box-shadow:
      var(--shadow-md),
      0 0 0 5px color-mix(in oklab, var(--attention-color) 28%, transparent),
      0 0 18px color-mix(in oklab, var(--attention-color) 35%, transparent);
    filter: saturate(1.08);
    transform: translateY(-1px);
  }
}

@keyframes clientReviewPulse {
  0%,
  100% {
    box-shadow: var(--shadow-sm);
  }

  50% {
    box-shadow:
      var(--shadow-md),
      0 0 0 4px color-mix(in oklab, #7d5aa3 20%, transparent);
  }
}

.team-assignment-bar:hover,
.team-assignment-bar.is-selected {
  background: color-mix(in oklab, var(--assignment-color) 86%, #ffffff);
}

.team-assignment-empty {
  padding: var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface-2) 72%, transparent);
  font-size: 0.78rem;
  font-weight: 800;
}

.phase-column {
  display: grid;
  align-content: start;
  min-height: 11rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  background: var(--color-surface);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--shadow-md);
  transition:
    opacity var(--transition-interactive),
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive),
    min-height var(--transition-interactive);
}

/* Preserve the legacy navy stone-column look in dark mode. */
[data-theme='dark'] .phase-column {
  color: #eee5d8;
  background: #172936;
  border-color: color-mix(in oklab, #d8cbb8 17%, transparent);
  box-shadow: 0 12px 26px oklch(0 0 0 / 0.22);
}

.phase-tracker.is-stone-board .phase-column {
  min-height: 9.85rem;
  max-height: 11.2rem;
}

.phase-tracker.is-task-board .phase-column {
  min-height: 21rem;
  max-height: 25rem;
}

.phase-tracker.is-stone-board .phase-column-header {
  grid-template-columns: minmax(0, 1fr) 2.08rem;
  min-height: 4.35rem;
  padding: 0.48rem 0.34rem 0.3rem 0.32rem;
  gap: 0.3rem;
  color: #080808;
}

.phase-tracker.is-task-board .phase-column-header {
  grid-template-columns: minmax(0, 1fr);
}

.phase-tracker.is-stone-board .phase-color-dot {
  display: none;
}

.phase-tracker.is-stone-board .phase-column-header h3 {
  display: grid;
  grid-template-columns: 1.5rem auto minmax(0, 1fr);
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  overflow: hidden;
  color: #080808;
  font-size: 0.68rem;
  line-height: 1.02;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.phase-tracker.is-stone-board .stone-heading-number {
  min-width: 1.5rem;
  font-family: var(--font-heading);
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
}

.phase-tracker.is-stone-board .stone-heading-divider {
  width: 1px;
  height: 2.02rem;
  margin-left: 0.16rem;
  background: color-mix(in oklab, #080808 72%, transparent);
}

.phase-tracker.is-stone-board .stone-heading-title {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: clamp(0.56rem, 0.68vw, 0.68rem);
  font-weight: 900;
  letter-spacing: 0.025em;
  line-height: 1.04;
  text-transform: uppercase;
}

.phase-tracker.is-stone-board .stone-heading-title span {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.phase-tracker.is-stone-board .phase-column-header small {
  min-width: 1.62rem;
  width: 1.62rem;
  height: 1.62rem;
  border: 1px solid color-mix(in oklab, #080808 72%, transparent);
  color: #080808;
  background: color-mix(in oklab, #ffffff 28%, transparent);
  font-size: 0.72rem;
}

.phase-tracker.is-stone-board .phase-column-metrics {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: end;
  align-self: stretch;
  align-content: stretch;
  gap: 0.08rem;
}

.phase-tracker.is-stone-board .phase-cost-total {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  color: #080808;
  background: transparent;
  font-size: 0.98rem;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.055em;
  white-space: nowrap;
  text-align: right;
}

.phase-tracker.is-stone-board .phase-column-metrics small {
  grid-row: 3;
  min-width: 1.42rem;
  width: 1.42rem;
  height: 1.42rem;
  font-size: 0.62rem;
}

.phase-tracker.is-stone-board .phase-folder-list {
  gap: 0.34rem;
  max-height: 6.05rem;
  padding: 0.52rem;
}

.phase-tracker.is-stone-board .phase-folder-pill {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  padding: 0.5rem 0.58rem;
  font-size: 0.66rem;
  line-height: 1.12;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-template-panel {
  display: grid;
  min-height: 0;
  padding: 0.58rem;
}

.task-outline-document {
  display: grid;
  gap: var(--space-4);
  padding: clamp(1rem, 2vw, 1.5rem);
  border: 1px solid color-mix(in oklab, var(--color-border) 76%, var(--color-heading-blue));
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--color-surface) 96%, #fff9ed), var(--color-surface-2)),
    var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.task-outline-stone {
  display: grid;
  gap: 0.58rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid color-mix(in oklab, var(--phase-color) 34%, var(--color-border));
}

.task-outline-stone:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.task-outline-heading {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.55rem;
  margin: 0;
  color: var(--phase-color);
  font-family: var(--font-heading);
  font-size: clamp(0.96rem, 1.22vw, 1.18rem);
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.task-outline-stone-number {
  text-align: right;
}

.task-outline-document .template-task-list {
  gap: 0.42rem;
  max-height: none;
  overflow: visible;
  padding: 0;
}

.task-outline-document .template-task-item {
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.25;
}

.task-outline-document .template-task-copy {
  display: grid;
  gap: 0.16rem;
}

.task-outline-document .template-task-item strong {
  letter-spacing: 0.018em;
}

.task-outline-document .template-subtask-list {
  gap: 0.18rem;
  margin-top: 0.16rem;
  padding-left: 1.25rem;
  font-size: 0.82rem;
}

.task-outline-document .template-subtask-item {
  grid-template-columns: 2.3rem minmax(0, 1fr);
  gap: 0.48rem;
}

.template-task-list {
  display: grid;
  align-content: start;
  gap: 0.28rem;
  max-height: 18rem;
  margin: 0;
  padding: 0 0.12rem 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.template-task-item {
  display: grid;
  grid-template-columns: 1.45rem minmax(0, 1fr);
  align-items: start;
  gap: 0.3rem;
  padding: 0.26rem 0.28rem;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: transparent;
  font-size: 0.76rem;
  line-height: 1.22;
}

.template-outline-label {
  color: var(--phase-color);
  font-weight: 950;
  text-align: right;
  text-transform: none;
}

.template-task-copy {
  min-width: 0;
}

.template-task-item strong {
  display: block;
  color: var(--color-text);
  font-weight: 900;
  text-transform: uppercase;
}

.template-task-item small {
  display: inline-block;
  margin-top: 0.14rem;
  color: var(--phase-color);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.template-task-item.is-complete .template-task-copy {
  opacity: 0.58;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.template-subtask-list {
  display: grid;
  gap: 0.1rem;
  margin: 0.26rem 0 0;
  padding-left: 0.68rem;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.template-subtask-item {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.28rem;
}

.template-outline-label-sub {
  color: var(--phase-color);
}

.template-task-empty {
  margin: 0;
  padding: var(--space-3);
  border: 1px dashed color-mix(in oklab, var(--phase-color) 42%, var(--color-border));
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface-2) 72%, transparent);
  font-size: 0.78rem;
  font-weight: 800;
}

.template-task-form {
  display: grid;
  gap: 0.42rem;
  padding: 0.52rem;
  border: 1px solid color-mix(in oklab, var(--phase-color) 32%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--color-surface) 88%, var(--phase-color));
}

.task-template-add-panel,
.task-template-filter-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(11rem, 0.5fr) minmax(0, 2.4fr);
  gap: var(--space-4);
  align-items: end;
  padding: var(--space-4);
  border: 1px solid color-mix(in oklab, var(--color-border) 80%, var(--color-heading-blue));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--color-surface-2) 88%, var(--color-heading-blue)), var(--color-surface));
  box-shadow: var(--shadow-sm);
}

.task-template-filter-panel {
  grid-template-columns: minmax(11rem, 0.45fr) minmax(16rem, 0.75fr) minmax(0, 1.4fr);
  align-items: center;
}

.task-template-add-panel h3,
.task-template-filter-panel h3 {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.task-template-filter-panel label {
  display: grid;
  gap: 0.22rem;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.task-template-filter-panel select {
  width: 100%;
  min-height: 2rem;
  padding: 0.34rem 1.9rem 0.34rem 0.48rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
}

.task-template-filter-panel p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.template-task-form-global {
  grid-template-columns: minmax(11rem, 0.7fr) minmax(13rem, 1fr) minmax(16rem, 1.2fr) auto;
  align-items: end;
  background: color-mix(in oklab, var(--color-surface) 92%, transparent);
}

.template-task-form select {
  width: 100%;
  min-height: 2rem;
  padding: 0.34rem 1.9rem 0.34rem 0.48rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
}

.template-task-form label {
  display: grid;
  gap: 0.22rem;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.template-task-form input,
.template-task-form textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
}

.template-task-form input {
  min-height: 2rem;
  padding: 0.34rem 0.48rem;
}

.template-task-form textarea {
  resize: vertical;
  min-height: 2.6rem;
  padding: 0.42rem 0.48rem;
}

.template-task-form button {
  min-height: 2.1rem;
  border: 1px solid color-mix(in oklab, var(--phase-color) 56%, #080808);
  border-radius: var(--radius-sm);
  color: #080808;
  background: color-mix(in oklab, var(--phase-color) 76%, #fffaf0);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.phase-column.is-click-expanded {
  position: fixed;
  top: 2dvh;
  left: 2vw;
  z-index: 1100;
  width: 96vw;
  height: 96dvh;
  min-height: auto;
  max-height: 96dvh;
  overflow: auto;
  transform: none;
  box-shadow:
    0 32px 80px color-mix(in oklab, #000000 34%, transparent),
    0 18px 40px color-mix(in oklab, var(--phase-color) 34%, transparent);
}

.phase-tracker:has(.phase-column.is-click-expanded)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: color-mix(in oklab, var(--color-background) 58%, #000000 30%);
  opacity: 0.84;
  pointer-events: none;
}

.phase-tracker.is-stone-board .phase-column.is-click-expanded {
  width: 96vw;
  height: 96dvh;
  min-height: auto;
  max-height: 96dvh;
}

.phase-column.is-click-expanded .phase-folder-list {
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: var(--space-3);
  max-height: none;
  overflow: visible;
  padding: var(--space-4);
}

.phase-tracker.is-stone-board .phase-column.is-click-expanded .phase-folder-list {
  max-height: none;
  padding: var(--space-4);
}

.phase-column.is-click-expanded .phase-column-header {
  min-height: 4.25rem;
  padding: var(--space-4);
}

.phase-column.is-click-expanded .phase-column-header h3 {
  font-size: clamp(1rem, 1.8vw, 1.6rem);
}

.phase-column.is-click-expanded .phase-column-header small {
  min-width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
}

.phase-column.is-click-expanded .phase-column-metrics {
  gap: 0.28rem;
  /* Keep cost total + folder count clear of the absolute-positioned close button */
  margin-right: 3rem;
}

.phase-column.is-click-expanded .phase-cost-total {
  min-width: 0;
  width: auto;
  height: auto;
  font-size: 1.16rem;
}

.phase-column.is-click-expanded .phase-color-dot {
  width: 0.9rem;
  height: 0.9rem;
}

.phase-column.is-click-expanded .phase-folder-pill {
  min-height: 3rem;
  padding: var(--space-3);
  font-size: 0.92rem;
  line-height: 1.15;
}

.phase-column.is-click-expanded .folder-card {
  min-height: 176px;
}

.phase-column-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.38rem 0.48rem;
  border-bottom: 1px solid color-mix(in oklab, #000000 24%, var(--phase-color));
  color: var(--phase-text);
  background: var(--phase-color);
  font: inherit;
  text-align: left;
}

.phase-column-header:hover {
  filter: saturate(1.08);
}

.phase-color-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--phase-text);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--phase-text) 30%, transparent);
}

.phase-column-header h3 {
  font-size: 0.57rem;
  font-weight: 900;
  line-height: 1.08;
}

.phase-column-header small {
  display: grid;
  place-items: center;
  min-width: 1.12rem;
  height: 1.12rem;
  border-radius: var(--radius-full);
  color: var(--phase-color);
  background: var(--phase-text);
  font-size: 0.58rem;
  font-weight: 900;
}

.phase-folder-list {
  display: grid;
  align-content: start;
  gap: 0.28rem;
  max-height: 3.65rem;
  padding: 0.38rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.phase-folder-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  min-width: 0;
}

.phase-column.is-click-expanded .phase-folder-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.phase-folder-pill {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  padding: 0.3rem 0.38rem;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--color-text);
  background: var(--color-surface-2);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.08;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  transition:
    border-color var(--transition-interactive),
    background var(--transition-interactive),
    transform var(--transition-interactive);
}

[data-theme='dark'] .phase-folder-pill {
  color: #eee5d8;
  background: color-mix(in oklab, #203543 82%, transparent);
  border-color: color-mix(in oklab, #d8cbb8 18%, transparent);
}

.phase-folder-open {
  display: none;
  min-width: 4.75rem;
  padding: 0 var(--space-3);
  border: 1px solid color-mix(in oklab, #000000 38%, transparent);
  border-radius: var(--radius-md);
  color: #000000;
  background: color-mix(in oklab, #ffffff 36%, transparent);
  font-size: 0.78rem;
  font-weight: 900;
  transition:
    border-color var(--transition-interactive),
    background var(--transition-interactive),
    transform var(--transition-interactive);
}

.phase-folder-empty {
  padding: 0.28rem 0.38rem;
  border: 1px dashed var(--color-border);
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  font-size: 0.56rem;
  font-weight: 800;
}

[data-theme='dark'] .phase-folder-empty {
  border-color: color-mix(in oklab, #d8cbb8 20%, transparent);
  color: #c0b29f;
  background: color-mix(in oklab, #203543 58%, transparent);
}

.phase-column.is-click-expanded .phase-folder-open {
  display: inline-grid;
  place-items: center;
}

.phase-folder-open:hover {
  border-color: color-mix(in oklab, #000000 58%, transparent);
  background: color-mix(in oklab, #ffffff 52%, transparent);
  transform: translateY(-1px);
}

.phase-folder-pill:hover,
.phase-folder-pill.is-selected {
  border-color: color-mix(in oklab, #000000 58%, transparent);
  transform: translateY(-1px);
}

.phase-folder-pill:hover {
  background: var(--color-surface-offset);
}

[data-theme='dark'] .phase-folder-pill:hover {
  background: #2a4351;
}

.phase-folder-pill.is-selected {
  box-shadow:
    inset 3px 0 0 var(--phase-color),
    0 0 0 2px color-mix(in oklab, var(--phase-color) 22%, transparent);
}

.team-assignment-bar.phase-folder-pill {
  color: var(--assignment-text);
  background: var(--assignment-color);
  border-color: color-mix(in oklab, #000000 22%, var(--assignment-color));
  box-shadow: inset 4px 0 0 color-mix(in oklab, #000000 18%, transparent);
}

.team-assignment-bar.phase-folder-pill:hover,
.team-assignment-bar.phase-folder-pill.is-selected {
  background: var(--assignment-color);
}

.team-assignment-bar.phase-folder-pill:hover {
  background: color-mix(in oklab, var(--assignment-color) 86%, #ffffff);
}

.team-assignment-bar.phase-folder-pill.is-selected {
  box-shadow:
    inset 4px 0 0 color-mix(in oklab, #000000 22%, transparent),
    0 0 0 2px color-mix(in oklab, #000000 20%, var(--assignment-color));
}

.phase-empty {
  padding: 0.35rem 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.search-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.search-wrap {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.search-wrap svg {
  color: var(--color-text-muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.filter-panel label {
  display: grid;
  gap: 0.22rem;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-panel select {
  width: min(10.5rem, 28vw);
  min-height: 36px;
  padding: 0 2rem 0 0.72rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-2) 76%, transparent);
  font-size: 0.82rem;
  font-weight: 700;
}

.board-search-panel {
  flex: 0 0 auto;
}

.board-search-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.38rem;
}

.board-search-label {
  display: grid;
  gap: 0.12rem;
  color: var(--color-text-muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.board-search-label .search-wrap {
  grid-template-columns: 0.82rem minmax(0, 1fr);
  gap: 0.42rem;
  width: clamp(7.4rem, 11vw, 9.35rem);
  min-height: 30px;
  padding: 0 0.52rem;
  border-radius: var(--radius-full);
  background: color-mix(in oklab, var(--color-surface-2) 76%, transparent);
}

.board-search-label .search-wrap svg {
  width: 0.82rem;
  height: 0.82rem;
}

.board-search-label input {
  font-size: 0.74rem;
  font-weight: 700;
}

.board-filter-panel {
  flex: 0 1 auto;
}

.board-clear-button {
  min-height: 30px;
  align-self: end;
  padding-inline: 0.58rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
}

.stats {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.stats div {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.stats span {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.stats p,
.detail-copy,
.action-note,
.folder-meta dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.text-button {
  padding: 0 var(--space-4);
  color: var(--color-accent);
  background: color-mix(in oklab, var(--color-accent) 9%, transparent);
  font-size: var(--text-sm);
  font-weight: 700;
}

.text-button:hover {
  background: color-mix(in oklab, var(--color-accent) 16%, transparent);
}

.folder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.add-folder-form {
  display: flex;
  gap: var(--space-2);
}

.add-folder-form input,
.rename-folder-form input {
  min-height: 44px;
  width: min(15rem, 48vw);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
}

.rename-folder-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-4);
}

.rename-folder-form input {
  width: min(100%, 18rem);
  flex: 1 1 12rem;
  text-transform: uppercase;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
}

.folder-grid > article {
  display: flex;
}

.construction-section {
  margin-top: var(--space-2);
  width: min(100%, 18.5rem);
  padding: 0.45rem 0.6rem;
  border-top: 1px solid var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
}

.construction-section.is-expanded {
  width: 100%;
  padding: var(--space-2);
}

.construction-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.construction-section.is-expanded .construction-heading {
  margin-bottom: var(--space-2);
}

.construction-heading:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.construction-heading .eyebrow {
  font-size: 0.62rem;
}

.construction-heading h3 {
  font-size: 0.88rem;
  line-height: 1.05;
}

.construction-heading span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 1.2rem;
  height: 1.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  background: var(--color-surface-2);
  font-size: 0.7rem;
  font-weight: 900;
  /* Pin the count circle to the right edge of the heading row so the
     Abandoned folder count sits at the same horizontal position as the
     Active Construction folder count, regardless of title length. */
  margin-left: auto;
}

.construction-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--space-2);
}

.construction-grid[hidden] {
  display: none;
}

.construction-grid .folder-card {
  min-height: 112px;
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.construction-grid .folder-card strong {
  font-size: 0.9rem;
}

.construction-grid .folder-card em,
.construction-grid .folder-card small {
  font-size: 0.72rem;
}

.construction-grid:empty {
  display: none;
}

.construction-empty {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.construction-empty[hidden] {
  display: none;
}

.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 176px;
  height: 100%;
  padding: var(--space-5) var(--space-4) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface));
  box-shadow: var(--shadow-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive),
    border-color var(--transition-interactive);
}

.folder-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: var(--space-4);
  width: 48%;
  height: var(--space-4);
  border: 1px solid var(--color-border);
  border-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--folder-tab-color, var(--color-folder));
}

.folder-card:hover,
.folder-card[aria-pressed='true'] {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--color-folder) 70%, var(--color-border));
  box-shadow: var(--shadow-lg);
}

.folder-card.is-construction::before {
  background: #ffffff;
}

.folder-card.is-completed::before {
  background: #5F7A4E;
}

[data-theme='light'] .folder-card.is-completed::before,
[data-theme='light'] .folder-card.is-completed .mini-track,
[data-theme='light'] .folder-card.is-completed .mini-dot {
  border-color: color-mix(in oklab, #1f2937 22%, transparent);
}

[data-theme='light'] .folder-card.is-construction::before,
[data-theme='light'] .folder-card.is-construction .mini-track,
[data-theme='light'] .folder-card.is-construction .mini-dot {
  border-color: color-mix(in oklab, #1f2937 22%, transparent);
}

.folder-card[aria-pressed='true'] {
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--color-folder) 16%, var(--color-surface-2)),
    var(--color-surface)
  );
}

.project-files-board .folder-card.is-stale {
  animation: staleProjectPulse 4.8s ease-in-out infinite;
  border-color: color-mix(in oklab, var(--folder-tab-color) 48%, var(--color-border));
}

@keyframes staleProjectPulse {
  0%,
  100% {
    box-shadow: var(--shadow-sm);
  }

  50% {
    box-shadow:
      var(--shadow-md),
      0 0 0 4px color-mix(in oklab, var(--folder-tab-color) 18%, transparent);
  }
}

.folder-card strong {
  display: block;
  min-height: 2.4em;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.2;
}

.folder-card em {
  display: block;
  margin-top: var(--space-2);
  color: var(--color-text);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  min-height: 2.4em;
}

.folder-card small {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.folder-card .folder-project-cost {
  color: var(--color-text);
  font-size: 0.72rem;
  font-weight: 900;
}

.mini-timeline {
  position: relative;
  margin-top: var(--space-4);
  height: 0.875rem;
}

.mini-track {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0.375rem;
  transform: translateY(-50%);
  border: 1px solid color-mix(in oklab, var(--color-border) 60%, transparent);
  border-radius: var(--radius-full);
  background: var(--stage-color);
  overflow: hidden;
}

.mini-dot {
  position: absolute;
  top: 50%;
  right: 0;
  width: 0.875rem;
  height: 0.875rem;
  transform: translate(50%, -50%);
  border: 2px solid var(--color-surface);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.24);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  width: 3rem;
  color: var(--color-folder);
}

.detail-panel {
  display: none;
  position: sticky;
  top: var(--space-6);
}

.large-folder {
  display: none;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.4;
  margin: var(--space-5) 0;
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  color: #fff8ea;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--color-folder) 82%, white), var(--color-folder-deep)),
    var(--color-folder);
  box-shadow: inset 0 1px 0 color-mix(in oklab, white 38%, transparent), var(--shadow-md);
}

.large-folder span {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-transform: uppercase;
}

.detail-copy {
  display: none;
  margin: var(--space-2) 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.detail-panel > .rename-folder-form {
  display: none;
}

.detail-panel > .timeline-card,
.detail-panel > .primary-action,
.detail-panel > .contract-action,
.detail-panel > .danger-action,
.detail-panel > .recover-action,
.detail-panel > .action-note {
  display: none;
}

.detail-panel > h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.folder-meta {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.folder-highlights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.folder-meta div {
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.folder-meta dt {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.folder-meta dd {
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.stone-highlight {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-2);
}

.stone-highlight-bar {
  display: block;
  width: 100%;
  height: 0.62rem;
  border: 1px solid color-mix(in oklab, #000000 20%, var(--stone-color));
  border-radius: var(--radius-full);
  background: var(--stone-color);
  box-shadow: inset 0 1px 2px oklch(0 0 0 / 0.18);
}

.stone-highlight-label {
  display: block;
}

.timeline-card {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface-2);
}

.notes-card,
.ownership-card {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid color-mix(in oklab, var(--color-border) 76%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--color-surface-2) 72%, transparent);
}

.ownership-card .notes-header {
  align-items: center;
  margin-bottom: 0.45rem;
}

.ownership-card .eyebrow {
  display: none;
}

.notes-card h2,
.ownership-card h3 {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--section-heading-size);
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ownership-card {
  padding: 0.65rem;
}

.ownership-card .notes-header span {
  padding: 0.22rem 0.48rem;
  font-family: var(--font-body);
  font-size: 0.68rem;
}

.notes-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.notes-header span {
  padding: 0.24rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.notes-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.notes-fields label {
  display: grid;
  gap: 0.18rem;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--field-label-size);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.notes-field-full {
  grid-column: 1 / -1;
}

.notes-card input,
.notes-card textarea,
.ownership-card input,
.ownership-card select {
  width: 100%;
  padding: 0.38rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  background: var(--color-surface);
  font-family: var(--font-body);
  font-size: var(--field-control-size);
  line-height: 1.2;
}

.notes-card input,
.ownership-card input,
.ownership-card select {
  min-height: 1.55rem;
  padding: 0.08rem 0.36rem;
  border-radius: var(--radius-md);
  font-size: var(--field-control-size);
  line-height: 1.1;
}

.notes-card input[type='date'] {
  min-width: 0;
  padding-inline: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.15;
}

.notes-card textarea {
  min-height: 3.8rem;
  resize: vertical;
}

.notes-card textarea::placeholder {
  color: var(--color-text-faint);
}

.ownership-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 0.28rem;
}

.ownership-form label {
  display: grid;
  width: 9.75rem;
  max-width: 100%;
  gap: 0.08rem;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--field-label-size);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.ownership-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.05rem;
}

.ownership-actions .text-button {
  min-height: 1.45rem;
  padding: 0 0.45rem;
  font-family: var(--font-body);
  font-size: var(--field-control-size);
  font-weight: 800;
}

.integration-link-row {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: start;
  gap: 0.22rem;
  margin: -0.15rem 0 var(--space-4);
  padding: 0.32rem 0.38rem;
  border: 1px solid color-mix(in oklab, var(--color-border) 70%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--color-surface-2) 48%, transparent);
}

.integration-link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  width: 8.75rem;
  min-height: 1.45rem;
  padding: 0 0.45rem;
  border: 1px solid color-mix(in oklab, var(--color-border) 84%, transparent);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface) 82%, transparent);
  font-family: var(--font-body);
  font-size: var(--field-control-size);
  font-weight: 800;
  cursor: not-allowed;
  opacity: 0.78;
}

.integration-link-button img {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.18rem;
  flex: 0 0 auto;
}

.text-button.secondary {
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

#timeline-title {
  font-size: clamp(1.75rem, 2.8vw, 2.7rem);
  line-height: 1;
}

.stage-pill {
  max-width: 45%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in oklab, var(--color-border) 60%, transparent);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.timeline-control {
  position: relative;
  height: 3.125rem;
  margin: 0 var(--space-2) var(--space-3);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.client-review-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  margin: 0 0 var(--space-3) var(--space-2);
  padding: 0 var(--space-3);
  border: 1px solid color-mix(in oklab, var(--color-border) 86%, transparent);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface-2) 70%, #8b8f96);
  font-family: var(--font-body);
  font-size: var(--field-control-size);
  font-weight: 900;
  transition:
    background var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

.client-review-button:hover {
  transform: translateY(-1px);
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-2) 50%, #b5b7bb);
}

.client-review-button.is-active {
  border-color: color-mix(in oklab, #ffffff 72%, var(--color-border));
  color: #1f2937;
  background: #ffffff;
  box-shadow: 0 0 0 3px color-mix(in oklab, #ffffff 28%, transparent);
}

.timeline-control.is-dragging {
  cursor: grabbing;
}

.timeline-track {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0.85rem;
  transform: translateY(-50%);
  border: 1px solid color-mix(in oklab, var(--color-border) 70%, transparent);
  border-radius: var(--radius-full);
  background: var(--timeline-gradient);
  box-shadow: inset 0 1px 3px oklch(0 0 0 / 0.18);
  pointer-events: none;
}

.timeline-marker {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  transform: translate(-50%, -50%);
  border: 3px solid var(--color-surface);
  border-radius: 0.9rem;
  box-shadow: 0 12px 24px oklch(0 0 0 / 0.3);
  cursor: grab;
  pointer-events: auto;
  transition:
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

.timeline-control.is-dragging .timeline-marker {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 16px 30px oklch(0 0 0 / 0.36);
}

.timeline-marker::after {
  content: '';
  position: absolute;
  inset: -0.55rem;
  border-radius: 1.3rem;
}

.timeline-marker-number {
  font-family: var(--font-highland-gothic);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transform: translateY(-0.02em);
  text-shadow: 0 1px 1px color-mix(in oklab, #ffffff 28%, transparent);
}

.timeline-date-badge {
  position: absolute;
  top: 100%;
  z-index: 4;
  min-width: max-content;
  padding: 0.25rem 0.5rem;
  transform: translateX(-50%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.7rem;
  font-weight: 800;
  pointer-events: none;
}

.timeline-date-badge[hidden] {
  display: none;
}

.timeline-tooltip {
  position: absolute;
  bottom: calc(100% + 0.65rem);
  z-index: 8;
  max-width: min(18rem, 70vw);
  padding: 0.5rem 0.7rem;
  transform: translateX(-50%);
  border: 2px solid var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 30px oklch(0 0 0 / 0.24);
  font-size: var(--text-xs);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  pointer-events: none;
}

.timeline-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  transform: translate(-50%, -52%) rotate(45deg);
  border-right: 2px solid var(--color-surface);
  border-bottom: 2px solid var(--color-surface);
  background: inherit;
}

.timeline-tooltip[hidden] {
  display: none;
}

.timeline-range {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: grab;
}

.timeline-range:active {
  cursor: grabbing;
}

.stamp-summary {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 700;
}

.phase-history {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.phase-history-heading {
  margin-bottom: var(--space-3);
}

.phase-history-heading h3 {
  font-size: 0.78rem;
}

.clear-other-dates {
  min-height: 1.9rem;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-accent);
  background: color-mix(in oklab, var(--color-accent) 8%, var(--color-surface));
  font-size: 0.62rem;
  font-weight: 900;
  transition:
    background var(--transition-interactive),
    transform var(--transition-interactive);
}

.clear-other-dates:hover {
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--color-accent) 14%, var(--color-surface));
}

.phase-history-list {
  display: grid;
  gap: var(--space-2);
  max-height: clamp(12rem, 27vh, 18rem);
  margin-bottom: var(--space-4);
  padding-right: 0.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.phase-history-empty {
  color: var(--color-text-muted);
  font-size: 0.64rem;
  font-weight: 700;
}

.phase-history-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(8.75rem, auto);
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid color-mix(in oklab, var(--phase-color) 20%, var(--color-border));
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--phase-color) 6%, transparent);
  font-size: 0.64rem;
  line-height: 1.2;
}

.phase-history-row.is-reached {
  color: var(--color-text);
  background: color-mix(in oklab, var(--phase-color) 12%, var(--color-surface));
}

.phase-dot {
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid color-mix(in oklab, var(--color-border) 70%, transparent);
  border-radius: var(--radius-full);
  background: var(--phase-color);
}

.phase-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-name small {
  display: block;
  margin-top: 0.12rem;
  color: var(--color-text-muted);
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1.15;
}

.phase-date {
  color: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.phase-date-editor input {
  min-height: 2rem;
  width: 100%;
  padding: 0 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  padding: 0 var(--space-5);
  color: var(--color-surface);
  background: var(--color-accent);
  font-weight: 700;
}

[data-theme='dark'] .primary-action {
  color: #12201d;
}

.primary-action:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.contract-action,
.danger-action,
.recover-action,
.completed-action {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-2);
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklab, var(--color-border) 86%, transparent);
  color: var(--color-text-muted);
  background: color-mix(in oklab, var(--color-surface-2) 70%, #8b8f96);
  font-family: var(--font-body);
  font-size: var(--field-control-size);
  font-weight: 900;
  transition:
    background var(--transition-interactive),
    transform var(--transition-interactive);
}

.contract-action {
  background: color-mix(in oklab, var(--color-surface-2) 70%, #8b8f96);
}

.danger-action {
  background: color-mix(in oklab, var(--color-surface-2) 70%, #8b8f96);
}

.recover-action {
  color: #ffffff;
  background: #7c3aed;
}

.completed-action {
  color: #ffffff;
  background: #5F7A4E;
  border-color: #5F7A4E;
}

.completed-action:hover {
  background: #4d6440;
  transform: translateY(-1px);
}

.completed-action.is-active {
  border-color: color-mix(in oklab, #ffffff 72%, var(--color-border));
  color: #ffffff;
  background: #4d6440;
  box-shadow: 0 0 0 3px color-mix(in oklab, #5F7A4E 28%, transparent);
}

.contract-action:hover {
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-2) 50%, #b5b7bb);
  transform: translateY(-1px);
}

.danger-action:hover {
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-2) 50%, #b5b7bb);
  transform: translateY(-1px);
}

.contract-action.is-active,
.danger-action.is-active {
  border-color: color-mix(in oklab, #ffffff 72%, var(--color-border));
  color: #1f2937;
  background: #ffffff;
  box-shadow: 0 0 0 3px color-mix(in oklab, #ffffff 28%, transparent);
}

.recover-action:hover {
  background: #6d28d9;
  transform: translateY(-1px);
}

.contract-action[hidden],
.danger-action[hidden],
.recover-action[hidden],
.completed-action[hidden] {
  display: none;
}

.action-note {
  min-height: 1.5rem;
  margin-top: var(--space-3);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .controls-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: var(--space-4);
  }

  .topbar,
  .section-heading.row {
    align-items: flex-start;
  }

  .header-tracker-bar {
    width: min(100%, 22rem);
  }

  .board-toolbar,
  .section-heading.row,
  .folder-actions,
  .add-folder-form {
    flex-direction: column;
  }

  .board-toolbar,
  .board-tools,
  .board-search-row,
  .board-search-panel,
  .board-clear-button,
  .board-filter-panel,
  .filter-panel,
  .filter-panel label,
  .filter-panel select {
    width: 100%;
  }

  .board-tools {
    align-items: stretch;
    justify-content: stretch;
    margin-left: 0;
  }

  .board-search-row {
    align-items: stretch;
    justify-content: stretch;
  }

  .board-search-label,
  .board-search-label .search-wrap {
    width: 100%;
  }

  .board-clear-button {
    align-self: stretch;
  }

  .board-filter-panel {
    margin-left: 0;
  }

  .filter-panel {
    justify-content: stretch;
  }

  .folder-actions,
  .add-folder-form,
  .add-folder-form input {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  }

  .notes-fields {
    grid-template-columns: 1fr;
  }

  .folder-highlights {
    grid-template-columns: 1fr;
  }

  .stage-pill {
    max-width: 52%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Abandon-project popover ===== */
.abandon-anchor {
  position: relative;
  display: inline-block;
}

.abandon-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface, #ffffff);
  color: var(--ink, #1f2937);
  border: 1px solid rgba(120, 120, 120, 0.18);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 38, 0.22), 0 2px 6px rgba(15, 23, 38, 0.08);
  padding: 14px 16px 16px;
  font-family: inherit;
  animation: abandon-popover-in 140ms ease-out;
}

@keyframes abandon-popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .abandon-popover {
  background: #1c2a35;
  color: #eee5d8;
  border-color: rgba(255, 255, 255, 0.1);
}

.abandon-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid rgba(120, 120, 120, 0.18);
  border-top: 1px solid rgba(120, 120, 120, 0.18);
  transform: rotate(45deg);
}

[data-theme="dark"] .abandon-popover::before {
  border-color: rgba(255, 255, 255, 0.1);
}

.abandon-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.abandon-popover-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #9a3f34;
}

[data-theme="dark"] .abandon-popover-header h3 {
  color: #e08b7d;
}

.abandon-popover-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 2px 6px;
  border-radius: 6px;
  opacity: 0.65;
  transition: opacity 120ms ease, background 120ms ease;
}

.abandon-popover-close:hover,
.abandon-popover-close:focus-visible {
  opacity: 1;
  background: rgba(120, 120, 120, 0.12);
  outline: none;
}

.abandon-popover-label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: inherit;
  opacity: 0.85;
}

.abandon-popover textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid rgba(120, 120, 120, 0.3);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 64px;
  background: var(--surface, #ffffff);
  color: inherit;
}

[data-theme="dark"] .abandon-popover textarea {
  background: #16222c;
  border-color: rgba(255, 255, 255, 0.15);
}

.abandon-popover textarea:focus {
  outline: none;
  border-color: #9a3f34;
  box-shadow: 0 0 0 2px rgba(154, 63, 52, 0.18);
}

.abandon-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.abandon-popover-cancel,
.abandon-popover-confirm {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

.abandon-popover-cancel {
  background: transparent;
  color: inherit;
  border-color: rgba(120, 120, 120, 0.3);
}

.abandon-popover-cancel:hover {
  background: rgba(120, 120, 120, 0.1);
}

.abandon-popover-confirm {
  background: #9a3f34;
  color: #ffffff;
  border-color: #9a3f34;
}

.abandon-popover-confirm:hover {
  background: #7c2f26;
  border-color: #7c2f26;
}

.abandon-popover-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Full-screen stone close button ===== */
.stone-close-button {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 1200;
  display: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-border, rgba(120,120,120,0.3));
  border-radius: 999px;
  color: var(--phase-text, var(--color-text, #1f2937));
  background: color-mix(in oklab, var(--phase-color, #ffffff) 84%, #ffffff 16%);
  box-shadow: 0 2px 6px rgba(15, 23, 38, 0.18);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.phase-column.is-click-expanded .stone-close-button {
  display: grid;
}

.stone-close-button:hover,
.stone-close-button:focus-visible {
  outline: none;
  transform: scale(1.06);
  background: color-mix(in oklab, var(--phase-color, #ffffff) 60%, #ffffff 40%);
  box-shadow: 0 4px 12px rgba(15, 23, 38, 0.28);
}

/* ============================================================
   Stone Screen Portal
   When a stone column is expanded, the JS moves it into a
   body-level <div id="stone-screen-portal"> so position:fixed
   escapes the .sales-tracker-panel backdrop-filter containing block.
   ============================================================ */
#stone-screen-portal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

#stone-screen-portal::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  background: color-mix(in oklab, var(--color-background) 58%, #000000 30%);
  opacity: 0.84;
  pointer-events: auto;
}

#stone-screen-portal .phase-column.is-click-expanded {
  position: fixed;
  top: 2dvh;
  left: 2vw;
  width: 96vw;
  height: 96dvh;
  min-height: auto;
  max-height: 96dvh;
  overflow: auto;
  transform: none;
  z-index: 2;
  pointer-events: auto;
  /* re-apply background/border so the column stays styled outside its panel ancestors */
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 18px);
  box-shadow:
    0 32px 80px color-mix(in oklab, #000000 34%, transparent),
    0 18px 40px color-mix(in oklab, var(--phase-color) 34%, transparent);
}

/* Hide the in-page backdrop overlay when the portal is active (portal has its own) */
body.has-stone-portal .phase-tracker:has(.phase-column.is-click-expanded)::before,
body.has-stone-portal .sales-tracker-panel:has(.phase-column.is-click-expanded)::before {
  display: none;
}

/* ============================================================
   Drag-and-drop: advance projects between stones
   ============================================================ */
.folder-card[draggable="true"],
.phase-folder-pill[draggable="true"],
.phase-folder-item[draggable="true"] {
  cursor: grab;
}

.folder-card.is-dragging,
.phase-folder-pill.is-dragging,
.phase-folder-item.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

body.is-dragging-folder .phase-column {
  transition: outline-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.phase-column.is-drop-target {
  outline: 3px dashed color-mix(in oklab, var(--phase-color, #2c5f8d) 70%, #ffffff 30%);
  outline-offset: -6px;
  background: color-mix(in oklab, var(--phase-color, #2c5f8d) 14%, transparent);
  transform: translateY(-2px);
}

.phase-column.is-drop-target .phase-column-header {
  background: color-mix(in oklab, var(--phase-color, #2c5f8d) 30%, #ffffff 30%);
}

/* ===== Delete-project popover (variant of abandon) ===== */
/* Inherits .abandon-popover layout, animation, and dark-mode rules.
   Differentiates with a slate header color + dashed border to signal
   "permanent removal" vs. abandon's brick-red "shelved/closed" tone. */
.abandon-popover.delete-popover {
  border-style: dashed;
  border-color: rgba(60, 70, 90, 0.28);
}

[data-theme="dark"] .abandon-popover.delete-popover {
  border-color: rgba(255, 255, 255, 0.18);
}

.delete-popover .abandon-popover-header h3 {
  color: #3c4656;
}

[data-theme="dark"] .delete-popover .abandon-popover-header h3 {
  color: #cfd6e0;
}

.delete-popover textarea:focus {
  border-color: #3c4656;
  box-shadow: 0 0 0 2px rgba(60, 70, 90, 0.18);
}

.delete-popover .abandon-popover-confirm {
  background: #3c4656;
  border-color: #3c4656;
}

.delete-popover .abandon-popover-confirm:hover {
  background: #2a323f;
  border-color: #2a323f;
}

/* Subtle separator between Abandon and Delete buttons in the action row */
.delete-action {
  margin-left: 0.35rem;
}

/* --- Stone view: assignee initials chip on project pills --- */
.phase-tracker.is-stone-board .phase-folder-pill {
  /* Use more horizontal space — keep size/font the same elsewhere */
  padding-left: 0.22rem;
  padding-right: 0.22rem;
}
.phase-folder-pill {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  justify-content: space-between;
}
.phase-folder-pill-name {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  /* Wrap only on whitespace — take the whole word to the next line.
     Never break inside a word and never insert a hyphen. */
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  white-space: normal;
}
.phase-folder-pill-initials {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  /* Tight chip — hugs the initials so we recover horizontal space */
  min-width: 0;
  height: 1.05rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: color-mix(in oklab, #f4ead7 92%, transparent);
  color: #1c2a33;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 1px solid color-mix(in oklab, #000 28%, transparent);
  box-shadow: 0 1px 0 color-mix(in oklab, #000 18%, transparent);
}
.phase-folder-pill-initials.is-unassigned {
  background: color-mix(in oklab, #b8a895 80%, transparent);
  color: #2b2018;
  border-color: color-mix(in oklab, #000 22%, transparent);
}
/* When expanded, pill is hidden and folder-cards take over — no extra rule needed. */

/* --- Stones 4-12 total panel (right of the closed sections in folders-panel) --- */
.closed-sections-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-start;
  margin-top: var(--space-2);
}
.closed-sections-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 0 0 auto;
  width: min(100%, 18.5rem);
}
.closed-sections-stack .construction-section {
  margin-top: 0;
}
.stones-total-panel {
  flex: 1 1 18rem;
  min-width: 14rem;
  align-self: stretch;
  padding: var(--space-5) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.stones-total-panel[hidden] {
  display: none;
}
.stones-total-value {
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--color-text, #1c2a33);
  font-variant-numeric: tabular-nums;
}
.stones-total-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--color-text, #1c2a33) 72%, transparent);
}

/* --- CL chip on stone view: client-court styling + urgent escalation --- */
/* Neutral CL chip (1-14 days): soft sand/teal so it reads distinct from team initials */
.phase-folder-pill-initials.is-client {
  background: color-mix(in oklab, #cde2dc 95%, transparent);
  color: #16363a;
  border-color: color-mix(in oklab, #16363a 38%, transparent);
}
/* Urgent CL chip (>14 days): brick/red so it draws the eye */
.phase-folder-pill-initials.is-client.is-urgent {
  background: color-mix(in oklab, #c0392b 92%, transparent);
  color: #fff5ec;
  border-color: color-mix(in oklab, #000 35%, transparent);
  box-shadow:
    0 1px 0 color-mix(in oklab, #000 22%, transparent),
    0 0 0 2px color-mix(in oklab, #c0392b 30%, transparent);
  animation: pillUrgentPulse 2.4s ease-in-out infinite;
}
@keyframes pillUrgentPulse {
  0%, 100% { box-shadow: 0 1px 0 color-mix(in oklab, #000 22%, transparent), 0 0 0 2px color-mix(in oklab, #c0392b 30%, transparent); }
  50%      { box-shadow: 0 1px 0 color-mix(in oklab, #000 22%, transparent), 0 0 0 4px color-mix(in oklab, #c0392b 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .phase-folder-pill-initials.is-client.is-urgent { animation: none; }
}

