/* ==========================================================================
   Screen and sheet layouts. Built only from the tokens and components.
   ========================================================================== */

/* ---- Boot ----------------------------------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.boot svg {
  animation: boot-in 600ms var(--ease-out) both;
}

@keyframes boot-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

.boot-error {
  padding: calc(var(--safe-t) + 48px) 24px;
  display: grid;
  gap: 12px;
}

.boot-error button {
  justify-self: start;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.inline-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin: -2px 5px 0 0;
  vertical-align: middle;
  stroke-width: 2;
}

.late-text { color: var(--hot); font-weight: 600; }
.accent-text { color: var(--accent-text); }
.caution-text { color: var(--caution); }

.more-btn {
  display: flex;
  margin: 8px auto 0;
}

.card.quiet {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--separator);
  padding: 14px 16px;
}

.row-sub.wrap {
  white-space: normal;
  overflow: visible;
}

.row-lead {
  flex: none;
  align-self: flex-start;
  padding-top: 1px;
}

.foot-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
}

/* ---- Today ---------------------------------------------------------------------- */

.card.check-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.check-card .check-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.check-card .chev {
  width: 18px;
  height: 18px;
  color: var(--text-4);
  stroke-width: 2.2;
}

.check-card.tint-caution .row-icon {
  background: var(--surface);
  color: var(--caution);
}

.meet-card {
  padding: 0;
  overflow: hidden;
}

.meet-main {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px 16px 12px;
  text-align: left;
  transition: background-color 120ms ease;
}

.meet-main:active {
  background: var(--fill-press);
}

.meet-time {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.meet-who {
  display: grid;
  gap: 1px;
}

.meet-ask {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.meet-ask p {
  margin-top: 3px;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.meet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px 14px;
}

.meet-card .tag {
  justify-self: start;
}

.fu-row {
  cursor: pointer;
  padding-right: 6px;
}

.fu-row .icon-btn {
  width: 40px;
  height: 40px;
}

.fu-row .icon-btn svg {
  width: 21px;
  height: 21px;
}

.calls-card {
  display: grid;
  gap: 16px;
}

.calls-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.calls-text {
  display: grid;
  gap: 2px;
}

.welcome {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ---- Clients ---------------------------------------------------------------------- */

.clients-tools {
  display: grid;
  gap: 12px;
  padding: 2px var(--gutter) 4px;
}

.clients-list {
  margin-top: var(--s-3);
}

.clients-list .row-trail .t-footnote {
  color: var(--text-3);
}

.clients-list .row-trail .late {
  color: var(--hot);
  font-weight: 600;
}

/* ---- Client page -------------------------------------------------------------------- */

.client-head {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 4px var(--gutter) 2px;
  text-align: center;
}

.client-head h1 {
  margin-top: 6px;
}

.client-level {
  margin-top: 8px;
}

.level-why {
  max-width: 340px;
  color: var(--text-2);
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.next-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.next-card .row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.next-card .row-icon svg {
  width: 20px;
  height: 20px;
}

.next-card.is-late .row-icon {
  background: var(--hot-tint);
  color: var(--hot);
}

.next-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.next-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.ask-card {
  display: grid;
  gap: 14px;
}

.ask-card .tag {
  justify-self: start;
}

.ask-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
  font: 400 var(--fs-callout)/var(--lh-callout) var(--font);
}

.ask-list li::marker {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.ask-one,
.ask-last {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 0.5px solid var(--separator);
}

.ask-one p,
.ask-last p {
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
  color: var(--text-2);
  white-space: pre-wrap;
}

.proofs-summary .row {
  align-items: flex-start;
  padding-top: 12px;
  padding-bottom: 12px;
}

.proofs-summary .row + .row::before {
  left: 54px;
}

.proofs-summary button.row {
  align-items: center;
}

.deal-steps .row {
  min-height: 46px;
}

.deal-steps .row + .row::before {
  left: 54px;
}

.deal-row.is-current .row-title {
  font-weight: 600;
}

.close-btn {
  color: var(--danger);
  margin-top: 6px;
}

/* ---- Numbers ------------------------------------------------------------------------ */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats .card + .card {
  margin-top: 0;
}

.stat {
  display: grid;
  gap: 2px;
  min-height: 96px;
  align-content: start;
}

.stat-value {
  font: 700 var(--fs-title1)/var(--lh-title1) var(--font-display);
  letter-spacing: var(--tracking-tight);
}

.stat-label {
  font: 500 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.stat-sub {
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font);
  color: var(--text-3);
}

.funnel {
  display: grid;
  gap: 14px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 128px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.funnel-label {
  font: 400 var(--fs-subhead)/1.2 var(--font);
  color: var(--text-2);
}

.funnel-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--fill);
  overflow: hidden;
}

.funnel-bar i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  animation: bar-grow 700ms var(--ease-out) both;
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
}

.funnel-value {
  text-align: right;
  font-weight: 600;
}

/* ---- Settings -------------------------------------------------------------------- */

.setting-row {
  gap: 10px;
}

.setting-value {
  color: var(--text-2);
  font: 400 var(--fs-subhead)/1 var(--font);
  white-space: nowrap;
}

.setting-row .stepper button {
  width: 36px;
}

.time-input,
.text-input {
  width: auto;
  min-height: 36px;
  max-width: 150px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  text-align: right;
  font-size: var(--fs-body);
}

.text-input.short {
  max-width: 80px;
}

.edit-chip {
  padding-right: 6px;
  gap: 2px;
}

.edit-chip button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--text-3);
}

