/* ==========================================================================
   Sudhir FSM — Prototype styles
   Design authority: Docs/FSM/02_UI_UX/16_Shared_Component_Library.md
   ========================================================================== */

:root {
  --fsm-primary: #4361ee;
  --fsm-primary-dark: #364fc7;
  --fsm-primary-tint: #e6ebff;
  --fsm-text: #1f2937;
  --fsm-text-muted: #6b7280;
  --fsm-text-faint: #9ca3af;
  --fsm-bg: #f4f6fb;
  --fsm-surface: #ffffff;
  --fsm-border: #e5e7eb;
  --fsm-border-strong: #d1d5db;
  --fsm-success: #16a34a;
  --fsm-success-tint: #dcfce7;
  --fsm-warning: #d97706;
  --fsm-warning-tint: #fef3c7;
  --fsm-danger: #dc2626;
  --fsm-danger-tint: #fee2e2;
  --fsm-info: #0284c7;
  --fsm-info-tint: #e0f2fe;

  --fsm-priority-high: #ef4444;
  --fsm-priority-med: #f59e0b;
  --fsm-priority-low: #22c55e;

  /* Sudhir brand — used only for the logo lockup on Splash / Login / Dashboard header */
  --fsm-brand: #1e2a78;
  --fsm-brand-tint: #eef1ff;

  --fsm-radius-sm: 8px;
  --fsm-radius: 12px;
  --fsm-radius-lg: 16px;

  --fsm-shadow-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.06);
  --fsm-shadow-2: 0 4px 12px rgba(15,23,42,.08);

  --fsm-header-h: 56px;
  --fsm-bottomnav-h: 68px;
  --fsm-sticky-h: 72px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--fsm-text);
  background: #d9dde5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- Phone frame + app layout (native-app behaviour) ----------
   The phone is a flex column:
     [ header ]      flex-shrink: 0     (fixed at top; safe-area padded)
     [ chrome ]      flex-shrink: 0     (filters / wizard head, if any)
     [ scroll ]      flex: 1            (only this area scrolls)
     [ nav / bar ]   flex-shrink: 0     (fixed at bottom; safe-area padded)
   Absolute-positioned children (sheets, toasts, backdrops) sit outside
   the flex flow as before. */
.fsm-phone {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background: var(--fsm-bg);
  position: relative;
  overflow: hidden;
  overflow: clip;   /* Maintenance (2026-09-18): not a scroll container - focus/scrollIntoView can no longer scroll the frame and reveal a closed sheet. hidden = fallback. */
  box-shadow: 0 20px 60px rgba(15,23,42,.15);
  display: flex;
  flex-direction: column;
}
/* Every direct flex child defaults to non-shrinking so its intrinsic
   height is preserved. The scrollable content area overrides this. */
.fsm-phone > * { flex-shrink: 0; min-height: 0; }
.fsm-phone > .fsm-scroll,
.fsm-phone > .fsm-login,
.fsm-phone > .fsm-splash {
  flex: 1 1 auto;
  min-height: 0;
}
@media (min-width: 768px) {
  .fsm-phone {
    height: 844px;
    max-height: 844px;
    margin-top: 24px;
    margin-bottom: 24px;
    border-radius: 40px;
    overflow: hidden;
    overflow: clip;
    border: 10px solid #111827;
  }
  body { padding: 24px 0; }
}

/* Scrollable content area — the only element in the phone that scrolls. */
.fsm-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Legacy modifiers kept for backward compatibility with existing pages.
   In the flex layout no extra bottom padding is needed because the
   sticky/bottom-nav bar is a sibling flex item, not an overlay. */
.fsm-scroll--nobottom,
.fsm-scroll--sticky {}

/* ---------- Header (fixed at top of the phone) ---------- */
.fsm-header {
  height: calc(var(--fsm-header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fsm-surface);
  border-bottom: 1px solid var(--fsm-border);
  z-index: 20;
}
.fsm-header__back {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 0; margin-left: -8px;
  color: var(--fsm-text); font-size: 20px;
  border-radius: 999px;
}
.fsm-header__back:active { background: var(--fsm-border); }
.fsm-header__title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--fsm-text);
}
.fsm-header__mark {
  width: 28px; height: 28px;
  margin-right: 4px;
  flex-shrink: 0;
}
.fsm-header__actions { display: flex; align-items: center; gap: 4px; }
.fsm-header__icon {
  position: relative;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--fsm-text);
  font-size: 20px; border-radius: 999px;
}
.fsm-header__icon:active { background: var(--fsm-border); }
.fsm-header__badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--fsm-danger); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--fsm-surface);
}

/* ---------- Bottom Navigation (fixed at bottom of the phone) ---------- */
.fsm-bottomnav {
  height: calc(var(--fsm-bottomnav-h) + env(safe-area-inset-bottom, 0px));
  background: var(--fsm-surface);
  border-top: 1px solid var(--fsm-border);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  z-index: 15;
}
.fsm-bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0; background: transparent;
  color: var(--fsm-text-muted);
  font-size: 11px;
  text-decoration: none;
  position: relative;
}
.fsm-bottomnav__item i { font-size: 20px; }
.fsm-bottomnav__item.is-active {
  color: var(--fsm-primary);
  font-weight: 600;
}
.fsm-bottomnav__item .fsm-badge-tab {
  position: absolute;
  top: 4px; right: 22%;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--fsm-danger); color: #fff;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Credit strip sitting immediately below .fsm-bottomnav.
   Provides ~50px of clearance so the Android PWA gesture bar overlays
   this band instead of the nav itself; on iOS / desktop it displays
   as an intentional branding line rather than empty padding. */
