/**
 * Rasadarshi Chemical Process Simulator
 * css/mobile.css - Ground-Up Mobile Studio & Live DCS Touch Interface
 * Scoped to html[data-ui-shell="mobile"] so the Desktop Studio remains 100% intact.
 */

/* Desktop Topbar Quick Toggle to Preview/Enter Mobile Studio */
.btn-mobile-shell-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

/* Hide Mobile Shell DOM Elements when in Desktop Studio */
html:not([data-ui-shell="mobile"]) #mob-topbar,
html:not([data-ui-shell="mobile"]) #mob-tabbar,
html:not([data-ui-shell="mobile"]) #mob-canvas-hud,
html:not([data-ui-shell="mobile"]) #mob-operate-view,
html:not([data-ui-shell="mobile"]) #mob-data-view,
html:not([data-ui-shell="mobile"]) #mob-alarms-view,
html:not([data-ui-shell="mobile"]) #mob-sheet-backdrop,
html:not([data-ui-shell="mobile"]) #mob-palette-sheet,
html:not([data-ui-shell="mobile"]) #mob-menu-sheet,
html:not([data-ui-shell="mobile"]) #mob-port-sheet,
html:not([data-ui-shell="mobile"]) #mob-insp-drag-bar {
  display: none !important;
}

/* ============================================================================
   MASTER MOBILE STUDIO SHELL (html[data-ui-shell="mobile"])
   ============================================================================ */
html[data-ui-shell="mobile"] {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --mob-top-h: calc(52px + var(--safe-top));
  --mob-tab-h: calc(60px + var(--safe-bottom));
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Prevent iOS Safari / Android auto-zoom on input focus (must be >= 16px) */
html[data-ui-shell="mobile"] input[type="text"],
html[data-ui-shell="mobile"] input[type="number"],
html[data-ui-shell="mobile"] input[type="password"],
html[data-ui-shell="mobile"] input[type="search"],
html[data-ui-shell="mobile"] select,
html[data-ui-shell="mobile"] textarea {
  font-size: 16px !important;
}

/* Hide Desktop Chrome in Mobile Shell */
html[data-ui-shell="mobile"] #topbar,
html[data-ui-shell="mobile"] #model-tabs-bar,
html[data-ui-shell="mobile"] #workspace-tabs,
html[data-ui-shell="mobile"] #dynbar,
html[data-ui-shell="mobile"] #statusbar,
html[data-ui-shell="mobile"] #palette,
html[data-ui-shell="mobile"] #palette-resizer,
html[data-ui-shell="mobile"] #inspector-resizer,
html[data-ui-shell="mobile"] .canvas-toolbar,
html[data-ui-shell="mobile"] #operate-mode-banner,
html[data-ui-shell="mobile"] #dcs-console-view,
html[data-ui-shell="mobile"] #cpm-view,
html[data-ui-shell="mobile"] #alarm-view,
html[data-ui-shell="mobile"] #flowsheet-hover-card {
  display: none !important;
}

/* Root Mobile Flex Column */
html[data-ui-shell="mobile"] #app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================================
   1. MOBILE TOP APP BAR (#mob-topbar)
   ============================================================================ */
html[data-ui-shell="mobile"] #mob-topbar {
  height: var(--mob-top-h);
  min-height: var(--mob-top-h);
  padding: var(--safe-top) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left));
  background: var(--bg-1);
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 70;
  flex-shrink: 0;
}

.mob-brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--txt);
  padding: 4px 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.mob-brand-logo {
  width: 24px;
  height: 24px;
  color: var(--acc);
  flex-shrink: 0;
}

.mob-brand-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, var(--txt) 25%, var(--acc) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 420px) {
  .mob-brand-name {
    display: none;
  }
  html[data-ui-shell="mobile"] #mob-topbar {
    padding: var(--safe-top) calc(6px + var(--safe-right)) 0 calc(6px + var(--safe-left));
    gap: 4px;
  }
  .mob-thermo-pill {
    height: 30px;
    padding: 0 6px;
    font-size: 10px;
  }
  .mob-mode-btn {
    padding: 4px 6px;
    font-size: 10.5px;
  }
  .mob-primary-exec-btn {
    height: 30px;
    padding: 0 8px;
    font-size: 11px;
    gap: 4px;
  }
  html[data-ui-shell="mobile"] .mob-icon-btn {
    width: 32px;
    height: 32px;
  }
}

