/* ============================================================================
   CineScale CRM — app.css
   Components only. Every value comes from tokens.css. Hairlines beat shadows.
   Square corners almost everywhere. ease-cine at 320ms is the default.
   ============================================================================ */

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

html, body { height: 100%; }
body { overflow: hidden; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--cs-cream); color: var(--cs-ink); }

/* ---------------------------------------------------------------- scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--cs-cream-40) transparent; }

/* ------------------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 100vh;
  height: 100vh;
}

/* ------------------------------------------------------------------ sidebar */
.sidebar {
  border-right: var(--cs-hairline);
  display: flex;
  flex-direction: column;
  padding: var(--cs-s-5) 0;
  min-height: 0;
}
.sidebar__brand {
  padding: 0 var(--cs-s-5) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.sidebar__brand img { width: 148px; display: block; }
.sidebar__brand .cs-caption { margin-top: var(--cs-s-2); }

.sidebar__nav { flex: 1; padding: var(--cs-s-5) 0; overflow-y: auto; }
.sidebar__group { margin-bottom: var(--cs-s-5); }
.sidebar__group-label {
  padding: 0 var(--cs-s-5);
  margin-bottom: var(--cs-s-3);
  color: var(--cs-fg-subtle);
  display: flex;
  align-items: center;
  gap: var(--cs-s-2);
}
.sidebar__group-label::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--cs-cream);
  display: inline-block;
}
.nav-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  padding: var(--cs-s-2) var(--cs-s-5);
  font-size: var(--cs-fs-small);
  font-weight: 400;
  color: var(--cs-fg-muted);
  text-align: left;
  transition: color var(--cs-dur-fast) var(--cs-ease-cine),
              background var(--cs-dur-fast) var(--cs-ease-cine);
}
.nav-item:hover { color: var(--cs-fg); }
.nav-item.active {
  color: var(--cs-fg);
  font-weight: 600;
  background: var(--cs-bg-elev);
  box-shadow: inset 2px 0 0 var(--cs-cream);
}
.nav-item .count {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-subtle);
}

.sidebar__foot {
  border-top: var(--cs-hairline);
  padding: var(--cs-s-4) var(--cs-s-5) 0;
}

/* ------------------------------------------------------------------- topbar */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: var(--cs-s-5);
  padding: var(--cs-s-4) var(--cs-gutter);
  border-bottom: var(--cs-hairline);
}
.topbar__search { position: relative; flex: 1; max-width: 460px; }
.topbar__search input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cs-border-faint);
  padding: var(--cs-s-2) 0;
  font-size: var(--cs-fs-small);
  color: var(--cs-fg);
  transition: border-color var(--cs-dur-base) var(--cs-ease-cine);
}
.topbar__search input::placeholder { color: var(--cs-fg-subtle); }
.topbar__search input:focus { outline: none; border-bottom: 2px solid var(--cs-focus-ring); }
.topbar__meta { margin-left: auto; display: flex; align-items: center; gap: var(--cs-s-4); }

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  box-shadow: var(--cs-shadow-2);
  z-index: 60;
  max-height: 380px;
  overflow-y: auto;
}
.search-results__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: var(--cs-s-3) var(--cs-s-4);
  border-bottom: var(--cs-hairline);
  font-size: var(--cs-fs-small);
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.search-results__item:last-child { border-bottom: none; }
.search-results__item:hover { background: var(--cs-bg-elev-2); }
.search-results__empty { padding: var(--cs-s-4); color: var(--cs-fg-subtle); font-size: var(--cs-fs-small); }

/* --------------------------------------------------------------------- view */
.view {
  flex: 1;
  overflow-y: auto;
  padding: var(--cs-s-6) var(--cs-gutter) var(--cs-s-9);
  animation: view-in var(--cs-dur-slow) var(--cs-ease-cine);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--cs-s-5);
  margin-bottom: var(--cs-s-6);
}
.view-head__title h1 {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h1);
  font-weight: 400;
  line-height: var(--cs-lh-heading);
  letter-spacing: var(--cs-ls-display);
}
.view-head__title h1 em { font-style: italic; }
.view-head__title .cs-eyebrow {
  color: var(--cs-fg-subtle);
  display: flex;
  align-items: center;
  gap: var(--cs-s-2);
  margin-bottom: var(--cs-s-3);
}
.view-head__title .cs-eyebrow::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--cs-cream);
}
.view-head__actions { display: flex; gap: var(--cs-s-3); align-items: center; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--cs-s-2);
  padding: 10px var(--cs-s-4);
  font-size: var(--cs-fs-small);
  font-weight: 600;
  border-radius: var(--cs-radius-0);
  transition: background var(--cs-dur-base) var(--cs-ease-cine),
              color var(--cs-dur-base) var(--cs-ease-cine),
              border-color var(--cs-dur-base) var(--cs-ease-cine);
}
.btn[hidden] { display: none; }
.btn .arrow { display: inline-block; transition: transform var(--cs-dur-fast) var(--cs-ease-cine); }
.btn:hover .arrow { transform: translateX(4px); }

.btn--primary { background: var(--cs-cream); color: var(--cs-ink); }
.btn--primary:hover { background: var(--cs-cream-95); }

.btn--ghost { border: 1px solid var(--cs-border); color: var(--cs-fg); background: transparent; }
.btn--ghost:hover { border-color: var(--cs-cream); }

.btn--bare {
  padding: var(--cs-s-1) 0;
  color: var(--cs-fg-muted);
  font-weight: 600;
  border-bottom: 1px solid transparent;
}
.btn--bare:hover { color: var(--cs-fg); border-bottom-color: var(--cs-cream); }

.btn--sm { padding: 6px var(--cs-s-3); font-size: var(--cs-fs-caption); }
.btn--bare.btn--sm { padding: var(--cs-s-1) 0; }

.btn--danger { border: 1px solid var(--cs-border); color: var(--cs-fg-subtle); }
.btn--danger:hover { border-color: var(--cs-cream); color: var(--cs-fg); }

.btn:focus-visible { outline: none; box-shadow: 0 2px 0 var(--cs-focus-ring); }

