@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
@import "tokens.css";
/* components.css é carregado via <link> DEPOIS de registration.css em cada
   página interna, para que as overrides Phase 2/3 vençam o cascade. */

/* ============================================================ */
/* RESET + BASE                                                 */
/* ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-surface-sunken);
  font-feature-settings: "cv11", "ss01", "ss02";
}

/* ============================================================ */
/* APP SHELL (Phase 1 — sidebar dark icon-rail + topbar slim)    */
/* ============================================================ */
.app {
  --ds-sidebar-w: var(--sidebar-width);
  display: grid;
  grid-template-columns: var(--ds-sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--duration-base) var(--ease-standard);
}

body.ds-sidebar-collapsed .app {
  --ds-sidebar-w: var(--sidebar-width-compact);
}

/* Sidebar shell — class kept for legacy gating; visual look fully overridden */
.sidebar,
.ds-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3);
  gap: var(--space-4);
  border-right: 1px solid var(--color-sidebar-border);
  z-index: var(--z-sidebar);
  overflow: hidden;
}

.ds-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: var(--topbar-height);
  padding: 0 var(--space-2);
  flex-shrink: 0;
}

.ds-shell__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  outline: none;
}
.ds-shell__brand:focus-visible {
  box-shadow: var(--ring-primary);
  border-radius: var(--radius-md);
}

.ds-shell__brand-img {
  height: 28px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1); /* logo monochrome white on dark sidebar */
  transition: opacity var(--duration-base) var(--ease-standard);
}

body.ds-sidebar-collapsed .ds-shell__brand-img {
  height: 24px;
  width: 24px;
  object-fit: contain;
  object-position: left center;
}

/* Sidebar nav */
.ds-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ds-nav--primary {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.ds-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-normal);
  text-transform: none;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}

.ds-nav__item:hover {
  background: var(--color-sidebar-bg-hover);
  color: var(--color-sidebar-text-strong);
}

.ds-nav__item--active {
  background: var(--color-sidebar-bg-active);
  color: var(--color-sidebar-text-strong);
}

.ds-nav__item--active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--color-sidebar-accent);
}

.ds-nav__item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-sidebar-bg), 0 0 0 4px var(--color-primary-400);
}

.ds-nav__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.ds-nav__label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-nav__tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-sidebar-bg-active);
  color: var(--color-sidebar-text-strong);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-standard);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  display: none;
}

body.ds-sidebar-collapsed .ds-nav__label {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  pointer-events: none;
  width: 0;
}

body.ds-sidebar-collapsed .ds-nav__item {
  justify-content: center;
  padding: 8px 0;
}

body.ds-sidebar-collapsed .ds-nav__item:hover .ds-nav__tooltip {
  display: block;
  opacity: 1;
}

.ds-sidebar__divider {
  height: 1px;
  background: var(--color-sidebar-border);
  margin: 4px 0;
  flex-shrink: 0;
}

.ds-sidebar__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-sidebar-border);
  margin-top: auto;
}

.ds-sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-width: 0;
}

.ds-sidebar__user-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ds-sidebar__user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-sidebar-text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.ds-sidebar__user-role {
  font-size: var(--text-xs);
  color: var(--color-sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

body.ds-sidebar-collapsed .ds-sidebar__user-meta {
  display: none;
}

.ds-sidebar__collapse {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-sidebar-text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.ds-sidebar__collapse:hover {
  background: var(--color-sidebar-bg-hover);
  color: var(--color-sidebar-text-strong);
  border-color: var(--color-sidebar-border);
}

/* Legacy .sidebar__* classes — neutralized when shell-ui hydrates */
.sidebar__brand,
.sidebar__nav,
.sidebar__section-label,
.nav-item {
  /* These remain in the DOM only as no-JS fallback. shell-ui.js wipes them. */
}

/* ============================================================ */
/* MAIN + TOPBAR                                                */
/* ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar,
.ds-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
}

.ds-topbar__hamburger {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ds-topbar__hamburger:hover { background: var(--color-surface-hover); }

.ds-topbar__title-host {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar__title,
.ds-topbar__title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  text-transform: none;
  color: var(--color-text-strong);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.ds-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  min-width: 0;
}

/* Global search */
.ds-topbar__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px 10px;
  width: clamp(180px, 28vw, 360px);
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.ds-topbar__search:focus-within {
  background: var(--color-surface);
  border-color: var(--color-primary-300);
  box-shadow: var(--ring-primary);
}

.ds-topbar__search-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.ds-topbar__search-input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: var(--text-md);
  color: var(--color-text);
  flex: 1 1 auto;
  min-width: 0;
}

.ds-topbar__search-input::placeholder { color: var(--color-text-subtle); }

.ds-topbar__search-kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Icon buttons */
.ds-iconbtn {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.ds-iconbtn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border-subtle);
}

.ds-iconbtn:focus-visible {
  outline: none;
  box-shadow: var(--ring-primary);
}

.ds-iconbtn--ai {
  color: var(--color-ai-600);
}

.ds-iconbtn--ai:hover {
  background: var(--color-ai-50);
  color: var(--color-ai-700);
  border-color: var(--color-ai-100);
}

.ds-iconbtn__dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--color-danger-500);
  border: 2px solid var(--color-surface);
}

/* DS Button — modern enterprise primary */
.ds-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: 1;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

.ds-btn--primary {
  background: var(--color-primary-500);
  color: var(--color-text-inverse);
}
.ds-btn--primary:hover { background: var(--color-primary-600); }
.ds-btn--primary:active { transform: translateY(1px); }
.ds-btn--primary:focus-visible { box-shadow: var(--ring-primary); outline: none; }

.ds-btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.ds-btn--ghost:hover { background: var(--color-surface-hover); }

.ds-btn--icon .ds-btn__label {
  font-size: var(--text-md);
}

@media (max-width: 1100px) {
  .ds-btn--icon .ds-btn__label { display: none; }
  .ds-btn--icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
}

/* Language inline pill in topbar */
.ds-topbar__lang {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-2) 0 var(--space-3);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color var(--duration-fast) var(--ease-standard),
              background var(--duration-fast) var(--ease-standard);
}
.ds-topbar__lang:hover {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-hover);
}

.ds-topbar__lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  padding-right: var(--space-3);
  outline: none;
}

/* Legacy .lang-* classes kept for any page that still injects them */
.lang-label {
  display: none; /* shell-ui detaches this, but hide just in case */
}
.lang-select {
  font: inherit;
  font-size: var(--text-md);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

/* Avatar */
.ds-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
  text-transform: uppercase;
  border: 1px solid var(--color-primary-100);
}

.ds-avatar--sm { width: 28px; height: 28px; font-size: var(--text-xs); }

/* User menu */
.ds-usermenu {
  position: relative;
}

.ds-usermenu__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 4px 8px 4px 4px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  cursor: pointer;
  height: 36px;
}
.ds-usermenu__trigger:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-subtle);
}
.ds-usermenu__trigger:focus-visible { outline: none; box-shadow: var(--ring-primary); }

.ds-usermenu__name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .ds-usermenu__name { display: none; }
}

.ds-usermenu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ds-usermenu__header {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ds-usermenu__name-strong {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text-strong);
}