html[data-ui-shell="mobile"] .canvas-empty-watermark {
  top: 52px;
  transform: translateX(-50%);
  max-height: calc(100% - 220px);
  overflow-y: auto;
}

.mob-thermo-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--acc);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.mob-mode-seg {
  display: inline-flex;
  align-items: center;
  background: var(--bg-0);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.mob-mode-btn {
  border: none;
  background: transparent;
  color: var(--txt-2);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1.1;
  transition: background 0.15s ease, color 0.15s ease;
}

.mob-mode-btn.active[data-mob-mode="design"] {
  background: rgba(56, 189, 248, 0.2);
  color: var(--acc);
}

.mob-mode-btn.active[data-mob-mode="rating"] {
  background: rgba(251, 191, 36, 0.22);
  color: var(--warn);
}

.mob-mode-btn.active[data-mob-mode="dynamics"] {
  background: rgba(52, 211, 153, 0.22);
  color: var(--ok);
}

.mob-spacer {
  flex: 1;
  min-width: 2px;
}

.mob-primary-exec-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.28);
}

.mob-primary-exec-btn.is-dyn-paused {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: rgba(52, 211, 153, 0.5);
}

.mob-primary-exec-btn.is-dyn-running {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: rgba(251, 191, 36, 0.55);
}

.mob-exec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.mob-exec-dot.dirty {
  background: #fbbf24;
}

.mob-exec-dot.warn {
  background: #fb7185;
}

.mob-clock-pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--bg-0);
  border: 1px solid var(--stroke);
  color: var(--ok);
  cursor: pointer;
  flex-shrink: 0;
}

.mob-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================================
   2. TAB VIEWPORT ROUTING (Flowsheet | Operate | Data/Trends | Alarms | Copilot)
   ============================================================================ */
html[data-ui-shell="mobile"] #workspace {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  display: none;
}

html[data-ui-shell="mobile"][data-mob-tab="flowsheet"] #workspace,
html[data-ui-shell="mobile"]:not([data-mob-tab]) #workspace {
  display: flex !important;
}

html[data-ui-shell="mobile"] #canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

/* Reposition Multi-Sheet Tabs Bar cleanly at top-left of Mobile Canvas */
html[data-ui-shell="mobile"] #sheet-tabs-bar {
  top: 10px;
  bottom: auto;
  left: 10px;
  right: auto;
  max-width: calc(100% - 20px);
  padding: 4px 6px;
  border-radius: 10px;
  z-index: 30;
}

html[data-ui-shell="mobile"] .sheet-tab,
html[data-ui-shell="mobile"] .sheet-add-btn {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

/* Mobile Empty Canvas Launchpad */
html[data-ui-shell="mobile"] #canvas-empty-watermark {
  padding: 14px;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
  touch-action: pan-y;
}

html[data-ui-shell="mobile"] .launchpad-shell {
  width: 100%;
  max-width: 500px;
  padding: 18px 16px;
  margin: 8px auto 76px auto;
  border-radius: 16px;
}

html[data-ui-shell="mobile"] .launchpad-title {
  font-size: 20px;
}

html[data-ui-shell="mobile"] .launchpad-sub {
  font-size: 12px;
}

html[data-ui-shell="mobile"] .launchpad-grid {
  grid-template-columns: 1fr !important;
  gap: 10px;
}

html[data-ui-shell="mobile"] .launchpad-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

html[data-ui-shell="mobile"] .launchpad-actions .btn-icon {
  min-height: 40px;
  justify-content: center;
  font-size: 12px;
}

/* ============================================================================
   3. MOBILE CANVAS OVERLAY HUD (Guided Wiring, Floating FABs, Selection Bar)
   ============================================================================ */
#mob-canvas-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 32;
}

.mob-canvas-overlay-ui {
  pointer-events: auto;
}

