/* Home (redesign Phases 1 and 2), the surgeon record, and the undo message.

   Phone first: one column in priority order (figures, share, what needs updating, coming
   up, surgeons, first cases, results, team). From 1024px the share, coming up and surgeons
   move to a side column. Every tap target is at least 44px; text is at least 14px, body
   copy 15-16px. Colors come from tokens.css; the win and loss greens and grays are the
   Closed and Lost stage colors from config/stages.json. */

.screen-home { max-width: 1240px; }
.home-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.home-hello { font: 700 24px/1.25 var(--font-display); color: var(--text-bright); margin: 4px 0; text-wrap: balance; }
.home-sub { font-size: 16px; color: var(--muted); }
.home-period { display: flex; align-items: center; gap: 8px; }
.home-period .period-select { width: auto; min-height: 44px; }

/* Layout */
.home-grid { display: flex; flex-direction: column; gap: 16px; }
.home-main, .home-side { display: contents; }
.o-figures { order: 1; } .o-share { order: 2; } .o-needs { order: 3; } .o-coming { order: 4; }
.o-surgeons { order: 5; } .o-cases { order: 6; } .o-results { order: 7; } .o-team { order: 8; }
.home-main > div:empty, .home-side > div:empty { display: none; }
/* Phone order puts the update list right under the figures. A CEO or CCO with no deals of
   their own leads with the company instead. */
.o-needs { order: 2; } .o-share { order: 3; }
.is-leader .o-team { order: 2; }
@media (min-width: 1024px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; }
  .home-main, .home-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
}

/* Your figures */
.home-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-figure {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0;
}
.home-figure.hf-est { grid-column: 1 / -1; border-top: 3px solid var(--zv-red); }
button.home-figure { font: inherit; text-align: left; color: inherit; cursor: pointer; width: 100%; }
.home-figure.is-link:hover { border-color: var(--zv-blue); }
.home-figure.is-link:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: 2px; }
.hf-go { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--zv-blue); }
.hf-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.hf-value { font-size: 26px; color: var(--text-bright); margin-top: 4px; }
.hf-missing { margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--zv-red-deep); }
.hf-ok { margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--accent-green); }
@media (min-width: 768px) {
  .home-figures { grid-template-columns: 1fr 1fr 1.3fr; }
  .home-figure.hf-est { grid-column: auto; }
}

/* Cards and controls */
.home-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.home-card-head { display: flex; align-items: center; gap: 10px; }
.home-h { font: 700 18px/1.3 var(--font-display); color: var(--text-bright); margin: 0 0 8px; }
.home-card-head .home-h { margin: 0; }
.home-h:focus { outline: none; }
.home-count {
  min-width: 28px; padding: 2px 9px; border-radius: 14px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 14px; font-weight: 700; color: var(--text-strong);
}
.home-quiet { font-size: 15px; color: var(--muted); margin: 4px 0; }

.home-action {
  display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 16px; text-align: left; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--border); background: var(--panel); text-decoration: none;
  font: 600 16px var(--font-body); color: var(--text-strong);
}
.home-action:hover { background: var(--panel-2); }
.home-action.primary { background: var(--zv-red); border-color: var(--zv-red); color: #fff; }
.home-action.primary:hover { background: var(--zv-red-hover); }
.home-action:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: 2px; }

