/* NEXORA Field Force — design tokens ported from fieldforce.html prototype.
   Dark-first, teal accent, 430px phone shell, RTL-aware. */

/* Default Arabic typeface for all modules: DIN Next LT Arabic (ASSETS/fonts).
   Relative URLs keep working under any base path; the PWA service worker
   caches .ttf for offline use. */
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 200;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-ultralight.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 300;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-light.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-regular.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-medium.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-bold.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 800;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-heavy.ttf') format('truetype');
}
@font-face {
  font-family: 'DIN Next LT Arabic'; font-style: normal; font-weight: 900;
  font-display: swap; src: url('../fonts/din-next-lt-arabic-black.ttf') format('truetype');
}

:root {
  --nxr-teal: #0f172a;
  --nxr-teal-dim: #1e293b;
  --nxr-teal-glow: rgba(15,23,42,0.12);
  --nxr-teal-fg: #0f172a;
  --nxr-amber: #F59E0B;
  --nxr-amber-dim: rgba(245,158,11,0.15);
  --nxr-danger: #EF4444;
  --nxr-danger-dim: rgba(239,68,68,0.12);
  --nxr-success: #22C55E;
  --nxr-success-dim: rgba(34,197,94,0.12);
  --nxr-info: #60A5FA;
  --tier-a: #F59E0B;
  --tier-b: #00C2A8;
  --tier-c: #94A3B8;
  --font-main: 'DIN Next LT Arabic', sans-serif;
  --tx-fast: 120ms ease;
  --tx-std: 220ms ease;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --header-h: 60px;
  --nav-h: 64px;
  --shell-max: 430px;
}

[data-theme="dark"] {
  --bg-base: #0A0F1E; --bg-surface: #111827; --bg-card: #1A2235;
  --bg-card-alt: #1E2A3A; --bg-elevated: #243044; --bg-overlay: rgba(10,15,30,0.92);
  --border: rgba(255,255,255,0.07); --border-focus: rgba(226,232,240,0.5);
  --text-primary: #F1F5F9; --text-secondary: #94A3B8; --text-muted: #64748B;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4); --shadow-float: 0 8px 32px rgba(0,0,0,0.6);
  --nav-bg: rgba(17,24,39,0.96); --header-bg: rgba(10,15,30,0.95);
  --nxr-teal-fg: #e2e8f0; --nxr-teal-glow: rgba(226,232,240,0.12);
}
[data-theme="light"] {
  --bg-base: #F0F4F8; --bg-surface: #FFFFFF; --bg-card: #FFFFFF;
  --bg-card-alt: #F8FAFC; --bg-elevated: #F1F5F9; --bg-overlay: rgba(240,244,248,0.95);
  --border: rgba(0,0,0,0.08); --border-focus: rgba(15,23,42,0.4);
  --text-primary: #0F172A; --text-secondary: #475569; --text-muted: #94A3B8;
  --shadow-card: 0 1px 8px rgba(0,0,0,0.08); --shadow-float: 0 8px 32px rgba(0,0,0,0.15);
  --nav-bg: rgba(255,255,255,0.96); --header-bg: rgba(255,255,255,0.95);
}
[data-dir="rtl"] { direction: rtl; text-align: start; }
/* Directional icons only (chevrons/arrows with .flip-rtl) mirror in RTL;
   symmetric icons (bell, theme, translate) must NOT flip. */
