/* Monet CRM: app-level pieces that Relay does not ship (shell, form fields, tables, board,
   timeline, palette, toasts). Built only from Relay tokens; no hard-coded colours. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { color: var(--accent-text); }
.link:hover { text-decoration: underline; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.tnum { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- App shell: 260px sidebar + main canvas with a 56px header ---- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-2); background: var(--surface-sidebar); border-right: 1px solid var(--border); overflow-y: auto; }
.side-ws { display: flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-2); font-weight: 600; }
.side-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 600; flex: none; }
.side-search { display: flex; align-items: center; gap: var(--space-2); height: 32px; margin: var(--space-1) 0 var(--space-2);
  padding: 0 var(--space-1-5) 0 var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--ink-muted); box-shadow: var(--shadow-xs); cursor: pointer; width: 100%; text-align: left; }
.side-search:hover { background: var(--surface-hover); }
.side-search span { flex: 1; }
.side-fill { flex: 1; }
.side-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); border-top: 1px solid var(--border);
  font-size: 13px; color: var(--ink-secondary); margin: var(--space-2) calc(-1 * var(--space-2)) calc(-1 * var(--space-2)); padding: var(--space-2) var(--space-3); }
.side-foot .who { flex: 1; min-width: 0; }
.nav-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full); font-size: 11px; line-height: 18px;
  font-weight: 600; text-align: center; background: var(--tag-gray-bg); color: var(--ink-muted); }
.nav-count.is-alert { background: var(--danger); color: var(--on-accent); }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-2); height: 56px;
  padding: 0 var(--space-4) 0 var(--space-6); border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.crumb { display: flex; align-items: center; gap: var(--space-1-5); font-weight: 500; color: var(--ink-secondary); min-width: 0; }
.crumb a:hover { color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 500; }
.crumb .rl-icon { color: var(--ink-faint); }
.top-grow { flex: 1; }
.menu-btn { display: none; }

/* ---- Page sections ---- */
.page { padding: var(--space-6); }
.page-narrow { max-width: 900px; margin: 0 auto; padding: var(--space-12) var(--space-6) var(--space-8); }
.page-form { max-width: 720px; padding: var(--space-6); }
.sechead { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; margin-bottom: var(--space-2); }
.sechead h2 { flex: 1; font-size: 15px; line-height: 20px; font-weight: 600; }
.sechead .count { font-size: 12px; color: var(--ink-muted); font-weight: 500; margin-left: var(--space-1); }
.greet { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }

/* Record page: header, tabs + feed on the left, details rail on the right */
.rhead { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); }
.rhead h1 { flex: 1; min-width: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -.005em; }
.rhead .sub { font-size: 13px; color: var(--ink-muted); font-weight: 400; margin-top: 2px; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.rhead-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.strip { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--border); background: var(--surface-sidebar); font-size: 13px; color: var(--ink-muted); min-height: 41px; }
.strip .sep { width: 1px; height: 16px; background: var(--border); }
.rbody { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
.rfeed { min-width: 0; border-right: 1px solid var(--border); min-height: calc(100vh - 56px - 73px); }
.rrail { min-width: 0; }
.railsec { padding: var(--space-4); border-bottom: 1px solid var(--border); }
.railsec h3 { display: flex; align-items: center; gap: var(--space-1); margin: 0 0 var(--space-2); font-size: 14px; line-height: 20px; font-weight: 600; }
.railsec h3 .grow { flex: 1; }
.railsec h3 .count { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
.railsec .rl-attr { grid-template-columns: 152px minmax(0, 1fr); min-height: 32px; font-size: 13px; }
.railsec .rl-attr-value { font-size: 13px; }
.rl-attr-value .rl-chip { max-width: 100%; }
.rl-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.rl-chip:hover { background: var(--surface-hover); }
.card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); background: var(--surface-raised); }
.card + .card { margin-top: var(--space-2); }
.cardhead { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--ink-muted); }
.cardhead b { color: var(--ink); font-weight: 500; }
.cardhead a:hover b { text-decoration: underline; text-underline-offset: 2px; }

