/* Area: settings — styles for src/next/areas/settings.js views. Tokens only (see next.css :root). */

/* autosave state bar — mandatory (a silent failed save once went unnoticed for two hours) */
.set-bar { position: sticky; top: 150px; z-index: 10; display: flex; align-items: center; gap: 12px; margin: 0 0 20px; padding: 10px 18px; border-radius: var(--pill); background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 15px; width: fit-content; max-width: 100%; }
.set-bar .dot { background: var(--good); }
.set-bar.dirty .dot, .set-bar.saving .dot { background: var(--warn); }
.set-bar.invalid, .set-bar.error { background: var(--alert-soft); color: var(--alert); }
.set-bar.invalid .dot, .set-bar.error .dot { background: var(--alert); }
.phone .set-bar { top: 70px; }

.set-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.phone .set-grid { grid-template-columns: 1fr; }
.set-nav { position: sticky; top: 210px; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; color: var(--ink-2); }
.set-nav a:hover { background: var(--card); color: var(--ink); }
.set-sec { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 220px; }
.set-me { display: flex; gap: 14px; align-items: center; }
.set-err { font-style: normal; font-size: 14px; font-weight: 700; color: var(--alert); }
.set-note { font-style: normal; font-size: 14px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.set-note svg { width: 16px; height: 16px; }
.field input[aria-invalid="true"], .set-link input[aria-invalid="true"] { border-color: var(--alert); background: var(--alert-soft); }
.field input:disabled { background: var(--sunk); color: var(--ink-2); }
.set-calc { margin: 0; font-weight: 600; color: var(--ink-2); }
.set-photo { display: flex; align-items: center; gap: 16px; }
.set-photo-img { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--olive-soft); color: var(--olive-deep); font-weight: 800; font-size: 24px; flex: none; }
.set-photo-img img { width: 100%; height: 100%; object-fit: cover; }
.set-link { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 10px; align-items: center; }
.phone .set-link { grid-template-columns: 1fr auto; }
.phone .set-link input:first-child { grid-column: 1 / -1; }
.set-link input, .set-sender-add input { min-height: 50px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; min-width: 0; width: 100%; }
.set-link input:focus, .set-sender-add input:focus { outline: 0; border-color: var(--olive); }
.set-push { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-md); background: var(--card-2); font-weight: 600; }
.set-push.needs-install, .set-push.blocked { background: var(--warn-soft); color: var(--warn); }
.set-push.on { background: var(--good-soft); color: var(--good); }
.set-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1.5px solid var(--line); font-weight: 600; cursor: pointer; }
.set-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.set-toggle i { width: 52px; height: 30px; border-radius: 15px; background: var(--sunk); position: relative; flex: none; transition: background .15s ease; }
.set-toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); transition: transform .15s ease; }
.set-toggle input:checked + i { background: var(--olive); }
.set-toggle input:checked + i::after { transform: translateX(22px); }
.set-toggle input:focus-visible + i { outline: 3px solid var(--olive); outline-offset: 2px; }
.set-meter { height: 12px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.set-meter i { display: block; height: 100%; background: var(--olive); }
.set-arm.armed, .btn.armed { background: var(--alert); border-color: var(--alert); color: var(--on-dark); }
.set-check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.set-check input { width: 20px; height: 20px; accent-color: var(--olive); }
.count-pill { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--olive); color: var(--on-dark); font-size: 14px; font-weight: 800; }


/* import */
.imp-drop { align-items: center; text-align: center; padding: 48px 24px; }
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.imp-table { display: flex; flex-direction: column; }
.imp-row { display: grid; grid-template-columns: 36px minmax(0, 1.3fr) minmax(0, 1.3fr) 150px 140px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1.5px solid var(--line); }
.imp-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--olive); }
.imp-row select { min-height: 42px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); padding: 0 10px; width: 100%; }
.imp-head { font-size: 14px; font-weight: 700; color: var(--ink-2); border-top: 0; }
.imp-row.dupe { opacity: .7; }
.phone .imp-row { grid-template-columns: 30px minmax(0, 1fr) 120px; }
.phone .imp-row > :nth-child(3), .phone .imp-row > :nth-child(5) { display: none; }

