/* FCB OS design system: components.
   Needs tokens.css. Every value comes from a token.
   Tone (late, today, action, wait, done, none) is set with data-tone and inherited by what is inside.
   Kind (promise, work, decision, event) is set with data-kind on a .marker. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, select, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
.num { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
/* "hidden" always wins: otherwise a layout rule (display: flex) shows the empty frame behind the sign-in */
[hidden] { display: none !important; }
.app { display: flex; height: 100%; min-height: 640px; }
.side {
  width: var(--w-nav); flex-shrink: 0; display: flex; flex-direction: column; gap: var(--sp-28);
  padding: var(--sp-20) var(--sp-12) var(--sp-16); background: var(--surface-soft);
  border-right: 1px solid var(--line); overflow: auto; scrollbar-width: none;
}
.main { flex: 1; min-width: 0; overflow: auto; }

.brand {
  display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-6) var(--sp-8);
  border: 0; background: transparent; border-radius: var(--r-control); cursor: pointer;
  font-weight: var(--fw-bold); font-size: var(--fs-row-lg); letter-spacing: -0.01em; text-decoration: none; color: var(--ink);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r-control); background: var(--accent-solid); color: #FFFFFF;
  display: grid; place-items: center; font-size: 11px; letter-spacing: 0.03em;
}

.nav { display: flex; flex-direction: column; gap: var(--sp-4); }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  height: var(--h-control-lg); padding: 0 var(--sp-12); border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--text); font-size: var(--fs-body); text-align: left; text-decoration: none; cursor: pointer;
}
.nav-item:hover { background: var(--hover); }
.nav-item[aria-current="page"] { background: var(--hover); color: var(--accent-text); font-weight: var(--fw-semibold); }
.nav-sub { display: flex; flex-direction: column; gap: var(--sp-2); padding-left: var(--sp-12); }
.nav-sub .nav-item { height: var(--h-control); color: var(--text-soft); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-16); }
.legend {
  display: flex; flex-direction: column; gap: var(--sp-10); padding: var(--sp-12);
  border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface);
}
.legend-title { font-size: var(--fs-meta); font-weight: var(--fw-semibold); color: var(--text-muted); }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6) var(--sp-8); font-size: var(--fs-meta); color: var(--text); }
.legend-grid > span { display: flex; align-items: center; gap: var(--sp-6); }

.user { display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-4) var(--sp-8); }
.user-name { display: flex; flex-direction: column; line-height: 1.25; font-weight: var(--fw-medium); }
.user-name small { font-size: var(--fs-meta); font-weight: var(--fw-regular); color: var(--text-muted); }
.avatar {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: #E9E2FB; color: var(--ink);
  display: grid; place-items: center; font-size: var(--fs-small); font-weight: var(--fw-semibold);
}

/* Phone navigation: hidden on desktop */
.tabs {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line-soft);
  padding: var(--sp-6) var(--sp-6) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
}
.tab {
  height: 56px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--sp-6); color: var(--text-soft); font-size: var(--fs-meta); text-decoration: none; cursor: pointer;
}
.tab::before { content: ""; width: 24px; height: 4px; border-radius: 2px; background: transparent; }
.tab[aria-current="page"] { color: var(--accent-text); font-weight: var(--fw-semibold); }
.tab[aria-current="page"]::before { background: var(--accent); }