/* Guided Wiring / Placement Banner at Top of Canvas */
.mob-wiring-banner {
  position: absolute;
  top: 52px;
  left: 10px;
  right: 10px;
  background: var(--bg-1);
  border: 1.5px solid var(--acc);
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  z-index: 38;
}

.mob-wiring-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mob-wiring-text {
  font-size: 12px;
  color: var(--txt);
  line-height: 1.35;
}

.mob-wiring-ports {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mob-port-chip {
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}

.mob-port-chip.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--acc);
  color: var(--acc);
}

.mob-wiring-cancel {
  border: 1px solid rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.14);
  color: var(--err);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Floating Right FAB Stack on Flowsheet Canvas */
.mob-fab-stack {
  position: absolute;
  right: calc(12px + var(--safe-right));
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  z-index: 34;
  transition: bottom 0.18s ease;
}

#mob-canvas-hud.has-selection .mob-fab-stack {
  bottom: 72px;
}

.mob-mini-fab {
  height: 40px;
  min-width: 40px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--bg-1);
  color: var(--txt);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.mob-mini-fab.active {
  border-color: var(--acc);
  background: rgba(56, 189, 248, 0.18);
  color: var(--acc);
}

.mob-add-fab {
  height: 50px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.42);
  cursor: pointer;
}

/* Contextual Selection Pill Bar at Bottom of Canvas */
.mob-sel-bar {
  position: absolute;
  left: calc(10px + var(--safe-left));
  right: calc(10px + var(--safe-right));
  bottom: 10px;
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
  z-index: 35;
}

.mob-sel-tag {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 8px;
  border-right: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mob-sel-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--txt);
  white-space: nowrap;
}

.mob-sel-sub {
  font-size: 10.5px;
  color: var(--txt-3);
  font-family: var(--mono);
  white-space: nowrap;
}

.mob-sel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mob-act-chip {
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
}

.mob-act-chip.primary {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--acc);
}

.mob-act-chip.accent-ok {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--ok);
}

.mob-act-chip.danger {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.38);
  color: var(--err);
}

/* ============================================================================
   4. CENTERED MOBILE EQUIPMENT & STREAM POP-UP WINDOW (#inspector)
   ============================================================================ */
html[data-ui-shell="mobile"] #inspector {
  position: fixed !important;
  left: 10px !important;
  right: 10px !important;
  top: calc(var(--mob-top-h) + 10px) !important;
  bottom: auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto;
  max-height: calc(100dvh - var(--mob-top-h) - var(--mob-tab-h) - 20px);
  background: var(--bg-1);
  border: 1.5px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.55);
  z-index: 85;
  display: none !important;
  flex-direction: column;
  transform: none;
}

html[data-ui-shell="mobile"] #inspector.mob-insp-open:not(.collapsed) {
  display: flex !important;
  pointer-events: auto;
  animation: inspPopupFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-ui-shell="mobile"] #inspector.mob-insp-peek {
  max-height: 54dvh;
}

html[data-ui-shell="mobile"] #inspector.mob-insp-half {
  max-height: 70dvh;
}

html[data-ui-shell="mobile"] #inspector.mob-insp-full {
  max-height: calc(100dvh - var(--mob-top-h) - var(--mob-tab-h) - 14px);
}

html[data-ui-shell="mobile"] .insp-popup-resizer,
html[data-ui-shell="mobile"] #btn-insp-wide,
html[data-ui-shell="mobile"] .insp-drag-grip {
  display: none !important;
}

#mob-insp-drag-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 2px 12px;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.mob-sheet-pill {
  width: 42px;
  height: 4.5px;
  border-radius: 999px;
  background: var(--stroke);
  margin: 0 auto;
}

.mob-insp-detent-btns {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mob-detent-btn {
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

html[data-ui-shell="mobile"] #inspector .inspector-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 28px 14px;
}

html[data-ui-shell="mobile"] #inspector .field-row input,
html[data-ui-shell="mobile"] #inspector .field-row select {
  min-height: 38px;
}

html[data-ui-shell="mobile"] #inspector .btn-icon,
html[data-ui-shell="mobile"] #inspector .btn-primary {
  min-height: 40px;
}

