/* ============================================================================
   PiE App Layer  ·  shared app-shell components
   Loaded AFTER pie-design.css by the product surfaces (index.html, admin.html).
   One canonical version of each component that previously drifted between the
   app and the admin console: modal, toast, stat card, chips, segmented
   controls, spinner/empty states, page head, card head/body, kv, login boxes.
   Marketing keeps pie-design.css alone; portals join in Phase 4.
   ============================================================================ */

body { background: var(--bg-soft); }

/* ---- user chip (top-bar identity) ---- */
.userchip { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.userchip .nm { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .rl { font-size: var(--fs-xs); color: var(--muted); text-transform: capitalize; }

/* ---- page head ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.crumb { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- cards with header / body ---- */
.card { padding: 0; }
.card-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: var(--fs-h3); }
.card-h .h-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-b { padding: 20px; }
.card-b.flush { padding: 0; }

/* ---- stat cards (one canonical card; .n/.l = app names, .stat-num/.stat-label
   = admin names — same component, both spellings resolve to the same look) ---- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat .n, .stat .stat-num { font-size: var(--fs-num-lg); font-weight: 700; line-height: 1.05;
  letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .l, .stat .stat-label { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600; }
.stat .l { margin-top: 8px; }
.stat .stat-label { margin: 0 0 8px; font-weight: 700; }
.stat .stat-foot { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }
.stat .stat-foot b { color: var(--pie-maroon); font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.red .n { color: var(--red); } .stat.amber .n { color: var(--amber); } .stat.green .n { color: var(--green); }
/* Stat tiles as real links (Today): whole card clickable, hover lift,
   visible keyboard focus. Tokens only, so both themes come along. */
a.stat { display: block; color: inherit; text-decoration: none;
  transition: box-shadow .12s var(--ease, ease), border-color .12s var(--ease, ease), transform .12s var(--ease, ease); }
a.stat:hover { border-color: var(--line-strong, var(--line)); box-shadow: var(--shadow, var(--shadow-sm)); transform: translateY(-1px); }
a.stat:focus-visible { outline: none; border-color: var(--pie-maroon); box-shadow: var(--ring); }

/* ---- key/value + section titles ---- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 12px 16px; font-size: var(--fs-sm); }
.kv .k { color: var(--muted); }
.kv .v { color: var(--ink); }
.sectiontitle { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 12px; }

/* ---- segmented controls (one control, three legacy spellings: .segmented =
   filters, .lang-toggle = EN/ES, .composer-toggle = channel picker) ---- */
.segmented, .lang-toggle, .composer-toggle { display: inline-flex; border: 1px solid var(--line);
  border-radius: var(--r-pill); overflow: hidden; background: var(--bg-soft); }
.segmented { margin-bottom: 18px; }
.composer-toggle { margin-bottom: 16px; }
.segmented button, .lang-toggle button, .composer-toggle button { border: none; background: none;
  cursor: pointer; font: inherit; font-weight: 600; color: var(--ink-2); line-height: 1.2;
  display: inline-flex; align-items: center; gap: 6px; transition: background .12s, color .12s; }
.segmented button { font-size: var(--fs-sm); padding: 7px 16px; }
.lang-toggle button { font-size: var(--fs-xs); padding: 5px 11px; }
.composer-toggle button { font-size: var(--fs-sm); padding: 6px 16px; }
.segmented button.active, .lang-toggle button.active, .composer-toggle button.active {
  background: var(--accent-bg); color: #fff; }
.segmented button:not(.active):hover, .lang-toggle button:not(.active):hover,
.composer-toggle button:not(.active):hover { color: var(--ink); }

/* ---- chips ---- */
.pill { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink-2); }

/* ---- document-type tag chip (kind + kindSource) ----
   Rides the design-system .badge look; auto-tagged ('ai'/'heuristic') gets a
   dotted underline hint, user/default render plain. The button variant is
   the staff+ click-to-correct affordance; on coarse pointers the hit area is
   expanded to >=44px without inflating the visual chip. */
.kind-chip-host { display: inline-flex; align-items: center; }
button.kind-chip { font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
button.kind-chip:hover, button.kind-chip:focus-visible { color: var(--ink); border-color: var(--ink-2); }
.kind-chip.auto { text-decoration: underline dotted; text-underline-offset: 3px; }
.kind-chip.unset { border-style: dashed; }
.kind-select { width: auto; min-width: 160px; font-size: var(--fs-sm); padding: 4px 8px; }
@media (pointer: coarse) {
  .kind-chip { position: relative; }
  button.kind-chip::after { content: ""; position: absolute; inset: -12px; }
  .kind-select { min-height: 44px; }
}

/* ---- tables: shared niceties on top of the design-system .table ---- */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-soft); }

