:root {
  /* One stacking scale (UI/UX batch A). Use these, never literal z-index > 0. */
  --z-base: 1;
  --z-raised: 2;
  --z-sticky-table: 3;
  --z-sticky-local: 4;
  --z-sticky-filters: 5;
  --z-pagebar: 44;
  --z-header: 45;
  --z-nav: 42;
  --z-popover: 50;
  --z-toast: 52;
  --z-sheet: 55;
  --z-widget: 60;
  --z-overlay: 70;
  --z-modal: 80;
  --z-modal-spot: 81;
  --z-modal-top: 82;
}

:root {
  color-scheme: light dark;
  --bg: #f4f7f2;
  --ink: #1c2b1f;
  --muted: #4d5e51;
  --card: #ffffff;
  --accent: #2f6b3a;
  --accent-soft: #e5f2e7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121814;
    --ink: #e8f0ea;
    --muted: #b7c6bb;
    --card: #1c2620;
    --accent: #8dcc98;
    --accent-soft: #24352a;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* Hash route is applied before shell.js so a reload of #live does not flash Sales or Agents. */
html[data-boot-route] #app .app-view-panel {
  display: none !important;
}

html[data-boot-route="kpis"] #view-kpis,
html[data-boot-route="sales"] #view-sales,
html[data-boot-route="live"] #view-live,
html[data-boot-route="tools"] #view-tools,
html[data-boot-route="crews"] #view-crews,
html[data-boot-route="owner"] #view-owner,
html[data-boot-route="settings"] #view-settings {
  display: block !important;
}

html:not(.has-session) body {
  background: #121816;
}

.login-hero {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #121816;
  pointer-events: none;
}

.login-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.has-session #login-hero {
  display: none !important;
}

/* Signed-in seasonal lawn. Same assets as the gate hero, barely there.
   Hidden while signed out so it does not stack on the full-bleed hero. */
.app-lawn {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.has-session .app-lawn {
  display: none;
}

.app-lawn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0.1;
  display: block;
}

#gate {
  position: relative;
  z-index: var(--z-base);
  width: min(36rem, calc(100% - 2rem));
  margin: auto;
  padding: 1.65rem 1.5rem 1.45rem;
  color: #f4f7f5;
  background: rgba(12, 18, 16, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 1rem;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

#gate .gate-logo {
  display: block;
  width: min(15rem, 70%);
  height: auto;
  margin: 0 0 1rem;
}

#gate .eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d7efe0;
}

#gate h1 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  line-height: 1.15;
  color: #f7faf8;
}

#gate .lede {
  margin: 1rem 0 0;
  color: rgba(244, 247, 245, 0.86);
}

#gate .hint {
  margin: 0.85rem 0 0;
  color: rgba(244, 247, 245, 0.78);
  font-size: 0.9rem;
}

.boot-veil {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(12, 16, 18, 0.42);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 1;
  transition: opacity 280ms ease;
  pointer-events: none;
}

.boot-veil.is-leaving {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .boot-veil {
    transition: none;
  }
}

/* Brave paints an opaque white canvas on the GIS iframe when :root is
   `light dark`. `only light` on the host makes that canvas transparent so
   filled_black sits on the frosted card. Clip fringe; do not cover the control. */
.google-button {
  width: max-content;
  max-width: 100%;
  min-height: 40px;
  margin-top: 1.25rem;
  background: transparent;
  color-scheme: only light;
  border-radius: 999px;
  overflow: hidden;
  line-height: 0;
}

.google-button > div,
.google-button iframe {
  background-color: transparent !important;
  color-scheme: only light;
  border-radius: 999px;
}

.google-button iframe {
  display: block;
  overflow: hidden;
  background-color: transparent !important;
  color-scheme: only light;
}

.message {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  background: #fdecea;
  color: #6f1d16;
}

.sign-out {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
}

.sign-out:hover {
  filter: brightness(0.97);
}

.sign-out:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.has-session #gate {
  display: none;
}

.has-session body,
.has-session {
  background: #0c1118;
}

@media (prefers-color-scheme: dark) {
  .message {
    background: #3a2422;
    color: #ffc7bf;
  }
}

@media (max-width: 40rem) {
  #gate {
    width: min(36rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    overflow: auto;
  }
}

/* ===== Signed-in shell. Gate palette stays above. ===== */
#app {
  --bg: #0c1118;
  --card: #151d2a;
  --card-sales: #141c28;
  --card-elevated: #1a2436;
  --text: #e8eef7;
  --ink: #e8eef7;
  --muted: #c5d0dc;
  --accent: #78a640;
  --accent-soft: rgba(120, 166, 64, 0.16);
  --accent-2: #5b9cff;
  --accent-2-soft: rgba(91, 156, 255, 0.14);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.1);
  --err: #f07178;
  --err-soft: rgba(240, 113, 120, 0.1);
  --line: #243044;
  /* Input and control outlines: 3.68:1 on --card, 3:1+ on --bg. */
  --border-strong: #5e808c;
  /* Text on a solid green fill: #0b1a20 on #78a640 is 6.19:1. */
  --on-accent: #0b1a20;
  --empty: #b7c4d2;
  --chip: rgba(120, 166, 64, 0.16);
  --nav-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --fab-size: 48px;
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.35);
  /* Shell colors stay dark when the OS theme is light, including native selects. */
  color-scheme: dark;
  position: relative;
  z-index: var(--z-base);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  height: 100%;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -8%, #1a2740 0%, transparent 55%),
    radial-gradient(700px 400px at 92% 0%, #14201c 0%, transparent 50%),
    transparent;
}

#app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

#app .app-header {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem 1.25rem;
  padding: 0.55rem 1.1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 30, 44, 0.72) 0%, rgba(12, 17, 24, 0.55) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(61, 214, 140, 0.06);
}

#app .header-brand {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

#app .brand-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

#app .brand-title-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.55rem;
  min-width: 0;
}

/* Official reverse (white wordmark, #78A640 grass and tagline).
   Narrow headers use the same art cropped above the tagline. */
#app .brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

#app .brand-logo-full {
  height: 4.75rem;
  max-width: min(22rem, 48vw);
}

#app .brand-logo-compact {
  display: none;
}

#app .eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

#app h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

#app .brand-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  min-width: 0;
}

#app .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(100%, 420px);
}

#app .identity-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.08rem 0.15rem 0.08rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(36, 48, 68, 0.9);
}

#app .who {
  margin: 0;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

#app .sign-out {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  min-height: 32px;
}

#app .sign-out:hover {
  filter: none;
  color: var(--text);
  text-decoration: underline;
}

#app .header-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.45rem;
  min-width: 0;
  max-width: 100%;
}

#app .periods {
  display: flex;
  gap: 0.28rem;
  flex-wrap: nowrap;
  max-width: 100%;
}

#app .periods button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
  white-space: nowrap;
}

#app .periods button:hover {
  border-color: #3a4a63;
  color: var(--text);
}

#app .periods button:focus-visible,
#app .gear-btn:focus-visible,
#app-nav button:focus-visible,
#app .admin-fab:focus-visible,
#app .admin-menu-item:focus-visible,
#app .toggle input:focus-visible + .toggle-track,
#app .overlay-close:focus-visible,
#app .tile:focus-visible,
#app .rollup-row:focus-visible,
#app .load-retry:focus-visible,
#app .tool-tile-live:focus-visible,
#app .settings-back:focus-visible,
#app .translator-back:focus-visible,
#app .translator-submit:focus-visible,
#app .translator-secondary:focus-visible,
#app .translator-close:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

#app .periods button.active {
  color: var(--on-accent);
  border-color: #78a640;
  background: #78a640;
  font-weight: 650;
}

#app button:not([class]):not([data-nav]),
#app .export-btn,
#app .load-retry,
#app .shift-reconcile,
#app [data-owner-retry] {
  font-family: inherit;
  color: #f4f7ef;
  background: rgba(120, 166, 64, 0.18);
  border: 1px solid rgba(120, 166, 64, 0.65);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  min-height: 32px;
  cursor: pointer;
}

#app button:not([class]):not([data-nav]):hover,
#app .export-btn:hover,
#app .load-retry:hover,
#app .shift-reconcile:hover,
#app [data-owner-retry]:hover {
  background: #78a640;
  color: #0c1118;
}

#app .tab-periods {
  width: 100%;
  margin: 0;
}

#app .gear-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}

#app .gear-btn:hover {
  color: var(--text);
  border-color: rgba(61, 214, 140, 0.35);
}

#app .gear-btn.active {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.45);
  background: var(--chip);
}

#app .gear-btn .gear-ico {
  display: block;
}

#app-view {
  flex: 1 0 auto;
  overflow: visible;
  min-height: 0;
  padding: 0 1.15rem calc(1.25rem + var(--nav-h) + var(--safe-bottom));
  max-width: none;
  width: 100%;
  margin: 0 auto;
}

html.has-session,
html.has-session body,
html.has-session #app,
html.has-session #app-shell {
  height: auto;
  min-height: 100%;
}

html.has-session #app .app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

/* Sales uses the full shell width and the page scrollbar. Other tabs keep the inner scroller. */
html:has(#view-sales:not([hidden])),
html:has(#view-sales:not([hidden])) body {
  height: auto;
  min-height: 100%;
}

#app:has(#view-sales:not([hidden])) {
  height: auto;
  min-height: 100%;
}

#app:has(#view-sales:not([hidden])) #app-shell {
  min-height: 100%;
}

#app:has(#view-sales:not([hidden])) #app-view {
  overflow: visible;
  max-width: none;
  flex: 1 0 auto;
}

#app:has(#view-sales:not([hidden])) .app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

#view-sales,
#sales-root {
  min-width: 0;
  max-width: 100%;
}

/* Viewport-pinned. Sales scrolls the document (height: auto on html/body/#app),
   which shrinks #app-shell to its content, so sticky bottom has no stick range
   and the bar sits under the Sales panel instead of the viewport. */
#app-nav {
  flex-shrink: 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 14, 20, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#app-nav button[data-nav] {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-height: 44px;
  padding: 0.4rem 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

#app-nav button[data-nav][hidden] {
  display: none;
}

#app-nav button[data-nav] .nav-ico {
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.8;
}

#app-nav button[data-nav].active .nav-ico {
  opacity: 1;
}

/* Only the selected tab gets the green pill. Hover is a faint tint, and only
   on devices that really hover, so a tapped tab (Live) does not keep a sticky
   green hover that looks selected after you leave it. This does not use
   :not([class]), so Agents (which starts with class="active") is not
   skipped once it is no longer selected. */
@media (hover: hover) and (pointer: fine) {
  #app-nav button[data-nav]:not(.active):hover {
    background: var(--accent-soft);
    color: var(--text);
    border-radius: 999px;
  }
}

#app-nav button[data-nav].active,
#app-nav button[data-nav].active:hover {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
}

#app .kpi-banner {
  margin-bottom: 0.85rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--card-elevated);
  font-size: 0.84rem;
  line-height: 1.45;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

