/* The topic pages (spec 2026-10-21-owner-page, items 2 and 16 to 21): Money, Sales, Schedule, Customers, Vendors. Every colour,
   size and space is a token; the masks below are the spec's own icons; nothing here sets a width or a colour from data (the
   script hands a bar its share through the --w variable, as the job page does). */

/* ---------- icons the topic places need (Lucide, self-hosted, the spec's list) */
.i-wallet { --icon: url(../static/wallet.svg); }
.i-trending-up { --icon: url(../static/trending-up.svg); }
.i-calendar-days { --icon: url(../static/calendar-days.svg); }
.i-contact { --icon: url(../static/contact.svg); }
.i-store { --icon: url(../static/store.svg); }
.i-shield-check { --icon: url(../static/shield-check.svg); }

/* a hidden mark stays hidden although .ico sets a display */
.mark[hidden], li[hidden], .tabs a[hidden] { display: none; }
.mark { width: 16px; height: 16px; color: var(--muted); }
.places .mark { margin-left: auto; }
.tabs .mark { position: absolute; top: 6px; left: calc(50% + 6px); width: 14px; height: 14px; }

/* ---------- the phone's tab bar: five places, or four when a business has no Money */
.tabs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (min-width: 768px) and (max-width: 1099px) {
  .places .mark { position: absolute; top: 4px; left: 6px; margin: 0; width: 14px; height: 14px; }
}

/* ---------- shared parts */
.topic-stack { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.topic-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 1100px) { .topic-cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.topic-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.topic-empty { padding: var(--space-5); border: 1px dashed var(--line-input); border-radius: var(--radius-lg); color: var(--muted); }
.topic-empty h2 { margin-bottom: var(--space-2); color: var(--ink); }
.topic-note { color: var(--muted); }
.topic-hidden { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--muted); }
.topic-hidden .ico { width: 16px; height: 16px; }
.topic-evidence { color: var(--warn); font-weight: 600; }
.topic-more { align-self: flex-start; border-radius: var(--radius-pill); }

/* ---------- a status chip: a 24 px round mark with an icon and a few words, in a status colour's soft ground */
.status-chip { display: inline-flex; align-items: center; gap: var(--space-1); align-self: flex-start; min-height: 24px; padding: 0 var(--space-2);
               border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; }
.status-chip .ico { width: 16px; height: 16px; flex: none; }
.status-chip.is-warn { background: var(--warn-soft); color: var(--warn); }
.status-chip.is-ok { background: var(--ok-soft); color: var(--ok); }
.status-chip.is-bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- Money: two tiles across on a phone, two from 768 px, four from 1100 px */
.is-money .tiles.is-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1100px) { .is-money .tiles.is-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.is-rollout .tiles.is-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.is-rollout .child-title { align-self: flex-start; }
/* ---------- stat tiles: an amount never breaks inside itself; a word sits at line size */
.topic-stack .tiles.is-stats .tile-figure { white-space: nowrap; font-size: clamp(var(--text-lg), 6vw, var(--text-2xl)); }
.topic-stack .tiles.is-stats .tile.is-word .tile-figure { white-space: normal; font-family: inherit; font-size: var(--text-md); }

/* ---------- kind bars: a label, a bar against the largest, the figure */
.kbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.kbar { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 2fr) auto; align-items: center; gap: var(--space-3); }
.kbar-label { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kbar-figure { text-align: right; font-weight: 600; }
.kbar .bar-fill { background: var(--accent); border-radius: var(--radius-pill); }
@media (max-width: 767px) { .kbar { grid-template-columns: minmax(0, 1fr) auto; } .kbar .track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Sales: a block per kind, its heading a step over the panel titles inside it and 32 px under the block before */
.topic-stack.is-sales { gap: var(--space-8); }
.is-sales .topic-title h2 { font-size: var(--text-xl); }
.is-sales .panel h3, .is-sales .topic-empty h3 { margin: 0; font-family: var(--font-display); letter-spacing: var(--tracking-tight); font-size: var(--text-lg); font-weight: 650;
                                                  line-height: var(--leading-tight); }
.is-sales .topic-empty h3 { margin-bottom: var(--space-2); color: var(--ink); }
@media (min-width: 768px) and (max-width: 1099px) { .is-sales .tiles.is-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wonlost { display: flex; align-items: center; gap: var(--space-4); }
.wonlost-line { color: var(--ink); font-weight: 600; }

/* ---------- the pipeline's columns (spec item 17): heading and count, value, a 6 px bar against the largest, the deal cards */
.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
@media (min-width: 768px) { .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.column { min-width: 0; padding: var(--space-4); background: var(--surface-2); border-radius: var(--radius-lg);
          display: flex; flex-direction: column; gap: var(--space-2); }
.column-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.column-head h4 { margin: 0; font-size: var(--text-md); font-weight: 600; overflow-wrap: anywhere; }
.column-head { align-items: center; }
.column-count { flex: none; min-width: 28px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--surface); text-align: center;
                font-size: var(--text-sm); font-weight: 700; line-height: 28px; }
.column-value { color: var(--muted); font-size: var(--text-sm); }
.column .track { height: 6px; background: var(--surface); }
.column .card.deal { flex-direction: row; align-items: flex-start; gap: var(--space-2); max-width: none; padding: var(--space-3);
                     border-radius: var(--radius-md); border-left: 3px solid var(--accent); box-shadow: none;
                     text-decoration: none; color: inherit; }
.column .card.deal:hover { border-color: var(--line-input); border-left-color: var(--accent); }
.deal .trow-figure.is-amount { white-space: nowrap; }

/* ---------- a list of rows as the tool gave them */
.trows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-3) 0; }
.trow + .trow { border-top: 1px solid var(--line); }
.trow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trow-name { font-weight: 600; overflow-wrap: anywhere; }
.trow-line { color: var(--muted); font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-1); }
.trow-line .ico { width: 16px; height: 16px; }
.trow-line.is-bad { background: var(--bad-soft); color: var(--bad); }
.trow-line.is-ok { background: var(--ok-soft); color: var(--ok); }
.trow-figure { font-weight: 600; text-align: right; }
a.trow { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
         text-decoration: none; color: inherit; }