/* ---------- Page ---------- */
.page {
  max-width: var(--w-read); margin: 0 auto; padding: var(--sp-52) var(--sp-40) var(--sp-96);
  display: flex; flex-direction: column; gap: var(--sp-40);
}
.page--narrow { max-width: var(--w-read-narrow); }
.page--wide { max-width: 1240px; gap: var(--sp-24); }
.page--left { margin: 0; }
.page-head { display: flex; flex-direction: column; gap: var(--sp-6); }
.eyebrow { font-size: var(--fs-body); color: var(--text-muted); }
.title { font-size: var(--fs-title); font-weight: var(--fw-semibold); letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.title--lg { font-size: var(--fs-title-lg); }
.title--sm { font-size: var(--fs-title-sm); letter-spacing: -0.015em; line-height: 1.25; }
.lede { font-size: var(--fs-lede); line-height: 1.5; color: var(--text); max-width: 56ch; text-wrap: pretty; }
.hint { font-size: var(--fs-body); color: var(--text-muted); }
.stack { display: flex; flex-direction: column; gap: var(--sp-32); }

/* ---------- Marker: what kind of thing this is ---------- */
.marker { display: inline-block; flex-shrink: 0; width: 10px; height: 10px; border-radius: 2.5px; background: var(--tone-mk); }
.marker[data-kind="promise"] { width: 9px; height: 9px; border-radius: 1.5px; transform: rotate(45deg); }
.marker[data-kind="work"] { border-radius: 2.5px; }
.marker[data-kind="decision"] { border-radius: 50%; }
.marker[data-kind="event"] { width: 13px; height: 4px; border-radius: 2px; }
.marker[data-kind="dot"] { width: 8px; height: 8px; border-radius: 50%; }
.marker--lg[data-kind="decision"] { width: 12px; height: 12px; }

/* ---------- Tag: a status word ---------- */
.tag {
  display: inline-flex; align-items: center; gap: var(--sp-4); padding: 2px var(--sp-8); border-radius: var(--r-pill);
  background: var(--tone-bg); color: var(--tone-fg); font-size: var(--fs-meta); font-weight: var(--fw-semibold); white-space: nowrap;
}
/* who it is waiting on: violet when it is you, blue when it is someone else */
.tag--who { padding: 5px 11px; font-size: var(--fs-small); font-weight: var(--fw-medium); }
/* the due label on a card or a work row */
.due {
  padding: 1px 7px; border-radius: var(--r-tag); background: var(--tone-bg); color: var(--tone-fg);
  font-size: var(--fs-meta); font-weight: var(--fw-medium); white-space: nowrap;
}
.kbd { font-size: 12px; padding: 2px var(--sp-6); border: 1px solid var(--line-field); border-radius: var(--r-tag); color: var(--text-muted); }

/* ---------- Buttons. One primary per screen. ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-8);
  height: var(--h-control-lg); padding: 0 var(--sp-16); border: 1px solid transparent; border-radius: var(--r-control);
  background: transparent; color: var(--text-soft); font-size: var(--fs-body); font-weight: var(--fw-medium);
  white-space: nowrap; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn--primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #FFFFFF; font-weight: var(--fw-semibold); padding: 0 var(--sp-20); }
.btn--primary:hover { background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); }
.btn--secondary { background: var(--surface); border-color: var(--accent); color: var(--accent-text); font-weight: var(--fw-semibold); }
.btn--link { color: var(--accent-text); padding: 0 var(--sp-12); }
.btn--sm { height: var(--h-control); padding: 0 var(--sp-12); }
.btn--action { height: var(--h-action); width: 100%; border-radius: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.more { align-self: flex-start; margin-left: var(--sp-4); }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-8); }
.field--inline { flex-direction: row; align-items: center; }
.label { font-size: var(--fs-small); color: var(--text-muted); }
.select, .textarea, .input {
  border: 1px solid var(--line-field); border-radius: var(--r-control); background: var(--surface);
  color: var(--ink); font-size: var(--fs-body);
}
.select, .input { height: var(--h-control); padding: 0 var(--sp-12); }
.select { cursor: pointer; }
.select[data-active="true"] { border-color: var(--accent); }
.textarea { width: 100%; padding: var(--sp-12); resize: vertical; line-height: 1.5; }

/* inside a form or a card field, a control takes the full width */
.field:not(.field--inline) > .input, .field:not(.field--inline) > .select, .prop > .input { width: 100%; }
.prop > .actions { margin-top: var(--sp-4); }
.panel--form { width: min(560px, 100%); }

/* ---------- Sign-in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-24) var(--sp-16); }
.signin-box { width: min(380px, 100%); display: flex; flex-direction: column; gap: var(--sp-20); padding: var(--sp-28) var(--sp-24); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.signin-box .brand { padding: 0; cursor: default; }

/* ---------- Group: a titled set of rows ---------- */
.group { display: flex; flex-direction: column; gap: var(--sp-10); }
.group-title { display: flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--tone-strong); }
.group-title .count { font-weight: var(--fw-regular); color: var(--text-muted); }
.group-icon {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--tone-mk); background: var(--tone-mk);
  color: #FFFFFF; font-size: 11px; font-weight: var(--fw-bold); display: grid; place-items: center;
}
.group-icon--ring { background: var(--surface); }
.box { background: var(--tone-box); border: 1px solid var(--tone-line); border-radius: var(--r-box); padding: var(--sp-4) var(--sp-6); }
.box--pad { padding: var(--sp-20); }