/* -------------------------------------------------------------------- chips */
.chip {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-pill);
  font-size: var(--cs-fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-muted);
  white-space: nowrap;
}
.chip--invert { background: var(--cs-cream); color: var(--cs-ink); border-color: var(--cs-cream); }
.chip--muted { color: var(--cs-fg-subtle); border-color: var(--cs-border-faint); }
/* Quiet emphasis — signed, without shouting it like an invert chip. */
.chip--on { color: var(--cs-cream); border-color: var(--cs-cream-40); }
h1 .chip { vertical-align: middle; margin-left: var(--cs-s-3); }

/* filter pills */
.pills { display: flex; gap: var(--cs-s-2); flex-wrap: wrap; }
.pill {
  padding: 5px 14px;
  border: 1px solid var(--cs-border-faint);
  border-radius: var(--cs-radius-pill);
  font-size: var(--cs-fs-caption);
  font-weight: 600;
  color: var(--cs-fg-muted);
  transition: all var(--cs-dur-fast) var(--cs-ease-cine);
}
.pill:hover { border-color: var(--cs-border); color: var(--cs-fg); }
.pill.active { background: var(--cs-cream); color: var(--cs-ink); border-color: var(--cs-cream); }

/* Larger pills — the line-of-business switcher in the topbar. */
.pill--lg {
  padding: 9px 22px;
  font-size: var(--cs-fs-small);
  border-color: var(--cs-border);
}

/* -------------------------------------------------------------------- stats */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: var(--cs-hairline);
  margin-bottom: var(--cs-s-6);
}
.stat {
  padding: var(--cs-s-5);
  border-right: var(--cs-hairline);
}
.stat:last-child { border-right: none; }
.stat .cs-eyebrow { color: var(--cs-fg-subtle); margin-bottom: var(--cs-s-3); display: block; }
.stat__value {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h2);
  line-height: var(--cs-lh-heading);
  letter-spacing: var(--cs-ls-display);
}
.stat__value em { font-style: italic; }
.stat__note { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); margin-top: var(--cs-s-2); }

/* -------------------------------------------------------------------- cards */
.panel { border: var(--cs-hairline); }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cs-s-4) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.panel__head .cs-eyebrow { color: var(--cs-fg-subtle); }
.panel__body { padding: var(--cs-s-5); }
.panel__body--flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cs-col-gap); align-items: start; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: var(--cs-col-gap); align-items: start; }

/* ------------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: var(--cs-s-3) var(--cs-s-5);
  font-size: var(--cs-fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-subtle);
  border-bottom: 1px solid var(--cs-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.table th .dir { font-family: var(--cs-font-mono); margin-left: 4px; }
.table td {
  padding: var(--cs-s-3) var(--cs-s-5);
  font-size: var(--cs-fs-small);
  border-bottom: var(--cs-hairline);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--cs-dur-fast) var(--cs-ease-cine); cursor: pointer; }
.table tbody tr:hover { background: var(--cs-bg-elev); }
.table .mono { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-muted); }
.table .strong { font-weight: 600; color: var(--cs-fg); }
.table .muted { color: var(--cs-fg-subtle); }
.table .num { text-align: right; }

.empty {
  padding: var(--cs-s-8) var(--cs-s-5);
  text-align: center;
  color: var(--cs-fg-subtle);
}
.empty .cs-display-3 { font-size: var(--cs-fs-h3); font-style: italic; color: var(--cs-fg-muted); margin-bottom: var(--cs-s-3); }

/* ------------------------------------------------------------------- kanban */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(212px, 1fr);
  gap: 0;
  border: var(--cs-hairline);
  min-height: 60vh;
  overflow-x: auto;
}
.kanban__col { border-right: var(--cs-hairline); display: flex; flex-direction: column; min-width: 0; }
.kanban__col:last-child { border-right: none; }
.kanban__col-head {
  padding: var(--cs-s-4);
  border-bottom: var(--cs-hairline);
}
.kanban__col-head .cs-eyebrow { color: var(--cs-fg); display: block; margin-bottom: var(--cs-s-2); }
.kanban__col-head .totals { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); }
.kanban__cards { flex: 1; padding: var(--cs-s-3); display: flex; flex-direction: column; gap: var(--cs-s-3); min-height: 120px; }
.kanban__col.drag-over .kanban__cards { background: var(--cs-bg-elev); }

.deal-card {
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  border-radius: var(--cs-radius-3);
  padding: var(--cs-s-4);
  cursor: grab;
  transition: border-color var(--cs-dur-fast) var(--cs-ease-cine),
              background var(--cs-dur-fast) var(--cs-ease-cine);
}
.deal-card:hover { border-color: var(--cs-border); background: var(--cs-bg-elev-2); }
.deal-card.dragging { opacity: 0.4; }
.deal-card__name { font-size: var(--cs-fs-small); font-weight: 600; margin-bottom: var(--cs-s-1); }
.deal-card__company { font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); margin-bottom: var(--cs-s-3); }
.deal-card__pulse {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--cs-s-2);
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  color: var(--cs-fg-subtle);
  padding-bottom: var(--cs-s-3);
  margin-bottom: var(--cs-s-3);
  border-bottom: var(--cs-hairline);
}
.deal-card__age, .deal-card__next, .deal-card__reason { white-space: nowrap; }
.deal-card__reason { white-space: normal; }
.deal-card__next.is-none, .deal-card__reason.is-none { font-style: italic; opacity: 0.7; }
.deal-card__foot { display: flex; justify-content: space-between; align-items: baseline; }
.deal-card__value { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-muted); }
.deal-card__date { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); }

/* Late, or sat too long — same quiet underline the task rows use.
   Always on an inline element, so the rule underlines the words and not
   the whole grid cell it sits in. */
.deal-card__next.overdue, .deal-card__age.stale,
.def-list dd .overdue, .def-list dd .stale, .cs-caption .stale {
  color: var(--cs-fg);
  border-bottom: 1px solid var(--cs-accent);
  font-weight: 500;
}

/* ------------------------------------------------------------ project board */
.kanban--projects { grid-auto-columns: minmax(196px, 1fr); }
.kanban__add {
  margin: 0 var(--cs-s-3) var(--cs-s-3);
  padding: var(--cs-s-2);
  border: 1px dashed var(--cs-border-faint);
  font-size: var(--cs-fs-caption);
  font-weight: 600;
  color: var(--cs-fg-subtle);
  transition: color var(--cs-dur-fast) var(--cs-ease-cine),
              border-color var(--cs-dur-fast) var(--cs-ease-cine);
}
.kanban__add:hover { color: var(--cs-fg); border-color: var(--cs-border); }