/* Contacts list on a record */
.contact { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.contact:last-child { border-bottom: 0; }
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-weight: 500; font-size: 13px; }
.contact-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.contact-role { font-size: 12px; color: var(--ink-muted); }
.contact-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--duration-fast); }
.contact:hover .contact-actions, .contact:focus-within .contact-actions { opacity: 1; }

/* ---- Timeline (activities, notes, history) ---- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border); }
.tl-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  border-radius: var(--radius-full); background: var(--tag-gray-bg); color: var(--ink-muted); margin-top: 1px; }
.tl-ico.is-call { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tl-ico.is-note { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); }
.tl-ico.is-meeting { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.tl-ico.is-email { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.tl-ico.is-task { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.tl-body { flex: 1; min-width: 0; }
.tl-top { display: flex; align-items: baseline; gap: var(--space-2); }
.tl-title { flex: 1; min-width: 0; font-weight: 500; }
.tl-time { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1-5); margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.tl-meta a:hover { color: var(--ink); text-decoration: underline; }
.tl-text { margin-top: var(--space-1-5); font-size: 13px; line-height: 18px; color: var(--ink-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-item.is-history { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.tl-item.is-history .tl-ico { width: 20px; height: 20px; margin: 0 4px; background: transparent; color: var(--ink-faint); }
.tl-item.is-history .tl-title { font-weight: 400; font-size: 13px; color: var(--ink-secondary); }
.tl-item.is-history .tl-title b { font-weight: 500; color: var(--ink); }
.tl-item .tl-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--duration-fast); }
.tl-item:hover .tl-actions, .tl-item:focus-within .tl-actions { opacity: 1; }
.tl-pinned { box-shadow: inset 2px 0 0 var(--status-yellow); }
.old { color: var(--ink-muted); text-decoration: line-through; }

/* ---- Activity rows (Mes activités, home) ---- */
.act { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2); border-bottom: 1px solid var(--border); min-height: 48px; }
.act:hover { background: var(--surface-hover); }
.act-check { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none; padding: 0;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface-raised); color: transparent; cursor: pointer; }
.act-check:hover { border-color: var(--success); color: var(--success); }
.act-check.is-done { background: var(--success); border-color: var(--success); color: var(--on-accent); }
.act-main { flex: 1; min-width: 0; }
.act-title { font-weight: 500; }
.act-links { display: flex; gap: var(--space-1-5); flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.act-links a:hover { color: var(--ink); text-decoration: underline; }
.act-due { font-size: 12px; color: var(--ink-muted); white-space: nowrap; text-align: right; min-width: 92px; }
.act-due.is-overdue { color: var(--danger); font-weight: 500; }
.act-due.is-today { color: var(--ink); font-weight: 500; }
.act-group { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-2) var(--space-1); font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.act-group.is-overdue { color: var(--danger); }

/* ---- Form fields (Relay has none: 32px, hairline, accent focus ring) ---- */
.field { display: flex; flex-direction: column; gap: var(--space-1-5); }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--ink-secondary); }
.field .req { color: var(--danger); margin-left: 2px; }
.field-help { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.field-error { font-size: 12px; line-height: 16px; color: var(--danger); }
.input, .select, .textarea { width: 100%; min-height: 32px; padding: 0 var(--space-2-5, 10px); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-xs); font-size: 14px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.textarea { padding: var(--space-2) 10px; line-height: 20px; resize: vertical; min-height: 80px; }
.select { appearance: none; padding-right: 30px; background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e9097' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E"); }
.select[multiple] { background-image: none; padding: var(--space-1); min-height: 96px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input-sm { min-height: 28px; font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-4); }
.form-grid .span-2 { grid-column: span 2; }
.form-section { padding: var(--space-6) 0; border-bottom: 1px solid var(--border); }
.form-section:first-child { padding-top: 0; }
.form-section h2 { font-size: 15px; font-weight: 600; margin-bottom: var(--space-4); }
.form-actions { display: flex; gap: var(--space-2); justify-content: flex-end; padding-top: var(--space-4); }
.list-input { display: flex; flex-direction: column; gap: var(--space-1-5); }
.list-input-row { display: flex; gap: var(--space-1-5); }

/* Segmented choice (call outcome, date presets): radios styled as a row of chips */
.seg { display: flex; flex-wrap: wrap; gap: var(--space-1-5); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: inline-flex; align-items: center; gap: var(--space-1-5); height: 28px; padding: 0 var(--space-3); border: 1px solid var(--border);
  border-radius: var(--radius-full); background: var(--surface-raised); font-size: 13px; font-weight: 500; color: var(--ink-secondary); cursor: pointer;
  box-shadow: var(--shadow-xs); transition: background var(--duration-fast), border-color var(--duration-fast); user-select: none; }
.seg label:hover { background: var(--surface-hover); }
.seg input:checked + label { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg kbd { margin-left: 2px; }

/* ---- Tables (list views) ---- */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1; }
.toolbar .search-in { position: relative; width: 260px; }
.toolbar .search-in .rl-icon { position: absolute; left: 8px; top: 50%; margin-top: -8px; color: var(--ink-faint); pointer-events: none; }
.toolbar .search-in .input { padding-left: 30px; min-height: 28px; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border); background: var(--surface-sidebar); }
.filters .field { width: 200px; }
.filters .field > label { font-size: 12px; color: var(--ink-muted); }
.filters .select, .filters .input { min-height: 28px; font-size: 13px; }
.chip-filter { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-1) 0 var(--space-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface-raised); font-size: 12px; font-weight: 500; color: var(--ink); }
.chip-filter b { font-weight: 400; color: var(--ink-muted); }
.chip-filter a { display: inline-flex; color: var(--ink-faint); border-radius: 3px; }
.chip-filter a:hover { color: var(--ink); background: var(--surface-hover); }
/* No scroll container on desktop, so the header can stick under the 56px top bar. */
.tablewrap { overflow-x: visible; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 56px; z-index: 1; height: 36px; padding: 0 var(--space-3); background: var(--surface-sidebar); border-bottom: 1px solid var(--border);
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-muted); white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: var(--space-6); }
.table th:last-child, .table td:last-child { padding-right: var(--space-6); }
.table th a { display: inline-flex; align-items: center; gap: 2px; }
.table th a:hover { color: var(--ink); }
.table th.num, .table td.num { text-align: right; }
.table td { height: 40px; padding: 0 var(--space-3); border-bottom: 1px solid var(--border); color: var(--ink-secondary); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.table td.primary { color: var(--ink); font-weight: 500; }
.table td.primary a { display: inline-flex; align-items: center; gap: var(--space-2); max-width: 100%; }
.table td.primary a span { overflow: hidden; text-overflow: ellipsis; }
.table td.primary a:hover span { text-decoration: underline; text-underline-offset: 2px; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr[data-href] { cursor: pointer; }
.table .empty-cell { color: var(--ink-faint); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-6); font-size: 13px; color: var(--ink-muted); }

/* ---- Board (Kanban, DEAL-1) ---- */
.board { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-6) var(--space-6); overflow-x: auto; align-items: flex-start; min-height: calc(100vh - 56px - 53px); background: var(--surface-sunken); }
.col { flex: 0 0 272px; display: flex; flex-direction: column; max-height: calc(100vh - 56px - 53px - 40px); background: var(--surface-sidebar); border: 1px solid var(--border); border-radius: var(--radius-md); }
.col-head { padding: var(--space-3) var(--space-3) var(--space-2); border-bottom: 1px solid var(--border); }
.col-title { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: 13px; }
.col-title .n { font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.col-sum { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.col-cards { flex: 1; overflow-y: auto; padding: var(--space-2); display: flex; flex-direction: column; gap: var(--space-2); min-height: 80px; }
.col-cards.is-over { background: var(--accent-soft); }
.dcard { display: block; padding: var(--space-2) var(--space-3); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow var(--duration-fast), border-color var(--duration-fast); }
.dcard:hover { border-color: var(--ink-faint); }
.dcard.is-dragging { opacity: .5; }
.dcard.is-rotting { border-left: 3px solid var(--status-red); }
.dcard-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 18px; overflow-wrap: anywhere; }
.dcard-org { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.dcard-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); font-size: 12px; color: var(--ink-muted); }
.dcard-foot .v { color: var(--ink); font-weight: 500; }