/* reports */
.rep-table { display: flex; flex-direction: column; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 60px 1fr 1fr 70px; gap: 10px; padding: 12px 0; border-top: 1.5px solid var(--line); align-items: center; }
.rep-head { font-size: 14px; font-weight: 700; color: var(--ink-2); border-top: 0; }
.phone .rep-row { grid-template-columns: minmax(0, 1.2fr) 40px 1fr 60px; }
.phone .rep-row > :nth-child(3) { display: none; }
.rep-form { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr auto; gap: 10px; align-items: end; }
.phone .rep-form { grid-template-columns: 1fr 1fr; }

/* community */
.com-state { min-width: 200px; }
.com-state select { min-height: 42px; }
.com-post { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.com-post:hover { box-shadow: var(--shadow-lift); }
.com-by { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.com-reply { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 12px 0; border-top: 1.5px solid var(--line); }
.com-reply .when { font-size: 14px; color: var(--ink-2); }
.com-form { margin-bottom: 18px; }

/* more */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.phone .more-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
.more-tile { display: flex; align-items: center; gap: 14px; text-decoration: none; position: relative; }
.phone .more-tile { flex-direction: column; align-items: flex-start; }
.more-tile .count-pill { position: absolute; top: 16px; right: 16px; }
.more-kpi { text-decoration: none; }
.more-kpi:hover, .more-tile:hover { box-shadow: var(--shadow-lift); }

/* ---------- Lead spend (2026-09-25 redesign) ---------- */
.spend-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spend-total { font-size: 16px; }
.spend-total b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-left: 6px; }
.spend-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.spend-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: var(--pill); background: var(--card-2); border: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.spend-chip b { font-weight: 800; }
.spend-log { display: grid; gap: 18px; }
.spend-mh { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 15px; }
.spend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.spend-row:last-child { border-bottom: 0; }
.spend-what { display: flex; flex-wrap: wrap; column-gap: 10px; row-gap: 2px; align-items: baseline; min-width: 0; }
.spend-what b { font-size: 16px; }
.spend-what .muted { font-size: 15px; }
.spend-amt { font-size: 16px; text-align: right; }
.spend-x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); display: grid; place-items: center; padding: 0; justify-self: end; font-size: 14px; font-weight: 700; }
.spend-x svg { width: 14px; height: 14px; }
.spend-x:hover { border-color: var(--ink-3); color: var(--ink); }
.spend-x.armed { width: auto; padding: 0 12px; border-radius: var(--pill); background: var(--alert-soft); border-color: var(--alert); color: var(--alert); white-space: nowrap; }
.spend-form { display: grid; grid-template-columns: minmax(0, 1.2fr) 170px 130px minmax(0, 1.4fr) auto; gap: 12px; align-items: end; padding-top: 18px; border-top: 1px solid var(--line); }
.spend-form .field { min-width: 0; }
.money-in { position: relative; display: block; }
.money-in > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--ink-2); pointer-events: none; }
.money-in input { padding-left: 30px; width: 100%; }
.spend-add { min-height: 50px; }
.phone .spend-form { grid-template-columns: 1fr 1fr; }
.phone .spend-add { grid-column: 1 / -1; }
.phone .spend-row { grid-template-columns: minmax(0, 1fr) auto 36px; }

/* ---------- report feeds ---------- */
.rep-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.rep-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-md); background: var(--card-2); }
.rep-kpis b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.rep-kpis span { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.rep-sub { margin: 18px 0 6px; }
.rep-list { display: grid; }
.rep-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.rep-item:last-child { border-bottom: 0; }
/* ⚠️ `:not(.av)` - the avatar is a direct span child too, and this rule used to turn it into a flex
   column with its initials at the top (2026-10-22). `.av.av` in next.css now outranks it either way. */
.rep-item > span:not(.av) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rep-item .muted { font-size: 14px; }
.rep-item:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- the bell ---------- */
.alert-list { display: grid; }
.alert-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 10px; gap: 12px; align-items: center; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.alert-row:last-child { border-bottom: 0; }
.alert-row.unread { color: var(--ink); font-weight: 700; }
.alert-row:hover { background: var(--card-2); }
.alert-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-t .muted { font-size: 14px; font-weight: 500; }

/* task history in the task sheet (lives with the data it reads) */
.info-history { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.info-history p { margin: 0; font-size: 15px; }
.info-history .muted { font-size: 14px; }
.spend-form input { width: 100%; min-width: 0; }
/* the card is half the page: two clean rows — Source · Spent on · Amount, then Note · Add */
.spend-form { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.spend-form > .field:nth-of-type(1), .spend-form > .field:nth-of-type(2), .spend-form > .field:nth-of-type(3) { grid-column: span 2; }
.spend-form > .field:nth-of-type(4) { grid-column: span 5; }
.spend-form > .spend-add { grid-column: span 1; }
.phone .spend-form { grid-template-columns: 1fr 1fr; }
.phone .spend-form > .field:nth-of-type(n) { grid-column: span 1; }
.phone .spend-form > .spend-add { grid-column: 1 / -1; }
.phone .rep-kpis { grid-template-columns: 1fr 1fr; }
.phone .rep-kpis > div:last-child { grid-column: 1 / -1; }
.phone .rep-feeds > * { align-self: stretch; }

/* Partners in the app (0113): two switches, off by default */
.set-switches { display: flex; flex-direction: column; gap: 4px; }
.set-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: var(--hair); font-size: 16px; font-weight: 600; }
.set-switch-row:first-child { border-top: 0; }
.set-switch { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 4px 14px 4px 4px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--sunk); font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; }
.set-switch .knob { width: 32px; height: 32px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); }
.set-switch.on { background: var(--accent, var(--olive)); border-color: var(--accent, var(--olive)); color: var(--on-dark); flex-direction: row-reverse; padding: 4px 4px 4px 14px; }

