/* Direction: calm SaaS — cool paper, deep ink, one indigo accent; each pipeline stage has its own colour */
/* Completed by the platform from the short form: both modes, every
   palette token, each text-on-ground pair at its floor. To restyle, write the
   short form again (the decisions in one :root) and it is completed again. */

:root {
  --canvas: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #e9eaef;
  --border: #d4d5db;
  --border-strong: #afafb9;
  --ink: #151a2e;
  --muted: #666976;
  --accent: #4f46e5;
  --accent-hover: #433cc3;
  --accent-ink: #ffffff;
  --accent-text: #4338ca;
  --accent-strong: #4f46e5;
  --accent-soft: #deddf7;
  --accent-border: #aaa7f1;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #dae8e3;
  --success-strong: #137638;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #ede2dd;
  --warning-strong: #a64c08;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #eedcdf;
  --danger-strong: #b91c1c;
  --chart-1: #4f46e5;
  --chart-2: #ce31b1;
  --chart-3: #8c2906;
  --chart-4: #8e7a06;
  --chart-5: #015d36;
  --chart-6: #198ba4;

  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --display-weight: 700;
  --display-tracking: -0.02em;
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --x-on-photo: #ffffff;
  --x-stage-new: #64748b;
  --x-stage-contacted: #0ea5e9;
  --x-stage-qualified: #8b5cf6;
  --x-stage-proposal: #f59e0b;
  --x-stage-won: #16a34a;
  --x-stage-lost: #e5484d;
  --gradient-login: linear-gradient(155deg, #312e81eb 0%, #4f46e5b8 52%, #1e1b4bf0 100%);
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", system-ui, sans-serif;
  --eyebrow-tracking: 0.08em;
}

html[data-theme="dark"] {
  --canvas: #080817;
  --surface: #21212e;
  --surface-2: #141423;
  --border: #2b2b37;
  --border-strong: #52525d;
  --ink: #f5f6fa;
  --muted: #96979f;
  --accent: #4f46e5;
  --accent-hover: #6962e9;
  --accent-ink: #ffffff;
  --accent-text: #817bed;
  --accent-strong: #817bed;
  --accent-soft: #181644;
  --accent-border: #282474;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #0b221f;
  --success-strong: #499c68;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #2e1914;
  --warning-strong: #c57a40;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #2f0c18;
  --danger-strong: #d16969;
  --chart-1: #5954f3;
  --chart-2: #dc41bd;
  --chart-3: #db450e;
  --chart-4: #9c8600;
  --chart-5: #0f985d;
  --chart-6: #1799b4;
}

/* ---------- stage colours (one source: theme.css --x-stage-*) ---------- */
.st-new { --stage: var(--x-stage-new); }
.st-contacted { --stage: var(--x-stage-contacted); }
.st-qualified { --stage: var(--x-stage-qualified); }
.st-proposal { --stage: var(--x-stage-proposal); }
.st-won { --stage: var(--x-stage-won); }
.st-lost { --stage: var(--x-stage-lost); }
.stage-dot { display: inline-block; height: 0.5rem; width: 0.5rem; flex: none; border-radius: 9999px; background: var(--stage); }
.stage-bar { background: var(--stage); }
.stage-badge {
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  border-radius: 9999px; padding: 0.2rem 0.65rem; font-size: 0.75rem; font-weight: 600; line-height: 1.2;
  color: var(--ink);
  background: color-mix(in srgb, var(--stage) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--stage) 38%, transparent);
}

/* Red text must stay readable in dark mode */
.text-danger { color: var(--danger-strong); }

/* ---------- card rhythm ----------
   The card primitive spaces its direct children 1rem apart. A list that IS
   the card (follow-ups) and the small kanban card set their own rhythm. */
ul.card > li { margin-top: 0; }
.kb-card > * + * { margin-top: 0.125rem; }
.kb-card > .kb-more + * { margin-top: 0; }
.kb-card > .kb-meta { margin-top: 0.6rem; }
.kb-card > .kb-due { margin-top: 0.4rem; }

/* ---------- leads filter bar: one line, one height ---------- */
.filter-bar .input, .filter-bar .select, .filter-bar .btn { height: 2.75rem; min-height: 2.75rem; }
.filter-bar .input, .filter-bar .select { padding-top: 0; padding-bottom: 0; line-height: 1.25; }
.filter-bar .search-input { padding-left: 2.75rem; text-overflow: ellipsis; }
.filter-bar .search-go { position: absolute; left: 0.25rem; top: 50%; transform: translateY(-50%); height: 2.25rem; width: 2.25rem; }