.proj-card {
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  padding: var(--cs-s-4);
  cursor: grab;
  transition: border-color var(--cs-dur-fast) var(--cs-ease-cine),
              background var(--cs-dur-fast) var(--cs-ease-cine);
}
.proj-card:hover { border-color: var(--cs-border); background: var(--cs-bg-elev-2); }
.proj-card.dragging { opacity: 0.4; }
.proj-card.done { opacity: 0.55; }
.proj-card.done .proj-card__title { text-decoration: line-through; }
.proj-card__title { font-size: var(--cs-fs-small); font-weight: 600; }
.proj-card__desc {
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-subtle);
  margin-top: var(--cs-s-1);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--cs-s-2);
  margin-top: var(--cs-s-3);
}
/* Wraps as whole pieces — a date broken across two lines reads as two dates. */
.proj-card__when { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--cs-s-2); min-width: 0; }
.proj-card__due { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); white-space: nowrap; }
.proj-card__due.overdue { color: var(--cs-fg); border-bottom: 1px solid var(--cs-accent); font-weight: 500; }
/* The estimate rides beside the deadline, boxed so hours never read as a date. */
.proj-card__est {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  color: var(--cs-fg-muted);
  border: 1px solid var(--cs-border-faint);
  padding: 1px 6px;
  white-space: nowrap;
}
.proj-card__who { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-muted); white-space: nowrap; }

/* ------------------------------------------------------- outsourced board
   Sections by person, not by column — one block per pair of hands. */
.out-group { border: var(--cs-hairline); margin-bottom: var(--cs-s-5); }
.out-group.drag-over { border-color: var(--cs-border); background: var(--cs-bg-elev); }
.out-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cs-s-4);
  padding: var(--cs-s-4) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.out-group__who { display: flex; align-items: baseline; gap: var(--cs-s-3); min-width: 0; }
.out-group__head .cs-eyebrow { color: var(--cs-fg); }
.out-group__title { font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); }
.out-group__count { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); white-space: nowrap; }
.out-group__add { display: block; width: calc(100% - var(--cs-s-5) * 2); margin: var(--cs-s-3) var(--cs-s-5); }

.out-row {
  display: grid;
  grid-template-columns: 1fr auto 168px 56px 112px;
  align-items: center;
  gap: var(--cs-s-4);
  padding: var(--cs-s-3) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
  cursor: grab;
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.out-row:last-child { border-bottom: none; }
.out-row:hover { background: var(--cs-bg-elev); }
.out-row.dragging { opacity: 0.4; }
.out-row.done { opacity: 0.55; }
.out-row.done .out-row__title { text-decoration: line-through; }
.out-row__main { min-width: 0; }
.out-row__title { font-size: var(--cs-fs-small); font-weight: 600; }
.out-row__desc {
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-subtle);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.out-row__from { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); white-space: nowrap; }
.out-row__est {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  color: var(--cs-fg-muted);
  text-align: right;
  justify-self: end;
  white-space: nowrap;
}
.out-row__due {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  color: var(--cs-fg-subtle);
  text-align: right;
  justify-self: end;
  white-space: nowrap;
}
.out-row__due.overdue { color: var(--cs-fg); border-bottom: 1px solid var(--cs-accent); font-weight: 500; }
.out-row__status {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cs-border-faint);
  padding: 4px 18px 4px 2px;
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-muted);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cs-cream-60) 50%),
                    linear-gradient(135deg, var(--cs-cream-60) 50%, transparent 50%);
  background-position: calc(100% - 8px) 50%, calc(100% - 3px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color var(--cs-dur-fast) var(--cs-ease-cine), color var(--cs-dur-fast) var(--cs-ease-cine);
}
.out-row__status:hover { color: var(--cs-fg); border-bottom-color: var(--cs-border); }
.out-row__status:focus { outline: none; border-bottom-color: var(--cs-border); }

/* The rest of the team — drop a card on a name, or click to write one. */
.out-handoff { display: flex; align-items: center; justify-content: space-between; gap: var(--cs-s-4); flex-wrap: wrap; margin-top: var(--cs-s-5); }
.out-handoff__names { display: flex; gap: var(--cs-s-3); flex-wrap: wrap; }
.out-chip {
  padding: var(--cs-s-2) var(--cs-s-4);
  border: 1px dashed var(--cs-border-faint);
  font-size: var(--cs-fs-caption);
  font-weight: 600;
  color: var(--cs-fg-subtle);
  transition: color var(--cs-dur-fast) var(--cs-ease-cine),
              border-color var(--cs-dur-fast) var(--cs-ease-cine);
}
.out-chip:hover, .out-chip.drag-over { color: var(--cs-fg); border-color: var(--cs-border); border-style: solid; }

/* ------------------------------------------------------- people on a lead
   Several names at one company — the row reads as a person, not a record. */
.lead-person {
  display: flex;
  align-items: center;
  gap: var(--cs-s-4);
  padding: var(--cs-s-3) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
  cursor: pointer;
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.lead-person:last-child { border-bottom: none; }
.lead-person:hover { background: var(--cs-bg-elev); }
.lead-person__who { flex: 1; min-width: 0; }
.lead-person__reach { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.lead-person__reach a { color: var(--cs-fg-subtle); }
.lead-person__reach a:hover { color: var(--cs-fg); }
.is-viewer .lead-person { cursor: default; }

/* A block of fields inside a form that belongs to something else. */
.sub-form {
  margin-top: var(--cs-s-5);
  padding-top: var(--cs-s-5);
  border-top: var(--cs-hairline);
}
.sub-form .cs-eyebrow { display: block; color: var(--cs-fg-subtle); margin-bottom: var(--cs-s-2); }

/* -------------------------------------------------------------------- forms */
.field { margin-bottom: var(--cs-s-4); }
.field label {
  display: block;
  font-size: var(--cs-fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-subtle);
  margin-bottom: var(--cs-s-2);
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  border-radius: var(--cs-radius-1);
  padding: 10px var(--cs-s-3);
  font-size: var(--cs-fs-small);
  color: var(--cs-fg);
  transition: border-color var(--cs-dur-base) var(--cs-ease-cine);
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--cs-border);
  box-shadow: 0 2px 0 var(--cs-focus-ring);
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cs-cream-60) 50%),
                    linear-gradient(135deg, var(--cs-cream-60) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cs-s-4); }