/* ---- Stats (dashboards) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.stat { padding: var(--space-3) var(--space-4); border-right: 1px solid var(--border); background: var(--surface-raised); }
.stat:last-child { border-right: 0; }
.stat-label { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
.stat-value { font-size: 22px; line-height: 28px; font-weight: 600; margin-top: var(--space-1); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: var(--radius-full); background: var(--surface-selected); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-full); }

/* ---- Popovers, palette, modal, toasts ---- */
.pop { position: absolute; z-index: 40; min-width: 200px; background: var(--surface-raised); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); padding: var(--space-1); }
.pop-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-1-5) var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; font-size: 14px; color: var(--ink); cursor: pointer; }
.pop-item:hover, .pop-item.is-active { background: var(--surface-hover); }
.pop-item .rl-icon { color: var(--ink-muted); }
.pop-item.is-danger { color: var(--danger); }
.pop-item.is-danger .rl-icon { color: var(--danger); }
.pop-sep { height: 1px; margin: var(--space-1) calc(-1 * var(--space-1)); background: var(--border); }
.modal-scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-start; justify-content: center; padding: 10vh var(--space-4) var(--space-4); overflow-y: auto; }
.modal-scrim .rl-dialog { animation: rise var(--duration-base) ease-out; }
.rl-dialog form { margin: 0; }
.rl-dialog-body > .field + .field, .rl-dialog-body > .stack-gap, .rl-dialog-body > form > .stack-gap { margin-top: var(--space-4); }
.rl-dialog:focus { outline: none; }
.dialog-context { display: flex; flex-wrap: wrap; gap: var(--space-1-5); }
.palette { width: 100%; max-width: 600px; background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-popover); overflow: hidden; animation: rise var(--duration-base) ease-out; }
.palette-search { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.palette-search .rl-icon { color: var(--ink-faint); }
.palette-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.palette-search input::placeholder { color: var(--ink-muted); }
.palette-results { max-height: 420px; overflow-y: auto; padding: var(--space-1); }
.palette-results:empty { display: none; }
.palette .rl-menu-heading { padding-top: var(--space-2); }
.palette .rl-menu-item { color: inherit; }
.palette-foot { display: flex; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-muted); }
.palette-foot span { display: inline-flex; align-items: center; gap: var(--space-1); }
.toasts { position: fixed; z-index: 60; bottom: var(--space-4); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--space-2); align-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--ink); color: var(--surface);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-popover); pointer-events: auto; animation: rise var(--duration-base) ease-out; }
.toast .rl-icon { color: var(--status-green); }
.toast.is-error .rl-icon { color: var(--status-red); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Duplicate warning */
.dupes { border: 1px solid var(--warning-soft); background: var(--warning-soft); border-radius: var(--radius-md); padding: var(--space-3); color: var(--warning); }
.dupes h3 { font-size: 14px; font-weight: 600; margin-bottom: var(--space-2); }
.dupes ul { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.dupes li { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--ink); }
.dupes li .why { color: var(--warning); font-size: 12px; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: var(--surface-sunken); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-8) var(--space-6) var(--space-6); }
.auth-card h1 { font-size: 18px; line-height: 24px; font-weight: 600; margin: var(--space-4) 0 var(--space-1); }
.auth-card .lead { font-size: 13px; color: var(--ink-muted); margin-bottom: var(--space-6); }
.auth-card .field + .field { margin-top: var(--space-4); }
.auth-card .rl-btn { width: 100%; justify-content: center; margin-top: var(--space-6); }
.auth-foot { margin-top: var(--space-4); text-align: center; font-size: 13px; }