.ds-usermenu__email {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-usermenu__role-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-top: var(--space-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.ds-role-badge--admin     { background: #fee2e2; color: #991b1b; }
.ds-role-badge--staff     { background: #d1fae5; color: #047857; }
.ds-role-badge--inspector { background: #dbeafe; color: #1d4ed8; }
.ds-role-badge--client    { background: #ede9fe; color: #5b21b6; }
.ds-role-badge--user      { background: var(--color-surface-muted); color: var(--color-text-muted); }

.ds-usermenu__divider {
  height: 1px;
  background: var(--color-border-subtle);
  margin: var(--space-1) var(--space-2);
}

.ds-usermenu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-md);
  color: var(--color-text);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ds-usermenu__item:hover { background: var(--color-surface-hover); }
.ds-usermenu__item--danger { color: var(--color-danger-600); }
.ds-usermenu__item--danger:hover { background: var(--color-danger-50); }

/* Drawer backdrop */
.ds-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 13, 26, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-emphasized),
              visibility var(--duration-base) var(--ease-emphasized);
  z-index: var(--z-drawer-backdrop);
}

.ds-drawer-backdrop--visible {
  opacity: 1;
  visibility: visible;
}

/* SVG icon helper */
.ds-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  vertical-align: middle;
}
.ds-icon--xs { width: 12px; height: 12px; }
.ds-icon--sm { width: 14px; height: 14px; }
.ds-icon--md { width: 18px; height: 18px; }
.ds-icon--lg { width: 22px; height: 22px; }
.ds-icon use { pointer-events: none; }

/* Native [hidden] must always win over our display: flex panels */
[hidden] { display: none !important; }

/* Content slot — slightly tighter padding (was 1.75rem = 28px) */
.content {
  padding: var(--space-6) var(--space-6);
  flex: 1;
}

/* ============================================================ */
/* RESPONSIVE SHELL                                              */
/* ============================================================ */
@media (max-width: 1023px) {
  /* Tablet: sidebar collapses to icon rail by default; can be expanded
     via the in-sidebar toggle. */
  .app { --ds-sidebar-w: var(--sidebar-width-compact); }
  body.ds-sidebar-collapsed .app { --ds-sidebar-w: var(--sidebar-width-compact); }

  body:not(.ds-sidebar-collapsed) .ds-nav__label { /* still hide labels in tablet rail */
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
    width: 0;
  }
  body:not(.ds-sidebar-collapsed) .ds-nav__item:hover .ds-nav__tooltip {
    display: block;
    opacity: 1;
  }
  body:not(.ds-sidebar-collapsed) .ds-nav__item { justify-content: center; padding: 8px 0; }
  body:not(.ds-sidebar-collapsed) .ds-sidebar__user-meta { display: none; }
  body:not(.ds-sidebar-collapsed) .ds-shell__brand-img { width: 24px; height: 24px; object-fit: contain; object-position: left center; }
}

@media (max-width: 720px) {
  /* Mobile: sidebar becomes an off-canvas drawer */
  .app { grid-template-columns: 1fr; --ds-sidebar-w: 0; }
  .sidebar, .ds-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--duration-base) var(--ease-emphasized);
    z-index: var(--z-drawer);
    border-right: 1px solid var(--color-sidebar-border);
  }
  body.ds-drawer-open .sidebar,
  body.ds-drawer-open .ds-sidebar {
    transform: translateX(0);
  }
  /* In mobile drawer, restore expanded labels */
  body:not(.ds-sidebar-collapsed) .sidebar .ds-nav__label,
  body:not(.ds-sidebar-collapsed) .ds-sidebar .ds-nav__label {
    opacity: 1;
    visibility: visible;
    position: static;
    pointer-events: auto;
    width: auto;
  }
  body:not(.ds-sidebar-collapsed) .ds-sidebar .ds-nav__item {
    justify-content: flex-start;
    padding: 8px 10px;
  }
  body:not(.ds-sidebar-collapsed) .ds-sidebar .ds-sidebar__user-meta { display: flex; }
  body:not(.ds-sidebar-collapsed) .ds-sidebar .ds-shell__brand-img {
    width: auto; height: 28px; filter: brightness(0) invert(1);
  }
  .ds-sidebar__collapse { display: none; }

  .ds-topbar__hamburger { display: inline-flex; }
  .ds-topbar__search { display: none; }
  .ds-btn--icon .ds-btn__label { display: none; }
  .ds-btn--icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
  .content { padding: var(--space-4); }
}

.content {
  padding: 1.75rem;
  flex: 1;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  max-width: 720px;
  padding: 1.75rem 2rem 2rem;
}

.card + .card {
  margin-top: 1.25rem;
}

.card--hidden {
  display: none;
}

/* Wide-content modifier: opt-in for pages whose card needs the full content
   width (wide data tables, multi-column boards). Existing narrow `.card`
   layouts (auth forms, customer-new) are unaffected. */
.card--wide {
  max-width: none;
  width: 100%;
}

/* ============================================================
 * Operations console page modifier (PR-UI-REQ-01).
 *
 * The Requirements Engine and other underwriting / operations
 * surfaces benefit from a wider working area than the default
 * 720 px `.card` cap allows. Adding `content--ops` to <main>
 * accomplishes three things at once:
 *   1. Every descendant `.card` opts out of the 720 px cap and
 *      stretches to the available content width (same effect as
 *      sprinkling `card--wide`, but page-level so future cards
 *      added by feature PRs benefit automatically).
 *   2. The whole content column is centered inside a generous
 *      1600 px operational ceiling — wider than the narrow forms
 *      but tighter than e.g. an unbounded data grid. The ceiling
 *      keeps line lengths readable on ultrawide monitors.
 *   3. The default padding is increased modestly on desktop and
 *      trimmed back on mobile so dense rule lists and modals get
 *      visual breathing room without sliding sideways.
 *
 * Narrow pages (login, customer-new, etc.) keep their current
 * `.card { max-width: 720px }` cap because they do not opt in.
 * ============================================================ */
.content--ops {
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 2vw, 2rem);
  padding-right: clamp(1rem, 2vw, 2rem);
  width: 100%;
}
.content--ops .card { max-width: none; width: 100%; }
.content--ops .card + .card { margin-top: 1.25rem; }
@media (max-width: 720px) {
  .content--ops {
    padding-left: var(--space-4, 1rem);
    padding-right: var(--space-4, 1rem);
  }
}

.card__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.5rem 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.card__toolbar-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.btn--small {
  font-size: 0.8125rem;
  padding: 0.45rem 0.85rem;
}

.card__header {
  margin-bottom: 1.5rem;
}

.card__title {
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
}

.card__subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}

.form-grid--full {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  /* Shell mobile rules live in the Phase 1 RESPONSIVE SHELL block above.
     This block keeps only form/grid mobile concerns. */
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
}

.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(30, 94, 255, 0.35);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.field--optional label::after {
  content: " (optional)";
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.75rem;
}

html[lang="pt-BR"] .field--optional label::after {
  content: " (opcional)";
}

html[lang="es"] .field--optional label::after {
  content: " (opcional)";
}

