/* Daylight — the look Alex picked on Oct 8 2026: today's warm colours, tidied into an iPhone-native
   feel (large titles, grouped lists, filled controls, sheets that slide). Loaded last:
   tokens.css → app.css → mobile.css → daylight.css. Tokens only; the screens' own stylesheets keep
   their layout, this file sets the shared look and the flow rules (transitions, sheets, tap safety). */

/* ---------- Shared look (all widths) ---------- */
.eyebrow { font: 700 12px/1.2 var(--font-ui); letter-spacing: 0.06em; color: var(--text-3); }
.card { border-color: color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--r-group); box-shadow: 0 1px 2px rgba(20, 18, 14, 0.04); }
.btn { border-radius: 12px; }
.btn.sm { border-radius: 10px; }
.btn.primary { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
.segmented { background: var(--fill); border-radius: 12px; padding: 3px; }
.segmented button { border-radius: 9px; }
.segmented button.active { box-shadow: 0 1px 3px rgba(20, 18, 14, 0.12), 0 0 0 0.5px rgba(20, 18, 14, 0.04); }
.input, .select, .textarea { border-radius: 12px; }
.input.sm, .select.sm { border-radius: 10px; }
.chip.active { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.table-wrap { border-radius: var(--r-group); }
.skeleton { border-radius: 8px; }

/* ---------- Grouped lists (iPhone Settings / Contacts) ----------
   <div class="group-title">Needs you now · 2</div>
   <div class="group"><a class="g-row">…</a><a class="g-row">…</a></div> */
.group-title { display: flex; align-items: baseline; gap: 6px; margin: 22px 4px 8px; font: 700 13px/1.2 var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.group-title:first-child { margin-top: 4px; }
.group-title > a, .group-title > button { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 14px; color: var(--accent-ink); background: none; border: 0; padding: 10px 0; margin-block: -10px; }
.group { background: var(--surface); border-radius: var(--r-group); overflow: hidden; box-shadow: 0 1px 2px rgba(20, 18, 14, 0.04); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.group + .group { margin-top: 12px; }
.g-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; color: inherit; background: var(--surface); width: 100%; border: 0; text-align: left; font: inherit; transition: background var(--dur-1); }
.g-row + .g-row::before, .g-row + .g-swipe::before, .g-swipe + .g-row::before, .g-swipe + .g-swipe::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); height: 1px; background: var(--line); z-index: 1; }
a.g-row:hover, button.g-row:hover { background: var(--surface-2); text-decoration: none; }
a.g-row:active, button.g-row:active { background: var(--surface-3); }
.g-row__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.g-row__title { font-weight: 650; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.g-row__sub { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-row__end { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.g-row__value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.g-row__meta { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; }
.g-row__chev { color: var(--text-3); flex: 0 0 auto; }
.g-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: 0 0 32px; background: var(--ic, var(--accent)); }
.g-icon svg { width: 18px; height: 18px; }
/* Initials avatar, tinted with the stage colour: fast to scan, no photo to wait for */
.ini { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: grid; place-items: center; font: 700 15px/1 var(--font-ui);
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); color: color-mix(in srgb, var(--c, var(--accent)) 82%, var(--text)); }
.ini.lg { width: 96px; height: 96px; flex-basis: 96px; font-size: 32px; }
.g-empty { padding: 18px 16px; color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- First open: the app's shape in grey instead of a spinner ---------- */
.boot { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.boot__bar { display: flex; align-items: center; gap: 12px; height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 16px 0; }
.boot__bar .brand__mark { width: 32px; height: 32px; border-radius: 10px; }
.boot__page { flex: 1; width: min(720px, 100%); margin: 0 auto; padding: 18px 16px; }
.boot__card { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-bottom: 12px; background: var(--surface); border-radius: var(--r-group); }
.boot__tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px; padding: 12px 22px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.boot__tabs .skeleton { height: 30px; border-radius: 10px; }

/* ---------- Screen transitions (router.js runs every route change in a View Transition) ----------
   The bars are their own layers so they hold still while the page slides underneath. */
.mobile-nav { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }
.sidebar { view-transition-name: sidebar; }
::view-transition-group(tabbar), ::view-transition-group(topbar), ::view-transition-group(sidebar) { animation-duration: 0s; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  html[data-nav="forward"]::view-transition-old(root) { animation: 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both vt-push-out; }
  html[data-nav="forward"]::view-transition-new(root) { animation: 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both vt-push-in; }
  html[data-nav="back"]::view-transition-old(root) { animation: 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both vt-pop-out; z-index: 2; }
  html[data-nav="back"]::view-transition-new(root) { animation: 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both vt-pop-in; }
  html[data-nav="tab"]::view-transition-old(root) { animation: 140ms ease-out both vt-fade-out; }
  html[data-nav="tab"]::view-transition-new(root) { animation: 180ms ease-out both vt-fade-in; }
}
@keyframes vt-push-out { to { transform: translateX(-26%); opacity: 0.7; } }
@keyframes vt-push-in { from { transform: translateX(100%); } }
@keyframes vt-pop-out { to { transform: translateX(100%); } }
@keyframes vt-pop-in { from { transform: translateX(-26%); opacity: 0.7; } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
/* With real transitions the page's own fade-up entrance would play twice; keep it only as the fallback. */
@supports (view-transition-name: none) { .page { animation: none !important; } }

/* ---------- Sheets: rise, settle, and slide back down ---------- */
.drawer__body, .modal__panel, .palette__list, .menu { overscroll-behavior: contain; }
@media (max-width: 900px) {
  .drawer, .modal__panel { border-radius: 22px 22px 0 0; }
  .drawer { animation: sheet-up 320ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
  .modal__panel { animation: sheet-up 300ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
  .drawer.is-closing, .modal__panel.is-closing { transform: translateY(105%) !important; transition: transform 190ms cubic-bezier(0.4, 0, 1, 1) !important; animation: none !important; }
  .overlay { animation: fade 240ms both; }
  .overlay.is-closing { opacity: 0; transition: opacity 190ms; animation: none; }
  .modal__grab { height: 24px; touch-action: none; }
  /* Edge swipe back (installed app): the page follows the finger */
  .main { transition: transform 170ms var(--ease-out); }
  .main.swiping { transition: none; box-shadow: -12px 0 32px rgba(20, 18, 14, 0.14); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- Phones: large titles, quieter chrome, safe areas ---------- */
@media (max-width: 900px) {
  .page { padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
  .page-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
  .page-head .sub { font-size: 14px; }
  .topbar { border-bottom-color: color-mix(in srgb, var(--line) 60%, transparent); background: color-mix(in srgb, var(--bg) 82%, transparent); }
  .search-trigger { background: var(--fill); border-color: transparent; }
  .leads-bar .leads-search .input, .page .input[type="search"] { background: var(--fill); border-color: transparent; }
  .card { border-color: transparent; }
  .card__head { border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent); }
  .group { border-color: transparent; }
  .toast { border-radius: 14px; }
}

/* ---------- Tap safety (Apple's 44pt) ---------- */
@media (pointer: coarse) {
  a, button, [role="button"], label, summary { touch-action: manipulation; }
  .btn, .btn.sm { min-height: var(--tap); }
  .btn.icon, .btn.icon.sm { min-width: var(--tap); }
  .btn.xs { min-height: 36px; }
  .chip { height: 38px; }
  .segmented button { min-height: 40px; }
  .tabs button { height: 46px; }
  .check { min-height: var(--tap); }
  .menu button, .menu a { min-height: 48px; }
  .btn:active, .chip:active { transform: scale(0.97); }
}

/* ---------- Phones: one nav (tab bar + More), iOS top bar ---------- */
@media (max-width: 900px) {
  /* Top bar: back button left, icons right (search · + · bell). The ☰ menu is gone. */
  .topbar { gap: 2px; padding-inline: max(6px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-right, 0px)); }
  .topbar__spacer { flex: 1 1 auto; }
  .topbar__back { display: inline-flex; align-items: center; gap: 0; flex: 1 1 auto; min-width: 0; max-width: 60%; height: var(--tap); padding: 0 8px 0 2px; border: 0; background: none; color: var(--accent-ink); font-weight: 600; font-size: 17px; margin-right: auto; }
  .topbar__back svg { flex: 0 0 auto; margin-right: -2px; }
  .topbar__back:active { opacity: 0.55; }
  .topbar .search-trigger { order: 0; flex: 0 0 var(--tap); width: var(--tap); height: var(--tap); padding: 0; justify-content: center; background: transparent; border: 0; color: var(--accent-ink); }
  .topbar .search-trigger > span { display: none !important; }
  .topbar .search-trigger svg { width: 22px; height: 22px; }
  .topbar__end { margin-left: 0; }
  .topbar__end .btn.ghost { color: var(--accent-ink); }
  .topbar__add svg { stroke-width: 2.4; }

  /* Tab bar: classic edge-to-edge, frosted, amber when active, red badge for unread */
  .mobile-nav { padding: 4px 4px calc(env(safe-area-inset-bottom, 0px) + 2px); background: color-mix(in srgb, var(--surface) 88%, transparent); border-top: 1px solid color-mix(in srgb, var(--line) 90%, transparent); }
  .mobile-nav a { gap: 1px; font-size: 11px; font-weight: 600; color: var(--text-3); min-height: 50px; }
  .mobile-nav a .ico { width: 44px; height: 30px; border-radius: 0; background: none !important; }
  .mobile-nav a.active { color: var(--accent-ink); }
  .mobile-nav a.active svg { stroke-width: 2.3; }
  .mobile-nav .badge { top: -2px; right: 4px; min-width: 19px; height: 19px; border: 2px solid var(--surface); box-sizing: content-box; }

  /* More page */
  .more-page .group .segmented button { min-width: 54px; }
  .more-signout .g-row__title { color: var(--bad-ink); text-align: center; }
}

/* "Viewing as" banner (0211): above the top bar on office screens, inside the crew sheet on crew
   screens. Clears the notch on phones and wraps instead of clipping the Exit button. */
.view-as-banner { flex-wrap: wrap; gap: 8px 12px; }
.view-as-banner .grow { min-width: 0; flex: 1 1 200px; }
.view-as-banner--shell { border-radius: 0; margin: 0; padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px)); }
.view-as-banner__ro { font-weight: 400; }
.view-as-banner--shell + .topbar { padding-top: 0; }
/* Permissions sheet: every toggle is a full-width row with a 44px target. */
.perm-list { display: flex; flex-direction: column; gap: 10px; }
.perm-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-height: 44px; cursor: pointer; }
.perm-row input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; }
.perm-row[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.perm-row__t { font-weight: 600; }
.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