/* ---------- file picker (CSV import) ---------- */
.file-input { padding: 0.35rem 0.4rem; line-height: 1.75rem; cursor: pointer; font-size: 0.875rem; color: var(--muted); }
.file-input::file-selector-button {
  margin-right: 0.75rem; border: 0; border-radius: 0.5rem; padding: 0.25rem 0.75rem;
  background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.file-input:hover::file-selector-button { background: var(--border); }

/* ---------- kanban ---------- */
.kb-col { border-top: 3px solid var(--stage); transition: background-color 0.18s ease, box-shadow 0.18s ease; }
.kb-col.is-over { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent), 0 14px 30px -18px rgb(0 0 0 / 0.45); }
.kb-card { position: relative; cursor: grab; touch-action: pan-x pan-y; transition: box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease; will-change: transform; }
.kb-card:hover { box-shadow: 0 10px 22px -12px rgb(0 0 0 / 0.35); transform: translateY(-2px); }
.kb-card:active { cursor: grabbing; }
.kb-card.is-dragging { opacity: 0.4; transform: scale(0.97) rotate(-1deg); box-shadow: none; }
.kb-card.just-dropped { animation: card-drop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.kb-zone { min-height: 7rem; outline: 2px dashed transparent; outline-offset: -4px; transition: outline-color 0.18s ease; }
.kb-col.is-over .kb-zone { outline-color: var(--accent-border); }
.kb-empty { display: none; }
.kb-zone:not(:has([data-card])) .kb-empty { display: block; }
.kb-more { position: absolute; top: 0.4rem; right: 0.4rem; display: grid; place-items: center; height: 1.75rem; width: 1.75rem; border-radius: 0.5rem; color: var(--muted); background: transparent; border: 0; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; }
.kb-more:hover, .kb-more[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.kb-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-menu {
  position: fixed; z-index: 80; min-width: 11.5rem; padding: 0.3rem; border-radius: 0.85rem;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 18px 40px -14px rgb(0 0 0 / 0.4);
  animation: menu-in 0.14s ease-out;
}
.kb-menu p { padding: 0.35rem 0.6rem 0.2rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.kb-menu button { display: flex; width: 100%; align-items: center; gap: 0.6rem; border: 0; background: transparent; color: var(--ink); text-align: left; padding: 0.55rem 0.6rem; border-radius: 0.55rem; font-size: 0.875rem; cursor: pointer; }
.kb-menu button:hover, .kb-menu button:focus-visible { background: var(--surface-2); outline: none; }
.kb-menu button[disabled] { color: var(--muted); cursor: default; }
.kb-menu .tick { margin-left: auto; font-size: 0.8rem; color: var(--accent-text); }

/* ---------- motion ---------- */
.page-in { animation: page-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.fx-list > *, .fx-rows > * { animation: item-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.fx-list > *:nth-child(2), .fx-rows > *:nth-child(2) { animation-delay: 40ms; }
.fx-list > *:nth-child(3), .fx-rows > *:nth-child(3) { animation-delay: 80ms; }
.fx-list > *:nth-child(4), .fx-rows > *:nth-child(4) { animation-delay: 120ms; }
.fx-list > *:nth-child(5), .fx-rows > *:nth-child(5) { animation-delay: 160ms; }
.fx-list > *:nth-child(6), .fx-rows > *:nth-child(6) { animation-delay: 200ms; }
.fx-list > *:nth-child(n+7), .fx-rows > *:nth-child(n+7) { animation-delay: 240ms; }
.lift { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.lift:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -16px rgb(0 0 0 / 0.35); border-color: var(--accent-border); }
.row-lift { transition: background-color 0.15s ease, transform 0.15s ease; }
.row-lift:hover { background: var(--surface-2); transform: translateY(-1px); }
.bar-fill { transform-origin: bottom; animation: bar-grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.bar-x { transform-origin: left; animation: bar-grow-x 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.toast { animation: toast-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.login-photo { transform-origin: center; animation: photo-settle 1.4s ease-out both; }

@keyframes page-in { from { opacity: 0.55; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes item-in { from { opacity: 0.55; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bar-grow { from { transform: scaleY(0.04); } to { transform: scaleY(1); } }
@keyframes bar-grow-x { from { transform: scaleX(0.04); } to { transform: scaleX(1); } }
@keyframes toast-in { from { transform: translateX(28px) scale(0.98); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes menu-in { from { transform: translateY(-4px) scale(0.98); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes card-drop { 0% { transform: scale(0.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes photo-settle { from { transform: scale(1.06); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .lift:hover, .row-lift:hover, .kb-card:hover { transform: none; }
}
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after { animation: none !important; transition: none !important; }
html.reduced-motion .lift:hover, html.reduced-motion .row-lift:hover, html.reduced-motion .kb-card:hover { transform: none; }

/* ---------- login photo panel ---------- */
.login-veil { background: var(--gradient-login); }

/* ---------- small screens ---------- */
@media (max-width: 480px) {
  .toasts { left: 0.75rem; right: 0.75rem; }
}