.actions {
  margin-top: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.alert {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  display: none;
}

.alert--error {
  display: block;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert--success {
  display: block;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert--warning {
  display: block;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.field-error {
  font-size: 0.75rem;
  color: #b91c1c;
  min-height: 1em;
}

/* App shell — QuickBooks-style lists & login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--color-canvas);
}

.login-page .card {
  max-width: 440px;
  width: 100%;
}

.sidebar__section-label {
  font-family: var(--font-head);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-sidebar-muted);
  margin: 0.25rem 0 0.35rem 0.75rem;
}

.nav-item[href] {
  display: block;
}

.nav-item[href]:hover {
  color: var(--color-surface);
  background: rgba(255, 255, 255, 0.06);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.content--flush {
  padding-top: 1.25rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-header__title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  color: var(--color-text);
}

.form-section-title {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

.form-section-title:first-child {
  margin-top: 0;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.filters-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  padding: 1rem 1.1rem;
  margin: 0 0 1rem 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  align-items: end;
}

.filters-bar__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.filters-bar__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.filters-bar__input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 8px);
  background: var(--color-surface);
  color: inherit;
  min-width: 0;
}

.filters-bar__input:focus {
  outline: 2px solid rgba(30, 94, 255, 0.35);
  outline-offset: 1px;
  border-color: rgba(30, 94, 255, 0.6);
}

.filters-bar__input[disabled] {
  background: var(--color-canvas);
  color: var(--color-muted);
  cursor: not-allowed;
}

.multi-select {
  position: relative;
  min-width: 0;
}

.multi-select__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 8px);
  background: var(--color-surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.multi-select__trigger:focus,
.multi-select__trigger:hover {
  border-color: rgba(30, 94, 255, 0.6);
}

.multi-select__trigger[aria-expanded="true"] {
  border-color: rgba(30, 94, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(30, 94, 255, 0.18);
}

.multi-select__trigger-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-muted);
}

.multi-select__trigger-label--filled {
  color: inherit;
}

.multi-select__caret {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-left: auto;
}

.multi-select__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  width: max-content;
  max-width: min(320px, 90vw);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 0.6rem;
  display: none;
}

.multi-select__panel--open {
  display: block;
}

.multi-select__search {
  width: 100%;
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 8px);
  margin-bottom: 0.5rem;
}

.multi-select__toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.multi-select__toolbar button {
  border: none;
  background: transparent;
  color: rgb(30, 94, 255);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.multi-select__toolbar button:hover {
  text-decoration: underline;
}

.multi-select__list {
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
  padding-top: 0.4rem;
  list-style: none;
  margin: 0;
}

.multi-select__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.multi-select__option:hover {
  background: rgba(30, 94, 255, 0.06);
}

.multi-select__option input {
  margin: 0;
  cursor: pointer;
}

.multi-select__empty {
  padding: 0.75rem 0.25rem;
  color: var(--color-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.filters-bar__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.filters-bar__hint {
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-right: auto;
}

.filters-bar__count {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin: 0.25rem 0 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: rgba(30, 94, 255, 0.04);
}

.mono-muted {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.empty-state {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9375rem;
}

/* Clients module — secondary tabs + collapsible Customers (QuickBooks-style) */
.clients-module-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.clients-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.25rem;
}

.clients-tab {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  color: var(--color-muted);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.clients-tab:hover {
  color: var(--color-text);
  background: var(--color-canvas);
}

.clients-tab--active {
  color: var(--color-primary);
  background: rgba(30, 94, 255, 0.08);
  border-color: rgba(30, 94, 255, 0.25);
}

.clients-customers-dropdown {
  margin-left: auto;
  position: relative;
  min-width: 140px;
}

.clients-customers-dropdown > summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  color: var(--color-text);
  background: var(--color-canvas);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.clients-customers-dropdown > summary::-webkit-details-marker {
  display: none;
}

.clients-customers-dropdown > summary::after {
  content: "";
  border: solid var(--color-muted);
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  margin-left: 0.25rem;
  transition: transform 0.15s ease;
}

.clients-customers-dropdown[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.clients-customers-dropdown > summary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.clients-customers-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.12);
  padding: 0.35rem;
  z-index: 20;
}

.clients-sublink {
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 6px;
}

.clients-sublink:hover {
  background: var(--color-canvas);
}

.clients-sublink--active {
  background: rgba(30, 94, 255, 0.1);
  color: var(--color-primary);
  font-weight: 600;
}

.clients-placeholder-card {
  max-width: 560px;
  padding: 1.5rem 1.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.clients-placeholder-card h2 {
  font-family: var(--font-head);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.clients-placeholder-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.clients-form-hint {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.client-detail-card {
  margin-bottom: 1.25rem;
}

.client-detail-dl {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0;
  font-size: 0.875rem;
}

.client-detail-dl dt {
  color: var(--color-muted);
  font-weight: 600;
  margin: 0;
}

.client-detail-dl dd {
  margin: 0;
}

.client-detail-stats {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.client-detail-stats p {
  margin: 0 0 0.5rem;
}

.data-table tbody td a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.data-table tbody td a:hover {
  text-decoration: underline;
}

.customer-local-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.customer-local-tab {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
}

.customer-local-tab:hover {
  color: var(--color-text);
  background: var(--color-canvas);
}

.customer-local-tab--active {
  color: var(--color-primary);
  border-color: rgba(30, 94, 255, 0.35);
  background: rgba(30, 94, 255, 0.08);
}

.customer-tab-panel {
  margin-bottom: 1.5rem;
}

.customer-tab-panel[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .clients-customers-dropdown {
    margin-left: 0;
    width: 100%;
  }

  .clients-customers-panel {
    left: 0;
    right: 0;
  }
}

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

.permissions-matrix th,
.permissions-matrix td {
  vertical-align: middle;
}

.permissions-matrix .permission-cell {
  text-align: center;
  white-space: nowrap;
}

.permissions-matrix .permission-cell input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.permissions-matrix .permission-cell input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.permissions-matrix .row-status {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted, #6b7280);
  min-width: 1rem;
}

.mono-muted {
  display: inline-block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  color: var(--color-text-muted, #6b7280);
}

/* ============================================================ Plans module */

.empty-state {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.empty-state--card {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  padding: 2rem 1rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -22px rgba(15, 23, 42, 0.45);
  border-color: rgba(30, 94, 255, 0.35);
}

.plan-card--popular {
  border-color: rgba(30, 94, 255, 0.55);
  box-shadow: 0 12px 24px -22px rgba(30, 94, 255, 0.55);
}

.plan-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.plan-card__name {
  font-family: var(--font-head);
  font-size: 1.15rem;
  margin: 0;
}

.plan-card__tagline {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.plan-card__price {
  font-size: 1.5rem;
  color: var(--color-text);
}

.plan-card__price strong {
  font-family: var(--font-head);
  font-weight: 700;
}

.plan-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0.75rem;
  background: var(--color-canvas);
  border-radius: 8px;
  font-size: 0.8rem;
}

.plan-card__meta div { display: flex; flex-direction: column; gap: 0.15rem; }
.plan-card__meta dt {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  color: var(--color-muted);
}

.plan-card__meta dd { margin: 0; color: var(--color-text); }

.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.plan-card__features li::before {
  content: "✓";
  color: var(--color-primary);
  margin-right: 0.5rem;
  font-weight: 700;
}

.plan-card__more {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.plan-card__more::before { content: none; }

.plan-card__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.plan-badge {
  align-self: flex-start;
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(30, 94, 255, 0.12);
  color: var(--color-primary);
}

.plan-badge--popular { background: rgba(255, 184, 0, 0.18); color: #b07a00; }
.plan-badge--new { background: rgba(0, 168, 107, 0.18); color: #00734a; }
.plan-badge--premium { background: rgba(138, 43, 226, 0.18); color: #6b21a8; }
.plan-badge--limited { background: rgba(220, 38, 38, 0.18); color: #b91c1c; }

/* ------------------------------------------------------------ Drawer shell */

.plan-drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
}

.plan-drawer--open { display: block; }

.plan-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.plan-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 980px);
  background: var(--color-surface);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "head head"
    "body side"
    "foot foot";
  box-shadow: -22px 0 50px -28px rgba(15, 23, 42, 0.45);
  animation: drawer-slide 0.18s ease-out;
}

@keyframes drawer-slide {
  from { transform: translateX(20px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

.plan-drawer__head {
  grid-area: head;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.plan-drawer__eyebrow {
  margin: 0;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.plan-drawer__title { margin: 0.25rem 0 0; font-family: var(--font-head); font-size: 1.25rem; }

.plan-drawer__body {
  grid-area: body;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.plan-drawer__side {
  grid-area: side;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: var(--color-canvas);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.plan-drawer__side-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plan-drawer__side-hint {
  margin: -0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.plan-drawer__foot {
  grid-area: foot;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* ----------------------------------------------------------- Drawer form */

.plan-form { display: flex; flex-direction: column; gap: 1.5rem; }

.plan-form__section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.1rem;
}

.plan-form__section-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text);
}

.plan-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.plan-form__grid .field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.plan-form__grid .field > span { font-size: 0.75rem; color: var(--color-muted); }
.plan-form__grid .field input[type="text"],
.plan-form__grid .field input[type="number"],
.plan-form__grid .field select,
.plan-form__grid .field textarea {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  background: var(--color-surface);
  width: 100%;
}

.plan-form__grid .field--wide { grid-column: span 2; }
.plan-form__grid .field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.plan-form__grid .field--inline input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--color-primary); }
.plan-form__grid .field--inline > span { font-size: 0.85rem; color: var(--color-text); }

.feature-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.feature-catalog__group {
  background: var(--color-canvas);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem;
}

.feature-catalog__cat {
  margin: 0 0 0.5rem;
  font-family: var(--font-head);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.feature-catalog__item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
}

.feature-catalog__item input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--color-primary);
}

.feature-catalog__item small {
  display: block;
  color: var(--color-muted);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

/* ----------------------------------------------------------- Live preview */

.plan-preview .plan-card { box-shadow: none; }
.plan-preview .plan-card--preview { border-style: dashed; }

/* ---------------------------------------------------------------- AI block */

.plan-ai { display: flex; flex-direction: column; gap: 0.6rem; }

.plan-ai__card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.plan-ai__card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.plan-ai__type {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.plan-ai__priority {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(30, 94, 255, 0.12);
  color: var(--color-primary);
}

.plan-ai__card--high { border-left-color: #dc2626; }
.plan-ai__card--high .plan-ai__priority { background: rgba(220, 38, 38, 0.15); color: #b91c1c; }
.plan-ai__card--medium { border-left-color: #f59e0b; }
.plan-ai__card--medium .plan-ai__priority { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.plan-ai__card--low { border-left-color: #2563eb; }
.plan-ai__card--low .plan-ai__priority { background: rgba(37, 99, 235, 0.15); color: #1d4ed8; }

.plan-ai__card h4 { margin: 0; font-size: 0.9rem; }
.plan-ai__card p { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--color-muted); }

.plan-ai__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

@media (max-width: 960px) {
  .plan-drawer__panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "body"
      "side"
      "foot";
  }
  .plan-drawer__side { border-left: none; border-top: 1px solid var(--color-border); }
  .plan-form__grid { grid-template-columns: 1fr; }
  .plan-form__grid .field--wide { grid-column: span 1; }
}

/* ============================================================ */
/* Customer Detail HUB — relationship summary, drawer, timeline */
/* ============================================================ */

.relationship-summary {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
}
.relationship-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.relationship-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.summary-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.summary-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-muted, #6b7280);
  margin: 0;
}
.summary-card__value {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0.25rem 0 0.5rem;
  color: var(--color-text, #111827);
  word-break: break-word;
}
.summary-card__warning {
  margin: 0.75rem 0 0;
  color: var(--color-warning, #b45309);
  font-size: 0.85rem;
}
.summary-card__hint {
  margin: 0 0 0.4rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.8125rem;
  word-break: break-word;
}

/* ===== Property Profile (PR-PROP-01) ===== */
.property-grid-safety .property-bool-field {
  align-self: start;
}
.property-bool-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0;
}
.property-bool-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 auto;
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
.status-badge--success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-badge--info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-badge--warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-badge--danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-badge--muted { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

.customer-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ---------- Plan summary card (Plans tab) ---------- */
.plan-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.plan-summary__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.plan-summary__head h4 { margin: 0; font-size: 1.125rem; }
.plan-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}
.plan-summary__grid > div { display: flex; flex-direction: column; gap: 0.15rem; }
.plan-summary__grid dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted, #6b7280);
}
.plan-summary__grid dd { margin: 0; font-weight: 600; color: var(--color-text, #111827); }
.plan-summary__section { display: flex; flex-direction: column; gap: 0.35rem; }
.plan-summary__section h5 { margin: 0; font-size: 0.875rem; }
.plan-summary__list { margin: 0; padding-left: 1.1rem; }
.plan-summary__list li { margin: 0.1rem 0; }

/* ---------- Insurance form helper ---------- */
.checkbox-row { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 500; }

/* ---------- Visit timeline ---------- */
.visit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  position: relative;
}
.visit-timeline-item {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}
.visit-timeline-item::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--color-primary, #2563eb);
}
.visit-timeline-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.visit-timeline-item__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 1rem;
  margin: 0;
}
.visit-timeline-item__grid dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted, #6b7280);
}
.visit-timeline-item__grid dd { margin: 0; font-weight: 500; }
.visit-timeline-item__photos { display: flex; flex-direction: column; gap: 0.35rem; }
.visit-timeline-item__photos h6 { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--color-text-muted, #6b7280); }
.visit-timeline-item__upload { display: flex; gap: 0.5rem; align-items: center; }
.visit-timeline-item__upload input[type="file"] { display: none; }

.visit-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.4rem;
}
.visit-photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
  cursor: pointer;
  padding: 0;
}
.visit-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visit-photo-thumb:hover { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }

.empty-state--inline { font-size: 0.85rem; margin: 0; }

/* ---------- Generic right-side drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 1000;
}
.drawer[hidden] { display: none; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  border: 0;
  cursor: pointer;
}
.drawer-panel {
  position: relative;
  width: min(480px, 100%);
  background: var(--color-surface, #fff);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.15);
  animation: drawerSlideIn 220ms ease;
}
.drawer-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.drawer-panel__header h3 { margin: 0; font-size: 1.0625rem; }
.drawer-panel__body { padding: 1rem; overflow-y: auto; }
.drawer-panel__footer {
  border-top: 1px solid var(--color-border, #e5e7eb);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.plan-preview-line { margin: 0; }
@keyframes drawerSlideIn {
  from { transform: translateX(8%); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1100;
}
.lightbox[hidden] { display: none; }
.lightbox__img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}
.lightbox__caption {
  margin: 0.75rem 0 0;
  color: #f9fafb;
  font-size: 0.95rem;
}
.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Portal access block ---------- */
.portal-access-block { margin-top: 0.75rem; }
.portal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 1rem;
  margin: 0;
}
.portal-info-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted, #6b7280);
  margin: 0;
}
.portal-info-grid dd { margin: 0 0 0.35rem; font-weight: 600; }

/* ---------- Loading skeletons ---------- */
.relationship-skeleton { margin-bottom: 1rem; padding: 1rem 1.25rem; }
.skeleton-card {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s linear infinite;
  border-radius: 10px;
  height: 84px;
  border: 1px solid var(--color-border, #e5e7eb);
}
.skeleton-card--header { height: 28px; width: 240px; margin-bottom: 0.85rem; }
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 720px) {
  .relationship-summary-grid { grid-template-columns: 1fr 1fr; }
  .customer-action-row { gap: 0.4rem; }
  .drawer-panel { width: 100%; }
}
@media (max-width: 480px) {
  .relationship-summary-grid { grid-template-columns: 1fr; }
}

/* Subscription preview (customer-new + customer-detail share styling) */
.subscription-preview {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.subscription-preview[hidden] { display: none; }
.subscription-preview__header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.subscription-preview__badge {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
  background: #e2e8f0;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.subscription-preview__title { font-size: 1rem; font-weight: 600; margin: 0; color: #0f172a; }
.subscription-preview__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem 1rem;
}
.subscription-preview__list li { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.86rem; color: #475569; }
.subscription-preview__list li strong { color: #0f172a; font-weight: 600; font-size: 0.95rem; }

.field--checkbox label { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.field--checkbox input[type="checkbox"] { width: 16px; height: 16px; }

.plan-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

/* =====================================================
   Insurance module (dashboard, carriers, eligibility)
   ===================================================== */
.insurance-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.insurance-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.insurance-chart-card { padding: 1rem 1.1rem; }

.insurance-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.insurance-bar {
  display: grid;
  grid-template-columns: minmax(120px, 30%) 1fr 48px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.insurance-bar__label {
  color: #334155;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.insurance-bar__track {
  background: #f1f5f9;
  border-radius: 999px;
  height: 8px;
  position: relative;
  overflow: hidden;
}
.insurance-bar__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #6366f1);
  border-radius: 999px;
}
.insurance-bar__count {
  text-align: right;
  font-weight: 600;
  color: #0f172a;
}

.insurance-panel { max-width: 720px; }
.insurance-eligibility { max-width: 920px; }
.insurance-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0 0.9rem;
}
.insurance-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}
.insurance-stat__label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.2rem;
}
.insurance-stat__value {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  color: #0f172a;
}

.insurance-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.4rem;
}
@media (max-width: 720px) {
  .insurance-cols { grid-template-columns: 1fr; }
}
.insurance-col-title {
  font-size: 0.9rem;
  margin: 0.6rem 0 0.4rem;
  color: #0f172a;
}
.insurance-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.insurance-list li {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  color: #1f2937;
}
.insurance-list li.empty-state {
  background: transparent;
  border: 1px dashed #cbd5e1;
  text-align: center;
  color: #64748b;
}
.insurance-list .muted { color: #64748b; }

.insurance-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.insurance-marketplace-banner {
  margin: 1rem 0;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  border: 1px solid #c7d2fe;
}
.insurance-marketplace-banner h2 { margin: 0.5rem 0; }
.insurance-marketplace-banner p { color: #1e293b; margin: 0; }

.insurance-generate-card { padding: 1rem 1.1rem; }

/* ---------- Insurance Policy History ---------- */
.insurance-history { padding: 1rem 1.1rem; }
.insurance-history__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.insurance-history__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.insurance-history__cap {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 0.6rem 0;
}
.insurance-history__table-wrap {
  overflow-x: auto;
}
.insurance-history__insights {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #e2e8f0;
}
.insurance-history .data-table th,
.insurance-history .data-table td {
  white-space: nowrap;
}
.insurance-history .actions-cell {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.insurance-history .empty-cell {
  text-align: center;
  padding: 1rem;
}
.btn--danger {
  color: #b91c1c;
}
.btn--danger:hover {
  background: #fef2f2;
}

/* ---------- Billing & Payments ---------- */
.billing-card { padding: 1rem 1.1rem; }
.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.billing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
}
.billing-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.billing-stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}
.billing-stat__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.billing-stat__mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.billing-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.billing-notification-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.billing-notification-list li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.85rem;
}
.billing-notification-list li:last-child { border-bottom: none; }
.billing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.billing-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.billing-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.billing-test-log {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
}
.status-badge--info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* ===== Schedule & Appointments module ===== */

.page-header__subtitle {
  margin: 0.25rem 0 0;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.9rem;
}
.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.kpi-grid {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}
.kpi-grid--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi-grid--5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi-grid--6 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 78px;
}
.kpi-card__label {
  font-size: 0.78rem;
  color: var(--color-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card__value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text, #111827);
}

.tab-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.25rem;
  background: var(--color-surface-muted, #f1f5f9);
  border-radius: 12px;
}
.tab-pill {
  border: 0;
  background: transparent;
  color: var(--color-text-muted, #475569);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tab-pill:hover { background: rgba(15, 23, 42, 0.05); }
.tab-pill--active {
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0 1rem;
}
.filter-bar__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--color-text-muted, #475569);
}
.filter-bar__field input,
.filter-bar__field select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
.filter-bar__actions {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.badge--info    { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge--warn    { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge--danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge--muted   { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge--soft    { background: #eef2ff; color: #3730a3; border: 1px solid #e0e7ff; }

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.suggestion-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
.suggestion-card--selected {
  border-color: var(--color-primary, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18);
}
.suggestion-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.suggestion-card__header strong { display: block; }
.suggestion-card__score {
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}
.suggestion-card__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.6rem;
  margin: 0;
  font-size: 0.8rem;
}
.suggestion-card__metrics dt {
  color: var(--color-text-muted, #6b7280);
  font-weight: 500;
}
.suggestion-card__metrics dd {
  margin: 0;
  color: var(--color-text, #111827);
  font-weight: 600;
}
.suggestion-card__reason {
  margin: 0;
  color: var(--color-text-muted, #475569);
  font-size: 0.82rem;
}

.route-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.route-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.route-card__header strong { display: block; }
.route-card__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.4rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px dashed var(--color-border, #e5e7eb);
  border-bottom: 1px dashed var(--color-border, #e5e7eb);
}
.route-card__metrics div { display: flex; flex-direction: column; }
.route-card__metrics dt {
  font-size: 0.72rem;
  color: var(--color-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.route-card__metrics dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 0.5rem;
}
.week-grid__day {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.week-grid__day header {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--color-text-muted, #6b7280);
}
.week-grid__day header strong { font-size: 0.85rem; color: var(--color-text, #111827); }
.week-grid__visit {
  background: #eef2ff;
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
.form-field textarea { min-height: 80px; resize: vertical; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

.hint-text {
  color: var(--color-text-muted, #6b7280);
  font-size: 0.85rem;
}
.data-table__truncate {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.data-table__empty {
  text-align: center;
  color: var(--color-text-muted, #6b7280);
  padding: 1.25rem 1rem;
}
.data-table--compact th,
.data-table--compact td { padding: 0.45rem 0.6rem; font-size: 0.85rem; }


/* ── Permissions admin (staff/permissions.html) ─────────────────────────── */
.permissions-user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 70vh;
  overflow-y: auto;
}
.permissions-user-list__item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border, #e6e8ee);
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name badge"
    "email badge";
  gap: 0.15rem 0.5rem;
  align-items: center;
}
.permissions-user-list__item:hover { background: rgba(15, 23, 42, 0.03); }
.permissions-user-list__item--active {
  background: rgba(56, 102, 255, 0.08);
  border-left: 3px solid var(--color-primary, #3866ff);
}
.permissions-user-list__name {
  grid-area: name;
  font-weight: 600;
  font-size: 0.92rem;
}
.permissions-user-list__item .mono-muted {
  grid-area: email;
  font-size: 0.78rem;
  color: var(--color-muted, #64748b);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.permissions-user-list__item .badge { grid-area: badge; align-self: center; }
.permissions-group {
  border: 1px solid var(--color-border, #e6e8ee);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0 0 0.85rem;
}
.permissions-group > legend {
  font-weight: 600;
  padding: 0 0.4rem;
  font-size: 0.95rem;
}
.permissions-group__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem 1rem;
  margin-top: 0.5rem;
}
.permissions-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.permissions-toggle input[type="checkbox"] { transform: translateY(1px); }
.permissions-toggle__name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge--admin     { background: #fee2e2; color: #b91c1c; }
.badge--staff     { background: #dcfce7; color: #166534; }
.badge--inspector { background: #dbeafe; color: #1d4ed8; }
.badge--client    { background: #f3e8ff; color: #6b21a8; }

/* Inspector Runtime Engine — session controls on the mobile route page */
.ds-inspection-session {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface-muted, #f8fafc);
}
.ds-inspection-session__head,
.ds-inspection-session__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.ds-inspection-session__head {
  justify-content: space-between;
}
.ds-inspection-session__status {
  font-weight: 600;
  color: var(--color-text, #111827);
}
.ds-inspection-session__timer {
  color: var(--color-text-muted, #6b7280);
  font-size: 0.85rem;
}
.ds-inspection-session__summary {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.65rem 0;
  font-size: 0.82rem;
  color: var(--color-text-muted, #6b7280);
}
.ds-inspection-session__summary textarea {
  width: 100%;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  resize: vertical;
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
}
.ds-inspection-session__message {
  min-height: 1rem;
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}
.ds-inspection-session__message--error { color: #b91c1c; }
.ds-inspection-session__message--success { color: #166534; }

.ds-compliance {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface, #fff);
}
.ds-compliance--ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.ds-compliance--blocked {
  border-color: #fecaca;
  background: #fff7f7;
}
.ds-compliance__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.ds-compliance__head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text, #111827);
}
.ds-compliance__status {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--color-text-muted, #6b7280);
}
.ds-compliance__score {
  min-width: 86px;
  text-align: right;
}
.ds-compliance__score span {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted, #6b7280);
}
.ds-compliance__score strong {
  display: block;
  font-size: 1.3rem;
  color: var(--color-text, #111827);
}
.ds-compliance__validate {
  margin-top: 0.65rem;
}
.ds-compliance__ok {
  margin: 0.65rem 0 0;
  color: #166534;
  font-weight: 600;
  font-size: 0.84rem;
}
.ds-compliance-issues {
  margin-top: 0.65rem;
  padding: 0.65rem;
  border-radius: 8px;
}
.ds-compliance-issues--danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.ds-compliance-issues--warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.ds-compliance-issues p {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.82rem;
}
.ds-compliance-issues ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
}
.ds-compliance-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.ds-compliance-photos p {
  flex-basis: 100%;
  margin: 0;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.78rem;
  font-weight: 600;
}
.ds-compliance-photo {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.ds-compliance-photo--ok {
  background: #dcfce7;
  color: #166534;
}
.ds-compliance-photo--missing {
  background: #fee2e2;
  color: #991b1b;
}

.ds-checklist {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--color-border, #e5e7eb);
}
.ds-checklist__head,
.ds-checklist-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.ds-checklist__head h3,
.ds-checklist-item__head h4 {
  margin: 0;
  color: var(--color-text, #111827);
}
.ds-checklist__head h3 {
  font-size: 0.95rem;
}
.ds-checklist__percent {
  font-weight: 700;
  color: var(--color-primary, #2563eb);
}
.ds-checklist__progress {
  height: 8px;
  margin: 0.65rem 0 0.35rem;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.ds-checklist__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: inherit;
  transition: width 160ms ease;
}
.ds-checklist__meta {
  margin: 0 0 0.65rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.82rem;
}
.ds-checklist-item {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 0.75rem;
  margin-top: 0.6rem;
}
.ds-checklist-item__head h4 {
  font-size: 0.92rem;
}
.ds-checklist-item__badges,
.ds-checklist-photos__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.ds-checklist-item__description {
  margin: 0.6rem 0 0;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.84rem;
  line-height: 1.45;
}
.ds-checklist-photos {
  margin-top: 0.65rem;
}
.ds-checklist-photos p {
  margin: 0;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ds-checklist-photo-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.76rem;
  font-weight: 600;
}
.ds-checklist-item__notes {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.65rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.82rem;
}
.ds-checklist-item__notes textarea {
  width: 100%;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  resize: vertical;
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
}

.ds-inspection-reports {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface, #fff);
}
.ds-inspection-reports__head,
.ds-inspection-report {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.ds-inspection-reports__head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text, #111827);
}
.ds-inspection-reports__list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.7rem;
}
.ds-inspection-report {
  padding: 0.65rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  background: var(--color-surface-muted, #f8fafc);
}
.ds-inspection-report__type {
  margin: 0;
  font-weight: 700;
  color: var(--color-text, #111827);
}
.ds-inspection-report__meta {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted, #6b7280);
}

.property-risk-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.property-risk-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.property-risk-score {
  padding: 0.85rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}
.property-risk-score__label {
  display: block;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.property-risk-score strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 2rem;
  color: var(--color-text, #111827);
}

.prevention-recommendations-card__header,
.prevention-recommendation__head,
.prevention-recommendation__actions,
.discount-opportunities-card__header,
.discount-opportunity__head,
.discount-opportunity__actions,
.submission-packages-card__header,
.submission-package__head,
.submission-package__actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.prevention-recommendations-list,
.discount-opportunities-list,
.submission-packages-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.prevention-recommendation,
.discount-opportunity,
.submission-package {
  padding: 0.85rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface-muted, #f8fafc);
}
.prevention-recommendation__title,
.discount-opportunity__title,
.submission-package__title {
  margin: 0;
  color: var(--color-text, #111827);
  font-weight: 700;
}
.prevention-recommendation__badges,
.discount-opportunity__badges,
.submission-package__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.discount-opportunity__score,
.submission-package__score {
  white-space: nowrap;
  color: var(--color-primary, #2563eb);
  font-size: 1.35rem;
}
.submission-packages-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.submission-package__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.6rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.86rem;
}
.discount-opportunity__stats,
.discount-opportunity__cols {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.discount-opportunity__stats {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.discount-opportunity__stats > div,
.discount-opportunity__cols > div {
  padding: 0.65rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface, #fff);
}
.discount-opportunity__stats span {
  display: block;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.78rem;
}
.discount-opportunity__stats strong {
  display: block;
  margin-top: 0.2rem;
}
.discount-opportunity__cols {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.discount-opportunity__cols h4 {
  margin: 0 0 0.4rem;
  color: var(--color-text, #111827);
  font-size: 0.84rem;
}
.discount-opportunity__list {
  margin: 0;
  padding-left: 1rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.86rem;
}
.prevention-recommendation__due {
  white-space: nowrap;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.82rem;
}
.prevention-recommendation__body,
.discount-opportunity__body,
.submission-package__body {
  margin: 0.65rem 0 0;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.86rem;
  line-height: 1.45;
}
.prevention-recommendation__actions,
.discount-opportunity__actions,
.submission-package__actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

@media (max-width: 720px) {
  .ds-inspection-session__actions .btn,
  .ds-checklist-item__head .btn,
  .ds-inspection-reports__head .btn,
  .ds-inspection-report .btn,
  .property-risk-card__header .btn,
  .prevention-recommendations-card__header .btn,
  .prevention-recommendation__actions .btn,
  .discount-opportunities-card__header .btn,
  .discount-opportunity__actions .btn,
  .submission-packages-card__header .btn,
  .submission-package__actions .btn {
    width: 100%;
  }
  .ds-checklist-item__head,
  .ds-inspection-reports__head,
  .ds-inspection-report,
  .property-risk-card__header,
  .prevention-recommendations-card__header,
  .prevention-recommendation__head,
  .discount-opportunities-card__header,
  .discount-opportunity__head,
  .submission-packages-card__header,
  .submission-package__head {
    flex-direction: column;
  }
  .ds-compliance__head {
    flex-direction: column;
  }
  .ds-compliance__score {
    text-align: left;
  }
}

/* =====================================================================
 * Inspector Inspection Workspace (PR-U)
 * Field-first layout: wide cards on tablet, single column on phone,
 * sticky bottom action bar so Start/Complete stay reachable on small
 * viewports.
 * ===================================================================== */
.inspection-workspace .inspection-workspace__main {
  /* PR-INSPECTION-STAB-02 — bumped from 96 → 112 so the new section
     action bar (Save Area / Add Another Area / Next Section) never
     hides under the sticky completion bar on tablet portrait. */
  padding-bottom: 112px;
}
/* PR-INSPECTION-STAB-01 — tablet-first content shell.
   * Mobile/phone (default): single column, max-width 100% of available space.
   * Tablet portrait (≥768px): single column but capped to a comfortable
     reading width with side margins.
   * Tablet landscape / desktop (≥1024px): two-rail layout — see
     `.inspection-workspace__rails` below.
   The legacy 960px ceiling is gone; horizontal space scales with the
   viewport via `clamp()`. */
.inspection-workspace__content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: clamp(960px, 92vw, 1320px);
}
.inspection-workspace__alert,
.inspection-workspace__date-warning {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}
.inspection-workspace__alert--error   { background:#fdecea; color:#a8181b; border:1px solid #f5c2c2; }
.inspection-workspace__alert--success { background:#e7f6ec; color:#1d6b3a; border:1px solid #b3dec4; }
.inspection-workspace__alert--info    { background:#eef3fb; color:#1c4587; border:1px solid #c5d6f0; }
.inspection-workspace__date-warning {
  background:#fff7e6;
  color:#8a5a00;
  border:1px solid #f5d68a;
}
.inspection-workspace__date-warning--future {
  background:#eef3fb;
  color:#1c4587;
  border-color:#c5d6f0;
}
.inspection-workspace__date-warning--past {
  background:#fff4f4;
  color:#a8181b;
  border-color:#f5c2c2;
}
.inspection-workspace__date-warning--missing {
  background:#f5f7fb;
  color:#5b6470;
  border-color:#d8dde6;
}

/* Two-rail container — collapses to single column below 1024px. */
.inspection-workspace__rails {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}
.inspection-workspace__rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0; /* allow children to shrink inside grid */
}
@media (min-width: 1024px) {
  .inspection-workspace__rails {
    grid-template-columns: minmax(320px, 360px) 1fr;
    align-items: start;
  }
  .inspection-workspace__rail--context {
    position: sticky;
    top: calc(var(--topbar-height, 64px) + 16px);
  }
}
.inspection-header__meta-value--muted {
  color: var(--ds-color-text-muted, #5b6470);
  font-style: italic;
}

.inspection-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.inspection-header__eyebrow {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted, #5b6470);
  margin: 0 0 4px;
}
.inspection-header__customer {
  font-size: 22px;
  margin: 0 0 4px;
  line-height: 1.2;
}
.inspection-header__address {
  margin: 0;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-header__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 480px) {
  .inspection-header__meta {
    grid-template-columns: 1fr;
  }
}
.inspection-header__meta dt {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-header__meta dd {
  margin: 2px 0 0;
  font-weight: 500;
}

.inspection-session-card__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.inspection-session-card__label {
  margin: 0;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-session-card__value {
  margin: 4px 0 0;
  font-weight: 500;
}
.inspection-session-card__hint {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f5f7fb;
  border-radius: 8px;
  font-size: 14px;
}
.inspection-session-card__hint--error {
  background: #fdecea;
  color: #a8181b;
}

.inspection-progress {
  margin: 8px 0 16px;
}
.inspection-progress__bar {
  width: 100%;
  height: 8px;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
}
.inspection-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, #2f7d57, #4aa676);
  transition: width .25s ease;
}

.inspection-checklist .ds-checklist-item + .ds-checklist-item {
  margin-top: 10px;
}
.inspection-photo-requirement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.inspection-photo-requirement {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f5f7fb;
  border-radius: 999px;
  font-size: 12px;
}
.inspection-photo-requirement--inline {
  background: transparent;
  padding: 0;
}
.inspection-photo-requirement__label { font-weight: 600; }
.inspection-photo-requirement__count { color: var(--ds-color-text-muted, #5b6470); }

.inspection-photo-upload {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.inspection-photo-upload__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-photo-upload__field input,
.inspection-photo-upload__field select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d6dce6;
  font-size: 14px;
  min-height: 40px;
}
.inspection-photo-upload__field--file input { padding: 6px; }
.inspection-photo-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.inspection-photos-card__subhead {
  margin: 16px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.inspection-photo {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f7fb;
  position: relative;
}
.inspection-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.inspection-photo figcaption {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--ds-color-text-muted, #5b6470);
}
/* PR-INSPECTION-STAB-02C — Section — Area — Condition metadata line. */
.inspection-photo__meta {
  font-weight: 600;
  color: var(--ds-color-text, #1f2937);
  border-bottom: 1px solid #eef0f4;
}
/* PR-INSPECTION-STAB-02C — Per-photo delete affordance shared between
   the per-section card and the global Uploaded Photos gallery. */
.inspection-photo__delete,
.inspection-section-photo__delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.inspection-photo__delete:hover,
.inspection-section-photo__delete:hover {
  background: rgba(220, 38, 38, 0.88);
  border-color: rgba(255, 255, 255, 0.85);
}
.inspection-photo__delete:disabled,
.inspection-section-photo__delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.inspection-compliance-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.inspection-compliance-card__list {
  margin-top: 12px;
}
.inspection-compliance-card__list h4 {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-compliance-card__list ul {
  margin: 0;
  padding-left: 18px;
}
.inspection-compliance-card__list--blockers ul li { color: #a8181b; }

.inspection-report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e6ee;
  border-radius: 10px;
  margin-top: 8px;
}
.inspection-report-row__title { margin: 0; font-weight: 600; }
.inspection-report-row__meta { margin: 2px 0 0; font-size: 12px; color: var(--ds-color-text-muted, #5b6470); }
.inspection-report-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspection-action-bar {
  position: fixed;
  bottom: 0;
  left: var(--ds-sidebar-width, 0);
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid #e2e6ee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  z-index: 30;
  backdrop-filter: blur(8px);
}
.btn--large {
  font-size: 16px;
  padding: 12px 20px;
  min-height: 48px;
}

@media (max-width: 960px) {
  .inspection-action-bar { left: 0; }
}

@media (max-width: 720px) {
  .inspection-workspace .inspection-workspace__main {
    /* PR-INSPECTION-STAB-02 — extra clearance on phone widths where
       the stacked action bar consumes ~144px (Start + Complete +
       padding + safe-area-inset-bottom). */
    padding-bottom: 144px;
  }
  .inspection-header__top { flex-direction: column; }
  .inspection-photo-upload {
    grid-template-columns: 1fr;
  }
  .inspection-photo-upload .btn { width: 100%; }
  .inspection-action-bar {
    flex-direction: column;
  }
  .inspection-action-bar .btn { width: 100%; }
  .inspection-report-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .inspection-report-row__actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* =====================================================================
 * PR-ROUTE-01 — Route Package surfaces (Route tab + Month foundation)
 *
 * Three concerns:
 *   1. The Route tab toolbar (Generate routes button + foundation hint).
 *   2. The Route detail card that hangs below the route list when the
 *      operator opens a package.
 *   3. The Month tab grid (one button per day with visit/route counts).
 * ===================================================================== */
.route-pkg-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
}
.route-pkg-toolbar__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted, #6b7280);
  line-height: 1.35;
  flex: 1 1 240px;
}
.route-pkg-detail {
  margin-top: 1rem;
}
.route-pkg-detail:empty { display: none; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.month-grid__day {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  min-height: 78px;
  cursor: pointer;
  font: inherit;
  color: var(--color-text, #111827);
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.month-grid__day:hover {
  border-color: var(--color-primary, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}
.month-grid__day strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.month-grid__day small {
  font-size: 0.72rem;
  color: var(--color-text-muted, #6b7280);
  line-height: 1.2;
}
.month-grid__day--active {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.06);
}
@media (max-width: 720px) {
  .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   PR-INSPECTION-01 — Section Engine UI
   ============================================================ */

.inspection-sections-card .ds-section-header {
  margin-bottom: 12px;
}

.inspection-sections__nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  margin-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.inspection-section-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  min-width: 132px;
  border: 1px solid var(--ds-color-border, #d6dbe0);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.inspection-section-chip:hover { border-color: #94a3b8; }
.inspection-section-chip:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}

.inspection-section-chip--active {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.inspection-section-chip__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ds-color-text, #111827);
}

.inspection-section-chip__status {
  margin-top: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ds-color-text-muted, #5b6470);
}

.inspection-section-chip--completed .inspection-section-chip__status { color: #047857; }
.inspection-section-chip--needs_attention .inspection-section-chip__status { color: #b45309; }
.inspection-section-chip--blocked .inspection-section-chip__status { color: #b91c1c; }
.inspection-section-chip--in_progress .inspection-section-chip__status { color: #2563eb; }

.inspection-section-card {
  border: 1px solid var(--ds-color-border, #e5e7eb);
  border-radius: 14px;
  padding: 16px;
  background: #fafbfc;
}

.inspection-section-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inspection-section-card__head h4 {
  margin: 0;
  font-size: 18px;
  color: var(--ds-color-text, #111827);
}

.inspection-section-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inspection-section-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.inspection-section-area {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--ds-color-border, #d6dbe0);
  background: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

.inspection-section-area--active {
  border-color: var(--color-primary, #2563eb);
  background: rgba(37, 99, 235, 0.08);
}

.inspection-section-area__chip {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.inspection-section-area__chip--good { background: #d1fae5; color: #047857; }
.inspection-section-area__chip--attention { background: #fef3c7; color: #b45309; }
.inspection-section-area__chip--bad { background: #fee2e2; color: #b91c1c; }
.inspection-section-area__chip--critical { background: #1f2937; color: #fef2f2; }

/* PR-INSPECTION-STAB-01b — Apple-style segmented condition control.
   The four GOOD / ATTENTION / BAD / CRITICAL options live inside a
   neutral container pill. Inactive segments are transparent; only the
   icon/label hints the meaning. The selected segment becomes a soft
   white pill with a subtle meaning-tinted ring + shadow — obvious but
   not aggressive. Touch targets stay at the iOS HIG minimum (44px+).
   No background red/green blocks; CRITICAL no longer renders as a
   dark slab — the meaning is carried by icon + label colour. */
.inspection-condition-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: #f1f3f6;
  border-radius: 12px;
}

.inspection-condition-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  min-height: 56px;
  font: inherit;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.inspection-condition-btn:hover:not(:disabled):not(.inspection-condition-btn--active) {
  background: rgba(255, 255, 255, 0.55);
}

.inspection-condition-btn:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}

.inspection-condition-btn:active:not(:disabled) { transform: scale(0.98); }

.inspection-condition-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.inspection-condition-btn__icon {
  font-size: 16px;
  line-height: 1;
  opacity: 0.78;
  transition: opacity 160ms ease, transform 160ms ease;
}

.inspection-condition-btn__label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.2;
}

/* Inactive segment — neutral surface, icon hints the meaning subtly. */
.inspection-condition-btn--good        .inspection-condition-btn__icon { color: #059669; }
.inspection-condition-btn--attention   .inspection-condition-btn__icon { color: #d97706; }
.inspection-condition-btn--bad         .inspection-condition-btn__icon { color: #dc2626; }
.inspection-condition-btn--critical    .inspection-condition-btn__icon { color: #b91c1c; }

/* Selected segment — soft white pill with meaning-tinted ring. The
   shadow is intentionally low so it never competes with the section
   chips or photo grid below. */
.inspection-condition-btn--active {
  background: #ffffff;
  color: #1f2937;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.inspection-condition-btn--active .inspection-condition-btn__icon {
  opacity: 1;
  transform: translateY(-0.5px);
}
.inspection-condition-btn--active .inspection-condition-btn__label {
  font-weight: 600;
}

.inspection-condition-btn--good.inspection-condition-btn--active {
  border-color: rgba(5, 150, 105, 0.35);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.14),
              0 1px 2px rgba(15, 23, 42, 0.08);
}
.inspection-condition-btn--attention.inspection-condition-btn--active {
  border-color: rgba(217, 119, 6, 0.4);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.16),
              0 1px 2px rgba(15, 23, 42, 0.08);
}
.inspection-condition-btn--bad.inspection-condition-btn--active {
  border-color: rgba(220, 38, 38, 0.4);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14),
              0 1px 2px rgba(15, 23, 42, 0.08);
}
.inspection-condition-btn--critical.inspection-condition-btn--active {
  border-color: rgba(185, 28, 28, 0.5);
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.18),
              0 1px 2px rgba(15, 23, 42, 0.08);
}

.inspection-requirement-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.inspection-requirement-badge--pass     { background: #d1fae5; color: #047857; }
.inspection-requirement-badge--review   { background: #fef3c7; color: #b45309; }
.inspection-requirement-badge--fail     { background: #fee2e2; color: #b91c1c; }
.inspection-requirement-badge--blocked  { background: #1f2937; color: #fef2f2; }

.inspection-section-findings {
  margin-top: 10px;
  padding: 10px;
  background: #fff7ed;
  border-radius: 8px;
  font-size: 13px;
}

.inspection-sections__summary {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #d6dbe0;
  border-radius: 14px;
  background: #ffffff;
}

.inspection-summary-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.inspection-summary-eligibility {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
}

.inspection-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.inspection-summary-table th,
.inspection-summary-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

@media (max-width: 540px) {
  /* Two-up at phone widths preserves the segmented look without
     squeezing the label past the icon. The container pill stays
     unified — the divider becomes a small inner gap. */
  .inspection-condition-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .inspection-condition-btn {
    min-height: 52px;
    padding: 9px 6px;
  }
  .inspection-section-chip { min-width: 110px; }
}

/* =====================================================================
   PR-INSPECTION-STAB-02 — Section workflow tablet UX + in-card photos
   ===================================================================== */

/* Default-template meta note: one-line internal breadcrumb between the
   sections header and the chip rail. Surfaces "Default inspection
   template applied" and the plan-eligible counts so the inspector
   knows what they're looking at. */
.inspection-sections__meta-note {
  margin: -4px 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f5f7fb;
  color: var(--ds-color-text-muted, #5b6470);
  font-size: 12.5px;
  line-height: 1.35;
}
.inspection-sections__meta-note:empty { display: none; }

/* New-area pill — distinct from the existing area tabs (dashed border
   and primary accent). The active state visually pairs with the
   condition row below so the inspector knows "I'm authoring a fresh
   area finding now." */
.inspection-section-area--new {
  border-style: dashed;
  color: var(--color-primary, #2563eb);
  font-weight: 500;
}
.inspection-section-area--new.inspection-section-area--active {
  background: rgba(37, 99, 235, 0.06);
  border-color: var(--color-primary, #2563eb);
  border-style: solid;
}

/* Per-section photo block — lives inside the section card. */
.inspection-section-photos {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e2e6ee;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inspection-section-photos__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.inspection-section-photos__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-section-photos__empty {
  margin: 0;
  padding: 8px 0;
  color: var(--ds-color-text-muted, #5b6470);
}
.inspection-section-photos__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.inspection-section-photo {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f3f6;
  position: relative;
  aspect-ratio: 1 / 1;
}
.inspection-section-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.inspection-section-photo--broken,
.inspection-photo--broken {
  background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 6px, #e5e7eb 6px, #e5e7eb 12px);
  min-height: 80px;
}
.inspection-section-photo figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspection-section-photos__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.inspection-section-photos__file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px dashed var(--ds-color-border, #cbd2da);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  background: #f9fafc;
  text-align: center;
  min-height: 44px;
}
.inspection-section-photos__file input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.inspection-section-photos__file--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* STAB-02D §1 — helper text that explains *why* photo upload is
   disabled when the inspector hasn't picked a condition yet. Sits
   right above the upload control so the relationship is obvious. */
.inspection-section-photos__condition-hint {
  margin: 4px 0 6px;
  font-size: 12px;
  color: var(--ds-color-text-secondary, #5a6473);
}
.inspection-section-photos__controls input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ds-color-border, #cbd2da);
  border-radius: 10px;
  font-size: 14px;
  min-height: 44px;
}

@media (max-width: 720px) {
  .inspection-section-photos__controls {
    grid-template-columns: 1fr;
  }
  .inspection-section-photos__controls .btn { width: 100%; }
}

/* When the section engine is active, the legacy global photo card is
   downgraded to a read-only gallery — the upload form lives inside
   each section card. */
.inspection-photos-card--gallery-only .inspection-photo-upload,
.inspection-photos-card--gallery-only #photo-upload-hint,
.inspection-photos-card--gallery-only .inspection-photo-requirements {
  display: none !important;
}

/* Tablet-first padding / spacing — the section card is the focal
   point on small landscape screens. */
@media (max-width: 1023px) {
  .inspection-section-card { padding: 14px; }
  .inspection-section-card__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .inspection-section-card__actions .btn {
    width: 100%;
    min-height: 48px;
  }
}

/* Section chips deserve a touch-friendly minimum at tablet widths
   even when the parent rail is narrow. */
@media (min-width: 768px) and (max-width: 1023px) {
  .inspection-sections__nav { gap: 10px; }
  .inspection-section-chip { min-width: 144px; padding: 12px 16px; }
}

/* (Sticky action-bar clearance lives at the canonical
   `.inspection-workspace .inspection-workspace__main` rule above and
   in the `max-width: 720px` media query — STAB-02 keeps that source
   as the single owner so the values don't drift.) */