/* Reports (2026-09-29, "this whole page is messed up"): one two-column flow, each column stacks its own cards,
   so the tall lead-spend ledger never leaves a hole beside a short card */
.rep-cols { columns: 2; column-gap: 24px; }
.rep-cols > section { break-inside: avoid; display: block; width: 100%; margin: 0 0 24px; }
@media (max-width: 1100px) { .rep-cols { columns: 1; } }

/* Settings → Calendar (2026-09-29): three calm rows, one main button each */
.cal-set { display: flex; flex-direction: column; }
.cal-set-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 20px 0; border-top: 1px solid var(--line); }
.cal-set-row:first-child { border-top: 0; padding-top: 6px; }
.cal-set-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); color: var(--ink); }
.cal-set-ic svg { width: 20px; height: 20px; }
.cal-set-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-set-main > b { font-size: 17px; }
.cal-set-main > .muted { font-size: 15px; line-height: 1.45; }
.cal-set-act { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.cal-set-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cal-set-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-2); }
.cal-set-item > span:not(.av) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-set-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.cal-set-add input { min-height: 48px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; min-width: 0; width: 100%; }
.cal-set-how { font-size: 15px; color: var(--ink-2); }
.cal-set-how summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.cal-set-how p { margin: 8px 0 0; line-height: 1.5; }
@media (max-width: 760px) {
  .cal-set-row { grid-template-columns: 40px minmax(0, 1fr); }
  .cal-set-act { grid-column: 1 / -1; justify-content: flex-start; }
  .cal-set-add { grid-template-columns: 1fr; }
}