.fsm-credit {
  min-height: 50px;
  background: var(--fsm-surface);
  border-top: 1px solid var(--fsm-border);
  color: var(--fsm-text-faint);
  font-size: 11px;
  line-height: 1;
  text-align: center;
  padding: 14px 12px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.fsm-credit .bi-heart-fill { color: #e11d48; font-size: 10px; margin: 0 3px; }

/* ---------- Sticky Bottom Action Bar (fixed at bottom of the phone) ---------- */
.fsm-sticky {
  height: calc(var(--fsm-sticky-h) + env(safe-area-inset-bottom, 0px));
  background: var(--fsm-surface);
  border-top: 1px solid var(--fsm-border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 15;
}
.fsm-sticky .btn { height: 48px; }
.fsm-sticky__primary { flex: 1; }
.fsm-sticky__icon {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  border: 0;
  font-size: 20px;
}

/* ---------- Cards ---------- */
.fsm-card {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  box-shadow: var(--fsm-shadow-1);
  padding: 16px;
}
.fsm-card--flush { padding: 0; overflow: hidden; }

/* ---------- Greeting card ---------- */
.fsm-greeting {
  margin: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 60%);
  border-radius: var(--fsm-radius-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--fsm-shadow-1);
}
.fsm-avatar {
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.fsm-avatar--lg { width: 96px; height: 96px; font-size: 32px; }
.fsm-row--action { cursor: pointer; }
.fsm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fsm-avatar__dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: var(--fsm-success);
  border: 2px solid var(--fsm-surface);
}
.fsm-greeting__hello { color: var(--fsm-text-muted); font-size: 13px; }
.fsm-greeting__name  { color: var(--fsm-text); font-weight: 700; font-size: 18px; margin: 2px 0; }
.fsm-greeting__meta  { color: var(--fsm-text-muted); font-size: 12px; }

/* Next Assigned Job strip (Dashboard) — assignment-based, no scheduling. */
.fsm-next {
  margin: -4px 16px 16px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--fsm-radius);
  color: #78350f;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}

/* ---------- Section headers ---------- */
.fsm-section {
  margin: 20px 16px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.fsm-section h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fsm-text);
}
.fsm-section a { font-size: 13px; color: var(--fsm-primary); text-decoration: none; }

/* ---------- KPI tiles ---------- */
.fsm-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px;
}
.fsm-kpi {
  background: var(--fsm-surface);
  color: inherit;
  text-decoration: none;
  border-radius: var(--fsm-radius);
  padding: 14px 10px 12px;
  text-align: left;
  border: 1px solid var(--fsm-border);
  cursor: pointer;
  transition: transform 80ms ease;
}
.fsm-kpi:active { transform: scale(.97); }
.fsm-kpi__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 8px;
}
.fsm-kpi--pending .fsm-kpi__icon { background: var(--fsm-info-tint);    color: var(--fsm-info); }
.fsm-kpi--today   .fsm-kpi__icon { background: var(--fsm-success-tint); color: var(--fsm-success); }
.fsm-kpi--closed  .fsm-kpi__icon { background: var(--fsm-primary-tint); color: var(--fsm-primary); }
.fsm-kpi__value { font-size: 22px; font-weight: 700; color: var(--fsm-text); line-height: 1; }
.fsm-kpi__label { font-size: 11px; color: var(--fsm-text-muted); margin-top: 4px; }

