/* Twinmark — platform design system
   Deep forest ground · bronze accent */

:root {
  --bg:        #0B0C10;
  --bg-rgb:    11,12,16;
  --bg-2:      #0E1015;
  --bg-2-rgb:  14,16,21;
  --surface:   #14161D;
  --surface-2: #1C1F29;
  --line:      #252938;
  --line-2:    #333849;
  --text:      #ECEDF2;
  --muted:     #9096A8;
  --faint:     #5C6275;
  /* Accent is metallic gold. Vars keep the --amber names for history; they
     hold gold values. --on-accent is the text colour that sits ON the accent,
     --accent-deep the shadow end used in gradients. */
  --amber:     #EDA93F;
  --amber-hi:  #F7BE63;
  --amber-rgb: 237,169,63;
  --amber-dim: rgba(237,169,63,0.12);
  --accent-deep: #A96C1E;
  --on-accent: #1A1006;
  --live:      #3DD68C;
  --live-rgb:  61,214,140;
  --up:        #3DD68C;
  --down:      #FF5C5C;
  --down-rgb:  255,92,92;
  --radius:    10px;
  --radius-s:  7px;
  --shadow-1:  0 1px 2px rgba(0,0,0,.25), 0 2px 10px rgba(0,0,0,.18);
  --shadow-2:  0 4px 16px rgba(0,0,0,.30);
  --shadow-3:  0 12px 48px rgba(0,0,0,.50);
  --t-fast: 120ms cubic-bezier(.2,.7,.3,1);
  --t:      160ms cubic-bezier(.2,.7,.3,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: rgba(var(--amber-rgb), 0.22); }
button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }
:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── WORDMARK ── */
.wordmark {
  display: flex; align-items: baseline; gap: 1px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
  user-select: none; text-decoration: none;
}
.wordmark .tld { color: var(--faint); font-weight: 500; }
.caret {
  display: inline-block; width: 7px; height: 15px;
  background: var(--amber); margin-left: 3px;
  transform: translateY(2px);
  animation: blink 1.2s step-end infinite;
}
@keyframes blink { 0%, 65% { opacity: 1; } 66%, 100% { opacity: 0; } }

/* ── APP SHELL ── */
.shell { display: none; min-height: 100vh; min-height: 100dvh; }
body.ready .shell { display: flex; }

.sidebar {
  width: 240px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 18px 12px 14px;
}
.sidebar .wordmark { padding: 2px 10px 0; }

.workspace {
  margin: 20px 0 6px;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface);
}
.workspace-avatar {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--amber), var(--accent-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--on-accent);
}
.workspace-name { font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.workspace-plan { font-size: 10.5px; color: var(--faint); line-height: 1.3; }

.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-s);
  font-size: 13px; color: var(--muted); text-decoration: none;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 2px; border-radius: 2px; background: var(--amber);
}
.nav-item.active svg { color: var(--amber); opacity: 1; }
.nav-item[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }

/* ── NAV GROUP (expandable sub-nav, e.g. Prospects → statuses) ── */
.nav-item.nav-parent { padding: 0; gap: 0; }
.nav-parent-link {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 7px 4px 7px 10px; color: inherit; text-decoration: none;
}
.nav-chevron-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; align-self: stretch; flex-shrink: 0;
  background: none; border: none; color: inherit; cursor: pointer;
}
.nav-chevron { transition: transform var(--t); opacity: 0.7; }
.nav-chevron.collapsed { transform: rotate(-90deg); }
.nav-sub-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--t); }
.nav-sub-wrap.collapsed { grid-template-rows: 0fr; }
.nav-sub {
  overflow: hidden; display: flex; flex-direction: column; gap: 1px;
  margin: 2px 0 6px 22px; padding-left: 10px; border-left: 1px solid var(--line);
}
.nav-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-s);
  font-size: 12px; color: var(--muted); text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-sub-item:hover { background: var(--surface-2); color: var(--text); }
.nav-sub-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav-sub-item.nav-sub-overview {
  color: var(--text); font-weight: 600;
  margin-bottom: 5px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-s) var(--radius-s) 0 0;
}
.nav-sub-item.nav-sub-overview svg { flex-shrink: 0; opacity: 0.85; color: var(--amber); }
.nav-sub-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--muted)); flex-shrink: 0; }
.nav-sub-count { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--faint); }

.soon-pill {
  margin-left: auto; font-size: 9px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px;
}
.sidebar-spacer { flex: 1; }

.signout-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-s);
  font-size: 12.5px; color: var(--muted);
  background: none; border: none; width: 100%; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.signout-row:hover { background: var(--surface-2); color: var(--text); }

/* ── MAIN / TOPBAR ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 54px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--bg-rgb), 0.86);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.view-title { font-size: 13px; font-weight: 500; }
.topbar-spacer { flex: 1; }

.search-stub {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; min-width: 190px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--faint); font-size: 12px;
}
.search-stub:hover { border-color: var(--line-2); color: var(--muted); }
.kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--faint); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; background: var(--bg);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--radius-s);
  font-size: 12.5px; font-weight: 500; text-decoration: none;
  border: 1px solid transparent; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn-ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
/* Primary button — a conic gold ramp rotates behind it, and a dark face inset
   by 1.5px covers all but the rim, so what reads is a lit metal edge rather
   than a painted gradient. The glow underneath is drawn from two ends of the
   ramp, so it's the button's own colour instead of generic black. */
