/* TJA OS: mobile first, RTL-safe (logical properties only), no external assets.
   Colours from the Thiqat Al Jazeera logo: brand green #0a9142 on a deep green. The logo's lettering is white,
   so it always sits on the dark top bar. Text on green uses a darker shade (#087a37, 5.5:1 with white). */
:root {
  --brand: #0a9142;
  --bar-bg: #0b2a1a;
  --bar-text: #ffffff;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --text: #17231c;
  --muted: #56655c;
  --line: #dbe4de;
  --primary: #087a37;
  --primary-text: #ffffff;
  --ok: #1d7a45;
  --warn: #9a5b00;
  --error: #b42318;
  --error-bg: #fdecea;
  --info-bg: #e6f2ea;
  --ok-bg: #e7f5ec;
  --radius: 10px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
/* Dark: when the device asks for it (unless the user chose Light), or when the user chose Dark. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111814; --surface: #18211c; --text: #e6eee9; --muted: #9db0a5; --line: #2a3630;
    --primary: #3fbf72; --primary-text: #0b1a12; --ok: #6cc28e; --warn: #e0a84a; --error: #ff8a80;
    --error-bg: #3a1d1b; --info-bg: #1a2e22; --ok-bg: #18301f; --bar-bg: #08190f;
  }
}
:root[data-theme="dark"] {
    --bg: #111814; --surface: #18211c; --text: #e6eee9; --muted: #9db0a5; --line: #2a3630;
    --primary: #3fbf72; --primary-text: #0b1a12; --ok: #6cc28e; --warn: #e0a84a; --error: #ff8a80;
    --error-bg: #3a1d1b; --info-bg: #1a2e22; --ok-bg: #18301f; --bar-bg: #08190f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
}
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 16px; padding-top: max(.5rem, env(safe-area-inset-top));
  background: var(--bar-bg); color: var(--bar-text);
  border-bottom: 3px solid var(--brand);
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.1rem;
  display: inline-flex; align-items: center; gap: .5rem; }
.brand img { height: 36px; width: auto; display: block; }
.login-logo { display: flex; justify-content: center; background: var(--bar-bg); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; }
.login-logo img { width: 160px; height: auto; }
.link-btn {
  background: none; border: 1px solid currentColor; color: inherit; border-radius: 999px;
  padding: .25rem .8rem; font: inherit; font-size: .85rem; min-height: 36px; cursor: pointer;
}
.lang-switch { margin: 0; }

/* content */
.content { padding: 16px; max-width: 760px; margin-inline: auto; }
.has-nav .content { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

/* navigation: bottom bar on phones, side menu on wide screens */
.app-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.app-nav a, .app-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font: inherit; font-size: .75rem;
  background: none; border: 0; cursor: pointer; min-height: 44px;
}
.app-nav .nav-form { flex: 1; display: flex; margin: 0; }
.app-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.app-nav a.active { color: var(--primary); font-weight: 600; }

@media (min-width: 900px) {
  .app-nav {
    top: 52px; bottom: 0; inset-inline-start: 0; inset-inline-end: auto; width: 220px; height: auto;
    flex-direction: column; justify-content: flex-start; padding: 1rem .5rem;
    border-top: 0; border-inline-end: 1px solid var(--line);
  }
  .app-nav a, .app-nav button, .app-nav .nav-form {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: .75rem;
    font-size: .95rem; padding: .6rem .75rem; border-radius: var(--radius); width: 100%;
  }
  .app-nav a.active { background: var(--info-bg); }
  .has-nav .content { margin-inline-start: 220px; padding: 24px; padding-bottom: 24px; }
}

/* cards and lists */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.narrow { max-width: 480px; margin-inline: auto; }
.cards { list-style: none; padding: 0; margin: 0; }
.row-card { display: flex; flex-direction: column; gap: .5rem; }
.row-main { display: flex; flex-direction: column; }
.row-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge, .chip {
  display: inline-block; font-size: .8rem; padding: .1rem .55rem; border-radius: 999px;
  background: var(--info-bg); color: var(--text);
}
.badge-off { background: var(--error-bg); color: var(--error); }
.chip { background: transparent; border: 1px solid var(--line); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { padding: .35rem 0; }
.status-list li.ok::before { content: "● "; color: var(--ok); }
.status-list li.warn::before { content: "● "; color: var(--warn); }

/* forms: one column, large touch targets; 16px inputs stop iOS from zooming */
.field { margin: 0 0 1rem; border: 0; padding: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date], input[type=month], input[type=time], input[type=tel], input[type=search], input.opp-search, select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px;
}
.checks ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-weight: 400; }
.check input { width: 20px; height: 20px; }
.req { color: var(--error); }
.help { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.error { color: var(--error); font-size: .9rem; margin: .25rem 0 0; }
.has-error input, .has-error select { border-color: var(--error); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: .25rem .75rem; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }

/* messages */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--info-bg); }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-success { background: var(--ok-bg); color: var(--ok); }

/* nav items: some only on wide screens, "More" only on phones */
.app-nav .nav-desktop { display: none; }
@media (min-width: 900px) {
  .app-nav .nav-desktop { display: flex; }
  .app-nav .nav-mobile { display: none; }
}

/* ---------------------------------------------------------------- phase 1: sales */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .btn { flex: 0 0 auto; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.filters .full { grid-column: 1 / -1; }
.filters select, .filters input { min-height: 40px; font-size: 16px; }
@media (min-width: 700px) { .filters { grid-template-columns: repeat(4, 1fr) auto; } .filters .full { grid-column: auto; } }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1.25rem 0 .5rem; }
.section-title h2 { margin: 0; }
.count { color: var(--muted); font-weight: 400; font-size: .9rem; }

.item { display: flex; flex-direction: column; gap: .25rem; }
.item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.item-title { font-weight: 600; color: var(--text); text-decoration: none; }
.item-title:hover { text-decoration: underline; }
.item-sub { color: var(--muted); font-size: .9rem; }
.item-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.inline { display: inline; margin: 0; }

