/* styles-dashboard.css — Owner / Executive dashboard (additive)
   Scoped under .owd-* — no overrides of existing selectors. Uses existing
   design tokens from tokens.css / redesign.css. */

.owd-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.owd-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  flex-wrap: wrap;
}

.owd-toolbar-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}

.owd-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
}

.owd-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 32px;
}

.owd-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
}

.owd-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 880px) {
  .owd-two-col { grid-template-columns: 1fr; }
}

/* ── mono / tone helpers ──────────────────────────────────────────────── */
.owd-wrap .mono { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; }
.owd-pos { color: oklch(0.52 0.14 160); }
.owd-neg { color: oklch(0.55 0.2 25); }
.owd-amber { color: oklch(0.62 0.18 60); }
.owd-strong { font-weight: 700; }

/* ── §1 KPI strip ─────────────────────────────────────────────────────── */
.owd-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1100px) { .owd-kpi-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .owd-kpi-strip { grid-template-columns: repeat(2, 1fr); } }

.owd-kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.owd-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.owd-kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.owd-kpi-sub {
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.owd-kpi-bar {
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.owd-kpi-bar-fill { height: 100%; border-radius: 99px; transition: width .3s ease; }

/* ── card shell ───────────────────────────────────────────────────────── */
.owd-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.owd-card-head {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.owd-card-title { font-weight: 700; font-size: 14px; color: var(--fg); flex: 1; }
.owd-card-hint { font-size: 14px; color: var(--fg-3); }

.owd-sort { display: flex; gap: 4px; }
.owd-sort-btn {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg);
  color: var(--fg-2);
  cursor: pointer;
}
.owd-sort-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.owd-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--fg-3);
}
.owd-loading { padding: 48px 16px; }
.owd-err { color: oklch(0.55 0.2 25); }

.owd-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.owd-name-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owd-code { color: var(--fg-3); font-size: 11px; }

/* ── §2 profitability table ───────────────────────────────────────────── */
.owd-table-scroll { overflow-x: auto; }
.owd-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.owd-th {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 8px 10px;
  background: color-mix(in oklab, var(--bg) 50%, transparent);
  border-bottom: 1px solid var(--line);
}
.owd-th-l { text-align: left; }
.owd-th-r { text-align: right; }

.owd-td {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  color: var(--fg-2);
}
.owd-r { text-align: right; }
.owd-td-name {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  color: var(--fg);
  font-weight: 600;
}
.owd-pm { color: var(--fg-3); font-size: 12px; }

.owd-row-neg { background: color-mix(in oklab, oklch(0.55 0.2 25) 7%, transparent); }
.owd-row-neg:hover { background: color-mix(in oklab, oklch(0.55 0.2 25) 11%, transparent); }
.owd-table tbody tr:hover { background: var(--bg-hover); }
.owd-row-neg:hover { background: color-mix(in oklab, oklch(0.55 0.2 25) 11%, transparent); }

/* Amber "no cost data yet" pill — a project missing its cost isn't a loss. */
.owd-incomplete-pill {
  display: inline-block; font-size: 10.5px; font-weight: 600; line-height: 1.4;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  color: #b45309;
  border: 1px solid color-mix(in oklab, #f59e0b 36%, var(--line));
  background: color-mix(in oklab, #f59e0b 12%, var(--bg));
}

.owd-foot td { border-top: 2px solid var(--line-strong, var(--line)); background: color-mix(in oklab, var(--bg) 40%, transparent); }

/* ── §3 margin gap ────────────────────────────────────────────────────── */
.owd-gap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 880px) { .owd-gap-grid { grid-template-columns: 1fr; } }

.owd-gap-col { padding: 14px 16px; }
.owd-gap-col + .owd-gap-col { border-left: 1px solid var(--line); }
.owd-gap-col-title { font-size: 12px; font-weight: 700; color: var(--fg-2); margin-bottom: 10px; }

.owd-gap-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.owd-gap-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg); min-width: 0; }
.owd-gap-bars { display: flex; flex-direction: column; gap: 3px; }
.owd-gap-bar-track { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.owd-gap-bar { height: 100%; border-radius: 99px; transition: width .3s ease; }
.owd-gap-bar-est { background: transparent; border: 1px solid var(--fg-3); box-sizing: border-box; }
.owd-gap-bar-act { background: oklch(0.52 0.14 160); }
.owd-gap-nums { font-size: 11px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.owd-gap-est { color: var(--fg-3); }
.owd-gap-arrow { color: var(--fg-4, var(--fg-3)); }

/* ── §4 cashflow / charts ─────────────────────────────────────────────── */
.owd-chart-wrap { position: relative; padding: 14px 16px 10px; }
.owd-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.owd-grid-line { stroke: var(--line); stroke-width: 1; }
.owd-axis-label { fill: var(--fg-3); font-size: 10px; font-family: var(--font-mono, monospace); }
.owd-ref-line { stroke: oklch(0.52 0.14 160); stroke-width: 1.5; stroke-dasharray: 5 4; }
.owd-ref-label { fill: oklch(0.52 0.14 160); font-size: 10px; font-weight: 600; }
.owd-hover-line { stroke: var(--fg-3); stroke-width: 1; stroke-dasharray: 3 3; }
.owd-hover-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }

.owd-bar-collected { fill: oklch(0.52 0.14 160); }
.owd-bar-expected { fill: color-mix(in oklab, oklch(0.62 0.18 60) 55%, var(--bg)); }

.owd-util-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.owd-util-dot { stroke: var(--bg); stroke-width: 1.5; }

.owd-legend { display: flex; gap: 16px; padding: 8px 4px 2px; flex-wrap: wrap; }
.owd-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fg-3); }
.owd-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.owd-sw-collected { background: oklch(0.52 0.14 160); }
.owd-sw-expected { background: color-mix(in oklab, oklch(0.62 0.18 60) 55%, var(--bg)); }

.owd-tooltip {
  position: absolute;
  top: 10px;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--line-strong, var(--line));
  border-radius: var(--radius-sm, 6px);
  padding: 7px 10px;
  font-size: 12px;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(0,0,0,0.2));
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.owd-tooltip-date { font-weight: 700; color: var(--fg); margin-bottom: 4px; }
.owd-tooltip-row { display: flex; align-items: center; gap: 6px; color: var(--fg-2); }
.owd-tooltip-row.sub { color: var(--fg-3); font-size: 11px; }

