/* YAK CRM — one stylesheet (04-ui-design-system.md). No inline styles anywhere (CSP). */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --leading: 1.5;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --radius-sm: 6px; --radius: 10px; --radius-full: 999px;

  --shadow-1: 0 1px 2px rgb(15 23 42 / .06), 0 1px 1px rgb(15 23 42 / .04);
  --shadow-2: 0 4px 12px rgb(15 23 42 / .08), 0 2px 4px rgb(15 23 42 / .05);
  --shadow-3: 0 12px 32px rgb(15 23 42 / .14);

  --bg: #f7f8fa;        --surface: #ffffff;   --surface-2: #f1f3f6;
  --border: #e3e6eb;    --border-strong: #c9ced6;
  --text: #0f172a;      --text-2: #475569;    --text-3: #64748b;

  --success: #15803d; --success-bg: #e8f5ec;
  --warning: #b45309; --warning-bg: #fdf3e2;
  --danger:  #b91c1c; --danger-bg:  #fdecec;
  --info:    #0369a1; --info-bg:    #e6f2f9;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8effd;
  --on-accent: #ffffff;
  --accent-text: #1d4ed8;

  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);

  --nav-w: 240px;
  --top-h: 60px;
  --tab-h: 64px;
  --control-h: 40px;
}

@media (pointer: coarse) { :root { --control-h: 44px; } }

/* ---- reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--text-md); line-height: var(--leading);
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }

/* ---- app shell (04 §4) ------------------------------------------------------- */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) 1fr;
  grid-template-areas: "nav top" "nav main";
}
.app__nav {
  grid-area: nav; position: sticky; top: 0; height: 100dvh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: var(--sp-3);
}
.app__brand {
  display: flex; align-items: center; gap: var(--sp-2);
  height: calc(var(--top-h) - var(--sp-3)); padding: 0 var(--sp-2) var(--sp-3);
  font-weight: 650; color: var(--text); letter-spacing: -.01em;
}
.app__brand:hover { text-decoration: none; }
.app__brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-size: var(--text-sm); font-weight: 700;
}
.app__brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 40px;
  padding: 0 var(--sp-3); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: var(--text-sm); font-weight: 500;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav__item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav__item--soon { color: var(--text-3); opacity: .7; cursor: default; }
.nav__item--soon:hover { background: none; color: var(--text-3); }
.nav__soon { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); }
.nav__sep { height: 1px; background: var(--border); margin: var(--sp-3) var(--sp-2); }
.nav__foot { margin-top: auto; }

.app__top {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.app__main { grid-area: main; padding: var(--sp-5); min-width: 0; view-transition-name: main; }

.top__search { position: relative; flex: 1; max-width: 520px; }
.top__spacer { flex: 1; }

.user-menu > summary { list-style: none; cursor: pointer; border-radius: var(--radius-full); }
.user-menu > summary::-webkit-details-marker { display: none; }

.tabbar { display: none; }

/* md: icon rail */
@media (max-width: 1023px) {
  :root { --nav-w: 64px; }
  .app__nav { padding: var(--sp-3) var(--sp-2); align-items: center; }
  .app__brand { padding: 0 0 var(--sp-3); justify-content: center; }
  .app__brand-name, .nav__label, .nav__soon { display: none; }
  .nav__item { justify-content: center; padding: 0; width: 44px; min-height: 44px; }
  .nav__sep { width: 32px; }
}

/* sm: bottom tab bar */
@media (max-width: 639px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .app__nav { display: none; }
  .app__top { padding: 0 var(--sp-4); }
  .app__main { padding: var(--sp-4) var(--sp-4) calc(var(--tab-h) + var(--sp-7) + env(safe-area-inset-bottom)); }
  .top__search { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset: auto 0 0 0; z-index: 30;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; color: var(--text-3); min-height: 44px;
  }
  .tabbar__item:hover { text-decoration: none; }
  .tabbar__item[aria-current="page"] { color: var(--accent-text); }
  .tabbar__item--soon { opacity: .5; }
  .hide-sm { display: none !important; }
}
@media (min-width: 640px) { .show-sm { display: none !important; } }

/* ---- page header ------------------------------------------------------------- */
.page { max-width: 1100px; margin: 0 auto; }
.page--wide { max-width: none; }
.page--narrow { max-width: 720px; }
.page__header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.page__title { font-size: var(--text-xl); font-weight: 650; letter-spacing: -.015em; line-height: 1.25; view-transition-name: page-title; }
.page__title:focus { outline: none; box-shadow: none; }
.page__count { color: var(--text-3); font-size: var(--text-md); font-weight: 400; margin-left: var(--sp-1); }
.page__actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.page__sub { color: var(--text-2); font-size: var(--text-sm); display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; margin-top: var(--sp-1); }
.back { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-3); font-size: var(--text-sm); margin-bottom: var(--sp-2); }

.c-btn.fab { display: none; }
@media (max-width: 639px) {
  .page__actions .c-btn--primary.has-fab { display: none; }
  .c-btn.fab {
    display: inline-flex; position: fixed; z-index: 25;
    right: var(--sp-4); bottom: calc(var(--tab-h) + var(--sp-4) + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: var(--radius-full); box-shadow: var(--shadow-3);
    align-items: center; justify-content: center; padding: 0;
  }
}

/* ---- buttons ----------------------------------------------------------------- */
.c-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 var(--sp-4); border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none; cursor: pointer; white-space: nowrap;
  font-size: var(--text-sm); font-weight: 550; text-decoration: none; transition: background-color .12s, border-color .12s, color .12s;
}
.c-btn:hover { text-decoration: none; }
.c-btn--primary { background: var(--accent); color: var(--on-accent); }
.c-btn--primary:hover { background: var(--accent-hover); }
.c-btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.c-btn--secondary:hover { background: var(--surface-2); }
.c-btn--ghost { color: var(--text-2); }
.c-btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.c-btn--danger { background: var(--danger); color: #fff; }
.c-btn--danger:hover { background: color-mix(in srgb, var(--danger) 88%, black); }
.c-btn--icon { width: var(--control-h); padding: 0; }
.c-btn--sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--text-sm); }
.c-btn--block { width: 100%; }
.c-btn[aria-busy="true"], .c-btn:disabled { opacity: .6; pointer-events: none; }
.c-btn__kbd { font-size: var(--text-xs); opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; line-height: 16px; }