.btn-primary {
  --gb-1: #b8651f; --gb-2: #e0932f; --gb-3: #f6c667; --gb-4: #ffe9a8; --gb-5: #d98a2b;
  --gb-glow-a: rgba(240,168,92,0.75);
  --gb-glow-b: rgba(184,101,31,0.70);
  --gb-face:    linear-gradient(155deg, #1a140c 0%, #0b0a08 52%, #17110a 100%);
  --gb-face-hi: linear-gradient(155deg, #2a2012 0%, #14110c 52%, #241a0e 100%);
  position: relative; isolation: isolate; overflow: hidden;
  border: 0; background: none;
  color: #fff; font-weight: 650; letter-spacing: 0.005em;
  box-shadow: 0 6px 24px -12px var(--gb-glow-a), 0 10px 34px -16px var(--gb-glow-b);
  transition: transform var(--t), box-shadow var(--t);
}
.btn-primary::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 240%; aspect-ratio: 1; z-index: -2;
  background: conic-gradient(from 0deg, var(--gb-1), var(--gb-2), var(--gb-3), var(--gb-4), var(--gb-5), var(--gb-1));
  /* resting angle lives here as well as in the keyframes: with animation
     suppressed the element falls back to this rule, and without the translate
     it would hang off centre and light only one corner */
  transform: translate(-50%, -50%) rotate(-28deg);
  animation: ctaRamp 7s linear infinite;
}
@keyframes ctaRamp {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
.btn-primary::after {
  content: ''; position: absolute; inset: 1.5px; z-index: -1;
  border-radius: calc(var(--radius-s) - 1.5px);
  background: var(--gb-face);
  transition: background var(--t);
}
.btn-primary:hover, .btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -10px var(--gb-glow-a), 0 14px 44px -14px var(--gb-glow-b);
}
/* the face lifts a shade too, so the whole button brightens rather than only
   the shadow under it */
.btn-primary:hover::after, .btn-primary:focus-visible::after { background: var(--gb-face-hi); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-danger { color: var(--down); border-color: rgba(var(--down-rgb), 0.3); background: rgba(var(--down-rgb), 0.06); }
.btn-danger:hover { background: rgba(var(--down-rgb), 0.12); }
.btn-danger-solid { color: #fff; border-color: var(--down); background: var(--down); }
.btn-danger-solid:hover { background: #E24B4B; }
.btn-sm { padding: 4px 10px; font-size: 11.5px; }

.chip-act {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--amber);
  background: var(--amber-dim); border: 1px solid rgba(var(--amber-rgb), 0.22);
  border-radius: 6px; padding: 4px 10px; text-decoration: none; cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.chip-act:hover { background: rgba(var(--amber-rgb), 0.16); }
.chip-act:active { transform: translateY(1px); }

/* ── CONTENT / CARDS ── */
.content { width: 100%; max-width: 1128px; margin: 0 auto; padding: 30px 28px 56px; }
.content-wide { max-width: none; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 20px;
  box-shadow: var(--shadow-1);
}
.card-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.card-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.card-hd-spacer { flex: 1; }

.rise { opacity: 0; transform: translateY(10px); animation: rise 0.45s cubic-bezier(0.2,0.6,0.2,1) forwards; }
.d1 { animation-delay: 0.03s; } .d2 { animation-delay: 0.09s; }
.d3 { animation-delay: 0.15s; } .d4 { animation-delay: 0.21s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px 15px;
  box-shadow: var(--shadow-1);
}
.kpi-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.kpi-val {
  font-size: 27px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.kpi-sub { font-size: 11px; color: var(--faint); margin-top: 7px; }

/* ── CALL STRIP (today's dials, above the prospect queues) ── */
.call-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 15px; margin-bottom: 12px;
  box-shadow: var(--shadow-1);
}
.call-strip-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.call-strip-stat { font-size: 12.5px; color: var(--faint); }
.call-strip-stat b {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 14.5px; font-weight: 600; color: var(--text); margin-right: 5px;
}
.call-strip-rate b { color: var(--amber); margin-right: 0; }
.call-strip-sep { width: 1px; height: 13px; background: var(--line-2); }

/* ── LIVE DOT ── */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(var(--live-rgb), 0.18);
  animation: pulse 2.6s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(var(--live-rgb), 0.18); }
  50%       { box-shadow: 0 0 0 5px rgba(var(--live-rgb), 0.05); }
}

/* ── FORMS ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--text); font-family: var(--font); font-size: 13px;
  padding: 8px 11px; width: 100%;
  transition: border-color var(--t-fast);
}
.input:hover { border-color: var(--line-2); }
.input:focus { outline: none; border-color: var(--amber); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 70px; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.pw-field { position: relative; }
.pw-field .input { padding-right: 52px; }
.toggle-pw {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted);
  font-family: var(--font); font-size: 10px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; padding: 6px; transition: color var(--t-fast);
}
.toggle-pw:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: span 2; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th .sort-arrow { color: var(--amber); font-size: 9px; margin-left: 4px; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
table.data tbody tr { cursor: pointer; transition: background var(--t-fast); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
.td-muted { color: var(--muted); }
.td-mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--on-accent);
  background: linear-gradient(135deg, var(--amber), var(--accent-deep));
  vertical-align: middle;
}
.avatar.co { border-radius: 6px; background: linear-gradient(135deg, var(--line-2), var(--surface-2)); color: var(--muted); }
.name-cell { display: flex; align-items: center; gap: 9px; }

/* ── KANBAN ── */
.board-wrap { position: relative; }
.board-wrap::before, .board-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 20px; width: 44px;
  pointer-events: none; opacity: 0; transition: opacity var(--t-fast); z-index: 1;
}
.board-wrap::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.board-wrap::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.board-wrap.fade-left::before { opacity: 1; }
.board-wrap.fade-right::after { opacity: 1; }
.board {
  display: flex; gap: 10px; align-items: flex-start;
  overflow-x: auto; padding: 2px 2px 20px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.board::-webkit-scrollbar { height: 8px; }
.board::-webkit-scrollbar-track { background: transparent; }
.board::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.board::-webkit-scrollbar-thumb:hover { background: var(--faint); }
.kcol {
  flex: 1 1 0; min-width: 208px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 248px);
  max-height: calc(100dvh - 248px);
  box-shadow: var(--shadow-1);
}
.kcol.drag-over { border-color: var(--amber); background: var(--surface-2); }
.kcol-hd {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 12px 9px; border-bottom: 1px solid var(--line);
}
.kcol-name { font-size: 12px; font-weight: 600; }
.kcol-count {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
}
.kcol-sum { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.kcol.won .kcol-name { color: var(--live); }
.kcol.lost .kcol-name { color: var(--faint); }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 40px; }
.kcol-add {
  margin: 0 8px 8px; padding: 6px; border: 1px dashed var(--line); border-radius: var(--radius-s);
  background: none; color: var(--faint); font-size: 11.5px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.kcol-add:hover { color: var(--amber); border-color: rgba(var(--amber-rgb), 0.4); }

.kcard {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 10px 12px; cursor: grab;
  transition: border-color var(--t-fast), opacity var(--t-fast), box-shadow var(--t-fast);
}
.kcard:hover { border-color: var(--line-2); }
.kcard.dragging { opacity: 0.4; cursor: grabbing; box-shadow: var(--shadow-2); }
.kcard-name { font-size: 12.5px; font-weight: 500; margin-bottom: 3px; }
.kcard-co { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.kcard-foot { display: flex; align-items: center; gap: 8px; }
.kcard-value { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.kcard-days { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.kcard-days.stale { color: var(--down); }

.ktray { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ktray-zone {
  flex: 1 1 280px; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 10px 14px; min-height: 46px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.ktray-zone.drag-over { border-color: var(--amber); background: var(--surface-2); }
.ktray-zone.won .kcol-name { color: var(--live); }
.ktray-zone.lost .kcol-name { color: var(--faint); }
.ktray-hd { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.ktray-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ktray-hint { font-size: 11px; color: var(--faint); }
.kchip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; font-size: 11px; cursor: grab;
  transition: border-color var(--t-fast), opacity var(--t-fast), box-shadow var(--t-fast);
}
.kchip:hover { border-color: var(--line-2); }
.kchip.dragging { opacity: 0.4; cursor: grabbing; box-shadow: var(--shadow-2); }
.kchip-val { font-family: var(--mono); font-size: 10.5px; color: var(--amber); }

/* ── SIDE PANEL ── */
.panel-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.45); opacity: 0;
  transition: opacity var(--t); pointer-events: none;
}
.panel-scrim.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(460px, 94vw);
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform: translateX(102%);
  transition: transform var(--t);
  display: flex; flex-direction: column;
}
.panel.open { transform: none; }
.panel-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.panel-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-x {
  background: none; border: none; color: var(--faint); font-size: 16px;
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.panel-x:hover { background: var(--surface-2); color: var(--text); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px 32px; }
.panel-sec { margin-bottom: 22px; }
.panel-sec-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.prop-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.prop-label { width: 110px; flex-shrink: 0; font-size: 11.5px; color: var(--muted); }
.prop-val { flex: 1; min-width: 0; }
.prop-val .input { padding: 5px 9px; font-size: 12.5px; background: transparent; border-color: transparent; }
.prop-val .input:hover { background: var(--surface-2); border-color: var(--line); }
.prop-val .input:focus { background: var(--surface-2); border-color: var(--amber); }

/* ── PHONE FIELD (country + number) ── */
.phone-field { display: flex; gap: 6px; }
.phone-field .phone-country { flex: 0 0 92px; padding-left: 6px; padding-right: 2px; }
.phone-field .phone-number { flex: 1; min-width: 0; }
.linked-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; cursor: pointer; text-decoration: none;
}
.linked-chip:hover { border-color: var(--line-2); }

/* ── TIMELINE ── */
.composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.composer-row { display: flex; gap: 8px; }
.composer select { width: 110px; flex-shrink: 0; }
.tl-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.tl-body { flex: 1; min-width: 0; }
.tl-text { font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.tl-text.sys { color: var(--muted); font-style: italic; }
.tl-time { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.tl-time-edit {
  background: none; border: none; color: var(--faint); font-size: 10px; padding: 0;
  text-decoration: underline; text-decoration-style: dotted; cursor: pointer; opacity: 0.7;
}
.tl-time-edit:hover { color: var(--amber); opacity: 1; }
.tl-time-del:hover { color: var(--down); opacity: 1; }

/* ── TASKS ── */
.task-group { margin-bottom: 22px; }
.task-group-hd {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.task-group-hd.overdue { color: var(--down); }
.task-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 9px 13px; margin-bottom: 6px;
}
.task-row.done .task-title { text-decoration: line-through; color: var(--faint); }
.task-check {
  width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0;
  border: 1.5px solid var(--line-2); background: none;
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: all var(--t-fast); padding: 0;
}
.task-check:hover { border-color: var(--amber); }
.task-check:active { transform: scale(0.9); }
.task-check.on { background: var(--live); border-color: var(--live); color: var(--bg); }
.task-title { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-due { font-family: var(--mono); font-size: 10.5px; color: var(--faint); flex-shrink: 0; }
.task-due.overdue { color: var(--down); }
.task-del {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0; padding: 0;
  border: none; background: none; border-radius: var(--radius-s);
  color: var(--faint); opacity: 0.6;
  transition: color var(--t-fast), opacity var(--t-fast), background var(--t-fast);
}
.task-del:hover { color: var(--down); opacity: 1; background: rgba(var(--down-rgb), 0.1); }

/* ── PROSPECTS ── */
.prospect-group { margin-bottom: 18px; }
.prospect-group-hd {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; text-align: left; cursor: pointer;
  padding: 6px 2px 8px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  transition: opacity var(--t-fast);
}
.prospect-group-hd:hover { opacity: 0.8; }
.prospect-group-count { font-family: var(--mono); font-size: 10.5px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--faint); }
.prospect-group-chevron { margin-left: auto; flex-shrink: 0; opacity: 0.7; transition: transform var(--t); }
.prospect-group-hd.collapsed .prospect-group-chevron { transform: rotate(-90deg); }
.prospect-group-rows {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows var(--t);
}
.prospect-group-rows.collapsed { grid-template-rows: 0fr; }
.prospect-group-rows-inner { overflow: hidden; min-height: 0; }

.prospect-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-left-width: 5px; border-left-style: solid;
  border-radius: var(--radius-s); padding: 10px 13px 10px 11px; margin-bottom: 6px;
  cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.prospect-row:hover { border-color: var(--line-2); }
.prospect-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.prospect-main { min-width: 0; flex: 1 1 240px; }
.prospect-name { font-size: 12.5px; font-weight: 500; }
.prospect-row[data-status="not_interested"] .prospect-name { color: var(--faint); text-decoration: line-through; }
.prospect-sub { font-size: 11px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect-notes { flex: 1 1 200px; min-width: 0; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect-meta { flex-shrink: 0; text-align: right; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.prospect-meta .overdue { color: var(--down); }
.prospect-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 620px) {
  .prospect-row { flex-wrap: wrap; }
  .prospect-notes { display: none; }
  /* one dropdown instead of a wall of tiny wrapped buttons — same actions,
     one comfortable control; the buttons remain in the prospect panel */
  .prospect-actions { display: none; }
  .prospect-status-select { display: block; flex: 1 1 100%; margin-top: 2px; }
  .prospect-row { padding: 9px 11px; margin-bottom: 5px; }
  .prospect-sub { margin-top: 2px; }
}

/* ── MODAL ── */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5);
  display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.modal-scrim.open { display: flex; }
.confirm-scrim { z-index: 130; padding-top: 20vh; } /* stacks above an already-open modal/palette */
.confirm-body { font-size: 13px; color: var(--muted); line-height: 1.55; white-space: pre-line; }
.modal {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  width: 100%; max-width: 480px; max-height: 76vh; max-height: 76dvh; overflow-y: auto;
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-3);
  animation: modalIn var(--t) forwards;
}
.modal.modal-wide { max-width: 760px; }

/* ── STATUS EDITOR ── */
.status-editor-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; padding-right: 2px; }
.status-editor-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line); border-left-width: 4px; border-left-style: solid;
  border-radius: var(--radius-s); padding: 10px 12px;
}
.status-editor-row .input { padding: 5px 9px; font-size: 12px; }
.status-swatch {
  width: 24px; height: 24px; padding: 0; border-radius: 7px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.18); cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.status-swatch:hover { border-color: rgba(255,255,255,0.45); transform: scale(1.06); }
.swatch-row { width: 100%; display: flex; gap: 9px; flex-wrap: wrap; padding: 4px 2px 2px; }
.swatch-dot {
  width: 20px; height: 20px; padding: 0; border-radius: 50%; flex-shrink: 0;
  border: 2px solid transparent; cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.swatch-dot:hover { transform: scale(1.18); }
.swatch-dot.sel { border-color: var(--text); }
.status-name-input { flex: 1 1 140px; min-width: 100px; }
.status-flag { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.status-days-input { width: 52px; flex-shrink: 0; }

/* flex, not a fixed column count — chips size to their labels and wrap, so
   adding a flag to STATUS_FLAGS doesn't need a grid change or overflow a cell */
.status-flags { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 520px; }
.flag-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  flex: 1 1 auto; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.flag-chip:hover { border-color: var(--line-2); color: var(--text); }
.flag-chip.on { background: var(--amber-dim); border-color: rgba(var(--amber-rgb), 0.4); color: var(--amber); font-weight: 600; }
.flag-chip-check { font-size: 9px; width: 9px; opacity: 0; transition: opacity var(--t-fast); }
.flag-chip.on .flag-chip-check { opacity: 1; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.modal-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── COMMAND PALETTE ── */
.palette-scrim {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(0,0,0,0.5);
  display: none; align-items: flex-start; justify-content: center;
  padding: 14vh 16px 16px;
}
.palette-scrim.open { display: flex; }
.palette {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  width: 100%; max-width: 560px; overflow: hidden;
  box-shadow: var(--shadow-3);
  animation: modalIn var(--t) forwards;
}
.palette-input {
  width: 100%; background: none; border: none; color: var(--text);
  font-family: var(--font); font-size: 15px; padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.palette-input:focus { outline: none; }
.palette-results { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-group {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); padding: 8px 12px 4px;
}
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-s);
  font-size: 13px; cursor: pointer; width: 100%;
  background: none; border: none; text-align: left;
}
.palette-item .sub { color: var(--faint); font-size: 11.5px; margin-left: auto; }
.palette-item.sel, .palette-item:hover { background: var(--surface-2); }
.palette-item.sel { box-shadow: inset 2px 0 0 var(--amber); }
.palette-empty { padding: 22px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ── TOAST ── */
.toast {
  position: fixed; z-index: 200;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  right: calc(28px + env(safe-area-inset-right, 0px));
  padding: 12px 18px; max-width: 320px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--t), transform var(--t);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: rgba(var(--down-rgb), 0.4); }

/* ── EMPTY STATES ── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px; text-align: center;
}
.empty-icon { font-size: 26px; opacity: 0.5; }
.empty-title { font-size: 14px; font-weight: 600; }
.empty-sub { font-size: 12px; color: var(--muted); max-width: 320px; }

/* ── VIEW TOOLBAR ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: 240px; }
.toolbar-spacer { flex: 1; }
.result-count { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative;
}
.login-wrap::before {
  content: ''; position: absolute; top: 0; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--amber-rgb), 0.5), transparent);
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 30px 30px;
  box-shadow: var(--shadow-2);
}
.login-card .wordmark { justify-content: center; margin-bottom: 6px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 26px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-err {
  font-size: 12px; color: var(--down);
  background: rgba(var(--down-rgb), 0.07); border: 1px solid rgba(var(--down-rgb), 0.25);
  border-radius: var(--radius-s); padding: 8px 12px; display: none;
}
.login-err.show { display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 1060px) {
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { width: 60px; padding: 18px 8px 14px; }
  .sidebar .wordmark { justify-content: center; padding: 2px 0 0; }
  .sidebar .wordmark .word, .sidebar .wordmark .tld { display: none; }
  .sidebar .caret { margin-left: 0; }
  .workspace-name, .workspace-plan, .nav-item span, .nav-label,
  .soon-pill, .signout-row span { display: none; }
  .workspace { justify-content: center; padding: 6px; }
  .nav-item { justify-content: center; padding: 9px 0; }
  .nav-parent-link { justify-content: center; padding: 9px 0; }
  .nav-chevron-btn, .nav-sub-wrap { display: none; }
  .signout-row { justify-content: center; padding: 9px 0; }
  .search-stub { min-width: 0; }
  .search-stub .search-txt { display: none; }
}
@media (max-width: 620px) {
  /* phone layout: the sidebar rail goes away — the bottom tab bar takes over */
  .sidebar { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px 13px 11px; }
  .kpi-label { font-size: 10px; margin-bottom: 6px; }
  .kpi-val { font-size: 20px; }
  .kpi-sub { font-size: 10.5px; margin-top: 4px; }
  .card { padding: 14px 14px 15px; }
  .content { padding: 14px 12px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 0 14px; gap: 8px; }
  .kbd { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .toolbar .input { width: 100%; }
  .kcol { max-height: calc(100dvh - 316px); }
  /* stays one line on a phone — it sits above the queue Mark works from */
  .call-strip { gap: 9px; padding: 9px 12px; }
  .call-strip-label { font-size: 10px; }
  .call-strip-stat { font-size: 11.5px; }
  .call-strip-stat b { font-size: 13px; margin-right: 4px; }
}

/* ── SKELETON (boot loading state) ── */
.sk {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.6s ease infinite;
  border-radius: var(--radius-s);
  display: block;
}
@keyframes shimmer { 0% { background-position: 140% 0; } 100% { background-position: -40% 0; } }

.boot-skeleton {
  position: fixed; inset: 0; z-index: 5;
  display: flex; background: var(--bg);
}
body.ready .boot-skeleton { display: none; }
.boot-skeleton .sidebar { background: var(--bg); }
.boot-skeleton-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.boot-skeleton-topbar {
  height: 54px; flex-shrink: 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 0 28px;
}
.boot-skeleton-content { padding: 30px 28px; flex: 1; }
.boot-skeleton-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 12px; }
.boot-skeleton-kpi {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 15px;
  display: flex; flex-direction: column; gap: 10px;
}
.boot-skeleton-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px;
}
.boot-skeleton-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.boot-skeleton-row:last-child { border-bottom: none; }

@media (max-width: 860px) {
  .boot-skeleton .sidebar { width: 60px; }
  .boot-skeleton-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .boot-skeleton .sidebar { display: none; }
  .boot-skeleton-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .boot-skeleton-content { padding: 14px 12px; }
  .boot-skeleton-topbar { padding: 0 14px; }
}

/* ── CALENDAR ── */
.cal-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-month { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; min-width: 148px; }
.cal-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast);
}
.cal-step:hover { color: var(--text); border-color: var(--line-2); }
.cal-step:active { transform: translateY(1px); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 11.5px; font-weight: 500;
  padding: 5px 12px; transition: background var(--t-fast), color var(--t-fast);
}
.seg-btn:hover { color: var(--text); }
.seg-btn:active { transform: translateY(1px); }
.seg-btn.on { background: var(--amber); color: var(--on-accent); font-weight: 600; }

.layers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.layer {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--faint); cursor: pointer; user-select: none;
  font-family: var(--font); font-size: 11px; padding: 4px 11px 4px 9px;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.layer:hover { border-color: var(--line-2); color: var(--muted); }
.layer:active { transform: translateY(1px); }
.layer.on { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.layer .ldot { width: 7px; height: 7px; border-radius: 50%; background: var(--ld, var(--muted)); flex-shrink: 0; opacity: 0.35; }
.layer.on .ldot { opacity: 1; }

.cal-grid { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-bottom: 1px solid var(--line); }
.cal-dow span {
  padding: 9px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
/* Hairlines come from the 1px grid gap showing the container through, not from
   per-cell borders — borders doubled at some seams and left a heavier edge down
   one side. This way every line is exactly 1px and the outer edges match. */
.cal-weeks {
  display: grid; grid-template-columns: repeat(7, minmax(0,1fr));
  gap: 1px; background: var(--line);
}
.cal-cell {
  min-height: 116px; padding: 7px 8px 8px; border: none;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  cursor: pointer; transition: background-color var(--t-fast); text-align: left;
  font-family: var(--font); color: var(--text); background-color: var(--surface);
}
.cal-cell:hover { background-color: var(--surface-2); }
.cal-cell:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
/* tint via background-image so it composites over the cell, never over the gap */
.cal-cell.pad { background-image: linear-gradient(rgba(var(--bg-rgb), 0.35), rgba(var(--bg-rgb), 0.35)); }
.cal-cell.pad .cal-num { color: var(--faint); }
.cal-cell.wknd { background-image: linear-gradient(rgba(var(--bg-rgb), 0.18), rgba(var(--bg-rgb), 0.18)); }
.cal-num {
  font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 5px;
}
.cal-cell.today .cal-num { color: var(--amber); font-weight: 600; }
.cal-cell.today .cal-num .n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px;
  background: var(--amber); color: var(--on-accent);
}
.cal-net { margin-left: auto; font-family: var(--mono); font-size: 10px; }
.cal-net.pos { color: var(--live); }
.cal-net.neg { color: var(--down); }

.chip {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 11px; line-height: 1.35; padding: 2px 5px; border-radius: 4px;
  background: var(--surface-2); color: var(--text);
  border-left: 2px solid var(--cc, var(--muted));
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.chip .ct { overflow: hidden; text-overflow: ellipsis; }
.chip .cm { margin-left: auto; font-family: var(--mono); font-size: 10px; flex-shrink: 0; }
.chip.in  { --cc: var(--live); } .chip.in .cm  { color: var(--live); }
.chip.out { --cc: var(--down); } .chip.out .cm { color: var(--down); }
.chip.event { --cc: var(--amber); }
.chip.sub {
  --cc: var(--amber); background: transparent; color: var(--muted);
  border: 1px dashed var(--line-2); border-left: 2px solid var(--amber);
}
.chip.task { --cc: var(--muted); color: var(--muted); }
.chip.task.late { --cc: var(--down); color: var(--down); }
.chip.deal { --cc: var(--amber); } .chip.deal .cm { color: var(--amber); }
.chip.pros { --cc: var(--pc, var(--muted)); }
.chip.log {
  background: transparent; border-left-color: transparent; color: var(--faint);
  font-family: var(--mono); font-size: 10px; padding-left: 0;
}
.cal-more { font-size: 10.5px; color: var(--faint); padding-left: 5px; }
.cal-cell:hover .cal-more { color: var(--amber); }
.cal-time { font-family: var(--mono); font-size: 10px; color: var(--faint); flex-shrink: 0; }

.cal-weeks.week .cal-cell { min-height: 300px; }
.cal-weeks.week .chip { font-size: 11.5px; padding: 4px 7px; }

.cal-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  margin-top: 10px; padding: 11px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); font-size: 11.5px; color: var(--muted);
}
.cal-foot b {
  font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
  font-weight: 500; color: var(--text);
}
.cal-foot b.pos { color: var(--live); }
.cal-foot b.neg { color: var(--down); }
.cal-foot-spacer { flex: 1; }

/* ── MONEY ── */
.sub-name { display: flex; align-items: center; gap: 9px; }
.dir-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dir-dot.in { background: var(--live); }
.dir-dot.out { background: var(--down); }
.amt { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.amt.in { color: var(--live); }
.amt.out { color: var(--down); }
.pill {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap;
}
.pill.active { color: var(--live); border-color: rgba(var(--live-rgb), 0.35); background: rgba(var(--live-rgb), 0.07); }
.pill.due { color: var(--amber); border-color: rgba(var(--amber-rgb), 0.35); background: var(--amber-dim); }
.pill.paused { color: var(--faint); }

.card-flush { padding: 18px 0 0; }
.card-flush .card-hd { padding: 0 20px; }
.card-flush .table-wrap { border: none; border-radius: 0; box-shadow: none; margin-top: 10px; }

/* ── EVENT SHEET (grouped-rows form, iOS-style structure) ── */
.ev-sheet { display: flex; flex-direction: column; gap: 10px; }
.ev-block {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); overflow: hidden;
}
.ev-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; min-height: 44px;
  border-bottom: 1px solid var(--line);
}
.ev-row:last-child { border-bottom: none; }
.ev-row.stack { flex-direction: column; align-items: stretch; gap: 8px; }
.ev-ico { width: 15px; height: 15px; flex-shrink: 0; color: var(--faint); display: inline-flex; }
.ev-lab { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.ev-fill { flex: 1; min-width: 0; }
.ev-end { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ev-title-input {
  width: 100%; background: none; border: none; color: var(--text);
  font-family: var(--font); font-size: 15.5px; font-weight: 500;
  padding: 14px 13px;
}
.ev-title-input:focus { outline: none; }
.ev-title-input::placeholder { color: var(--faint); font-weight: 400; }
.ev-row .input { padding: 6px 9px; font-size: 12.5px; width: auto; }
.ev-row .input.grow { width: 100%; }
.ev-row.dim { opacity: 0.4; pointer-events: none; }

.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-2); transition: background var(--t-fast); pointer-events: none;
}
.switch .thumb {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform var(--t-fast); pointer-events: none;
}
.switch input:checked ~ .track { background: var(--amber); }
.switch input:checked ~ .thumb { transform: translateX(16px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--amber); outline-offset: 2px; }