#app .kpi-banner .banner-ico {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

#app .kpi-banner .banner-body {
  flex: 1 1 auto;
  min-width: 0;
}

#app .kpi-banner.retrying {
  border-color: rgba(240, 180, 41, 0.4);
  color: #f5c86a;
  background: linear-gradient(135deg, rgba(240, 180, 41, 0.1) 0%, rgba(26, 36, 54, 0.9) 60%);
}

#app .kpi-banner.retrying .banner-ico {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(240, 180, 41, 0.35);
}

#app .kpi-banner.error {
  border-color: rgba(240, 113, 120, 0.4);
  color: #f5a0a5;
  background: linear-gradient(135deg, rgba(240, 113, 120, 0.1) 0%, rgba(26, 36, 54, 0.9) 60%);
}

#app .kpi-banner.error .banner-ico {
  background: var(--err-soft);
  color: var(--err);
  border: 1px solid rgba(240, 113, 120, 0.35);
}

#app .kpi-banner.ok {
  border-color: rgba(61, 214, 140, 0.35);
  color: var(--accent);
  background: linear-gradient(135deg, rgba(61, 214, 140, 0.1) 0%, rgba(26, 36, 54, 0.9) 60%);
}

#app .kpi-banner.ok .banner-ico {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(61, 214, 140, 0.35);
}

#app .kpi-banner .dev-detail {
  display: block;
  margin-top: 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(36, 48, 68, 0.8);
}

#app .kpi-banner .retry-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 560;
}

#app .kpi-banner .retry-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--warn);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

#app .company {
  background: linear-gradient(165deg, #1c273a 0%, var(--card) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.05rem 1.1rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-soft);
}

#app .company.loading {
  background: var(--card);
  border-color: var(--line);
  padding: 1rem 1.05rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  box-shadow: none;
}

#app .loading-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

#app .loading-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#app .skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

#app .skel-card {
  height: 148px;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, #151d2a 0%, #1c273a 50%, #151d2a 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#app .company-line {
  display: none;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#app .company-line::-webkit-scrollbar {
  display: none;
}

#app .company-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

#app .company-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

#app .company-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  margin-left: 0.45rem;
}

#app .status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

#app .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.15);
}

#app .chip.warn {
  border-color: rgba(240, 180, 41, 0.45);
  color: var(--warn);
}

#app .chip.info {
  border-color: rgba(91, 156, 255, 0.4);
  color: #9ec1ff;
}

#app .stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
}

#app .stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
}

#app .stat .val {
  font-size: 1.4rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text);
}

#app .stat .val.live {
  color: var(--accent);
}

#app .stat .val.zero {
  color: var(--muted);
  font-weight: 600;
}

#app .stat .val.pending {
  color: var(--empty);
  font-size: 0.82rem;
  font-weight: 600;
}

#app .stat .lbl {
  margin-top: 0.18rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#app .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  width: 100%;
}

#app .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.95rem 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

#app .card.sales-rep {
  background: var(--card-sales);
  border-color: rgba(91, 156, 255, 0.35);
  box-shadow: inset 3px 0 0 var(--accent-2), 0 4px 14px rgba(0, 0, 0, 0.18);
}

#app .card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

#app .card-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  min-width: 0;
  flex: 1 1 auto;
}

#app .card h3 {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

#app .card-email {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

#app .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.14rem 0.45rem 0.14rem 0.32rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  line-height: 1.2;
  white-space: nowrap;
}

#app .status-badge .status-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

#app .status-badge.status-available {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.4);
  background: var(--chip);
}

#app .status-badge.status-dnd {
  color: #ffb4b8;
  border-color: rgba(240, 113, 120, 0.65);
  background: rgba(240, 113, 120, 0.18);
  box-shadow: 0 0 0 1px rgba(240, 113, 120, 0.25), 0 0 12px rgba(240, 113, 120, 0.18);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

#app .status-badge.status-dnd .status-dot {
  background: #f07178;
  box-shadow: 0 0 0 2px rgba(240, 113, 120, 0.35), 0 0 8px rgba(240, 113, 120, 0.55);
}

#app .status-badge.status-offline {
  color: #9aa8bc;
  border-color: rgba(106, 122, 144, 0.55);
  background: rgba(106, 122, 144, 0.12);
}

#app .status-badge.status-on-call {
  color: #9ec1ff;
  border-color: rgba(91, 156, 255, 0.55);
  background: rgba(91, 156, 255, 0.16);
}

#app .shift-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  border: 1px solid rgba(240, 180, 41, 0.45);
  color: var(--warn);
  background: var(--warn-soft);
}

#app .agent-activity {
  min-width: 0;
  max-width: 100%;
  margin: 0 0 10px;
}

#app .agent-activity:empty {
  display: none;
  margin: 0;
}

#app .activity-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.65rem;
  min-width: 0;
}

@media (min-width: 761px) {
  /* A 0px minimum would put every agent on one row. 15rem is the floor that still shrinks. */
  #app .activity-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  }
}

#app .activity-grid > * {
  min-width: 0;
}

#app .activity-tile {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(120, 166, 64, 0.4);
  background: #151d2a;
  color: #e8eef7;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#app .activity-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

#app .activity-metric {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

#app .activity-metric[data-activity-known="0"] {
  grid-template-columns: 3.4rem auto minmax(0, 1fr);
}

#app .activity-label,
#app .activity-missing {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

#app .activity-missing {
  font-weight: 550;
}

#app .activity-track {
  display: block;
  height: 7px;
  min-width: 0;
  border-radius: 999px;
  background: #0c1118;
  overflow: hidden;
}

#app .activity-bar {
  display: block;
  width: 0;
  min-width: 0;
  height: 7px;
  max-width: 100%;
  border-radius: 999px;
  background: #78a640;
}

#app .activity-val {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 760px) {
  #app .activity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  #app .activity-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

#app .on-shift-bar {
  margin: 0.85rem 0 0.2rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}

#app .on-shift-bar h3,
#app .presence-label,
#app .dnd-rollup h3 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .on-shift-bar ul,
#app .presence-strip ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
}

#app .on-shift-bar li,
#app .presence-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

#app .shift-reconcile,
#app .schedule-save,
#app .schedule-add button {
  margin-top: 0.65rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(61, 214, 140, 0.4);
  background: var(--chip);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
}

#app .on-shift-note,
#app .schedule-status,
#app .schedule-lock,
#app .schedule-lead {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

#app .presence-strip {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(0, 0, 0, 0.18);
}

#app .dnd-rollup {
  margin-top: 0.9rem;
}

#app .dnd-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#app .dnd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#app .dnd-table th,
#app .dnd-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

#app .schedule-board {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#app .schedule-agent {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
  padding: 0.85rem;
}

#app .schedule-agent h3 {
  margin: 0;
  font-size: 1rem;
}

#app .schedule-email {
  margin: 0.15rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
}

#app .schedule-notes,
#app .schedule-add label,
#app .schedule-day label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

#app .schedule-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
}

#app .schedule-day {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.4rem;
  border-radius: 0.55rem;
  background: rgba(0, 0, 0, 0.18);
}

#app .schedule-day-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app .schedule-day input,
#app .schedule-notes input,
#app .schedule-add input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.35rem;
}

#app .schedule-off {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

#app .schedule-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
}

@media (max-width: 720px) {
  #app .schedule-days {
    grid-template-columns: 1fr;
  }
}

#app .status-badge.status-unknown {
  color: var(--warn);
  border-color: rgba(240, 180, 41, 0.4);
  background: var(--warn-soft);
}

#app .status-badge.status-disconnected {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(0, 0, 0, 0.18);
  font-weight: 650;
  letter-spacing: 0.04em;
}

#app .status-badge.status-disconnected .status-dot {
  background: var(--empty);
}

#app .badge {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
}

#app .badge.agent {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.35);
  background: var(--chip);
}

#app .badge.sales {
  color: #9ec1ff;
  border-color: rgba(91, 156, 255, 0.4);
  background: rgba(91, 156, 255, 0.1);
}

#app .metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

#app .company-metrics {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}

#app .group-label {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.15rem;
}

#app .card-source {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

#app .tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.5rem 0.55rem;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

#app button.tile {
  cursor: pointer;
}

#app button.tile:hover {
  border-color: rgba(61, 214, 140, 0.45);
  background: rgba(61, 214, 140, 0.06);
}

#app button.tile:active {
  transform: scale(0.98);
}

#app .tile.span2 {
  grid-column: 1 / -1;
}

#app .tile .val {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: -0.02em;
}

#app .tile .val.zero {
  color: var(--muted);
}

#app .tile .val.pending {
  color: var(--empty);
  font-size: 0.8rem;
  font-weight: 600;
}

/* A changed number gets a soft green tint that fades out. Full opacity
   throughout, and only color/background move, so nothing reflows. */
#app .value-tick {
  animation: mb-value-tint 1000ms ease-out;
  border-radius: 4px;
}

@keyframes mb-value-tint {
  from { background-color: rgba(120, 166, 64, 0.18); color: #b9dc8a; }
  to { background-color: rgba(120, 166, 64, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #app .value-tick {
    animation: none;
  }
}

#app .tile .lbl {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

#app .tile .hint-click {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.75rem;
  color: var(--empty);
}

#app .muted {
  color: var(--muted);
}

#app .ac-overflow {
  margin-top: 0.85rem;
}

#app .ac-overflow h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

#app .ac-note {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .err {
  color: var(--err);
}

#app .stub-shell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.2rem 1.5rem;
}

#app .company:has(.load-error) {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

#app .load-error {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.2rem 1.5rem;
  max-width: 28rem;
}

#app .load-error-title {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 650;
}

#app .load-error-copy {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .load-retry {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
}

#app .load-retry:hover {
  border-color: #3a4a63;
  color: var(--text);
}

#app .agents-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

#app .live-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  max-height: none;
  overflow: visible;
  position: static;
}

#app .live-feed[hidden] {
  display: none;
}

#app .live-feed .live-widgets {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#app .live-board .live-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 10px;
  align-items: start;
}

#app .live-row,
#app .live-snippet {
  overflow-wrap: anywhere;
}

#app .live-widget {
  min-width: 0;
}

#app .live-board .live-widget {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.7rem 0.75rem 0.35rem;
  background: var(--card);
}

#app .owner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#app .owner-grid > * {
  min-width: 0;
  max-width: 100%;
}

#app .owner-card {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
  background: var(--card);
  min-width: 0;
  overflow: visible;
}

#app .owner-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

#app .owner-chip {
  grid-column: 1 / -1;
  justify-self: start;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  width: auto;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.82rem;
}

#app .owner-chip .export-btn {
  margin: 0;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}

#app .owner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#app .owner-table th,
#app .owner-table td {
  text-align: left;
  padding: 0.28rem 0.35rem;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  overflow-wrap: anywhere;
}

#app .owner-kpis {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.2rem, 1fr));
  gap: 0.55rem;
}