/* ============================================================================
   5. GENERIC MOBILE BOTTOM SHEETS (Palette, Menu & Port Picker)
   ============================================================================ */
.mob-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.55);
  backdrop-filter: blur(3px);
  z-index: 88;
}

.mob-bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  padding-bottom: calc(14px + var(--safe-bottom));
  background: var(--bg-1);
  border-top: 1.5px solid var(--stroke);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -14px 42px rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mob-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mob-sheet-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--txt);
}

.mob-sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
}

/* Mobile Equipment Palette Sheet */
.mob-pal-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.mob-pal-search {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  padding: 0 12px;
}

.mob-pal-mode-toggle {
  height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.mob-pal-mode-toggle.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--acc);
  color: var(--acc);
}

.mob-cat-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.mob-cat-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.mob-cat-pill.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #ffffff;
}

.mob-pal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 560px) {
  .mob-pal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.mob-unit-tile {
  min-height: 70px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  cursor: pointer;
}

.mob-unit-tile:active {
  transform: scale(0.97);
  border-color: var(--acc);
}

.mob-unit-tile svg {
  width: 24px;
  height: 24px;
}

.mob-unit-tile-lbl {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--txt);
}

.mob-unit-tile-cat {
  font-size: 9.5px;
  color: var(--txt-3);
}

/* Mobile Command & Settings Sheet */
.mob-cmd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mob-cmd-btn {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.mob-cmd-btn.highlight {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--acc);
}

.mob-pref-group {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--bg-0);
  overflow: hidden;
  margin-bottom: 12px;
}

.mob-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--stroke-2);
}

.mob-pref-row:last-child {
  border-bottom: none;
}

.mob-pref-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--txt);
}

.mob-pref-sub {
  font-size: 11px;
  color: var(--txt-3);
}

/* ============================================================================
   6. TAB 2: MOBILE OPERATE DECK (#mob-operate-view — Live DCS & Faceplates)
   ============================================================================ */
html[data-ui-shell="mobile"] #mob-operate-view {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: none;
  flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

html[data-ui-shell="mobile"][data-mob-tab="operate"] #mob-operate-view {
  display: flex !important;
}

.mob-dyn-transport {
  padding: 10px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.mob-dyn-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.mob-dyn-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
}

.mob-dyn-btn.run {
  background: #059669;
  border-color: #10b981;
  color: #ffffff;
}

.mob-dyn-btn.pause {
  background: #d97706;
  border-color: #f59e0b;
  color: #ffffff;
}

.mob-spd-chip {
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.mob-spd-chip.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--acc);
  color: var(--acc);
}

.mob-op-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mob-loop-card {
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mob-loop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mob-loop-tag {
  font-size: 14px;
  font-weight: 800;
  color: var(--txt);
}

.mob-loop-desc {
  font-size: 11px;
  color: var(--txt-3);
}

.mob-mode-pills {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-0);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
}

.mob-fp-mode-btn {
  border: none;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.mob-fp-mode-btn.active {
  background: var(--acc);
  color: #ffffff;
}

.mob-kpi-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.mob-kpi-box {
  background: var(--bg-0);
  border: 1px solid var(--stroke-2);
  border-radius: 9px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
}

.mob-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--txt-3);
  text-transform: uppercase;
}

.mob-kpi-val {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--txt);
  margin-top: 2px;
}

.mob-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-0);
  border: 1px solid var(--stroke-2);
  position: relative;
  overflow: hidden;
}

.mob-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.2s ease;
}

.mob-bar-sp-tick {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2.5px;
  background: #fbbf24;
}

.mob-nudge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mob-nudge-btn {
  flex: 1;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mob-nudge-btn:active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--acc);
}

/* ============================================================================
   7. TAB 3: MOBILE TRENDS, STREAMS & SIZING (#mob-data-view + #drawer)
   ============================================================================ */
html[data-ui-shell="mobile"] #mob-data-view {
  display: none;
  flex-direction: column;
  background: var(--bg-0);
  width: 100%;
}

html[data-ui-shell="mobile"][data-mob-tab="data"] #mob-data-view {
  display: flex !important;
  flex: 1;
  min-height: 0;
}