/* ── §5 ageing / §6 pipeline ──────────────────────────────────────────── */
.owd-ageing { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.owd-ageing-row { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 12px; }
.owd-ageing-label { font-size: 12px; color: var(--fg-2); white-space: nowrap; }
.owd-ageing-track { height: 14px; background: var(--line); border-radius: 4px; overflow: hidden; }
.owd-ageing-bar { height: 100%; border-radius: 4px; transition: width .3s ease; min-width: 2px; }
.owd-ageing-amt { font-size: 13px; font-weight: 700; color: var(--fg); white-space: nowrap; }

.owd-pipeline-nums { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; }
.owd-pipeline-profit { font-size: 10px; }

.owd-chase { border-top: 1px solid var(--line); padding: 12px 16px; }
.owd-chase-title { font-size: 11px; font-weight: 700; color: oklch(0.55 0.2 25); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.owd-chase-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 12px; border-top: 1px solid var(--line-soft, var(--line)); }
.owd-chase-row:first-of-type { border-top: none; }
.owd-chase-cust { color: var(--fg-3); }
.owd-chase-amt { font-weight: 700; color: var(--fg); }
.owd-chase-days { color: oklch(0.55 0.2 25); font-weight: 600; }

/* ── §8 capacity gauges ───────────────────────────────────────────────── */
.owd-gauges { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.owd-gauge { display: flex; flex-direction: column; gap: 6px; }
.owd-gauge-head { display: flex; align-items: baseline; justify-content: space-between; }
.owd-gauge-label { font-size: 13px; font-weight: 600; color: var(--fg); }
.owd-gauge-pct { font-size: 16px; font-weight: 700; }
.owd-gauge-track { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; }
.owd-gauge-fill { height: 100%; border-radius: 6px; transition: width .3s ease; }

/* ── capacity heatmap (member × week / day) ───────────────────────────── */
.cap-card { position: relative; }
.cap-toolbar { display: flex; align-items: center; gap: 10px; }
.cap-week-select {
  font-size: 12px; padding: 4px 8px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
.cap-body { padding: 14px 16px 16px; }

.cap-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.cap-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fg-3); }
.cap-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cap-sw-over { background: oklch(0.55 0.2 25); box-shadow: inset 0 0 0 2px var(--bg); outline: 1.5px solid oklch(0.55 0.2 25); }

.cap-grid-scroll { overflow-x: auto; }
.cap-grid { display: grid; gap: 4px; min-width: max-content; align-items: stretch; }

.cap-corner { }
.cap-colhead {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px 2px; gap: 2px; text-align: center;
}
.cap-colhead-wk { font-size: 11px; font-weight: 700; color: var(--fg-2); }
.cap-colhead-sub { font-size: 9px; color: var(--fg-3); white-space: nowrap; }
.cap-colhead-off .cap-colhead-wk, .cap-colhead-off .cap-colhead-sub { color: var(--fg-3); opacity: 0.6; }

.cap-rowlabel {
  display: flex; align-items: center; gap: 8px; padding: 0 8px 0 2px;
  min-width: 0; overflow: hidden;
}
.cap-initials {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 15%, var(--line));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--fg-2);
}
.cap-name { font-size: 12px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cap-cell {
  position: relative; min-height: 32px; border-radius: var(--radius);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: default; transition: transform .12s ease, box-shadow .12s ease;
}
.cap-cell:hover, .cap-cell:focus-visible {
  transform: translateY(-1px); outline: none;
  box-shadow: 0 2px 6px color-mix(in oklab, var(--fg) 14%, transparent);
}
.cap-cell-val { font-size: 11px; font-weight: 600; color: var(--fg); }
.cap-cell-dim { background: var(--bg); border-style: dashed; }
.cap-cell-dim .cap-cell-val { color: var(--fg-3); }
.cap-cell-flag { border: 2px solid oklch(0.55 0.2 25); }
.cap-cell-bang {
  position: absolute; top: 1px; right: 3px; font-size: 11px; font-weight: 800;
  color: oklch(0.55 0.2 25); line-height: 1;
}

.cap-tip {
  position: fixed; transform: translate(-50%, calc(-100% - 8px));
  z-index: 60; pointer-events: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 20px color-mix(in oklab, var(--fg) 22%, transparent);
  padding: 8px 10px; min-width: 140px; max-width: 240px;
}
.cap-tip-head { font-size: 12px; font-weight: 700; color: var(--fg); margin-bottom: 4px; }
.cap-tip-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--fg-2); padding: 1px 0; }
.cap-tip-row.sub { color: var(--fg-3); }
.cap-tip-warn { margin-top: 4px; font-size: 11px; font-weight: 600; color: oklch(0.55 0.2 25); }
.owd-gauge-sub { font-size: 12px; color: var(--fg-3); }

/* ── At-risk alerts strip (top of dashboard) ───────────────────────────── */
.alert-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-strip-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.alert-strip-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
}

.alert-strip-clear {
  font-size: 13px;
  font-weight: 600;
  color: oklch(0.52 0.14 160);
}

.alert-strip-note {
  font-size: 14px;
  color: oklch(0.55 0.2 25);
}

.alert-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.alert-chip:hover { border-color: var(--fg-3); }
.alert-chip:focus-visible { outline: 2px solid var(--fg-3); outline-offset: 1px; }
.alert-chip.active { background: color-mix(in oklab, var(--fg) 8%, transparent); border-color: var(--fg-3); }

.alert-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-chip-err .alert-chip-dot { background: oklch(0.55 0.2 25); }
.alert-chip-warn .alert-chip-dot { background: oklch(0.62 0.18 60); }

.alert-chip-count {
  font-weight: 800;
  color: var(--fg);
}
.alert-chip-err .alert-chip-count { color: oklch(0.55 0.2 25); }
.alert-chip-warn .alert-chip-count { color: oklch(0.62 0.18 60); }

.alert-expand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 4px;
  font-size: 12px;
  color: var(--fg-2);
  border-radius: 6px;
}
.alert-item:hover { background: color-mix(in oklab, var(--fg) 5%, transparent); }

.alert-item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-dot-err { background: oklch(0.55 0.2 25); }
.alert-dot-warn { background: oklch(0.62 0.18 60); }