#app .owner-kpi,
#app .owner-stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgba(0, 0, 0, 0.18);
}

#app .owner-kpi {
  padding: 0.7rem 0.75rem 0.62rem;
}

#app .owner-kpi-val,
#app .owner-stat-val {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

#app .owner-kpi-val {
  font-size: 1.15rem;
}

#app .owner-kpi-lbl,
#app .owner-stat-lbl {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app .owner-kpi-sub,
#app .owner-note {
  margin: 0.28rem 0 0;
  color: var(--text);
  font-size: 0.75rem;
}

#app .owner-note,
#app .owner-updated {
  grid-column: 1 / -1;
}

#app .owner-note {
  margin: 0 0 0.55rem;
  color: var(--muted);
}

#app .owner-updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

#app .owner-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.4rem, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.65rem;
}

#app .owner-stat {
  padding: 0.45rem 0.5rem 0.4rem;
}

#app .owner-stat-val {
  display: block;
  font-size: 1rem;
}

#app .owner-stat-lbl {
  display: block;
}

#app .owner-mtd {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.38rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 0.08em;
}

#app .owner-bar-track {
  display: grid;
  grid-template-columns: minmax(0, 5.5rem) auto;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#app .owner-bar {
  display: block;
  height: 0.42rem;
  width: 100%;
  max-width: 100%;
  border-radius: 999px;
  background: var(--accent-2);
  justify-self: stretch;
}

#app .owner-table tr.is-peak td {
  background: var(--accent-soft);
}

#app .owner-table tr.is-peak td:first-child {
  font-weight: 700;
}

#app .owner-table tr.is-peak .owner-bar {
  background: var(--accent);
}

#app .owner-bar-n {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 40rem) {
  #app .owner-kpis,
  #app .owner-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #app .owner-kpi-val {
    font-size: 1rem;
  }
}

@media (min-width: 860px) {
  #app .owner-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#app .live-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

#app .live-item {
  margin: 0;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

#app .live-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

#app .live-agent {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

#app .live-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

#app .card-skel .val,
#app .card-skel h3,
#app .card-skel .card-email {
  color: var(--muted);
}

#app .live-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 48rem;
}

#app .live-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#app .live-chip[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(61, 214, 140, 0.55);
  background: rgba(61, 214, 140, 0.12);
}

#app .live-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

#app .live-ico {
  width: 1.8rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.4;
}

#app .live-row-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: baseline;
  min-width: 0;
}

#app .live-dir {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

#app .live-who,
#app .live-row .live-agent {
  min-width: 0;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app .live-open {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

#app .live-snippet {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#app .missed-rule,
#app .sales-growth-method {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

#app .sales-growth-scroll {
  overflow: visible;
  margin-top: 0.7rem;
  max-width: 100%;
}

#app .sales-growth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 0;
}

#app .sales-growth-table th,
#app .sales-growth-table td {
  text-align: right;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  overflow-wrap: anywhere;
}

#app .sales-growth-table th:first-child,
#app .sales-growth-table td:first-child {
  text-align: left;
}

#app .export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

#app .export-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  min-height: 28px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

#app .access-manager {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

#app .access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.75rem auto;
  gap: 0.45rem 0.55rem;
  align-items: center;
  margin: 0;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

#app .access-email {
  font-size: 0.84rem;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

#app .access-email-sub {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

#app .access-row .chip {
  justify-content: center;
}

#app .access-row select,
#app .access-add select,
#app .access-add input {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background-color: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 32px;
  width: 100%;
}

#app .access-row select,
#app .access-add select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.4 1.6 6 6.2 10.6 1.6' fill='none' stroke='%238b9bb0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.65rem 0.4rem;
  padding: 0.22rem 1.55rem 0.22rem 0.7rem;
  cursor: pointer;
}

#app .access-add input {
  padding: 0.22rem 0.75rem;
}

#app .access-add input::placeholder {
  color: var(--empty);
}

#app .access-row select:hover,
#app .access-add select:hover,
#app .access-add input:hover,
#app .access-btn:hover {
  border-color: #3a4a63;
}

#app .access-row select:focus-visible,
#app .access-add select:focus-visible,
#app .access-add input:focus-visible,
#app .access-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

#app .access-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.75rem auto;
  gap: 0.45rem 0.55rem;
  align-items: end;
  margin: 0.85rem 0 0.2rem;
}

#app .access-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app .access-btn {
  color-scheme: dark;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
  background: rgba(91, 156, 255, 0.14);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 32px;
  padding: 0.22rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

#app .access-log-title {
  margin: 0.95rem 0 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--empty);
}

#app .access-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

#app .access-log li {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
}

#app .access-log-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

#app .access-log-line {
  overflow-wrap: anywhere;
}

#app .sales-net.pos {
  color: var(--accent);
}

#app .sales-net.neg {
  color: #ff8d8d;
}

#app .sales-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

#app .sales-loading {
  padding: 1.1rem 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .loading-hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .sales-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1rem 1.05rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  min-width: 0;
  max-width: 100%;
}

#app .sales-block > h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#app .sales-rep-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin: 0 0 0.7rem;
}

#app .sales-rep-head > h2 {
  margin: 0;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#app .sales-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  white-space: nowrap;
}

#app .sales-sort select {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  field-sizing: fixed;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background-color: rgba(0, 0, 0, 0.28);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.4 1.6 6 6.2 10.6 1.6' fill='none' stroke='%238b9bb0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.65rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 1.55rem 0.22rem 0.7rem;
  min-height: 32px;
  width: 10.25rem;
  flex: 0 0 auto;
  cursor: pointer;
}

#app .sales-sort select:hover {
  border-color: #3a4a63;
}

#app .sales-sort select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

#app .sales-block .company-head {
  margin-bottom: 0.75rem;
}

#app .sales-totals {
  margin-top: 0.15rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

#app .sales-reps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.5rem;
}

#app .sales-rep-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.03);
}

#app .sales-rep-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

#app .sales-rep-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 0;
}

#app .sales-rep-rate {
  margin: 0;
  text-align: right;
  flex: 0 0 auto;
}

#app .sales-rep-rate-val {
  display: block;
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: -0.02em;
}

#app .sales-rep-rate-lbl {
  display: block;
  margin-top: 0.05rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .sales-rep-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

#app .sales-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#app .sales-recent li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "kind name time"
    "meta meta meta";
  gap: 0.2rem 0.55rem;
  align-items: baseline;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
}

#app .sales-kind {
  grid-area: kind;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ec1ff;
  border: 1px solid rgba(91, 156, 255, 0.4);
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
}

#app .sales-kind-empty {
  display: none;
}

#app .sales-name {
  grid-area: name;
  font-weight: 700;
  min-width: 0;
}

#app .sales-time {
  grid-area: time;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
  white-space: nowrap;
}

#app .sales-time.sales-time-date {
  font-variant-numeric: tabular-nums;
}

#app .sales-meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 0.78rem;
}

#app .sales-cap {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
}

#app .sales-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

#app .sales-active .val {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--accent);
}

#app .sales-active .val.zero {
  color: var(--muted);
  font-weight: 600;
}

#app .sales-active .val.pending {
  color: var(--empty);
  font-size: 0.95rem;
  font-weight: 600;
}

#app .sales-active .lbl {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .sales-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  margin-top: 0.85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
}

#app .sales-chart-col {
  flex: 1 0 2.6rem;
  min-width: 2.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
}

#app .sales-chart-bars {
  height: 5.4rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.28rem;
}

#app .sales-chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0.12rem;
}

#app .sales-chart-n {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

#app .sales-chart-bar {
  display: block;
  width: 0.45rem;
  min-height: 0;
  border-radius: 0.2rem 0.2rem 0 0;
  background: var(--accent-2);
}

#app .sales-chart-bar.clients {
  background: var(--accent);
}

#app .sales-chart-lbl {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
}

#app .sales-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

#app .sales-swatch {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.28rem;
  border-radius: 0.12rem;
  vertical-align: middle;
  background: var(--accent-2);
}

#app .sales-swatch.clients {
  background: var(--accent);
}

#app .admin-menu-status {
  margin: 0.1rem 0.75rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--warn);
}

#app .admin-menu-status.ok {
  color: var(--accent);
}

#app .admin-menu-status.err {
  color: var(--err);
}

#app .view-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#app .view-copy {
  margin: 0.55rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 36rem;
}

#app .tools-shell,
#app .settings-shell,
#app .weather-panel,
#app .settings-section,
#app .translator-bar,
#app .settings-hero,
#app .settings-cats {
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#app .settings-about {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

#app .needed-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

#app .needed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.6rem;
  margin: 0 0 1rem;
  min-width: 0;
}

#app .needed-tile {
  border: 2px solid #8b938c;
  border-radius: 0.8rem;
  padding: 0.7rem 0.75rem;
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
}

#app .needed-tile h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

#app .needed-tile p {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .needed-tile[data-needed-status="fresh"] { border-color: #78a640; }
#app .needed-tile[data-needed-status="partial"] { border-color: #e2b340; }
#app .needed-tile[data-needed-status="stale"],
#app .needed-tile[data-needed-status="missing"] { border-color: #d4534a; }
#app .needed-tile[data-needed-status="error"] { border-color: #cc5500; }
#app .needed-tile[data-needed-status="off"] { border-color: #4c8dff; }

#app .tools-shell {
  max-width: 980px;
}

#app .settings-shell {
  max-width: 560px;
}

#app .tools-hero,
#app .sales-hero,
#app .settings-hero {
  margin-bottom: 1rem;
}

#app .tools-hero .view-title,
#app .sales-hero .view-title,
#app .settings-hero .view-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

#app .tools-hero .view-copy,
#app .sales-hero .view-copy,
#app .settings-hero .view-copy {
  margin: 0.4rem 0 0;
}

#app .sales-stub {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.15rem 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

#app .sales-stub-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

#app .sales-stub-ico {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 156, 255, 0.12);
  border: 1px solid rgba(91, 156, 255, 0.28);
  color: #9ec1ff;
  font-size: 1.15rem;
  line-height: 1;
}

#app .sales-stub-copy {
  flex: 1 1 auto;
  min-width: 0;
}

#app .sales-stub-copy h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

#app .sales-stub-copy p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

#app .sales-stub .soon-chip {
  margin-left: auto;
}

#app .sales-stub-note {
  margin: 0.9rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--empty);
  font-size: 0.75rem;
}

#app .tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#app .tool-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  text-align: left;
  padding: 1rem 1.05rem 0.9rem;
  border-radius: 0.95rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  cursor: not-allowed;
  min-height: 118px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

#app .tool-tile:disabled {
  opacity: 1;
}

#app .tool-tile-live {
  cursor: pointer;
}

#app .tool-tile-live:hover {
  border-color: rgba(61, 214, 140, 0.45);
}

#app .tool-tile-live .tool-hint {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.45);
}