/* ---------- Ticket Card ---------- */
.fsm-ticket {
  margin: 0 16px 12px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  box-shadow: var(--fsm-shadow-1);
  overflow: hidden;
  border-left: 4px solid var(--fsm-border);
  cursor: pointer;
}
.fsm-ticket--critical { border-left-color: var(--fsm-danger); }
.fsm-ticket--high { border-left-color: var(--fsm-priority-high); }
.fsm-ticket--med  { border-left-color: var(--fsm-priority-med); }
.fsm-ticket--low  { border-left-color: var(--fsm-priority-low); }
.fsm-ticket__body { padding: 14px; }
.fsm-ticket__top  { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fsm-ticket__id   { font-size: 12px; color: var(--fsm-primary); font-weight: 600; }
.fsm-ticket__date { font-size: 12px; color: var(--fsm-text-muted); text-align: right; }
.fsm-ticket__customer { font-weight: 600; font-size: 15px; color: var(--fsm-text); }
.fsm-ticket__product  { font-size: 13px; color: var(--fsm-text-muted); margin-top: 2px; }
.fsm-ticket__meta { display: flex; align-items: center; gap: 6px; color: var(--fsm-text-muted); font-size: 12px; margin-top: 10px; flex-wrap: wrap; }
.fsm-meta-sep { color: var(--fsm-text-faint); margin: 0 2px; }
/* CFB-02: label shown when client has not shared their location. */
.fsm-loc-flag { color: var(--fsm-text-faint); font-style: italic; }
/* Sequence-number badge used on Toolbox rows (S.No column). */
.fsm-sno {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px;
  background: var(--fsm-primary-tint); color: var(--fsm-primary);
  border-radius: 999px; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.fsm-ticket__actions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px dashed var(--fsm-border);
}
.fsm-ticket__actions .btn { height: 40px; font-size: 13px; }
.fsm-ticket__actions .btn-primary { flex: 1; }

/* ---------- Chips ---------- */
.fsm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
/* CFB-04 Point 7 — Critical is a distinct, higher-urgency tier than High.
   Solid danger fill + white text to read as "attention now". No new
   color token — composed from the existing --fsm-danger. */
.fsm-chip--critical { background: var(--fsm-danger); color: #ffffff; }
.fsm-chip--high  { background: var(--fsm-danger-tint);  color: var(--fsm-danger);  }
.fsm-chip--med   { background: var(--fsm-warning-tint); color: var(--fsm-warning); }
.fsm-chip--low   { background: var(--fsm-success-tint); color: var(--fsm-success); }
.fsm-chip--info  { background: var(--fsm-info-tint);    color: var(--fsm-info);    }
.fsm-chip--muted { background: #e5e7eb; color: #4b5563; }
/* OCMS020 Phase 8 - non-terminal 'Visited' status. Indigo (brand primary) reads as
   active/in-progress and stays distinct from Assigned (info) and Closed (muted). */
.fsm-chip--visited { background: var(--fsm-primary-tint); color: var(--fsm-primary); }
.fsm-chip--dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; display: inline-block;
}

/* ---------- Quick Actions row ---------- */
.fsm-quick {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 8px 16px 24px;
}
.fsm-quick__item {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  padding: 12px 6px;
  text-align: center;
  color: var(--fsm-text);
  text-decoration: none;
  border: 1px solid var(--fsm-border);
  cursor: pointer;
}
.fsm-quick__item i {
  font-size: 20px;
  color: var(--fsm-primary);
  display: block;
  margin-bottom: 6px;
}
.fsm-quick__item span { font-size: 11px; color: var(--fsm-text-muted); line-height: 1.15; display: block; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--fsm-primary); border-color: var(--fsm-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--fsm-primary-dark); border-color: var(--fsm-primary-dark); }
.btn-outline-primary { color: var(--fsm-primary); border-color: var(--fsm-primary); }
.btn-outline-primary:hover { background: var(--fsm-primary); border-color: var(--fsm-primary); }

/* ---------- Login screen ---------- */
.fsm-login {
  padding: 40px 24px 24px;
  display: flex;
  flex-direction: column;
  background: var(--fsm-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.fsm-login__brand {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 32px;
}
.fsm-login__logo {
  width: 200px; height: auto; margin: 0 auto 16px;
  display: block;
}
.fsm-login__title { font-size: 22px; font-weight: 700; color: var(--fsm-text); margin: 0; }
.fsm-login__subtitle { color: var(--fsm-text-muted); font-size: 14px; margin-top: 4px; }

.fsm-login__form { flex: 1; }
.fsm-login__field { margin-bottom: 14px; }
.fsm-login__label { font-size: 12px; font-weight: 600; color: var(--fsm-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fsm-login__input {
  height: 48px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  border: 1px solid var(--fsm-border);
  padding: 0 44px 0 14px;
  width: 100%;
  font-size: 15px;
  color: var(--fsm-text);
  position: relative;
}
.fsm-login__input:focus { outline: none; border-color: var(--fsm-primary); box-shadow: 0 0 0 3px var(--fsm-primary-tint); }
.fsm-login__inputwrap { position: relative; }
.fsm-login__eye {
  position: absolute; right: 4px; top: 4px;
  width: 40px; height: 40px;
  background: transparent; border: 0;
  color: var(--fsm-text-muted);
  border-radius: 8px;
}
.fsm-login__eye:active { background: var(--fsm-border); }

.fsm-login__captcha {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.fsm-login__captchaimg {
  height: 46px; padding: 0 14px;
  background: linear-gradient(90deg,#fff 0%, #eef2ff 100%);
  border-radius: 10px;
  border: 1px dashed var(--fsm-border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 20px; font-weight: 700; letter-spacing: 3px;
  color: var(--fsm-primary);
  user-select: none;
}
.fsm-login__refresh {
  width: 40px; height: 40px;
  border-radius: 999px; border: 1px solid var(--fsm-border);
  background: var(--fsm-surface); color: var(--fsm-text-muted);
}

.fsm-login__submit { height: 50px; width: 100%; margin-top: 8px; }
.fsm-login__link { text-align: center; margin-top: 18px; }
.fsm-login__link a { color: var(--fsm-primary); text-decoration: none; font-weight: 600; font-size: 13px; }

/* ---------- Splash ---------- */
.fsm-splash {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 24px;
  background: var(--fsm-bg);
  padding: 24px;
  text-align: center;
}
.fsm-splash__lockup {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.fsm-splash__lockup img { width: 220px; height: auto; }
.fsm-splash__module {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--fsm-brand);
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: 4px;
}
.fsm-splash__loader {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--fsm-border);
  border-top-color: var(--fsm-brand);
  border-radius: 999px;
  animation: fsm-spin 800ms linear infinite;
}
@keyframes fsm-spin { to { transform: rotate(360deg); } }

/* ---------- Brand marks (reusable — used in Login top, Splash, headers) ---------- */
.fsm-mark {
  display: inline-block;
  vertical-align: middle;
}
.fsm-mark--sm { width: 24px; height: 24px; }
.fsm-mark--md { width: 40px; height: 40px; }
.fsm-mark--lg { width: 84px; height: 84px; }

/* ---------- Bottom Sheet ---------- */
.fsm-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.35);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
  z-index: 40;
}
.fsm-sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.fsm-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--fsm-surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  visibility: hidden;   /* Maintenance (2026-09-18): a closed sheet is out of the tab order (its buttons were focusable off-screen and focus scrolled the frame) */
  transition: transform 220ms cubic-bezier(.22,.61,.36,1), visibility 0s linear 220ms;
  z-index: 41;
  box-shadow: 0 -8px 24px rgba(15,23,42,.15);
}
.fsm-sheet.is-open { transform: translateY(0); visibility: visible; transition: transform 220ms cubic-bezier(.22,.61,.36,1), visibility 0s; }
.fsm-sheet__handle {
  width: 40px; height: 4px; border-radius: 4px;
  background: var(--fsm-border-strong);
  margin: 6px auto 12px;
}
.fsm-sheet__title { font-weight: 700; color: var(--fsm-text); font-size: 15px; margin: 0 0 8px; }
.fsm-sheet__body  { color: var(--fsm-text-muted); font-size: 14px; margin-bottom: 12px; }
/* CFB-02A — sheet used by Ask Location. Small hint / read-only preview /
   inline error / actions row. All composed from existing tokens. */
.fsm-sheet__hint  { color: var(--fsm-text-muted); font-size: 13px; margin: 0 0 10px; line-height: 1.5; }
.fsm-message-preview {
  background: var(--fsm-bg);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--fsm-text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  margin: 0 0 10px;
  font-family: inherit;
}
.fsm-sheet__err {
  background: var(--fsm-danger-tint);
  color: var(--fsm-danger);
  border-radius: var(--fsm-radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}
.fsm-sheet__actions { display: flex; gap: 8px; }
.fsm-sheet__actions .btn { flex: 1; }
.fsm-sheet__actions .btn-success { background: #25d366; border-color: #25d366; }
.fsm-sheet__actions .btn-success:hover { background: #1fbf5b; border-color: #1fbf5b; }

/* ---------- Filter chips row ---------- */
.fsm-filters {
  display: flex; gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  background: var(--fsm-bg);
  border-bottom: 1px solid var(--fsm-border);
  z-index: 15;
}
.fsm-filters::-webkit-scrollbar { display: none; }
.fsm-filter {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--fsm-surface);
  border: 1px solid var(--fsm-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--fsm-text);
  cursor: pointer;
  white-space: nowrap;
}
.fsm-filter.is-active {
  background: var(--fsm-primary);
  color: #fff;
  border-color: var(--fsm-primary);
}

/* ---------- Section divider + count ---------- */
.fsm-listmeta {
  padding: 12px 16px 4px;
  color: var(--fsm-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Empty state ---------- */
.fsm-empty {
  text-align: center;
  padding: 60px 24px 40px;
  color: var(--fsm-text-muted);
}
.fsm-empty i { font-size: 48px; display: block; margin-bottom: 12px; color: var(--fsm-text-faint); }
.fsm-empty__title { font-weight: 600; color: var(--fsm-text); font-size: 15px; }
.fsm-empty__body  { font-size: 13px; margin-top: 4px; }

/* ---------- Detail sections ---------- */
.fsm-detail-summary {
  margin: 16px;
  padding: 14px 16px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  border-left: 4px solid var(--fsm-border);
  box-shadow: var(--fsm-shadow-1);
}
.fsm-detail-summary--critical { border-left-color: var(--fsm-danger); }
.fsm-detail-summary--high { border-left-color: var(--fsm-priority-high); }
.fsm-detail-summary--med  { border-left-color: var(--fsm-priority-med); }
.fsm-detail-summary--low  { border-left-color: var(--fsm-priority-low); }
.fsm-detail-summary__row  { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.fsm-detail-summary__id   { font-size: 13px; color: var(--fsm-primary); font-weight: 600; margin-top: 6px; }
.fsm-detail-summary__meta { color: var(--fsm-text-muted); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }

.fsm-block {
  margin: 16px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  box-shadow: var(--fsm-shadow-1);
  overflow: hidden;
}
.fsm-block__title {
  padding: 12px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fsm-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fsm-block__body { padding: 6px 16px 16px; }
.fsm-row {
  display: flex; align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--fsm-border);
  gap: 12px;
}
.fsm-row:last-child { border-bottom: 0; }
.fsm-row__icon { color: var(--fsm-text-muted); width: 22px; text-align: center; font-size: 16px; padding-top: 2px; }
.fsm-row__label { color: var(--fsm-text-muted); font-size: 12px; }
.fsm-row__value { color: var(--fsm-text); font-size: 14px; }
.fsm-row__stack { flex: 1; }
.fsm-row__actions { display: flex; align-items: center; gap: 8px; }
.fsm-row__btn { background: transparent; border: 1px solid var(--fsm-border); color: var(--fsm-primary); border-radius: 8px; padding: 6px 10px; font-size: 12px; }

.fsm-blockquote {
  border-left: 3px solid var(--fsm-border-strong);
  padding: 4px 12px;
  color: var(--fsm-text);
  font-size: 14px;
  background: #fafbfc;
  margin: 4px 0;
  white-space: pre-wrap;
}

/* Location / map placeholder */
.fsm-map {
  height: 140px;
  background:
    linear-gradient(135deg,#f3f4f6 25%,#e5e7eb 25%,#e5e7eb 50%,#f3f4f6 50%,#f3f4f6 75%,#e5e7eb 75%);
  background-size: 24px 24px;
  border-radius: var(--fsm-radius);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--fsm-border);
}
.fsm-map__pin {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -100%);
  color: var(--fsm-danger); font-size: 32px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.2));
}

/* Activity timeline */
.fsm-timeline { padding: 6px 0 0; }
.fsm-timeline__item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.fsm-timeline__dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--fsm-primary);
  margin-top: 6px; flex-shrink: 0;
}
.fsm-timeline__item::before {
  content: '';
  position: absolute; left: 4.5px; top: 24px; bottom: -8px;
  width: 1px; background: var(--fsm-border);
}
.fsm-timeline__item:last-child::before { display: none; }
.fsm-timeline__body { flex: 1; }
.fsm-timeline__when { font-size: 12px; color: var(--fsm-text-muted); }
.fsm-timeline__label { font-size: 14px; font-weight: 500; color: var(--fsm-text); }
.fsm-timeline__note  { font-size: 13px; color: var(--fsm-text-muted); font-style: italic; margin-top: 2px; }

/* ---------- Attachment tile ---------- */
.fsm-attachments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fsm-att {
  aspect-ratio: 1;
  border-radius: var(--fsm-radius-sm);
  background: #eef2ff;
  color: var(--fsm-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border: 1px solid var(--fsm-border);
}

/* ---------- Row variants ---------- */
.fsm-row--stacked { display: block; }

/* ---------- Wizard shell ---------- */
.fsm-wizard-head {
  background: var(--fsm-surface);
  border-bottom: 1px solid var(--fsm-border);
  padding: 8px 16px 12px;
  z-index: 15;
}
.fsm-wizard-progress {
  height: 4px;
  background: var(--fsm-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.fsm-wizard-progress__fill {
  height: 100%;
  background: var(--fsm-primary);
  transition: width 240ms ease;
}
.fsm-wizard-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px;
}
.fsm-wizard-meta__step {
  font-size: 11px;
  font-weight: 600;
  color: var(--fsm-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fsm-wizard-meta__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--fsm-text);
}

/* ---------- Recap card (compact summary at top of wizard steps) ---------- */
.fsm-recap {
  margin: 16px;
  padding: 12px 14px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  border-left: 4px solid var(--fsm-primary);
  box-shadow: var(--fsm-shadow-1);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.fsm-recap__id { font-size: 12px; color: var(--fsm-primary); font-weight: 600; }
.fsm-recap__customer { font-weight: 600; font-size: 14px; color: var(--fsm-text); }
.fsm-recap__meta { color: var(--fsm-text-muted); font-size: 12px; margin-top: 2px; }
.fsm-recap i { color: var(--fsm-primary); font-size: 20px; padding-top: 2px; }

/* ---------- Wizard step content ---------- */
.fsm-step {
  padding: 4px 16px 24px;
}
.fsm-step__intro {
  margin: 6px 0 16px;
  color: var(--fsm-text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.fsm-step__lead {
  font-size: 16px;
  font-weight: 600;
  color: var(--fsm-text);
  margin: 8px 0 6px;
}

/* Big informational card used in Visit Start's auto-stamped time */
.fsm-infocard {
  background: var(--fsm-surface);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.fsm-infocard__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.fsm-infocard__label { font-size: 12px; color: var(--fsm-text-muted); }
.fsm-infocard__value { font-size: 15px; color: var(--fsm-text); font-weight: 600; }

/* Radio-card selector — used for Visit Purpose, closure outcome, etc. */
.fsm-choice {
  display: block;
  background: var(--fsm-surface);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 100ms ease, background 100ms ease;
}
.fsm-choice:has(input:checked) {
  border-color: var(--fsm-primary);
  background: var(--fsm-primary-tint);
}
.fsm-choice input { position: absolute; opacity: 0; pointer-events: none; }
.fsm-choice__row { display: flex; align-items: flex-start; gap: 12px; }
.fsm-choice__dot {
  width: 22px; height: 22px; border-radius: 999px;
  border: 2px solid var(--fsm-border-strong);
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.fsm-choice:has(input:checked) .fsm-choice__dot {
  border-color: var(--fsm-primary);
  background: var(--fsm-primary);
}
.fsm-choice:has(input:checked) .fsm-choice__dot::after {
  content: '';
  width: 8px; height: 8px; border-radius: 999px; background: #fff;
}
.fsm-choice__title { font-weight: 600; font-size: 15px; color: var(--fsm-text); }
.fsm-choice__body  { font-size: 13px; color: var(--fsm-text-muted); margin-top: 2px; line-height: 1.45; }

/* Form fields (large, mobile-friendly) */
.fsm-field { margin-bottom: 14px; }
.fsm-field__label {
  display: block;
  font-size: 12px;
  color: var(--fsm-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.fsm-field__required { color: var(--fsm-danger); margin-left: 2px; }
.fsm-field__input, .fsm-field__select, .fsm-field__textarea {
  width: 100%;
  min-height: 48px;
  background: var(--fsm-surface);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--fsm-text);
}
.fsm-field__textarea { min-height: 96px; }
.fsm-field__input:focus, .fsm-field__select:focus, .fsm-field__textarea:focus {
  outline: none;
  border-color: var(--fsm-primary);
  box-shadow: 0 0 0 3px var(--fsm-primary-tint);
}

/* Signature canvas */
.fsm-sig {
  background: var(--fsm-surface);
  border: 1px dashed var(--fsm-border-strong);
  border-radius: var(--fsm-radius);
  height: 140px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fsm-text-faint);
  font-size: 13px;
  margin-bottom: 6px;
  overflow: hidden;
  position: relative;
}
.fsm-sig svg { width: 100%; height: 100%; display: block; }
.fsm-sig__hint { position: absolute; }

/* GPS status card */
.fsm-gps {
  padding: 40px 24px 24px;
  text-align: center;
}
.fsm-gps__icon {
  width: 88px; height: 88px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 40px;
  position: relative;
}
.fsm-gps__icon--ok { background: var(--fsm-success-tint); color: var(--fsm-success); }
.fsm-gps__icon--warn { background: var(--fsm-warning-tint); color: var(--fsm-warning); }
.fsm-gps__title { font-size: 17px; font-weight: 700; color: var(--fsm-text); }
.fsm-gps__coords {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--fsm-bg);
  border-radius: var(--fsm-radius);
  color: var(--fsm-text);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  display: inline-block;
}
.fsm-gps__hint { color: var(--fsm-text-muted); font-size: 13px; margin-top: 10px; }

/* Closure code input */
.fsm-code {
  display: flex; justify-content: center;
  gap: 8px;
  margin: 12px 0 6px;
}
.fsm-code__box {
  width: 44px; height: 56px;
  border: 1px solid var(--fsm-border-strong);
  border-radius: 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--fsm-text);
  background: var(--fsm-surface);
}
.fsm-code__box:focus {
  outline: none;
  border-color: var(--fsm-primary);
  box-shadow: 0 0 0 3px var(--fsm-primary-tint);
}

/* Review summary blocks (last step) */
.fsm-review-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--fsm-border);
}
.fsm-review-row:last-child { border-bottom: 0; }
.fsm-review-row__label { font-size: 12px; color: var(--fsm-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fsm-review-row__value { font-size: 14px; color: var(--fsm-text); font-weight: 500; margin-top: 2px; }
.fsm-review-row__edit  { color: var(--fsm-primary); background: transparent; border: 0; font-size: 13px; }

/* Helper text above sticky bar (CSO-22 pattern) */
.fsm-stickyhint {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--fsm-sticky-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 16px 8px;
  font-size: 12px;
  color: var(--fsm-text-muted);
  text-align: center;
  background: linear-gradient(180deg, rgba(244,246,251,0), rgba(244,246,251,1));
  z-index: 14;
  pointer-events: none;
}

/* Photo grid (Photo Upload step) */
.fsm-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.fsm-photo {
  aspect-ratio: 1;
  background: var(--fsm-bg);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius-sm);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fsm-photo--add {
  border: 1px dashed var(--fsm-border-strong);
  background: var(--fsm-surface);
  color: var(--fsm-primary);
  font-size: 22px;
  cursor: pointer;
}
.fsm-photo__thumb {
  width: 100%; height: 100%;
  background:
    linear-gradient(135deg, #cbd5e1 25%, #94a3b8 50%, #cbd5e1 75%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 24px;
}
.fsm-photo__lock {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: rgba(255,255,255,.9); border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fsm-text-muted); font-size: 12px;
}

/* FSR section navigation dots */
.fsm-secdots { display: flex; align-items: center; gap: 4px; margin: 0 0 4px; }
.fsm-secdots__dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--fsm-border-strong);
}
.fsm-secdots__dot.is-done { background: var(--fsm-success); }
.fsm-secdots__dot.is-current { background: var(--fsm-primary); }

/* ---------- Notification row (inherits ticket card tokens) ---------- */
.fsm-notif {
  margin: 0 16px 10px;
  padding: 12px 14px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  box-shadow: var(--fsm-shadow-1);
  display: flex; gap: 12px;
  cursor: pointer;
  position: relative;
}
.fsm-notif__dot {
  position: absolute; top: 14px; left: 6px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--fsm-primary);
}
.fsm-notif--read .fsm-notif__dot { display: none; }
.fsm-notif__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.fsm-notif__body { flex: 1; min-width: 0; }
.fsm-notif__title { font-weight: 600; color: var(--fsm-text); font-size: 14px; }
.fsm-notif__desc  { color: var(--fsm-text-muted); font-size: 12px; margin-top: 2px; }
.fsm-notif__when  { color: var(--fsm-text-faint); font-size: 11px; margin-top: 4px; }

/* ---------- Expense row (list card, inherits ticket card tokens) ---------- */
.fsm-expcard {
  margin: 0 16px 10px;
  padding: 14px;
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  box-shadow: var(--fsm-shadow-1);
  cursor: pointer;
}
.fsm-expcard__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fsm-expcard__id  { font-size: 12px; color: var(--fsm-primary); font-weight: 600; }
.fsm-expcard__date{ font-size: 12px; color: var(--fsm-text-muted); }
.fsm-expcard__customer { font-weight: 600; font-size: 14px; color: var(--fsm-text); margin-top: 4px; }
.fsm-expcard__ticket   { font-size: 12px; color: var(--fsm-text-muted); margin-top: 2px; }
.fsm-expcard__bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.fsm-expcard__amount { font-weight: 700; color: var(--fsm-text); font-size: 15px; }

/* ==========================================================================
   Install landing page (install.html)
   Uses existing tokens only — no new visual language.
   ========================================================================== */
.fsm-install {
  min-height: 100vh;
  background: var(--fsm-bg);
  padding: 20px 16px 48px;
}
.fsm-install__container { max-width: 1080px; margin: 0 auto; }

/* Top nav */
.fsm-install__nav {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 28px;
}
.fsm-install__nav-mark { width: 32px; height: 32px; flex-shrink: 0; }
.fsm-install__nav-name { font-weight: 800; color: var(--fsm-brand); font-size: 16px; letter-spacing: -.01em; }
.fsm-install__nav-sub  { color: var(--fsm-text-muted); font-size: 13px; margin-left: 4px; }

/* Hero */
.fsm-install__hero {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--fsm-shadow-2);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.fsm-install__hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at top, var(--fsm-primary-tint) 0%, transparent 60%);
  opacity: .8; pointer-events: none;
}
.fsm-install__hero > * { position: relative; }
.fsm-install__lockup { width: min(320px, 80%); height: auto; margin: 0 auto 12px; display: block; }
.fsm-install__version {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  margin: 6px 0 14px;
}
.fsm-install__title {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  color: var(--fsm-text);
  margin: 4px 0 8px;
  letter-spacing: -.01em;
}
.fsm-install__subtitle {
  color: var(--fsm-text-muted);
  font-size: 15px;
  max-width: 540px;
  margin: 0 auto 24px;
  line-height: 1.55;
}
.fsm-install__cta {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 28px;
  border-radius: 12px;
  background: var(--fsm-primary);
  color: #fff;
  border: 0;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(67,97,238,.28);
  transition: transform 100ms ease, box-shadow 200ms ease, background 100ms ease;
}
.fsm-install__cta:hover  { background: var(--fsm-primary-dark); }
.fsm-install__cta:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(67,97,238,.28); }
.fsm-install__cta[disabled] { opacity: .55; cursor: not-allowed; }
.fsm-install__cta i { font-size: 18px; }
.fsm-install__hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--fsm-text-muted);
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.fsm-install__hint span { display: inline-flex; align-items: center; gap: 4px; }

/* Section headers */
.fsm-install__section {
  margin: 32px 0 12px;
  padding: 0 4px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.fsm-install__section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--fsm-text);
  margin: 0;
  letter-spacing: -.01em;
}
.fsm-install__section span { color: var(--fsm-text-muted); font-size: 13px; }

/* Feature grid */
.fsm-install__features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.fsm-install__feature {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  padding: 16px 14px;
  box-shadow: var(--fsm-shadow-1);
  display: flex; flex-direction: column; gap: 8px;
}
.fsm-install__feature-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.fsm-install__feature-title { font-weight: 700; color: var(--fsm-text); font-size: 14px; }
.fsm-install__feature-desc  { color: var(--fsm-text-muted); font-size: 12px; line-height: 1.45; }
@media (min-width: 720px) {
  .fsm-install__features { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .fsm-install__feature  { padding: 20px 16px; }
  .fsm-install__feature-title { font-size: 15px; }
  .fsm-install__feature-desc  { font-size: 13px; }
}

/* Instructions */
.fsm-install__how {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .fsm-install__how { grid-template-columns: 1fr 1fr; gap: 14px; }
}
.fsm-install__platform {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius);
  padding: 18px 18px 20px;
  box-shadow: var(--fsm-shadow-1);
  transition: box-shadow 200ms ease;
}
.fsm-install__platform.is-emphasized {
  box-shadow: 0 0 0 2px var(--fsm-primary), var(--fsm-shadow-2);
}
.fsm-install__platform-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.fsm-install__platform-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.fsm-install__platform-title { font-weight: 700; color: var(--fsm-text); font-size: 15px; }
.fsm-install__platform-sub   { color: var(--fsm-text-muted); font-size: 12px; }
.fsm-install__steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.fsm-install__steps li {
  counter-increment: step;
  padding: 8px 0 8px 32px;
  position: relative;
  font-size: 13px;
  color: var(--fsm-text);
  line-height: 1.45;
  border-bottom: 1px dashed var(--fsm-border);
}
.fsm-install__steps li:last-child { border-bottom: 0; }
.fsm-install__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 8px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.fsm-install__steps kbd {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  border: 1px solid var(--fsm-border);
  border-radius: 6px;
  background: var(--fsm-bg);
  font-family: inherit;
  font-size: 12px;
  color: var(--fsm-text);
}

/* Callout — shown when running standalone or as an info banner */
.fsm-install__callout {
  background: var(--fsm-success-tint);
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: var(--fsm-radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px;
}
.fsm-install__callout i { font-size: 18px; padding-top: 1px; }

/* Footer */
.fsm-install__footer {
  margin-top: 36px;
  padding: 20px 8px;
  text-align: center;
  color: var(--fsm-text-muted);
  font-size: 12px;
  border-top: 1px solid var(--fsm-border);
}
.fsm-install__footer strong { color: var(--fsm-brand); font-weight: 700; }
.fsm-install__footer a { color: var(--fsm-primary); text-decoration: none; }

/* ---------- Toast ---------- */
.fsm-toast {
  position: absolute; left: 50%; bottom: calc(var(--fsm-bottomnav-h) + 20px);
  transform: translate(-50%, 20px);
  min-width: 240px; max-width: 340px;
  background: var(--fsm-text);
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  z-index: 50;
  text-align: center;
  pointer-events: none;   /* Maintenance (2026-09-19): a toast is never interactive - faded-out (opacity 0) it must not swallow taps on controls beneath it (e.g. a sheet Submit button) */
}
.fsm-toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Client Share Location page (CFB-02) — public-facing, no bottom nav.
   Reuses tokens; no new colors introduced.
   ========================================================================== */
.fsm-share {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 20px 32px;
  display: flex; flex-direction: column;
  background: var(--fsm-bg);
}
.fsm-share__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.fsm-share__mark { width: 44px; height: 44px; }
.fsm-share__wordmark { font-size: 20px; font-weight: 800; color: var(--fsm-brand); letter-spacing: .5px; }
.fsm-share__module { font-size: 12px; color: var(--fsm-text-muted); }
.fsm-share__card {
  background: var(--fsm-surface);
  border-radius: var(--fsm-radius-lg);
  border: 1px solid var(--fsm-border);
  padding: 24px 20px;
  box-shadow: var(--fsm-shadow-1);
  flex: 1;
}
.fsm-share__title { font-size: 20px; font-weight: 700; color: var(--fsm-text); margin: 0 0 8px; }
.fsm-share__intro { font-size: 14px; color: var(--fsm-text-muted); margin: 0 0 16px; line-height: 1.5; }
.fsm-share__ticket {
  display: flex; align-items: center; gap: 8px;
  background: var(--fsm-primary-tint); color: var(--fsm-primary);
  border-radius: var(--fsm-radius); padding: 10px 12px; font-size: 13px;
  margin-bottom: 16px;
}
.fsm-share__cta { height: 52px; font-size: 15px; font-weight: 600; }
.fsm-share__hint {
  margin: 14px 0 0; font-size: 12px; color: var(--fsm-text-faint);
  display: flex; gap: 6px; align-items: flex-start; line-height: 1.5;
}
.fsm-share__ok, .fsm-share__err {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: var(--fsm-radius);
}
.fsm-share__ok  { background: var(--fsm-success-tint); color: var(--fsm-success); }
.fsm-share__err { background: var(--fsm-danger-tint);  color: var(--fsm-danger); }
.fsm-share__ok i, .fsm-share__err i { font-size: 22px; flex-shrink: 0; }
.fsm-share__okTitle, .fsm-share__errTitle { font-weight: 700; margin-bottom: 4px; }
.fsm-share__okBody, .fsm-share__errBody { color: var(--fsm-text); font-size: 13px; line-height: 1.5; }
.fsm-share__footer {
  text-align: center; font-size: 11px; color: var(--fsm-text-faint);
  margin-top: 20px;
}

/* ==========================================================================
   Digital FSR (CFB-03) — 7-step wizard body styles.
   All composed from existing tokens. No new colors / fonts / shadows.
   ========================================================================== */

/* Segmented control — Type of Service (5 buttons). */
.fsm-fsr-seg {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 4px;
}
.fsm-fsr-seg__btn {
  flex: 1 1 calc(50% - 6px);
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--fsm-border);
  background: var(--fsm-surface);
  color: var(--fsm-text);
  border-radius: var(--fsm-radius);
  font-size: 13px; font-weight: 500;
}
.fsm-fsr-seg__btn.is-active {
  background: var(--fsm-primary);
  color: #fff;
  border-color: var(--fsm-primary);
}

/* Read-only prefill card — a fsm-block with de-emphasised styling. */
.fsm-fsr-prefill {
  background: var(--fsm-bg);
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.fsm-fsr-prefill dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; }
.fsm-fsr-prefill dt { color: var(--fsm-text-muted); font-weight: 500; }
.fsm-fsr-prefill dd { color: var(--fsm-text); margin: 0; word-break: break-word; }

/* Repeatable row card — used by Equipment & Material steps. */
.fsm-fsr-rep {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: var(--fsm-surface);
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}
.fsm-fsr-rep__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.fsm-fsr-rep__num { font-weight: 700; font-size: 13px; color: var(--fsm-text); }
.fsm-fsr-rep__remove {
  background: transparent; border: 0; color: var(--fsm-danger);
  font-size: 13px; padding: 4px 6px; border-radius: var(--fsm-radius-sm);
}
.fsm-fsr-rep__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px;
}
.fsm-fsr-rep__grid .full { grid-column: 1 / -1; }
.fsm-fsr-add {
  width: 100%; height: 44px;
  border: 1px dashed var(--fsm-border-strong);
  background: transparent; color: var(--fsm-primary);
  border-radius: var(--fsm-radius); font-weight: 600; font-size: 14px;
}