/* When Trends sub-tab is active, #mob-data-view shrinks to its header bar and #drawer fills remaining space */
html[data-ui-shell="mobile"][data-mob-tab="data"][data-mob-data-sub="trends"] #mob-data-view {
  flex: 0 0 auto;
}

html[data-ui-shell="mobile"] #drawer {
  display: none !important;
}

html[data-ui-shell="mobile"][data-mob-tab="data"][data-mob-data-sub="trends"] #drawer {
  display: flex !important;
  flex: 1 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  border-top: none !important;
  position: relative !important;
}

html[data-ui-shell="mobile"] #drawer #drawer-resizer,
html[data-ui-shell="mobile"] #drawer .drawer-header,
html[data-ui-shell="mobile"] #drawer #btn-trend-float,
html[data-ui-shell="mobile"] #drawer #btn-trend-max {
  display: none !important;
}

html[data-ui-shell="mobile"] #drawer #trends-view {
  display: flex !important;
  flex: 1;
  min-height: 0;
}

html[data-ui-shell="mobile"] #drawer .trend-content {
  flex-direction: column !important;
  flex: 1;
  min-height: 0;
}

html[data-ui-shell="mobile"] #drawer .trend-legend {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 118px !important;
  border-right: none !important;
  border-bottom: 1px solid var(--stroke);
  overflow-y: auto;
}

html[data-ui-shell="mobile"] #drawer .trend-canvas-wrapper {
  flex: 1;
  min-height: 210px;
}

html[data-ui-shell="mobile"] #drawer .trend-pages-bar,
html[data-ui-shell="mobile"] #drawer .trend-toolbar {
  flex-wrap: wrap !important;
  gap: 6px !important;
  padding: 6px 8px !important;
  height: auto !important;
}

html[data-ui-shell="mobile"] #drawer .trend-toolbar .btn-icon,
html[data-ui-shell="mobile"] #drawer .trend-pages-bar .btn-icon {
  min-height: 32px;
}

.mob-subtab-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mob-subtab-btn {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--bg-0);
  color: var(--txt-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mob-subtab-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--acc);
  color: var(--acc);
}

.mob-data-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-ui-shell="mobile"][data-mob-tab="data"][data-mob-data-sub="trends"] .mob-data-scroll {
  display: none !important;
}

.mob-data-card {
  background: var(--bg-1);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mob-data-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mob-phase-pill {
  font-size: 10.5px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  color: var(--acc);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.mob-prop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.mob-prop-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--stroke-2);
}

.mob-prop-item span {
  color: var(--txt-3);
}

.mob-prop-item strong {
  font-family: var(--mono);
  color: var(--txt);
}

.mob-wq-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 4px;
}

.mob-wq-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.32);
  color: var(--acc);
}

/* ============================================================================
   8. TAB 4: MOBILE ISA-18.2 ALARMS & SOE (#mob-alarms-view)
   ============================================================================ */
html[data-ui-shell="mobile"] #mob-alarms-view {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: none;
  flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

html[data-ui-shell="mobile"][data-mob-tab="alarms"] #mob-alarms-view {
  display: flex !important;
}

.mob-alm-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mob-alm-kpi {
  background: var(--bg-0);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  padding: 6px;
  text-align: center;
}

.mob-alm-kpi-num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  color: var(--txt);
}

.mob-alm-kpi-lbl {
  font-size: 10px;
  color: var(--txt-3);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .alm-health-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .alm-health-strip .alm-kpi-card {
    padding: 8px 10px;
  }
  .alm-health-strip .alm-kpi-val {
    font-size: 15px;
  }
  .alm-health-strip .alm-kpi-val-sm {
    font-size: 12px;
  }
}

/* ============================================================================
   9. TAB 5: MOBILE AI COPILOT (#copilot-panel in Mobile Shell)
   ============================================================================ */
html[data-ui-shell="mobile"] #copilot-panel {
  display: none !important;
}

html[data-ui-shell="mobile"][data-mob-tab="copilot"] #copilot-panel {
  display: flex !important;
  position: relative !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  flex: 1 !important;
  min-height: 0 !important;
  transform: none !important;
  pointer-events: auto !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
  z-index: 40;
}