/* Code / secrets */
.secret { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-sunken); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.secret code { flex: 1; }

/* ---- Responsive (NFR-2): phone can search, read, log a call, add a note ---- */
@media (max-width: 1100px) {
  .rbody { grid-template-columns: minmax(0, 1fr); }
  .rfeed { border-right: 0; min-height: 0; }
  .rrail { order: -1; border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 45; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform var(--duration-base); box-shadow: var(--shadow-popover); }
  .app.nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 var(--space-2) 0 var(--space-2); }
  .page, .page-form { padding: var(--space-4); }
  .page-narrow { padding: var(--space-6) var(--space-4); }
  .rhead { flex-wrap: wrap; padding: var(--space-4); }
  .rhead-actions { width: 100%; justify-content: flex-start; }
  .strip, .toolbar, .filters { padding-left: var(--space-4); padding-right: var(--space-4); }
  .tl-item { padding-left: var(--space-4); padding-right: var(--space-4); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .table th:first-child, .table td:first-child { padding-left: var(--space-4); }
  .toolbar .search-in { width: 100%; }
  .tablewrap { overflow-x: auto; }
  .table th { top: 0; }
  .hide-sm { display: none !important; }
  .modal-scrim { padding: var(--space-2); }
}
.rl-obj-campaign { background: var(--obj-workspace); }