/* Inspection table — Check | Observation, 11 rows. Matches sample PDF layout. */
.fsm-fsr-inspect {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: var(--fsm-surface);
  overflow: hidden;
}
.fsm-fsr-inspect__row {
  display: grid; grid-template-columns: 45% 55%;
  border-bottom: 1px solid var(--fsm-border);
}
.fsm-fsr-inspect__row:last-child { border-bottom: 0; }
.fsm-fsr-inspect__row.is-head { background: var(--fsm-bg); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--fsm-text-muted); }
.fsm-fsr-inspect__cell { padding: 8px 10px; font-size: 13px; }
.fsm-fsr-inspect__cell.is-check { border-right: 1px solid var(--fsm-border); color: var(--fsm-text); }
.fsm-fsr-inspect__cell input {
  width: 100%; border: 0; background: transparent;
  padding: 4px 0; font-size: 13px; color: var(--fsm-text);
  outline: none;
}

/* Prototype-mock flag under a field — small italic muted hint. */
.fsm-fsr-mockhint {
  font-size: 11px; color: var(--fsm-text-faint);
  font-style: italic; margin-top: 4px;
}

/* Signature capture card — tap to open pad. */
.fsm-sig-card {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: var(--fsm-surface);
  padding: 12px;
  text-align: center;
}
.fsm-sig-card__ink {
  min-height: 120px;
  background: #fff;
  border: 1px dashed var(--fsm-border-strong);
  border-radius: var(--fsm-radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  color: var(--fsm-text-faint);
  font-size: 13px;
  overflow: hidden;
}
.fsm-sig-card__ink img { max-height: 120px; max-width: 100%; }
.fsm-sig-card__meta { font-size: 12px; color: var(--fsm-text-muted); }
.fsm-sig-card__meta strong { color: var(--fsm-text); }

/* Signature pad sheet — canvas on a white surface. */
.fsm-sigpad__canvas {
  display: block;
  width: 100%; height: 240px;
  background: #fff;
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  touch-action: none;
  margin: 10px 0;
}

/* Preview iframe — approximates A4 portrait rendering inside the phone. */
.fsm-fsr-preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: #fff;
}