.due { font-size: .85rem; white-space: nowrap; padding: .05rem .5rem; border-radius: 999px; background: var(--info-bg); }
.due.overdue { background: var(--error-bg); color: var(--error); font-weight: 600; }
.due.today { background: #fff4d6; color: var(--warn); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .due.today { background: #3a2f12; } }
:root[data-theme="dark"] .due.today { background: #3a2f12; }

.stage { display: inline-block; font-size: .8rem; padding: .1rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.stage-won { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.stage-lost { background: var(--error-bg); color: var(--error); border-color: transparent; }

.stage-strip { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; scrollbar-width: thin; }
.stage-strip a { flex: 0 0 auto; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; }
.stage-strip a.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.total { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.total .label { color: var(--muted); font-size: .8rem; display: block; }
.total .value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.archived-banner { background: var(--error-bg); color: var(--error); padding: .6rem 1rem; border-radius: 8px;
  margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }

details.card > summary { cursor: pointer; font-weight: 600; list-style: none; min-height: 32px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: " +"; color: var(--muted); }
details.card[open] > summary::after { content: " −"; }
details.card[open] > summary { margin-bottom: .75rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-inline-start: 2px solid var(--line); padding: 0 0 .9rem; padding-inline-start: .9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: .45rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); }
.timeline .meta { color: var(--muted); font-size: .85rem; }
.history { list-style: none; padding: 0; margin: 0; font-size: .85rem; color: var(--muted); }
.history li { padding: .2rem 0; }

.grid-2 { display: grid; gap: 0 1rem; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
textarea { min-height: 88px; resize: vertical; }
.radio-row ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.5rem; }
.empty { color: var(--muted); padding: .5rem 0; }
.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-list li a, .menu-list li button { display: flex; align-items: center; min-height: 52px; padding: 0 .25rem;
  border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; width: 100%; background: none;
  border-inline: 0; border-top: 0; font: inherit; cursor: pointer; text-align: start; }
.spaced { margin-top: .75rem; }
.service-group { border: 1px solid var(--line); border-radius: 8px; padding: .25rem .75rem; margin-bottom: .5rem; }
.service-group > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.service-group .check { display: flex; }
.row-card .chip, dd .chip { margin-block: .1rem; }

/* ---------------------------------------------------------------- sections and sub-sections */
.nav-section { display: contents; }
.app-nav .nav-sub { display: none; }
.section-tabs { margin-bottom: 1rem; }
@media (min-width: 900px) {
  .nav-section { display: block; width: 100%; }
  .app-nav .nav-sub { display: block; list-style: none; margin: 0 0 .5rem; padding: 0; padding-inline-start: 2.25rem; }
  .app-nav .nav-sub a { display: block; padding: .35rem .6rem; font-size: .9rem; border-radius: 6px; min-height: 0; }
  .app-nav .nav-sub a.active { background: var(--info-bg); color: var(--primary); font-weight: 600; }
  .app-nav .nav-top.active { background: transparent; color: var(--text); font-weight: 700; }
  .section-tabs { display: none; }
}
.app-nav .nav-top { flex: 1; }
@media (min-width: 900px) { .app-nav .nav-top { flex: 0 0 auto; } }
.brief-list { list-style: none; padding: 0; margin: 0; }
.brief-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; }
.brief-list li:last-child { border-bottom: 0; }
.section-title h2 .count { font-size: .85rem; }
.q-item { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.totals-box { margin-top: 1rem; padding-top: .75rem; border-top: 2px solid var(--primary); }
.pre { white-space: pre-line; }

/* ---------------------------------------------------------------- collapsible side menu (owner request 2026-11-14) */
.side-nav { display: none; }
@media (min-width: 900px) {
  .app-nav { display: none; }
  .side-nav {
    display: flex; flex-direction: column; gap: .15rem; position: fixed; top: 52px; bottom: 0;
    inset-inline-start: 0; width: 220px; padding: .75rem .5rem; overflow-y: auto;
    background: var(--surface); border-inline-end: 1px solid var(--line); z-index: 20;
  }
  .side-link, .side-section > summary {
    display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 40px; padding: .45rem .65rem;
    border-radius: var(--radius); color: var(--text); text-decoration: none; font: inherit; font-size: .95rem;
    background: none; border: 0; cursor: pointer; text-align: start;
  }
  .side-link:hover, .side-section > summary:hover { background: var(--bg); }
  .side-link.active { background: var(--info-bg); color: var(--primary); font-weight: 600; }
  .side-section > summary { list-style: none; font-weight: 600; }
  .side-section > summary::-webkit-details-marker { display: none; }
  .side-section > summary::after { content: "›"; margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
  [dir="rtl"] .side-section > summary::after { content: "‹"; }
  .side-section[open] > summary::after { transform: rotate(-90deg); }
  .side-section > summary.active { color: var(--primary); }
  .side-section ul { list-style: none; margin: 0 0 .35rem; padding: 0; padding-inline-start: 2.1rem; }
  .side-section li a { display: block; padding: .32rem .6rem; border-radius: 6px; color: var(--muted);
    text-decoration: none; font-size: .9rem; }
  .side-section li a:hover { color: var(--text); background: var(--bg); }
  .side-section li a.active { color: var(--primary); background: var(--info-bg); font-weight: 600; }
  .side-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
  .side-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: .5rem; }
  .side-bottom form { margin: 0; }
}
.side-section-card > summary { font-weight: 600; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .side-section > summary::after { transition: none; } }
.capture-box { display: flex; flex-direction: column; gap: .5rem; }
.capture-label { font-weight: 700; }
.capture-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.help-list { margin: 0; padding-inline-start: 1.2rem; color: var(--muted); }
.task-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; width: 100%; padding: .35rem 0; }
.task-row input[type=text], .task-row input[type=number], .task-row select { width: auto; min-width: 90px; min-height: 36px; }
.checks-list { list-style: none; padding: 0; margin: 0; }

/* assistant */
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.assistant-btn { text-decoration: none; display: inline-flex; align-items: center; }
.ctx-chip { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.chat { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.bubble { border-radius: var(--radius); padding: .75rem 1rem; border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble p { margin: 0 0 .5rem; }
.bubble-user { background: var(--info-bg); margin-inline-start: 15%; }
.bubble-ai { background: var(--surface); margin-inline-end: 5%; }
.sources code { font-size: .75rem; color: var(--muted); }
.save-as { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.save-as select { width: auto; flex: 1 1 10rem; }
.ask-box textarea { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.inline-form { display: inline; margin: 0; }
.shortcuts { border-top: 1px solid var(--line); padding-top: .5rem; }
.attach-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.attach-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; padding: .5rem 0;
  border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.attach-form { margin-top: .75rem; }
.link-plain { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }

/* ================================================================ design system v2 (2026-11-15)
   One page pattern: header (title + actions) -> filters -> view switch -> list / cards / board. */
@media (min-width: 900px) { .content { max-width: 1240px; } }
.content > h1:first-child { margin-top: 0; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem 1rem;
  margin-bottom: 1rem; }
.page-title h1 { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.page-title p { margin: .2rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }

.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.view-switch a { padding: .35rem .9rem; font-size: .85rem; text-decoration: none; color: var(--muted); min-height: 36px;
  display: inline-flex; align-items: center; }
.view-switch a + a { border-inline-start: 1px solid var(--line); }
.view-switch a.on { background: var(--primary); color: var(--primary-text); font-weight: 600; }

/* list view: a real table on wide screens, stacked rows on phones */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .93rem; }
.data-table th { text-align: start; font-weight: 600; color: var(--muted); font-size: .8rem; background: var(--bg);
  padding: .6rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--info-bg) 55%, transparent); }
.data-table .t-main { font-weight: 600; color: var(--text); text-decoration: none; }
.data-table .t-main:hover { text-decoration: underline; }
.data-table .t-sub { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; }
.data-table .t-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 699px) {
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { padding: .1rem 0; border: 0; }
  .data-table td.t-num { text-align: start; }
  .data-table .hide-sm { display: none; }
}

/* cards view */
.card-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card-grid > li { margin: 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .4rem; height: 100%; }
.tile:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.tile-title { font-weight: 700; color: var(--text); text-decoration: none; line-height: 1.35; }
.tile-title:hover { text-decoration: underline; }
.tile-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding-top: .4rem; border-top: 1px dashed var(--line); font-size: .88rem; }

/* number tiles (Today, pipeline) */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.25rem; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem;
  text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .15rem; }
a.kpi:hover { border-color: var(--primary); }
.kpi .k-label { color: var(--muted); font-size: .8rem; }
.kpi .k-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .k-sub { color: var(--muted); font-size: .78rem; }
.kpi.alert .k-value { color: var(--error); }
.kpi.good .k-value { color: var(--ok); }

/* two columns on wide screens: main + side */
.split { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.split > * > .card:last-child { margin-bottom: 0; }

/* kanban board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .75rem; overflow-x: auto;
  padding-bottom: .5rem; align-items: start; scroll-snap-type: x proximity; }
.board-col { background: color-mix(in srgb, var(--line) 35%, var(--bg)); border-radius: var(--radius); padding: .6rem;
  min-height: 160px; scroll-snap-align: start; }
.board-col.drop { outline: 2px dashed var(--primary); outline-offset: -2px; }
.board-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .1rem .2rem .55rem; }
.board-col-head h2 { margin: 0; font-size: .95rem; }
.board-col-head .num { color: var(--muted); font-size: .8rem; }
.board-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; min-height: 40px; }
.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem;
  display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.board-card[draggable="true"] { cursor: grab; }
.board-card.dragging { opacity: .5; }
.board-card .move-form { display: flex; gap: .35rem; align-items: center; margin-top: .2rem; }
.board-card .move-form select { min-height: 32px; padding: .15rem .4rem; font-size: .85rem; }
.board-card .move-form .btn { min-height: 32px; padding: .1rem .6rem; font-size: .8rem; }
.js .board-card .move-form .btn { display: none; }

/* stage colours: one hue per step, quiet */
.stage-lead { background: color-mix(in srgb, #64748b 14%, transparent); }
.stage-qualified { background: color-mix(in srgb, #0ea5e9 16%, transparent); }
.stage-meeting { background: color-mix(in srgb, #8b5cf6 16%, transparent); }
.stage-proposal { background: color-mix(in srgb, #f59e0b 20%, transparent); }
.stage-negotiation { background: color-mix(in srgb, #ea580c 18%, transparent); }
.stage { border-color: transparent; white-space: nowrap; }

/* stage stepper on the opportunity page */
.stepper { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; gap: .25rem; overflow-x: auto; }
.stepper li { flex: 1 1 0; min-width: 72px; text-align: center; font-size: .78rem; color: var(--muted);
  padding-top: .45rem; border-top: 4px solid var(--line); }
.stepper li.done { border-top-color: color-mix(in srgb, var(--primary) 45%, var(--line)); color: var(--text); }
.stepper li.now { border-top-color: var(--primary); color: var(--primary); font-weight: 700; }
.stepper.won li { border-top-color: var(--ok); }
.stepper.lost li.now { border-top-color: var(--error); color: var(--error); }

.empty-state { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.1rem; text-align: center;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.empty-state p { margin: 0; }
.quiet-line { color: var(--muted); font-size: .9rem; margin: .25rem 0 1rem; }
.section-block { margin-bottom: 1.5rem; }
.section-block > h2 { font-size: 1.05rem; margin: 0 0 .6rem; display: flex; align-items: baseline; gap: .4rem; }
/* board v2.1: five stage columns fit a laptop screen; Won / Lost are narrow drop zones */
.board { display: flex; gap: .6rem; }
.board-col { flex: 1 0 200px; }
.board-end { flex: 0 0 130px; min-height: 120px; }
.board-card .item-head { flex-wrap: wrap; gap: .25rem .5rem; align-items: center; }
.board-card .due { font-size: .78rem; }
@media (max-width: 699px) {
  .board-col { flex-basis: 78vw; }
  .data-table td:not(:first-child) { display: inline-block; width: auto; margin-inline-end: .6rem; margin-top: .25rem; }
}
.board-col { flex: 1 0 172px; }
.board-end { flex: 0 0 108px; }
.board-col-head { flex-wrap: wrap; }
.board-col-head h2 { white-space: nowrap; }
@media (max-width: 699px) { .data-table td.hide-sm { display: none; } .board-col { flex-basis: 78vw; } }

/* follow-up rows (Today and Follow-ups): who + deal, action under it, date on the side */
.fu-list { list-style: none; margin: 0; padding: 0; }
.fu { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; align-items: start;
  padding: .7rem 0; border-bottom: 1px solid var(--line); }
.fu:last-child { border-bottom: 0; }
.fu-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; }
.fu-party { font-weight: 700; color: var(--text); text-decoration: none; }
.fu-party:hover { text-decoration: underline; color: var(--primary); }
.fu-deal { color: var(--muted); font-size: .85rem; }
.fu-action { margin: .2rem 0 0; color: var(--text); font-size: .92rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fu-side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.fu-buttons { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.fu .due { font-size: .8rem; }
@media (max-width: 599px) {
  .fu { grid-template-columns: 1fr; }
  .fu-side { flex-direction: row; align-items: center; justify-content: space-between; }
}
.checks-inline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }

/* multi-choice dropdown: one closed line showing the choices, a compact scrollable list when open */
.field > .label { display: block; font-weight: 600; margin-bottom: .3rem; }
.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; min-height: 44px; padding: .55rem .75rem; padding-inline-end: 2rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after { content: "▾"; position: absolute; inset-inline-end: .75rem; top: .7rem; color: var(--muted); }
.multi[open] > summary { border-color: var(--primary); }
.multi-panel { position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.multi-head { margin: .4rem 0 .15rem; font-size: .78rem; font-weight: 700; color: var(--muted); }
.multi-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .25rem; border-radius: 6px; cursor: pointer;
  font-size: .92rem; font-weight: 400; }
.multi-item:hover { background: var(--bg); }
.multi-item input { width: 18px; height: 18px; flex: 0 0 auto; }
.field .multi-item { display: flex; font-weight: 400; margin: 0; padding: .28rem .3rem; min-height: 0; line-height: 1.4; }
.checks-inline .check { min-height: 36px; }

/* Ledger (phase 9b) */
.amt-in { color: var(--ok); }
.amt-out { color: var(--error); }
.num.big { font-size: 1.5rem; font-weight: 700; }
.nowrap { white-space: nowrap; }
.data-table tfoot th { border-top: 2px solid var(--line); }
[hidden] { display: none !important; }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }

/* Marketing calendar (phase 10) */
.mk-ai { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }
.mk-month { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: .5rem 0; }
.mk-month h2 { margin: 0; font-size: 1.15rem; min-width: 9rem; text-align: center; }
.mk-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.mk-wd { padding: .4rem; font-size: .8rem; font-weight: 600; text-align: center; border-bottom: 1px solid var(--line); }
.mk-day { min-height: 7rem; padding: .3rem; border-inline-start: 1px solid var(--line); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.mk-day.out { opacity: .45; }
.mk-day.today .mk-num { background: var(--primary); color: var(--primary-text); border-radius: 999px; padding: 0 .4rem; }
.mk-day-head { display: flex; justify-content: space-between; align-items: center; }
.mk-num { font-size: .85rem; font-weight: 600; }
.mk-add { text-decoration: none; opacity: .35; font-weight: 700; padding: 0 .3rem; }
.mk-day:hover .mk-add, .mk-add:focus { opacity: 1; }
.mk-chip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .78rem; line-height: 1.35; padding: .2rem .4rem; border-radius: 6px; text-decoration: none; overflow: hidden; border: 0; border-inline-start: 3px solid; }
.mk-chip.mk-post { background: var(--info-bg); border-color: var(--primary); color: inherit; }
.mk-chip.mk-ad { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: var(--warn); color: inherit; }
.mk-chip.mk-st-published { opacity: .6; text-decoration: line-through; }
.mk-chip.mk-st-idea, .mk-chip.mk-st-draft { border-inline-start-style: dashed; background: transparent; outline: 1px dashed var(--line); }
.mk-plat { font-weight: 700; font-size: .7rem; opacity: .8; display: block; }
.mk-legend { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.mk-legend .mk-chip { display: inline-block; }
.mk-agenda .mk-chip { -webkit-line-clamp: unset; }
.mk-agenda { display: none; list-style: none; padding: 0; margin: 0; }
.mk-agenda li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; }
.mk-agenda-day { font-weight: 700; font-size: .9rem; }
.mk-agenda-day.today { color: var(--primary); }
.mk-agenda .mk-chip { white-space: normal; }
@media (max-width: 760px) { .mk-cal { display: none; } .mk-agenda { display: block; } }
.mk-stage-idea { background: var(--info-bg); } .mk-stage-approved, .mk-stage-scheduled { background: var(--ok-bg); } .mk-stage-published { background: var(--ok-bg); font-weight: 700; } .mk-stage-dropped { opacity: .6; }
.mk-ai-form { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.mk-ai-form select { max-width: 12rem; }
.mk-draft { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; display: flex; flex-direction: column; gap: .35rem; }
.mk-pick { list-style: none; padding: 0; margin: 0 0 .75rem; display: flex; flex-direction: column; gap: .5rem; }
.mk-pick .item-sub { display: block; }
.mk-answer { margin-bottom: 1rem; }
.mk-search { width: 100%; margin-bottom: .35rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit; font: inherit; font-size: .9rem; }
.mk-sec { font-size: .68rem; font-weight: 700; padding: 0 .3rem; border-radius: 4px; background: var(--line); }
.mk-ai-form { flex-wrap: nowrap; }
.mk-ai-form select { max-width: 9.5rem; }
@media (max-width: 760px) { .mk-ai-form { flex-wrap: wrap; } }

/* Daily tasks */
.tk-quick { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.tk-quick input[type=text] { flex: 1 1 18rem; }
.tk-group { margin-bottom: .75rem; }
.tk-group h2.tk-late { color: var(--error); }
.tk-list { list-style: none; padding: 0; margin: 0; }
.tk-row { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.tk-row:first-child { border-top: 0; }
.tk-check { margin: 0; }
.tk-box { width: 1.4rem; height: 1.4rem; border: 2px solid var(--muted); border-radius: 50%; background: transparent; color: var(--primary-text); font-size: .8rem; line-height: 1; cursor: pointer; padding: 0; display: grid; place-items: center; }
.tk-box:hover { border-color: var(--primary); }
.tk-closed .tk-box { background: var(--primary); border-color: var(--primary); }
.tk-closed .tk-title { text-decoration: line-through; opacity: .6; }
.tk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.tk-title { font-weight: 600; text-decoration: none; color: inherit; }
.tk-meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; color: var(--muted); align-items: center; }
.tk-pri { font-size: .72rem; font-weight: 700; padding: 0 .4rem; border-radius: 999px; }
.tk-pri-urgent { background: var(--error-bg); color: var(--error); }
.tk-pri-high { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.board-card.tk-urgent { border-inline-start: 3px solid var(--error); }
.board-card.tk-high { border-inline-start: 3px solid var(--warn); }
.tk-quick > * { width: auto; margin: 0; }
.tk-quick input[type=text] { flex: 1 1 16rem; min-width: 0; }
.tk-quick input[type=date] { flex: 0 0 11rem; }
.tk-quick select { flex: 0 0 8rem; }
.tk-filters { display: contents; }
.tk-filters > summary { list-style: none; cursor: pointer; }
.tk-filters > summary::-webkit-details-marker { display: none; }
.tk-filters[open] .tk-filter-grid { display: flex; flex-wrap: wrap; gap: .5rem; flex-basis: 100%; order: 10; }
.tk-filter-grid > select { flex: 1 1 10rem; }
@media (max-width: 760px) { .tk-quick input[type=date], .tk-quick select { flex: 1 1 40%; } }

/* accounts register */
.badge-warn { background: var(--error-bg); color: var(--warn); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.acc-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.acc-foot { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .6rem 0 1.25rem; }
.acc-foot form { margin: 0; }
.acc-login { overflow-wrap: anywhere; }
html:not(.js) [data-copy] { display: none; }  /* copy buttons need the script */
.acc-help { margin-top: .5rem; } .acc-help summary { cursor: pointer; font-weight: 600; } .acc-help ol { margin: .5rem 0 0; padding-inline-start: 1.2rem; } .acc-help li { margin-bottom: .3rem; }
.opp-customer { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; }
.opp-customer legend { font-weight: 700; padding: 0 .3rem; }
.opp-search { width: 100%; margin: .5rem 0; }
.pr-reason { margin: .5rem 0 .3rem; }
.pr-signals { margin: .2rem 0 .4rem; padding-inline-start: 1.1rem; font-size: .88rem; color: var(--muted); }
.pr-signals li { margin-bottom: .2rem; }
.pr-convert { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pr-convert select { flex: 1 1 10rem; min-width: 0; width: auto; max-width: 100%; min-height: 38px; text-overflow: ellipsis; }
.pr-convert .btn { flex: 0 0 auto; min-height: 38px; }
/* prospect cards (owner 2026-11-26): service + convert on one line, the other two quiet under it, at the card's foot */
.pr-card { min-width: 0; overflow-wrap: anywhere; }
.pr-actions { margin-top: auto; padding-top: .7rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .35rem; }
.pr-actions .pr-convert { flex-wrap: nowrap; }
.pr-more { display: flex; gap: .2rem; justify-content: flex-end; flex-wrap: wrap; }
.pr-more form { margin: 0; }

/* ---------- clean layout: tabs, compact rows, quieter sections ---------- */
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 0 1rem;
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: .6rem .9rem; color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 999px; background: var(--bar-bg, var(--line));
  color: var(--muted); font-size: .75rem; text-align: center; margin-inline-start: .15rem; }
.tabs a.on .tab-count { background: var(--primary); color: var(--primary-text); }
html:not(.js) .tab-panel { margin-bottom: 1.5rem; }  /* without the script: every panel, one under the other */
.tab-panel > .card { box-shadow: none; }
.sub-title { font-size: .95rem; margin: 1.1rem 0 .4rem; color: var(--muted); font-weight: 600; }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.next-step .k-label { display: block; color: var(--muted); font-size: .8rem; }
.row-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .2rem; border-bottom: 1px solid var(--line); }
.row-item form { margin: 0; display: flex; }
.row-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.row-item.is-done .row-title { color: var(--muted); text-decoration: line-through; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; padding: 0;
  cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; }
.tick:hover { border-color: var(--primary); background: var(--ok-bg); }
.tick.done { border-color: var(--ok); color: var(--ok); cursor: default; }
.inline-details { margin: .6rem 0; }
.inline-details > summary { cursor: pointer; color: var(--primary); font-weight: 600; list-style: none; }
.inline-details > summary::before { content: "+ "; }
.inline-details[open] > summary { margin-bottom: .6rem; }
.log-box[open] { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-panel { position: absolute; inset-inline-end: 0; top: calc(100% + .3rem); z-index: 20; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 9rem; }
.more-panel .btn { width: 100%; }
.btn-block { width: 100%; justify-content: center; }
.link-list { display: flex; flex-direction: column; gap: .15rem; margin-top: .4rem; }
.link-list form { margin: 0; }
.link-btn-plain { background: none; border: 0; padding: .35rem 0; color: var(--primary); font: inherit; cursor: pointer;
  text-align: start; width: 100%; }
.link-btn-plain:hover { text-decoration: underline; }
.split > * { min-width: 0; }  /* a wide child (tabs, tables) scrolls inside, never widens the page */
.kpis-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (min-width: 900px) { .kpis-4 { grid-template-columns: repeat(4, 1fr); } }
.see-all { font-size: .85rem; font-weight: 600; text-decoration: none; }
.see-all::after { content: " ←"; }
[dir="ltr"] .see-all::after { content: " →"; }
.all-clear { padding: .8rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.more-wide { min-width: 16rem; }
.more-wide input { width: 100%; margin-bottom: .4rem; }
.form-section { border: 0; padding: 0; margin: 0 0 1rem; }
.form-section > legend { font-weight: 700; font-size: .95rem; color: var(--muted); padding: 0; margin-bottom: .5rem;
  border-bottom: 1px solid var(--line); width: 100%; padding-bottom: .3rem; }
@media (min-width: 700px) {
  .filters { display: flex; flex-wrap: wrap; align-items: center; }
  .filters > input[type=search], .filters > input[type=text] { flex: 2 1 220px; }
  .filters > select, .filters > details { flex: 1 1 160px; }
  .filters > .btn, .filters > button { flex: 0 0 auto; }
  .filters > label.check { flex: 0 0 auto; }
}
.code-input { font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; max-width: 12rem; font-variant-numeric: tabular-nums; }
.steps-list { padding-inline-start: 1.2rem; } .steps-list > li { margin-bottom: 1.2rem; }
.setup-key code { font-size: 1.05rem; letter-spacing: .05em; user-select: all; }
.recovery-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 12rem)); gap: .4rem; }
.recovery-codes code { font-size: 1.05rem; }
.amount-row { display: grid; grid-template-columns: 7.5rem minmax(8rem, 12rem) minmax(8rem, 12rem); gap: .75rem; align-items: start; justify-content: start; padding: .6rem .75rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.amount-row .field { margin-bottom: 0; }
@media (max-width: 600px) { .amount-row { grid-template-columns: 1fr 1fr; } .amount-row > .field:first-child { grid-column: 1 / -1; } }
.fx-recalc { width: auto; display: inline; margin-inline-start: .5rem; font-size: .85rem; }
form.filters.is-live > button[type=submit], form.filters.is-live .tk-filter-grid > button[type=submit] { display: none; }
.tile-person { margin-top: .5rem; padding-top: .45rem; border-top: 1px dashed var(--line); font-size: .9rem; overflow-wrap: anywhere; }
.tile-person a { text-decoration: none; }

/* A phone number anywhere: the number (call) + a small WhatsApp icon (opens a chat; the person sends) */
.phone { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.phone > a[href^="tel:"] { unicode-bidi: isolate; }
.wa-link { display: inline-flex; align-items: center; color: #1fa855; line-height: 1; padding: .1rem; border-radius: 4px; }
.wa-link:hover, .wa-link:focus-visible { color: #128c43; background: rgba(31, 168, 85, .12); }
.mail-link { display: inline-flex; align-items: center; color: #1d5fd1; line-height: 1; padding: .1rem; border-radius: 4px; vertical-align: middle; }
.mail-link:hover, .mail-link:focus-visible { background: rgba(37, 99, 235, .12); }

/* Tasks (owner 2026-11-18): type pills, day/time on one line, a quiet "more" section */
.tk-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.tk-types { display: flex; flex-wrap: wrap; gap: .4rem; }
.tk-type { position: relative; cursor: pointer; }
.tk-type input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tk-type span { display: inline-flex; align-items: center; gap: .3rem; min-height: 38px; padding: .3rem .85rem;
  border: 1px solid var(--line); border-radius: 999px; font-size: .92rem; background: var(--surface); }
.tk-type input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, transparent);
  font-weight: 700; }
.tk-type input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.tk-when { display: flex; flex-wrap: wrap; gap: .75rem; }
.tk-when .field { flex: 1 1 150px; max-width: 220px; }
.tk-cust { margin-bottom: .5rem; }
.tk-more { margin: .5rem 0 1rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.tk-more > summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .4rem 0; }
.tk-icon { display: inline-block; min-width: 1.4em; text-align: center; }
.tk-time { font-variant-numeric: tabular-nums; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.tk-cal { text-decoration: none; opacity: .7; }
.tk-cal:hover, .tk-cal:focus-visible { opacity: 1; }
.tk-quick select[name="type_id"] { max-width: 150px; }

/* Customer login password (D-42) */
.pw-reveal { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-inline-start: .4rem; }
.pw-confirm { display: inline-flex; gap: .3rem; align-items: center; }
.pw-confirm input { width: 200px; min-height: 34px; }
.pw-value { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .2rem .5rem;
  font-size: .95rem; user-select: all; unicode-bidi: isolate; }
.pw-input { display: flex; gap: .4rem; align-items: center; }
.pw-input input { flex: 1; }
.acc-pw { border-top: 1px solid var(--line); padding-top: .75rem; }
.acc-linked p { margin: .2rem 0; }
.acc-pw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: -.25rem 0 .5rem; }
.acc-pw-tools .pw-reveal { margin-inline-start: 0; }
.acc-help { margin: 0 0 .75rem; }

/* Opportunity side panel (owner 2026-11-19): numbers first, short grouped rows, compact services */
.opp-side { padding: 1rem 1.1rem; }
.os-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .4rem; }
.os-num { background: var(--bg); border-radius: 10px; padding: .65rem .8rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.os-label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.os-big { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.os-empty { font-size: .85rem; font-weight: 600; }
.os-bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 5px; border: 0;
  border-radius: 99px; background: var(--line); overflow: hidden; margin-top: .25rem; }
.os-bar::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
.os-bar::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.os-bar::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.os-head { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0;
  margin: 1rem 0 .35rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.os-row { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .28rem 0; font-size: .9rem; }
.os-k { color: var(--muted); flex: 0 1 auto; }
.os-v { font-weight: 600; text-align: end; min-width: 0; overflow-wrap: anywhere; }
.os-services { list-style: none; padding: 0; margin: .35rem 0 0; display: flex; flex-direction: column; gap: .3rem; }
.os-services li { font-size: .82rem; line-height: 1.35; padding: .35rem .55rem; border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 9%, transparent); border-inline-start: 3px solid var(--primary); }
.os-services li.muted { background: none; border: 0; padding-inline: 0; color: var(--muted); }
.os-note { font-size: .82rem; color: var(--muted); margin: 0 0 .25rem; }
.os-notes { margin-top: .9rem; background: var(--bg); border-radius: 10px; padding: .6rem .75rem; }
.os-notes p { margin: .2rem 0 0; font-size: .88rem; }
.os-stage { margin-top: 1rem; }
.os-stage > summary { list-style: none; text-align: center; }
.os-stage > summary::-webkit-details-marker { display: none; }
.os-stage[open] > summary { margin-bottom: .75rem; }
.os-stage > summary::before { content: none; }

/* Forms everywhere (owner 2026-11-19): a fieldset never grows past its card; one look for every select
   (Safari draws its own thin one otherwise); no number spinners */
fieldset { min-width: 0; }
.form-section { min-width: 0; max-width: 100%; }
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-inline-end: 2.2rem; line-height: 1.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2356655c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px 8px; background-position: left .8rem center;
}
[dir="ltr"] select:not([multiple]):not([size]), html[dir="ltr"] select:not([multiple]):not([size]) { background-position: right .8rem center; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.multi > summary { line-height: 1.6; }
.opp-form { max-width: 760px; margin-inline: auto; }
.multi > summary::after { content: ""; top: 50%; width: 12px; height: 8px; margin-top: -4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2356655c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px; }
.multi > summary { padding-inline-end: 2.2rem; }

/* Partners (owner 2026-11-19) */
.grid-3 { display: grid; gap: 0 1rem; }
@media (min-width: 700px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.pt-services { display: flex; flex-wrap: wrap; gap: .3rem; margin: .45rem 0; }
.pt-services .chip { font-size: .8rem; }
.pt-summary { font-size: .88rem; color: var(--muted); margin: .4rem 0; }
.pt-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .85rem; }
.pt-profile { display: grid; gap: 1rem; }
@media (min-width: 900px) { .pt-profile { grid-template-columns: 2fr 1fr; } }
.pt-block h3 { font-size: .8rem; color: var(--muted); font-weight: 700; margin: 0 0 .35rem; }
.pt-block p { margin: 0 0 .9rem; }
.pt-terms { background: var(--bg); border-radius: 10px; padding: .7rem .85rem; }

/* Website and social accounts (owner 2026-11-19): a closed section in forms; small icons on pages */
.social-box { margin: .25rem 0 1rem; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; }
.social-box > summary { cursor: pointer; font-weight: 600; color: var(--primary); list-style: none; }
.social-box > summary::-webkit-details-marker { display: none; }
.social-box > summary::before { content: "＋ "; }
.social-box[open] > summary::before { content: "－ "; }
.social-box[open] > summary { margin-bottom: .5rem; }
.soc-row { display: inline-flex; flex-wrap: wrap; gap: .3rem; vertical-align: middle; }
.soc { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem;
  border-radius: 6px; font-size: .72rem; font-weight: 800; text-decoration: none; color: #fff; background: #5b6770; line-height: 1; }
label .soc { min-width: 1.35rem; height: 1.35rem; font-size: .65rem; margin-inline-end: .2rem; }
.soc-website { background: var(--primary); }
.soc-linkedin { background: #0a66c2; }
.soc-instagram { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.soc-x { background: #111; }
.soc-facebook { background: #1877f2; }
.soc-tiktok { background: #010101; }
.soc-snapchat { background: #fffc00; color: #111; }
a.soc:hover, a.soc:focus-visible { filter: brightness(1.12); }

/* Services (owner 2026-11-19): catalogue with sector chips, live search, prices inside each service */
.crumbs { margin: 0 0 .6rem; font-size: .9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.sv-sectors a .count { opacity: .7; font-size: .8rem; margin-inline-start: .2rem; }
.sv-hint { font-size: .9rem; color: var(--muted); margin: 0 0 .9rem; }
.sv-tile { display: flex; flex-direction: column; }
.sv-tile.is-off { opacity: .65; }
.sv-tile .item-sub { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .35rem; }
.sv-desc { font-size: .88rem; color: var(--muted); margin: .5rem 0 0; line-height: 1.6; }
.sv-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .85rem; }
.sv-stats { display: flex; gap: .7rem; color: var(--muted); }
.sv-page { display: grid; gap: 1rem; align-items: start; }
.sv-page fieldset { min-width: 0; }
@media (min-width: 1000px) { .sv-page { grid-template-columns: minmax(0, 1fr) 360px; } }
.sv-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.sv-head h1 { margin: 0; }
.sv-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.sv-side .section-title { margin-top: 0; }
.sv-prices { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-direction: column; gap: .6rem; }
.sv-pkg { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; }
.sv-pkg.is-off { border-style: dashed; }
.sv-pkg-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.sv-pkg-head a { text-decoration: none; color: var(--text); }
.sv-includes { white-space: pre-line; font-size: .86rem; color: var(--muted); margin: .4rem 0 0; line-height: 1.6; }
.sv-pkg-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.sv-pkg-foot form { margin-inline-start: auto; }
.sv-tile .tile-head .badge { white-space: nowrap; flex: 0 0 auto; }

/* Content plans (owner 2026-11-19) */
.cp-form fieldset { min-width: 0; }
.cp-step { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: var(--primary); color: var(--primary-text); font-size: .8rem; margin-inline-end: .3rem; }
.cp-checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.cp-progress { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.cp-progress progress { flex: 1 1 auto; max-width: 260px; height: .5rem; accent-color: var(--primary); }
.cp-tile.is-past { opacity: .7; }
.cp-head .tile-head h1 { margin: 0; }
.cp-head-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.cp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem 1rem; margin: .8rem 0 .4rem; }
.cp-facts dt { font-size: .8rem; color: var(--muted); }
.cp-facts dd { margin: 0; font-weight: 600; }
.cp-wait { padding: 1rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.cp-rows { display: flex; flex-direction: column; gap: .8rem; }
.cp-row { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; display: grid; gap: .5rem; min-width: 0; }
.cp-topic:has(.cp-pick input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cp-pick { display: flex; align-items: center; gap: .4rem; }
.cp-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .4rem; }
.cp-meta > * { min-width: 0; }
.cp-title { font-weight: 600; }
.cp-row textarea, .cp-row input[type=text] { width: 100%; }
.cp-more summary { cursor: pointer; font-size: .9rem; color: var(--primary); }
.cp-more { display: grid; gap: .3rem; }
.mk-prompt-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .3rem; }
.cp-save { position: sticky; bottom: 0; background: var(--surface); padding: .6rem 0; }
.cp-more-form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.cp-more-form input[type=text] { flex: 2 1 260px; }
.cp-more-form select { flex: 0 1 180px; }
.cp-topic .cp-pick { align-items: flex-start; }
.cp-topic .cp-pick input[type=text] { flex: 1 1 auto; }
.cp-vgrid { display: grid; gap: .6rem; }
@media (min-width: 1100px) { .cp-vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cp-version { display: flex; flex-direction: column; gap: .3rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; min-width: 0; }
.cp-version:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cp-vhead { font-weight: 600; display: flex; gap: .4rem; align-items: center; }
.cp-version textarea { width: 100%; }
.cp-save-row { margin-top: .5rem; }
.cp-topic-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.cp-topic-tools .cp-more-form { margin-top: 0; flex: 1 1 320px; }
.cp-caps { display: grid; gap: .6rem; }
@media (min-width: 1000px) { .cp-caps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cp-cap { min-width: 0; margin: 0; }
.cp-cap textarea { width: 100%; }
.cp-chosen { background: var(--surface-2, transparent); border-inline-start: 3px solid var(--primary); padding: .4rem .7rem; margin: .4rem 0; }
.cp-save-row input[type=text] { flex: 2 1 260px; }
.soc-youtube { background: #ff0000; }
.soc-whatsapp { background: #25d366; }
.cp-platforms { border: 0; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-width: 0; }
.cp-platforms legend { float: inline-start; font-size: .9rem; color: var(--muted); margin-inline-end: .4rem; padding: 0; }
.pf-toggle { position: relative; display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .6rem .25rem .3rem; cursor: pointer; font-size: .88rem; }
.pf-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pf-toggle:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pf-toggle:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.pf-toggle:not(:has(input:checked)) .soc { filter: grayscale(1); opacity: .55; }

/* Message templates (owner 2026-11-21) */
.mt-tile .mt-subject { font-weight: 600; margin: .4rem 0 0; font-size: .9rem; }
.mt-tile .mt-body { white-space: pre-line; font-size: .88rem; color: var(--muted); margin: .4rem 0 0; line-height: 1.6; }
.mt-form { max-width: 820px; }
.mt-fields { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .4rem; }
.mt-field { cursor: pointer; font-size: .8rem; background: var(--surface); }
.mp-dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 1rem; }
.mp-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.mp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .6rem; }
.mp-search { width: 100%; margin-bottom: .5rem; }
.mp-list ul { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .4rem;
  max-height: 55vh; overflow-y: auto; }
.mp-choice { width: 100%; text-align: start; display: flex; flex-direction: column; gap: .15rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.mp-choice:hover, .mp-choice:focus-visible { border-color: var(--primary); }
.mp-name { font-weight: 600; }
.mp-preview { font-size: .85rem; color: var(--muted); }
.mp-edit { display: flex; flex-direction: column; gap: .5rem; }
.mp-edit textarea, .mp-edit input[type=text] { width: 100%; }
.mp-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.mp-loading { text-align: center; color: var(--muted); }
.mp-log, .mp-done { display: flex; flex-direction: column; gap: .5rem; }
.mp-log input { width: 100%; }
.mp-log[hidden], .mp-done[hidden] { display: none; }
.mt-ai { border: 1px dashed var(--line); border-radius: var(--radius); padding: .6rem .8rem; margin: .6rem 0; display: grid; gap: .5rem; }
.mt-ai summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.mt-ai textarea { width: 100%; }

/* ---------------------------------------------------------------- assistant side panel (owner 2026-11-21) */
.aip-bubble {
  position: fixed; inset-inline-end: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 40;
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1;
  background: var(--primary); color: var(--primary-text); box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}
.has-nav .aip-bubble { bottom: calc(var(--nav-h) + .75rem + env(safe-area-inset-bottom)); }
.aip-bubble:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.aip-on .aip-bubble { display: none; }
.aip {
  position: fixed; z-index: 45; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); border-inline-start: 1px solid var(--line); box-shadow: 0 0 24px rgba(0, 0, 0, .18);
}
.aip[hidden] { display: none; }
@media (min-width: 900px) {
  .aip { top: 52px; bottom: 0; inset-inline-start: auto; inset-inline-end: 0; width: 400px; }
  .has-nav .aip-bubble { bottom: 1.25rem; }
  .aip-on .content { margin-inline-end: 400px; }
}
.aip-body { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.aip-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .8rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.aip-head-actions { display: flex; align-items: center; gap: .35rem; }
.aip-close { border: 0; background: none; font-size: 1.15rem; cursor: pointer; color: var(--muted); padding: .25rem .5rem; }
.aip-ctx { margin: 0; padding: .4rem .8rem; font-size: .85rem; background: var(--info-bg); color: var(--text); }
.aip-thread { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.aip-thread .bubble { padding: .55rem .75rem; font-size: .95rem; }
.aip-thread .bubble p:last-child { margin-bottom: 0; }
.aip-thread .bubble-user { margin-inline-start: 12%; }
.aip-thread .bubble-ai { margin-inline-end: 0; }
.aip-wait::after { content: " ⏳"; }
.aip-try { display: flex; flex-wrap: wrap; gap: .4rem; }
.aip-try .chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: .85rem; }
.aip-card {
  display: flex; flex-direction: column; gap: .4rem; padding: .6rem .7rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand);
}
.aip-card p { margin: 0; }
.aip-card-title { font-weight: 600; }
.aip-card input[type=text], .aip-card textarea, .aip-card select { width: 100%; font: inherit; }
.aip-row { display: flex; gap: .4rem; align-items: center; }
.aip-row input[type=date] { flex: 0 0 auto; width: auto; }
.aip-card-actions { display: flex; gap: .4rem; }
.aip-card-applied { border-inline-start-color: var(--ok); background: var(--ok-bg); }
.aip-card-rejected, .aip-card-expired { opacity: .7; border-inline-start-color: var(--line); }
.aip-done { color: var(--ok); font-weight: 600; }
/* D-52: the steps of an operations card */
.ops-steps { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .5rem; }
.ops-step-title { font-weight: 600; }
.ops-danger .ops-step-title { color: var(--error); }
.ops-rows { display: grid; grid-template-columns: minmax(6rem, max-content) 1fr; gap: .25rem .5rem; margin: .25rem 0 0; }
.ops-rows dt { color: var(--muted); }
.ops-rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ops-rows dd input, .ops-rows dd select, .ops-rows dd textarea { width: 100%; font: inherit; }
.ops-before { text-decoration: line-through; color: var(--muted); }
.aip-ask { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .6rem .75rem; background: var(--surface); border-top: 1px solid var(--line); }
/* the writing box takes the whole width and grows with the text (app.js); the buttons sit under it */
.aip-ask textarea { flex: 1 0 100%; box-sizing: border-box; resize: vertical; min-height: 6.5rem; max-height: min(55vh, 26rem); font: inherit; line-height: 1.6; padding: .55rem .7rem; }
.aip-ask .aip-hint { flex: 1; margin: 0; }
.aip-ask button[type=submit] { margin-inline-start: auto; }
.ask-box textarea { min-height: 8rem; max-height: 60vh; resize: vertical; line-height: 1.6; }
.aip-attach { cursor: pointer; white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.aip .flash { margin: .4rem .75rem; }
.aip-loading { padding: 1rem; }

p.warn { color: var(--warn); }

/* a task's people (D-48): beside the form on a wide screen, under it on a phone */
.tk-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 760px) minmax(260px, 340px); align-items: start; }
.tk-layout .tk-form { max-width: none !important; }
.tk-people { position: sticky; top: 1rem; }
.tk-people h2 { font-size: 1rem; margin: 0 0 .6rem; }
.tk-people p { margin: .2rem 0; }
.tk-p-name { font-weight: 600; }
.tk-p-company { padding-bottom: .6rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line, #e5e5e5); }
.tk-p-list { list-style: none; margin: 0; padding: 0; }
.tk-p-list li { padding: .5rem 0; border-bottom: 1px solid var(--line, #e5e5e5); }
.tk-p-list li:last-child { border-bottom: 0; }
.tk-p-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem !important; }
@media (max-width: 980px) { .tk-layout { grid-template-columns: minmax(0, 1fr); } .tk-people { position: static; } }

/* D-50: the assistant is still working on the same customer */
.aip-busy { grid-column: 1 / -1; border: 1px solid var(--warn); border-radius: 8px; padding: .6rem .75rem; margin-bottom: .6rem; background: var(--surface); }
.aip-busy p { margin: .2rem 0; } .aip-busy ul { margin: .3rem 0; padding-inline-start: 1.1rem; }
.aip-busy-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.aip-ask:has(.aip-busy) { flex-wrap: wrap; } .aip-ask .aip-busy { flex: 1 0 100%; }

/* D-51: won with a recurring service, no subscription */
.sub-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.sub-nudge-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.fu-side form.inline { display: inline; }

/* users: job templates tick a job's sections */
.job-templates { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.job-templates .help { flex-basis: 100%; margin: 0; }

/* One "Today" tab (owner 2026-11-25): a segmented switch between today, my tasks and all tasks */
.day-tabs { display: inline-flex; gap: .25rem; padding: .25rem; margin: 0 0 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.day-tabs a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; min-height: 38px;
  padding: .3rem 1rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600;
  transition: background .15s, color .15s; }
.day-tabs a:hover { color: var(--text); }
.day-tabs a.on { background: var(--primary); color: var(--primary-text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.day-tabs .count { font-size: .8rem; font-weight: 600; padding: 0 .45rem; border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent); }
@media (max-width: 600px) { .day-tabs { display: flex; } .day-tabs a { flex: 1 0 auto; justify-content: center; padding: .3rem .7rem; } }
.card > .tk-quick { margin-top: .25rem; }
.wa-sort > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.wa-sort > summary::-webkit-details-marker { display: none; }
.wa-sort > summary::after { content: "▾"; margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
.wa-sort[open] > summary::after { transform: rotate(180deg); }
.wa-sum-title { font-weight: 700; font-size: 1.05rem; }
.wa-pills { display: flex; gap: .3rem; }
.wa-group { border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .5rem; }
.wa-group > summary { cursor: pointer; font-weight: 600; padding: .2rem 0; }

/* Suggestions as cards: who, phone, the conversation summary, and the actions (owner 2026-11-25) */
.sg-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.sg-card { display: flex; flex-direction: column; gap: .45rem; margin: 0; border-top: 3px solid var(--primary); }
.sg-card.sg-high { border-top-color: var(--warn); }
.sg-top { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.sg-time { margin-inline-start: auto; }
.sg-name { font-size: 1.15rem; margin: .1rem 0 0; }
.sg-meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0; color: var(--muted); font-size: .92rem; }
.sg-summary { margin: .2rem 0 0; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.sg-next { margin: 0; font-weight: 600; font-size: .92rem; }
.sg-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--line); }
.sg-actions form { margin: 0; }
.sg-actions .sg-reject { margin-inline-start: auto; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--error); }
.sg-timeline { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem;
  border-inline-start: 2px solid var(--line); padding-inline-start: .8rem; }
.sg-tl-head { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.sg-summary-short { -webkit-line-clamp: 3; }
.chip-small { font-size: .75rem; padding: 0 .4rem; }
.sg-count { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.link-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.link-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }

/* "⋯" menu: a row's actions, folded (owner 2026-11-25) */
.kebab { position: relative; }
.kebab > summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; font-size: 1.3rem; line-height: 1; color: var(--muted); user-select: none; }
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary:hover, .kebab[open] > summary { background: var(--bg); color: var(--text); }
.kebab-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .3rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / .14); display: flex; flex-direction: column; }
.kebab-menu form { margin: 0; }
.kebab-menu a, .kebab-menu button { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .5rem .7rem;
  border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .95rem;
  text-align: start; text-decoration: none; cursor: pointer; white-space: nowrap; min-height: 0; }
.kebab-menu a:hover, .kebab-menu button:hover { background: var(--bg); }
.kebab-menu hr { border: 0; border-top: 1px solid var(--line); margin: .25rem 0; }
.kebab-menu .kebab-danger { color: var(--error); }
.fu-buttons { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.kebab-date { display: flex; align-items: center; gap: .4rem; padding: .3rem .6rem; }
.kebab-date label { display: flex; align-items: center; gap: .3rem; margin: 0; }
.kebab-date input[type=date] { min-height: 34px; font-size: .9rem; padding: .2rem .4rem; width: auto; }
.tk-row .kebab > summary { width: 30px; height: 30px; }

/* sent messages on a company / prospect (owner 2026-11-26): a chip, its popup on hover / focus */
.sent-pop { position: relative; display: inline-block; margin: .2rem 0; outline: none; }
.sent-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .55rem; border-radius: 999px;
  background: var(--info-bg); color: var(--text); font-weight: 600; font-size: .85rem; cursor: default; }
.sent-panel { display: none; position: absolute; z-index: 40; top: calc(100% + 6px); inset-inline-start: 0;
  width: max-content; min-width: 260px; max-width: min(360px, 88vw); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .75rem; box-shadow: 0 10px 28px rgb(0 0 0 / .16);
  font-size: .86rem; line-height: 1.5; text-align: start; overflow-wrap: normal; word-break: normal; white-space: normal; }
.sent-pop:hover .sent-panel, .sent-pop:focus-within .sent-panel, .sent-pop:focus .sent-panel { display: block; }
.sent-pop:focus .sent-chip { box-shadow: 0 0 0 2px var(--primary); }
.sent-panel-title { display: block; margin-bottom: .4rem; font-size: .9rem; }
.sent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.sent-list li { padding-top: .45rem; border-top: 1px solid var(--line); }
.sent-list li:first-child { padding-top: 0; border-top: 0; }
.sent-svc { display: flex; align-items: flex-start; gap: .45rem; font-weight: 600; }
.sent-times { flex: 0 0 auto; padding: 0 .45rem; border-radius: 999px; background: var(--primary); color: var(--primary-text);
  font-size: .78rem; line-height: 1.6; }
.sent-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sent-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .8rem; margin-top: .2rem;
  color: var(--muted); font-size: .8rem; }
.sent-day { white-space: nowrap; }
.mp-sent-before { margin: .3rem 0 .5rem; font-size: .9rem; }
.mp-sent-before > summary { cursor: pointer; font-weight: 600; }
.mp-sent-flag { color: var(--warn); font-weight: 600; }
.mp-sent { margin-top: .6rem; }

/* company data (owner 2026-11-26) */
.cd-filters { display: grid; gap: .5rem; margin-bottom: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.cd-filters .cd-q { grid-column: 1 / -1; }
.cd-filters input, .cd-filters select { min-height: 40px; width: 100%; }
.pr-origin { margin: .1rem 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: 1rem 0; }
/* company data, table view: resizable columns, one line per company, the text in full on hover (owner 2026-11-26) */
.cd-table-wrap { padding: 0; overflow-x: auto; }
.cd-table { table-layout: fixed; width: max-content; min-width: 100%; border-collapse: collapse; font-size: .92rem; }
.cd-table th { position: relative; text-align: start; font-weight: 600; color: var(--muted); background: var(--bg);
  padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.cd-th { display: block; overflow: hidden; text-overflow: ellipsis; }
.col-grip { position: absolute; top: 0; bottom: 0; inset-inline-end: -3px; width: 7px; cursor: col-resize; z-index: 2; }
.col-grip::after { content: ""; position: absolute; top: 25%; bottom: 25%; inset-inline-start: 3px; width: 1px; background: var(--line); }
.col-grip:hover::after, .cd-table.resizing .col-grip::after { background: var(--primary); width: 2px; }
.cd-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: middle; }
.cd-table tr:last-child td { border-bottom: 0; }
.cd-table tbody tr:hover td { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cd-table td.cd-visible { overflow: visible; }
.cd-strong { font-weight: 600; }
.cd-text { position: relative; outline: none; }
.cd-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); cursor: default; }
.cd-pop { display: none; position: fixed; z-index: 60; width: min(440px, 88vw); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .75rem; box-shadow: 0 10px 28px rgb(0 0 0 / .16);
  font-size: .88rem; line-height: 1.6; white-space: normal; color: var(--text); }
.cd-text.pop-open .cd-pop { display: block; }
.cd-pop > span { display: block; margin-bottom: .3rem; }
.cd-pop ul { margin: .2rem 0 0; padding-inline-start: 1.1rem; color: var(--muted); }
.cd-table .kebab-menu { position: fixed; min-width: 260px; z-index: 60; }
.cd-table .kebab-date select { flex: 1; min-width: 0; min-height: 34px; }
.cd-table .sent-panel { position: fixed; }

/* Find customers: where to look (owner 2026-11-26) */
.seg-switch { display: inline-flex; gap: .25rem; padding: .25rem; margin: 0 0 1rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--bg); flex-wrap: wrap; }
.seg-switch label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .4rem 1rem; border-radius: 999px;
  cursor: pointer; font-weight: 600; color: var(--muted); }
.seg-switch input { position: absolute; opacity: 0; pointer-events: none; }
.seg-switch label:has(input:checked) { background: var(--primary); color: var(--primary-text); }
.seg-switch label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.live-loading [data-live-body] { opacity: .55; transition: opacity .15s; }

/* "More" on a company (owner 2026-11-26) */
.pr-badges { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .2rem 0; }
.info-widget { display: inline-flex; align-items: center; }
.info-more { padding: .1rem .55rem; min-height: 0; font-size: .85rem; border: 1px dashed var(--line); border-radius: 999px; }
.info-chip { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.info-busy { color: var(--muted); font-weight: 500; }
.info-panel { width: min(420px, 88vw); max-width: min(420px, 88vw); }
.info-summary { display: block; margin-bottom: .4rem; line-height: 1.6; }
.info-meta { display: flex; flex-wrap: wrap; gap: .2rem .8rem; margin-bottom: .35rem; color: var(--muted); font-size: .82rem; }
.info-facts { margin: .2rem 0 .4rem; padding-inline-start: 1.1rem; }
.info-facts li { margin-bottom: .2rem; }
.info-social { display: flex; flex-wrap: wrap; gap: .3rem .7rem; font-size: .8rem; margin-bottom: .3rem; }
.cd-name-cell { white-space: nowrap; overflow: hidden; }
.cd-name-cell .cd-strong { display: inline-block; max-width: calc(100% - 4.5rem); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.web-link { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: inline-block; vertical-align: middle; }
.cd-web { overflow: hidden !important; }

/* ---------------------------------------------------------------- side menu: groups and show/hide (owner 2026-11-26) */
.side-toggle { display: none; }
.side-section .side-group, .menu-list .menu-group { font-size: .75rem; font-weight: 700; color: var(--muted);
  letter-spacing: .02em; }
.side-section .side-group { margin: .55rem 0 .15rem; padding: .35rem .6rem 0; border-top: 1px solid var(--line); }
.side-section .side-group.end { padding-top: 0; }
.menu-list .menu-group { padding: .9rem .25rem .3rem; }
@media (min-width: 900px) {
  .side-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    margin-inline-end: .5rem; background: none; border: 0; border-radius: var(--radius); color: inherit;
    cursor: pointer; }
  .side-toggle:hover { background: rgba(255, 255, 255, .12); }
  .side-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; }
  .side-toggle + .brand { margin-inline-end: auto; }
  /* closed: an icon rail; the name shows on hover, the page shows its section's tabs */
  .side-closed .side-nav { width: 60px; padding-inline: .4rem; overflow-x: hidden; }
  .side-closed .side-nav span, .side-closed .side-section ul,
  .side-closed .side-section > summary::after { display: none; }
  .side-closed .side-link, .side-closed .side-section > summary { justify-content: center; padding-inline: 0; }
  .has-nav.side-closed .content { margin-inline-start: 60px; }
  .side-closed .section-tabs { display: flex; }
  .side-tip { position: fixed; z-index: 60; padding: .3rem .65rem; border-radius: 6px; font-size: .85rem;
    background: var(--text); color: var(--surface); white-space: nowrap; pointer-events: none;
    transform: translateY(-50%); }
}
.wa-refresh { display: inline-flex; align-items: center; gap: .5rem; margin-inline-start: auto; }
.wa-refresh .link-btn { min-height: 30px; padding: .1rem .7rem; color: var(--primary); }
.wa-refresh .link-btn[disabled] { opacity: .6; cursor: default; }