/* A date with a relative shortcut under it — "or in 3 days" fills the date.
   The inner label has to undo .field label, which is a block eyebrow. */
.date-days { display: grid; gap: var(--cs-s-2); }
label.date-days__rel {
  display: flex;
  align-items: center;
  gap: var(--cs-s-2);
  margin: 0;
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-caption);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--cs-fg-subtle);
  cursor: text;
}
.field .date-days__rel input {
  width: 64px;
  flex: none;
  padding: 6px var(--cs-s-2);
  text-align: center;
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-caption);
  appearance: textfield;
  -moz-appearance: textfield;
}
.field .date-days__rel input::-webkit-outer-spin-button,
.field .date-days__rel input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* A number with its unit spelled out beside it, inside the same box.
   The spinner goes — it would sit under the unit, and these get typed. */
.input-unit { position: relative; }
.input-unit input { padding-right: 60px; appearance: textfield; -moz-appearance: textfield; }
.input-unit input::-webkit-outer-spin-button,
.input-unit input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-unit > span {
  position: absolute;
  right: var(--cs-s-3);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-subtle);
  pointer-events: none;
}

/* Searchable client picker — type-ahead over the client list */
.combo { position: relative; }
.combo__list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  border-radius: var(--cs-radius-1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.combo__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px var(--cs-s-3);
  font-size: var(--cs-fs-small);
  color: var(--cs-fg);
  background: none;
  border: none;
  border-bottom: var(--cs-hairline);
  cursor: pointer;
}
.combo__item:last-child { border-bottom: none; }
.combo__item:hover { background: var(--cs-bg-elev-2); }
.combo__item--new { color: var(--cs-fg-muted); font-style: italic; }

/* -------------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, 0.78);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--cs-s-9) var(--cs-s-5);
  z-index: 100;
  overflow-y: auto;
  animation: fade-in var(--cs-dur-base) var(--cs-ease-cine);
}
.modal {
  width: 100%;
  max-width: 560px;
  background: var(--cs-bg-elev);
  border: var(--cs-hairline);
  box-shadow: var(--cs-shadow-pop);
  animation: modal-in var(--cs-dur-slow) var(--cs-ease-cine);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.modal__head h2 {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h3);
  font-weight: 400;
  font-style: italic;
  letter-spacing: var(--cs-ls-display);
}
.modal__body { padding: var(--cs-s-5); }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--cs-s-3);
  padding: var(--cs-s-4) var(--cs-s-5);
  border-top: var(--cs-hairline);
}
.modal__close { color: var(--cs-fg-subtle); font-size: var(--cs-fs-h4); line-height: 1; }
.modal__close:hover { color: var(--cs-fg); }

/* The form is still there underneath, dimmed rather than gone — the answer
   to "leave without saving?" is easier when you can still see what's at
   stake. Keep editing is the prominent one; discarding takes the plain button. */
.modal { position: relative; }
.modal__leave {
  position: absolute; inset: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  /* Tall forms scroll. Starting near the top and sticking there keeps the
     question in view wherever the modal happens to be scrolled to. */
  padding: var(--cs-s-8) var(--cs-s-5) var(--cs-s-5);
  background: rgba(20, 20, 20, 0.82);
  z-index: 10;
  animation: fade-in var(--cs-dur-fast) var(--cs-ease-cine);
}
.modal__leave-card {
  width: 100%;
  max-width: 380px;
  background: var(--cs-bg-elev);
  border: 1px solid var(--cs-border);
  box-shadow: var(--cs-shadow-pop);
  padding: var(--cs-s-5);
  position: sticky;
  top: var(--cs-s-5);
}
.modal__leave-card h3 {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h4);
  font-weight: 400;
  font-style: italic;
  letter-spacing: var(--cs-ls-display);
  margin-bottom: var(--cs-s-2);
}
.modal__leave-card p { color: var(--cs-fg-muted); }
.modal__leave-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--cs-s-3);
  margin-top: var(--cs-s-5);
}

/* ------------------------------------------------------------ record detail */
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cs-s-5); margin-bottom: var(--cs-s-6); }
.record-head h1 {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h2);
  font-weight: 400;
  letter-spacing: var(--cs-ls-display);
  line-height: var(--cs-lh-heading);
}
.record-head .crumbs { margin-bottom: var(--cs-s-3); }
.crumbs { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); }
.crumbs a:hover { color: var(--cs-fg); }

.def-list { display: grid; grid-template-columns: 128px 1fr; row-gap: var(--cs-s-3); column-gap: var(--cs-s-4); font-size: var(--cs-fs-small); }
.def-list dt {
  font-size: var(--cs-fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-subtle);
  padding-top: 2px;
}
.def-list dd { color: var(--cs-fg-muted); }
.def-list dd a { border-bottom: 1px solid var(--cs-border); }
.def-list dd a:hover { color: var(--cs-fg); border-bottom-color: var(--cs-cream); }

/* ----------------------------------------------------------------- timeline */
.timeline { list-style: none; }
.timeline li {
  position: relative;
  padding: var(--cs-s-4) 0 var(--cs-s-4) var(--cs-s-6);
  border-bottom: var(--cs-hairline);
}
.timeline li:last-child { border-bottom: none; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 0; top: 26px;
  width: 24px; height: 1px;
  background: var(--cs-cream-40);
}
.timeline__meta { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); margin-bottom: var(--cs-s-1); text-transform: uppercase; letter-spacing: var(--cs-ls-caps-tight); }
.timeline__body { font-size: var(--cs-fs-small); color: var(--cs-fg-muted); }

/* One entry shows on the deal, the client and the contact, so it carries the
   set it belongs to. Reading them is how you tell a shared history from a
   muddle of unrelated records. */