/* ==========================================================================
   CFB-03 — Digital FSR wizard additions (additive; reuses existing tokens).
   ========================================================================== */

/* Repeatable row card (Equipment / Materials) */
.fsr-rowcard {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: var(--fsm-surface);
  padding: 12px;
  margin-bottom: 12px;
}
.fsr-rowcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.fsr-rowcard__title { font-weight: 700; font-size: 0.9rem; color: var(--fsm-text); }
.fsr-rowcard__remove {
  border: none;
  background: none;
  color: #b91c1c;
  font-size: 0.85rem;
  padding: 2px 6px;
}
.fsr-add-row {
  width: 100%;
  border: 1px dashed var(--fsm-primary);
  border-radius: var(--fsm-radius);
  background: var(--fsm-primary-tint);
  color: var(--fsm-primary);
  font-weight: 600;
  padding: 10px;
  margin-bottom: 12px;
}

/* Inspection two-column entry (Check | Observation) — mirrors the PDF layout */
.fsr-inspect { display: table; width: 100%; border-collapse: collapse; }
.fsr-inspect__row { display: table-row; }
.fsr-inspect__check {
  display: table-cell;
  width: 52%;
  padding: 8px 8px 8px 0;
  font-size: 0.85rem;
  color: var(--fsm-text);
  vertical-align: middle;
  border-bottom: 1px solid var(--fsm-border);
}
.fsr-inspect__obs {
  display: table-cell;
  padding: 6px 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--fsm-border);
}
.fsr-inspect__obs input {
  width: 100%;
  border: 1px solid var(--fsm-border);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 0.85rem;
}