.c-btn--call { background: var(--success); color: #fff; }
.c-btn--call:hover { background: color-mix(in srgb, var(--success) 88%, black); }

/* ---- fields ------------------------------------------------------------------ */
.c-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.c-field__label { font-size: var(--text-sm); font-weight: 550; color: var(--text); }
.c-field__req { color: var(--danger); margin-left: 2px; }
.c-field__hint { font-size: var(--text-xs); color: var(--text-3); }
.c-field__error { font-size: var(--text-sm); color: var(--danger); }
.c-field__wrap { position: relative; display: flex; }
.c-input {
  width: 100%; min-height: var(--control-h); padding: 8px 12px;
  font-size: var(--text-md); background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.c-input::placeholder { color: var(--text-3); }
.c-input:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.c-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.c-input[aria-invalid="true"] { border-color: var(--danger); }
textarea.c-input { min-height: 96px; resize: vertical; line-height: 1.45; }
select.c-input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form__grid > .span-2 { grid-column: 1 / -1; }
.form__actions { display: flex; gap: var(--sp-2); justify-content: flex-end; padding-top: var(--sp-2); }
.form__error { padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-size: var(--text-sm); }
@media (max-width: 1023px) { .form__grid { grid-template-columns: 1fr; } }
@media (max-width: 639px) {
  .form__actions--sticky {
    position: sticky; bottom: 0; margin: 0 calc(-1 * var(--sp-4)); padding: var(--sp-3) var(--sp-4);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .form__actions--sticky .c-btn--primary { flex: 1; }
}

.c-warning { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--warning); font-size: var(--text-sm); }
.c-warning a { color: inherit; text-decoration: underline; font-weight: 550; }
.c-warning .icon { margin-top: 2px; }

/* combobox (company picker) */
.c-combo { position: relative; }
.c-combo__list {
  position: absolute; z-index: 40; inset: calc(100% + 4px) 0 auto 0; max-height: 280px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); padding: var(--sp-1);
}
.c-combo__list:empty { display: none; }
.c-combo__opt {
  display: flex; width: 100%; align-items: center; gap: var(--sp-2); text-align: left;
  padding: 8px 10px; border: 0; background: none; border-radius: 4px; cursor: pointer; font-size: var(--text-sm);
}
.c-combo__opt:hover, .c-combo__opt[aria-selected="true"] { background: var(--surface-2); }
.c-combo__opt small { color: var(--text-3); margin-left: auto; }
.c-combo__opt--new { color: var(--accent-text); font-weight: 550; }
.c-combo__none { margin: 0; padding: var(--sp-2) var(--sp-3); color: var(--text-3); font-size: var(--text-sm); }
.link-picker { padding: var(--sp-2) var(--sp-4) var(--sp-3); }
.page__sub-part { display: contents; }

/* ---- search box -------------------------------------------------------------- */
.c-search { position: relative; display: flex; align-items: center; }
.c-search > .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.c-search .c-input { padding-left: 40px; background: var(--surface); }
.c-search .c-input::-webkit-search-cancel-button { cursor: pointer; }
.c-search--lg .c-input { min-height: 44px; }
.c-search__kbd { position: absolute; right: 10px; font-size: var(--text-xs); color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; pointer-events: none; }
.c-search .c-input:focus ~ .c-search__kbd, .c-search .c-input:not(:placeholder-shown) ~ .c-search__kbd { display: none; }

.c-dropdown {
  position: absolute; z-index: 50; inset: calc(100% + 6px) 0 auto 0; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: var(--sp-2);
}
.c-dropdown:empty { display: none; }
.c-dropdown__group { font-size: var(--text-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: var(--sp-2) var(--sp-2) var(--sp-1); }
.c-dropdown__item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2); border-radius: var(--radius-sm); color: var(--text); }
.c-dropdown__item:hover, .c-dropdown__item:focus { background: var(--surface-2); text-decoration: none; }
.c-dropdown__meta { color: var(--text-3); font-size: var(--text-sm); margin-left: auto; white-space: nowrap; }
.c-dropdown__all { display: block; text-align: center; padding: var(--sp-2); font-size: var(--text-sm); border-top: 1px solid var(--border); margin-top: var(--sp-1); }
.c-dropdown__empty { padding: var(--sp-3); color: var(--text-3); font-size: var(--text-sm); }

/* ---- filters ----------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-4); }
.filters__search { flex: 1 1 320px; }
.filters .c-input { width: auto; }
.filters__note { flex-basis: 100%; display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--text-sm); color: var(--text-2); }
.filters select.c-input { min-width: 150px; }
.c-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface);
  font-size: var(--text-sm); color: var(--text-2); cursor: pointer; user-select: none;
}
.c-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.c-chip:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.c-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filters__body { display: contents; }
.filters .filters__search .c-input { width: 100%; }
@media (max-width: 639px) {
  .filters__search { flex-basis: 100%; position: sticky; top: calc(var(--top-h) + var(--sp-2)); z-index: 10; }
  .filters select.c-input { flex: 1 1 140px; min-width: 0; }
}

/* ---- table ------------------------------------------------------------------- */
.c-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.c-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.c-table th {
  text-align: left; font-weight: 550; color: var(--text-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px var(--sp-4); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.c-table td { padding: 12px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.c-table tbody tr:last-child td { border-bottom: 0; }
.c-table__row { position: relative; }
.c-table__row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.c-table__link { color: var(--text); font-weight: 550; }
.c-table__link::after { content: ""; position: absolute; inset: 0; }
.c-table__link:hover { text-decoration: none; }
.c-table__row:hover .c-table__link { color: var(--accent-text); }
.c-table__row a:not(.c-table__link), .c-table__row button { position: relative; z-index: 1; }
.c-table__primary { display: flex; align-items: center; gap: var(--sp-3); }
.c-table__muted { color: var(--text-3); }
.c-table__more td { text-align: center; padding: var(--sp-3); background: var(--surface); }
.c-table__num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) { .c-table [data-priority="2"] { display: none; } }
@media (max-width: 639px) {
  .c-table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .c-table--stack thead { display: none; }
  .c-table--stack, .c-table--stack tbody { display: block; }
  .c-table--stack .c-table__row {
    display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sp-3); align-items: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2);
  }
  .c-table--stack td { display: block; padding: 0; border: 0; grid-column: 1; color: var(--text-2); }
  .c-table--stack td[data-priority="2"] { display: none; }
  .c-table--stack td.c-table__cell--tel { grid-column: 2; grid-row: 1 / span 3; }
  .c-table--stack td:empty { display: none; }
  .c-table--stack .c-table__more { display: block; }
  .c-table--stack .c-table__more td { display: block; background: none; }
}

/* ---- card -------------------------------------------------------------------- */
.c-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.c-card__header { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.c-card__title { font-size: var(--text-sm); font-weight: 650; }
.c-card__count { color: var(--text-3); font-size: var(--text-sm); }
.c-card__action { margin-left: auto; }
.c-card__body { padding: var(--sp-4); }
.c-card__body--flush { padding: 0; }
.c-card__footer { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--text-sm); }
.c-card--soon { border-style: dashed; box-shadow: none; background: transparent; }
.c-card--soon .c-card__body { color: var(--text-3); font-size: var(--text-sm); }

/* definition list with inline edit */
.dl { display: flex; flex-direction: column; }
.dl__row { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-3); align-items: start; padding: 6px 0; min-height: 40px; }
.dl__row + .dl__row { border-top: 1px dashed var(--border); }
.dl__term { color: var(--text-3); font-size: var(--text-sm); padding-top: 6px; }
.dl__value { min-width: 0; }
/* Inline field (owner, round 5): an input that reads as plain text. Hover tints it,
   focus outlines it; there is no separate edit box and no buttons. */