/* Settings → Client experience (2026-09-29): a phone-icon preview, the icon + name, the portal's own look */
.cx-app { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.cx-phone { display: grid; justify-items: center; gap: 8px; padding: 22px 26px; border-radius: 24px; background: var(--dark); min-width: 132px; }
.cx-icon { width: 76px; height: 76px; border-radius: 18px; overflow: hidden; display: grid; place-items: center; background: var(--card); color: var(--ink); font: 700 26px/1 var(--font-display); }
.cx-icon img { width: 100%; height: 100%; object-fit: cover; }
.cx-name { color: var(--on-dark); font-size: 14px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-fields { display: grid; gap: 14px; flex: 1 1 260px; min-width: 0; justify-items: start; }
.cx-fields .field { width: 100%; max-width: 360px; }
.cx-h { margin: 28px 0 12px; }
.cx-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cx-look { display: grid; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); cursor: pointer; text-align: left; font: inherit; min-width: 0; }
.cx-look.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cx-sw { display: grid; place-items: center; height: 76px; border-radius: 10px; }
.cx-card { display: grid; gap: 5px; width: 64%; padding: 9px 10px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cx-card i { display: block; height: 5px; border-radius: 3px; }
.cx-card i + i { width: 70%; }
.cx-card b { display: block; width: 38%; height: 9px; border-radius: 5px; margin-top: 2px; }
.cx-l { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.cx-l svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
@media (max-width: 600px) { .cx-looks { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cx-app { gap: 18px; } }

/* Client experience: a live preview of the portal in the picked look (2026-09-29) */
.cx-look-wrap { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .cx-look-wrap { grid-template-columns: 250px minmax(0, 1fr); } .cx-prev { position: sticky; top: 110px; } }
.cx-prev { margin: 0; width: 250px; max-width: 100%; justify-self: center; border-radius: 34px; padding: 10px; background: var(--ink); box-shadow: 0 18px 40px rgb(0 0 0 / .22); }
.cx-prev > div, .cx-prev .cx-prev-dock { background: var(--p-ground); color: var(--p-ink); font-family: var(--p-font); }
.cx-prev-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; border-radius: 24px 24px 0 0; font-family: var(--p-font-display); font-size: 14px; }
.cx-prev-av { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--p-card); border: 1px solid var(--p-line); font-size: 14px; font-weight: 700; }
.cx-prev-body { padding: 4px 14px 14px; display: grid; gap: 10px; }
.cx-prev-hi { margin: 4px 0 0; font-family: var(--p-font-display); font-weight: 800; font-size: 24px; line-height: 1.02; letter-spacing: -.02em; }
.cx-prev-hi span { color: var(--p-accent); }
.cx-prev-eyebrow { margin: 0; font-size: 14px; font-weight: 700; color: var(--p-ink-2); }
.cx-prev-card { border-radius: 16px; overflow: hidden; background: var(--p-card); border: 1px solid var(--p-line); }
.cx-prev-photo { height: 92px; background: linear-gradient(135deg, color-mix(in srgb, var(--p-accent) 55%, var(--p-line)), color-mix(in srgb, var(--p-accent) 20%, var(--p-card))); position: relative; }
.cx-prev-photo span { position: absolute; left: 10px; top: 10px; padding: 2px 10px; border-radius: 999px; background: var(--p-accent); color: var(--p-card); font-size: 14px; font-weight: 700; }
.cx-prev-in { display: grid; gap: 2px; padding: 10px 12px 12px; }
.cx-prev-in b { font-size: 17px; }
.cx-prev-in span { font-size: 14px; font-weight: 700; }
.cx-prev-in small, .cx-prev-row small { font-size: 14px; color: var(--p-ink-2); }
.cx-prev-btns { display: flex; gap: 6px; margin-top: 6px; }
.cx-prev-btns i { font-style: normal; font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--p-line); background: var(--p-ground); }
.cx-prev-btns i:first-child { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-card); }
.cx-prev-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--p-card); border: 1px solid var(--p-line); }
.cx-prev-row > span:last-child { display: grid; font-size: 14px; }
.cx-prev-cal { display: grid; place-items: center; width: 40px; height: 44px; border-radius: 10px; background: var(--p-dark); color: var(--p-on-dark); font-weight: 800; font-size: 17px; line-height: 1; }
.cx-prev-cal small { font-size: 14px; color: var(--p-on-dark); opacity: .8; }
.cx-prev-dock { display: flex; justify-content: space-around; padding: 12px 18px 16px; border-radius: 0 0 24px 24px; border-top: 1px solid var(--p-line); }
.cx-prev-dock i { width: 22px; height: 22px; border-radius: 50%; background: var(--p-line); }
.cx-prev-dock i.on { background: var(--p-ink); }
.cx-prev figcaption { color: var(--card); text-align: center; font-size: 14px; font-weight: 600; padding: 10px 0 4px; }

/* Settings → Email (Tovah, 2026-09-29: "make this look better") */

/* ★ THE SAME ROWS, INSIDE THE CALENDAR SETTINGS SHEET (Tovah, 2026-10-30, screenshot: the title
   reading one word per line with the buttons on top of it).
   v593 made the sheet render the Settings page's real rows instead of a thinner copy - which was
   right, and left them in a container less than half the width they were drawn for. The third
   column is `auto`, so the buttons take their natural width first and `minmax(0, 1fr)` gets
   whatever is left, which at sheet width is almost nothing.
   ⚠️ Scoped to the sheet, not fixed on the row: the Settings page is wide and its three-column row
   is right there. One body, two frames, and the frame sets the shape.
   ⚠️ `.sheet`, NOT `#sheet`. app.js:366 writes `<div class="sheet">` into the layer - there is no
   element with that id, so the first version of these four rules matched nothing at all and the
   screenshot would not have changed. */
.sheet .cal-set-row { grid-template-columns: 44px minmax(0, 1fr); row-gap: 14px; padding: 18px 0; }
.sheet .cal-set-act { grid-column: 2; justify-content: flex-start; }
.sheet .cal-set-main > b { font-size: 16px; }
.sheet .cal-set-add { flex-wrap: wrap; }