.chip-btn {
  min-height: 44px; padding: 0 14px; border-radius: 22px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-strong);
  font: 600 15px var(--font-body);
}
.chip-btn:hover { border-color: var(--zv-blue); color: var(--zv-blue); }
.chip-btn.primary { background: var(--zv-blue); border-color: var(--zv-blue); color: #fff; }
.chip-btn.ghost { border-style: dashed; color: var(--muted); }
.chip-btn.primary:hover { background: var(--zv-blue-hover); color: #fff; }
.chip-btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: 2px; }
.link-btn {
  min-height: 44px; padding: 0 4px; background: none; border: 0; cursor: pointer;
  color: var(--zv-blue); font: 600 15px var(--font-body); text-decoration: underline; text-underline-offset: 3px;
}

/* Needs your update */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-strong); font: 600 15px var(--font-body);
}
.tab-btn.is-on { background: var(--text-bright); border-color: var(--text-bright); color: #fff; }
.tab-btn:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: 2px; }
.tab-n { min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--panel-2); color: var(--text-strong); font-size: 13px; text-align: center; }
.tab-btn.is-on .tab-n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.nu-list { list-style: none; margin: 8px 0 0; }
.nu-item { padding: 14px 0; border-top: 1px solid var(--border-soft); }
.nu-item:first-child { border-top: 0; }
.nu-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.nu-surgeon { font-size: 17px; font-weight: 700; color: var(--text-bright); }
.nu-amount { font-size: 15px; color: var(--text-strong); white-space: nowrap; }
.nu-meta { margin-top: 2px; font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nu-problems { list-style: none; margin: 8px 0 10px; display: grid; gap: 4px; }
.nu-problems li { position: relative; padding-left: 18px; font-size: 15px; color: var(--text-strong); }
.nu-problems li::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.nu-problems li.p-pastStart::before, .nu-problems li.p-noStart::before { background: var(--zv-red); }
.nu-problems li.p-missing::before { background: var(--accent-amber); }
.nu-fixes, .nu-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nu-inline select, .nu-inline input { width: auto; min-height: 44px; }
.nu-inline select.year-select { width: 96px; }
.nu-inline input[type="text"] { min-width: 200px; flex: 1; }

/* Share of the company, and meters */
.share-big { font: 700 40px/1.1 var(--font-display); color: var(--text-bright); margin: 4px 0 10px; }
.meter { display: block; height: 10px; border-radius: 5px; background: var(--zv-blue-wash); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 5px; background: var(--zv-blue); }
.meter-win { margin-top: 6px; background: #e3f2ea; }
.meter-win > span { background: #157347; }
.meter-sm { display: inline-block; width: 64px; height: 8px; vertical-align: middle; margin-left: 8px; }
.share .home-quiet { margin-top: 10px; }

/* Coming up and My surgeons */
.coming, .surg-list, .cases, .res-recent, .tm-people, .ss-deals, .ss-timeline { list-style: none; }
.coming-item, .surg-item {
  display: grid; gap: 2px; width: 100%; min-height: 52px; padding: 10px 8px; text-align: left; cursor: pointer;
  background: none; border: 0; border-top: 1px solid var(--border-soft); border-radius: 6px; color: inherit; font: inherit;
}
.coming li:first-child .coming-item, .surg-list li:first-child .surg-item { border-top: 0; }
.coming-item:hover, .surg-item:hover { background: var(--panel-2); }
.coming-item:focus-visible, .surg-item:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: -2px; }
.coming-when { font-size: 14px; font-weight: 700; color: var(--zv-blue); }
.coming-when.is-late { color: var(--zv-red-deep); }
.coming-what, .surg-name { font-size: 16px; font-weight: 600; color: var(--text-strong); }
.coming-body, .surg-meta { font-size: 14px; color: var(--muted); }
.surg-item { grid-template-columns: 1fr auto; }
.surg-name, .surg-meta { grid-column: 1; }
.surg-state { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 3px 8px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.surg-state.is-saved { background: #e3f2ea; color: #0f5c37; }
.surg-state.is-old { background: var(--panel-2); color: var(--muted); }

/* First cases */
.case-item { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.case-item:first-child { border-top: 0; }
.case-when { font-size: 14px; font-weight: 700; color: var(--zv-blue); }
.case-what { font-size: 16px; font-weight: 600; color: var(--text-strong); }
.case-where { font-size: 14px; color: var(--muted); }
.case-form { margin-top: 12px; justify-content: center; color: var(--zv-blue); border-color: var(--zv-blue); }

/* Your results. Emphasis form: wins in the Closed green, losses in the Lost gray. Every
   column carries its win count and a full label, because the gray is low contrast. */
.res-headline { font-size: 17px; color: var(--text-strong); margin: 0 0 10px; }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.badge { padding: 6px 12px; border-radius: 16px; background: #e3f2ea; color: #0f5c37; font-size: 14px; font-weight: 700; }
.res-stats { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; margin-bottom: 14px; }
.res-num { font-size: 28px; color: var(--text-bright); }
.rb { display: flex; align-items: flex-end; gap: 10px; height: 140px; border-bottom: 1px solid var(--border); }
.rb-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.rb-stack { display: flex; flex-direction: column; gap: 2px; width: 100%; max-width: 40px; }
.rb-stack > span:first-child { border-radius: 4px 4px 0 0; }
.rb-won { background: #157347; }
.rb-lost { background: #9a9b9e; }
.rb-num { min-height: 18px; font-size: 14px; font-weight: 700; color: var(--text-strong); }
.rb-month { padding: 4px 0 2px; font-size: 13px; color: var(--muted); }
.rb-legend { display: flex; align-items: center; gap: 6px; margin: 8px 0 4px; font-size: 14px; color: var(--muted); }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lg-won { background: #157347; }
.lg-lost { background: #9a9b9e; margin-left: 10px; }
.res-recent li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border-soft); font-size: 15px; }
.res-recent li:first-child { margin-top: 6px; border-top: 0; }
.res-tag { padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.res-tag.is-won { background: #e3f2ea; color: #0f5c37; }
.res-tag.is-lost { background: var(--panel-2); color: var(--muted); }
.res-when { font-size: 14px; color: var(--muted); }

/* My team */
.tm-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; width: 100%; min-height: 52px; padding: 10px 8px;
  text-align: left; cursor: pointer; background: none; border: 0; border-top: 1px solid var(--border-soft); border-radius: 6px; font: inherit; color: inherit;
}
.tm-row:hover { background: var(--panel-2); }
.tm-row:focus-visible { outline: 2px solid var(--zv-blue); outline-offset: -2px; }
.tm-name { flex: 1 1 100%; font-size: 16px; font-weight: 700; color: var(--text-strong); }
.tm-fig { font-size: 15px; color: var(--text-strong); }
.tm-l { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.tm-list { margin: 0 0 8px 8px; padding: 0 8px 8px 16px; border-left: 3px solid var(--zv-blue-wash); }
.tm-area { margin: 18px 0 4px; font: 700 16px var(--font-display); color: var(--text-bright); }
.tm-total { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 8px; border-radius: 8px; background: var(--panel-2); }
@media (min-width: 768px) {
  .tm-name { flex: 1 1 200px; }
  .tm-fig { min-width: 90px; }
}

/* Surgeon record (src/components/surgeonSheet.js) */
.sheet-wide { max-width: 640px; }
.ss-h { margin: 20px 0 6px; font: 700 16px var(--font-display); color: var(--text-bright); }
.ss-brief { margin-top: 14px; justify-content: center; }
.ss-hint, .ss-empty { margin: 6px 0; font-size: 14px; color: var(--muted); }
.ss-deal {
  display: flex; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 8px;
  background: none; border: 0; border-top: 1px solid var(--border-soft); border-radius: 6px;
  font: 600 16px var(--font-body); color: var(--text-strong); text-align: left; cursor: pointer;
}
.ss-deal:hover { background: var(--panel-2); }
.ss-deal-meta { font-weight: 400; font-size: 14px; color: var(--muted); }
.ss-add { display: grid; gap: 10px; margin: 8px 0 14px; }
.ss-kinds { display: flex; flex-wrap: wrap; gap: 6px; border: 0; }
.ss-kind-opt { margin: 0; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text-strong); }
.ss-kind-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ss-kind-opt span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 22px; font-weight: 600; cursor: pointer; }
.ss-kind-opt input:checked + span { background: var(--zv-blue); border-color: var(--zv-blue); color: #fff; }
.ss-kind-opt input:focus-visible + span { outline: 2px solid var(--zv-blue); outline-offset: 2px; }
.ss-timeline { display: grid; gap: 10px; }
.ss-item { padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--muted-2); border-radius: 8px; }
.ss-item.kind-meeting { border-left-color: var(--zv-blue); }
.ss-item.kind-task { border-left-color: var(--accent-amber); }
.ss-item.is-done { opacity: 0.7; }
.ss-item-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.ss-kind { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.ss-when { font-weight: 700; color: var(--zv-blue); }
.ss-text { margin: 6px 0; font-size: 16px; color: var(--text-strong); white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-item-actions { display: flex; gap: 14px; align-items: center; }
.ss-done { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text-strong); }
.ss-done input { width: 20px; height: 20px; }
.ss-link { min-height: 44px; background: none; border: 0; color: var(--zv-red-deep); font: 600 15px var(--font-body); cursor: pointer; }

/* Undo message (src/components/undoToast.js). Above the phone bar, clear of the home indicator. */
.undo-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 140; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(560px, calc(100vw - 32px));
  padding: 10px 10px 10px 16px; border-radius: 12px; background: #1a1a1a; color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); font-size: 15px;
}
.undo-toast.is-error { background: var(--zv-red-deep); }
.undo-msg { flex: 1; }
.undo-btn { min-height: 44px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 8px; background: transparent; color: #fff; font: 700 15px var(--font-body); cursor: pointer; }
.undo-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 767px) {
  .undo-toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Name cleanup from sales history (lib/naming.js). */
.nu-problems li.p-name::before, .nu-problems li.p-split::before { background: var(--zv-blue); }
.nu-names { margin-bottom: 8px; }
.nu-names .chip-btn { text-align: left; }
