:root {
  --premium-bg: #f5f5f7;
  --premium-panel: rgba(255, 255, 255, 0.78);
  --premium-ink: #1d1d1f;
  --premium-muted: #6e6e73;
  --premium-line: rgba(29, 29, 31, 0.1);
  --premium-line-strong: rgba(29, 29, 31, 0.18);
  --premium-black: #1d1d1f;
  --premium-blue: #0071e3;
  --premium-green: #248a3d;
  --premium-amber: #a15c00;
  --premium-red: #d70015;
  --premium-radius-lg: 16px;
  --premium-radius-md: 12px;
  --premium-shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
  --premium-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 36px rgba(0, 0, 0, 0.055);
}

body.visual-enhanced.session-authenticated {
  color: var(--premium-ink);
  background: linear-gradient(180deg, #fbfbfd 0%, var(--premium-bg) 54%, #f0f1f3 100%);
  font-feature-settings: "kern";
}

body.visual-enhanced.session-authenticated .topbar::before,
body.visual-enhanced.session-authenticated .topbar::after,
body.visual-enhanced.session-authenticated .page-panel::before,
body.visual-enhanced.session-authenticated #workspaceNavSection::before,
body.visual-enhanced.session-authenticated #source-banner::after,
body.visual-enhanced.session-authenticated .quick-action-dock::before {
  display: none;
}

body.visual-enhanced .topbar {
  border-color: var(--premium-line);
  background: rgba(251, 251, 253, 0.72);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(28px) saturate(1.3);
}

body.visual-enhanced .workspace,
body.visual-enhanced .quick-action-dock,
body.visual-enhanced .premium-system-strip {
  width: auto;
  max-width: calc(100% - var(--shell-left) - var(--shell-right));
  margin-left: var(--shell-left);
  margin-right: var(--shell-right);
}

body.visual-enhanced.session-authenticated .page-panel,
body.visual-enhanced.session-authenticated #workspaceNavSection {
  width: 100%;
  max-width: 100%;
}

body.visual-enhanced .brand-block,
body.visual-enhanced .brand-meta-strip,
body.visual-enhanced .session-mini-card,
body.visual-enhanced .language-switcher,
body.visual-enhanced .global-search-shell,
body.visual-enhanced .shell-status-details,
body.visual-enhanced .quick-action-dock,
body.visual-enhanced.session-authenticated #workspaceNavSection,
body.visual-enhanced.session-authenticated .page-panel,
body.visual-enhanced .source-banner,
body.visual-enhanced .task-board,
body.visual-enhanced .ops-card,
body.visual-enhanced .kpi-card,
body.visual-enhanced .dashboard-connection-card,
body.visual-enhanced .delivery-section,
body.visual-enhanced label.field,
body.visual-enhanced .module-table-shell,
body.visual-enhanced .table-shell {
  border-color: var(--premium-line);
  border-radius: var(--premium-radius-lg);
  background: var(--premium-panel);
  box-shadow: var(--premium-shadow-soft);
  backdrop-filter: blur(24px) saturate(1.18);
}

body.visual-enhanced .brand-block {
  min-height: 74px;
  max-width: 248px;
  padding: 8px 12px;
}

body.visual-enhanced .brand-logo-shell {
  height: 52px;
}

body.visual-enhanced .brand-logo {
  max-height: 48px;
}

body.visual-enhanced .quick-action-dock {
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, 1.2fr) minmax(240px, 0.92fr);
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(28px) saturate(1.25);
}

body.visual-enhanced .quick-action-kicker,
body.visual-enhanced .source-banner-kicker,
body.visual-enhanced .section-kicker,
body.visual-enhanced .field span,
body.visual-enhanced .ops-card small,
body.visual-enhanced .kpi-card small,
body.visual-enhanced .premium-system-card small {
  color: var(--premium-muted);
  letter-spacing: 0;
}

body.visual-enhanced .quick-action-label,
body.visual-enhanced .brand-title,
body.visual-enhanced .source-banner-title,
body.visual-enhanced .dashboard-header h2,
body.visual-enhanced .clients-header h2,
body.visual-enhanced .ops-card strong,
body.visual-enhanced .kpi-card strong,
body.visual-enhanced .dashboard-connection-card h3,
body.visual-enhanced .task-board-head h3 {
  color: var(--premium-ink);
  letter-spacing: 0;
}

body.visual-enhanced button,
body.visual-enhanced button.secondary,
body.visual-enhanced .quick-more-actions summary {
  border: 1px solid var(--premium-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--premium-ink);
  box-shadow: none;
  font-weight: 700;
}

