/* Presentation-only improvements shared by the customer and merchant screens. */
html { -webkit-text-size-adjust: 100%; }
body[data-ui] { overflow-wrap: break-word; }
body[data-ui] :where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid #26746b;
  outline-offset: 3px;
}
body[data-ui] :where(input, select, textarea) { min-width: 0; max-width: 100%; }
body[data-ui] :where(img, video) { max-width: 100%; }
body[data-ui] :where(button, a, label) { touch-action: manipulation; }
.ui-skip {
  position: fixed; top: 8px; left: 8px; z-index: 10000;
  padding: 12px 18px; border-radius: 8px; background: #fff; color: #132621;
  font: 600 14px/1.4 Inter, sans-serif; transform: translateY(-160%);
}
.ui-skip:focus { transform: none; }
.ui-sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
body[data-ui] .glass-input::placeholder,
body[data-ui] .login-input::placeholder { color: #6c7872 !important; opacity: 1; }
body[data-ui="login"] .password-toggle {
  display: grid; place-items: center; width: 44px; height: 44px;
  right: 5px; border-radius: 10px;
}
body[data-ui="login"] #password { padding-right: 54px; }
body[data-ui="scanner"] .reward-mode {
  display: flex; align-items: flex-start; gap: 10px; min-height: 44px;
  padding: 12px; margin-bottom: 12px; border: 1px solid #d4dfd9;
  border-radius: 12px; color: #263d34; background: #eef4f0;
  font-size: 13px; line-height: 1.5; cursor: pointer;
}
body[data-ui="scanner"] .reward-mode input {
  flex: none; width: 20px; height: 20px; margin: 0; accent-color: #286351;
}
body[data-ui="scanner"] .camera-status { color: #45625a !important; }
body[data-ui="scanner"] .scanner-shell { isolation: isolate; }
body[data-ui="scanner"] .scan-line { pointer-events: none; }
body[data-ui="scanner"] #reader video { width: 100% !important; }
body[data-ui="scanner"] #resultText { font-size: 13px; overflow-wrap: anywhere; }
body[data-ui="scanner"] .scanner-return {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; margin: 4px 0 12px; padding: 10px 16px;
  border: 1px solid #ffffff35; border-radius: 12px; color: #e5eee8;
  font-size: 13px; text-decoration: none;
}

/* Dashboard grids must shrink before their contents, not widen the page. */
body[data-ui="dashboard"] :where(.main, .canvas, .app-page, .card, .field,
  .campaign-layout, .card-design-layout, .dash-preview-sticky, .phone-sim-card,
  .workspace-right, .topbar .titles) { min-width: 0; }
body[data-ui="dashboard"] :where(.card-design-layout, .campaign-layout,
  .autopilot-grid, .ap-row-2col, .filters, .kpi-row, .trio, .split-row) > * { min-width: 0; }
body[data-ui="dashboard"] .card-design-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr);
}
body[data-ui="dashboard"] .campaign-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
body[data-ui="dashboard"] .model-sector-filter-bar {
  min-width: 0; max-width: 100%; overflow-x: auto;
  overscroll-behavior-inline: contain; padding-block: 6px;
}
body[data-ui="dashboard"] .sector-filter-btn { flex-shrink: 0; }
body[data-ui="dashboard"] .dash-models-grid { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
body[data-ui="dashboard"] :where(#dashPrimaryColorHex, #dashAccentColorHex) { width: 0; min-width: 0; }
body[data-ui="dashboard"] :where(#dashPrimaryColor, #dashAccentColor) { flex-shrink: 0; }
body[data-ui="dashboard"] textarea.input {
  height: auto !important; min-height: 120px; resize: vertical; line-height: 1.6;
}
body[data-ui="dashboard"] :where(.workspace-current-btn .w-info, .pos-item-info, .feed-item .body) { min-width: 0; }
body[data-ui="dashboard"] :where(.topbar .titles p, .pos-item-name, .client-name) { overflow-wrap: anywhere; }
body[data-ui="dashboard"] .workspace-bar { min-height: 80px; height: auto; padding-block: 12px; flex-wrap: wrap; }
body[data-ui="dashboard"] .workspace-right { flex-wrap: wrap; justify-content: flex-end; }
body[data-ui="dashboard"] :where(.workspace-dropdown-menu, .pos-dropdown-menu) {
  max-width: calc(100vw - 32px); max-height: min(520px, calc(100dvh - 120px));
  overflow-y: auto; overscroll-behavior: contain;
}
body[data-ui="dashboard"] .mobile-drawer { visibility: hidden; }
body[data-ui="dashboard"] .mobile-drawer.open { visibility: visible; }
body[data-ui="dashboard"] .drawer-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -12px 0 16px; color: #e5eee8; font-size: 13px;
}
body[data-ui="dashboard"] .drawer-close {
  width: 40px; height: 40px; flex: none; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px; background: rgba(255, 255, 255, 0.08); color: #fff;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  padding: 0 !important; box-sizing: border-box !important; line-height: 1 !important; cursor: pointer; text-align: center;
  transition: all 0.15s ease;
}
body[data-ui="dashboard"] .drawer-close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
}
body[data-ui="dashboard"] .drawer-close i,
body[data-ui="dashboard"] .drawer-close svg {
  display: flex !important; align-items: center !important; justify-content: center !important;
  width: 100% !important; height: 100% !important; font-size: 16px !important; line-height: 1 !important;
  margin: 0 !important; padding: 0 !important;
}
body[data-ui="dashboard"] .drawer-tools { margin: 2px 0 16px; }
body[data-ui="dashboard"] .mobile-drawer #topbarPosBtn {
  width: 100%; min-height: 44px; justify-content: space-between; text-align: left;
  color: #e5eee8 !important; border-color: #ffffff30 !important; background: #ffffff0a !important;
}
body[data-ui="dashboard"] .mobile-drawer .pos-dropdown-menu {
  --ink: #192c29; --muted: #687671;
  position: static !important; min-width: 0 !important; width: 100%; margin-top: 8px;
}
body[data-ui="dashboard"] .modal-frame { position: relative; width: 100%; max-width: var(--dialog-width, 520px); }
body[data-ui="dashboard"] .modal {
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  overscroll-behavior: contain; scroll-padding-block: 64px 20px; scrollbar-gutter: stable;
}
body[data-ui="dashboard"] .modal-close {
  z-index: 2; width: 40px !important; height: 40px !important; top: 12px; right: 12px;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  padding: 0 !important; box-sizing: border-box !important; line-height: 1 !important; cursor: pointer; text-align: center;
}
body[data-ui="dashboard"] .modal-close i,
body[data-ui="dashboard"] .modal-close svg {
  display: flex !important; align-items: center !important; justify-content: center !important;
  width: 100% !important; height: 100% !important; line-height: 1 !important; margin: 0 !important; padding: 0 !important;
  font-size: 16px !important;
}
body[data-ui="dashboard"] .modal :where(h2, h3) { padding-right: 32px; }
body[data-ui="dashboard"] #modalClientName { overflow-wrap: anywhere; }
body[data-ui="dashboard"] :where(tr[data-client-profile], .mclient) { cursor: pointer; }
body[data-ui="dashboard"] :where(tr[data-client-profile], .mclient):focus-visible {
  outline: 3px solid #26746b; outline-offset: -3px;
}
body[data-ui="dashboard"] .dashboard-toast {
  top: auto; bottom: max(20px, env(safe-area-inset-bottom)); right: 20px;
  width: min(390px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  pointer-events: none;
}
body[data-ui="dashboard"] .dashboard-toast p { overflow-wrap: anywhere; }
body[data-ui="dashboard"] .dashboard-toast .toast-title { margin: 0; font-size: 13px; font-weight: 700; }
body[data-ui="dashboard"] .dashboard-toast .toast-desc { margin: 4px 0 0; font-size: 12px; color: #d3dfd7; line-height: 1.5; }
body[data-ui="dashboard"] .export-button { font-size: 11px; }

@media (max-width: 1200px) {
  body[data-ui="dashboard"] .campaign-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  body[data-ui] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea) { font-size: 16px !important; }
  body[data-ui="dashboard"] .card-design-layout { grid-template-columns: minmax(0, 1fr); }
  body[data-ui="dashboard"] .dash-preview-sticky { position: static; }
}
@media (max-width: 900px) {
  body[data-ui="dashboard"] .workspace-bar { display: none; }
  body[data-ui="dashboard"] .mobile-drawer {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
}
@media (max-width: 600px) {
  body[data-ui="dashboard"] .card-design-colors,
  body[data-ui="dashboard"] .dialog-fields { grid-template-columns: minmax(0, 1fr) !important; }
  body[data-ui="dashboard"] .card-design-intro { flex-wrap: wrap; gap: 16px; }
  body[data-ui="dashboard"] .card-design-intro > div { min-width: 0; }
  body[data-ui="dashboard"] .card-design-intro > div > div:last-child { min-width: 0; }
  body[data-ui="dashboard"] .card-design-intro > div > div:last-child > div { flex-wrap: wrap; }
  body[data-ui="dashboard"] .card-design-intro button { white-space: normal; width: 100%; height: auto !important; padding: 12px !important; }
  body[data-ui="dashboard"] .phone-sim-card { padding: 18px 10px; }
  body[data-ui="dashboard"] .phone-device-wrap { width: min(300px, 100%); }
  body[data-ui="dashboard"] .phone-sim-header { flex-wrap: wrap; gap: 12px; }
  body[data-ui="dashboard"] .dash-apple-wallet-frame { width: 100%; max-width: 390px; }
  body[data-ui="dashboard"] .dash-preview-sticky > .card { flex-wrap: wrap; gap: 8px; }
  body[data-ui="dashboard"] .dash-preview-sticky > .card > div { min-width: 0; }
  body[data-ui="dashboard"] .page-actions { flex-wrap: wrap; }
  body[data-ui="dashboard"] .export-button { width: auto; padding: 0 12px; }
  body[data-ui="dashboard"] :where(.topbar .menu-btn, .icon-btn, .scan-btn, .export-button,
    .period-btn, .hero-toggle button, .attn-btn, .churn-reengage-btn, .sector-filter-btn,
    .sim-os-btn, .sim-trigger-btn, .logout-btn, .seg-card) { min-height: 44px; }
  body[data-ui="dashboard"] :where(.topbar .menu-btn, .icon-btn) { min-width: 44px; }
  body[data-ui="dashboard"] .modal-overlay { padding: 12px; }
  body[data-ui="dashboard"] .modal { max-height: calc(100dvh - 24px); padding: 20px 16px; }
  body[data-ui="dashboard"] .dashboard-toast { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) {
  body[data-ui] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea) { font-size: 16px !important; }
  body[data-ui="dashboard"] :where(button, .scan-btn, .side-link) { min-height: 44px; }
  body[data-ui="dashboard"] .ap-switch { height: 44px; min-height: 44px; display: inline-flex; align-items: center; }
  body[data-ui="dashboard"] .ap-slider { top: 11px; bottom: 11px; }
  body[data-ui="dashboard"] .ap-switch:focus-within { outline: 3px solid #26746b; outline-offset: 3px; border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body[data-ui] *, body[data-ui] *::before, body[data-ui] *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}
body[data-ui="scanner"][data-camera-state="unavailable"] .scanner-shell { display: none; }
body[data-ui="scanner"][data-camera-state="unavailable"] .camera-status { color: #9b503a !important; }
body[data-ui="dashboard"] .hint:has(#campaignHoldout) { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding-block: 10px; cursor: pointer; }
body[data-ui="dashboard"] #campaignHoldout { width: 20px; height: 20px; flex: none; margin: 0; accent-color: #26725b; }
.ui-entry { margin: 0; padding: 24px 16px; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: #0b1b15; color: #1b332a; font: 400 16px/1.65 Inter, system-ui, sans-serif; }
.ui-entry * { box-sizing: border-box; }
.ui-entry-card { width: min(100%, 460px); padding: clamp(24px, 6vw, 40px); background: #f8faf6; border-radius: 24px; box-shadow: 0 20px 60px #0003; }
.ui-entry-eyebrow { font-size: 11px; letter-spacing: 1.5px; font-weight: 700; color: #536d5f; margin-top: 24px; }
.ui-entry-card h1 { margin: 12px 0; font-size: clamp(28px, 6vw, 36px); line-height: 1.2; letter-spacing: -1px; }
.ui-entry-card > p:not(.ui-entry-eyebrow) { color: #53675e; }
.ui-entry-card a { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 600; }
.ui-entry-card .ui-entry-primary { margin: 28px 0 8px; background: #22634f; color: #fff; }
body[data-ui="dashboard"] .sidebar :focus-visible { outline-color: #f5d77f; }
body[data-ui="dashboard"] .dash-model-card:focus-visible { outline: 3px solid #26746b; outline-offset: 3px; }
body[data-ui="dashboard"] .ui-empty-state { grid-column: 1 / -1; margin: 0; padding: 20px; background: #f4f7f3; border: 1px dashed #cad7cc; border-radius: 10px; color: #52665b; font-size: 13px; line-height: 1.6; }
body[data-ui="scanner"][data-camera-state="unavailable"] .scanner-hint { display: none; }
@media (max-width: 600px) {
  body[data-ui="dashboard"] .card-design-intro > div { align-items: flex-start !important; }
}
/* Location attribution stays accessible beside the scanner on every screen. */
body[data-ui="scanner"] .scanner-location{margin:0 0 16px;padding:16px;border:1px solid #ffffff24;border-radius:16px;background:#ffffff0b;color:#fff}
body[data-ui="scanner"] .scanner-location label{display:block;font-size:12px;font-weight:600;margin-bottom:8px}
body[data-ui="scanner"] .scanner-location select{width:100%;min-height:48px;padding:10px 12px;border:1px solid #ffffff40;border-radius:10px;background:#f7faf7;color:#203c2b;font:16px/1.5 system-ui}
body[data-ui="scanner"] .scanner-location p{font-size:11px;line-height:1.6;color:#c7d6cc;margin:8px 0 0}

/* Inset the client-filter arrows without replacing native select behavior. */
body[data-ui="dashboard"] .clients-page select.select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 42px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23536a62' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
}
@media (forced-colors: active) {
  body[data-ui="dashboard"] .clients-page select.select { appearance: auto; background-image: none; }
}