/* ---------- Row: one line in a list ----------
   Parts, always in this order: marker, when, who for, what, state. */
.row {
  width: 100%; display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sp-16); row-gap: var(--sp-6);
  padding: var(--sp-12); border: 0; border-top: 1px solid var(--tone-rule); border-radius: var(--r-control);
  background: transparent; color: var(--ink); font-size: var(--fs-body); text-align: left; text-decoration: none; cursor: pointer;
}
.row:first-child { border-top-color: transparent; }
.row:hover { background: var(--hover-row); }
.row-mark { width: 14px; flex-shrink: 0; display: flex; justify-content: center; }
.row-when { width: 150px; flex-shrink: 0; font-weight: var(--fw-semibold); color: var(--tone-strong); white-space: nowrap; }
.row-client { width: 140px; flex-shrink: 0; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text { flex: 1 1 200px; min-width: 0; text-wrap: pretty; }
.row-person { width: 52px; flex-shrink: 0; color: var(--text-soft); }
.row-end { margin-left: auto; }
.row-meta { width: 150px; flex-shrink: 0; font-size: var(--fs-small); color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta--wide { width: 240px; }   /* two short facts side by side, e.g. "29 open · 8 with the client" */
.row-prio { width: 22px; flex-shrink: 0; font-size: var(--fs-meta); font-weight: var(--fw-semibold); color: var(--text-muted); }
.only-phone { display: none; }
.row .num { width: 42px; flex-shrink: 0; }
/* the rows that must be seen first */
.row--strong { padding: 15px var(--sp-12); font-size: var(--fs-row-lg); }
.row--strong .row-text { font-weight: var(--fw-medium); }

/* ---------- Empty, loading, toast ---------- */
.empty {
  display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-16) 18px; border-radius: var(--r-box);
  background: var(--surface); border: 1px solid var(--line-soft); font-size: var(--fs-body-lg); color: var(--text);
}
.empty--ok::before { content: "✓"; color: var(--done-fg); font-weight: var(--fw-bold); }
.empty--plain { padding: 0 var(--sp-4); border: 0; background: transparent; font-size: var(--fs-body); color: var(--text-muted); }
.skel { border-radius: var(--r-box); background: var(--skeleton); height: 46px; }
.skel--line { height: 16px; width: 80px; border-radius: 6px; }
.skel--row-lg { height: 58px; }
.toast {
  position: fixed; left: 50%; bottom: var(--sp-28); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-8) var(--sp-8) var(--sp-8) 18px;
  background: var(--ink); color: #FFFFFF; border-radius: 12px; font-size: var(--fs-body); box-shadow: var(--shadow-toast);
}
.toast .btn { height: 36px; padding: 0 var(--sp-10); color: #D4C4FF; font-weight: var(--fw-semibold); }
.toast .btn:hover { background: rgba(255, 255, 255, 0.1); }
.toast--static { position: static; transform: none; display: inline-flex; }

/* ---------- Board ---------- */
.board-screen { display: flex; flex-direction: column; height: 100%; }
.board-screen .board-scroll { flex: 1; min-height: 0; }
.board-head { padding: var(--sp-32) var(--sp-32) var(--sp-20); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-20); flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: var(--sp-10); flex-wrap: wrap; }
.board-scroll { overflow: auto; padding: 0 var(--sp-32) var(--sp-32); }
.board { display: flex; gap: var(--sp-12); align-items: flex-start; width: max-content; }
.col {
  width: var(--w-col); flex-shrink: 0; display: flex; flex-direction: column; gap: var(--sp-8); padding: var(--sp-10);
  background: var(--well); border: 1px dashed transparent; border-radius: var(--r-box);
}
.col[data-over="true"] { background: var(--well-over); border-color: var(--accent); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-8); padding: var(--sp-4) var(--sp-6) var(--sp-2); font-size: var(--fs-small); font-weight: var(--fw-semibold); }
.col-head .count { font-weight: var(--fw-regular); color: var(--text-muted); }
.col-empty { padding: var(--sp-12) var(--sp-8); font-size: var(--fs-small); color: var(--text-muted); text-align: center; }
.col .btn { height: 38px; font-size: var(--fs-small); border-radius: 8px; }
.col .btn:hover { background: var(--well-over); }
.card {
  display: flex; flex-direction: column; gap: var(--sp-6); padding: var(--sp-10) var(--sp-12);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control); cursor: grab;
}
.card:hover { border-color: var(--accent-line); }
.card[data-dragging="true"] { opacity: 0.4; }
.card-top, .card-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-8); font-size: var(--fs-meta); color: var(--text-muted); }
.card-top .num { font-size: var(--fs-meta); }
.card-title { font-size: var(--fs-body); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Panel: a card, opened ---------- */
.panel-wrap { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.panel { position: relative; width: min(var(--w-panel), 100%); height: 100%; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.panel-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-16); padding: var(--sp-16) var(--sp-28); border-bottom: 1px solid var(--line-faint); }
.panel-crumb { display: flex; align-items: center; gap: var(--sp-10); color: var(--text-muted); }
.panel-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-wrap: wrap; align-items: stretch; }
.panel-main { flex: 1 1 400px; min-width: 0; padding: var(--sp-32) var(--sp-32) var(--sp-52); display: flex; flex-direction: column; gap: var(--sp-32); }
.panel-side { flex: 1 1 270px; max-width: 100%; display: flex; flex-direction: column; gap: var(--sp-24); padding: var(--sp-32) var(--sp-24) 0; border-left: 1px solid var(--line-faint); background: var(--surface-soft); }
.panel-action { position: sticky; bottom: 0; margin: auto calc(-1 * var(--sp-24)) 0; padding: var(--sp-16) var(--sp-24) var(--sp-24); background: var(--surface-soft); border-top: 1px solid var(--line-faint); }
.prose { font-size: var(--fs-body-lg); line-height: 1.6; color: var(--text); max-width: 60ch; text-wrap: pretty; }
.section-title { font-size: var(--fs-body); font-weight: var(--fw-semibold); }