body.visual-enhanced button:hover,
body.visual-enhanced button.secondary:hover,
body.visual-enhanced .quick-more-actions summary:hover {
  border-color: var(--premium-line-strong);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

body.visual-enhanced button:not(.secondary),
body.visual-enhanced button.secondary.is-active,
body.visual-enhanced .page-nav > button.is-active {
  border-color: var(--premium-black);
  background: var(--premium-black);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

body.visual-enhanced input:not([type]),
body.visual-enhanced input[type="text"],
body.visual-enhanced input[type="search"],
body.visual-enhanced input[type="email"],
body.visual-enhanced input[type="password"],
body.visual-enhanced input[type="number"],
body.visual-enhanced input[type="date"],
body.visual-enhanced input[type="time"],
body.visual-enhanced input[type="tel"],
body.visual-enhanced input[type="url"],
body.visual-enhanced input[type="datetime-local"],
body.visual-enhanced textarea,
body.visual-enhanced select {
  border-color: var(--premium-line);
  border-radius: var(--premium-radius-md);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
  color: var(--premium-ink);
  letter-spacing: 0;
}

body.visual-enhanced input:focus,
body.visual-enhanced textarea:focus,
body.visual-enhanced select:focus {
  border-color: var(--premium-blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}

.premium-system-strip {
  width: calc(100vw - var(--shell-left) - var(--shell-right));
  margin: 10px var(--shell-right) 0 var(--shell-left);
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(240px, 1.4fr);
  gap: 10px;
}

body.session-guest .premium-system-strip {
  display: none;
}

body.visual-enhanced.session-authenticated .premium-system-strip[data-visibility="quiet"],
body.visual-enhanced.session-authenticated #source-banner[data-visibility="quiet"] {
  display: none;
}

.premium-system-card {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 6px 10px;
  padding: 12px 14px;
  border: 1px solid var(--premium-line);
  border-radius: var(--premium-radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--premium-shadow-soft);
}

.premium-system-card small,
.premium-system-card strong {
  grid-column: 1;
}

.premium-system-card small {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.premium-system-card strong {
  color: var(--premium-ink);
  font-size: 1.08rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.premium-system-card::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #98a2b3;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.premium-system-card[data-state="ok"]::before {
  background: var(--premium-green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
}

.premium-system-card[data-state="warn"]::before {
  background: var(--premium-amber);
  box-shadow: 0 0 0 5px rgba(183, 121, 31, 0.12);
}

.premium-system-card[data-state="error"]::before {
  background: var(--premium-red);
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.12);
}

body.visual-enhanced .source-banner {
  min-height: 76px;
  display: grid;
  align-content: center;
  border-left: 4px solid var(--premium-blue);
}

body.visual-enhanced .source-banner-desktop {
  color: var(--premium-ink);
  border-left-color: var(--premium-green);
  background: #ffffff;
}

body.visual-enhanced .source-banner-error {
  color: var(--premium-ink);
  border-left-color: var(--premium-red);
  background: #fffafa;
}

body.visual-enhanced .source-banner-title {
  font-size: clamp(1.2rem, 1.9vw, 1.85rem);
}

body.visual-enhanced .source-banner-detail {
  color: var(--premium-muted);
}

body.visual-enhanced .dashboard-header,
body.visual-enhanced .clients-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--premium-line);
}

body.visual-enhanced .dashboard-header h2,
body.visual-enhanced .clients-header h2 {
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  line-height: 1.05;
}

body.visual-enhanced .dashboard-ops-home {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: none;
}

body.visual-enhanced .dashboard-ops-home .dashboard-ops-card {
  grid-area: auto;
}

body.visual-enhanced .dashboard-ops-card {
  min-height: 132px;
  border-top: 0;
}

body.visual-enhanced .dashboard-ops-card.danger {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
}

body.visual-enhanced .dashboard-ops-card.warning {
  background: linear-gradient(180deg, #ffffff 0%, #fff9f0 100%);
}

body.visual-enhanced .dashboard-ops-card.success {
  background: linear-gradient(180deg, #ffffff 0%, #f5fbf6 100%);
}

body.visual-enhanced .dashboard-ops-card.info {
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
}

body.visual-enhanced .dashboard-ops-card strong {
  font-size: 2rem;
  font-weight: 800;
}

body.visual-enhanced .kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

body.visual-enhanced .kpi-grid .kpi-card:nth-child(1),
body.visual-enhanced .kpi-grid .kpi-card:nth-child(5) {
  grid-column: span 1;
}

body.visual-enhanced .kpi-card {
  min-height: 96px;
  display: grid;
  align-content: center;
  border-top: 0;
}

body.visual-enhanced .dashboard-connection-card {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  background: #1d1d1f;
  color: #ffffff;
}

body.visual-enhanced .dashboard-connection-card h3,
body.visual-enhanced .dashboard-connection-card .section-kicker,
body.visual-enhanced .dashboard-connection-score strong {
  color: #ffffff;
}

body.visual-enhanced .dashboard-connection-card p,
body.visual-enhanced .dashboard-connection-score span {
  color: rgba(255, 255, 255, 0.72);
}

body.visual-enhanced .dashboard-connection-score {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

body.visual-enhanced .dashboard-connection-card button.secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: #ffffff;
  color: #1d1d1f;
}

body.visual-enhanced .delivery-overview-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.delivery-confirmation-chain {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.delivery-confirmation-chain article {
  position: relative;
  min-height: 78px;
  padding: 12px 13px;
  border: 1px solid var(--premium-line);
  border-radius: var(--premium-radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--premium-shadow-soft);
}

.delivery-confirmation-chain article::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #98a2b3;
}

.delivery-confirmation-chain article[data-state="ok"]::before {
  background: var(--premium-green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
}

.delivery-confirmation-chain article[data-state="warn"]::before {
  background: var(--premium-amber);
  box-shadow: 0 0 0 5px rgba(183, 121, 31, 0.12);
}

.delivery-confirmation-chain small {
  color: var(--premium-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.delivery-confirmation-chain strong {
  display: block;
  margin-top: 5px;
  color: var(--premium-ink);
  font-size: 1rem;
}

.delivery-confirmation-chain span {
  display: block;
  margin-top: 4px;
  color: var(--premium-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

body.visual-enhanced .dossier-card {
  border: 1px solid var(--premium-line);
  border-radius: var(--premium-radius-lg);
  background: #ffffff;
  box-shadow: var(--premium-shadow-soft);
}

body.visual-enhanced .delivery-section {
  padding: 18px;
}

body.visual-enhanced .delivery-section:first-of-type {
  border-top: 3px solid var(--premium-blue);
}

body.visual-enhanced .delivery-section:nth-of-type(2) {
  border-top: 3px solid var(--premium-black);
}

body.visual-enhanced .signature-pad {
  border: 1px solid var(--premium-line-strong);
  border-radius: var(--premium-radius-md);
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  background-size: 24px 100%, auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.visual-enhanced .module-table-shell thead th,
body.visual-enhanced .table-shell thead th {
  background: #f6f7f9;
  color: #475467;
}

body.visual-enhanced .module-table-shell tbody tr:hover,
body.visual-enhanced .table-shell tbody tr:hover {
  background: #f9fafb;
}

body.visual-enhanced .module-launcher-sheet {
  z-index: 5200;
}

body.visual-enhanced .module-launcher-backdrop {
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(17, 24, 39, 0.38) !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px);
}

body.visual-enhanced .module-launcher-panel {
  border-color: var(--premium-line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(34px) saturate(1.2);
}

body.visual-enhanced .module-launcher-head strong {
  color: var(--premium-ink);
  letter-spacing: 0;
}

body.visual-enhanced .module-launcher-item,
body.visual-enhanced .module-launcher-recent-chip {
  border-color: var(--premium-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84) !important;
  color: var(--premium-ink) !important;
  box-shadow: var(--premium-shadow-soft);
}

body.visual-enhanced .module-launcher-item.is-active,
body.visual-enhanced .module-launcher-recent-chip.is-active {
  border-color: var(--premium-black);
  background: #f9fafb !important;
  color: var(--premium-ink) !important;
}

body.visual-enhanced .module-launcher-badge {
  background: #f2f2f7;
  color: var(--premium-ink);
}

body.visual-enhanced .module-launcher-copy strong {
  color: var(--premium-ink);
}

body.visual-enhanced .module-launcher-copy small {
  color: var(--premium-muted);
}

body.visual-enhanced .module-launcher-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

body.visual-enhanced .module-launcher-recent-chip span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--premium-ink);
  font-size: 0.68rem;
  font-weight: 900;
}

body.visual-enhanced .module-launcher-recent-chip strong {
  color: var(--premium-ink);
  font-size: 0.82rem;
}

@media (max-width: 1180px) {
  .premium-system-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.visual-enhanced .dashboard-ops-home,
  body.visual-enhanced .kpi-grid,
  body.visual-enhanced .delivery-overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .premium-system-strip {
    width: calc(100vw - 24px);
    margin: 8px 12px 0;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .premium-system-card {
    min-height: 64px;
    padding: 10px 11px;
  }

  .premium-system-card-wide {
    grid-column: 1 / -1;
  }

  body.visual-enhanced .quick-action-dock {
    grid-template-columns: 1fr;
  }

  body.visual-enhanced .dashboard-ops-home,
  body.visual-enhanced .kpi-grid,
  body.visual-enhanced .delivery-overview-strip,
  body.visual-enhanced .delivery-confirmation-chain,
  body.visual-enhanced .delivery-pickers-grid,
  body.visual-enhanced .delivery-form-grid,
  body.visual-enhanced .delivery-email-grid {
    grid-template-columns: 1fr;
  }

  body.visual-enhanced .dashboard-connection-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body.visual-enhanced.session-authenticated .workspace {
    margin-top: 8px;
  }

  body.visual-enhanced.session-authenticated #workspaceNavSection {
    left: 8px;
    right: 8px;
    padding: 8px;
    border-radius: 22px 22px 0 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -18px 40px rgba(15, 23, 42, 0.14);
  }

  body.visual-enhanced .page-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  body.visual-enhanced.role-limited .page-nav > button[data-page-target]:not([data-page-target="ops_hub"]):not([data-page-target="visits"]):not([data-page-target="deliveries"]) {
    display: none;
  }

  body.visual-enhanced .page-nav > button {
    min-height: 44px;
    border-radius: 999px;
    font-size: 0.78rem;
  }

  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    min-height: 48px;
    border-color: var(--premium-line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--premium-ink);
  }

  body.visual-enhanced .module-launcher-sheet {
    align-items: end;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  body.visual-enhanced .module-launcher-panel {
    width: 100%;
    max-height: min(760px, calc(100dvh - 20px));
    padding: 10px;
    border-radius: 24px 24px 18px 18px;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
  }

  body.visual-enhanced .module-launcher-head {
    padding: 4px 2px 0;
  }

  body.visual-enhanced .module-launcher-close {
    min-height: 38px;
    border-radius: 999px;
  }

  body.visual-enhanced .module-launcher-search {
    min-height: 48px;
    border-radius: 16px;
    font-size: 1rem;
  }

  body.visual-enhanced .module-launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 2px 2px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  body.visual-enhanced .module-launcher-item {
    min-height: 104px;
    grid-template-columns: 1fr;
    justify-items: start;
    align-content: start;
    gap: 8px;
    padding: 12px;
  }

  body.visual-enhanced .module-launcher-badge {
    width: 38px;
    height: 38px;
  }

  body.visual-enhanced .module-launcher-copy strong {
    white-space: normal;
    line-height: 1.12;
  }

  body.visual-enhanced .module-launcher-copy small {
    -webkit-line-clamp: 2;
  }

  body.visual-enhanced .module-launcher-recent-list {
    gap: 8px;
    padding-bottom: 4px;
  }

  body.visual-enhanced .module-launcher-recent-chip {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 999px;
  }
}

@media (max-width: 340px) {
  body.visual-enhanced .module-launcher-grid {
    grid-template-columns: 1fr;
  }
}

/* Apple-style second pass: quieter chrome, fewer visible instructions, calmer density. */
body.visual-enhanced.session-authenticated {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

body.visual-enhanced.session-authenticated .topbar {
  min-height: 64px;
}

body.visual-enhanced .brand-block {
  min-height: 58px;
  max-width: 212px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

body.visual-enhanced .brand-logo-shell {
  height: 44px;
}

body.visual-enhanced .brand-logo {
  max-height: 40px;
}

body.visual-enhanced .quick-action-dock {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 9px 11px;
}

body.visual-enhanced .quick-action-meta,
body.visual-enhanced #pageGuideBar {
  display: none !important;
}

body.visual-enhanced .quick-action-summary {
  min-width: 0;
}

body.visual-enhanced .quick-action-label {
  font-size: 1rem;
  line-height: 1.15;
}

body.visual-enhanced .quick-action-hint {
  max-width: 46rem;
  color: var(--premium-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.visual-enhanced .quick-action-group {
  gap: 7px;
}

body.visual-enhanced .quick-action-dock button,
body.visual-enhanced .quick-more-actions summary {
  min-height: 36px;
  padding: 8px 13px;
  font-size: 0.84rem;
}

body.visual-enhanced.session-authenticated #workspaceNavSection {
  padding: 9px;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 20px;
}

body.visual-enhanced .page-nav {
  gap: 7px;
  align-items: center;
}

body.visual-enhanced .page-nav > button,
body.visual-enhanced .page-nav > .nav-module-launcher-button {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  background: transparent;
  font-size: 0.84rem;
  font-weight: 700;
}

body.visual-enhanced .page-nav > button:not(.is-active):hover,
body.visual-enhanced .page-nav > .nav-module-launcher-button:hover {
  background: rgba(255, 255, 255, 0.72);
}

body.visual-enhanced.session-authenticated .page-panel {
  padding-top: 20px;
}

body.visual-enhanced .dashboard-header,
body.visual-enhanced .clients-header {
  align-items: center;
  padding-bottom: 10px;
}

body.visual-enhanced .dashboard-header h2,
body.visual-enhanced .clients-header h2 {
  font-size: clamp(1.55rem, 2vw, 2rem);
  font-weight: 800;
}

body.visual-enhanced .dashboard-ops-home {
  gap: 12px;
}

body.visual-enhanced .dashboard-ops-card,
body.visual-enhanced .kpi-card {
  padding: 15px;
  border-radius: 18px;
}

body.visual-enhanced .dashboard-ops-card button {
  align-self: end;
}

body.visual-enhanced .dashboard-ops-card small,
body.visual-enhanced .kpi-card small {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: none;
}

body.visual-enhanced .dashboard-ops-card strong,
body.visual-enhanced .kpi-card strong {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

body.visual-enhanced .task-board,
body.visual-enhanced .table-shell,
body.visual-enhanced .module-table-shell {
  border-radius: 18px;
  overflow: hidden;
}

body.visual-enhanced .table-shell thead th,
body.visual-enhanced .module-table-shell thead th {
  background: rgba(245, 245, 247, 0.92);
  color: var(--premium-muted);
  font-size: 0.74rem;
  font-weight: 800;
}

body.visual-enhanced .delivery-confirmation-chain {
  gap: 8px;
}

body.visual-enhanced .delivery-confirmation-chain article {
  border-radius: 16px;
  min-height: 72px;
  padding: 11px 12px;
}

body.visual-enhanced .delivery-confirmation-chain strong {
  font-size: 0.94rem;
}

body.visual-enhanced .module-launcher-panel {
  max-width: 920px;
}

body.visual-enhanced .module-launcher-search {
  background: rgba(242, 242, 247, 0.96);
  border-color: transparent;
}

body.visual-enhanced .module-launcher-item {
  min-height: 86px;
}

@media (max-width: 760px) {
  body.visual-enhanced.session-authenticated .topbar {
    min-height: 56px;
  }

  body.visual-enhanced .quick-action-dock {
    grid-template-columns: 1fr;
    margin-top: 8px;
  }

  body.visual-enhanced .quick-action-center {
    width: 100%;
  }

  body.visual-enhanced .quick-action-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  body.visual-enhanced .quick-action-group > button,
  body.visual-enhanced .quick-action-group > details {
    min-width: 0;
  }

  body.visual-enhanced .quick-action-dock button,
  body.visual-enhanced .quick-more-actions summary {
    width: 100%;
    min-height: 42px;
    padding: 9px 8px;
  }

  body.visual-enhanced .dashboard-ops-home,
  body.visual-enhanced .kpi-grid {
    gap: 10px;
  }

  body.visual-enhanced .dashboard-ops-card,
  body.visual-enhanced .kpi-card {
    min-height: 92px;
  }
}

@media (max-width: 560px) {
  body.visual-enhanced.session-authenticated .workspace {
    margin-top: 6px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }

  body.visual-enhanced.session-authenticated #workspaceNavSection {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(30px) saturate(1.24);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
  }

  body.visual-enhanced .page-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  body.visual-enhanced .page-nav > button,
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    min-height: 44px;
    padding: 7px 6px;
    font-size: 0.73rem;
  }

  body.visual-enhanced.role-limited .page-nav > button[data-page-target="deliveries"],
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    display: inline-flex;
  }

  body.visual-enhanced .module-launcher-sheet {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  body.visual-enhanced .module-launcher-panel {
    max-height: min(760px, calc(100dvh - 16px));
    padding: 12px;
    border-radius: 28px;
  }

  body.visual-enhanced .module-launcher-grid {
    gap: 8px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  body.visual-enhanced .module-launcher-item {
    min-height: 96px;
    border-radius: 18px;
  }
}

/* Login polish: the first screen should feel as calm as the app shell. */
body.visual-enhanced.session-guest {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0) 32%),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 58%, #eeeeef 100%) !important;
  color: var(--premium-ink);
}

body.visual-enhanced.session-guest .login-shell {
  width: min(456px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
  border: 1px solid var(--premium-line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--premium-ink);
  box-shadow: var(--premium-shadow-soft);
  backdrop-filter: blur(28px) saturate(1.18);
}

body.visual-enhanced.session-guest .login-shell *,
body.visual-enhanced.session-guest .login-message,
body.visual-enhanced.session-guest .login-user-strip,
body.visual-enhanced.session-guest .login-user-strip-list,
body.visual-enhanced.session-guest .login-user-chip {
  box-sizing: border-box;
  max-width: 100%;
}

body.visual-enhanced.session-guest .login-shell::before,
body.visual-enhanced.session-guest .login-shell::after {
  display: none;
}

body.visual-enhanced.session-guest .login-shell-brand {
  justify-items: center;
  text-align: center;
}

body.visual-enhanced.session-guest .login-shell-logo-frame {
  width: min(100%, 238px);
  height: 74px;
  margin: 0 auto 4px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.visual-enhanced.session-guest .login-shell-logo {
  max-height: 66px;
}

body.visual-enhanced.session-guest .login-shell-kicker {
  color: var(--premium-blue);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}

body.visual-enhanced.session-guest .login-shell-copy h3 {
  color: var(--premium-ink);
  font-size: clamp(1.85rem, 5vw, 2.25rem);
  letter-spacing: 0;
}

body.visual-enhanced.session-guest .login-shell-runtime small,
body.visual-enhanced.session-guest .login-shell .muted {
  color: var(--premium-muted);
}

body.visual-enhanced.session-guest .language-switcher,
body.visual-enhanced.session-guest .login-user-field,
body.visual-enhanced.session-guest .login-user-strip,
body.visual-enhanced.session-guest .login-status-strip {
  border-color: var(--premium-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

body.visual-enhanced.session-guest .login-message {
  border-color: transparent;
  border-radius: 16px;
  background: rgba(0, 113, 227, 0.08);
  color: #0057b8;
}

body.visual-enhanced.session-guest .login-message.error {
  background: rgba(215, 0, 21, 0.08);
  color: var(--premium-red);
}

body.visual-enhanced.session-guest .login-user-field input,
body.visual-enhanced.session-guest #pin {
  min-height: 50px;
  border-color: transparent;
  border-radius: 16px;
  background: rgba(242, 242, 247, 0.94);
  color: var(--premium-ink);
  font-weight: 600;
}

body.visual-enhanced.session-guest .login-user-strip-head strong,
body.visual-enhanced.session-guest .login-user-field > span {
  color: var(--premium-ink);
  letter-spacing: 0;
}

body.visual-enhanced.session-guest .login-user-strip-head small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.visual-enhanced.session-guest .login-user-chip {
  border-color: var(--premium-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--premium-ink);
  box-shadow: none;
}

body.visual-enhanced.session-guest .login-user-chip:hover,
body.visual-enhanced.session-guest .login-user-chip:focus-visible {
  background: #ffffff;
  border-color: var(--premium-line-strong);
}

body.visual-enhanced.session-guest .login-user-chip strong {
  color: var(--premium-ink);
}

body.visual-enhanced.session-guest .login-user-chip small {
  color: var(--premium-muted);
}

body.visual-enhanced.session-guest .login-user-chip.is-active {
  border-color: var(--premium-black);
  background: var(--premium-black);
  color: #ffffff;
}

body.visual-enhanced.session-guest .login-user-chip.is-active strong,
body.visual-enhanced.session-guest .login-user-chip.is-active small {
  color: #ffffff;
}

body.visual-enhanced.session-guest #login-button.login-primary {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--premium-blue);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.22);
}

body.visual-enhanced.session-guest #login-button.login-primary:hover {
  background: #0077ed;
}

body.visual-enhanced.session-guest .login-status-strip {
  display: none;
}

@media (max-width: 560px) {
  body.visual-enhanced.session-guest .login-shell {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    margin: 12px auto;
    padding: 14px;
    border-radius: 24px;
  }

  body.visual-enhanced.session-guest .login-user-strip-list {
    max-height: 220px;
  }

  body.visual-enhanced.session-guest .login-user-strip-head small {
    display: none;
  }
}

/* Final mobile module pass: predictable bottom nav and cleaner module sheet. */
@media (max-width: 560px) {
  body.visual-enhanced.session-authenticated .workspace {
    padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.visual-enhanced.session-authenticated #workspaceNavSection {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    margin: 0 !important;
    padding: 8px !important;
    border-radius: 24px !important;
    background: rgba(255, 255, 255, 0.82) !important;
    border-color: rgba(29, 29, 31, 0.1) !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16) !important;
    backdrop-filter: blur(32px) saturate(1.25);
  }

  body.visual-enhanced .page-nav {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding: 0 !important;
  }

  body.visual-enhanced .page-nav > button {
    display: none !important;
  }

  body.visual-enhanced .page-nav > button[data-page-target="ops_hub"],
  body.visual-enhanced .page-nav > button[data-page-target="visits"],
  body.visual-enhanced .page-nav > button[data-page-target="deliveries"],
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    display: inline-flex !important;
  }

  body.visual-enhanced .page-nav > button,
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    width: 100%;
    min-width: 0;
    min-height: 46px !important;
    padding: 7px 5px !important;
    border-radius: 18px !important;
    border-color: transparent !important;
    background: transparent !important;
    color: var(--premium-muted) !important;
    box-shadow: none !important;
    font-size: 0.72rem !important;
    line-height: 1.05;
  }

  body.visual-enhanced .page-nav > button.is-active {
    background: var(--premium-black) !important;
    color: #ffffff !important;
  }

  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    background: rgba(242, 242, 247, 0.9) !important;
    color: var(--premium-ink) !important;
  }

  body.visual-enhanced .page-nav > .nav-module-launcher-button::before {
    display: none !important;
  }

  body.visual-enhanced .page-nav .nav-icon {
    display: none !important;
  }

  body.visual-enhanced .page-nav .nav-label-mobile,
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.visual-enhanced .page-nav .nav-label-full {
    display: none !important;
  }

  body.visual-enhanced .page-nav .nav-jump {
    display: none !important;
  }

  body.visual-enhanced .module-launcher-backdrop {
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(18px) saturate(1.1);
  }

  body.visual-enhanced .module-launcher-panel {
    width: 100% !important;
    max-height: min(780px, calc(100dvh - 16px)) !important;
    padding: 12px !important;
    border-radius: 30px !important;
    background: rgba(255, 255, 255, 0.9) !important;
  }

  body.visual-enhanced .module-launcher-handle {
    width: 38px;
    height: 4px;
    margin-bottom: 12px;
    background: rgba(29, 29, 31, 0.18);
  }

  body.visual-enhanced .module-launcher-head {
    margin-bottom: 8px;
  }

  body.visual-enhanced .module-launcher-head small {
    display: none;
  }

  body.visual-enhanced .module-launcher-head strong {
    font-size: 1.15rem;
    font-weight: 800;
  }

  body.visual-enhanced .module-launcher-close {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(242, 242, 247, 0.96) !important;
  }

  body.visual-enhanced .module-launcher-recent {
    margin-bottom: 8px;
  }

  body.visual-enhanced .module-launcher-recent small {
    display: none;
  }

  body.visual-enhanced .module-launcher-search {
    min-height: 46px;
    margin-bottom: 10px;
    border-radius: 16px;
    background: rgba(242, 242, 247, 0.96);
  }

  body.visual-enhanced .module-launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  body.visual-enhanced .module-launcher-item {
    min-height: 104px !important;
    grid-template-columns: 1fr !important;
    align-content: start;
    justify-items: start;
    gap: 9px;
    padding: 12px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.94) !important;
  }

  body.visual-enhanced .module-launcher-badge {
    width: 36px !important;
    height: 36px !important;
    background: rgba(242, 242, 247, 0.96);
    color: var(--premium-ink);
  }

  body.visual-enhanced .module-launcher-copy strong {
    max-width: 100%;
    font-size: 0.88rem;
    line-height: 1.12;
    white-space: normal !important;
  }

  body.visual-enhanced .module-launcher-copy small {
    margin-top: 4px;
    color: var(--premium-muted);
    font-size: 0.72rem;
    -webkit-line-clamp: 1;
  }
}

/* Mobile form/table pass: iOS-like touch targets and quieter dense data. */
@media (max-width: 760px) {
  body.visual-enhanced.session-authenticated .page-panel {
    padding: 14px 12px 18px !important;
    border-radius: 22px !important;
  }

  body.visual-enhanced .clients-header,
  body.visual-enhanced .dashboard-header,
  body.visual-enhanced .panel-title-row,
  body.visual-enhanced .task-board-head {
    gap: 10px;
  }

  body.visual-enhanced .toolbar {
    gap: 8px;
  }

  body.visual-enhanced .toolbar > button,
  body.visual-enhanced .settings-actions button,
  body.visual-enhanced .finance-actions button,
  body.visual-enhanced .crm-entry-actions button,
  body.visual-enhanced .delivery-inline-toolbar button {
    min-height: 42px;
    border-radius: 14px;
  }

  body.visual-enhanced label.field,
  body.visual-enhanced .field {
    border-radius: 18px !important;
    padding: 12px !important;
    background: rgba(255, 255, 255, 0.82) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035) !important;
  }

  body.visual-enhanced .field span,
  body.visual-enhanced label.field span {
    color: var(--premium-muted) !important;
    font-size: 0.72rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body.visual-enhanced .field input,
  body.visual-enhanced .field select,
  body.visual-enhanced .field textarea,
  body.visual-enhanced label.field input,
  body.visual-enhanced label.field select,
  body.visual-enhanced label.field textarea {
    min-height: 48px !important;
    border-color: transparent !important;
    border-radius: 16px !important;
    background: rgba(242, 242, 247, 0.94) !important;
    font-size: 1rem !important;
  }

  body.visual-enhanced .field textarea,
  body.visual-enhanced label.field textarea {
    min-height: 96px !important;
  }

  body.visual-enhanced .delivery-pickers-grid,
  body.visual-enhanced .delivery-form-grid,
  body.visual-enhanced .delivery-email-grid,
  body.visual-enhanced .settings-grid-2,
  body.visual-enhanced .settings-hardening-grid {
    gap: 10px !important;
  }

  body.visual-enhanced .delivery-section {
    padding: 14px !important;
    border-radius: 20px !important;
    border-top: 0 !important;
  }

  body.visual-enhanced .delivery-confirmation-chain {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.visual-enhanced .delivery-confirmation-chain article {
    min-height: 82px !important;
    padding: 11px !important;
  }

  body.visual-enhanced .delivery-confirmation-chain span {
    display: none;
  }

  body.visual-enhanced .delivery-confirmation-chain article::before {
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
  }

  body.visual-enhanced .delivery-overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.visual-enhanced .module-table-shell,
  body.visual-enhanced .table-shell {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  body.visual-enhanced .module-table-shell tbody tr,
  body.visual-enhanced .table-shell tbody tr {
    border: 1px solid var(--premium-line) !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.82) !important;
    box-shadow: var(--premium-shadow-soft) !important;
  }

  body.visual-enhanced .module-table-shell tbody td,
  body.visual-enhanced .table-shell tbody td {
    padding: 10px 12px !important;
    color: var(--premium-ink) !important;
  }

  body.visual-enhanced .module-table-shell tbody td[data-label]:not([data-label=""])::before,
  body.visual-enhanced .table-shell tbody td[data-label]:not([data-label=""])::before {
    color: var(--premium-muted) !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body.visual-enhanced .table-primary strong {
    color: var(--premium-ink) !important;
  }

  body.visual-enhanced .table-primary small,
  body.visual-enhanced .table-muted,
  body.visual-enhanced .table-summary {
    color: var(--premium-muted) !important;
  }
}

/* Mobile header polish: keep the authenticated shell closer to an iOS app bar. */
@media (max-width: 560px) {
  body.visual-enhanced.session-authenticated .topbar {
    min-height: auto !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px !important;
    gap: 7px !important;
    align-items: center !important;
    background: rgba(251, 251, 253, 0.84) !important;
  }

  body.visual-enhanced.session-authenticated .brand-block {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    min-height: 42px !important;
    padding: 5px !important;
    border-radius: 15px !important;
    box-shadow: none !important;
  }

  body.visual-enhanced.session-authenticated .brand-logo-shell {
    width: 38px !important;
    height: 32px !important;
  }

  body.visual-enhanced.session-authenticated .brand-logo {
    max-width: 38px !important;
    max-height: 30px !important;
    object-fit: contain !important;
  }

  body.visual-enhanced.session-authenticated .top-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 48px 46px;
    gap: 6px !important;
    align-items: center !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  body.visual-enhanced.session-authenticated .work-clock,
  body.visual-enhanced.session-authenticated #syncConnectivityPill,
  body.visual-enhanced.session-authenticated #syncControlCenter,
  body.visual-enhanced.session-authenticated #btnCommandPalette {
    display: none !important;
  }

  body.visual-enhanced.session-authenticated .language-switcher {
    grid-column: 2;
    grid-row: 1;
    width: 48px !important;
    min-width: 48px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    background: rgba(242, 242, 247, 0.94) !important;
  }

  body.visual-enhanced.session-authenticated .language-switcher label {
    display: none !important;
  }

  body.visual-enhanced.session-authenticated .language-switcher select {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 8px !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    text-align: center !important;
  }

  body.visual-enhanced.session-authenticated .global-search-shell {
    grid-column: 1;
    grid-row: 1;
    min-width: 0 !important;
    width: 100% !important;
    min-height: 36px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    background: rgba(242, 242, 247, 0.96) !important;
  }

  body.visual-enhanced.session-authenticated .global-search-shell label {
    display: none !important;
  }

  body.visual-enhanced.session-authenticated .global-search-control {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 4px !important;
    align-items: center !important;
    height: 36px !important;
  }

  body.visual-enhanced.session-authenticated #globalSearchInput {
    min-width: 0 !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 8px 0 13px !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 0.86rem !important;
    line-height: 1 !important;
  }

  body.visual-enhanced.session-authenticated #globalSearchGo {
    width: 34px !important;
    min-width: 34px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    font-size: 0.72rem !important;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails {
    display: none !important;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails summary {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    color: transparent !important;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails summary::before {
    content: "i";
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--premium-black);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 800;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails[open] {
    position: absolute !important;
    right: 10px;
    top: calc(54px + env(safe-area-inset-top, 0px));
    z-index: 40;
    width: min(310px, calc(100vw - 20px)) !important;
    height: auto !important;
    padding: 10px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18) !important;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails[open] summary {
    width: 100% !important;
    justify-content: start !important;
    color: var(--premium-ink) !important;
    font-size: 0.82rem !important;
    font-weight: 800 !important;
  }

  body.visual-enhanced.session-authenticated #shellStatusDetails[open] summary::before {
    margin-right: 8px;
  }

  body.visual-enhanced.session-authenticated #logout-button {
    grid-column: 3;
    grid-row: 1;
    justify-self: stretch;
    width: 46px !important;
    min-width: 46px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    font-size: 0 !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.68) !important;
    box-shadow: none !important;
  }

  body.visual-enhanced.session-authenticated #logout-button::before {
    content: "Salir";
    font-size: 0.68rem;
    font-weight: 800;
  }

  body.visual-enhanced.session-authenticated .global-search-results {
    left: 0 !important;
    right: 0 !important;
    top: 42px !important;
    border-radius: 18px !important;
  }
}

@media (max-width: 560px) {
  body.visual-enhanced .delivery-inline-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  body.visual-enhanced .delivery-inline-toolbar button {
    width: 100%;
  }

  body.visual-enhanced .signature-pad {
    min-height: 160px;
    border-radius: 18px;
  }

  body.visual-enhanced .document-preview-shell {
    border-radius: 24px;
  }
}

/* iPhone density pass: more native-app rhythm for technician work. */
@media (max-width: 560px) {
  body.visual-enhanced.session-authenticated .workspace {
    margin-top: 10px !important;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.visual-enhanced.session-authenticated .page-panel {
    padding: 16px 12px 18px !important;
    border-radius: 22px !important;
  }

  body.visual-enhanced .clients-header,
  body.visual-enhanced .dashboard-header {
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  body.visual-enhanced .clients-header h2,
  body.visual-enhanced .dashboard-header h2 {
    font-size: 1.72rem !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
  }

  body.visual-enhanced .clients-header .muted,
  body.visual-enhanced #opsHubUnifiedCenter {
    display: none !important;
  }

  body.visual-enhanced .clients-header .toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px !important;
    width: 100%;
  }

  body.visual-enhanced .clients-header .toolbar label {
    display: none !important;
  }

  body.visual-enhanced .clients-header .toolbar select,
  body.visual-enhanced .clients-header .toolbar button {
    min-height: 40px !important;
    border-radius: 14px !important;
    font-size: 0.86rem !important;
  }

  body.visual-enhanced .ops-hub-mobile-tools {
    margin: 8px 0 10px !important;
    padding: 10px !important;
    gap: 9px !important;
    border: 1px solid rgba(29, 29, 31, 0.08) !important;
    border-left: 4px solid var(--premium-blue) !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.78) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.055) !important;
  }

  body.visual-enhanced .ops-hub-mobile-status {
    gap: 2px !important;
  }

  body.visual-enhanced .ops-hub-mobile-status small {
    color: var(--premium-muted) !important;
    font-size: 0.68rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body.visual-enhanced .ops-hub-mobile-status strong {
    color: var(--premium-ink) !important;
    font-size: 1.05rem !important;
    line-height: 1.12 !important;
  }

  body.visual-enhanced .ops-hub-mobile-status span {
    color: #42526b !important;
    font-size: 0.78rem !important;
    font-weight: 750 !important;
  }

  body.visual-enhanced .ops-hub-mobile-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body.visual-enhanced .ops-hub-mobile-buttons button {
    min-height: 36px !important;
    padding: 0 7px !important;
    border-radius: 999px !important;
    font-size: 0.76rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body.visual-enhanced #btnOpsHubMobileSync {
    grid-column: 1 / -1;
    min-height: 36px !important;
  }

  body.visual-enhanced .tech-center-ops-home {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-top: 10px !important;
  }

  body.visual-enhanced .tech-center-ops-home .dashboard-ops-card {
    min-height: 102px !important;
    padding: 12px !important;
    border-radius: 18px !important;
    border-left-width: 3px !important;
    background: rgba(255, 255, 255, 0.88) !important;
  }

  body.visual-enhanced .tech-center-ops-home .dashboard-ops-card:nth-child(3) {
    grid-column: 1 / -1;
    min-height: 92px !important;
  }

  body.visual-enhanced .tech-center-ops-home .dashboard-ops-card small {
    font-size: 0.74rem !important;
    color: var(--premium-muted) !important;
  }

  body.visual-enhanced .tech-center-ops-home .dashboard-ops-card strong {
    font-size: 1.9rem !important;
    line-height: 1 !important;
    color: var(--premium-ink) !important;
  }

  body.visual-enhanced .tech-center-ops-home .dashboard-ops-card:nth-child(3) strong {
    font-size: 1.15rem !important;
    line-height: 1.15 !important;
  }

  body.visual-enhanced .ops-hub-card-meta {
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
  }

  body.visual-enhanced .tech-center-ops-home .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body.visual-enhanced .tech-center-ops-home .toolbar button {
    min-height: 34px !important;
    padding: 0 8px !important;
    border-radius: 999px !important;
    font-size: 0.74rem !important;
  }

  body.visual-enhanced .task-board {
    margin-top: 12px !important;
    border-radius: 20px !important;
  }

  body.visual-enhanced .task-board-head h3 {
    font-size: 1.05rem !important;
  }

  body.visual-enhanced.session-authenticated #workspaceNavSection {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    padding: 7px !important;
    border-radius: 22px !important;
  }

  body.visual-enhanced .page-nav {
    gap: 5px !important;
  }

  body.visual-enhanced .page-nav > button,
  body.visual-enhanced .page-nav > .nav-module-launcher-button {
    min-height: 40px !important;
    padding: 6px 5px !important;
    border-radius: 16px !important;
    font-size: 0.7rem !important;
  }
}