.edit-chip button svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}

.add-inline {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.add-inline .input {
  min-height: 44px;
}

/* ---- Design kit --------------------------------------------------------------- */

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.swatch {
  display: grid;
  gap: 2px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font);
}

.swatch span {
  height: 54px;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--hairline);
  margin-bottom: 6px;
}

.swatch b {
  font-weight: 600;
}

.swatch small {
  color: var(--text-3);
  font-size: 11px;
}

.type-specimen {
  display: grid;
  gap: 10px;
}

.kit-stack {
  display: grid;
  gap: 14px;
}

.kit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px 8px;
  justify-items: center;
  color: var(--text);
}

.icon-grid svg {
  width: 24px;
  height: 24px;
}

.space-scale {
  display: grid;
  gap: 8px;
}

.space-scale div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.space-scale i {
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.radius-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.radius {
  display: grid;
  place-items: center;
  align-content: center;
  aspect-ratio: 1;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--separator-strong);
}

.radius small {
  color: var(--text-3);
  font-size: 11px;
}

/* ---- After-call sheet --------------------------------------------------------------- */

.reveal > div > .sheet-section {
  padding-top: var(--s-6);
}

.reveal > div > .sheet-section > .label {
  display: block;
  margin-bottom: 10px;
}

.next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.next-head .label {
  margin: 0;
}

[data-preview] {
  font: 400 var(--fs-footnote)/1 var(--font);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-preview-why] {
  margin-bottom: 12px;
}

.proofs {
  display: grid;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
  overflow: hidden;
}

.proof + .proof {
  border-top: 0.5px solid var(--separator);
}

.proof-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  text-align: left;
  transition: background-color 120ms ease;
}

button.proof-row:active {
  background: var(--fill-press);
}

.proof-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.proof-label {
  font: 500 var(--fs-callout)/var(--lh-callout) var(--font);
  letter-spacing: -0.01em;
}

.proof-hint {
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font);
  color: var(--text-3);
}

.proof-more {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px 56px;
}

.proof-more .textarea {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.flag-row {
  min-height: 44px;
  padding: 0 14px 10px 56px;
}

.flag-row .row-sub {
  color: var(--text-2);
  white-space: normal;
}

.flag-row + .row::before,
.flag-row::before {
  display: none;
}

.deciders {
  display: grid;
  gap: 8px;
}

.decider {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 6px;
}

.decider .input {
  min-height: 42px;
  padding: 9px 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.decider .icon-btn {
  width: 36px;
  height: 36px;
  color: var(--text-3);
}

.decider .icon-btn svg {
  width: 18px;
  height: 18px;
}

.met-chip {
  min-width: 86px;
  justify-content: center;
}

.met-chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.proof-more .btn-sm {
  justify-self: start;
}

.next-step {
  display: grid;
  gap: 14px;
}

.next-body {
  display: grid;
  gap: 16px;
}

.next-body .field + .field {
  margin-top: 0;
}

.date-chips {
  margin-top: 2px;
}

.pick-date {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.pick-date input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.agreed-row {
  padding: 8px 0 0;
  min-height: 52px;
}

.agreed-row::before {
  display: none;
}

.agreed-row .row-sub {
  white-space: normal;
}

/* Done state */

.done {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 4px 4px;
  text-align: center;
}

.done-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  animation: done-in 520ms var(--ease-out) both;
}

.done-mark svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.6;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw 420ms var(--ease-out) 160ms forwards;
}

@keyframes done-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.done-level {
  margin-top: 4px;
}

.done-why {
  max-width: 330px;
  color: var(--text-2);
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.done-next {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-top: 6px;
  text-align: left;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.done-msg {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  text-align: left;
}

/* Lead card, send flow, pickers */

.lead-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px 0 18px;
  text-align: center;
}

.lead-card .avatar {
  margin-bottom: 6px;
}

.lead-phone {
  margin-top: 8px;
}

.lead-note {
  max-width: 320px;
}

.send-who {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 12px;
}

.sticky-search {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 10px;
  background: var(--surface-sheet);
}

.pick-list {
  background: transparent;
}

.pick-list .row {
  padding-left: 2px;
  padding-right: 2px;
}

.import-pick {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 12px 8px;
  text-align: center;
}

.import-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.import-icon svg {
  width: 26px;
  height: 26px;
}

.file-btn {
  margin: 8px 0 4px;
}

.map-row {
  gap: 12px;
}

.map-select {
  width: auto;
  min-height: 36px;
  max-width: 170px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-subhead);
  text-align: right;
}

.client-form .group {
  background: var(--fill);
}

.progress {
  margin-bottom: 4px;
}

/* ---- Keyboard open: lift sheets above it ------------------------------------------- */

.kb-open .sheet {
  bottom: var(--kb);
  max-height: calc(100% - var(--kb) - var(--safe-t) - 10px);
  transition: bottom 120ms ease;
}

.kb-open .sheet.tall {
  height: calc(100% - var(--kb) - var(--safe-t) - 10px);
}

.kb-open .sheet-foot {
  padding-bottom: 12px;
}

@media (min-width: 760px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.sheet-body > .notice + .sheet-section,
.sheet-body > .notice + .group {
  margin-top: var(--s-5);
}

.setting-row .row-title,
.setting-row .row-sub {
  white-space: normal;
}