.prop { display: flex; flex-direction: column; gap: var(--sp-6); }
.prop-label { font-size: var(--fs-meta); color: var(--text-muted); }
.prop-value { display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap; font-size: var(--fs-body-lg); font-weight: var(--fw-medium); color: var(--tone-strong); }
.prop-was { font-size: var(--fs-small); color: var(--text-muted); }
.prop-was s { text-decoration: line-through; }
/* who acts next: the loudest field of a card */
.next { display: flex; flex-direction: column; gap: var(--sp-8); padding: var(--sp-12); border-radius: var(--r-box); background: var(--tone-bg); }
.next .prop-label { font-weight: var(--fw-semibold); color: var(--tone-fg); }
.next .select { height: var(--h-control-lg); border-color: var(--tone-line); font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); }
.next-hint { font-size: var(--fs-small); color: var(--text); }

.promise { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: var(--sp-10); align-items: start; padding: var(--sp-10) var(--sp-12); border: 1px solid var(--line-soft); border-radius: var(--r-control); background: var(--surface); }
.promise .marker { margin-top: 6px; }
.promise-date { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; font-weight: var(--fw-semibold); color: var(--tone-strong); }
.promise-text { font-size: var(--fs-small); color: var(--text); }

.comment { display: flex; gap: var(--sp-12); }
.comment-head { font-size: var(--fs-small); }
.comment-head b { font-weight: var(--fw-semibold); }
.comment-head span { color: var(--text-muted); }
.comment-text { line-height: 1.55; color: var(--text); max-width: 58ch; }