html[data-ui-shell="mobile"] #copilot-panel .copilot-header {
  flex-wrap: wrap !important;
  padding: 8px 10px !important;
  gap: 6px !important;
}

html[data-ui-shell="mobile"] #copilot-panel .copilot-header-title {
  flex-wrap: wrap;
  gap: 6px;
}

html[data-ui-shell="mobile"] #copilot-panel .copilot-header-controls {
  margin-left: auto;
  gap: 6px;
}

html[data-ui-shell="mobile"] #copilot-settings-btn,
html[data-ui-shell="mobile"] #copilot-clear-btn {
  min-width: 36px;
  min-height: 36px;
  justify-content: center;
}

html[data-ui-shell="mobile"] #copilot-model-select {
  width: 138px !important;
  min-height: 36px;
}

html[data-ui-shell="mobile"] #copilot-resizer,
html[data-ui-shell="mobile"] #copilot-expand-btn,
html[data-ui-shell="mobile"] #copilot-close-btn,
html[data-ui-shell="mobile"] .copilot-hint,
html[data-ui-shell="mobile"] .copilot-global-mode-note {
  display: none !important;
}

/* ============================================================================
   10. FIXED 5-TAB BOTTOM NAVIGATION BAR (#mob-tabbar)
   ============================================================================ */
html[data-ui-shell="mobile"] #mob-tabbar {
  height: var(--mob-tab-h);
  min-height: var(--mob-tab-h);
  padding: 4px var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--bg-1);
  border-top: 1px solid var(--stroke);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  z-index: 84;
  flex-shrink: 0;
}

.mob-tab-btn {
  border: none;
  background: transparent;
  color: var(--txt-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  position: relative;
  cursor: pointer;
  padding: 2px 0;
}

.mob-tab-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.mob-tab-btn.active {
  color: var(--acc);
}

.mob-tab-btn.active::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 24%;
  right: 24%;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--acc);
}

.mob-tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   11. RESPONSIVE MODAL & FACEPLATE ADAPTATION ON MOBILE
   ============================================================================ */
/* Align .modal-overlay near the TOP on mobile so the on-screen keyboard never covers input fields */
html[data-ui-shell="mobile"] .modal-overlay {
  padding: calc(10px + var(--safe-top)) 8px calc(12px + var(--safe-bottom)) 8px !important;
  align-items: flex-start !important;
  overflow-y: auto !important;
}

html[data-ui-shell="mobile"] .thermo-advisor-modal,
html[data-ui-shell="mobile"] .equipment-advisor-modal {
  padding: calc(8px + var(--safe-top)) 6px calc(8px + var(--safe-bottom)) 6px !important;
  align-items: stretch !important;
}

html[data-ui-shell="mobile"] .modal-dialog,
html[data-ui-shell="mobile"] .modal-dialog-wide,
html[data-ui-shell="mobile"] .thermo-advisor-dialog,
html[data-ui-shell="mobile"] .equipment-advisor-dialog {
  width: 100% !important;
  max-width: 100% !important;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 18px) !important;
  border-radius: 16px !important;
  margin: 0 !important;
}

html[data-ui-shell="mobile"] .thermo-advisor-dialog,
html[data-ui-shell="mobile"] .equipment-advisor-dialog {
  height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px) !important;
}

html[data-ui-shell="mobile"] .modal-dialog .modal-header,
html[data-ui-shell="mobile"] .thermo-advisor-dialog .modal-header,
html[data-ui-shell="mobile"] .equipment-advisor-dialog .modal-header {
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 10px 12px !important;
}

html[data-ui-shell="mobile"] .modal-dialog .modal-body {
  padding: 12px !important;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 140px) !important;
}

html[data-ui-shell="mobile"] .modal-dialog .modal-footer {
  flex-wrap: wrap !important;
  padding: 10px 12px !important;
  gap: 8px !important;
}