.swatches { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-left: auto; }
.swatch {
  width: 20px; height: 20px; border-radius: 50%; padding: 0;
  border: 2px solid transparent; background-clip: padding-box; cursor: pointer;
  transition: transform var(--t-fast);
}
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--text); }
.swatch:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ── DAY PANEL ── */
.day-sec { margin-bottom: 20px; }
.day-sec-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 7px;
}
.day-sec-title .n { font-family: var(--mono); font-weight: 400; letter-spacing: 0; color: var(--faint); }
.day-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.day-row:last-child { border-bottom: none; }
.day-row .rt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-row.clickable { cursor: pointer; }
.day-row.clickable:hover .rt { color: var(--amber); }
.day-del {
  background: none; border: none; color: var(--faint); cursor: pointer; padding: 2px 4px;
  display: inline-flex; opacity: 0; transition: opacity var(--t-fast), color var(--t-fast);
}
.day-row:hover .day-del { opacity: 1; }
.day-del:hover { color: var(--down); }

/* ── OVERVIEW: next 7 days strip ── */
.next7 { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.next7-day {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 9px 8px; min-height: 74px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font); color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.next7-day:hover { border-color: var(--line-2); }
.next7-day:active { transform: translateY(1px); }
.next7-day.today { border-color: var(--amber); }
.next7-dow {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.next7-day.today .next7-dow { color: var(--amber); }
.next7-num { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; line-height: 1; }
.next7-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.next7-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--dc, var(--muted)); }
.next7-none { font-size: 10px; color: var(--faint); margin-top: auto; }