/* ---------- Decision ---------- */
.decision { display: flex; flex-direction: column; gap: 18px; padding: var(--sp-24) var(--sp-24) var(--sp-20); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.decision-top { display: flex; gap: var(--sp-16); align-items: flex-start; }
.decision-top .marker { margin-top: 8px; }
.decision-q { font-size: var(--fs-question); font-weight: var(--fw-medium); line-height: 1.4; text-wrap: pretty; }
.decision-meta { margin-top: var(--sp-8); display: flex; align-items: center; gap: var(--sp-10); flex-wrap: wrap; color: var(--text-muted); }
.decision-meta b { font-weight: var(--fw-semibold); color: var(--tone-strong); }
.decision-detail { margin-left: var(--sp-28); display: flex; flex-direction: column; gap: var(--sp-12); }
.decision-detail--inset { padding: var(--sp-16) 18px; border-radius: 12px; background: var(--surface-inset); }
.actions { display: flex; gap: var(--sp-10); justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Clients ---------- */
.split { display: flex; min-height: 100%; }
.split-main { flex: 1; min-width: 0; }
.list-pane { width: var(--w-list); flex-shrink: 0; display: flex; flex-direction: column; gap: var(--sp-28); padding: var(--sp-32) var(--sp-12); border-right: 1px solid var(--line); background: var(--surface-soft); }
.list-pane > .title { padding: 0 var(--sp-10); }
.list-group { display: flex; flex-direction: column; gap: var(--sp-4); }
.list-group-title { padding: 0 var(--sp-10); margin-bottom: var(--sp-4); font-size: var(--fs-meta); font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.list-item { display: flex; flex-direction: column; gap: 3px; padding: 11px var(--sp-12); border: 0; border-radius: var(--r-control); background: transparent; text-align: left; text-decoration: none; color: var(--ink); cursor: pointer; }
.list-item:hover { background: var(--hover); }
.list-item b { font-size: var(--fs-body-lg); font-weight: var(--fw-medium); }
.list-item small { font-size: var(--fs-meta); color: var(--tone-fg); }
.list-item:not([data-tone]) small { color: var(--text-muted); }
.list-item[aria-current="page"] { background: var(--hover); }
.list-item[aria-current="page"] b { color: var(--accent-text); font-weight: var(--fw-semibold); }
.summary { display: flex; flex-wrap: wrap; gap: var(--sp-16) 48px; padding: var(--sp-20); border-radius: var(--r-box); background: var(--tone-box); border: 1px solid var(--tone-line); }
.summary > div { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.summary dt { display: flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-small); color: var(--text-muted); }
.summary dd { display: flex; align-items: baseline; gap: var(--sp-10); flex-wrap: wrap; font-size: var(--fs-lede); font-weight: var(--fw-semibold); color: var(--tone-strong); }
.summary dd span { font-size: var(--fs-body); font-weight: var(--fw-regular); color: var(--text); }

/* ---------- Checklist and links inside a card ---------- */
.check { display: flex; align-items: flex-start; gap: var(--sp-10); width: 100%; padding: var(--sp-8) var(--sp-4); border: 0; border-radius: var(--r-control); background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.check:hover { background: var(--hover-row); }
.check-ask { margin-left: var(--sp-6); font-size: var(--fs-small); color: var(--text-soft); white-space: nowrap; }   /* "Kylie, by Fri 16 Oct" after an asked line */
.check-ask[data-tone="late"] { color: var(--late-fg); font-weight: var(--fw-medium); }
.check::before { content: ""; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--line-field); background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: var(--fw-bold); color: #FFFFFF; }
.check[aria-checked="true"] { color: var(--text-muted); text-decoration: line-through; }
.check[aria-checked="true"]::before { content: "✓"; background: var(--done-mk); border-color: var(--done-mk); }
.link-row { display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-6) var(--sp-4); min-width: 0; }
.link-row a, .link-row button.as-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent-text); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; }

/* ---------- Document: a Library page ---------- */
.doc { max-width: 76ch; font-size: var(--fs-body-lg); line-height: 1.6; color: var(--text); display: flex; flex-direction: column; gap: var(--sp-16); overflow-wrap: anywhere; }
.doc h2 { margin-top: var(--sp-16); font-size: 22px; font-weight: var(--fw-semibold); color: var(--ink); letter-spacing: -0.01em; }
.doc h3, .doc h4 { margin-top: var(--sp-8); font-size: var(--fs-row-lg); font-weight: var(--fw-semibold); color: var(--ink); }
.doc ul, .doc ol { margin: 0; padding-left: var(--sp-24); display: flex; flex-direction: column; gap: var(--sp-6); }
.doc b { font-weight: var(--fw-semibold); color: var(--ink); }
.doc code { font-family: var(--font-mono); font-size: 0.9em; padding: 1px 5px; border-radius: 5px; background: var(--well); }
.doc pre { margin: 0; padding: var(--sp-12) var(--sp-16); border-radius: var(--r-control); background: var(--well); overflow-x: auto; }
.doc pre code { padding: 0; background: transparent; }
.doc blockquote { margin: 0; padding-left: var(--sp-16); border-left: 3px solid var(--line); color: var(--text-soft); }
.doc hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.doc--talk { font-size: var(--fs-body); line-height: 1.55; gap: var(--sp-8); max-width: none; }   /* a description or a comment: same rules, smaller */
.doc--talk h2, .doc--talk h3, .doc--talk h4 { margin-top: var(--sp-4); font-size: var(--fs-body); }
.doc a { color: var(--accent-text, var(--accent)); text-decoration: underline; text-underline-offset: 2px; }
.doc-table { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-box); background: var(--surface); }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--fs-body); line-height: 1.45; }
.doc th { text-align: left; font-size: var(--fs-meta); font-weight: var(--fw-semibold); color: var(--text-muted); white-space: nowrap; }
.doc th, .doc td { padding: var(--sp-10) var(--sp-12); border-top: 1px solid var(--line-faint); vertical-align: top; }
.doc thead th { border-top: 0; }
/* a value to copy: a key or a command */
.copy { display: block; padding: var(--sp-12); border: 1px solid var(--line-field); border-radius: var(--r-control); background: var(--surface); font-family: var(--font-mono); font-size: var(--fs-small); overflow-wrap: anywhere; user-select: all; }