/* Signature slot on wizard steps */
.fsr-sigslot {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: var(--fsm-surface);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}
.fsr-sigslot img { max-height: 64px; max-width: 100%; }
.fsr-sigslot__date { font-size: 0.75rem; color: var(--fsm-text-muted); }
.fsr-sigslot--empty { color: var(--fsm-text-muted); border-style: dashed; }

/* Full-screen signature pad (CFB-03 §9 — fixed popup, stationary background) */
.fsr-sigpad {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: #fff;
  display: flex;
  flex-direction: column;
}
body.fsr-sigpad-open { overflow: hidden; }
.fsr-sigpad__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--fsm-border);
}
.fsr-sigpad__title { font-weight: 700; color: var(--fsm-text); }
.fsr-sigpad__canvaswrap { position: relative; flex: 1; background: #fbfbfd; }
.fsr-sigpad__canvaswrap canvas { position: absolute; inset: 0; touch-action: none; }
.fsr-sigpad__hint {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--fsm-text-faint);
  pointer-events: none;
}
.fsr-sigpad__actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--fsm-border);
}
.fsr-sigpad__actions .btn { flex: 1; }

/* Read-only lock banner */
.fsr-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #166534;
  border-radius: var(--fsm-radius);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ==========================================================================
   CFB-03 Digital FSR — signature pad + signature slot styles.
   Names match the classes used in fsr.js. Full-screen fixed overlay so
   the underlying wizard stays stationary while signing (§9 of instructions).
   ========================================================================== */