#app .lookup-search input,
#app .lookup-filters input,
#app .lookup-filters select {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  min-height: 44px;
  margin: 0.25rem 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: inherit;
}

#app .lookup-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin: 0.8rem 0;
}

#app .lookup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.9rem;
}

#app .lookup-actions button,
#app .lookup-search button {
  min-height: 44px;
}

#app .lookup-badge {
  display: inline-block;
  margin: 0.2rem 0 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

#app .lookup-badge-active { background: #166534; color: #f0fdf4; }
#app .lookup-badge-lead { background: #f6c445; color: #1a1403; }
#app .lookup-badge-former,
#app .lookup-badge-cancelled { background: #9f1239; color: #fff; }
#app .lookup-badge-unknown { background: #314056; color: #e7eef6; }

#app .lookup-person {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.35rem;
}

#app .lookup-sources,
#app .lookup-cancel-note,
#app .lookup-pick-meta,
#app .lookup-event-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

#app .lookup-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--card);
}

#app .lookup-facts div { min-width: 0; }
#app .lookup-facts dt { color: var(--muted); font-size: 0.75rem; }
#app .lookup-facts dd { margin: 0.15rem 0 0; overflow-wrap: anywhere; }
#app .lookup-missing { color: var(--empty); }

#app .lookup-event,
#app .lookup-possible {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--card);
}

#app .lookup-picks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

#app .lookup-pick-extra { display: none; }
#app .lookup-picks.is-open .lookup-pick-extra { display: block; }

#app .lookup-pick-card,
#app .lookup-more,
#app .lookup-listen {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  font: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

#app .lookup-listen,
#app .lookup-more {
  display: inline-flex;
  align-items: center;
  width: auto;
}

#app .lookup-pick-card:hover,
#app .lookup-pick-card:focus-visible,
#app .lookup-listen:hover,
#app .lookup-listen:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app .lookup-pick-name { font-weight: 700; }
#app .lookup-pick-meta { grid-column: 1 / -1; }

#app .lookup-day {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-local);
  margin: 0.8rem 0 0.4rem;
  padding: 0.35rem 0;
  background: var(--bg);
  font-size: 0.85rem;
}

#app .lookup-event { border-left-width: 4px; }
#app .lookup-event-call { border-left-color: #38bdf8; }
#app .lookup-event-text { border-left-color: #f6c445; }
#app .lookup-event-email { border-left-color: #a78bfa; }
#app .lookup-event-lsa { border-left-color: #34d399; }
#app .lookup-event-job,
#app .lookup-event-dispatch { border-left-color: #fb923c; }
#app .lookup-event-cancel { border-left-color: #fb7185; }

#app .lookup-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#app .lookup-clamp.is-open {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

#app .lookup-search {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-filters);
  background: var(--bg);
  padding-bottom: 0.35rem;
}

#app .lookup-actions button {
  min-width: 44px;
}

#app .lookup-event a,
#app .lookup-facts dd,
#app .lookup-pick-card {
  overflow-wrap: anywhere;
}

#app .lookup-freshness,
#app .lookup-period {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  #app .lookup-facts { grid-template-columns: 1fr; }
}

@media (min-width: 720px) {
  #app .lookup-filters {
    grid-template-columns: 1.2fr 1fr 1fr;
  }
}

#app .translator-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#app .translator-kicker {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--empty);
}

#app .translator-title {
  margin: 0 0 1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--accent);
  user-select: none;
  cursor: default;
}

#app .translator-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.05rem 0.95rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

#app .translator-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .translator-card textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0.7rem 0.75rem;
}

#app .translator-card textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#app .translator-submit,
#app .translator-secondary,
#app .translator-close,
#app .translator-back,
#app .settings-back {
  font-family: inherit;
  cursor: pointer;
}

#app .translator-back,
#app .settings-back {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  min-height: 32px;
  font-size: 0.78rem;
}

#app .settings-hero .settings-back {
  margin: 0 0 0.85rem;
}

#app .translator-back:hover,
#app .settings-back:hover {
  border-color: #3a4a63;
  color: var(--text);
}

#app .translator-submit,
#app .translator-secondary {
  width: 100%;
  margin-top: 0.75rem;
  border-radius: 0.7rem;
  padding: 0.7rem 0.9rem;
  font-weight: 750;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app .translator-submit {
  background: var(--accent);
  color: #062215;
  border: none;
}

#app .translator-submit-alt {
  background: #7c6bb5;
  color: #f8f5ff;
}

#app .translator-submit:disabled,
#app .translator-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#app .translator-secondary,
#app .translator-close {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

#app .translator-hidden-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

#app .translator-hidden-head h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4b5fd;
}

#app .translator-close {
  width: auto;
  margin: 0;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
}

#app .translator-status {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

#app .translator-block {
  margin-top: 0.85rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid #c4b5fd;
}

#app .translator-block h4 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4b5fd;
}

#app .translator-block p {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

#app .translator-block-tone {
  border-left-color: #7eb6ff;
}

#app .translator-block-tone h4 {
  color: #9ec1ff;
}

#app .translator-block-carnal {
  border-left-color: var(--accent);
}

#app .translator-block-boss {
  border-left-color: #e2b657;
}

#app .translator-block-stern {
  border-left-color: #f07178;
}

#app .translator-gloss {
  margin-top: 0.35rem !important;
  color: var(--muted);
  font-style: italic;
}

#app .translator-standalone {
  margin: 0.2rem 0 0;
  text-align: center;
  font-size: 0.78rem;
}

#app .translator-standalone a {
  color: var(--muted);
}

#app .translator-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
}

#app .translator-modes button {
  flex: 1 1 6.5rem;
  min-height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

#app .translator-modes button[aria-pressed="true"] {
  background: var(--accent);
  color: #062215;
  border-color: transparent;
}

#app .translator-mode-copy,
#app .translator-note,
#app .translator-tone {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

#app .translator-tone {
  margin-top: 0.75rem;
}

#app .translator-label + textarea {
  margin-top: 0.15rem;
}

#app .tool-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.45rem;
  font-size: 1.05rem;
  line-height: 1;
  color: #d5deea;
}

#app .tool-ico svg {
  display: block;
  width: 1.3rem;
  height: 1.3rem;
}

#app .tool-ico.tone-gold {
  color: #e2b657;
}

#app .tool-ico.tone-blue {
  color: #9ec1ff;
}

#app .tool-ico.tone-amber {
  color: #e0a15a;
}

#app .tool-ico.tone-pin {
  color: #f07178;
}

#app .tool-label {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

#app .tool-hint,
#app .soon-chip {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

#app .tool-hint {
  margin-top: auto;
}

#app .soon-chip {
  flex: 0 0 auto;
  color: var(--empty);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.22rem 0.55rem;
}

#app .settings-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}

#app .settings-cats button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  min-height: 32px;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

#app .settings-cats button.active,
#app .settings-cats button[aria-expanded="true"] {
  background: #78a640;
  border-color: #78a640;
  color: var(--on-accent);
}

#app .settings-section:not(.is-settings-open) {
  display: none;
}

#app .settings-section {
  margin-bottom: 1.25rem;
}

#app .settings-section-lbl {
  margin: 0 0 0.55rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--empty);
}

#app .comms-health-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

#app .comms-health-dot {
  font-weight: 700;
  text-transform: uppercase;
}

#app .comms-health-dot.red { color: #e85d4c; }
#app .comms-health-dot.yellow { color: #e0a030; }
#app .comms-health-dot.green { color: #3dd68c; }

#app .settings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1rem 1.05rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

#app .settings-card.featured {
  border-color: rgba(61, 214, 140, 0.35);
  background: linear-gradient(145deg, rgba(61, 214, 140, 0.08) 0%, var(--card) 55%);
}

#app .settings-card.muted-card {
  opacity: 0.78;
  box-shadow: none;
  background: rgba(21, 29, 42, 0.7);
}

#app .settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

#app .settings-copy {
  min-width: 0;
  flex: 1 1 auto;
}

#app .settings-label {
  font-size: 0.95rem;
  font-weight: 650;
}

#app .settings-hint {
  margin-top: 0.28rem;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 28rem;
}

#app .settings-foot {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--empty);
  text-align: center;
}

#app .toggle {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex: 0 0 auto;
}

#app .toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

#app .toggle-track {
  display: block;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: #1e2a3c;
  border: 1px solid var(--line);
  position: relative;
}

#app .toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s, background 0.18s;
}

#app .toggle input:checked + .toggle-track {
  background: rgba(61, 214, 140, 0.22);
  border-color: rgba(61, 214, 140, 0.6);
}

#app .toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
  background: var(--accent);
}

#app .admin-widget {
  position: fixed;
  z-index: var(--z-widget);
  left: auto;
  right: max(0.85rem, env(safe-area-inset-right, 0px));
  top: auto;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 0.75rem);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  touch-action: none;
  width: max-content;
  max-width: calc(100% - 0.5rem);
}

#app .admin-widget[data-side="left"] {
  align-items: flex-start;
}

#app .admin-widget[data-side="right"] {
  align-items: flex-end;
}

#app .admin-widget.is-dragging {
  opacity: 0.92;
  transition: none;
}

#app .admin-widget:not(.is-dragging) {
  transition: left 0.18s ease, top 0.18s ease, right 0.18s ease, bottom 0.18s ease;
}

#app .admin-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  position: relative;
}

#app .admin-fab-lock-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 24, 36, 0.92);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.16rem 0.45rem;
  min-height: 22px;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#app .admin-fab-lock-btn:hover {
  color: var(--text);
  border-color: rgba(91, 156, 255, 0.45);
}

#app .admin-widget[data-locked="false"] .admin-fab-lock-btn {
  color: var(--warn);
  border-color: rgba(240, 180, 41, 0.45);
  background: rgba(40, 32, 12, 0.92);
}

#app .admin-widget[data-locked="false"] .admin-fab {
  cursor: grab;
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.35), 0 10px 28px rgba(0, 0, 0, 0.5);
}

#app .admin-widget[data-locked="false"].is-dragging .admin-fab {
  cursor: grabbing;
  transform: scale(1.06);
}

#app .admin-fab {
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 0.7rem;
  border: 2px solid #f4f8ff;
  background: linear-gradient(145deg, #6aadff 0%, #3d74e8 55%, #2a5cc4 100%);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(91, 156, 255, 0.28), 0 10px 28px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  touch-action: none;
  user-select: none;
}

#app .admin-fab:hover {
  transform: translateY(-2px) scale(1.02);
}

#app .admin-fab[aria-expanded="true"] {
  background: linear-gradient(145deg, #4ae09a 0%, #2fb872 55%, #23965c 100%);
  border-color: #f0fff7;
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.38), 0 10px 28px rgba(0, 0, 0, 0.5);
}

#app .admin-fab-shield {
  display: block;
  width: 22px;
  height: 22px;
  color: #f4f8ff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