.timeline__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--cs-s-2);
  margin-top: 6px;
}
.timeline__links a { color: var(--cs-fg-subtle); border-bottom: 1px solid transparent; }
.timeline__links a:hover { color: var(--cs-fg); border-bottom-color: var(--cs-cream); }
.timeline__sep { color: var(--cs-cream-40); font-size: var(--cs-fs-micro); }

/* The standing notes from every record in the relationship, gathered. Each
   keeps its own field — this only makes sure none of them is out of sight. */
.note-row {
  padding: var(--cs-s-4) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.note-row:last-child { border-bottom: none; }
.note-row__src {
  display: block;
  color: var(--cs-fg-subtle);
  margin-bottom: var(--cs-s-2);
  border-bottom: 1px solid transparent;
}
.note-row__src:hover { color: var(--cs-fg); border-bottom-color: var(--cs-cream); }
.note-row p { color: var(--cs-fg-muted); white-space: pre-wrap; }

/* -------------------------------------------------------------------- tasks */
.task-row { display: flex; align-items: baseline; gap: var(--cs-s-4); padding: var(--cs-s-4) var(--cs-s-5); border-bottom: var(--cs-hairline); }
.task-row:last-child { border-bottom: none; }
.task-row__check {
  flex: none;
  width: 18px; height: 18px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-0);
  position: relative;
  top: 3px;
  transition: all var(--cs-dur-base) var(--cs-ease-cine);
}
.task-row__check:hover { border-color: var(--cs-cream); }
.task-row.done .task-row__check { background: var(--cs-cream); border-color: var(--cs-cream); }
.task-row.done .task-row__check::after {
  content: "×";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--cs-ink);
  font-size: 13px; font-weight: 600; line-height: 1;
}
.task-row__title { flex: 1; font-size: var(--cs-fs-small); }
.task-row.done .task-row__title { color: var(--cs-fg-subtle); text-decoration: line-through; }
.task-row__due { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); white-space: nowrap; }
.task-row__due.overdue { color: var(--cs-fg); border-bottom: 1px solid var(--cs-cream); font-weight: 500; }
.task-row__link { font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); white-space: nowrap; }
.task-row__link:hover { color: var(--cs-fg); }

/* ------------------------------------------------------------ personal to-do
   The day's page. Two lists under one hairline: today at the left where the
   eye lands first, the backlog beside it, slightly sunk so it reads as the
   shelf rather than the desk. */
.todo { display: grid; grid-template-columns: 1.6fr 1fr; }
.todo__col {
  display: flex;
  flex-direction: column;
  min-height: 176px;
  border-right: var(--cs-hairline);
  transition: background var(--cs-dur-fast) var(--cs-ease-cine),
              box-shadow var(--cs-dur-fast) var(--cs-ease-cine);
}
.todo__col:last-child { border-right: none; background: rgba(0, 0, 0, 0.14); }
.todo__col.drag-over { background: var(--cs-bg-elev); box-shadow: inset 0 0 0 1px var(--cs-cream-40); }
.todo__col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cs-s-3);
  padding: var(--cs-s-3) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.todo__col-head .cs-eyebrow { color: var(--cs-fg-subtle); }
.todo__count { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); white-space: nowrap; }
.todo__items { flex: 1; padding: var(--cs-s-2) 0; }
.todo__empty { padding: var(--cs-s-3) var(--cs-s-5); color: var(--cs-fg-subtle); max-width: 42ch; }
.todo__head-note { display: inline-flex; align-items: center; gap: var(--cs-s-4); color: var(--cs-fg-subtle); }

.todo-row {
  display: flex;
  align-items: baseline;
  gap: var(--cs-s-3);
  padding: var(--cs-s-2) var(--cs-s-5);
  cursor: grab;
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.todo-row:hover { background: var(--cs-bg-elev); }
.todo-row.dragging { opacity: 0.4; cursor: grabbing; }
.todo-row__check {
  flex: none;
  width: 15px; height: 15px;
  border: 1px solid var(--cs-border);
  position: relative;
  top: 2px;
  transition: all var(--cs-dur-base) var(--cs-ease-cine);
}
.todo-row__check[hidden] { display: none; }
.todo-row__check:hover { border-color: var(--cs-cream); }
.todo-row.done .todo-row__check { background: var(--cs-cream); border-color: var(--cs-cream); }
.todo-row.done .todo-row__check::after {
  content: "×";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--cs-ink);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.todo-row__text { flex: 1; font-size: var(--cs-fs-small); cursor: text; word-break: break-word; }
.todo-row__text:focus-visible { outline: none; border-bottom: 1px solid var(--cs-focus-ring); }
.todo-row.done .todo-row__text { color: var(--cs-fg-subtle); text-decoration: line-through; }
/* How long it's been carried. Only shows once something has outlived a day. */
.todo-row__age { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); white-space: nowrap; }
.todo-row__x {
  flex: none;
  font-size: 15px; line-height: 1;
  color: var(--cs-fg-subtle);
  opacity: 0;
  transition: opacity var(--cs-dur-fast) var(--cs-ease-cine), color var(--cs-dur-fast) var(--cs-ease-cine);
}
.todo-row:hover .todo-row__x, .todo-row__x:focus-visible { opacity: 1; }
.todo-row__x:hover { color: var(--cs-fg); }
.todo-row__edit {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cs-cream);
  padding: 0 0 2px;
  font-size: var(--cs-fs-small);
}
.todo-row__edit:focus { outline: none; }

.todo__add { border-top: var(--cs-hairline); }
.todo__add input {
  width: 100%;
  background: transparent;
  border: none;
  padding: var(--cs-s-3) var(--cs-s-5);
  font-size: var(--cs-fs-small);
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.todo__add input::placeholder { color: var(--cs-fg-subtle); }
.todo__add input:focus { outline: none; background: var(--cs-bg-elev); }

/* ------------------------------------------------------------------- charts */
.bar-chart { display: flex; flex-direction: column; gap: var(--cs-s-3); }
.bar-chart__row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: var(--cs-s-4); }
.bar-chart__label { font-size: var(--cs-fs-caption); color: var(--cs-fg-muted); text-align: right; }
.bar-chart__track { height: 22px; background: var(--cs-bg-elev); position: relative; }
.bar-chart__fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--cs-cream);
  transform-origin: left center;
  animation: bar-grow var(--cs-dur-cine) var(--cs-ease-cine);
}
.bar-chart__fill.dim { background: var(--cs-cream-40); }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-chart__value { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); }