.inline { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inline__control { display: flex; align-items: flex-start; gap: var(--sp-1); min-width: 0; }
.inline__control > .c-field__wrap { flex: 0 1 auto; min-width: 0; max-width: 100%; } /* the unit sits right after the number */
.inline__input {
  flex: 1; width: 100%; min-width: 0; min-height: 32px; padding: 5px 8px; margin: 0 -8px;
  font: inherit; font-size: var(--text-sm); line-height: 1.45; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  overflow-wrap: anywhere; cursor: text; transition: background .12s, border-color .12s, box-shadow .12s;
}
.inline__control > .c-field__wrap .inline__input { margin-right: 0; }
.inline__input:hover { background: var(--surface-2); }
.inline__input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--focus-ring); cursor: auto; }
.inline__input::placeholder, .inline__input--empty { color: var(--text-3); }
.inline__input--warn::placeholder, .inline__input--warn.inline__input--empty { color: var(--warning); font-weight: 600; }
.inline__input[aria-invalid="true"] { border-color: var(--danger); background: var(--surface); }
.inline__input--num { text-align: left; font-variant-numeric: tabular-nums; padding-right: 36px; field-sizing: content; min-width: 10ch; }
.inline__suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: var(--text-sm); color: var(--text-3); pointer-events: none; }
.inline__input--num:placeholder-shown + .inline__suffix { display: none; }
textarea.inline__input { display: block; resize: none; field-sizing: content; min-height: 32px; max-height: 60vh; overflow-y: auto; }
textarea.inline__input[data-single] { overflow: hidden; }
select.inline__input { appearance: none; cursor: pointer; padding-right: 28px; }
select.inline__input:hover, select.inline__input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
input[type=date].inline__input { cursor: pointer; }
input[type=date].inline__input::-webkit-calendar-picker-indicator { opacity: 0; transition: opacity .12s; }
input[type=date].inline__input:hover::-webkit-calendar-picker-indicator,
input[type=date].inline__input:focus::-webkit-calendar-picker-indicator { opacity: .6; }
.inline__check { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 32px; font-size: var(--text-sm); cursor: pointer; }
.inline .c-field__error { font-size: var(--text-xs); }
.inline__hint { font-size: var(--text-xs); color: var(--text-3); }
.inline__hint--focus { display: none; }
.inline:focus-within .inline__hint--focus { display: block; }
.inline__saved { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--success); animation: inline-saved 2.4s ease forwards; }
.inline__saved svg { width: 12px; height: 12px; }
@keyframes inline-saved { 0%, 70% { opacity: 1; } 99% { opacity: 0; height: auto; } 100% { opacity: 0; height: 0; overflow: hidden; } }
/* Notes and other multi-line fields take the whole row: label above, text below. */
.dl__row:has(.inline--multi) { grid-template-columns: 1fr; gap: 0; }
.dl__row:has(.inline--multi) .dl__term { padding-top: 0; }
@media (pointer: coarse) {
  .inline__input { font-size: var(--text-md); } /* 16px: no iOS zoom */
  .inline:focus-within .inline__hint--keys { display: none; } /* no keyboard shortcuts on a phone */
}
.inline__form-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); justify-content: flex-end; }

/* ---- detail layout ----------------------------------------------------------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-5); align-items: start; }
.detail__main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); grid-column: 1; grid-row: 1; }
.detail__side { display: flex; flex-direction: column; gap: var(--sp-4); grid-column: 2; grid-row: 1; }
@media (max-width: 1023px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail__side { grid-row: 1; grid-column: 1; }
  .detail__main { grid-row: 2; }
}
.detail__hero { display: flex; gap: var(--sp-4); align-items: flex-start; margin-bottom: var(--sp-5); flex-wrap: wrap; }
.detail__hero-text { flex: 1; min-width: 220px; }
.detail__hero-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.quickbar { display: none; }
@media (max-width: 639px) {
  .detail__hero-actions .hide-sm { display: none; }
  .quickbar {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-1);
    position: fixed; z-index: 25; left: var(--sp-3); right: var(--sp-3);
    bottom: calc(var(--tab-h) + var(--sp-2) + env(safe-area-inset-bottom));
    padding: var(--sp-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3);
  }
  .quickbar__btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 52px; justify-content: center; font-size: 12px; color: var(--text-2); border-radius: var(--radius-sm); background: none; border: 0; }
  .quickbar__btn:hover { background: var(--surface-2); text-decoration: none; }
  .quickbar__btn--call { color: var(--success); }
  .details-sm > summary { list-style: none; cursor: pointer; }
}
@media (min-width: 640px) {
  .details-sm > summary { display: none; }
}

.people { display: flex; flex-direction: column; }
.people__item { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4); border-top: 1px solid var(--border); }
.people__item:first-child { border-top: 0; }
.people__name { font-weight: 550; font-size: var(--text-sm); color: var(--text); display: block; }
.people__meta { font-size: var(--text-xs); color: var(--text-3); }
.people__text { flex: 1; min-width: 0; }

/* ---- pills, tags, avatar ----------------------------------------------------- */
.c-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-2); font-size: var(--text-xs); font-weight: 550; white-space: nowrap; }
.c-tag--warning { background: var(--warning-bg); color: var(--warning); }
.c-tag--success { background: var(--success-bg); color: var(--success); }
.c-tag--info { background: var(--info-bg); color: var(--info); }
.c-tag--danger { background: var(--danger-bg); color: var(--danger); }
.c-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-full); border: 1px solid var(--border); font-size: var(--text-xs); font-weight: 550; }
.c-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stage, var(--text-3)); }

.c-avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 12px; font-weight: 650; flex: none; letter-spacing: .02em; }
.c-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.c-avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.c-avatar--1 { background: #dbeafe; color: #1e40af; }
.c-avatar--2 { background: #dcfce7; color: #166534; }
.c-avatar--3 { background: #fef3c7; color: #92400e; }
.c-avatar--4 { background: #fce7f3; color: #9d174d; }
.c-avatar--5 { background: #ede9fe; color: #5b21b6; }
.c-avatar--6 { background: #cffafe; color: #155e75; }
.c-avatar--7 { background: #ffedd5; color: #9a3412; }
.c-avatar--8 { background: #e2e8f0; color: #334155; }
.c-avatar--company { border-radius: var(--radius-sm); }

/* ---- phone link (04 §5, brief #14) -------------------------------------------- */
.c-tel { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--accent-text); font-weight: 500; }
.c-tel .icon { width: 16px; height: 16px; }
@media (max-width: 639px) {
  .c-tel--tap { width: 44px; height: 44px; justify-content: center; border-radius: 50%; background: var(--success-bg); color: var(--success); }
  .c-tel--tap .c-tel__text { display: none; }
  .c-tel--tap .icon { width: 20px; height: 20px; }
}

/* ---- timeline ---------------------------------------------------------------- */
.composer { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.composer__row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.composer__when { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-3); font-size: var(--text-sm); }
.composer__when .c-input { width: auto; min-height: 36px; padding: 4px 8px; font-size: var(--text-sm); }
.composer__submit { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.composer__hint { font-size: var(--text-xs); color: var(--text-3); }
.composer textarea.c-input { min-height: 72px; }
@media (max-width: 639px) { .composer__hint { display: none; } }

.c-segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); gap: 2px; }
.c-segmented label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--sp-3); border-radius: 5px; font-size: var(--text-sm); color: var(--text-2); cursor: pointer; }
.c-segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 550; }
.c-segmented label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.c-segmented input { position: absolute; opacity: 0; pointer-events: none; }
/* Entry kind (composer, timeline edit): four options share the row; on phones a 2×2 grid. */
.composer .c-segmented, .c-timeline__edit .c-segmented { display: flex; flex-wrap: wrap; max-width: 100%; }
.composer .c-segmented label, .c-timeline__edit .c-segmented label { flex: 1 1 auto; justify-content: center; }
@media (max-width: 480px) {
  .composer .c-segmented, .c-timeline__edit .c-segmented { display: grid; grid-template-columns: 1fr 1fr; }
}

.c-timeline { display: flex; flex-direction: column; }
.c-timeline__item { display: grid; grid-template-columns: 32px 1fr; gap: var(--sp-3); padding: var(--sp-4); border-top: 1px solid var(--border); }
.c-timeline__icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.c-timeline__item--call .c-timeline__icon { background: var(--success-bg); color: var(--success); }
.c-timeline__item--meeting .c-timeline__icon { background: #ede9fe; color: #5b21b6; }
.c-timeline__item--email .c-timeline__icon { background: var(--info-bg); color: var(--info); }
.c-timeline__item--note .c-timeline__icon { background: var(--warning-bg); color: var(--warning); }
.c-timeline__item--system, .c-timeline__item--stage_change { padding-block: var(--sp-2); color: var(--text-3); font-size: var(--text-sm); }
.c-timeline__item--system .c-timeline__icon, .c-timeline__item--stage_change .c-timeline__icon { width: 24px; height: 24px; margin-left: 4px; }
.c-timeline__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--sp-2); font-size: var(--text-sm); }
.c-timeline__kind { font-weight: 600; }
.c-timeline__meta { color: var(--text-3); }
.c-timeline__origin { font-size: var(--text-xs); }
.c-timeline__body { margin-top: var(--sp-1); font-size: var(--text-md); overflow-wrap: anywhere; color: var(--text); }
.c-timeline__tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.c-timeline__item:hover .c-timeline__tools, .c-timeline__item:focus-within .c-timeline__tools { opacity: 1; }
@media (pointer: coarse) { .c-timeline__tools { opacity: 1; } }
.c-timeline__edit { display: flex; flex-direction: column; gap: var(--sp-2); }
.c-timeline__more { padding: var(--sp-3); text-align: center; border-top: 1px solid var(--border); }
.c-timeline:has(.c-timeline__item) > .c-empty { display: none; }

/* ---- empty / skeleton / error ------------------------------------------------- */
.c-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-7) var(--sp-5); color: var(--text-2); }
.c-empty__icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.c-empty__text { max-width: 420px; }
.c-empty__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.c-empty--sm { padding: var(--sp-5) var(--sp-4); font-size: var(--text-sm); }
.c-table .c-empty { padding-block: var(--sp-6); }