#app .admin-menu {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  min-width: min(292px, calc(100% - 1.5rem));
  background: #101824;
  border: 1px solid rgba(91, 156, 255, 0.45);
  border-radius: 0.95rem;
  padding: 0.35rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
  z-index: var(--z-base);
}

#app .admin-widget[data-side="right"] .admin-menu {
  right: 0;
  left: auto;
}

#app .admin-widget[data-side="left"] .admin-menu {
  left: 0;
  right: auto;
}

#app .admin-widget[data-menu="below"] .admin-menu {
  bottom: auto;
  top: calc(100% + 0.45rem);
}

#app .admin-menu-head {
  padding: 0.55rem 0.75rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--empty);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}

#app .admin-menu-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0.6rem;
  padding: 0.7rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

#app .admin-menu-item:hover:not(:disabled) {
  background: var(--accent-2-soft);
}

#app .admin-menu-item.soon,
#app .admin-menu-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#app .admin-menu-item strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 650;
}

#app .admin-menu-item small {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.75rem;
  color: var(--muted);
}

#app .ami-ico {
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: rgba(91, 156, 255, 0.12);
  border: 1px solid rgba(91, 156, 255, 0.22);
}

#app .overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(5, 8, 14, 0.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + var(--safe-bottom));
  backdrop-filter: blur(4px);
}

#app .overlay-card {
  width: min(420px, 100%);
  max-height: min(82vh, 640px);
  overflow: auto;
  background: linear-gradient(180deg, #1a2436 0%, var(--card) 40%);
  border: 1px solid rgba(91, 156, 255, 0.22);
  border-radius: 1.1rem 1.1rem 0.85rem 0.85rem;
  padding: 1rem 1.05rem 1.15rem;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.55);
}

#app .overlay-card-wide {
  width: min(720px, 100%);
}

#app .overlay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

#app .overlay-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 720;
}

#app .overlay-close {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 0.55rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

#app .overlay-note {
  margin: 0 0 0.9rem;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
}

#app .overlay-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: #9ec1ff;
}

#app .stub-note {
  color: var(--warn);
}

#app .overlay-foot {
  margin: 0.8rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--empty);
}

#app .drilldown-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: dd;
}

#app .drilldown-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.4rem 0.65rem 1.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  position: relative;
  counter-increment: dd;
}

#app .drilldown-list li::before {
  content: counter(dd);
  position: absolute;
  left: 0.15rem;
  top: 0.6rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app .rollup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#app .rollup-name {
  flex: 1 1 auto;
  min-width: 0;
}

#app .rollup-count,
#app .rollup-share {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

#app .drilldown-list .dd-name {
  flex: 1 1 auto;
  min-width: 0;
}

#app .drilldown-list .dd-time {
  flex: 0 1 auto;
  text-align: right;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

#app .overlay .admin-panel {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

#app .admin-panel h2 {
  margin: 0;
  font-size: 0.95rem;
}

#app .admin-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

#app .admin-status {
  min-height: 1.1rem;
  font-size: 0.78rem;
  margin-bottom: 0.65rem;
}

#app .admin-status.err {
  color: var(--err);
}

#app .admin-status.ok {
  color: var(--accent);
}

#app .admin-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

#app .admin-pager .page-label {
  font-size: 0.78rem;
  color: var(--muted);
}

#app .admin-pager .pager-btns {
  display: flex;
  gap: 0.4rem;
}

#app .admin-pager button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}

#app .admin-pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#app .agent-edit {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.75rem 0.8rem 0.85rem;
  margin-bottom: 0.65rem;
  background: rgba(255, 255, 255, 0.02);
}

#app .agent-edit.inactive {
  opacity: 0.72;
}

#app .agent-edit-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

#app .agent-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

#app .agent-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.6rem;
}

#app .agent-fields label,
#app .admin-add label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

#app .agent-fields label.span2,
#app .admin-add label.span2 {
  grid-column: 1 / -1;
}

#app .agent-fields input,
#app .admin-add input {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.45rem 0.5rem;
  font-family: inherit;
  min-height: 40px;
}

#app .check {
  flex-direction: row !important;
  align-items: center;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.8rem !important;
  gap: 0.4rem !important;
}

#app .admin-save,
#app .admin-add button {
  margin-top: 0.55rem;
  background: var(--chip);
  color: var(--text);
  border: 1px solid rgba(61, 214, 140, 0.45);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
}

#app .admin-add {
  margin-top: 0.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

#app .admin-add h3 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 650;
}

#app .signoff-field,
#app .signoff-input {
  max-width: 10rem;
}

#app .signoff-input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem !important;
}

#app .admin-panel .hint,
#app .admin-add .hint {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.75rem !important;
  color: var(--empty);
  margin-top: 0.15rem;
  font-weight: 400;
}

#app .attr-block {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 0.55rem;
  padding: 0.55rem 0.6rem 0.65rem;
  margin-top: 0.15rem;
}

#app .attr-block .attr-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

@media (min-width: 640px) {
  #app .overlay {
    align-items: center;
    padding: 1.25rem;
  }

  #app .overlay-card {
    border-radius: 1.1rem;
  }
}

@media (max-width: 640px) {
  #app {
    --fab-size: 46px;
    --nav-h: 54px;
  }

  #app-nav button[data-nav] {
    font-size: 0.75rem;
    padding: 0.35rem 0.1rem;
    letter-spacing: 0;
  }

  #app .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.32rem;
    padding: 0.4rem 0.7rem 0.38rem;
  }

  #app .eyebrow {
    font-size: 0.75rem;
  }

  #app .brand-logo-full {
    display: none;
  }

  #app .brand-logo-compact {
    display: block;
    height: 2.35rem;
    max-width: min(16.5rem, 68vw);
  }

  #app h1 {
    font-size: 0.95rem;
  }

  #app .sub {
    font-size: 0.75rem;
    max-width: 100%;
    white-space: normal;
  }

  #app .brand-meta-row {
    justify-content: space-between;
  }

  #app .who {
    font-size: 0.75rem;
    max-width: 8.5rem;
  }

  #app .header-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: 100%;
  }

  #app .periods {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.22rem;
  }

  #app .periods::-webkit-scrollbar {
    display: none;
  }

  #app .periods button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0.16rem 0.52rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  #app .sales-rep-head {
    flex-wrap: wrap;
  }

  #app .sales-sort {
    margin-left: auto;
  }

  #app .sales-sort select {
    font-size: 16px;
    min-height: 36px;
  }

  #app-view {
    padding: 0 0.7rem calc(0.85rem + var(--nav-h) + var(--safe-bottom));
  }

  #app .company {
    padding: 0.7rem 0.75rem 0.75rem;
    margin-bottom: 0.7rem;
  }

  #app .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  #app .stat {
    padding: 0.42rem 0.5rem;
  }

  #app .stat .val {
    font-size: 1.2rem;
  }

  #app .grid {
    grid-template-columns: 1fr;
  }

  #app .agent-fields {
    grid-template-columns: 1fr;
  }

  #app .agent-fields label.span2,
  #app .admin-add label.span2 {
    grid-column: auto;
  }

  #app .drilldown-list li {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  #app .drilldown-list .dd-time {
    width: 100%;
    text-align: left;
    white-space: normal;
  }

  #app .drilldown-list .dd-time.dd-time-date {
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
  }

  #app .sales-recent li {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "kind time"
      "name name"
      "meta meta";
  }

  #app .sales-time {
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #app .sales-time.sales-time-date {
    white-space: nowrap;
  }

  #app .sales-chart-col {
    flex-basis: 2.4rem;
  }

  #app .skel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  #app .gear-btn {
    width: 32px;
    height: 32px;
  }

  #app .sales-stub-row {
    flex-wrap: wrap;
  }
}

@media (min-width: 860px) {
  #app .tools-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  #app .sales-shell {
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.85fr);
    align-items: start;
  }

  #app .sales-shell > .sales-block:first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  #app .app-header {
    padding: 0.5rem 1.35rem 0.48rem;
    align-items: center;
  }

  #app h1 {
    font-size: 1.08rem;
  }
}

@media (max-width: 640px) {
  #app .live-feed {
    position: static;
    max-height: none;
    overflow: visible;
  }

  #app .access-row,
  #app .access-add {
    grid-template-columns: minmax(0, 1fr);
  }

  #app .access-row select,
  #app .access-add select,
  #app .access-add input,
  #app .access-btn {
    font-size: 16px;
    min-height: 36px;
    width: 100%;
  }
}

#view-sales .reveo-reviews {
  display: flex;
  justify-content: flex-start;
  width: fit-content;
  max-width: min(100%, 18rem);
  margin: 0.35rem 0 0.85rem;
  min-height: 0;
}

@media (max-width: 640px) {
  #view-sales .reveo-reviews {
    max-width: 100%;
  }
}

@media (min-width: 960px) {
  #app .sales-shell > .sales-growth,
  #app .sales-shell > .sales-lsa {
    grid-column: 1 / -1;
  }
}

#app .active-chart {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

#app .active-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) 4.2rem;
  gap: 0.55rem;
  align-items: center;
}

#app .active-name,
#app .active-val {
  font-size: 0.82rem;
}

#app .active-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #d5e7be;
}

#app .active-track {
  display: block;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

#app .active-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #78a640;
}

#app .active-by-hour {
  margin-top: 0.75rem;
}

#app .active-hours {
  display: flex;
  align-items: flex-end;
  gap: 0.28rem;
  min-height: 6.5rem;
  margin-top: 0.55rem;
}

#app .active-hour {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 6.2rem;
}

#app .active-hour-bar {
  display: block;
  width: 100%;
  max-width: 1.4rem;
  border-radius: 0.3rem 0.3rem 0.15rem 0.15rem;
  background: #78a640;
}

#app .active-hour-lbl {
  margin-top: 0.25rem;
  font-size: 0.62rem;
  color: var(--muted);
}

#app .weather-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#app .weather-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(120, 166, 64, 0.45);
  background: rgba(120, 166, 64, 0.14);
}

#app .weather-banner-delayed {
  border-color: rgba(240, 180, 41, 0.5);
  background: rgba(240, 180, 41, 0.12);
}

#app .weather-banner-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

#app .weather-banner-status {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

#app .weather-now {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

#app .weather-temp {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

#app .weather-now-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .weather-days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 0.55rem;
  min-width: 0;
  max-width: 100%;
}

#app .weather-day {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.65rem 0.7rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
}

#app .weather-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

#app .weather-day-name {
  margin: 0;
  font-weight: 700;
}

#app .weather-day-date {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

#app .weather-ico {
  width: 1.7rem;
  height: 1.7rem;
  color: #d5e7be;
  flex: 0 0 auto;
}

#app .weather-ico-lg {
  width: 3rem;
  height: 3rem;
}

#app .weather-hi {
  margin: 0.45rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

#app .weather-lo {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

#app .weather-day-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

#app .weather-note,
#app .weather-alert {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .weather-alert {
  color: #f0d48a;
}