/* Collapse multi-column grids inside standard & RBAC modals on narrow screens */
@media (max-width: 640px) {
  html[data-ui-shell="mobile"] .modal-dialog [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  html[data-ui-shell="mobile"] .rbac-form-grid {
    grid-template-columns: 1fr !important;
  }
}

html[data-ui-shell="mobile"] .rbac-table-wrap,
html[data-ui-shell="mobile"] .rbac-matrix-scroll {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Standalone Fixed Modals: APC Studio, Well Studio, Trend Pens */
html[data-ui-shell="mobile"] .apc-studio-modal,
html[data-ui-shell="mobile"] .apc-studio-modal.apc-maximized {
  top: calc(6px + var(--safe-top)) !important;
  left: 6px !important;
  right: 6px !important;
  bottom: calc(6px + var(--safe-bottom)) !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
  border-radius: 16px !important;
}

html[data-ui-shell="mobile"] .apc-studio-modal .apc-modal-header {
  flex-wrap: wrap !important;
  gap: 6px !important;
  padding: 8px 10px !important;
  cursor: default !important;
}

html[data-ui-shell="mobile"] .apc-studio-modal [style*="grid-template-columns:1fr 1fr"],
html[data-ui-shell="mobile"] .apc-studio-modal [style*="grid-template-columns: 1fr 1fr"] {
  grid-template-columns: 1fr !important;
}

html[data-ui-shell="mobile"] .apc-studio-modal [style*="width:385px"],
html[data-ui-shell="mobile"] .apc-studio-modal [style*="min-width:350px"] {
  width: 100% !important;
  min-width: 0 !important;
  max-height: 260px !important;
}

html[data-ui-shell="mobile"] .well-studio-modal {
  top: calc(6px + var(--safe-top)) !important;
  left: 6px !important;
  right: 6px !important;
  bottom: calc(6px + var(--safe-bottom)) !important;
  width: auto !important;
  height: auto !important;
  align-items: stretch !important;
  justify-content: center !important;
}

html[data-ui-shell="mobile"] .well-modal-window {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 16px !important;
}

html[data-ui-shell="mobile"] .well-modal-header {
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  cursor: default !important;
}

html[data-ui-shell="mobile"] .well-modal-body {
  flex-direction: column !important;
  overflow-y: auto !important;
}

html[data-ui-shell="mobile"] .well-modal-sidebar {
  width: 100% !important;
  max-width: 100% !important;
  border-right: none !important;
  border-bottom: 1px solid #1e293b !important;
  overflow-y: visible !important;
  flex-shrink: 0 !important;
}

html[data-ui-shell="mobile"] .trend-pens-modal {
  top: calc(8px + var(--safe-top)) !important;
  left: 8px !important;
  right: 8px !important;
  bottom: auto !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px) !important;
  border-radius: 16px !important;
}

html[data-ui-shell="mobile"] .trend-pens-nav {
  flex-wrap: wrap !important;
}

/* Equipment Help & Equations Reference Modal */
html[data-ui-shell="mobile"] .help-modal-overlay {
  padding: calc(6px + var(--safe-top)) 6px calc(6px + var(--safe-bottom)) 6px !important;
  align-items: stretch !important;
}

html[data-ui-shell="mobile"] .help-modal-dialog {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  border-radius: 16px !important;
}

html[data-ui-shell="mobile"] .help-modal-header {
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 10px 12px !important;
}

html[data-ui-shell="mobile"] .help-search-box {
  min-width: 0 !important;
  width: 100% !important;
}

html[data-ui-shell="mobile"] .help-modal-body {
  flex-direction: column !important;
}

html[data-ui-shell="mobile"] .help-sidebar {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 148px !important;
  border-right: none !important;
  border-bottom: 1px solid var(--stroke-2) !important;
  flex-shrink: 0 !important;
}

/* Mobile Floating PID & APC Faceplate -> Clean Centered/Bottom Card */
html[data-ui-shell="mobile"] #controller-faceplate-modal,
html[data-ui-shell="mobile"] #apc-faceplate-modal {
  position: fixed !important;
  left: 8px !important;
  right: 8px !important;
  top: auto !important;
  bottom: calc(var(--mob-tab-h) + 8px) !important;
  width: auto !important;
  max-width: none !important;
  max-height: calc(100dvh - var(--mob-top-h) - var(--mob-tab-h) - 16px) !important;
  overflow-y: auto !important;
  border-radius: 16px !important;
  z-index: 86 !important;
}