.c-skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, #e9ecf1 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; height: 14px; }
@keyframes skel { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* htmx indicators: skeleton/progress after 150 ms, so fast responses never flash (04 §2) */
.htmx-indicator { opacity: 0; transition: opacity .1s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; transition-delay: 150ms; }
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; overflow: hidden; pointer-events: none; }
.loading-bar::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: left; animation: loadbar 1.2s ease-in-out infinite; }
@keyframes loadbar { 0% { transform: translateX(-100%) scaleX(.4); } 100% { transform: translateX(100%) scaleX(.4); } }
[aria-busy="true"].results-region, .htmx-request .results-region { opacity: .55; transition: opacity .15s .15s; }

.c-error { padding: var(--sp-5); text-align: center; color: var(--text-2); }

/* ---- toast ------------------------------------------------------------------- */
.c-toasts { position: fixed; z-index: 200; right: var(--sp-4); bottom: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); width: min(380px, calc(100vw - 2 * var(--sp-4))); pointer-events: none; }
.c-toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  background: var(--text); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-3); font-size: var(--text-sm);
  animation: toast-in .2s ease-out;
}
.c-toast__icon { flex: none; }
.c-toast--success .c-toast__icon { color: #4ade80; }
.c-toast--error { background: var(--danger); }
.c-toast--info .c-toast__icon { color: #7dd3fc; }
.c-toast__text { flex: 1; }
.c-toast__action { color: #fff; font-weight: 650; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 4px; text-decoration: underline; text-underline-offset: 2px; }
.c-toast__close { color: #fff; opacity: .7; background: none; border: 0; cursor: pointer; padding: 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 639px) { .c-toasts { top: calc(var(--top-h) + var(--sp-2)); bottom: auto; left: var(--sp-4); right: var(--sp-4); width: auto; } }

/* ---- dialog & drawer ----------------------------------------------------------- */
.c-dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-3); width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); }
.c-dialog::backdrop, .c-drawer::backdrop { background: rgb(15 23 42 / .35); }
.c-dialog__body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.c-dialog__title { font-size: var(--text-lg); font-weight: 650; }
.c-dialog__text { color: var(--text-2); font-size: var(--text-sm); }
.c-dialog__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.c-drawer {
  border: 0; padding: 0; margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 480px; max-width: 100vw;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-3);
}
.c-drawer[open] { display: flex; flex-direction: column; animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.c-drawer__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.drawer__header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.drawer__title { font-size: var(--text-lg); font-weight: 650; flex: 1; }
.drawer__title:focus { outline: none; box-shadow: none; }
.drawer__content { flex: 1; overflow: auto; padding: var(--sp-5); }
.drawer__content .form__grid { grid-template-columns: 1fr 1fr; }
.drawer__footer { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-2); justify-content: flex-end; align-items: center; }
.drawer__footer-hint { margin-right: auto; font-size: var(--text-xs); color: var(--text-3); }
.drawer__loading { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.c-drawer form.drawer__form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
@media (max-width: 1023px) { .c-drawer { width: 80vw; } }
@media (max-width: 639px) {
  .c-drawer { width: 100vw; height: 90dvh; margin: auto 0 0 0; border-radius: var(--radius) var(--radius) 0 0; }
  .c-drawer[open] { animation: sheet-in .22s ease-out; }
  .drawer__content .form__grid { grid-template-columns: 1fr; }
  .drawer__footer-hint { display: none; }
  .drawer__footer .c-btn--primary { flex: 1; }
}
@keyframes sheet-in { from { transform: translateY(32px); opacity: 0; } }

/* ---- menu -------------------------------------------------------------------- */
.c-menu { position: relative; }
.c-menu > summary { list-style: none; cursor: pointer; }
.c-menu > summary::-webkit-details-marker { display: none; }
.c-menu__list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); padding: var(--sp-1); }
.c-menu__item { display: flex; width: 100%; align-items: center; gap: var(--sp-2); padding: 8px 10px; border: 0; background: none; text-align: left; border-radius: 4px; cursor: pointer; font-size: var(--text-sm); color: var(--text); }
.c-menu__item:hover { background: var(--surface-2); text-decoration: none; }
.c-menu__item--danger { color: var(--danger); }
.c-menu__sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }
.c-menu__head { padding: 8px 10px; font-size: var(--text-sm); }
.c-menu__head small { display: block; color: var(--text-3); }