.col-chart { display: flex; align-items: flex-end; gap: var(--cs-s-3); height: 180px; padding-top: var(--cs-s-4); }
.col-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--cs-s-2); height: 100%; justify-content: flex-end; }
.col-chart__bar { width: 100%; max-width: 48px; background: var(--cs-cream); transform-origin: bottom; animation: col-grow var(--cs-dur-cine) var(--cs-ease-cine); }
.col-chart__bar.dim { background: var(--cs-cream-20); }
@keyframes col-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.col-chart__label { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-subtle); text-transform: uppercase; }
.col-chart__value { font-family: var(--cs-font-mono); font-size: var(--cs-fs-micro); color: var(--cs-fg-muted); }

/* ------------------------------------------------------- pipelines overview */
.pipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.pipe-card {
  display: flex;
  flex-direction: column;
  gap: var(--cs-s-3);
  padding: var(--cs-s-5);
  border-right: var(--cs-hairline);
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.pipe-card:last-child { border-right: none; }
.pipe-card:hover { background: var(--cs-bg-elev); }
.pipe-card .cs-eyebrow { color: var(--cs-fg-subtle); }
.pipe-card__value {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h3);
  line-height: var(--cs-lh-heading);
  letter-spacing: var(--cs-ls-display);
}
.pipe-card__note { font-family: var(--cs-font-mono); font-size: var(--cs-fs-caption); color: var(--cs-fg-subtle); }
.pipe-bar { display: flex; height: 6px; background: var(--cs-bg-elev-2); overflow: hidden; }
.pipe-bar__seg { height: 100%; }
.pipe-bar__seg.s0, .pipe-card__stage i.s0 { background: var(--cs-cream); }
.pipe-bar__seg.s1, .pipe-card__stage i.s1 { background: var(--cs-cream-60); }
.pipe-bar__seg.s2, .pipe-card__stage i.s2 { background: var(--cs-cream-40); }
.pipe-bar__seg.s3, .pipe-card__stage i.s3 { background: var(--cs-cream-20); }
.pipe-card__stages { display: flex; flex-wrap: wrap; gap: var(--cs-s-2) var(--cs-s-3); }
.pipe-card__stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  color: var(--cs-fg-muted);
}
.pipe-card__stage.dim { color: var(--cs-fg-subtle); }
.pipe-card__stage i { width: 8px; height: 8px; flex: none; }
.pipe-card__go { margin-top: auto; font-size: var(--cs-fs-caption); font-weight: 600; color: var(--cs-fg-muted); }
.pipe-card__go .arrow { display: inline-block; transition: transform var(--cs-dur-fast) var(--cs-ease-cine); }
.pipe-card:hover .pipe-card__go { color: var(--cs-fg); }
.pipe-card:hover .pipe-card__go .arrow { transform: translateX(4px); }

/* ---------------------------------------------------------------- lead rows */
.lead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cs-s-3);
  padding: var(--cs-s-3) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
  cursor: pointer;
  transition: background var(--cs-dur-fast) var(--cs-ease-cine);
}
.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--cs-bg-elev); }
.lead-row__who { display: flex; flex-direction: column; min-width: 0; }
.lead-row__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__tags { display: flex; gap: var(--cs-s-2); flex: none; }

/* ------------------------------------------------------------ user switcher */
.user-switcher {
  display: flex;
  align-items: center;
  gap: var(--cs-s-2);
}
.user-switcher label {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-subtle);
}
.user-switcher select {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cs-border-faint);
  padding: 4px 18px 4px 2px;
  font-size: var(--cs-fs-small);
  font-weight: 600;
  color: var(--cs-fg);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cs-cream-60) 50%),
                    linear-gradient(135deg, var(--cs-cream-60) 50%, transparent 50%);
  background-position: calc(100% - 8px) 55%, calc(100% - 4px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.user-switcher select:focus { outline: none; border-bottom: 2px solid var(--cs-focus-ring); }

/* ------------------------------------------------------------- access grid */
.access-member { border-bottom: var(--cs-hairline); padding: var(--cs-s-4) 0; }
.access-member:last-child { border-bottom: none; }
.access-member__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--cs-s-3);
}
.access-member__name { font-weight: 600; font-size: var(--cs-fs-small); }
.access-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cs-s-2) var(--cs-s-4);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--cs-s-2);
  font-size: var(--cs-fs-caption);
  color: var(--cs-fg-muted);
  cursor: pointer;
  user-select: none;
}
.check input {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-0);
  cursor: pointer;
  position: relative;
  transition: all var(--cs-dur-fast) var(--cs-ease-cine);
}
.check input:hover { border-color: var(--cs-cream); }
.check input:checked { background: var(--cs-cream); border-color: var(--cs-cream); }
.check input:checked::after {
  content: "×";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--cs-ink);
  font-size: 11px; font-weight: 600; line-height: 1;
}

/* -------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  bottom: var(--cs-s-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--cs-cream);
  color: var(--cs-ink);
  padding: var(--cs-s-3) var(--cs-s-5);
  font-size: var(--cs-fs-small);
  font-weight: 600;
  box-shadow: var(--cs-shadow-2);
  z-index: 200;
  animation: toast-in var(--cs-dur-base) var(--cs-ease-cine);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast.out { animation: toast-out var(--cs-dur-base) var(--cs-ease-in) forwards; }
@keyframes toast-out {
  to { opacity: 0; transform: translate(-50%, 8px); }
}

/* ----------------------------------------------------- intro logo animation */
/* Six beats over 2.4s per LOGO_ANIMATION.md — the only scripted motion.      */
.intro {
  position: fixed; inset: 0;
  background: var(--cs-ink);
  display: grid;
  place-items: center;
  z-index: 1000;
}
.intro.done { animation: intro-out var(--cs-dur-slow) var(--cs-ease-in) forwards; }
@keyframes intro-out { to { opacity: 0; visibility: hidden; } }