/* ---------- Phone ---------- */
/* ---------- Calendar (FullCalendar, themed from the tokens) ---------- */
.cal-key { display: inline-flex; gap: var(--sp-16); flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-soft); }
.cal-key > span { display: inline-flex; align-items: center; gap: var(--sp-6); }
.cal-slot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-box); padding: var(--sp-16); }
#cal {
  --fc-border-color: var(--line-soft); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-soft);
  --fc-today-bg-color: var(--today-bg); --fc-now-indicator-color: var(--late-mk); --fc-list-event-hover-bg-color: var(--hover-row);
  --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--line-field); --fc-button-text-color: var(--ink);
  --fc-button-hover-bg-color: var(--hover); --fc-button-hover-border-color: var(--line-field);
  --fc-button-active-bg-color: var(--accent); --fc-button-active-border-color: var(--accent-line);
  --fc-bg-event-color: var(--none-mk); --fc-bg-event-opacity: .14; --fc-more-link-text-color: var(--accent-text);
  font-family: var(--font); font-size: var(--fs-small); color: var(--ink);
}
#cal .fc-toolbar-title { font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); color: var(--ink); }
#cal .fc-button { font-family: var(--font); font-weight: var(--fw-medium); font-size: var(--fs-small); border-radius: var(--r-control); box-shadow: none; padding: var(--sp-6) var(--sp-12); }
#cal .fc-button-primary:not(:disabled).fc-button-active, #cal .fc-button-primary:not(:disabled):active { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--surface); }
#cal .fc-button:focus-visible { outline: var(--focus); outline-offset: 2px; box-shadow: none; }
#cal .fc-col-header-cell-cushion, #cal .fc-daygrid-day-number { color: var(--text-soft); font-weight: var(--fw-medium); text-decoration: none; }
#cal .fc-day-today .fc-daygrid-day-number { color: var(--today-fg); font-weight: var(--fw-bold); }
#cal .fc-daygrid-day.fc-day-other { background: var(--surface-soft); }
#cal .ev { border: 0; border-left: 3px solid var(--none-mk); border-radius: var(--r-tag); background: var(--surface-inset); color: var(--ink); padding: 1px var(--sp-4); cursor: pointer; }
#cal .ev .fc-event-main, #cal .ev .fc-event-title, #cal .ev .fc-event-time { color: inherit; }
#cal .fc-daygrid-dot-event.ev .fc-daygrid-event-dot { display: none; }
#cal .ev--work { border-left-color: var(--accent-solid); }
#cal .ev--promise { border-left-color: var(--action-mk); background: var(--action-bg); }
#cal .ev--decision { border-left-color: var(--wait-mk); background: var(--wait-bg); }
#cal .ev--event { border-left-color: var(--none-mk); }
#cal .ev--late { border-left-color: var(--late-mk); background: var(--late-bg); color: var(--late-fg); }
#cal .ev--today { border-left-color: var(--today-mk); background: var(--today-bg); }
#cal .ev--closed .fc-event-title { color: var(--text-soft); font-style: normal; font-weight: var(--fw-medium); font-size: var(--fs-meta); opacity: 1; margin-top: var(--sp-20); }
#cal .fc-bg-event.ev--closed { opacity: 1; background: repeating-linear-gradient(-45deg, var(--surface-soft) 0 6px, var(--surface-inset) 6px 12px); }
#cal .fc-list .ev { background: transparent; border-left: 0; }
#cal .fc-list-event-dot { border-color: var(--accent-solid); }
#cal .fc-list .ev--late .fc-list-event-dot { border-color: var(--late-mk); }
#cal .fc-list .ev--promise .fc-list-event-dot { border-color: var(--action-mk); }
#cal .fc-list .ev--decision .fc-list-event-dot { border-color: var(--wait-mk); }
#cal .fc-list-day-cushion { background: var(--surface-soft); }
#cal a { color: inherit; }