/* Phone: person cards first, company total as one line. 390px sits inside this. */
@media (max-width: 480px) {
  #app #view-kpis {
    display: flex;
    flex-direction: column;
  }

  #app #view-kpis > .page-bar {
    order: 1;
  }

  #app #view-kpis > #agent-activity {
    order: 2;
  }

  #app #view-kpis > #kpi-banner {
    order: 3;
  }

  #app #view-kpis > #on-shift {
    order: 4;
  }

  #app #view-kpis > .agents-board {
    order: 5;
  }

  #app #view-kpis > #company {
    order: 6;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.45rem;
  }


  #app #view-kpis > #company .company-line {
    display: block;
    white-space: normal;
    overflow-x: visible;
    overflow-wrap: anywhere;
  }

  #app #view-kpis > #company .company-head,
  #app #view-kpis > #company .company-metrics,
  #app #view-kpis > #company .missed-rule {
    display: none;
  }

  #app .agents-board {
    display: flex;
    flex-direction: column;
  }

  #app .agents-board .grid {
    order: 1;
  }

  #app .agents-board .live-feed {
    order: 2;
    max-height: 12rem;
  }

  #app .brand-logo-compact {
    height: 1.7rem;
    max-width: min(12rem, 58vw);
  }

  #app .app-header {
    padding: 0.28rem 0.6rem 0.28rem;
    gap: 0.2rem;
  }

  #app .translator-card textarea,
  #app .translator-modes button,
  #app .translator-submit,
  #app .translator-secondary {
    font-size: 16px;
  }

  #app .translator-modes button {
    flex-basis: 100%;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#app .company-skel {
  display: grid;
  gap: 0.75rem;
}

#app .skel-line,
#app .skel-tile {
  border-radius: 0.7rem;
  background: linear-gradient(90deg, #151d2a 0%, #1c273a 50%, #151d2a 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

#app .skel-line-lg {
  height: 1.4rem;
  width: 14rem;
}

#app .skel-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

#app .skel-tile {
  height: 4.6rem;
}

#app .offline-banner {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.6rem;
  background: #3a2a12;
  color: #f3e2c4;
}

#app .kpi-updating {
  margin: 0 0 0.4rem;
}

#app .panel-error {
  margin: 0.4rem 0;
  color: var(--danger, #e07a6a);
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: var(--z-toast);
  display: grid;
  gap: 0.4rem;
}

.toast {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  background: #142033;
  color: #e8eef8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.toast-err {
  background: #3a1c1c;
}

#app .upload-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 0.6rem 0 0.8rem;
}

#app .quote-tool {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 52rem;
}

#app .quote-search-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

#app .quote-address-host,
#app .quote-address-host input,
#app .quote-place,
#app gmp-place-autocomplete {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

#app .quote-address-host input,
#app .quote-grid input,
#app .quote-stepper input {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  color-scheme: dark;
}

#app .quote-place,
#app gmp-place-autocomplete {
  color-scheme: dark;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--card);
}

#app .quote-find,
#app .quote-primary {
  border: 0;
  border-radius: 0.75rem;
  background: var(--accent);
  color: #0c1118;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#app .quote-find {
  flex: 0 0 auto;
  padding: 0 1rem;
}

#app .quote-primary {
  min-height: 2.8rem;
  padding: 0.7rem 1.1rem;
}

#app .quote-card,
#app .quote-price-card,
#app .quote-calc {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  padding: 0.9rem 1rem;
}

#app .quote-city {
  margin: 0 0 0.7rem;
  font-size: 1.15rem;
}

#app .quote-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

#app .quote-day {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.45rem 0.35rem 0.4rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-align: center;
}

#app .quote-day.is-approved {
  background: var(--accent-soft);
  border-color: rgba(120, 166, 64, 0.55);
  color: var(--text);
}

#app .quote-day.is-low {
  box-shadow: inset 0 0 0 1px var(--accent);
}

#app .quote-day-name {
  font-weight: 700;
  font-size: 0.85rem;
}

#app .quote-day-rev {
  font-size: 0.75rem;
  color: var(--muted);
}

#app .quote-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#app .quote-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

#app .quote-badges,
#app .quote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

#app .quote-badge,
#app .quote-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
}

#app .quote-badge-earliest {
  color: var(--text);
  background: var(--accent-soft);
}

#app .quote-note,
#app .quote-empty {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .quote-map-wrap {
  position: relative;
}

#app .quote-map {
  height: 22rem;
  width: 100%;
  border-radius: 1rem;
  background: #102033;
  overflow: hidden;
}

#app .quote-toolbar {
  position: absolute;
  z-index: var(--z-raised);
  top: 0.65rem;
  left: 0.65rem;
  right: 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}

#app .quote-toolbar > * {
  pointer-events: auto;
}

#app .quote-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(12, 17, 24, 0.88);
  border: 1px solid var(--line);
}

#app .quote-segment button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

#app .quote-segment button.is-on {
  background: var(--accent);
  color: #0c1118;
  font-weight: 700;
}

#app .quote-chip {
  margin: 0;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(12, 17, 24, 0.88);
  border: 1px solid rgba(120, 166, 64, 0.55);
  color: var(--text);
  font-weight: 700;
}

#app .quote-hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#app .quote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

#app .quote-grid label,
#app .quote-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

#app .quote-service {
  display: flex;
}

#app .quote-addons,
#app .quote-calc {
  color: var(--text);
}

#app .quote-addons summary,
#app .quote-calc summary {
  cursor: pointer;
  font-weight: 650;
}

#app .quote-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.7rem;
}

#app .quote-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

#app .quote-stepper span {
  min-width: 0;
}

#app .quote-stepper input {
  width: 4.5rem;
  flex: 0 0 4.5rem;
  text-align: center;
}

#app .quote-stepper button {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: var(--card-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

#app .quote-unit {
  color: var(--muted);
  font-size: 0.75rem;
}

#app .quote-price-main {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 750;
  color: var(--accent);
}

#app .quote-price-main span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

#app .quote-tiers-wrap {
  margin-top: 0.9rem;
}

#app .quote-tiers-kicker {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app .quote-tiers {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

#app .quote-tiers caption {
  text-align: left;
  font-weight: 650;
  margin-bottom: 0.35rem;
}

#app .quote-tiers th,
#app .quote-tiers td {
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--line);
}

#app .quote-tiers tr.is-current th,
#app .quote-tiers tr.is-current td {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  font-weight: 700;
}

#app .quote-approval {
  margin: 0;
  color: var(--warn);
  font-size: 1.35rem;
  font-weight: 750;
}

#app .quote-copy-status {
  min-height: 1.2rem;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  #app .quote-grid,
  #app .quote-steps {
    grid-template-columns: 1fr;
  }

  #app .quote-map {
    height: 18rem;
  }

  #app .quote-toolbar {
    flex-wrap: wrap;
  }
}

#app .lookup-badge-dual {
  background: #1d4e89;
  color: #f0f7ff;
}

#app .upload-tiles .is-selected {
  border-color: rgba(61, 214, 140, 0.8);
}

#app #uploads-form label {
  display: block;
  margin: 0.45rem 0;
}

#app .ask-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.6rem 0 0.8rem;
}

#app #tools-ask.ask-has-thread .ask-starters {
  display: none;
}

#app .ask-starter,
#app .lookup-reply-channels button,
#app .ask-pill {
  border: 1px solid rgba(120, 166, 64, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

#app .ask-thread {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

#app .ask-bubble,
#app .lookup-reply {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  padding: 0.85rem 0.95rem;
}

#app .ask-bubble-user {
  border-color: rgba(120, 166, 64, 0.55);
}

#app .ask-bubble p,
#app .lookup-reply p {
  margin: 0.25rem 0;
  white-space: pre-wrap;
}

#app .ask-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0;
}

#app .ask-pill {
  cursor: default;
  text-decoration: none;
}

/* Playbook pills are labels. They do not open the rules sheet. */
#app .ask-pill-playbook {
  cursor: default;
  text-decoration: none;
}

#app .ask-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0 0.5rem;
}

#app .ask-toolbar .ask-memory {
  position: relative;
  margin: 0;
}

#app .ask-toolbar .ask-memory summary {
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  font-size: 0.82rem;
}

#app .ask-toolbar .ask-memory summary::-webkit-details-marker {
  display: none;
}

#app .ask-toolbar .ask-memory[open] #ask-memory-list {
  position: absolute;
  right: 0;
  z-index: var(--z-raised);
  width: min(18rem, 80vw);
  margin-top: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.6rem;
}

/* Phone Ask: pin the form above the Calls bar and the nav. */
@media (max-width: 390px) {
  #app #tools-ask .ask-form {
    position: fixed;
    left: 0;
    right: 0;
    z-index: var(--z-raised);
    bottom: calc(48px + var(--nav-h, 56px) + env(safe-area-inset-bottom, 0px));
    margin: 0;
    padding: 0.4rem 0.7rem;
    background: var(--bg, #0c1118);
    border-top: 1px solid var(--line);
    box-sizing: border-box;
  }

  #app #tools-ask .ask-thread {
    padding-bottom: 11rem;
  }
}

#app .ask-new {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

#app .ask-md p {
  white-space: normal;
}

#app .ask-md ul,
#app .ask-md ol {
  margin: 0.3rem 0 0.3rem 1.2rem;
  padding: 0;
}

#app .ask-md li {
  margin: 0.15rem 0;
}

#app .ask-bubble p.ask-nudge {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

#app .ask-nudge a {
  color: var(--accent);
}

#app .lookup-reply-skeleton {
  margin: 0.4rem 0;
}

#app .ask-remembered {
  color: var(--muted);
  font-size: 0.85rem;
}

#app .ask-skeleton span {
  display: block;
  height: 0.65rem;
  margin: 0.4rem 0;
  border-radius: 999px;
  background: rgba(120, 166, 64, 0.28);
  animation: ask-pulse 1.2s ease-in-out infinite;
}

#app .ask-skeleton span:nth-child(2) {
  width: 86%;
}

#app .ask-skeleton span:nth-child(3) {
  width: 64%;
}

@keyframes ask-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

#app .ask-form textarea,
#app .lookup-reply textarea {
  width: 100%;
  margin: 0.3rem 0 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  padding: 0.6rem 0.7rem;
}

#app .lookup-reply {
  margin-top: 1rem;
}

#app .lookup-reply-channels button[aria-pressed="true"] {
  background: var(--accent);
  color: #0c1118;
}

#app .crew-page {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 1rem;
}

/* Freshness and upload share one quiet row (was two full-width green bars). */
#app .crew-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}

#app .crew-freshness {
  margin: 0;
  flex: 1 1 14rem;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
}

#app .crew-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  flex: 1 1 22rem;
  margin: 0;
}

#app .crew-upload-hint {
  flex: 1 1 14rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

#app .crew-modes,
#app .crew-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

#app .crew-page button,
#app .crew-upload-btn,
#app .crew-settings-card button {
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#app .crew-mode.is-on,
#app .crew-status-working {
  background: var(--accent);
  color: #0c1118;
  border-color: transparent;
}