[data-dir="rtl"] .flip-rtl { transform: scaleX(-1); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Form controls never inherit body type by default — force the DIN stack. */
button, input, select, textarea, option { font-family: inherit; }
html, body { height: 100%; }
body { font-family: var(--font-main); background: var(--bg-base); color: var(--text-primary); -webkit-font-smoothing: antialiased; }

.app-shell { position: fixed; inset: 0; max-width: var(--shell-max); margin: 0 auto; display: flex; flex-direction: column; background: var(--bg-base); color: var(--text-primary); overflow: hidden; box-shadow: 0 0 60px rgba(0,0,0,0.5); }
.app-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: var(--header-h); padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }
.ff-page { min-height: 100%; padding: 16px 16px 8px; animation: ffFade 180ms ease; }
@keyframes ffFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.app-header { position: fixed; top: 0; left: 50%; width: 100%; max-width: var(--shell-max); transform: translateX(-50%); height: var(--header-h); background: var(--header-bg); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 100; }
.header-brand { display: flex; align-items: baseline; gap: 6px; flex: 1; }
.header-brand .brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: var(--nxr-teal-fg); }
.header-brand .brand-sub { font-size: 10px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }
.header-brand-stacked { display: flex; flex-direction: column; line-height: 1.05; flex: 1; }
.header-brand-stacked .brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: var(--nxr-teal-fg); }
.header-brand-stacked .brand-sub-thin { font-size: 11px; font-weight: 300; color: var(--text-muted); letter-spacing: 0.4px; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.header-btn { width: 40px; height: 40px; border: none; background: transparent; color: var(--text-secondary); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; position: relative; text-decoration: none; }
.header-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.header-btn .notif-badge { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; background: var(--nxr-danger); border-radius: 50%; }

.online-pill { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--nxr-success); background: var(--nxr-success-dim); padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.online-pill .dot { width: 6px; height: 6px; background: var(--nxr-success); border-radius: 50%; animation: ffPulse 2s infinite; }
@keyframes ffPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.online-pill.offline { color: var(--text-muted); background: var(--bg-card); }
.online-pill.offline .dot { background: var(--text-muted); animation: none; }

.bottom-nav { position: fixed; bottom: 0; left: 50%; width: 100%; max-width: var(--shell-max); transform: translateX(-50%); height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); background: var(--nav-bg); backdrop-filter: blur(20px); border-top: 1px solid var(--border); display: flex; padding-top: 4px; z-index: 100; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; min-height: 48px; text-decoration: none; position: relative; font-family: var(--font-main); }
.nav-item:hover { color: var(--text-secondary); }
.nav-item.on { color: var(--nxr-teal-fg); background: var(--nxr-teal-glow); border-radius: 12px; }
.nav-item.on .nav-icon { font-size: 24px; }
.nav-item.on .nav-label { font-weight: 700; }
.nav-icon { font-size: 22px; line-height: 1; position: relative; }
.nav-label { font-size: 10px; font-weight: 500; }
.nav-badge { position: absolute; top: -2px; inset-inline-end: -6px; min-width: 16px; height: 16px; background: var(--nxr-danger); color: #fff; font-size: 9px; font-weight: 700; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

.nxr-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-card); }
.nxr-card-featured { background: linear-gradient(135deg, #0F2744 0%, #1a2f50 100%); border: 1px solid rgba(15,23,42,0.35); border-radius: 20px; padding: 20px; position: relative; overflow: hidden; }
.kpi-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.kpi-strip::-webkit-scrollbar { display: none; }
.kpi-card { flex: 0 0 108px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.kpi-value { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.kpi-label { font-size: 10px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.btn-nxr { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 20px; height: 48px; border-radius: 12px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; white-space: nowrap; text-decoration: none; font-family: var(--font-main); }
.btn-nxr:active { transform: scale(0.97); }
.btn-nxr:disabled { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--nxr-teal); color: #ffffff; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline { background: transparent; color: var(--nxr-teal-fg); border: 1.5px solid var(--nxr-teal); }
.btn-danger { background: var(--nxr-danger); color: #fff; }
.btn-amber { background: var(--nxr-amber); color: #0A0F1E; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-full { width: 100%; }

.badge-nxr { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-teal { background: var(--nxr-teal-glow); color: var(--nxr-teal-fg); }
.badge-amber { background: var(--nxr-amber-dim); color: var(--nxr-amber); }
.badge-danger { background: var(--nxr-danger-dim); color: var(--nxr-danger); }
.badge-success { background: var(--nxr-success-dim); color: var(--nxr-success); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }
.tier-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 20px; border-radius: 4px; font-size: 10px; font-weight: 800; }
.tier-a { background: rgba(245,158,11,0.15); color: var(--tier-a); }
.tier-b { background: rgba(0,194,168,0.15); color: var(--tier-b); }
.tier-c { background: rgba(148,163,184,0.12); color: var(--tier-c); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; }
.section-action { font-size: 12px; color: var(--nxr-teal-fg); background: none; border: none; cursor: pointer; text-decoration: none; font-family: var(--font-main); }
.fs-label { font-size: 11px; font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-muted); }
.fs-caption { font-size: 11px; color: var(--text-muted); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: #ffffff; flex-shrink: 0; background: linear-gradient(135deg, var(--nxr-teal), var(--nxr-teal-dim)); text-transform: uppercase; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

.progress-nxr { height: 6px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.progress-bar-nxr { height: 100%; border-radius: 4px; background: var(--nxr-teal); transition: width 0.5s ease; }
.progress-bar-amber { background: var(--nxr-amber); }
.progress-bar-danger { background: var(--nxr-danger); }

.chip-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-strip::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; white-space: nowrap; flex-shrink: 0; font-family: var(--font-main); }
.chip.on { background: var(--nxr-teal-glow); border-color: var(--nxr-teal-fg); color: var(--nxr-teal-fg); }

.input-nxr { width: 100%; height: 48px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; color: var(--text-primary); font-size: 14px; font-family: var(--font-main); padding: 0 14px; outline: none; }
.input-nxr::placeholder { color: var(--text-muted); }
.input-nxr:focus { border-color: var(--nxr-teal-fg); box-shadow: 0 0 0 3px var(--nxr-teal-glow); }
.input-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; display: block; }
textarea.input-nxr { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input-nxr { cursor: pointer; }
.seg-tabs { display: flex; background: var(--bg-card); border-radius: 12px; padding: 3px; gap: 2px; border: 1px solid var(--border); }
.seg-tab { flex: 1; padding: 8px 6px; border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500; border-radius: 9px; cursor: pointer; text-align: center; font-family: var(--font-main); }
.seg-tab.on { background: var(--bg-elevated); color: var(--text-primary); }

.alert-nxr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.alert-warning { background: var(--nxr-amber-dim); border: 1px solid rgba(245,158,11,0.3); color: var(--nxr-amber); }
.alert-danger { background: var(--nxr-danger-dim); border: 1px solid rgba(239,68,68,0.25); color: var(--nxr-danger); }
.alert-success { background: var(--nxr-success-dim); border: 1px solid rgba(34,197,94,0.25); color: var(--nxr-success); }
.alert-info { background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.25); color: var(--nxr-info); }

.offline-banner { background: var(--nxr-amber-dim); border: 1px solid rgba(245,158,11,0.3); border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--nxr-amber); margin-bottom: 12px; }

.alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; font-size: 13px; color: var(--text-secondary); cursor: pointer; font-family: var(--font-main); }
.alert-item .arrow { margin-inline-start: auto; color: var(--text-muted); font-size: 14px; }

.ff-switch { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); position: relative; cursor: pointer; flex-shrink: 0; margin: 0; }
.ff-switch:checked { background: var(--nxr-teal); border-color: var(--nxr-teal-fg); }
.ff-switch::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start var(--tx-fast); }
.ff-switch:checked::after { inset-inline-start: 22px; }

.greeting-block { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.greeting-line { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.greeting-date { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.nba-card { background: linear-gradient(140deg, #082540 0%, #0d2a45 50%, #0f2e4e 100%); border: 1px solid rgba(15,23,42,0.45); border-radius: 20px; padding: 18px; margin-bottom: 24px; position: relative; overflow: hidden; }
.nba-label { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; color: var(--nxr-teal-fg); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }

.visit-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; display: inline-block; }
.status-planned { background: var(--text-muted); }
.status-active { background: var(--nxr-teal); animation: ffPulse 2s infinite; }
.status-completed { background: var(--nxr-success); }
.status-overdue { background: var(--nxr-danger); }

.timeline-item { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; border: 2px solid var(--border); background: var(--bg-elevated); }
.timeline-dot.teal { background: var(--nxr-teal); border-color: var(--nxr-teal-fg); }
.timeline-dot.amber { background: var(--nxr-amber); border-color: var(--nxr-amber); }
.timeline-dot.danger { background: var(--nxr-danger); border-color: var(--nxr-danger); }
.timeline-dot.muted { background: var(--text-muted); border-color: var(--text-muted); }
.timeline-connector { width: 2px; height: 20px; background: var(--border); margin-inline-start: 5px; }

.route-stop { display: flex; gap: 12px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.route-stop.done { background: var(--nxr-success-dim); border-color: rgba(34,197,94,0.2); }
.route-stop.active-stop { border-color: var(--nxr-teal-fg); box-shadow: 0 0 0 1px var(--nxr-teal-glow); }
.route-stop-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.route-stop-num.done { background: var(--nxr-success); color: #0A0F1E; }
.route-stop-num.active-n { background: var(--nxr-teal); color: #ffffff; }
.route-stop-num.overdue-n { background: var(--nxr-danger); color: #fff; }
.route-stop-num.planned-n { background: var(--bg-elevated); color: var(--text-muted); border: 1.5px solid var(--border); }

.ff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ff-table th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ff-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ff-table tr:last-child td { border-bottom: none; }
.ff-table tr.me { background: var(--nxr-teal-glow); }

.ff-login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.ff-login-card { width: 100%; max-width: 360px; }
.ff-err { background: var(--nxr-danger-dim); border: 1px solid rgba(239,68,68,0.3); color: var(--nxr-danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.mb-section { margin-bottom: 24px; }
.ff-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ff-map { height: 180px; background: linear-gradient(135deg,#0d2a45,#1a3a55); border-radius: 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; border: 1px solid rgba(15,23,42,0.3); }
.icon-circle { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.icon-circle-sm { width: 32px; height: 32px; font-size: 15px; }
.icon-circle-teal { background: var(--nxr-teal-glow); color: var(--nxr-teal-fg); }
.icon-circle-amber { background: var(--nxr-amber-dim); color: var(--nxr-amber); }
.icon-circle-danger { background: var(--nxr-danger-dim); color: var(--nxr-danger); }

/* Toasts (global session queue, rendered by FieldShell). */
.toast-container { position: fixed; top: calc(60px + 12px); inset-inline: 0; margin-inline: auto; width: calc(100% - 32px); max-width: 398px; z-index: 200; pointer-events: none; }
.toast-nxr { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: 0 8px 32px rgba(0,0,0,0.6); font-size: 13px; font-weight: 500; pointer-events: auto; animation: ffSlideDown 220ms ease; margin-bottom: 8px; }
@keyframes ffSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast-nxr .toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--nxr-success); }
.toast-warning .toast-icon { color: var(--nxr-amber); }
.toast-error .toast-icon { color: var(--nxr-danger); }
.toast-info .toast-icon { color: var(--nxr-info, #60A5FA); }

/* Empty states with actions. */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; gap: 12px; }
.empty-icon { font-size: 48px; color: var(--text-muted); opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-body { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* Segmented progress bar (today's plan). */
.plan-bar-row { display: flex; gap: 3px; margin-bottom: 12px; }
.plan-bar-seg { height: 5px; border-radius: 3px; }
.plan-bar-done { background: var(--nxr-success); }
.plan-bar-active { background: var(--nxr-teal); }
.plan-bar-remain { background: var(--bg-elevated); }
.plan-bar-overdue { background: var(--nxr-danger); }

/* Quotation wizard stepper. */
.qt-steps { display: flex; align-items: center; justify-content: center; }
.qt-step { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.qt-step-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-elevated); border: 2px solid var(--border); color: var(--text-muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qt-step.active .qt-step-dot { background: var(--nxr-teal); border-color: var(--nxr-teal-fg); color: #ffffff; }
.qt-step.done .qt-step-dot { background: var(--nxr-success); border-color: var(--nxr-success); color: #0A0F1E; }
.qt-step-label { font-size: 10px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.qt-step.active .qt-step-label { color: var(--nxr-teal-fg); }
.qt-step.done .qt-step-label { color: var(--nxr-success); }
.qt-step-line { flex: 1; height: 2px; background: var(--border); margin: 0 6px 18px; min-width: 16px; }
.qt-step-line.done { background: var(--nxr-success); }

/* Objective cards (visit-type picker). */
.obj-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: 14px; padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-family: var(--font-main); text-align: center; color: var(--text-primary); }
.obj-card.selected { border-color: var(--nxr-teal-fg); background: var(--nxr-teal-glow); box-shadow: 0 0 0 1px var(--nxr-teal); }
.obj-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--nxr-teal-fg); }
.obj-card.selected .obj-icon { background: var(--nxr-teal-glow); }
.obj-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); line-height: 1.3; }
.obj-card.selected .obj-label { color: var(--nxr-teal-fg); }

/* Active visit bar + activity checklist. */
.active-visit-bar { background: var(--bg-card); border: 1px solid var(--nxr-teal); border-radius: 16px; padding: 14px 16px; box-shadow: 0 0 0 1px var(--nxr-teal-glow); }
.activity-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); }
.activity-item.done { background: var(--nxr-success-dim); border-color: rgba(34,197,94,0.2); }
.activity-check { font-size: 18px; flex-shrink: 0; margin-top: 1px; color: var(--text-muted); }
.activity-item.done .activity-check { color: var(--nxr-success); }
.activity-title { font-size: 13px; font-weight: 600; }
.activity-item.done .activity-title { color: var(--nxr-success); }
.activity-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* NBA reasons. */
.nba-reasons { background: rgba(0,0,0,0.2); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.nba-reason-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(203,213,225,0.9); padding: 2px 0; }
.nba-reason-item .bi { color: var(--nxr-teal-fg); font-size: 11px; flex-shrink: 0; }

/* Quote sheet printing (Phase D): hide shell chrome, ink on white. */
@media print {
  .app-header, .bottom-nav, .offline-banner, .btn-nxr { display: none !important; }
  .app-shell, .app-body, .ff-page { background: #fff !important; color: #111 !important; }
  .nxr-card, .visit-card { border: 1px solid #ccc !important; background: #fff !important; }
  .nxr-card *, .visit-card * { color: #111 !important; }
  .ff-page { max-width: none; }
}

/* To Do floating actions + bottom sheets (mobile shell, shared by pages). */
.td-fab { position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); width: 56px; height: 56px; border-radius: 50%; border: none; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; z-index: 90; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.td-fab-project { right: max(16px, calc((100% - var(--shell-max)) / 2 + 16px)); background: var(--nxr-teal); color: #fff; }
.td-fab-list { left: max(16px, calc((100% - var(--shell-max)) / 2 + 16px)); background: var(--bg-card); color: var(--nxr-teal-fg); border: 1px solid var(--border); }
/* Global capture FAB: rides above the list FAB row, logical side. */
.td-fab-capture { bottom: calc(var(--nav-h) + var(--safe-bottom) + 84px); inset-inline-end: max(16px, calc((100% - var(--shell-max)) / 2 + 16px)); background: var(--nxr-teal); color: #fff; }
.td-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity 200ms ease; z-index: 198; max-width: var(--shell-max); margin: 0 auto; }
.td-backdrop.open { opacity: 1; pointer-events: auto; }
.td-sheet { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%) translateY(105%); width: 100%; max-width: var(--shell-max); background: var(--bg-card); border-top: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 12px 16px calc(20px + var(--safe-bottom)); transition: transform 240ms ease; z-index: 199; }
.td-sheet.open { transform: translateX(-50%) translateY(0); }
.td-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 12px; }
.td-opts { max-height: 180px; overflow-y: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; }
.td-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: none; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font-size: 15px; cursor: pointer; text-align: start; }
.td-opt:last-child { border-bottom: none; }
.td-opt.on { color: var(--nxr-teal-fg); font-weight: 700; }
.td-opt span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* YouTube-style top loading bar (indeterminate, red), attached under the app header. */
.ff-loadbar { position: fixed; top: var(--header-h); left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--shell-max); height: 3px; background: rgba(239,68,68,.18); overflow: hidden; z-index: 99; }
.ff-loadbar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--nxr-danger); border-radius: 2px; animation: ffLoadSlide 1.1s infinite ease-in-out; }
@keyframes ffLoadSlide { 0% { left: -40%; } 100% { left: 100%; } }
/* Drag handle for touch + mouse reorder (pointer events, not HTML5 DnD). */
.td-grip-handle { touch-action: none; cursor: grab; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 40px; color: var(--text-muted); flex-shrink: 0; }
.td-grip-handle:active { cursor: grabbing; color: var(--nxr-teal-fg); }
/* Sticky task status bar (created-by + delete), pinned above the bottom nav. */
.td-taskbar { position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--shell-max); display: flex; align-items: center; gap: 8px; padding: 10px 16px calc(10px + var(--safe-bottom)); background: var(--bg-card); border-top: 1px solid var(--border); z-index: 90; }
/* Dropdown menu panel under the list header. */
.td-menu { position: fixed; top: calc(var(--header-h) + 8px); inset-inline-end: max(16px, calc((100% - var(--shell-max)) / 2 + 16px)); width: min(280px, calc(100% - 32px)); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 199; padding: 6px; max-height: 70vh; overflow-y: auto; }
.td-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: none; border-radius: 9px; background: transparent; color: inherit; font-size: 14px; cursor: pointer; text-align: start; }
.td-menu-item:hover { background: var(--bg-card); }
.td-menu-item.danger { color: var(--nxr-danger); }
.td-menu-item span { flex: 1; }
.td-swatches { display: flex; gap: 8px; padding: 6px 12px 10px; flex-wrap: wrap; }
.td-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.td-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--nxr-teal); }
.td-opt .td-swatch { flex: none; }
.td-opt.on .td-swatch { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--nxr-teal); }
/* Smart capture sheet: mic + AR/EN pill + removable parsed chips. */
.td-capture-input { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.td-capture-input .input-nxr { flex: 1; min-width: 0; }
.td-mic { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--nxr-teal-fg); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; }
.td-mic:disabled { opacity: .45; cursor: not-allowed; }
.td-mic.listening { background: var(--nxr-danger); border-color: var(--nxr-danger); color: #fff; animation: tdMicPulse 1.4s ease-in-out infinite; }
@keyframes tdMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
.td-capture-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.td-smart-btn { border: 1px solid var(--border); background: transparent; color: var(--nxr-teal-fg); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.td-smart-btn:disabled { opacity: .45; cursor: not-allowed; }
.td-lang-pill { min-width: 44px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated); color: inherit; font-size: 12px; font-weight: 700; letter-spacing: .5px; cursor: pointer; }
.td-lang-pill:disabled { opacity: .45; cursor: not-allowed; }
.td-capture-caption { font-size: 11px; color: var(--text-muted); margin: 0 0 8px; }
.td-live { margin: 2px 0 12px; padding: 12px 14px 10px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card)); }
.td-live-wave { position: relative; height: 76px; }
.td-live-canvas { width: 100%; height: 100%; display: block; }
.td-live-text { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--text-muted); font-style: italic; }
.td-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nxr-danger); flex: none; animation: tdLiveDot 1.2s ease-in-out infinite; }
@keyframes tdLiveDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.75); }
}
.td-attach-btn { cursor: pointer; padding: 5px 8px; }
.td-attach { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); font-size: 12px; }
.td-attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.td-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); font-size: 12px; max-width: 100%; }
.td-chip-k { color: var(--text-muted); }
.td-chip-x { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.td-capture-picks { display: flex; gap: 6px; flex-wrap: wrap; margin-block: 4px 10px; margin-inline-start: 26px; }
@media (prefers-reduced-motion: reduce) {
  .td-mic.listening { animation: none; }
  .td-live-dot { animation: none; }
}
/* Morning briefing card: personal counts, team strip, one-click rollover. */
.td-brief-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.td-brief-title { flex: 1; font-size: 15px; font-weight: 700; }
.td-brief-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.td-brief-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; }
button.td-brief-stat { cursor: pointer; }
.td-brief-n { font-size: 20px; font-weight: 800; line-height: 1.1; }
.td-brief-l { font-size: 10px; color: var(--text-muted); text-align: center; }
.td-brief-stat.warn .td-brief-n { color: var(--nxr-danger); }
.td-brief-stat.amber .td-brief-n { color: var(--nxr-amber); }
.td-brief-clear { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--nxr-success); padding: 6px 0; }
.td-brief-team { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.td-brief-team-k { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.td-brief-team-v { font-size: 12px; }
.td-brief-rollover { margin-top: 8px; justify-content: center; }
.td-brief-confirm { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
/* Capture duplicate strip: advisory matches above Save, never blocking. */
.td-dup { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); padding: 6px; margin: 6px 0; }
.td-dup-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 4px; font-size: 12px; color: var(--text-muted); }
.td-dup-title { flex: 1; font-weight: 700; }
.td-dup-item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; color: inherit; padding: 7px 6px; border-radius: 8px; cursor: pointer; text-align: start; }
.td-dup-item:hover { background: var(--bg-card); }
.td-dup-desc { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-dup-tag { flex: none; font-size: 10px; font-weight: 700; color: var(--nxr-amber); border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; }
/* Task notes as chat: creator avatar + bubble, own notes mirrored + navy. */
.chat-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.chat-row.mine { flex-direction: row-reverse; }
.chat-bubble { max-width: 78%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.chat-row.mine .chat-bubble { background: var(--nxr-teal); border-color: var(--nxr-teal); color: #fff; }
.chat-head { display: flex; gap: 6px; align-items: baseline; margin-bottom: 2px; }
.chat-name { font-size: 11px; font-weight: 700; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 10px; opacity: 0.6; white-space: nowrap; margin-inline-start: auto; padding-inline-start: 6px; }
.chat-text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-del { flex-shrink: 0; width: 28px; height: 28px; border: none; background: transparent; color: var(--text-muted); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }
.chat-del:hover { color: var(--nxr-danger); background: var(--bg-elevated); }
@media print {
  .td-fab, .td-backdrop, .td-sheet, .td-menu, .header-btn { display: none !important; }
}