.alert-item-main {
  font-weight: 600;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-item-sub { color: var(--fg-3); font-size: 11px; white-space: nowrap; }
.alert-item-amt { font-weight: 700; color: var(--fg); white-space: nowrap; }
.alert-item-meta { color: var(--fg-3); font-size: 11px; white-space: nowrap; }

/* ── Collections (วางบิล & ทวงเงิน) ──────────────────────────────────── */
.col-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.col-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.col-toolbar-title { font-size: 15px; font-weight: 700; color: var(--fg); }
.col-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.col-empty { padding: 48px 16px; text-align: center; color: var(--fg-3); }
.col-empty.col-err { color: oklch(0.55 0.2 25); }
.col-note { font-size: 14px; color: var(--fg-3); background: var(--bg-soft, var(--bg)); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }

.col-kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.col-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.col-kpi-label { font-size: 11.5px; color: var(--fg-3); margin-bottom: 4px; }
.col-kpi-val { font-size: 20px; font-weight: 700; color: var(--fg); }
.col-kpi-sub { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.col-kpi.danger { border-color: color-mix(in oklab, oklch(0.55 0.2 25) 40%, var(--line)); background: color-mix(in oklab, oklch(0.55 0.2 25) 6%, var(--bg)); }
.col-kpi.danger .col-kpi-val { color: oklch(0.5 0.2 25); }
.col-kpi.warn { border-color: color-mix(in oklab, #f59e0b 40%, var(--line)); background: color-mix(in oklab, #f59e0b 8%, var(--bg)); }
.col-kpi.warn .col-kpi-val { color: #b45309; }
.col-kpi.ok .col-kpi-val { color: oklch(0.52 0.14 160); }

/* flex: none so lanes keep their natural height instead of being shrunk to
   fit (which clipped the long billing list); .col-body then scrolls the lot. */
.col-lane { flex: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.col-lane-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); background: color-mix(in oklab, var(--bg) 50%, transparent); }
.col-lane-title { font-size: 13px; font-weight: 700; color: var(--fg); }
.col-lane-title.danger { color: oklch(0.5 0.2 25); }
.col-lane-title.warn { color: #b45309; }
.col-lane-meta { font-size: 12px; color: var(--fg-3); }
.col-lane-empty { padding: 16px; text-align: center; color: var(--fg-3); font-size: 14px; }
.col-table-scroll { overflow-x: auto; }
.col-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.col-th { text-align: left; font-weight: 600; color: var(--fg-3); font-size: 11px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.col-th-r { text-align: right; }
.col-td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft, var(--line)); vertical-align: middle; }
.col-r { text-align: right; }
.col-table tbody tr:hover { background: var(--bg-hover); }
.col-row-overdue { background: color-mix(in oklab, oklch(0.55 0.2 25) 5%, transparent); }
.col-td-name { display: flex; align-items: center; gap: 7px; }
.col-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.col-name-txt { font-weight: 600; color: var(--fg); }
.col-td-who { color: var(--fg-2); }
.col-due { display: inline-flex; align-items: center; gap: 6px; }
.col-due-none { color: var(--fg-3); }
.col-due.overdue { color: oklch(0.5 0.2 25); font-weight: 600; }
.col-due.soon { color: #b45309; }
.col-due-note { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: color-mix(in oklab, currentColor 12%, var(--bg)); }

.col-status-pill { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; }
.col-status-pill.st-pending { color: var(--fg-3); }
.col-status-pill.st-ready { color: oklch(0.5 0.18 250); border-color: color-mix(in oklab, oklch(0.5 0.18 250) 30%, var(--line)); }
.col-status-pill.st-invoiced { color: #b45309; border-color: color-mix(in oklab, #f59e0b 32%, var(--line)); }
.col-status-pill.st-received { color: oklch(0.5 0.16 145); border-color: color-mix(in oklab, oklch(0.5 0.16 145) 30%, var(--line)); }

.col-advance-btn { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--accent, var(--line)); background: color-mix(in oklab, var(--accent, #3b82f6) 10%, var(--bg)); color: var(--accent, #2563eb); cursor: pointer; white-space: nowrap; }
.col-advance-btn:hover:not(:disabled) { background: color-mix(in oklab, var(--accent, #3b82f6) 18%, var(--bg)); }
.col-advance-btn:disabled { opacity: 0.5; cursor: default; }

/* ── ยังไม่ได้วางแผนวางบิล lane: simple project rows + plan CTA ── */
.col-np-list { display: flex; flex-direction: column; }
.col-np-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft, var(--line));
}
.col-np-row:last-child { border-bottom: none; }
.col-np-name { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-np-who { font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.col-plan-btn {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--accent, var(--line));
  background: color-mix(in oklab, var(--accent, #3b82f6) 10%, var(--bg));
  color: var(--accent, #2563eb); cursor: pointer;
}
.col-plan-btn:hover { background: color-mix(in oklab, var(--accent, #3b82f6) 18%, var(--bg)); }

/* ── Project tree: parent + nested billing-round subtasks ── */
.col-proj-list { display: flex; flex-direction: column; }
.col-proj { border-bottom: 1px solid var(--line); }
.col-proj:last-child { border-bottom: none; }
.col-proj-head {
  width: 100%;
  display: grid;
  grid-template-columns: 16px auto minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: none; border: none; cursor: pointer; text-align: left;
}
.col-proj-head:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-proj-caret { display: grid; place-items: center; color: var(--fg-3); transition: transform .15s ease; }
.col-proj-caret.open { transform: rotate(90deg); }
.col-proj-name { font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-proj-who { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-proj-count { font-size: 11.5px; color: var(--fg-3); white-space: nowrap; }
.col-proj-amt { font-weight: 600; color: var(--fg); white-space: nowrap; }
.col-proj-badge { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.col-proj-badge.danger { color: oklch(0.5 0.2 25); background: color-mix(in oklab, oklch(0.55 0.2 25) 12%, transparent); }
.col-proj-badge.warn { color: #b45309; background: color-mix(in oklab, #f59e0b 14%, transparent); }
.col-proj.overdue { background: color-mix(in oklab, oklch(0.55 0.2 25) 4%, transparent); }

/* subtask rows */
.col-subtasks { padding: 0 14px 6px 39px; display: flex; flex-direction: column; gap: 2px; }
.col-subtask {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(110px, auto) auto auto;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line-soft, var(--line));
  background: var(--bg);
}
.col-subtask.overdue { border-color: color-mix(in oklab, oklch(0.55 0.2 25) 35%, var(--line)); }
.col-subtask.received { opacity: 0.62; }
.col-subtask-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.col-subtask-label { font-size: 12.5px; color: var(--fg-2); white-space: nowrap; flex: none; }
.col-subtask-note { font-size: 14px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
button.col-subtask-note { cursor: text; }
.col-note-add {
  font-size: 14px; color: var(--fg-3);
  background: none; border: 1px dashed var(--line); border-radius: 5px;
  padding: 0 6px; cursor: pointer; white-space: nowrap; flex: none;
  opacity: 0; transition: opacity .12s ease;
}
.col-subtask:hover .col-note-add, .col-note-add:focus-visible { opacity: 0.75; }
.col-note-add:hover { opacity: 1; color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.col-note-input { max-width: 220px; }
.col-subtask-amt { font-weight: 600; color: var(--fg); white-space: nowrap; text-align: right; }
.col-subtask-due { font-size: 12px; }

/* status picker */
.col-status-control { position: relative; justify-self: end; }
.col-status-trigger {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px 2px 4px; border-radius: 999px;
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--fg-3);
}
.col-status-trigger:hover:not(:disabled) { border-color: var(--line); background: var(--bg); }
.col-status-trigger:disabled { opacity: 0.6; cursor: default; }
.col-status-spin { font-size: 12px; width: 12px; text-align: center; }
.col-menu-backdrop { position: fixed; inset: 0; z-index: 60; }
.col-status-menu {
  position: fixed; z-index: 61;
  min-width: 176px;
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: 0px 2px 4px rgba(0,0,0,0.06), 2px 4px 16px rgba(0,0,0,0.12);
}
.col-status-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px; border-radius: 6px;
  border: none; background: none; cursor: pointer; text-align: left;
  color: var(--accent, #2563eb);
}
.col-status-opt:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); }
.col-status-opt.current { cursor: default; }
.col-status-opt.current:hover { background: none; }

/* เก็บครบแล้ว: collapsible, muted lane that keeps received rounds revertible */
.col-lane-toggle { width: 100%; gap: 9px; cursor: pointer; }
.col-lane-toggle .col-lane-title { flex: 1; text-align: left; }
.col-lane-toggle:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-lane--done { opacity: 0.92; }

/* ── FlowAccount-driven billing workspace (rewrite) ─────────────────────── */
/* Toolbar extras: search + segmented filter + sync age. */
.col-search { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border-strong, #d4d4d8); border-radius: 8px; color: var(--fg-3); background: var(--bg); min-width: 220px; }
.col-search:focus-within { border-color: var(--fg-2); box-shadow: 0 0 0 3px color-mix(in oklab, var(--fg) 8%, transparent); }
.col-search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--fg); width: 100%; }
.col-search input::placeholder { color: var(--fg-3); }
.col-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); border-radius: 8px; }
.col-seg-btn { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--fg-2); padding: 4px 11px; border-radius: 6px; cursor: pointer; transition: background 140ms, color 140ms; }
.col-seg-btn:hover { color: var(--fg); }
.col-seg-btn.active { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.col-sync-at { font-size: 12px; color: var(--fg-3); white-space: nowrap; }

/* Loading skeleton. */
.col-skeleton { display: flex; flex-direction: column; gap: 10px; }
.col-skel-row { height: 56px; border-radius: 10px; background: linear-gradient(90deg, color-mix(in oklab, var(--fg) 5%, transparent) 25%, color-mix(in oklab, var(--fg) 9%, transparent) 37%, color-mix(in oklab, var(--fg) 5%, transparent) 63%); background-size: 400% 100%; animation: col-shimmer 1.4s ease infinite; }
@keyframes col-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .col-skel-row { animation: none; } }

/* Stacked value bar: เก็บแล้ว | รอเก็บ | ยังไม่วางบิล. */
.col-bar { display: inline-flex; height: 7px; border-radius: 999px; overflow: hidden; background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); width: 110px; flex: none; }
.col-bar-seg { height: 100%; }
.col-bar-seg.seg-paid { background: oklch(0.62 0.15 150); }
.col-bar-seg.seg-ar { background: oklch(0.74 0.15 70); }
.col-bar-seg.seg-unbilled { background: oklch(0.82 0.02 250); }

/* Ledger strip (replaces the KPI card grid). */
.col-ledger { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.col-ledger-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.col-ledger-count { font-size: 13px; font-weight: 700; color: var(--fg); }
.col-ledger-total { font-size: 14px; font-weight: 700; color: var(--fg); }
.col-ledger .col-bar { width: 100%; height: 10px; }
.col-ledger-legend { display: flex; flex-wrap: wrap; gap: 18px; }
.col-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-2); }
.col-leg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.col-leg i.seg-paid { background: oklch(0.62 0.15 150); }
.col-leg i.seg-ar { background: oklch(0.74 0.15 70); }
.col-leg i.seg-unbilled { background: oklch(0.82 0.02 250); }
.col-leg b { color: var(--fg); }

/* Project cards. */
.col-cards { display: flex; flex-direction: column; }
.col-card { border-bottom: 1px solid var(--line); }
.col-card:last-child { border-bottom: 0; }
.col-card.is-done { opacity: 0.8; }
.col-card-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; transition: background 130ms; }
.col-card-head:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-caret { display: inline-flex; color: var(--fg-3); flex: none; transition: transform 160ms cubic-bezier(0.16,1,0.3,1); }
.col-caret.open { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .col-caret { transition: none; } }
.col-card-name { font-size: 13.5px; font-weight: 600; color: var(--fg); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-card-who { font-size: 12px; color: var(--fg-2); width: 150px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-card-value { font-size: 13px; font-weight: 700; color: var(--fg); width: 96px; text-align: right; flex: none; }
.col-stage { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; flex: none; width: 116px; text-align: center; }
.col-stage.st-ok { color: oklch(0.46 0.16 150); background: color-mix(in oklab, oklch(0.55 0.16 150) 14%, transparent); }
.col-stage.st-ar { color: oklch(0.5 0.14 60); background: color-mix(in oklab, oklch(0.7 0.15 70) 20%, transparent); }
.col-stage.st-wait { color: var(--fg-2); background: var(--line-soft, color-mix(in oklab, var(--fg) 7%, transparent)); }
.col-stage.st-mid { color: oklch(0.48 0.16 250); background: color-mix(in oklab, oklch(0.5 0.16 250) 13%, transparent); }
.col-card-gap { flex: 1; }

/* Project lifecycle stage chip (outline; distinct from the filled billing pill). */
.col-pstage { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; white-space: nowrap; flex: none; border: 1px solid var(--border-strong, #d4d4d8); color: var(--fg-2); }
.col-pstage.ps-active { color: oklch(0.46 0.15 250); border-color: color-mix(in oklab, oklch(0.5 0.16 250) 38%, transparent); }
.col-pstage.ps-closed { color: var(--fg-3); }
.col-pstage.ps-pipe { color: oklch(0.5 0.12 60); border-color: color-mix(in oklab, oklch(0.7 0.14 70) 42%, transparent); }
.col-pstage.ps-dropped { color: oklch(0.54 0.16 25); border-color: color-mix(in oklab, oklch(0.6 0.18 25) 38%, transparent); }

/* Action-lane status dots. */
.col-lane-title { display: inline-flex; align-items: center; gap: 7px; }
.col-lane-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ld-ar { background: oklch(0.7 0.17 50); }
.ld-bill { background: oklch(0.72 0.02 250); }
.ld-done { background: oklch(0.62 0.15 150); }

/* "ยังไม่มีเอกสาร" sub-block inside the ต้องวางบิล lane. */
.col-nodoc-block { border-top: 1px solid var(--line); }
.col-subhead { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent; padding: 9px 14px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--fg-2); cursor: pointer; }
.col-subhead:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-subhead .col-lane-meta { font-weight: 400; }
.col-nodoc-name { flex: 0 1 auto; max-width: 340px; }
.col-nodoc-who { flex: 1; }

/* Document rows inside a project. */
.col-doclist { padding: 2px 14px 10px 40px; display: flex; flex-direction: column; gap: 2px; }
.col-doclist-empty { font-size: 14px; color: var(--fg-3); padding: 6px 0; }
.col-doc { display: grid; grid-template-columns: 78px minmax(110px, 1fr) 92px 104px auto; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 7px; }
.col-doc:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-doc-tier { font-size: 10.5px; font-weight: 700; text-align: center; padding: 2px 0; border-radius: 5px; }
.col-doc-tier.tier-quotation { color: var(--fg-2); background: var(--line-soft, color-mix(in oklab, var(--fg) 8%, transparent)); }
.col-doc-tier.tier-billingNote { color: oklch(0.48 0.16 250); background: color-mix(in oklab, oklch(0.5 0.16 250) 13%, transparent); }
.col-doc-tier.tier-taxInvoice { color: oklch(0.48 0.17 300); background: color-mix(in oklab, oklch(0.5 0.17 300) 13%, transparent); }
.col-doc-tier.tier-cashInvoice, .col-doc-tier.tier-receipt { color: oklch(0.44 0.15 150); background: color-mix(in oklab, oklch(0.55 0.16 150) 14%, transparent); }
.col-doc-serial { font-size: 12.5px; font-weight: 600; color: var(--fg); background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; justify-self: start; }
.col-doc-serial:hover { color: oklch(0.48 0.16 250); text-decoration: underline; }
.col-doc-date { font-size: 12px; color: var(--fg-2); }
.col-doc-amt { font-size: 12.5px; font-weight: 600; color: var(--fg); text-align: right; }

/* Quotation anchor line (the project's agreed value). */
.col-qt { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; border-bottom: 1px solid var(--line); padding: 4px 4px 9px; margin-bottom: 7px; cursor: pointer; font: inherit; text-align: left; }
.col-qt-lbl { font-size: 10px; font-weight: 700; color: var(--fg-3); background: var(--line-soft, color-mix(in oklab, var(--fg) 7%, transparent)); padding: 2px 7px; border-radius: 5px; flex: none; }
.col-qt-serial { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.col-qt:hover .col-qt-serial { color: oklch(0.48 0.16 250); text-decoration: underline; }
.col-qt-date { font-size: 12px; color: var(--fg-2); }
.col-qt-amt { font-size: 13px; font-weight: 700; color: var(--fg); margin-left: auto; }

/* Installments (งวด): วางบิล → เก็บเงิน lifecycle per billing note. */
.col-insts { display: flex; flex-direction: column; gap: 7px; }
.col-inst { display: grid; grid-template-columns: 54px 104px 1fr; align-items: center; gap: 12px; }
.col-inst-no { font-size: 11px; font-weight: 700; color: var(--fg-2); background: var(--line-soft, color-mix(in oklab, var(--fg) 7%, transparent)); padding: 2px 0; border-radius: 6px; text-align: center; }
.col-inst-amt { font-size: 13px; font-weight: 700; color: var(--fg); text-align: right; }
.col-inst-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.col-step { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; background: var(--bg); font: inherit; font-size: 12px; color: var(--fg); cursor: pointer; transition: border-color 120ms, background 120ms; }
.col-step:hover { border-color: var(--border-strong, #d4d4d8); background: var(--line-soft, color-mix(in oklab, var(--fg) 4%, transparent)); }
.col-step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); flex: none; }
.col-step.tone-wait .col-step-dot { background: oklch(0.72 0.02 250); }
.col-step.tone-mid  .col-step-dot { background: oklch(0.55 0.16 250); }
.col-step.tone-ok   .col-step-dot { background: oklch(0.6 0.15 150); }
.col-step.tone-void .col-step-dot { background: oklch(0.6 0.2 25); }
.col-step.tone-mid  .col-step-lbl { color: oklch(0.46 0.16 250); }
.col-step.tone-ok   .col-step-lbl { color: oklch(0.44 0.15 150); }
.col-step-lbl { font-weight: 600; }
.col-step-serial { color: var(--fg-2); }
.col-step-date { color: var(--fg-3); font-size: 11.5px; }
.col-step.is-empty { color: var(--fg-3); border-style: dashed; cursor: default; background: transparent; }
.col-step-arrow { color: var(--fg-3); display: inline-flex; flex: none; }

/* "No FlowAccount document yet" quiet lane. */
.col-lane--nodoc { opacity: 0.96; }
.col-nodoc-list { display: flex; flex-direction: column; }
.col-nodoc-hint { font-size: 14px; color: var(--fg-3); padding: 10px 14px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.col-nodoc-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.col-nodoc-row:last-child { border-bottom: 0; }
.col-nodoc-name { font-size: 13px; color: var(--fg); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-nodoc-who { font-size: 12px; color: var(--fg-2); }
.col-link { display: inline-flex; align-items: center; gap: 3px; border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: oklch(0.48 0.16 250); cursor: pointer; padding: 0; }
.col-link:hover { text-decoration: underline; }
.col-pick-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong, #d4d4d8); background: var(--bg); font: inherit; font-size: 12px; font-weight: 600; color: var(--fg); cursor: pointer; padding: 4px 10px; border-radius: 7px; white-space: nowrap; transition: border-color 130ms, background 130ms; }
.col-pick-btn:hover { border-color: oklch(0.6 0.16 250); background: color-mix(in oklab, oklch(0.5 0.16 250) 7%, transparent); }

/* Document picker modal (attach a doc to a no-doc project). */
.col-picker { width: min(680px, 94vw); max-height: 82vh; display: flex; flex-direction: column; }
.col-picker-proj { font-size: 13px; font-weight: 700; color: var(--fg); margin-left: 8px; }
.col-picker-tools { display: flex; gap: 10px; padding: 12px 16px 0; flex-wrap: wrap; }
.col-picker-tools .col-search { flex: 1; min-width: 200px; }
.col-picker-hint { font-size: 14px; color: var(--fg-3); padding: 8px 16px 4px; line-height: 1.5; }
.col-picker-list { overflow: auto; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.col-pick-row { display: grid; grid-template-columns: 72px 124px 1fr minmax(120px, 0.8fr) 84px 96px auto 16px; align-items: center; gap: 10px; width: 100%; padding: 8px 8px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit; text-align: left; color: var(--fg); transition: background 120ms; }
.col-pick-row:hover:not(:disabled) { background: color-mix(in oklab, oklch(0.5 0.16 250) 8%, transparent); }
.col-pick-row:disabled { opacity: 0.5; cursor: default; }
.col-pick-row > svg { color: var(--fg-3); }
.col-pick-serial { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.col-pick-who { font-size: 12.5px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-pick-ref { font-size: 12.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-pick-date { font-size: 12px; color: var(--fg-3); }
.col-pick-amt { font-size: 12.5px; font-weight: 600; color: var(--fg); text-align: right; }
@media (max-width: 720px) {
  .col-pick-row { grid-template-columns: 64px 1fr auto auto 16px; }
  .col-pick-who, .col-pick-ref, .col-pick-date { display: none; }
}

@media (max-width: 720px) {
  .col-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .col-toolbar-title { flex-basis: 100%; }
  .col-sync-at { display: none; }
  .col-card-who, .col-card .col-bar { display: none; }
  .col-card-value { width: auto; }
  .col-card-action { padding-inline: 7px; }
  .col-doc { grid-template-columns: 64px 1fr auto; row-gap: 2px; }
  .col-doc-date { display: none; }
  .col-doc .fl-stag { grid-column: 2 / 4; justify-self: start; }
  .col-search { min-width: 0; flex: 1 1 140px; }
  .col-inst { grid-template-columns: auto 1fr; row-gap: 6px; }
  .col-inst-amt { text-align: left; }
  .col-inst-steps { grid-column: 1 / -1; }
}

/* Inline-edit fields (amount / due): look like text until clicked. */
.col-inline {
  background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 1px 5px; cursor: text; color: inherit; font: inherit; text-align: inherit;
}
.col-inline:hover:not(:disabled) { border-color: var(--line); background: var(--bg); }
.col-inline:disabled { cursor: default; opacity: 0.6; }
.col-subtask-amt.col-inline { text-align: right; justify-self: end; }
.col-subtask-due.col-inline { justify-self: start; }
.col-inline-input {
  width: 100%; max-width: 130px;
  padding: 3px 6px; border: 1px solid var(--accent, #2563eb); border-radius: 5px;
  background: var(--bg); color: var(--fg); font: inherit;
  outline: none;
}
.col-inline-input.mono { text-align: right; font-variant-numeric: tabular-nums; }

/* Per-round edit menu (⋯): split %, monthly duplicate, delete */
.col-round-menu-wrap { position: relative; justify-self: end; }
.col-round-menu-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid transparent; background: none; cursor: pointer;
  color: var(--fg-3); font-size: 16px; line-height: 1;
}
.col-round-menu-btn:hover:not(:disabled) { border-color: var(--line); background: var(--bg); color: var(--fg); }
.col-round-menu-btn:disabled { opacity: 0.5; cursor: default; }
.col-round-menu {
  position: fixed; z-index: 61; min-width: 210px;
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: 0px 2px 4px rgba(0,0,0,0.06), 2px 4px 16px rgba(0,0,0,0.12);
}
.col-round-opt {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: 6px;
  border: none; background: none; cursor: pointer; text-align: left;
  font-size: 13px; color: var(--fg);
}
.col-round-opt:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); }
.col-round-opt.danger { color: oklch(0.5 0.2 25); }
.col-round-opt.danger:hover { background: color-mix(in oklab, oklch(0.55 0.2 25) 10%, transparent); }
.col-round-opt.accent { color: var(--accent, #2563eb); font-weight: 600; }
/* FlowAccount linkage chip on a round */
.col-fa-chip {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  padding: 1px 7px; border-radius: 999px;
  color: oklch(0.46 0.16 150);
  background: color-mix(in oklab, oklch(0.55 0.16 150) 13%, transparent);
}
/* Backfilled (linked-from-FlowAccount) docs: quiet zinc, distinct from the
   green "we issued this" chip. Informational, not a status signal. */
.col-fa-chip--linked {
  color: var(--fg-2);
  background: var(--bg);
  border: 1px solid var(--border-strong, #d4d4d8);
}
.col-fa-chip-type { font-weight: 700; color: var(--fg-3); margin-right: 4px; }
/* Live FlowAccount status dot on a linked chip (status pulled without a sync). */
.col-fa-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--fg-3); }
.col-fa-chip.tone-await .col-fa-dot { background: oklch(0.7 0.02 250); }
.col-fa-chip.tone-billed .col-fa-dot { background: oklch(0.55 0.16 250); }
.col-fa-chip.tone-paid { color: oklch(0.46 0.16 150); border-color: color-mix(in oklab, oklch(0.55 0.16 150) 45%, transparent); }
.col-fa-chip.tone-paid .col-fa-dot { background: oklch(0.55 0.16 150); }
.col-fa-chip.tone-void { color: oklch(0.5 0.18 25); }
.col-fa-chip.tone-void .col-fa-dot { background: oklch(0.55 0.2 25); }
/* "live" marker in the detail modal status line. */
.fl-live { margin-left: 7px; font-size: 10px; font-weight: 700; color: oklch(0.55 0.16 150); }
.col-menu-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 9px; }
.col-menu-form-label { font-size: 12px; color: var(--fg-2); font-weight: 500; }
.col-menu-form-row { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg-2); }
.col-menu-form-row input {
  width: 70px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); font: inherit; outline: none;
  font-variant-numeric: tabular-nums;
}
.col-menu-form-row input:focus { border-color: var(--accent, #2563eb); }
.col-menu-form-btn {
  padding: 6px 10px; border-radius: 6px; border: none;
  background: var(--accent, #2563eb); color: #fff; cursor: pointer;
  font-size: 12.5px; font-weight: 600;
}
.col-menu-form-btn:hover { opacity: 0.92; }

/* ── FlowAccount backfill / linking review screen ── */
.fl-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.fl-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex: none; }
.fl-toolbar-title { font-size: 15px; font-weight: 700; color: var(--fg); }
.fl-lastsync { font-size: 12px; color: var(--fg-3); }
.fl-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.fl-empty { padding: 40px 16px; text-align: center; color: var(--fg-3); }
.fl-note { font-size: 14px; color: var(--fg-3); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }

.fl-section { flex: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fl-section-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--line-soft, var(--bg)); }
.fl-section-title { font-size: 13px; font-weight: 700; color: var(--fg); }
.fl-section-count { font-size: 11px; font-weight: 600; color: var(--fg-3); }
.fl-list { display: flex; flex-direction: column; }

.fl-row { display: grid; grid-template-columns: minmax(0,1.2fr) 18px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft, var(--line)); }
.fl-row:last-child { border-bottom: none; }
.fl-row.busy { opacity: 0.5; }
.fl-arrow { color: var(--fg-3); text-align: center; }

.fl-doc-top { display: flex; align-items: baseline; gap: 8px; }
.fl-doc-type { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in oklab, var(--accent,#2563eb) 12%, transparent); color: var(--accent,#2563eb); white-space: nowrap; }
.fl-doc-serial { font-size: 12px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.fl-doc-contact { font-size: 13px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.fl-doc-meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--fg-3); margin-top: 2px; }
.fl-doc-meta .mono { font-variant-numeric: tabular-nums; color: var(--fg-2); }

.fl-target { display: flex; flex-direction: column; }
.fl-target-name { font-size: 13px; font-weight: 600; color: var(--fg); }
.fl-target-round { font-size: 11px; color: var(--fg-3); }
.fl-target--none { color: var(--fg-3); font-style: normal; }
.fl-reason { font-size: 14px; color: var(--fg-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-conf { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.fl-conf-bar { width: 56px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fl-conf-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--fg-3); }
.fl-conf--ok .fl-conf-bar > span { background: oklch(0.55 0.16 150); }
.fl-conf--warn .fl-conf-bar > span { background: #d9920a; }
.fl-conf--low .fl-conf-bar > span { background: oklch(0.6 0.2 25); }
.fl-conf-num { font-size: 10.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

.fl-actions { display: flex; align-items: center; gap: 6px; justify-self: end; position: relative; }
.fl-link-btn { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; border: 1px solid var(--line); background: var(--bg); color: var(--fg-2); }
.fl-link-btn:hover:not(:disabled) { border-color: var(--fg-3); color: var(--fg); }
.fl-link-btn:disabled { opacity: 0.5; cursor: default; }
.fl-link-btn.primary { background: var(--accent,#2563eb); border-color: var(--accent,#2563eb); color: #fff; }
.fl-link-btn.danger { color: oklch(0.5 0.2 25); border-color: color-mix(in oklab, oklch(0.55 0.2 25) 30%, var(--line)); }
.fl-link-btn.ghost { background: none; }

.fl-picker { position: absolute; right: 0; top: 100%; z-index: 30; margin-top: 4px; width: 280px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 2px 4px 16px rgba(0,0,0,0.14); display: flex; flex-direction: column; gap: 6px; }
.fl-picker-input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; outline: none; }
.fl-picker-list { display: flex; flex-direction: column; max-height: 240px; overflow: auto; }
.fl-picker-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: none; background: none; cursor: pointer; text-align: left; border-radius: 6px; }
.fl-picker-opt:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); }
.fl-picker-name { font-size: 12.5px; color: var(--fg); }
.fl-picker-cust { font-size: 11px; color: var(--fg-3); }
.fl-picker-empty { padding: 8px; font-size: 14px; color: var(--fg-3); text-align: center; }

/* status tag (FlowAccount lifecycle) */
.fl-stag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.fl-stag--wait { color: var(--fg-3); background: var(--line-soft, color-mix(in oklab, var(--fg) 7%, transparent)); }
.fl-stag--mid  { color: oklch(0.5 0.16 250); background: color-mix(in oklab, oklch(0.5 0.16 250) 12%, transparent); }
.fl-stag--ok   { color: oklch(0.46 0.16 150); background: color-mix(in oklab, oklch(0.55 0.16 150) 14%, transparent); }
.fl-stag--void { color: oklch(0.5 0.18 25); background: color-mix(in oklab, oklch(0.55 0.2 25) 12%, transparent); text-decoration: line-through; }

.fl-doc-open { background: none; border: none; padding: 0; cursor: pointer; color: var(--accent, #2563eb); font: inherit; }
.fl-doc-open:hover { text-decoration: underline; }

/* detail modal */
.fl-modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.4); display: grid; place-items: center; padding: 24px; }
.fl-modal { width: min(680px, 100%); max-height: 86vh; overflow: auto; background: var(--bg); border-radius: 14px; box-shadow: 0px 24px 56px -16px rgba(0,0,0,0.4), 0px 0px 8px rgba(0,0,0,0.16); }
.fl-modal-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg); }
.fl-modal-head .fl-doc-type { margin-right: 8px; }
.fl-modal-serial { font-size: 14px; font-weight: 600; color: var(--fg); }
.fl-modal-x { background: none; border: none; cursor: pointer; color: var(--fg-3); padding: 4px; border-radius: 6px; }
.fl-modal-x:hover { background: var(--line-soft, color-mix(in oklab, var(--fg) 6%, transparent)); color: var(--fg); }
.fl-modal-body { padding: 16px 18px 22px; }
.fl-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; }
.fl-detail-grid > div { display: flex; flex-direction: column; gap: 1px; }
.fl-k { font-size: 11px; color: var(--fg-3); }
.fl-v { font-size: 13px; color: var(--fg); }
.fl-addr { margin-top: 8px; font-size: 12px; color: var(--fg-2); }
.fl-items { width: 100%; border-collapse: collapse; margin-top: 16px; }
.fl-items th { font-size: 11px; color: var(--fg-3); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.fl-items th.r, .fl-items td.r { text-align: right; }
.fl-items td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft, var(--line)); font-size: 12.5px; vertical-align: top; }
.fl-item-name { color: var(--fg); }
.fl-item-desc { font-size: 14px; color: var(--fg-3); margin-top: 2px; }
.fl-totals { margin-top: 12px; margin-left: auto; width: max-content; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.fl-totals > div { display: flex; justify-content: space-between; gap: 24px; font-size: 12.5px; color: var(--fg-2); }
.fl-totals .fl-grand { font-size: 14px; font-weight: 700; color: var(--fg); border-top: 1px solid var(--line); padding-top: 5px; margin-top: 2px; }
.fl-chain { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.fl-chain-title { font-size: 12px; font-weight: 600; color: var(--fg-2); margin-bottom: 8px; }
.fl-chain-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; }
.fl-chain-row.current { background: var(--line-soft, color-mix(in oklab, var(--accent,#2563eb) 8%, transparent)); }
.fl-chain-serial { font-size: 12px; color: var(--fg-2); }
.fl-chain-date { font-size: 11.5px; color: var(--fg-3); }
.fl-chain-amt { font-size: 12px; color: var(--fg); text-align: right; }
.fl-err { color: oklch(0.55 0.2 25); }

/* Collections: in-page document link/unlink controls. */
.col-card-action {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg-2);
  border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.col-card-action:hover { border-color: oklch(0.6 0.16 250); color: oklch(0.48 0.16 250); background: color-mix(in oklab, oklch(0.5 0.16 250) 7%, transparent); }
.col-doc { grid-template-columns: 78px minmax(110px, 1fr) 92px 104px auto auto; }
.col-doc-unlink {
  justify-self: end; border: 1px solid transparent; background: transparent; color: var(--fg-3);
  border-radius: 999px; padding: 2px 8px; font: inherit; font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.col-doc-unlink:hover:not(:disabled) { color: oklch(0.55 0.18 25); border-color: color-mix(in oklab, oklch(0.6 0.18 25) 28%, transparent); background: color-mix(in oklab, oklch(0.6 0.18 25) 7%, transparent); }
.col-doc-unlink:disabled { opacity: 0.55; cursor: default; }
.col-qt-row { display: flex; align-items: stretch; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 7px; }
.col-qt-row .col-qt { border-bottom: 0; margin-bottom: 0; flex: 1; min-width: 0; }
.col-qt-row > .col-doc-unlink { align-self: center; margin-right: 4px; }
.col-step-wrap { display: inline-flex; align-items: center; gap: 4px; }
.col-step-unlink {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--fg-3);
  font: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.col-step-unlink:hover:not(:disabled) { color: oklch(0.55 0.18 25); border-color: color-mix(in oklab, oklch(0.6 0.18 25) 28%, transparent); background: color-mix(in oklab, oklch(0.6 0.18 25) 7%, transparent); }
.col-step-unlink:disabled { opacity: 0.55; cursor: default; }
@media (max-width: 720px) {
  .col-doc { grid-template-columns: 64px 1fr auto auto; }
  .col-doc-unlink { padding-inline: 6px; }
}

/* Collections: subgroup each billing lane by project status. */
.col-stage-groups { display: flex; flex-direction: column; }
.col-stage-group + .col-stage-group { border-top: 1px solid var(--line); }
.col-stage-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 7px;
  font-size: 12px; font-weight: 700; color: var(--fg-2);
  background: var(--line-soft, color-mix(in oklab, var(--fg) 3%, transparent));
}
.col-stage-head .col-lane-meta { margin-left: auto; font-weight: 500; }
.col-nodoc-list .col-stage-head { padding-left: 14px; }

/* Collections: make the no-document block read as a subsection, not a project row. */
.col-nodoc-block { margin-top: 8px; border-top: 1px solid var(--line); background: color-mix(in oklab, var(--fg) 1.5%, transparent); }
.col-subhead {
  padding: 11px 14px; background: color-mix(in oklab, oklch(0.72 0.02 250) 12%, transparent);
  border-bottom: 1px solid var(--line); color: var(--fg); text-transform: none;
}
.col-subhead:hover { background: color-mix(in oklab, oklch(0.72 0.02 250) 18%, transparent); }
.col-subhead-icon { display: inline-flex; color: var(--fg-3); }
.col-subhead-text { font-size: 12px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.col-subhead .col-lane-meta { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }

/* Collections: status subgroups use the real project pipeline order. */
.col-status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px color-mix(in oklab, currentColor 8%, transparent); }
.col-status-name { font-size: 11.5px; font-weight: 800; letter-spacing: .025em; color: var(--fg); }

.col-pick-status { font-size: 11px; color: var(--fg-3); white-space: nowrap; }

/* Collections picker: make FlowAccount document status chips visually distinct. */
.col-picker .fl-stag, .col-pick-status {
  border: 1px solid currentColor; font-weight: 800; letter-spacing: .01em;
}
.col-picker .fl-stag--wait { color: oklch(0.50 0.14 70); background: color-mix(in oklab, oklch(0.75 0.16 75) 22%, transparent); }
.col-picker .fl-stag--mid  { color: oklch(0.46 0.16 250); background: color-mix(in oklab, oklch(0.58 0.18 250) 18%, transparent); }
.col-picker .fl-stag--ok   { color: oklch(0.43 0.15 150); background: color-mix(in oklab, oklch(0.58 0.16 150) 20%, transparent); }
.col-picker .fl-stag--void { color: oklch(0.50 0.18 25); background: color-mix(in oklab, oklch(0.60 0.20 25) 16%, transparent); }

/* Collections: project hover detail preview. */
.col-card, .col-nodoc-row { position: relative; }
.col-hover-card {
  position: absolute; left: 54px; top: calc(100% - 4px); z-index: 40;
  width: min(360px, calc(100vw - 36px)); padding: 12px; border: 1px solid var(--border-strong, #d4d4d8);
  border-radius: 12px; background: color-mix(in oklab, var(--bg) 96%, white 4%);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 3px 10px rgba(15, 23, 42, .08);
  opacity: 0; pointer-events: none; transform: translateY(-2px) scale(.98);
  transition: opacity 120ms ease, transform 120ms ease;
}
.col-card:hover > .col-hover-card, .col-card:focus-within > .col-hover-card,
.col-nodoc-row:hover > .col-hover-card, .col-nodoc-row:focus-within > .col-hover-card { opacity: 1; transform: translateY(0) scale(1); }
.col-nodoc-row .col-hover-card { left: 18px; top: calc(100% - 2px); }
.col-hover-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 9px; }
.col-hover-name { font-size: 13px; font-weight: 800; color: var(--fg); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-hover-status { font-size: 10.5px; font-weight: 900; white-space: nowrap; }
.col-hover-grid { display: grid; grid-template-columns: 72px 1fr; gap: 5px 10px; font-size: 12px; }
.col-hover-grid span { color: var(--fg-3); }
.col-hover-grid b { color: var(--fg); font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-hover-section { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.col-hover-label { font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 5px; }
.col-hover-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; line-height: 1.35; }
.col-hover-line span { color: var(--fg-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-hover-line em { color: var(--fg-3); font-style: normal; white-space: nowrap; }
@media (max-width: 720px) { .col-hover-card { display: none; } }