#app .crew-status-out,
#app .crew-status-mech {
  background: var(--warn, #f0b429);
  color: #1c1404;
  border-color: transparent;
}

#app .crew-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}

#app .crew-tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

#app .crew-tile h3 {
  margin: 0;
  font-size: 1.2rem;
}

#app .crew-meta,
#app .crew-places,
#app .crew-note,
#app .crew-empty,
#app .crew-notice,
#app .crew-needs {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

#app .crew-stats {
  margin: 0.55rem 0 0;
  font-size: 1.05rem;
}

#app .crew-flag {
  margin: 0.45rem 0 0;
  font-weight: 800;
}

#app .crew-sync-unknown,
#app .crew-tile.crew-sync-unknown .crew-sync {
  color: var(--warn);
  font-weight: 700;
}

/* A possibly-stale tile keeps readable text and gets an amber edge; the
   "Possibly stale" line itself is amber (about 9:1 on the card). */
#app .crew-tile.crew-sync-unknown {
  color: var(--muted);
  border-color: rgba(240, 180, 41, 0.55);
}

#app .crew-upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  overflow: hidden;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--accent);
}

#app .crew-upload-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app .crew-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-size: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

#app .crew-note-field,
#app .crew-eta label,
#app .crew-roster label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 700;
  margin-top: 0.45rem;
}

#app .crew-page input,
#app .crew-page select,
#app .crew-roster input,
#app .crew-roster select {
  min-height: 48px;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  padding: 0.4rem 0.7rem;
}

#app .crew-list {
  margin: 0;
  padding-left: 1.1rem;
}

#app .crew-list li {
  margin: 0.45rem 0;
}

#app .crew-reply {
  margin: 0.45rem 0;
}

#app .crew-global {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.8rem 1rem;
}

#app .crew-global h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

#app .crew-global ul {
  margin: 0;
  padding-left: 1.1rem;
}

#app .crew-roster-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

#app .crew-check {
  flex-direction: row;
  align-items: center;
  min-height: 48px;
}

#app .crew-save-msg {
  margin: 0.6rem 0 0;
  font-weight: 800;
}

#app .crew-save-ok {
  color: var(--accent);
}

#app .crew-save-bad {
  color: #e85d4c;
}

#app .crew-foot {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
}

#app .crew-picks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#app .crew-page button[disabled] {
  opacity: 0.55;
  cursor: default;
}

@media (min-width: 720px) {
  #app .crew-roster-row {
    grid-template-columns: 0.6fr 1fr 1fr 1fr auto;
    align-items: end;
  }
}

/* UI batch 1 (2026-10-30): contrast, touch size, search state, access confirm. */
#app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
#app select,
#app textarea {
  border-color: var(--border-strong);
}

#app .access-row {
  gap: 0.75rem 1rem;
}

#app .access-confirm {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--err);
  border-radius: var(--radius-md);
  background: var(--err-soft);
}

#app .access-confirm-text {
  flex: 1 1 14rem;
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

#app .access-btn-danger {
  color: var(--text);
  border-color: var(--err);
  background: rgba(240, 113, 120, 0.22);
}

#app .ops-searching,
#app .crew-searching {
  margin: 0.75rem 0;
  color: var(--text);
}

#app .crew-eta button[disabled],
#app .lookup-search button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

@media (pointer: coarse) {
  /* !important: many controls set a 32-34px min-height with higher specificity. */
  #app button:not([data-nav]),
  #app .sign-out,
  #app select,
  #app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
    min-height: 44px !important;
  }

  #app .gear-btn {
    width: 44px;
    height: 44px;
  }
}

/* Call proof: the calls behind one agent-card number. */
#app .overlay-card.proof-card {
  /* The base overlay card is 420px wide; the proof table needs all 7 columns visible at 1280px. */
  width: min(1040px, 100%);
  max-width: 100%;
  max-height: min(88vh, 900px);
}
#app .proof-scroll {
  max-height: 60vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#app .proof-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
#app .proof-table th,
#app .proof-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.2);
  text-align: left;
  white-space: nowrap;
}
#app .proof-table th {
  position: sticky;
  top: 0;
  background: var(--card, #fff);
}
#app .proof-table td.proof-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
#app .tile.proof-tile {
  cursor: pointer;
}
@media (max-width: 760px) {
  /* Phones: one stacked card per call, label on the left, value on the right. */
  #app .proof-scroll {
    max-height: none;
    overflow: visible;
  }
  #app .proof-table thead {
    display: none;
  }
  #app .proof-table,
  #app .proof-table tbody,
  #app .proof-table tr,
  #app .proof-table td {
    display: block;
    width: 100%;
  }
  #app .proof-table tr {
    padding: 6px 0;
    border-bottom: 1px solid rgba(127, 127, 127, 0.35);
  }
  #app .proof-table td {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 3px 4px;
    border-bottom: 0;
    white-space: normal;
    text-align: right;
    overflow-wrap: anywhere;
  }
  #app .proof-table td::before {
    content: attr(data-label);
    grid-column: 1;
    min-width: 0;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    font-weight: 600;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    opacity: 0.75;
  }
  #app .proof-table td > * {
    grid-column: 2;
    justify-self: end;
    font-weight: 700;
    color: var(--text);
    overflow-wrap: anywhere;
  }
  #app .proof-table td.proof-id {
    word-break: break-all;
  }
}
#app #missed-cutoff-input {
  width: 72px;
  margin-right: 8px;
}

/* Dual client tag lists (Uploads and Lookup). */
#app .dual-tags .dual-list h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin: 12px 0 6px;
}
#app .dual-tags .dual-list ul {
  margin: 0;
  padding-left: 18px;
  max-height: 260px;
  overflow: auto;
}
#app .dual-tags .dual-list li {
  overflow-wrap: anywhere;
}

/* One centered column. Header, pills, gear, and cards share these gutters. */
#app {
  --shell-max: 1120px;
  --shell-gutter: 1.25rem;
  --header-h: 0px;
  overflow-x: clip;
}

#app-shell {
  width: min(100%, var(--shell-max));
  max-width: var(--shell-max);
  min-width: 0;
  margin-inline: auto;
}

#app .app-header,
#app-view {
  padding-left: var(--shell-gutter);
  padding-right: var(--shell-gutter);
}

#app-nav {
  padding-left: max(var(--shell-gutter), calc((100% - var(--shell-max)) / 2 + var(--shell-gutter)));
  padding-right: max(var(--shell-gutter), calc((100% - var(--shell-max)) / 2 + var(--shell-gutter)));
  box-sizing: border-box;
}

#app .card,
#app .owner-card,
#app .sales-block,
#app .live-board .live-widget,
#app .settings-card,
#app .tool-tile,
#app .kpi-banner {
  background: rgba(21, 29, 42, 0.78);
  border: 1px solid rgba(94, 128, 140, 0.38);
  border-radius: 0.9rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(120, 166, 64, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

#app .periods button,
#app .gear-btn,
#app .sign-out,
#app-nav button[data-nav] {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

#app .owner-mtd {
  white-space: nowrap;
}

#app .month-toggle {
  display: none;
}

#app .owner-card h2,
#app .view-title,
#app h1 {
  letter-spacing: -0.02em;
}

@media (max-width: 760px) {
  #app {
    --shell-gutter: 1rem;
    --header-h: clamp(44px, 7vh, 56px);
  }

  /* Every data table becomes a stack of cards. Labels are data-label. */
  #app .proof-scroll,
  #app .sales-growth-scroll,
  #app .quote-tiers-wrap {
    max-height: none;
    overflow: visible;
    max-width: 100%;
  }

  #app table {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }

  #app table thead {
    display: none;
  }

  #app table tbody,
  #app table tr,
  #app table td,
  #app table tbody th {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #app .owner-table tr,
  #app .sales-growth-table tr,
  #app .proof-table tr,
  #app .quote-tiers tr,
  #app table tr {
    margin: 0 0 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: rgba(21, 29, 42, 0.78);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(120, 166, 64, 0.12);
  }

  #app .owner-table td,
  #app .owner-table tbody th,
  #app .sales-growth-table td,
  #app .proof-table td,
  #app .quote-tiers td,
  #app .quote-tiers tbody th,
  #app table td,
  #app table tbody th {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 0.75rem;
    padding: 0.4rem 0;
    border: 0;
    text-align: right;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
    max-width: 100%;
    background: transparent;
  }

  #app table tbody tr > :first-child {
    display: block;
    grid-template-columns: none;
    width: 100%;
    max-width: 100%;
    padding: 0 0 0.4rem;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    color: var(--text);
  }

  #app table tbody tr > :first-child::before {
    content: none;
  }

  #app table td::before,
  #app table tbody th::before {
    content: attr(data-label);
    grid-column: 1;
    min-width: 0;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    font-weight: 650;
    font-size: 0.82rem;
    text-align: left;
    color: var(--muted);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #app table td > *,
  #app table tbody th > * {
    grid-column: 2;
    justify-self: end;
    text-align: right;
    font-weight: 700;
    font-size: inherit;
    color: var(--text);
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #app table td > .cell-val,
  #app table tbody th > .cell-val,
  #app table td > .owner-bar-n {
    grid-column: 2;
    justify-self: end;
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
    min-width: max-content;
    max-width: none;
    overflow-wrap: normal;
  }

  #app table.month-collapse:not(.is-expanded) tr.month-extra {
    display: none !important;
  }

  #app .month-toggle {
    display: inline-flex;
    align-items: center;
    margin: 0.35rem 0 0.15rem;
    min-height: 44px;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 166, 64, 0.55);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  #app .proof-table td.proof-id {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  #app .grid,
  #app .skel-grid,
  #app .tools-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  }

  #app .owner-kpis,
  #app .owner-stats,
  #app .owner-grid,
  #owner-root,
  #app .owner-card,
  #app .owner-note,
  #app .owner-updated {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #app .owner-kpis,
  #app .owner-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  #app .owner-kpi-lbl,
  #app .owner-kpi-sub,
  #app .owner-kpi-val,
  #app .owner-note,
  #app .owner-updated,
  #app .view-copy {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  html.has-session #app .app-header,
  #app:has(#view-sales:not([hidden])) .app-header,
  #app .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    max-width: 100%;
    height: clamp(44px, 7vh, 56px);
    min-height: clamp(44px, 7vh, 56px);
    max-height: clamp(44px, 7vh, 56px);
    overflow: hidden;
    gap: 0.35rem;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
  }

  #app-view {
    padding-top: var(--header-h);
  }

  #app .header-brand,
  #app .brand-top,
  #app .brand-title-block,
  #app .brand-meta-row,
  #app .header-actions,
  #app .identity-compact {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
  }

  #app .header-brand {
    flex: 1 1 auto;
    gap: 0.35rem;
  }

  #app .brand-meta-row {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 0.25rem;
  }

  #app .header-actions {
    flex: 0 0 auto;
    width: auto;
  }

  #app .sub {
    display: none;
  }

  #app .brand-logo-compact {
    height: 1.55rem;
    max-width: 7.5rem;
  }

  #app .app-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  #app h1 {
    display: none;
  }

  #app .who {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    font-size: 0;
  }

  #app .who::after {
    content: attr(data-short);
    font-size: 0.75rem;
    line-height: 1.2;
  }

  #app .sign-out {
    width: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
  }

  #app .sign-out::before {
    content: "\21A9";
    font-size: 0.95rem;
    line-height: 1;
  }
}