.intro__lockup { text-align: center; }
.intro__word {
  font-size: 72px;
  line-height: 1;
  white-space: nowrap;
}
.intro__cine {
  font-family: var(--cs-font-display);
  font-style: italic;
  letter-spacing: var(--cs-ls-display);
  display: inline-block;
  /* beat 02 — wipe in L→R, 0.3s → 1.0s, ease-cine */
  clip-path: inset(0 100% 0 0);
  animation: cine-wipe 700ms var(--cs-ease-cine) 300ms forwards;
}
@keyframes cine-wipe { to { clip-path: inset(0 -5% 0 0); } }
.intro__scale {
  font-family: var(--cs-font-body);
  font-weight: 800;
  letter-spacing: -0.01em;
  display: inline-block;
  /* beat 03 — cuts in upright at 1.0s. Snap, not glide. */
  opacity: 0;
  animation: snap-in 1ms linear 1000ms forwards;
}
@keyframes snap-in { to { opacity: 1; } }
.intro__rule {
  /* beat 05 — rule draws under, 1.8s, ease-inout */
  width: 220px;
  height: 1px;
  background: var(--cs-cream);
  margin: var(--cs-s-4) auto var(--cs-s-3);
  transform: scaleX(0);
  transform-origin: left center;
  animation: rule-draw 200ms var(--cs-ease-inout) 1800ms forwards;
}
@keyframes rule-draw { to { transform: scaleX(1); } }
.intro__tagline {
  /* beat 05 — letters fade up after the rule */
  color: var(--cs-fg-subtle);
  opacity: 0;
  animation: snap-in 200ms linear 2000ms forwards;
}

/* ------------------------------------------------------------------- helpers */
.mono { font-family: var(--cs-font-mono); }
.muted { color: var(--cs-fg-subtle); }
.mt-4 { margin-top: var(--cs-s-4); }
.mt-6 { margin-top: var(--cs-s-6); }
.mb-4 { margin-bottom: var(--cs-s-4); }
.mb-6 { margin-bottom: var(--cs-s-6); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--cs-s-4); margin-bottom: var(--cs-s-5); flex-wrap: wrap; }

/* ----------------------------------------------------------------- avatars */
/* A face is the one round thing in a square system — it reads as a person
   rather than another panel. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  /* A size on the base class, not only the modifiers — a modifier the
     stylesheet doesn't know (stale cache, a typo) then reads small and
     round instead of dropping the photo in at its natural 256px. */
  width: 40px; height: 40px;
  background: var(--cs-bg-elev-2);
  border: 1px solid var(--cs-border-faint);
  color: var(--cs-fg-muted);
  font-family: var(--cs-font-mono);
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--sm { width: 28px; height: 28px; font-size: 10px; }
.avatar--nav { width: 32px; height: 32px; font-size: 11px; }
.avatar--md { width: 40px; height: 40px; font-size: 12px; }
.avatar--lg { width: 72px; height: 72px; font-size: 20px; }
.avatar--xl { width: 104px; height: 104px; font-size: 28px; }

/* ------------------------------------------------------- account & menu */
.user-switcher { position: relative; }
/* Just the face, hard right. The name and title live in the menu it opens —
   the corner stays one small round mark rather than a block of text. */
.account {
  display: block;
  padding: 0;
  border: none;
  background: none;
  border-radius: 50%;
  line-height: 0;
  cursor: pointer;
}
.account .avatar { box-shadow: 0 0 0 1px var(--cs-border-faint); transition: box-shadow var(--cs-dur-base) var(--cs-ease-cine); }
.account:hover .avatar { box-shadow: 0 0 0 1px var(--cs-cream-40); }
.account:focus-visible { outline: none; }
.account:focus-visible .avatar { box-shadow: 0 0 0 3px var(--cs-focus-ring); }
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--cs-bg-elev);
  border: 1px solid var(--cs-border-faint);
  box-shadow: var(--cs-shadow-2);
  z-index: 150;
}
.user-menu__head {
  display: flex;
  align-items: center;
  gap: var(--cs-s-3);
  padding: var(--cs-s-4);
  border-bottom: var(--cs-hairline);
}
.user-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--cs-s-3) var(--cs-s-4);
  font-size: var(--cs-fs-small);
  color: var(--cs-fg-muted);
  cursor: pointer;
  transition: all var(--cs-dur-fast) var(--cs-ease-cine);
}
.user-menu__item:hover { background: var(--cs-bg-elev-2); color: var(--cs-fg); }

/* ---------------------------------------------------------- team (settings) */
.team-row {
  display: flex;
  align-items: center;
  gap: var(--cs-s-4);
  padding: var(--cs-s-3) var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.team-row__who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.team-row__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row__name { font-size: var(--cs-fs-small); font-weight: 600; }
.team-note { padding: var(--cs-s-4) var(--cs-s-5); }

.photo-field {
  display: flex;
  align-items: center;
  gap: var(--cs-s-5);
  padding-bottom: var(--cs-s-5);
  margin-bottom: var(--cs-s-5);
  border-bottom: var(--cs-hairline);
}
.photo-field .field { flex: 1; margin-bottom: 0; }
.photo-field__meta { flex: 1; min-width: 0; }
.photo-field__meta .cs-eyebrow { display: block; color: var(--cs-fg-subtle); margin-bottom: var(--cs-s-2); }
.photo-field__meta .cs-caption { color: var(--cs-fg-subtle); }
.photo-field__actions { display: flex; align-items: center; gap: var(--cs-s-4); margin-top: var(--cs-s-3); }

/* The crop stage — square window, round mask, drag to place. */
.photo-crop {
  display: flex;
  gap: var(--cs-s-5);
  align-items: center;
  padding: var(--cs-s-5);
  margin-bottom: var(--cs-s-5);
  border: var(--cs-hairline);
  background: var(--cs-bg-elev-2);
  animation: fade-in var(--cs-dur-base) var(--cs-ease-cine);
}
.photo-crop[hidden] { display: none; }
.photo-crop__stage {
  flex: none;
  width: 232px; height: 232px;
  border-radius: 50%;
  background: var(--cs-ink);
  box-shadow: 0 0 0 1px var(--cs-border-faint);
  cursor: grab;
  touch-action: none;
}
.photo-crop__stage.is-dragging { cursor: grabbing; }
.photo-crop__side { flex: 1; min-width: 0; }
.photo-crop__side .cs-eyebrow { display: block; color: var(--cs-fg); margin-bottom: var(--cs-s-2); }
.photo-crop__side .cs-caption { color: var(--cs-fg-subtle); }
.photo-crop__actions { display: flex; align-items: center; gap: var(--cs-s-4); margin-top: var(--cs-s-5); flex-wrap: wrap; }

.photo-crop__zoom {
  width: 100%;
  margin-top: var(--cs-s-4);
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.photo-crop__zoom::-webkit-slider-runnable-track { height: 1px; background: var(--cs-border); }
.photo-crop__zoom::-moz-range-track { height: 1px; background: var(--cs-border); }
.photo-crop__zoom::-webkit-slider-thumb {
  appearance: none;
  width: 12px; height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--cs-cream);
}
.photo-crop__zoom::-moz-range-thumb {
  width: 12px; height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--cs-cream);
}
.photo-crop__zoom:focus-visible { outline: none; }
.photo-crop__zoom:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--cs-focus-ring); }