/* ---------- Insights and Costs: figures, a plain table, one bar chart ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-12); }
.figure { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-16); border: 1px solid var(--line-soft); border-radius: var(--r-box); background: var(--surface); }
.figure-label { font-size: var(--fs-small); color: var(--text-muted); }
.figure-value { font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.figure[data-tone] .figure-value { color: var(--tone-strong); }
.figure-note { font-size: var(--fs-meta); color: var(--text-muted); }
.data-table { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-box); background: var(--surface); }
.data-table table { border-collapse: collapse; width: 100%; font-size: var(--fs-body); }
.data-table th { text-align: left; font-size: var(--fs-meta); font-weight: var(--fw-semibold); color: var(--text-muted); white-space: nowrap; }
.data-table th, .data-table td { padding: var(--sp-10) var(--sp-12); border-top: 1px solid var(--line-faint); }
.data-table thead th { border-top: 0; }
.data-table td.n, .data-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tfoot td { font-weight: var(--fw-semibold); }
/* bars: one series, values on hover and as text for screen readers; the chart sits on its own baseline */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 6px; height: 140px; padding: var(--sp-16) var(--sp-16) 0; border: 1px solid var(--line-soft); border-bottom: 0; border-radius: var(--r-box) var(--r-box) 0 0; background: var(--surface); }
.bar { position: relative; height: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { background: var(--accent-solid); }
.bar-tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); display: none; white-space: nowrap; padding: var(--sp-4) var(--sp-8); border-radius: 6px; background: var(--ink); color: #FFFFFF; font-size: var(--fs-meta); z-index: 2; }
.bar:hover .bar-tip, .bar:focus-visible .bar-tip { display: block; }
.bar:nth-child(-n+3) .bar-tip { left: 0; transform: none; }
.bar:nth-last-child(-n+3) .bar-tip { left: auto; right: 0; transform: none; }
.bars-axis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: var(--sp-6) var(--sp-16) var(--sp-10); border: 1px solid var(--line-soft); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-box) var(--r-box); background: var(--surface); font-size: var(--fs-meta); color: var(--text-muted); text-align: center; white-space: nowrap; }
.cost-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-12); align-items: end; }

