/* book: page styles on top of the design-system primitives in /styles.css.
   Tokens only (var(--...)); no hex, no rgba, no new hues.
   Screen: screens/revenue.js (Core v11 board "02 Book"). */

.bk { display: flex; flex-direction: column; min-width: 0; }
.bk-body { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

/* Header: the advisor picker sits next to the title, the rest on the right. */
.bk .page-actions:has(.bk-adv) { flex: 1 1 auto; }
.bk-adv { margin-right: auto; }
.bk-adv-btn { padding: 0 10px 0 12px; gap: 6px; color: var(--ink-2); }
.bk-adv-pop { left: 0; right: auto; width: 320px; max-width: calc(100vw - 32px); padding: 6px; transform-origin: top left; }
.bk-adv-pop .menu { padding: 0; max-height: min(56vh, 480px); overflow-y: auto; }
.bk-adv-pop .menu > button { height: 46px; }
.bk-adv-pop .setup-actions { margin-top: 6px; padding: 10px 4px 4px; }
.bk-adv-pop .setup-actions .btn { flex: 1; }
.bk-adv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-adv-value { font-weight: 600; white-space: nowrap; }

/* Sections */
.bk-section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bk-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; min-height: 34px; }
.bk-section-head h2 { margin: 0; }
.bk-hint { font-size: var(--fs-meta); color: var(--ink-3); }
.bk-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bk-tools .seg { align-self: center; }
.bk-gate { min-height: min(56vh, 560px); display: grid; place-items: center; }