/* ---- D4 Telefon --------------------------------------------------------------- */
.call__lookup { display: flex; flex-direction: column; gap: var(--sp-2); }
.call__results { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.call__option {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s;
}
.call__option:hover { border-color: var(--border-strong); }
.call__option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.call__option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.call__option input { position: absolute; opacity: 0; pointer-events: none; }
.call__option-text { flex: 1; min-width: 0; }
.call__option-name { font-weight: 600; }
.call__option-meta { font-size: var(--text-sm); color: var(--text-2); }
.call__option-last { font-size: var(--text-sm); color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.call__option--new .call__option-name { color: var(--accent-text); }
.call__check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; margin-top: 2px; display: grid; place-items: center; }
.call__option:has(input:checked) .call__check { border-color: var(--accent); background: var(--accent); }
.call__option:has(input:checked) .call__check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-accent); }
.call__section { margin-top: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }
.call__section-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; }
.call__newfields { display: none; }
.call:has(input[name="caller"][value="new"]:checked) .call__newfields { display: flex; }
.call__pick-hint { display: none; color: var(--text-3); font-size: var(--text-sm); }
.call:not(:has(input[name="caller"]:checked)):has(.call__option) .call__pick-hint { display: block; }
.call__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.call__cbtime { display: none; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.call:has(input[name="callback"]:not([value=""]):checked) .call__cbtime { display: flex; }
.call__cbdate { display: none; }
.call:has(input[name="callback"][value="date"]:checked) .call__cbdate { display: block; }
.call__cbtime .c-input { width: auto; }
.call__note textarea { min-height: 140px; }
.call__other { margin-top: var(--sp-1); font-size: var(--text-sm); color: var(--text-3); }

/* ---- login ------------------------------------------------------------------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-4); }
.auth__card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-5); }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; }
.auth__brand .app__brand-mark { width: 48px; height: 48px; font-size: var(--text-lg); border-radius: var(--radius); }
.auth__org { font-size: var(--text-lg); font-weight: 650; }
.auth__note { font-size: var(--text-sm); color: var(--text-3); text-align: center; }
.demo-banner { margin: 0 0 var(--sp-3); padding: 6px var(--sp-3); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--text-2); background: var(--surface-2); text-align: center; }
.pw { position: relative; }
.pw .c-input { padding-right: 84px; }
.pw__toggle { position: absolute; right: 4px; top: 4px; height: calc(100% - 8px); }

/* ---- misc -------------------------------------------------------------------- */
.muted { color: var(--text-3); }
.small { font-size: var(--text-sm); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.kbd { font-family: var(--font-mono); font-size: var(--text-xs); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text-2); background: var(--surface); }
.section-title { font-size: var(--text-lg); font-weight: 650; margin-bottom: var(--sp-3); }
.search-group + .search-group { margin-top: var(--sp-5); }

/* ---- motion ------------------------------------------------------------------ */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Actions for modules not built yet: visible for layout review, clearly inert. */
.c-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
/* Visually hidden radios/checkboxes stay inside their label's box. */
.c-chip, .c-segmented label, .call__option { position: relative; }
fieldset.c-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.call__option-name { display: flex; align-items: center; gap: 6px; }
.call__option-meta, .call__option-last { display: block; }

/* ==== M3 Pipeline ============================================================ */

:root {
  /* Temperature (D-12). Semantic, separate from the brand accent; icon + word always. */
  --hot: #c2410c;  --hot-bg: #fff1e8;
  --warm: #a16207; --warm-bg: #fef7dd;
  --cold: #0369a1; --cold-bg: #e6f2f9;
}

/* ---- temperature ------------------------------------------------------------ */
.c-temp { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.c-temp .icon { width: 14px; height: 14px; }
.c-temp--hot { background: var(--hot-bg); color: var(--hot); }
.c-temp--warm { background: var(--warm-bg); color: var(--warm); }
.c-temp--cold { background: var(--cold-bg); color: var(--cold); }
.c-temp--compact { padding: 0; width: 22px; justify-content: center; }
.c-temp--compact .c-temp__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.c-temp-picker { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.c-temp-picker__opt {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface);
  font-size: var(--text-sm); color: var(--text-2); cursor: pointer;
}
.c-temp-picker__opt input { position: absolute; opacity: 0; pointer-events: none; }
.c-temp-picker__opt .icon { width: 16px; height: 16px; }
.c-temp-picker__opt:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.c-temp-picker__opt--hot:is(:has(input:checked), [aria-checked="true"]) { background: var(--hot-bg); border-color: var(--hot); color: var(--hot); font-weight: 600; }
.c-temp-picker__opt--warm:is(:has(input:checked), [aria-checked="true"]) { background: var(--warm-bg); border-color: var(--warm); color: var(--warm); font-weight: 600; }
.c-temp-picker__opt--cold:is(:has(input:checked), [aria-checked="true"]) { background: var(--cold-bg); border-color: var(--cold); color: var(--cold); font-weight: 600; }
.c-temp-picker__opt:not([class*="--"]):has(input:checked) { background: var(--surface-2); color: var(--text); }
.c-temp-picker__clear { width: 36px; padding: 0; justify-content: center; }
.c-temp-picker fieldset, fieldset.c-field legend { padding: 0; }
.c-segmented--temp .seg-hot:has(input:checked) { color: var(--hot); }
.c-segmented--temp .seg-warm:has(input:checked) { color: var(--warm); }
.c-segmented--temp .seg-cold:has(input:checked) { color: var(--cold); }

/* ---- stage pills ------------------------------------------------------------ */
.c-pill { background: var(--surface); color: var(--text); white-space: nowrap; }
.c-pill--won { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.c-pill--lost { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ---- kanban (04 §5, §6) ------------------------------------------------------- */
.c-kanban { position: relative; }
.c-kanban__cols { display: flex; gap: var(--sp-3); overflow-x: auto; padding-bottom: var(--sp-3); align-items: flex-start; scroll-snap-type: x proximity; }
.c-kanban__col {
  flex: 0 0 280px; display: flex; flex-direction: column; max-height: calc(100dvh - 220px);
  background: var(--surface-2); border-radius: var(--radius); border-top: 4px solid var(--stage, var(--border-strong));
  scroll-snap-align: start;
}
.c-kanban__col--collapsed { flex-basis: 180px; background: transparent; border: 2px dashed var(--border-strong); border-top-width: 4px; border-top-style: solid; }
.c-kanban__col--won.c-kanban__col--collapsed { border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.c-kanban__col--lost.c-kanban__col--collapsed { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.c-kanban__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.c-kanban__meta { font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-kanban__list { flex: 1; overflow-y: auto; padding: 0 var(--sp-2) var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); min-height: 64px; }
.c-kanban__empty, .c-kanban__drop { padding: var(--sp-4) var(--sp-2); text-align: center; font-size: var(--text-sm); color: var(--text-3); }
.c-kanban__drop { border-radius: var(--radius-sm); }
.c-kanban.is-dragging .c-kanban__drop { background: var(--surface); color: var(--text-2); }
.c-kanban__card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1); padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px;
  cursor: grab; touch-action: pan-y; user-select: none; border-left: 3px solid transparent;
}
.c-kanban__card:hover { border-top-color: var(--border-strong); border-right-color: var(--border-strong); border-bottom-color: var(--border-strong); }
.c-kanban__card:focus-visible { box-shadow: var(--focus-ring); }
.c-kanban__card--hot { border-left-color: var(--hot); }
.c-kanban__card--warm { border-left-color: var(--warm); }
.c-kanban__card--cold { border-left-color: var(--cold); }
.c-kanban__card.is-dragging { opacity: .35; }
.c-kanban__card[aria-busy="true"] { opacity: .7; }
.c-kanban__ghost { position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; box-shadow: var(--shadow-3); transform-origin: 0 0; rotate: 1.5deg; cursor: grabbing; }
.c-kanban__card-top { display: flex; align-items: flex-start; gap: var(--sp-1); }
.c-kanban__title { flex: 1; font-weight: 600; font-size: var(--text-sm); color: var(--text); line-height: 1.35; overflow-wrap: anywhere; }
.c-kanban__title:hover { color: var(--accent-text); text-decoration: none; }
.c-kanban__menu > summary { margin: -6px -6px 0 0; width: 28px; height: 28px; }
.c-kanban__menu .c-menu__list form { margin: 0; }
.c-kanban__overdue { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-top: 6px; flex: none; }
.c-kanban__party { font-size: var(--text-sm); color: var(--text-2); }
.c-kanban__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.c-kanban__value { font-weight: 600; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.c-kanban__field { font-size: var(--text-xs); color: var(--text-2); }
.c-kanban__foot { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.c-kanban__stale { font-size: var(--text-xs); color: var(--warning); font-weight: 600; }
.c-kanban__chips { display: none; }
@media (max-width: 1023px) {
  .c-kanban__cols { scroll-snap-type: x mandatory; }
  .c-kanban__col { flex-basis: 85%; }
}
@media (max-width: 639px) {
  /* One column at a time: chips jump, swiping snaps. No drag on phones (04 §6). */
  .c-kanban__chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-3); margin: 0 calc(-1 * var(--sp-4)); padding-inline: var(--sp-4); }
  .c-kanban__chip { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--text); }
  .c-kanban__chip:hover { text-decoration: none; }
  .c-kanban__chip-count { font-size: var(--text-xs); color: var(--text-3); }
  .c-kanban__col { flex-basis: 100%; max-height: none; }
  .c-kanban__col--collapsed { flex-basis: 100%; }
  .c-kanban__card { cursor: default; }
}

/* ---- deal list rows (panels, search, settings) --------------------------------- */
.deal-list { display: flex; flex-direction: column; }
.deal-list__item { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4); border-top: 1px solid var(--border); }
.deal-list__item:first-child { border-top: 0; }
.deal-list__item--closed { opacity: .6; }
.deal-list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.deal-list__title { font-weight: 600; font-size: var(--text-sm); color: var(--text); overflow-wrap: anywhere; }
.deal-list__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.deal-list__value { font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- S11 ------------------------------------------------------------------- */
.eyebrow-row { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.c-status { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.c-status--won { color: var(--success); }
.c-status--lost { color: var(--danger); }
.stagebar-wrap { display: flex; flex-direction: column; gap: var(--sp-3); margin: calc(-1 * var(--sp-3)) 0 var(--sp-5); }
/* S11: the "Etap" dropdown is the only stage control; the progress line is not clickable. */
.stagepick { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.stagepick__label { font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.stagepick__btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 40px; padding: 0 var(--sp-3) 0 var(--sp-4); min-width: 240px;
  border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 650; color: var(--text); box-shadow: var(--shadow-1, none);
}
.stagepick__btn:hover { border-color: var(--accent); }
.stagepick__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stagepick__hint { margin-left: auto; font-weight: 500; font-size: var(--text-xs); color: var(--accent); }
.stagepick__caret { color: var(--text-2); }
.stagepick__menu[open] .stagepick__caret { transform: rotate(180deg); }
.stagepick__list { left: 0; right: auto; min-width: 280px; }
.stagepick__list form { margin: 0; }
.stagepick__list .c-menu__item .icon { width: 16px; height: 16px; }
.stagepick__list .c-menu__item.is-current { font-weight: 650; background: color-mix(in srgb, var(--stage) 10%, transparent); cursor: default; }
.stagepick__now { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); font-weight: 500; }
.stagepick__lost > summary { list-style: none; }
.stagepick__lost > summary::-webkit-details-marker { display: none; }
.stagepick__lost form { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) 10px var(--sp-3); }
.stagebar { display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.stagebar__step {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 var(--sp-3) 6px;
  font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; border-bottom: 3px solid var(--border);
}
.stagebar__step .icon { width: 12px; height: 12px; }
.stagebar__step.is-done { color: var(--text-2); border-bottom-color: color-mix(in srgb, var(--stage) 55%, var(--border)); }
.stagebar__step.is-current { color: var(--text); font-weight: 650; border-bottom-color: var(--stage); }
.stagebar__step--won, .stagebar__step--lost { flex-grow: 0; }
.stagebar__step--won:not(.is-current), .stagebar__step--lost:not(.is-current) { border-bottom-style: dashed; }
@media (max-width: 639px) { .stagepick__btn { min-width: 0; flex: 1; } }
.vcard-menu { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.vcard-menu > summary { margin-left: calc(-1 * var(--sp-3)); color: var(--text-2); }
.vcard-menu .c-menu__list { left: 0; right: auto; }
.vcard-pop { width: 248px; padding: var(--sp-3); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; }
.vcard-pop p { margin: 0; }
.vcard-pop__qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; border-radius: var(--radius-sm); }
/* ---- tasks (S13, panels, dashboard) ------------------------------------------- */
.tasks__bar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.tasks__bar .c-tabs { flex: 1; overflow-y: hidden; scrollbar-width: none; }
.tasks__person { margin-bottom: var(--sp-5); }
.tasks__person .c-input { width: auto; min-width: 160px; }
.task-group + .task-group { margin-top: var(--sp-5); }
.task-group__title { font-size: var(--text-sm); font-weight: 650; color: var(--text-2); margin: 0 0 var(--sp-2); display: flex; gap: var(--sp-2); align-items: center; }
.task-group__title--danger { color: var(--danger); }
.task-group__count { font-weight: 500; color: var(--text-3); }
.task-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.task-list--compact { border: 0; border-radius: 0; }
.task { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3); border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task__checkform { margin: 0; padding-top: 2px; }
.task__check { width: 20px; height: 20px; accent-color: var(--success); cursor: pointer; }
.task__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task__title { all: unset; cursor: pointer; font-weight: 550; color: var(--text); overflow-wrap: anywhere; }
.task__title:hover { text-decoration: underline; }
.task__title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.task--done .task__title { text-decoration: line-through; color: var(--text-3); }
.task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-3); font-size: var(--text-sm); color: var(--text-2); }
.task__meta .icon { width: 14px; height: 14px; }
.task__due, .task__link { display: inline-flex; align-items: center; gap: 4px; }
.task__link { color: var(--text-2); }
.task__due--over { color: var(--danger); font-weight: 600; }
.task__notes { margin: 0; font-size: var(--text-sm); color: var(--text-3); white-space: pre-line; }
.task__menu .c-menu__list { min-width: 200px; }
.task-list--compact .task__menu .hide-sm { display: none; }
.task__menu form { margin: 0; }
.task__pickdate { display: flex; gap: var(--sp-2); padding: 6px 10px; }
.task__fixed { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); }
.task__fixed .icon { width: 16px; height: 16px; }
.taskform__at { display: none; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.taskform__at .c-input { width: auto; }
.taskform__when:has(input[name="when"]:not([value=""]):checked) .taskform__at { display: flex; }
.taskform__date { display: none; }
.taskform__when:has(input[name="when"][value="date"]:checked) .taskform__date { display: block; }
.nav__badge, .tabbar__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.nav__badge { margin-left: auto; }
.nav__badge[hidden], .tabbar__badge[hidden] { display: none; }
.tabbar__icon { position: relative; display: inline-flex; }
.tabbar__badge { position: absolute; top: -6px; right: -12px; height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; }
@media (max-width: 1023px) and (min-width: 640px) { .nav__item { position: relative; } .nav__badge { position: absolute; top: 2px; right: 0; } }
@media (max-width: 639px) {
  .task { padding: var(--sp-3) var(--sp-2); }
  .task .c-tel { min-height: 44px; }
}

/* ---- S03 Pulpit ------------------------------------------------------------- */
.dash__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.dash__tasks { grid-row: span 2; }
.dash__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.dash-tile { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.dash-tile:hover { border-color: var(--accent); text-decoration: none; }
.dash-tile__label { font-size: var(--text-sm); color: var(--text-2); }
.dash-tile__value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dash-tile__sub { font-size: var(--text-sm); color: var(--success); font-weight: 600; }
.dash-bars { list-style: none; margin: 0; padding: var(--sp-2) 0; }
.dash-bar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 32px minmax(70px, auto); align-items: center; gap: var(--sp-3); padding: 6px var(--sp-4); color: var(--text); font-size: var(--text-sm); }
.dash-bar:hover { background: var(--surface-2); text-decoration: none; }
.dash-bar__track { height: 10px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.dash-bar__fill { display: block; height: 100%; border-radius: inherit; background: var(--stage, var(--accent)); width: 0; }
.dash-bar__num { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.dash-bar__sum { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-recent { list-style: none; margin: 0; padding: 0; }
.dash-recent li { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.dash-recent li:first-child { border-top: 0; }
.dash-recent__title { font-weight: 550; color: var(--text); }
.dash-recent__meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
@media (max-width: 1023px) { .dash__grid { grid-template-columns: minmax(0, 1fr); } .dash__tasks { grid-row: auto; } }
@media (max-width: 639px) { .dash-bar { grid-template-columns: minmax(90px, 1fr) 1.2fr 24px; } .dash-bar__sum { display: none; } .dash-tile__value { font-size: 1.4rem; } }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* ---- S14 Kalendarz -------------------------------------------------------------- */
.cal__bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.cal__nav, .cal__tools { display: flex; align-items: center; gap: var(--sp-2); }
.cal__tools .c-input { width: auto; }
.cal__month { font-size: var(--text-lg, 1.15rem); margin: 0 var(--sp-2); min-width: 170px; text-align: center; }
.c-segmented a { display: inline-flex; align-items: center; height: 30px; padding: 0 var(--sp-3); border-radius: 5px; font-size: var(--text-sm); color: var(--text-2); }
.c-segmented a:hover { text-decoration: none; color: var(--text); }
.c-segmented a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }
.cal { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-5); align-items: start; }
.cal__grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cal__grid th { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: var(--sp-2); text-align: left; border-bottom: 1px solid var(--border); }
.cal__day { position: relative; vertical-align: top; height: 104px; padding: 0; border: 1px solid var(--border); }
.cal__day.is-out { background: var(--surface-2); }
.cal__day.is-out .cal__num { color: var(--text-3); }
.cal__daylink { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 6px 8px; color: var(--text); z-index: 1; }
.cal__daylink:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); text-decoration: none; }
.cal__daylink:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal__num { font-size: var(--text-sm); font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal__day.is-today .cal__num { background: var(--accent); color: #fff; }
.cal__day.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal__count { display: none; font-size: 11px; font-weight: 700; color: var(--accent-text); }
.cal__items { list-style: none; margin: 34px 6px 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; position: relative; pointer-events: none; }
.cal__item { font-size: 12px; line-height: 1.35; padding: 1px 5px; border-radius: 4px; background: var(--accent-bg, var(--surface-2)); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__item.is-over { background: var(--danger-bg); color: var(--danger); }
.cal__item.is-done { text-decoration: line-through; color: var(--text-3); background: var(--surface-2); }
.cal__time { font-variant-numeric: tabular-nums; font-weight: 600; }
.cal__more { font-size: 11px; color: var(--text-3); padding-left: 5px; }
.cal__panel { position: sticky; top: var(--sp-4); }
.cal-agenda { display: flex; flex-direction: column; gap: var(--sp-5); max-width: 760px; }
.cal-agenda__more { align-self: flex-start; }
@media (max-width: 1023px) { .cal { grid-template-columns: minmax(0, 1fr); } .cal__panel { position: static; } }
@media (max-width: 639px) {
  .cal__day { height: 52px; }
  .cal__items { display: none; }
  .cal__daylink { flex-direction: column; align-items: center; padding: 4px 2px; gap: 2px; }
  .cal__count { display: block; }
  .cal__grid th { padding: 6px 2px; text-align: center; }
  .cal__month { min-width: 0; }
}

/* ---- files (S05, S08, S11) ------------------------------------------------------ */
.files__form { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.files__drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--sp-4); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); text-align: center; font-size: var(--text-sm); color: var(--text-2); cursor: pointer; position: relative; }
.files__drop:hover, .files.is-dragover .files__drop { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--text); }
.files__drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.files__drop .icon { color: var(--accent); }
.files__limit { font-size: var(--text-xs); color: var(--text-3); }
.files__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.files__camera { position: relative; display: none; align-self: center; }
.files__progress { width: 100%; height: 6px; accent-color: var(--accent); }
.files.is-uploading .files__drop { opacity: .6; pointer-events: none; }
.files__list { list-style: none; margin: 0; padding: 0; }
.file { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); }
.file:first-child { border-top: 0; }
.file__thumb { flex: none; width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.file__thumb img { width: 100%; height: 100%; object-fit: cover; }
.file__icon { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-3); }
.file__icon--pdf { color: #dc2626; }
.file__icon--sheet { color: #16a34a; }
.file__icon--image { color: var(--accent); }
.file__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file__name { font-weight: 550; color: var(--text); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__meta { font-size: var(--text-xs); color: var(--text-3); }
@media (pointer: coarse) { .files__camera { display: inline-flex; } }

/* ---- in-app help (pagehelp under page titles, /help) ---------------------------- */
.pagehelp { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); }
.pagehelp__summary { display: flex; align-items: flex-start; gap: var(--sp-2); padding: 10px var(--sp-3); cursor: pointer; list-style: none; color: var(--text-2); }
.pagehelp__summary::-webkit-details-marker { display: none; }
.pagehelp__summary .icon { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
.pagehelp__lead { flex: 1; min-width: 0; }
.pagehelp__toggle { color: var(--accent); font-weight: 550; white-space: nowrap; }
.pagehelp[open] .pagehelp__toggle::after { content: " ▴"; }
.pagehelp:not([open]) .pagehelp__toggle::after { content: " ▾"; }
.pagehelp__summary:hover .pagehelp__toggle { text-decoration: underline; }
.pagehelp > .pagehelp__points { padding: 0 var(--sp-3) var(--sp-3) calc(var(--sp-3) + 26px); }
.pagehelp__points { margin: 0; display: grid; gap: var(--sp-2); }
.pagehelp__point { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: var(--sp-3); }
.pagehelp__point dt { font-weight: 600; color: var(--text); }
.pagehelp__point dd { margin: 0; color: var(--text-2); }
@media (max-width: 639px) {
  .pagehelp__summary { flex-wrap: wrap; }
  .pagehelp__point { grid-template-columns: 1fr; gap: 2px; }
  .pagehelp > .pagehelp__points { padding-left: var(--sp-3); }
}
.help__intro { color: var(--text-2); margin: 0 0 var(--sp-4); }
.help { display: grid; gap: var(--sp-4); }
.help__lead { margin: 0 0 var(--sp-3); color: var(--text); }
kbd { font-family: var(--font-mono, ui-monospace, monospace); font-size: .85em; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
.dl__static { padding: 6px 0; font-size: var(--text-sm); display: flex; align-items: center; gap: var(--sp-2); }
.c-timeline__stage { margin-top: 2px; font-size: var(--text-sm); color: var(--text-2); }
.c-tag--deal { background: var(--accent-soft); color: var(--accent-text); }

/* ---- forms ------------------------------------------------------------------ */
.c-field__wrap { position: relative; display: flex; align-items: center; }
.c-input--suffixed { padding-right: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.c-field__suffix { position: absolute; right: 12px; color: var(--text-3); font-size: var(--text-sm); pointer-events: none; }
.c-check { width: 18px; height: 18px; accent-color: var(--accent); }
.c-radio-card { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.c-radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.c-radio-card input { margin-top: 4px; accent-color: var(--accent); }
.c-multiselect > summary.c-input { display: flex; align-items: center; min-width: 120px; cursor: pointer; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.c-multiselect .c-menu__list { left: 0; right: auto; }
label.c-menu__item { cursor: pointer; }
.c-date-range { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--text-2); }
.c-date-range .c-input { width: 150px; }
@media (max-width: 639px) { .c-date-range { width: 100%; } .c-date-range .c-input { flex: 1; width: auto; min-width: 0; } }

/* ---- tables ----------------------------------------------------------------- */
.c-sort { color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.c-sort:hover { color: var(--text); text-decoration: none; }
.c-table__sum td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
@media (max-width: 639px) { .c-table--stack tfoot { display: block; } .c-table__sum { display: flex; justify-content: space-between; padding: var(--sp-3) var(--sp-4); } .c-table__sum td { display: block; background: none; border: 0; padding: 0; } .c-table__sum td:empty { display: none; } }

/* ---- D4 additions ----------------------------------------------------------- */
.call__option-deals { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.call__deal { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text); }
.call__about-opts { display: flex; flex-direction: column; gap: var(--sp-2); }
.call__newdeal { display: none; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4); background: var(--surface-2); border-radius: var(--radius); }
.call:has(input[name="about"][value="new"]:checked) .call__newdeal { display: flex; }
.call__option--deal .call__option-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }

/* ---- settings --------------------------------------------------------------- */
.c-tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; }
.c-tabs__item { padding: var(--sp-2) var(--sp-3); font-size: var(--text-sm); font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.c-tabs__item:hover { color: var(--text); text-decoration: none; }
.c-tabs__item[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.c-tabs__item--soon { color: var(--text-3); opacity: .6; cursor: default; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--sp-5); align-items: start; }
@media (max-width: 639px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.list-plain { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }
.code { margin: 0; padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--text-xs); overflow-x: auto; white-space: pre; }
.secret-card { margin-bottom: var(--sp-5); border-color: var(--accent); }
@media (max-width: 639px) {
  /* Keep the stage chips and the column header in view after a chip jump. */
  .c-kanban__chips { position: sticky; top: var(--top-h); z-index: 6; background: var(--bg); padding-top: var(--sp-2); }
  .c-kanban__col { scroll-margin-top: calc(var(--top-h) + 60px); }
}
.c-kanban__chips { scrollbar-width: none; }
.c-kanban__chips::-webkit-scrollbar { display: none; }

/* D4: temperature applies to a new deal and to the existing one the call is about. */
.call__temp { display: none; }
.call:has(input[name="about"]:checked:not([value="note"])) .call__temp { display: block; }

/* ---- S15 import ------------------------------------------------------------------ */
.steps { display: flex; gap: var(--sp-2); list-style: none; margin: 0 0 var(--sp-4); padding: 0; flex-wrap: wrap; }
.steps__item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-3); }
.steps__item + .steps__item::before { content: ""; width: 20px; height: 1px; background: var(--border-strong); margin-right: 2px; }
.steps__num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); font-size: var(--text-xs); font-weight: 650; }
.steps__item.is-current { color: var(--text); font-weight: 600; }
.steps__item.is-current .steps__num { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps__item.is-done .steps__num { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.c-note { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-size: var(--text-sm); margin: 0 0 var(--sp-3); }
.c-note .icon { margin-top: 2px; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); }
.import__drop { padding: var(--sp-5); }
.import__file { font-size: var(--text-sm); max-width: 100%; }
.import__file-line { margin: 0 0 var(--sp-3); font-size: var(--text-sm); color: var(--text-2); overflow-wrap: anywhere; }
.import__filebar { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; margin-bottom: var(--sp-4); font-size: var(--text-sm); }
.import__opt { display: inline-flex; align-items: center; gap: var(--sp-2); }
.import__opt .c-input { width: auto; }
.import__err { padding: var(--sp-3) var(--sp-4) 0; margin: 0; }
.import__map { display: flex; flex-direction: column; }
.import__col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(200px, 1fr); gap: var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.import__col:first-child { border-top: 0; }
.import__col:has(select option[value=""]:checked) .import__head, .import__col:has(select option[value=""]:checked) .import__samples { opacity: .55; }
.import__head { display: flex; gap: var(--sp-2); align-items: baseline; min-width: 0; }
.import__letter { flex: none; font-size: var(--text-xs); font-weight: 650; color: var(--text-3); width: 22px; }
.import__name { font-weight: 550; overflow-wrap: anywhere; }
.import__samples { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.import__samples span { max-width: 100%; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); font-size: var(--text-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import__samples span.muted { background: none; padding: 0; }
@media (max-width: 720px) {
  .import__col { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
}
.import__summary { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.import__stat { display: flex; flex-direction: column; min-width: 120px; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.import__stat b { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.import__stat span { font-size: var(--text-sm); color: var(--text-2); }
.import__stat--ok b { color: var(--success); }
.import__stat--bad b { color: var(--danger); }
.import__stat--warn b { color: var(--warning); }
.import__table-wrap { overflow-x: auto; }
.import__table th small { display: block; font-weight: 450; color: var(--accent-text); text-transform: none; letter-spacing: 0; }
.import__table td, .import__table th { position: relative; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; } /* relative: keeps .sr-only reasons inside the scroller */
.import__table tbody th { font-weight: 550; color: var(--text-2); }
.import__table tbody th .c-tag { margin-left: 4px; }
.import__table td.is-bad { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 -2px 0 var(--danger); }
.import__table tr.is-dup td.is-bad, .import__table tr:not(.is-error) td.is-bad { background: var(--warning-bg); color: var(--warning); box-shadow: inset 0 -2px 0 var(--warning); }
.import__table tr.is-error td.is-bad { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 -2px 0 var(--danger); }
.import__problems { margin: 0; padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 18px); font-size: var(--text-sm); display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.import__board { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); margin-bottom: var(--sp-4); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius); background: var(--surface-2); }
.import__board p { margin: 0; }
.import__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.import__progress { width: 100%; height: 10px; accent-color: var(--accent); }
.import__errs summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-2); }

/* ---- S16 export ------------------------------------------------------------------ */
.export__targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); }
.export__filtered > span:first-child { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); font-weight: 550; }

/* Synced e-mail on the timeline (D-21) */
.mail-entry__head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-1); }
.mail-entry__subject { overflow-wrap: anywhere; }
.mail-entry__dir--in { background: var(--success-bg); color: var(--success); }
.mail-entry__dir--out { background: var(--accent-soft); color: var(--accent-text); }
.mail-entry__addr { margin-top: 2px; overflow-wrap: anywhere; }
.mail-entry__body > summary { list-style: none; cursor: pointer; }
.mail-entry__body > summary::-webkit-details-marker { display: none; }
.mail-entry__preview { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mail-entry__more { color: var(--accent-text); }
.mail-entry__body[open] > summary { display: none; }
.mail-entry__files { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); padding: 0; list-style: none; }
.mail-entry__files .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.mail-row { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.mail-row:first-child { border-top: 0; }
.mail-row__main { flex: 1; min-width: 0; }
.mail-row__subject { font-weight: 600; overflow-wrap: anywhere; }
.mail-row__text { margin-top: var(--sp-1); color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mail-row__actions { display: flex; flex-direction: column; gap: var(--sp-1); align-items: stretch; min-width: 12rem; }
@media (max-width: 640px) { .mail-row { flex-direction: column; } .mail-row__actions { min-width: 0; width: 100%; } }
.mail-status--error { color: var(--danger); }
.mail-status--error .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