/* iPhone delivery pass: keep the delivery workflow fast, calm, and scannable. */
@media (max-width: 560px) {
  body.visual-enhanced [data-page="deliveries"] .clients-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start !important;
  }

  body.visual-enhanced [data-page="deliveries"] .clients-header h2 {
    font-size: 1.24rem !important;
    line-height: 1.12 !important;
    max-width: 210px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .clients-stats {
    min-width: 72px !important;
    padding: 8px 9px !important;
    border-radius: 16px !important;
    box-shadow: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .clients-stats strong {
    font-size: 0.98rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .clients-stats span {
    font-size: 0.66rem !important;
    white-space: nowrap !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-overview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 8px 0 !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-overview-strip .dossier-card {
    min-height: 72px !important;
    padding: 9px !important;
    border-radius: 16px !important;
    box-shadow: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-overview-strip .dossier-card small {
    font-size: 0.64rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-overview-strip .dossier-card strong {
    font-size: 0.82rem !important;
    line-height: 1.15 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-confirmation-chain {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin: 8px 0 !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-confirmation-chain article {
    min-height: 58px !important;
    padding: 8px 7px !important;
    border-radius: 15px !important;
    background: rgba(255, 255, 255, 0.86) !important;
    box-shadow: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-confirmation-chain article::before {
    top: 8px !important;
    right: 8px !important;
    width: 7px !important;
    height: 7px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-confirmation-chain small {
    font-size: 0.6rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-confirmation-chain strong {
    margin-top: 4px !important;
    font-size: 0.66rem !important;
    line-height: 1.12 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  body.visual-enhanced [data-page="deliveries"] #deliveriesSummaryMeta {
    display: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-desktop-form {
    gap: 10px !important;
    margin-top: 10px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-section {
    padding: 12px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.82) !important;
  }

  body.visual-enhanced [data-page="deliveries"] label.field,
  body.visual-enhanced [data-page="deliveries"] .field {
    padding: 10px !important;
    border-radius: 16px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .field input,
  body.visual-enhanced [data-page="deliveries"] .field select,
  body.visual-enhanced [data-page="deliveries"] .field textarea,
  body.visual-enhanced [data-page="deliveries"] label.field input,
  body.visual-enhanced [data-page="deliveries"] label.field select,
  body.visual-enhanced [data-page="deliveries"] label.field textarea {
    min-height: 42px !important;
    border-radius: 14px !important;
    font-size: 0.94rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .field span,
  body.visual-enhanced [data-page="deliveries"] label.field span {
    font-size: 0.68rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .field-hint,
  body.visual-enhanced [data-page="deliveries"] .delivery-email-shell .muted,
  body.visual-enhanced [data-page="deliveries"] .delivery-equipment-details summary small {
    display: none !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-picker-select {
    min-height: 104px !important;
    max-height: 168px !important;
    border-radius: 14px !important;
    padding: 8px !important;
    font-size: 0.94rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-picker-select option {
    padding: 7px 8px !important;
    font-size: 0.94rem !important;
    line-height: 1.2 !important;
  }

  body.visual-enhanced [data-page="deliveries"] #deliveryExistingClientSearch,
  body.visual-enhanced [data-page="deliveries"] #deliveryExistingEquipment {
    font-size: 0.94rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-inline-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-inline-toolbar button {
    width: auto !important;
    min-height: 42px !important;
    padding: 0 12px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .signature-pad {
    min-height: 128px !important;
    height: 128px !important;
    border-radius: 16px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .signature-pad-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .signature-pad-actions button {
    width: 100% !important;
    min-height: 38px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-equipment-details {
    padding: 10px !important;
    border-radius: 16px !important;
    background: rgba(242, 242, 247, 0.7) !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-equipment-details summary {
    min-height: 42px !important;
    font-size: 0.88rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-actions,
  body.visual-enhanced [data-page="deliveries"] .delivery-email-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-actions button,
  body.visual-enhanced [data-page="deliveries"] .delivery-email-actions button {
    width: 100% !important;
    min-height: 42px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    font-size: 0.82rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] #btnDeliveryClear {
    grid-column: 1 / -1;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-history-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  body.visual-enhanced [data-page="deliveries"] .delivery-history-toolbar h3 {
    grid-column: 1 / -1;
    margin: 0 !important;
    font-size: 1.05rem !important;
  }

  body.visual-enhanced [data-page="deliveries"] #delivery-search {
    min-width: 0 !important;
    width: 100% !important;
  }
}