/* Hero figure: label, the 72px value with its delta, the comparison note. */
.bk-hero { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bk-hero-row { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.bk-hero .figure--hero { white-space: nowrap; }

/* Monthly chart */
.bk-chart-section { gap: 12px; margin-top: -8px; }
.bk-chart-title { font-size: var(--fs-body); font-weight: 600; }
.bk-chart { height: 260px; min-width: 0; }
.bk-key-green { background: var(--green); }

/* By product: one card per segment with the 28-notch gauge. */
.bk-gauges { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.bk-gcard {
  width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 18px;
  padding: 16px 10px; color: inherit; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: border-color 200ms var(--ease-out), box-shadow 300ms var(--ease-out);
}
button.bk-gcard { cursor: pointer; }
/* A product card lifts toward the pointer (kit tilt) and casts a shadow: it opens the product. */
button.bk-gcard { transition: border-color 200ms var(--ease-out), box-shadow 300ms var(--ease-out); }
button.bk-gcard:hover, button.bk-gcard:focus-visible { border-color: var(--ink-3); box-shadow: 0 18px 36px -18px color-mix(in oklch, var(--ink) 40%, transparent), var(--shadow); position: relative; z-index: 1; }
.bk-gcard-label { font-size: var(--fs-ui); font-weight: 600; line-height: 1.3; min-height: 38px; display: flex; align-items: center; }
.bk-gauge { position: relative; width: 112px; height: 88px; display: block; }
.bk-gauge-pct { position: absolute; inset: 0; padding-top: 6px; display: grid; place-items: center; font-size: var(--fs-lead); font-weight: 700; }
.bk-gcard-value { font-size: var(--fs-lead); font-weight: 700; }
.bk-gcard-count { font-size: var(--fs-min); color: var(--ink-3); margin-top: -6px; }
.bk-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Brushed metal (the one --metal accent) as SVG stops, light in both themes. */
.bk-metal-1 { stop-color: var(--soft); }
.bk-metal-2 { stop-color: var(--series-5); }
.bk-metal-3 { stop-color: var(--panel); }
:root[data-theme="dark"] .bk-metal-1 { stop-color: var(--ink-2); }
:root[data-theme="dark"] .bk-metal-2 { stop-color: var(--ink-3); }
:root[data-theme="dark"] .bk-metal-3 { stop-color: var(--ink); }

/* Goal cell in the figure row */
.figures > .bk-goal { flex-direction: row; }
.bk-goal { display: flex; align-items: center; gap: 16px; text-align: left; color: inherit; cursor: pointer; }
.bk-goal:hover .bk-goal-of { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.bk-goal-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-goal-of { font-size: var(--fs-body); font-weight: 500; }

/* Rows: contracts, clients, notes. Dividers inset like .feed-row so the hover fill has air. */
.bk-rows { display: flex; flex-direction: column; }
.bk-crow, .bk-row {
  position: relative; width: calc(100% + 24px); margin: 0 -12px; padding: 13px 12px;
  border-radius: var(--r-md); color: inherit; text-align: left; font-size: var(--fs-body);
  transition: background 160ms var(--ease-out);
}
.bk-crow::before, .bk-row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line-2); }
.bk-crow:hover, .bk-row:hover { background: var(--soft); }
.bk-crow:hover::before, .bk-crow:hover + .bk-crow::before, .bk-row:hover::before, .bk-row:hover + .bk-row::before { border-color: transparent; }
.bk-crow { display: grid; grid-template-columns: 14px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 110px; align-items: center; gap: 16px; }
.bk-swatch { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.bk-crow-main, .bk-row-main { display: flex; flex-direction: column; min-width: 0; }
.bk-crow-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-crow-meta { font-size: var(--fs-meta); color: var(--ink-3); }
.bk-crow-product { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-crow-pol { color: var(--ink-3); font-family: var(--font-mono); font-size: var(--fs-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-crow-value { text-align: right; font-weight: 600; white-space: nowrap; }
.bk-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; }
.bk-row .row-meta { margin-top: 2px; }
.bk-row-value { font-weight: 600; white-space: nowrap; }
.bk-row-go { color: var(--ink-3); }
.bk-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--soft); border: 1px solid var(--line); color: var(--ink-2);
  font-size: var(--fs-min); font-weight: 600;
}
.bk-avatar--sm { width: 30px; height: 30px; }
.bk-clink:empty { display: none; }
.bk button.link { padding: 0; }
.bk-basis-row { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bk-coverage { margin: 0; }
.bk-basis { align-self: flex-start; gap: 7px; text-align: left; font-size: var(--fs-ui); color: var(--ink-3); }

/* Projection: the "how" disclosure */
.bk-disclose { display: grid; grid-template-rows: 0fr; margin-top: -14px; transition: grid-template-rows 320ms var(--ease-out), margin-top 320ms var(--ease-out); }
.bk-disclose.open { grid-template-rows: 1fr; margin-top: 0; }
.bk-disclose > div { overflow: hidden; min-height: 0; }
.bk-explain { margin: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--soft); color: var(--ink-2); font-size: var(--fs-ui); line-height: 1.55; }

/* Segment + client tables */
.bk-toolbar { margin: 0; }
.bk-toolbar .search-input { flex: 1 1 260px; margin: 0; }
.bk-toolbar select { width: auto; flex: 0 0 auto; }
.bk-table td { vertical-align: middle; }
.bk-table .row-title, .bk-table .row-meta { display: block; }
.bk-cell-client { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bk-col-share { width: 28%; }
.bk-muted { color: var(--ink-2); }
.bk-strong { font-weight: 600; white-space: nowrap; }
.bk-mono { font-family: var(--font-mono); font-size: var(--fs-meta); }
.bk-foot { margin: 12px 0 0; font-size: var(--fs-meta); }
.bk-bar { display: block; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bk-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--bar, var(--green)); }

/* Client sheet */
.bk-client-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 40px; }
.bk-split { display: flex; flex-direction: column; gap: 14px; }
.bk-split-top { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-ui); margin-bottom: 6px; color: var(--ink-2); }
.bk-split-top b { color: var(--ink); white-space: nowrap; }
.bk-table--contracts { min-width: 560px; }

/* Notes */
.bk-note { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line-2); }
.bk-note-text { font-size: var(--fs-body); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bk-note-form { display: flex; align-items: center; gap: 10px; }
.bk-note-form input { flex: 1; min-width: 0; }

/* Locked-agents banner (screens/locked-agents-banner.js, shared by Reports,
   Policies and Book; this stylesheet is loaded on every page). */
.lock-banner { align-items: center; flex-wrap: wrap; margin: 0 0 28px; }
.lock-banner > svg { margin-top: 0; }
.lock-banner-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.lock-banner-body { color: var(--ink-2); font-size: var(--fs-meta); }
.lock-banner-actions { display: flex; gap: 8px; }
.lock-chip { margin: 0 0 28px; color: var(--ink-2); }
.lock-chip-cta { color: var(--ink); font-weight: 600; }

@media (max-width: 1100px) {
  .bk-gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
  .bk-client-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bk-body { gap: 32px; }
  .bk-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bk-crow { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .bk-crow-product, .bk-crow-pol { display: none; }
  .bk-col-share, .bk-col-adv { display: none; }
  .bk .page-actions { gap: 8px; }
}