.fsr-sigpad {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--fsm-bg);
  display: flex; flex-direction: column;
}
.fsr-sigpad__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--fsm-surface);
  border-bottom: 1px solid var(--fsm-border);
}
.fsr-sigpad__title { font-size: 15px; font-weight: 700; color: var(--fsm-text); }
.fsr-sigpad__canvaswrap {
  flex: 1 1 auto;
  position: relative;
  background: #fff;
  margin: 12px;
  border: 1px dashed var(--fsm-border-strong);
  border-radius: var(--fsm-radius);
  overflow: hidden;
}
.fsr-sigpad__canvaswrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.fsr-sigpad__hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--fsm-text-faint); font-size: 14px; pointer-events: none;
}
.fsr-sigpad__actions {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--fsm-surface); border-top: 1px solid var(--fsm-border);
}
.fsr-sigpad__actions .btn { flex: 1; height: 48px; }
/* When the pad is open, prevent underlying scroll. */
body.fsr-sigpad-open { overflow: hidden; }

/* Captured-signature slot inside the wizard's engineer/customer step. */
.fsr-sigslot {
  border: 1px solid var(--fsm-border);
  border-radius: var(--fsm-radius);
  background: #fff;
  padding: 10px;
  text-align: center;
  min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.fsr-sigslot img { max-width: 100%; max-height: 120px; display: block; }
.fsr-sigslot__date { font-size: 11px; color: var(--fsm-text-muted); margin-top: 6px; }
.fsr-sigslot--empty {
  color: var(--fsm-text-faint);
  font-size: 13px;
  border-style: dashed;
  border-color: var(--fsm-border-strong);
  background: var(--fsm-bg);
}
.fsr-sigslot--empty .bi { margin-right: 6px; }

/* Locked-FSR banner shown on fsr-view.html and on any wizard step reached
   after submission (defensive — the guard usually redirects first). */
.fsr-locked-banner {
  background: var(--fsm-success-tint);
  color: var(--fsm-success);
  border: 1px solid var(--fsm-success);
  border-radius: var(--fsm-radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

/* Preview shell — an iframe holding the bound HTML template. */
.fsr-preview {
  display: flex; flex-direction: column;
  height: 100%;
}
.fsr-preview__frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #f4f6fb;
}

/* ==========================================================================
   CFB-04 additions.
   All composed from existing tokens; no new colors / fonts.
   ========================================================================== */

/* Point 6 — small "Assigned" label above the date in the ticket card. */
.fsm-ticket__datelabel {
  font-size: 10px;
  font-weight: 600;
  color: var(--fsm-text-faint);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}

/* Point 8 — Birthday / Anniversary greeting card on the Dashboard. */
.fsm-celebrate {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin: 12px 16px 4px;
  border-radius: var(--fsm-radius);
  background: var(--fsm-brand-tint);
  border: 1px solid var(--fsm-brand-tint);
  color: var(--fsm-brand);
}
.fsm-celebrate + .fsm-celebrate { margin-top: 6px; }
.fsm-celebrate i { font-size: 26px; flex-shrink: 0; }
.fsm-celebrate__body { flex: 1; }
.fsm-celebrate__title {
  font-size: 14px; font-weight: 700; color: var(--fsm-text); line-height: 1.2;
}
.fsm-celebrate__sub {
  font-size: 12px; color: var(--fsm-text-muted); margin-top: 2px;
}
/* Birthday accent (soft warm), anniversary keeps brand blue. */
.fsm-celebrate--birthday {
  background: var(--fsm-warning-tint);
  border-color: var(--fsm-warning-tint);
  color: var(--fsm-warning);
}
.fsm-celebrate--birthday .fsm-celebrate__title { color: var(--fsm-text); }

/* Point 9 — small "Submission X of N" tag on expense list rows. */
.fsm-expcard__submissiontag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10px; font-weight: 600;
  background: var(--fsm-primary-tint); color: var(--fsm-primary);
  border-radius: 999px;
  vertical-align: middle;
}

/* ==========================================================================
   CFB-05 — Email Report Copy to Client (post-closure).
   Small styles for the Report Delivery block on Ticket Details (Closed).
   All composed from existing tokens.
   ========================================================================== */

/* Success tint on the "Report Available" leading icon. */
.fsm-report-block .fsm-report-ok-icon {
  color: var(--fsm-success);
  font-size: 20px;
}

/* Send-failure banner shown in State C ("Couldn't send report"). */
.fsm-report-err {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fsm-danger-tint);
  color: var(--fsm-danger);
  border-radius: var(--fsm-radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
}
.fsm-report-err i { flex-shrink: 0; font-size: 16px; }

/* -------------------------------------------------------------------------
   CFB-06 · Customer Information card (ticket-scoped edit)
   ------------------------------------------------------------------------- */
.fsm-cust-card .fsm-block__title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fsm-cust-scope-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--fsm-text-muted);
  font-style: italic;
}
.fsm-cust-master-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--fsm-text-muted);
  margin-left: 4px;
}
.fsm-cust-audit {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fsm-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fsm-cust-audit i { font-size: 13px; }
.fsm-cust-helper {
  background: var(--fsm-info-tint, #eef4ff);
  color: var(--fsm-text-body, #1f2937);
  border-radius: var(--fsm-radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.fsm-cust-card--edit .fsm-field { margin-bottom: 12px; }
.fsm-cust-card--edit .fsm-field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fsm-text-body, #1f2937);
  margin-bottom: 4px;
  display: block;
}
.fsm-cust-card--edit .form-control {
  border-radius: var(--fsm-radius-sm);
  border: 1px solid var(--fsm-border, #d5dbe6);
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
}
.fsm-cust-card--edit .form-control:focus {
  border-color: var(--fsm-primary, #2b6cff);
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 108, 255, 0.12);
}
.fsm-cust-card--edit .form-control.is-invalid {
  border-color: var(--fsm-danger, #d64545);
}
.fsm-cust-card--edit .invalid-feedback {
  color: var(--fsm-danger, #d64545);
  font-size: 12px;
  margin-top: 4px;
}
.fsm-cust-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.fsm-cust-actions .btn { width: 100%; }

/* ---------------------------------------------------------------------------
   FSM.Web.UI — Engineer Login integration additions (not in the prototype
   design system; composed from existing tokens, no new palette).
   --------------------------------------------------------------------------- */
.fsm-login__error {
  display: block;
  background: var(--fsm-danger-tint);
  color: var(--fsm-danger);
  border-radius: var(--fsm-radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}
.fsm-panel-entry {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.fsm-panel-entry__greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--fsm-text);
  margin-top: 8px;
}
.fsm-panel-entry__sub {
  color: var(--fsm-text-muted);
  font-size: 14px;
  margin-top: 4px;
  margin-bottom: 28px;
}

/* OCMS020 Phase 4 — Engineer Profile: field hint text under an input. */
.fsm-field__hint { font-size: 12px; color: var(--fsm-text-muted, #6b7280); }