@media (max-width: 900px) {
  .cal-cell { min-height: 82px; padding: 5px; }
  .cal-cell .chip .ct { display: none; }
  .cal-cell .chip { justify-content: center; }
  .cal-weeks.week .cal-cell { min-height: 150px; }
  .cal-weeks.week .chip .ct { display: block; }
  .cal-dow span { padding: 7px 5px; font-size: 9.5px; }
  .cal-month { min-width: 0; font-size: 13.5px; }
  .next7 { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .next7 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .cal-foot { gap: 12px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rise { opacity: 1; transform: none; }
}

/* ── MOBILE / TOUCH (2026-07-14 mobile audit) ──
   Everything below is scoped to touch devices or small widths;
   desktop rendering is unchanged. */

/* no double-tap-zoom delay; kill the default gray tap flash (components
   already have their own :active/hover states) */
a, button, input, select, textarea,
.kcard, .kchip, .prospect-row, table.data tbody tr { touch-action: manipulation; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

/* overlay layers own their scroll — no chaining to the page behind */
.panel-body, .modal, .palette-results, .board, .kcol-body, .status-editor-list {
  overscroll-behavior: contain;
}
body.scroll-lock { overflow: hidden; }

/* prospect rows: mobile-only status dropdown (desktop keeps the buttons).
   Hidden via min-width so the ≤620px display:block above (earlier in the
   file) actually wins on phones — a plain display:none here overrode it. */
@media (min-width: 621px) {
  .prospect-status-select { display: none; }
}

/* prospect group header: "Open" link to the status's own page — only shown
   when the sidebar collapses to the icon rail and its sub-nav disappears */
.prospect-group-hdrow { display: flex; align-items: center; gap: 8px; }
.prospect-group-hdrow .prospect-group-hd { flex: 1; width: auto; min-width: 0; }
.prospect-group-open {
  display: none; flex-shrink: 0;
  color: var(--faint); text-decoration: none;
  font-size: 11px; font-weight: 500; padding: 4px 6px;
  transition: color var(--t-fast);
}
.prospect-group-open:hover { color: var(--amber); }
@media (max-width: 860px) { .prospect-group-open { display: inline-flex; } }

/* ── BOTTOM TAB BAR (phones only; sidebar serves ≥621px) ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; gap: 2px;
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(var(--bg-rgb), 0.92);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--line);
}
@media (max-width: 620px) { .tabbar { display: flex; } }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; padding: 5px 0 3px;
  color: var(--muted); font-family: var(--font); font-size: 9.5px; font-weight: 500;
  text-decoration: none; border-radius: 8px;
  transition: color var(--t-fast);
}
.tab svg { opacity: 0.9; }
.tab.active { color: var(--amber); }

/* ── TOOLBAR ACTIONS: inline on desktop, one swipeable line on phones ── */
.toolbar-actions { display: contents; }
@media (max-width: 620px) {
  .toolbar-actions {
    display: flex; align-items: center; gap: 8px;
    flex: 1 1 100%; overflow-x: auto; padding-bottom: 2px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .toolbar-actions::-webkit-scrollbar { display: none; }
  .toolbar-actions .btn { flex-shrink: 0; }
}

@media (pointer: coarse) {
  /* iOS Safari auto-zooms the page on focusing any input under 16px */
  .input, select.input, textarea.input, .palette-input,
  .prop-val .input, .status-editor-row .input { font-size: 16px; }

  /* comfortable tap sizes — invisible hit-area extension where the visual
     size is part of the design (checkbox, ✕, timeline text-buttons, swatches) */
  .btn-sm { padding: 8px 12px; font-size: 12.5px; }
  .task-check, .task-del, .panel-x, .tl-time-edit, .status-swatch, .swatch-dot { position: relative; }
  :is(.tl-time-edit, .status-swatch, .swatch-dot, .toggle-pw)::after {
    content: ''; position: absolute; inset: -8px -4px;
  }
  :is(.task-check, .task-del, .panel-x)::after {
    content: ''; position: absolute; inset: -10px;
  }
  .linked-chip { padding: 6px 11px; }
  .chip-act { padding: 7px 12px; }
  table.data th { padding: 12px 14px; }
  .panel-body { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 620px) {
  /* tables: keep the identity columns, drop the rest — full record lives in
     the side panel a tap away */
  table.data td { max-width: 42vw; }
  .t-contacts th:nth-child(4), .t-contacts td:nth-child(4),
  .t-contacts th:nth-child(5), .t-contacts td:nth-child(5),
  .t-contacts th:nth-child(6), .t-contacts td:nth-child(6),
  .t-companies th:nth-child(2), .t-companies td:nth-child(2),
  .t-companies th:nth-child(3), .t-companies td:nth-child(3),
  .t-companies th:nth-child(6), .t-companies td:nth-child(6),
  .t-billing th:nth-child(4), .t-billing td:nth-child(4) { display: none; }

  /* modals & palette: work with the height the on-screen keyboard leaves */
  .modal-scrim, .palette-scrim { padding: 20px 12px 12px; }
  .modal { max-height: calc(100dvh - 32px); }
  .palette-results { max-height: 50dvh; }

  .toast {
    left: 16px; right: 16px; max-width: none;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)); /* clears the tab bar */
  }
}

/* pipeline: long-press-to-drag on touch. Cards are drag handles on every
   device, so text selection / iOS long-press callout never make sense here */
.kcard, .kchip {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 300;
  pointer-events: none; opacity: 0.95;
  box-shadow: var(--shadow-3);
  cursor: grabbing;
}