/* Mobile overflow guardrails. Cards and tiles stay inside the viewport. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow-x: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

#app,
#app-shell,
#app-view,
#app .grid > *,
#app .skel-grid > *,
#app .tools-grid > *,
#app .card,
#app .tile,
#app .tool-tile,
#app .owner-card,
#app .sales-block {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 760px) {
  #app {
    --shell-gutter: 16px;
  }

  #app .card h3,
  #app .owner-kpi-lbl,
  #app .owner-kpi-sub,
  #app .owner-stat-lbl,
  #app .tool-label,
  #app .tool-hint,
  #app .tile .lbl,
  #app .view-copy {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  #app .owner-kpi-val,
  #app .stat .val,
  #app .tile .val {
    font-size: clamp(0.95rem, 4.6vw, 1.35rem);
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  #app .card,
  #app .owner-card,
  #app .owner-kpi,
  #app .tool-tile,
  #app .stat {
    padding: 16px;
    box-sizing: border-box;
  }

  #app .header-actions {
    margin-left: 22px;
  }

  #app .grid,
  #app .skel-grid,
  #app .stat-row,
  #app .owner-grid,
  #app .owner-kpis,
  #app .owner-stats,
  #app .sales-shell,
  #app .tools-grid,
  #app .live-board .live-widgets {
    grid-template-columns: minmax(0, 1fr);
  }

  #view-owner,
  #view-kpis,
  #view-sales,
  #view-tools,
  #owner-root,
  #sales-root,
  #app .owner-grid > *,
  #app .sales-shell > *,
  #app .tools-shell,
  #app .agents-board,
  #app .section-jumps {
    min-width: 0;
    max-width: 100%;
  }

  #app .card-email,
  #app .card h3 {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

}

.signout-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.signout-modal[hidden] {
  display: none !important;
}

.signout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.signout-dialog {
  position: relative;
  z-index: var(--z-base);
  width: min(100%, 22rem);
  margin: 0;
  padding: 1.15rem 1.1rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(120, 166, 64, 0.55);
  background: #151d2a;
  color: #e8eef7;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(120, 166, 64, 0.2);
}

.signout-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.signout-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.signout-actions button {
  min-height: 44px;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#signout-cancel {
  background: transparent;
  color: #e8eef7;
  border: 1px solid #5e808c;
}

#signout-confirm,
.signout-danger {
  background: #f07178;
  color: #1c1214;
  border: 0;
}

.tutorial-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}

.tutorial-modal[hidden] {
  display: none !important;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tutorial-spot {
  position: fixed;
  z-index: var(--z-modal-spot);
  border: 2px solid #78a640;
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(120, 166, 64, 0.35);
  pointer-events: none;
}

.tutorial-spot[hidden] {
  display: none !important;
}

.tutorial-dialog {
  position: fixed;
  z-index: var(--z-modal-top);
  left: 16px;
  right: 16px;
  width: auto;
  max-width: 22rem;
  margin: 0 auto;
  max-height: min(46vh, 22rem);
  overflow: auto;
  padding: 1rem 1rem 0.85rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(120, 166, 64, 0.55);
  background: #151d2a;
  color: #e8eef7;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(120, 166, 64, 0.2);
}

.tutorial-count {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c5d0dc;
}

.tutorial-dialog h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.tutorial-dialog p {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.tutorial-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 0 0.35rem;
}

.tutorial-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #e8eef7;
}

.tutorial-swatch i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 0.35rem;
}

.tutorial-actions button {
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

#tutorial-back,
#tutorial-skip {
  background: transparent;
  color: #e8eef7;
  border: 1px solid #5e808c;
}

#tutorial-skip {
  margin-right: auto;
}

#tutorial-back:disabled {
  opacity: 0.45;
  cursor: default;
}

#tutorial-next {
  background: #78a640;
  color: #0b1a20;
  border: 0;
}

.tutorial-live-sample {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 16px 0;
  grid-column: 1 / -1;
}

.tutorial-live-sample .status-badge {
  white-space: nowrap;
}

html.tutorial-open,
html.tutorial-open body {
  overflow: hidden;
}

/* Period control and section chips share one sticky bar under the header.
   8px pad + 32px track + 6px gap + 30px chips + 8px pad = 84px.
   Opaque fill so a phone browser cannot show scrolling cards through the bar. */
#app .page-bar {
  --bar-h: 84px;
  position: sticky;
  top: var(--header-h, 0px);
  z-index: var(--z-pagebar);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "track" "chips";
  grid-template-rows: 32px 30px;
  row-gap: 6px;
  align-content: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 84px;
  max-height: 84px;
  margin: 0 0 8px;
  padding: 8px 0;
  box-sizing: border-box;
  background: #0f1a2b;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

#app .page-bar:not(:has(.periods)) {
  --bar-h: 46px;
  grid-template-areas: "chips";
  grid-template-rows: 30px;
  height: 46px;
  max-height: 46px;
}

#app .page-bar:not(:has(.section-jumps button)) {
  --bar-h: 48px;
  grid-template-areas: "track";
  grid-template-rows: 32px;
  height: 48px;
  max-height: 48px;
}

#app .page-bar:not(:has(button)) {
  display: none;
}

#app .page-bar::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: calc(-1 * var(--shell-gutter));
  right: calc(-1 * var(--shell-gutter));
  top: 0;
  bottom: 0;
  background: #0f1a2b;
}

#app .page-bar .periods {
  grid-area: track;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  width: 100%;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 3px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(232, 238, 247, 0.08);
}

#app .page-bar .periods button[data-period] {
  flex: 1 1 0;
  align-self: center;
  min-width: 0;
  height: 26px;
  min-height: 26px !important;
  max-height: 26px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #e8eef7;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

#app .page-bar .periods button[data-period].active {
  background: #78a640;
  color: var(--on-accent);
  border-color: transparent;
}

#app .section-jumps {
  grid-area: chips;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px;
}

#app .section-jumps:empty {
  display: none;
}

#app .section-jumps::-webkit-scrollbar {
  display: none;
}

#app .section-jumps.can-scroll-left.can-scroll-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 16px), transparent);
}

#app .section-jumps.can-scroll-left:not(.can-scroll-right) {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 100%);
  mask-image: linear-gradient(to right, transparent, #000 12px, #000 100%);
}

#app .section-jumps.can-scroll-right:not(.can-scroll-left) {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 16px), transparent);
}

#app .section-jumps button[data-jump] {
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  scroll-snap-align: center;
  white-space: nowrap;
  height: 32px;
  min-height: 32px !important;
  max-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(232, 238, 247, 0.08);
  color: #e8eef7;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

#app .section-jumps button[data-jump].is-active {
  background: #78A640;
  color: #0b1a20;
  border-color: transparent;
}

#app:has(#on-shift[hidden]) .section-jumps [data-jump="on-shift"],
#app:has(#tool-lookup[hidden]) .section-jumps [data-jump="tool-lookup"],
#app:has(#tool-weather[hidden]) .section-jumps [data-jump="tool-weather"],
#app:has(#tool-uploads[hidden]) .section-jumps [data-jump="tool-uploads"] {
  display: none;
}

#view-kpis,
#view-sales {
  --bar-h: 84px;
}

#view-owner,
#view-tools {
  --bar-h: 46px;
}

#app #company,
#app #answer-connect,
#app #on-shift,
#app #cards,
#app #sales-growth,
#app #sales-totals,
#app #sales-agents,
#app #sales-recent,
#app #sales-lsa,
#app .card,
#app .activity-tile,
#app .company,
#app .owner-card,
#app .owner-kpis,
#app .owner-chip,
#app .sales-block,
#app .tool-tile {
  scroll-margin-top: calc(var(--header-h, 64px) + var(--bar-h, 84px) + 12px);
}

#app .sales-totals .tile,
#app .sales-totals button.tile {
  min-height: 4.6rem;
  box-sizing: border-box;
}

#app .tile .val.pending,
#app .stat .val.pending {
  color: transparent;
  position: relative;
}

#app .tile .val.pending::before,
#app .stat .val.pending::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 42%;
  height: 1.05rem;
  border-radius: 6px;
  background: rgba(232, 238, 247, 0.14);
}

#view-live,
#view-settings,
#view-owner:not(:has(.page-bar button)) {
  padding-top: 8px;
}

#app .page-age {
  margin: 0 0 6px;
  font-size: 0.75rem;
  line-height: 1.2;
}

#app .info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0 0 0 6px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(232, 238, 247, 0.35);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 1px;
  cursor: help;
}

/* Loading call tiles are the size of the filled tiles, so the cards do not
   grow when the call log lands. */
#app .tile[data-pending="calls"] .val.pending {
  font-size: 1.15rem;
}

/* Card tiles are divs or proof buttons; buttons do not inherit the line
   height, so the same tile was 4px shorter once it became a button. */
#app .card .tile {
  line-height: 1.5;
}

@media (max-width: 760px) {
  #app .tile[data-pending="calls"] .val.pending {
    font-size: clamp(0.95rem, 4.6vw, 1.35rem);
  }
}

/* "· updating…" after an "as of" stamp while the cached first paint waits
   for the live numbers. Inline, so the stamp line does not grow. */
#app .asof-updating {
  opacity: 0.75;
  font-style: italic;
  white-space: nowrap;
}

/* Batch C: info button. A small round themed "i", centered with the title,
   with a 44px tap target from transparent padding (no layout growth). */
#app button.info-dot.info-dot {
  box-sizing: border-box;
  /* 22px circle (content box) inside a 44px tap target. */
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 11px;
  margin: -11px -11px -11px -5px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(232, 238, 247, 0.06) calc(100% - 1.5px), rgba(232, 238, 247, 0.38) calc(100% - 1px), transparent 100%) content-box;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  vertical-align: middle;
  display: inline-block;
  cursor: help;
  box-shadow: none;
}
#app button.info-dot.info-dot:hover { color: var(--text, #e8eef7); }
#app button.info-dot.info-dot:focus-visible { outline: 2px solid var(--accent, #4ea1ff); outline-offset: -9px; }
#app .val.pending[data-loading],
#app .activity-val.pending[data-loading],
#app .activity-mini-val.pending[data-loading] {
  color: var(--muted);
  animation: mb-loading-pulse 1.4s ease-in-out infinite;
}
@keyframes mb-loading-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  #app [data-loading] { animation: none; }
}