/* Record picker */
.picker { position: relative; }
.picker-value { display: flex; align-items: center; gap: var(--space-1-5); min-height: 32px; padding: 0 var(--space-1) 0 var(--space-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-raised); box-shadow: var(--shadow-xs); }
.picker-value .rl-chip { border: 0; box-shadow: none; background: transparent; padding-left: var(--space-1); min-width: 0; }
.picker-value .grow { flex: 1; }
.picker .pop { left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; }
.picker .rl-menu-item { padding: var(--space-1-5) var(--space-2); }
.picker-empty { padding: var(--space-2); font-size: 13px; color: var(--ink-muted); }

/* Dictation assistant (PRD §8). The panel is a phone layout first: one column, nothing side
   by side, and controls a thumb can hit. Desktop is the same layout with more room. */
.asst-notehead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.asst-notehead label { margin: 0; }
.asst-run .rl-icon { color: var(--accent); }
.asst .rl-dialog-body { max-height: min(70vh, 720px); overflow-y: auto; }
/* Activity dialog: wide enough for its five footer buttons; the note grows with its content and
   the body scrolls, so a long call brief reads in one piece instead of through a 3-row slot. */
.rl-dialog.act { max-width: 820px; }
.act .rl-dialog-body { max-height: min(65vh, 720px); overflow-y: auto; }
.act .rl-dialog-foot { flex-wrap: wrap; }
.act-note { min-height: 140px; overflow: hidden; resize: none; }
.asst .seg label { height: 32px; }
/* The note grows with its content (Alpine sizes it), so the dialog body is the only thing
   that scrolls: a textarea scrolling inside a scrolling panel is miserable on a phone. */
.asst-note { min-height: 200px; font-size: 14px; line-height: 20px; overflow: hidden; resize: none; }
/* A run takes ten to twenty seconds. The button says so rather than just going grey. */
.busy { display: none; }
.htmx-request .idle { display: none; }
.htmx-request .busy { display: inline; }
.htmx-request .rl-icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.asst-ask { padding: var(--space-3); border: 1px solid var(--accent); border-radius: var(--radius-md);
  background: var(--accent-soft); margin-bottom: var(--space-4); }
.asst-ask-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: var(--space-2); }
.asst-ask .field + .field { margin-top: var(--space-2); }
.asst-ask-send { width: 100%; margin-top: var(--space-3); }
.asst-ask .field-help { margin-top: var(--space-2); }
.asst-sug { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-raised); margin-top: var(--space-2); }
.asst-sug.is-off { opacity: 0.6; }
.asst-sug-top { display: flex; align-items: center; gap: var(--space-2); }
.asst-sug-top input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.asst-sug-top .input { flex: 1; min-width: 0; }
.asst-sug-fields { margin-top: var(--space-2); display: grid; gap: var(--space-2); }
.asst-sug-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); }
.asst-sug .field-help { margin: 0; }
.tl-structured { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 11px; color: var(--ink-muted); margin-top: var(--space-1); }
@media (max-width: 760px) {
  .asst .rl-dialog-body { max-height: calc(100vh - 180px); }
  .asst-note { min-height: 160px; }
  .asst-sug-row { grid-template-columns: minmax(0, 1fr); }
  .asst-foot .rl-btn { flex: 1; justify-content: center; }
  .asst-foot .rl-kbd { display: none; }
}