/* Mobile Toast Position (above bottom tab bar) */
html[data-ui-shell="mobile"] #toast-container {
  bottom: calc(var(--mob-tab-h) + 12px) !important;
  left: 12px !important;
  right: 12px !important;
  align-items: center !important;
}

/* Mobile Login Card Adaptation */
@media (max-width: 640px) {
  .login-card-container {
    width: 100% !important;
    padding: 12px !important;
  }
  .login-card {
    padding: 20px 16px !important;
    border-radius: 18px !important;
  }
}

/* Light Theme High-Contrast Mobile Refinements */
html[data-ui-shell="mobile"][data-theme="light"] .mob-sheet-backdrop {
  background: rgba(15, 23, 42, 0.35);
}

html[data-ui-shell="mobile"][data-theme="light"] #inspector,
html[data-ui-shell="mobile"][data-theme="light"] .mob-bottom-sheet,
html[data-ui-shell="mobile"][data-theme="light"] .mob-sel-bar,
html[data-ui-shell="mobile"][data-theme="light"] .mob-wiring-banner {
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.14);
}

/* ============================================================================
   10. ANDROID, iOS & DESKTOP PWA APP INSTALLER MODAL (Active in Desktop & Mobile)
   ============================================================================ */
.mob-install-top-btn {
  border-color: rgba(56, 189, 248, 0.45) !important;
  background: rgba(56, 189, 248, 0.12) !important;
}

.pwa-install-modal {
  max-width: 500px;
  width: 94vw;
}

.pwa-install-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.pwa-hero-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-2, rgba(15, 23, 42, 0.06));
  border: 1px solid var(--stroke);
}

.pwa-app-icon-hero {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.28);
}

.pwa-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pwa-hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pwa-hero-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--txt);
}

.pwa-hero-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--txt-2);
}

.pwa-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.pwa-status-badge.ready,
.pwa-status-badge.installed {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pwa-status-badge.guide {
  background: rgba(56, 189, 248, 0.15);
  color: var(--acc, #0284c7);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pwa-native-cta-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pwa-native-install-btn {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  border-radius: 10px;
}

.pwa-native-cta-sub {
  font-size: 11px;
  text-align: center;
  color: var(--txt-2);
}

.pwa-installed-banner {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--txt);
  font-size: 12.5px;
}

.pwa-platform-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 11px;
  background: var(--bg-2, rgba(15, 23, 42, 0.06));
  border: 1px solid var(--stroke);
}

.pwa-plat-tab {
  min-height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--txt-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pwa-plat-tab.active {
  background: var(--acc, #0284c7);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.pwa-step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--bg-0);
  border: 1px solid var(--stroke);
}

.pwa-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--acc, #0284c7);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.pwa-step-text {
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--txt);
}

.pwa-key-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--bg-2, rgba(56, 189, 248, 0.12));
  border: 1px solid var(--stroke);
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
}

.pwa-ios-note {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.28);
  font-size: 11.5px;
  line-height: 1.42;
  color: var(--txt-2);
}

/* Mobile adaptation for Parametric Sensitivity Study modal */
@media (max-width: 768px) {
  .sens-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
  }
  .sens-form-grid {
    grid-template-columns: 1fr !important;
  }
  .comp-map-kpis {
    gap: 5px;
  }
  .comp-map-kpi-val {
    font-size: 10.5px;
  }
  .psv-orifice-ladder {
    gap: 4px;
  }
  .psv-orifice-chip {
    padding: 3px 2px;
  }
  .psv-orifice-util {
    font-size: 8.5px;
  }
  .ct-fan-ladder {
    gap: 4px;
  }
  .ct-fan-chip {
    padding: 3px 2px;
  }
  .ct-fan-pwr {
    font-size: 8px;
  }
  .pump-vfd-ladder {
    gap: 4px;
  }
  .pump-vfd-chip {
    padding: 3px 2px;
  }
  .pump-vfd-pwr {
    font-size: 8px;
  }
}