/* ---- forms ---- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
textarea { min-height: 90px; resize: vertical; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

/* ---- modal (single canonical dialog: one scrim token, one z-plane) ---- */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-start;
  justify-content: center; padding: 48px 16px; z-index: 80; overflow: auto; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 720px; }
.modal .m-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal .m-h h2, .modal .m-h h3 { margin: 0; }
.modal .m-b { padding: 22px; }
.modal .m-f { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--ink); }

/* ---- toast (canonical: errors are --red, never brand maroon) ---- */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: 12px 16px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); animation: slideup .2s var(--ease); }
.toast.err { background: var(--error); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }
[data-theme="dark"] .toast.err, [data-theme="dark"] .toast.ok { color: #101215; }
@keyframes slideup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- states ---- */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty.in-card { padding: 32px 20px; }
.empty .big { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty p { margin: 6px 0 14px; }
.empty p:last-child { margin-bottom: 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--pie-maroon);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px; }
.btn-ghost .inline-spin { border-color: var(--brand-border); border-top-color: var(--pie-maroon); }
.btn-gold .inline-spin { border-color: rgba(0,0,0,.18); border-top-color: #2a2310; }

/* ---- login (shared shell; each surface keeps its own card internals) ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1100px 560px at 70% -10%, var(--pie-maroon-50), transparent), var(--bg-soft); }
.login-err { background: var(--red-bg); color: var(--red-ink); padding: 10px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); margin-bottom: 16px; }
.login-note { background: var(--amber-bg); color: var(--amber-ink); padding: 10px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); margin-bottom: 16px; }
input.code-input, .code-input { letter-spacing: 10px; text-align: center; font-size: 24px; }

/* ---- document viewer (full-screen modal variant + preview stage) ----
   Rides on the canonical modal: openModal() output gets .viewer / .viewer-bg
   added, so focus trap, dirty guard, Escape and focus-restore are inherited. */
.modal-bg.viewer-bg { padding: 16px; align-items: stretch; }
.modal.viewer { max-width: none; width: 100%; height: calc(100vh - 32px); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; }
.modal.viewer .m-h { flex-wrap: wrap; row-gap: 8px; }
.modal.viewer .m-h h3 { flex: 1 1 auto; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal.viewer .m-b { flex: 1 1 auto; overflow: auto; display: flex; flex-direction: column; }
.dv-root { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.dv-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dv-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dv-vbadge { flex: none; white-space: nowrap; }
.dv-layout { flex: 1 1 auto; display: flex; gap: 16px; min-height: 0; align-items: stretch; }
.dv-stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 40vh; }
.dv-frame { flex: 1 1 auto; width: 100%; min-height: 50vh; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--bg-soft); }
.dv-fallback { margin-top: 8px; }
.dv-img-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; overflow: auto;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.dv-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dv-text { flex: 1 1 auto; overflow: auto; margin: 0; padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dv-text.prose { font-family: inherit; max-width: 70ch; }
.dv-none { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 16px; border: 1px dashed var(--line); border-radius: var(--r); }
.dv-none-icon { font-size: 40px; opacity: .55; margin-bottom: 10px; }
.dv-none-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.dv-none-msg { margin: 10px 0 14px; max-width: 46ch; }
.dv-none-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dv-cycle { margin: 16px 0 8px; max-width: 46ch; }
.dv-dz { margin-top: 4px; width: 100%; max-width: 420px; }
.dv-editwrap { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.dv-edit-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; }
.dv-edit-btns { display: flex; gap: 8px; }
.dv-editor { flex: 1 1 auto; width: 100%; min-height: 45vh; resize: vertical;
  font-size: var(--fs-sm); line-height: 1.6; }
.dv-editor.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dv-editor.prose { max-width: 70ch; }
.dv-versions { flex: 0 0 300px; max-width: 300px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 14px; background: var(--surface); }
.dv-vrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dv-vrow:last-child { border-bottom: 0; padding-bottom: 0; }
.dv-vrow:first-child { padding-top: 0; }
.dv-vrow-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.dv-vno { font-weight: 700; font-variant-numeric: tabular-nums; }
.dv-vnote { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dv-vact { margin-top: 8px; }
.dv-extra summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); padding: 6px 0; }
.dv-extra .ai-result { margin-top: 8px; }
@media (pointer: coarse) {
  .dv-actions .btn, .dv-edit-btns .btn, .dv-none-actions .btn, .dv-vact .btn { min-height: 44px; }
}
@media (max-width: 760px) {
  /* Full-screen sheet on phones. */
  .modal-bg.viewer-bg { padding: 0; }
  .modal.viewer, .modal.viewer.wide { height: 100vh; max-height: 100vh; border-radius: 0; border: 0; }
  .dv-layout { flex-direction: column; }
  .dv-versions { flex: none; max-width: none; overflow: visible; }
  .dv-text.prose, .dv-editor.prose { max-width: none; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .toast, .spinner, .inline-spin { animation: none !important; }
  .segmented button, .lang-toggle button, .composer-toggle button { transition: none !important; }
  a.stat { transition: none !important; }
  a.stat:hover { transform: none; }
}

/* ---- responsive (mirrors the design-system breakpoints) ---- */
@media (max-width: 760px) {
  .page-head { align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
  .stat { padding: 14px 16px; }
  .stat .n, .stat .stat-num { font-size: 28px; }

  .card-h { gap: 8px; }

  /* Modals near full screen with internal scroll; footer reachable. */
  .modal-bg { padding: 12px; align-items: stretch; }
  .modal, .modal.wide { max-width: none; width: 100%; max-height: calc(100vh - 24px);
    display: flex; flex-direction: column; }
  .modal .m-b { overflow: auto; flex: 1 1 auto; }
  .modal .m-f { flex: none; }
  .modal .m-f .btn { flex: 1 1 auto; min-height: 42px; }

  /* Toasts span comfortably without hugging a corner off-screen. */
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat .n, .stat .stat-num { font-size: 26px; }
  .kv { grid-template-columns: 120px 1fr; }
  .card-h { padding: 14px 16px; }
  .card-b { padding: 16px; }
  .modal .m-h, .modal .m-b, .modal .m-f { padding-left: 16px; padding-right: 16px; }
}

/* ---- Document viewer: extended previews (docx / spreadsheets / media) ---- */
.dv-doc { flex: 1 1 auto; overflow: auto; padding: 16px; }
.dv-doc-page { max-width: 820px; margin: 0 auto; padding: 28px 32px; line-height: 1.65; }
.dv-doc-page table { border-collapse: collapse; margin: 10px 0; }
.dv-doc-page td, .dv-doc-page th { border: 1px solid var(--line); padding: 4px 10px; }
.dv-doc-page img { max-width: 100%; }
.dv-sheet { flex: 1 1 auto; overflow: auto; padding: 12px 16px; }
.dv-sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.dv-sheet-tab { border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 5px 14px; font-size: var(--fs-sm); cursor: pointer; min-height: 32px; }
.dv-sheet-tab.active { background: var(--accent-bg, var(--pie-maroon)); border-color: transparent; color: #fff; }
.dv-sheet-holder { overflow: auto; }
.dv-sheet-table th { position: sticky; top: 0; background: var(--surface); }
.dv-sheet-table td, .dv-sheet-table th { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.dv-media { display: block; margin: 48px auto 12px; max-width: min(92%, 900px); }
.dv-video { max-height: 68vh; }
.dv-ro { text-align: center; margin: 10px 0 4px; }
@media (pointer: coarse) { .dv-sheet-tab { min-height: 44px; } }

/* ---- Today: consolidated compact KPI row (7 tiles fit one row on desktop) ---- */
.stats.compact { gap: 10px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); margin-bottom: 16px; }
.stats.compact .stat { padding: 10px 12px; }
.stats.compact .stat .n { font-size: var(--fs-num-sm, 22px); line-height: 1.15; }
.stats.compact .stat .l { font-size: var(--fs-micro, 11px); }
@media (max-width: 560px) { .stats.compact { grid-template-columns: repeat(2, 1fr); } }

/* ---- Custom reports (#/reports): list cards, builder picker, viewer grid,
   share modal. Tokens only — both themes come along for free. ---- */
.cr-section { margin-bottom: 24px; }
.cr-section .card-h .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.cr-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cr-card { display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  background: var(--surface); color: inherit; text-decoration: none;
  transition: box-shadow .12s var(--ease, ease), border-color .12s var(--ease, ease), transform .12s var(--ease, ease); }
.cr-card:hover { border-color: var(--line-strong, var(--line)); box-shadow: var(--shadow, var(--shadow-sm)); transform: translateY(-1px); }
.cr-card:focus-visible { outline: none; border-color: var(--pie-maroon); box-shadow: var(--ring); }
.cr-name { font-weight: 700; color: var(--ink); margin-bottom: 6px; overflow-wrap: anywhere; }
.cr-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cr-meta { font-size: var(--fs-xs); }
/* viewer */
.cr-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-asof { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); margin: -12px 0 14px; }
.cr-asof .linklike { background: none; border: none; padding: 0; font: inherit; font-size: var(--fs-xs);
  color: var(--pie-maroon); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cr-asof .linklike:hover { color: var(--ink); }
.cr-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cr-grid > .stats, .cr-grid > .cr-wide, .cr-grid > .spinner { grid-column: 1 / -1; }
.cr-grid > .stats { margin-bottom: 0; }
.cr-widget.cr-wide { grid-column: 1 / -1; }
.cr-chart { position: relative; height: 260px; }
.cr-note { font-size: var(--fs-xs); }
.card-b.flush .cr-note { padding: 8px 16px 14px; }
.cr-more { padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
/* builder: two-step modal + widget picker */
.cr-step { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 14px; }
.cr-client-filter { margin-bottom: 8px; }
.wpick-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wpick { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; cursor: pointer; background: var(--surface); }
.wpick:hover { border-color: var(--line-strong, var(--line)); }
.wpick.on { border-color: var(--pie-maroon); box-shadow: 0 0 0 1px var(--pie-maroon) inset; }
.wpick input[type="checkbox"] { margin-top: 3px; flex: none; }
.wpick .wp-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wpick .wp-name { font-weight: 600; color: var(--ink); font-size: var(--fs-sm); }
.wpick .wp-desc { color: var(--muted); font-size: var(--fs-xs); }
.wpick .wp-range { display: none; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.wpick.on .wp-range { display: inline-flex; }
.wp-chip { border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2); border-radius: 999px;
  padding: 2px 10px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.wp-chip:hover { color: var(--ink); }
.wp-chip.active { background: var(--accent-bg, var(--pie-maroon)); border-color: transparent; color: #fff; }
/* share modal */
.cr-vis { display: flex; flex-direction: column; gap: 8px; }
.cr-radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer; }
.cr-radio:hover { border-color: var(--line-strong, var(--line)); }
.cr-radio input { margin-top: 3px; flex: none; }
.cr-radio > span { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.cr-radio .muted { font-size: var(--fs-xs); }
.cr-people { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px;
  max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.cr-person { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); cursor: pointer; }
@media (pointer: coarse) {
  .wpick, .cr-radio, .cr-person { min-height: 44px; }
  .wp-chip { min-height: 32px; padding: 4px 12px; }
  .cr-asof .linklike { min-height: 44px; display: inline-flex; align-items: center; }
}
@media (max-width: 760px) {
  .cr-grid { grid-template-columns: 1fr; }
  .wpick-grid { grid-template-columns: 1fr; }
  .cr-people { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-card { transition: none !important; }
  .cr-card:hover { transform: none; }
}

/* ---- Personal access tokens (Siri & connected apps card on #/me) ----
   Tokens only, so both themes come along. The monospace box is the show-once
   surface: the raw token renders nowhere else in the app. */
.pat-card .card-h .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.pat-card .card-h > div:first-child { min-width: 0; flex: 1 1 240px; }
.pat-token-box { display: flex; gap: 8px; align-items: center; }
.pat-token-box input { flex: 1 1 auto; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm); letter-spacing: .02em; }
.pat-token-box .btn { flex: none; }
.pat-masknote { padding: 10px 20px 14px; border-top: 1px solid var(--line); }
@media (pointer: coarse) { .pat-token-box .btn { min-height: 44px; } }

/* ---- Sign in with Google (Admin -> Comms email setup) ----
   Monochrome "G" mark inherits the button's text color via currentColor,
   so it works on the primary (maroon) and ghost buttons in both themes. */
.g-btn { display: inline-flex; align-items: center; gap: 8px; }
.g-btn .g-ico { width: 18px; height: 18px; flex: none; }
.g-reconnect { margin-left: 6px; vertical-align: middle; }
.g-reconnect .g-ico { width: 14px; height: 14px; }
@media (pointer: coarse) { .g-btn { min-height: 44px; } }