a.trow:hover { border-color: var(--line-input); }
.search-results .trows { gap: var(--space-2); }
.search-results .topic-more { margin-top: var(--space-3); }

/* ---------- the name search: 44 px, round, the search icon inside */
.search-field { position: relative; display: flex; align-items: center; }
.search-field .ico { position: absolute; left: var(--space-4); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; height: var(--tap); padding: 0 var(--space-4) 0 calc(var(--space-4) + 18px + var(--space-2)); border: 1px solid transparent;
                      border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink); font: inherit; }
.search-field input:focus-visible { border-color: var(--line-input); }
.search-line:empty { display: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
          background: var(--surface-2); color: var(--ink-2); font-size: var(--text-sm); font-weight: 700; }
.avatar.is-square { border-radius: var(--radius-md); }
.avatar.is-big { width: 64px; height: 64px; font-size: var(--text-lg); }
.trow > .ico { width: 18px; height: 18px; color: var(--muted); }

/* ---------- the week grid and the day picker */
.week { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
        overflow: hidden; }
.week-row { display: grid; grid-template-columns: 170px repeat(6, minmax(0, 1fr)); }
.week-row + .week-row { border-top: 1px solid var(--line); }
.week-cell { min-width: 0; padding: var(--space-2); display: flex; flex-direction: column; gap: var(--space-1); }
.week-cell + .week-cell { border-left: 1px solid var(--line); }
.week-cell.is-today { background: var(--accent-soft); }
.week-head .week-cell { font-weight: 700; font-size: var(--text-sm); }
.week-head .week-cell.is-today { color: var(--accent-text); }
.week-name { font-weight: 600; overflow-wrap: anywhere; }
.pill { padding: var(--space-1) var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2); font-size: var(--text-sm); font-weight: 600;
        overflow-wrap: anywhere; }
.daylist .pill { padding: 0; background: none; color: var(--muted); font-weight: 400; }
.daylist .pill small { display: inline; margin-left: var(--space-1); }
.daylist { flex-direction: column; gap: var(--space-2); }
.day-card { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.pill small { display: block; font-weight: 400; color: var(--muted); font-size: var(--text-xs); }
.daypicker { display: none; }
.daylist { display: none; }
@media (min-width: 768px) and (max-width: 1099px) { .week-row { grid-template-columns: 120px repeat(6, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .week { display: none; }
  .daypicker { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-1); }
  .daypicker button { flex: none; min-width: 56px; padding: var(--space-2) var(--space-3); white-space: nowrap; min-height: 64px; display: flex; flex-direction: column;
                      align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-lg);
                      background: var(--surface); color: var(--ink); font-size: var(--text-sm); font-weight: 600; }
  .daypicker button .daynum { font-size: var(--text-lg); font-weight: 700; }
  .daypicker button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  .daylist { display: flex; margin-top: var(--space-2); }
}

/* ---------- one customer and one vendor: a header card, the avatar beside the tiles */
.who { display: flex; align-items: center; gap: var(--space-4); }
.who .tiles { flex: 1; min-width: 0; margin-bottom: 0; }
@media (max-width: 767px) { .who { flex-direction: column; align-items: flex-start; } .who .tiles { width: 100%; }
                            .who .tiles.is-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- words for a screen reader only */
.lock-words { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.topic-back { margin-bottom: var(--space-2); }