/* Feedback widget: one small button on every screen, a short form when opened */
.fbw-btn {
  position: fixed; right: var(--sp-16); bottom: var(--sp-16); z-index: 35; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--fs-small); font-weight: var(--fw-medium); box-shadow: var(--shadow-toast); cursor: pointer;
}
.fbw-btn:hover { color: var(--accent-text); }
.fbw-card {
  position: fixed; right: var(--sp-16); bottom: var(--sp-16); z-index: 45; width: min(360px, calc(100% - 32px));
  display: grid; gap: var(--sp-12); padding: var(--sp-16); background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-box); box-shadow: var(--shadow-toast);
}
.fbw-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); }
.fbw-card .hint { margin: 0; }
.fbw-btn.fbw--left, .fbw-card.fbw--left { right: auto; left: var(--sp-16); z-index: 50; }

@media (max-width: 760px) {
  .fbw-btn, .fbw-card { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .bars, .bars-axis { gap: 3px; padding-left: var(--sp-8); padding-right: var(--sp-8); }
  .bars-axis span:nth-child(even) { visibility: hidden; }
  /* on a phone an open card fills the screen: no widget over it */
  .fbw-btn.fbw--left { display: none; }
  .cal-slot { padding: var(--sp-8); }
  #cal .fc-toolbar-title { font-size: var(--fs-body-lg); }
  .app { display: block; height: auto; min-height: 0; }
  .side { display: none; }
  .tabs { display: grid; }
  .main { padding-bottom: 96px; }
  /* a notice sits above the tab bar, never on it: the bar stays usable while it shows */
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .page { padding: var(--sp-24) var(--sp-16) var(--sp-40); gap: var(--sp-28); }
  .title--lg { font-size: var(--fs-title-sm); }
  .box { padding: var(--sp-2) var(--sp-4); }

  /* a row stacks: marker on the left, the rest in one column */
  .row { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: var(--sp-12); row-gap: 5px; align-items: start; min-height: 56px; padding: var(--sp-12) var(--sp-10); }
  .row > * { grid-column: 2; }
  .row > .row-mark, .row > .marker { grid-column: 1; grid-row: 1; margin-top: 6px; }
  .row-when, .row-client, .row-person, .row-meta, .row-prio, .row .num { width: auto; font-size: var(--fs-small); }
  .only-phone { display: inline-flex; }
  .split[data-open="true"] .list-pane, .split[data-open="false"] .split-main { display: none; }
  .filters .input { flex: 1 1 100%; }
  .row-end { margin-left: 0; justify-self: start; }
  .tag--who { padding: 3px 9px; font-size: var(--fs-meta); }
  .more { align-self: stretch; margin-left: 0; height: var(--h-action); border-color: var(--line); background: var(--surface); border-radius: 12px; }

  .split { display: block; }
  .list-pane { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--sp-24) var(--sp-8); }
  .board-screen { height: auto; }
  .board-head { padding: var(--sp-24) var(--sp-16) var(--sp-16); }
  .board-scroll { padding: 0 var(--sp-16) var(--sp-24); }
  .panel-head { padding: var(--sp-12) var(--sp-16); }
  .panel-main { padding: var(--sp-24) var(--sp-16) var(--sp-32); }
  .panel-side { border-left: 0; border-top: 1px solid var(--line-faint); padding: var(--sp-24) var(--sp-16) 0; }
  .panel-action { margin: auto calc(-1 * var(--sp-16)) 0; padding: var(--sp-16); }
  .decision { padding: var(--sp-20) var(--sp-16) var(--sp-16); }
  .decision-detail { margin-left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-item, .row, .card, .list-item { transition: background-color 0.12s ease, border-color 0.12s ease; }
}