@media (max-width: 560px) {
  .photo-crop { flex-direction: column; align-items: stretch; }
  .photo-crop__stage { align-self: center; }
}

.mt-2 { margin-top: var(--cs-s-2); }

/* ------------------------------------------------------------------ sign-in */
.cs-root.locked .app { display: none; }
.login {
  position: fixed; inset: 0;
  background: var(--cs-ink);
  display: grid;
  place-items: center;
  z-index: 900;
  overflow: auto;
}
.login__panel {
  text-align: center;
  padding: var(--cs-s-7) var(--cs-s-6);
  max-width: 560px;
  width: 100%;
  animation: login-in var(--cs-dur-slow) var(--cs-ease-cine);
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.login__panel.shake { animation: login-shake 320ms var(--cs-ease-cine); }
@keyframes login-shake {
  20% { transform: translateX(-8px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-4px); }
  100% { transform: none; }
}
.login__word { font-size: 56px; line-height: 1; white-space: nowrap; }
.login__cine { font-family: var(--cs-font-display); font-style: italic; letter-spacing: var(--cs-ls-display); }
.login__scale { font-family: var(--cs-font-body); font-weight: 800; letter-spacing: -0.01em; }
.login__eyebrow { color: var(--cs-fg-subtle); margin: var(--cs-s-3) 0 var(--cs-s-6); }

/* The door screens — turned away, or unable to ask. Same lockup as the old
   sign-in, one sentence, one way forward. */
.login__title {
  font-family: var(--cs-font-display);
  font-size: var(--cs-fs-h3);
  font-weight: 400;
  font-style: italic;
  letter-spacing: var(--cs-ls-display);
  margin-bottom: var(--cs-s-3);
}
.login__body {
  color: var(--cs-fg-muted);
  max-width: 46ch;
  margin: 0 auto;
  line-height: var(--cs-lh-body, 1.55);
}
.login__body .mono { font-family: var(--cs-font-mono); color: var(--cs-fg); }
.login__actions { display: flex; justify-content: center; gap: var(--cs-s-3); margin-top: var(--cs-s-6); }

/* ------------------------------------------------------------- sync state
   Quiet by default. It appears only when something is in flight or has gone
   wrong, so seeing it at all means look. */
.sync {
  font-family: var(--cs-font-mono);
  font-size: var(--cs-fs-micro);
  text-transform: uppercase;
  letter-spacing: var(--cs-ls-caps-tight);
  color: var(--cs-fg-subtle);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--cs-s-2);
}
.sync[hidden] { display: none; }
.sync::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.sync--saving::before { animation: sync-pulse 1.1s var(--cs-ease-cine) infinite; }
.sync--offline, .sync--error { color: var(--cs-fg-muted); }
.sync--error::before, .sync--offline::before { background: var(--cs-cream); }
@keyframes sync-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.login__users {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--cs-s-4);
  margin-bottom: var(--cs-s-6);
}
.login__user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--cs-s-2);
  padding: var(--cs-s-4);
  min-width: 120px;
  border: 1px solid var(--cs-border-faint);
  cursor: pointer;
  transition: border-color var(--cs-dur-fast) var(--cs-ease-cine), background var(--cs-dur-fast) var(--cs-ease-cine);
}
.login__user:hover { border-color: var(--cs-border); }
.login__user.active { border-color: var(--cs-accent); background: var(--cs-bg-elev); }
.login__name { font-size: var(--cs-fs-small); font-weight: 600; color: var(--cs-fg); }
.login__form {
  display: flex;
  justify-content: center;
  gap: var(--cs-s-3);
  flex-wrap: wrap;
}
.login__form[hidden] { display: none; }
.login__form input[type="password"] {
  width: 220px;
  background: var(--cs-bg-elev);
  border: 1px solid var(--cs-border-faint);
  padding: var(--cs-s-3) var(--cs-s-4);
  color: var(--cs-fg);
  font-size: var(--cs-fs-small);
}
.login__form input[type="password"]:focus { outline: none; border-color: var(--cs-focus-ring); }
.login__msg { width: 100%; min-height: 18px; margin-top: var(--cs-s-2); }
.login__foot { margin-top: var(--cs-s-7); color: var(--cs-fg-subtle); }

/* -------------------------------------------------------- viewer read-only
   Buttons vanish; links stay. The store refuses viewer writes regardless. */
.is-viewer .view button.btn--primary,
.is-viewer .view button.btn--danger,
.is-viewer .view button.btn--ghost,
.is-viewer .view button.btn--bare,
.is-viewer .view [data-status],
.is-viewer .view .kanban__add { display: none; }
.is-viewer .view .out-handoff { display: none; }
.is-viewer .task-row__check { visibility: hidden; }
.is-viewer .deal-card, .is-viewer .proj-card, .is-viewer .out-row { cursor: default; }
.is-viewer .out-row__status { pointer-events: none; opacity: 0.6; cursor: default; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 200px 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: var(--cs-hairline); }
  .grid-2, .grid-3-2 { grid-template-columns: 1fr; }
  /* Stacked, the backlog sits under today — still one drop target each. */
  .todo { grid-template-columns: 1fr; }
  .todo__col { border-right: none; border-bottom: var(--cs-hairline); }
  .todo__col:last-child { border-bottom: none; }
}
