/* High-Contrast Industrial Theme - Compressed Zero-Scroll Kiosk */
:root {
  --bg-main: #f0f4f8;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --accent-blue: #0284c7;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #ea580c;
  --warning-bg: #ffedd5;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --border: #cbd5e1;
  --header-bg: #0f172a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Zero scroll in kiosk mode */
}

/* Compact Navbar */
.navbar {
  background-color: var(--header-bg);
  color: #ffffff;
  padding: 0.35rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  height: 44px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-icon {
  font-size: 1.25rem;
}

.nav-left h1 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.nav-left small {
  color: #94a3b8;
  font-size: 0.7rem;
}

.line-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.line-selector-wrapper label {
  font-size: 0.75rem;
  color: #94a3b8;
}

.line-selector-wrapper select {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  height: 28px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clock-badge {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
  background: #1e293b;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  border: 1px solid #334155;
  height: 28px;
  display: flex;
  align-items: center;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  height: 28px;
  display: flex;
  align-items: center;
}

.badge-scanner {
  background: #065f46;
  color: #6ee7b7;
}

.badge-idle {
  background: #334155;
  color: #e2e8f0;
}

.badge-running {
  background: #15803d;
  color: #ffffff;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.75; }
  100% { opacity: 1; }
}

.btn-nav {
  background: #3b82f6;
  color: #ffffff;
  border: none;
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-nav:hover {
  background: #2563eb;
}

.btn-view-mode {
  background: #475569;
}

/* Main Container */
.main-container {
  max-width: 100%;
  margin: 0;
  padding: 0.4rem 0.75rem;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
  height: calc(100vh - 44px - 34px);
  overflow: hidden;
}

/* Status Banner - Ultra Compact */
.status-banner {
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  min-height: 38px;
}

.banner-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.banner-content {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.banner-content h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin: 0;
  line-height: 1.2;
}

.banner-content p {
  font-size: 0.82rem;
  margin: 0;
  opacity: 0.95;
}

.banner-idle {
  background-color: #f1f5f9;
  border-left: 6px solid #64748b;
  color: #334155;
}

.banner-running {
  background-color: var(--success-bg);
  border-left: 6px solid var(--success);
  color: #14532d;
}

.banner-error {
  background-color: var(--danger-bg);
  border-left: 6px solid var(--danger);
  color: #7f1d1d;
  animation: flash-border 1s infinite alternate;
}

@keyframes flash-border {
  from { box-shadow: 0 0 4px rgba(185, 28, 28, 0.3); }
  to { box-shadow: 0 0 12px rgba(185, 28, 28, 0.6); }
}

/* KPI Cards - Compact */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  flex-shrink: 0;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.1;
  margin: 0.1rem 0;
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-green { color: var(--success); }
.text-orange { color: var(--warning); }
.text-red { color: var(--danger); }

.card-controls {
  padding: 0.3rem 0.65rem;
}

.btn-big-start {
  background-color: var(--success);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
  width: 100%;
  margin-top: 0.15rem;
  height: 32px;
}

.btn-big-start:hover {
  background-color: #166534;
}

.btn-big-stop {
  background-color: var(--danger);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  margin-top: 0.15rem;
  height: 32px;
}

.btn-big-stop:hover {
  background-color: #991b1b;
}

.control-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  text-align: center;
}

/* Side-by-Side Split Grid for Plan Management & Scan Audit */
.content-split-grid {
  display: grid;
  grid-template-columns: 52% 48%;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.plan-section, .log-section {
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  flex-shrink: 0;
}

.section-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-sm {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  height: 24px;
}

.log-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Collapsible Plan Form Panel */
.plan-form-panel {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.3rem;
  flex-shrink: 0;
}

.form-row {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.form-fg-group {
  flex: 2;
  min-width: 180px;
}

.form-tank-group {
  flex: 2;
  min-width: 180px;
}

.form-qty-group {
  flex: 1;
  min-width: 70px;
}

.form-group label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
}

.form-group select, .form-group input {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
  outline: none;
  height: 28px;
}

.tank-auto-box {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  min-height: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tank-auto-box.loaded {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
}

.tank-auto-box.error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

.btn-submit-plan {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  height: 28px;
  white-space: nowrap;
}

/* Scrollable Tables inside Cards */
.table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th {
  background: #f1f5f9;
  color: #475569;
  padding: 0.3rem 0.45rem;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 #cbd5e1;
  white-space: nowrap;
}

.data-table td {
  padding: 0.3rem 0.45rem;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.row-active-plan {
  background-color: #eff6ff !important;
  font-weight: 600;
}

.tag-ok {
  background: #dcfce7;
  color: #15803d;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.tag-dup {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.tag-wrong {
  background: #fef3c7;
  color: #b45309;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.row-dup {
  background-color: #fff1f2;
}

.row-wrong {
  background-color: #fffbeb;
}

/* Simulation Bar Footer */
.sim-scanner-bar {
  background: #0f172a;
  color: #ffffff;
  padding: 0.2rem 0.75rem;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  height: 34px;
}

.sim-wrapper {
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sim-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}

.sim-wrapper input {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  height: 24px;
}

.sim-wrapper input:focus {
  outline: none;
  border-color: #38bdf8;
}

.btn-sim-send {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  height: 24px;
  white-space: nowrap;
}

.btn-sim-send:hover {
  background: #0369a1;
}

.btn-sim-sample {
  background: #334155;
  color: #e2e8f0;
  border: none;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  height: 24px;
  white-space: nowrap;
}

.btn-sim-sample:hover {
  background: #475569;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: 10px;
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.05rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #64748b;
}

.modal-body {
  padding: 1rem 1.25rem;
}

.modal-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.wa-section {
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
}

.wa-preview {
  background: #111b21;
  color: #e9edef;
  font-family: monospace;
  white-space: pre-wrap;
  padding: 0.75rem;
  border-radius: 6px;
  margin: 0.5rem 0;
  font-size: 0.8rem;
  line-height: 1.35;
  border-left: 4px solid #25d366;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.btn-wa-broadcast {
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary {
  background: #64748b;
  color: #ffffff;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
}

.hidden { display: none !important; }

.kiosk-station-badge {
  background: #0284c7;
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-user {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-logout-link {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding-left: 0.3rem;
  text-decoration: underline;
}
.btn-logout-link:hover {
  color: #ef4444;
}


/* --- Advanced FG Search Styles --- */
.fg-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.15rem;
}

.btn-adv-search {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 24px;
}

.btn-adv-search:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}

.fg-input-combo {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fg-quick-filter-input {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  outline: none;
  background: #f8fafc;
  height: 26px;
  transition: border-color 0.2s, background 0.2s;
}

.fg-quick-filter-input:focus {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.selected-fg-pill {
  margin-top: 0.25rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 5px;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-icon {
  font-size: 0.95rem;
}

.badge-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.badge-text strong {
  font-size: 0.8rem;
  color: #15803d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-text span {
  font-size: 0.7rem;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-remove-fg {
  background: none;
  border: none;
  font-size: 1.15rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}

.btn-remove-fg:hover {
  color: #dc2626;
}

/* Modal FG Search */
.modal-fg-search {
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-sub-badge {
  font-size: 0.72rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-weight: 700;
}

.fg-search-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  overflow: hidden;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

.fg-search-box {
  width: 100%;
  padding: 0.6rem 2.2rem 0.6rem 2.4rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
  height: 42px;
}

.fg-search-box:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 0.65rem;
  background: #e2e8f0;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-filter-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chip-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

.filter-chip {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.2rem 0.55rem;
  border-radius: 14px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.filter-chip.active {
  background: #1e40af;
  color: #ffffff;
  border-color: #1e40af;
}

.search-results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.25rem;
}

.hint-text {
  color: #0284c7;
  font-size: 0.72rem;
}

.fg-results-list {
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.25rem;
}

.fg-search-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fg-search-card:hover {
  background: #f8fafc;
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.fg-card-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.fg-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fg-code-badge {
  background: #eff6ff;
  color: #1e40af;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  border: 1px solid #bfdbfe;
  font-family: monospace;
}

.fg-id-tag {
  font-size: 0.68rem;
  color: #94a3b8;
}

.fg-card-name {
  font-size: 0.82rem;
  color: #1e293b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-card-select {
  background: #1e40af;
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 0.5rem;
  height: 32px;
}

.btn-card-select:hover {
  background: #1d4ed8;
}

.fg-modal-actions {
  margin-top: 0.35rem;
  display: flex;
  justify-content: flex-end;
}

/* =============================================================
   Mobile & Responsive Optimization Mode
   Targeted for Supervisors on Mobile Devices / Small Screens
   ============================================================= */

/* Default Mobile Tabs Hidden on Desktop */
.mobile-tabs {
  display: none;
}

/* 1. Viewport-based responsive rules for Phones & Tablets */
@media screen and (max-width: 900px) {
  body:not(.kiosk-mode) {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
  }
  body:not(.kiosk-mode) .main-container {
    height: auto !important;
    overflow: visible !important;
    padding: 0.4rem 0.5rem;
    gap: 0.45rem;
  }
  body:not(.kiosk-mode) .navbar {
    display: flex;
    flex-wrap: wrap;
    height: auto;
    padding: 0.45rem 0.65rem;
    gap: 0.35rem;
    align-items: center;
  }
  body:not(.kiosk-mode) .nav-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  body:not(.kiosk-mode) .nav-left h1 {
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body:not(.kiosk-mode) #subTitle {
    display: none !important;
  }
  body:not(.kiosk-mode) .nav-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
  }
  body:not(.kiosk-mode) #liveClock,
  body:not(.kiosk-mode) #scannerBadge {
    display: none !important;
  }
  body:not(.kiosk-mode) #statusBadge,
  body:not(.kiosk-mode) #btnNavRecon,
  body:not(.kiosk-mode) #userProfileBadge,
  body:not(.kiosk-mode) #btnModeToggle {
    height: 26px;
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
  }
  body:not(.kiosk-mode) .nav-center {
    width: 100%;
    order: 3;
    margin-top: 0.1rem;
  }
  body:not(.kiosk-mode) .line-selector-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
  body:not(.kiosk-mode) .line-selector-wrapper label {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
  }
  body:not(.kiosk-mode) .line-selector-wrapper select {
    flex: 1;
    width: 100%;
    height: 36px;
    font-size: 0.88rem;
    background: #1e293b;
    color: #38bdf8;
    border: 1px solid #334155;
    border-radius: 6px;
  }
  body:not(.kiosk-mode) .status-banner {
    padding: 0.35rem 0.6rem;
    min-height: 36px;
    gap: 0.5rem;
  }
  body:not(.kiosk-mode) .banner-icon {
    font-size: 1.25rem;
  }
  body:not(.kiosk-mode) .banner-content h2 {
    font-size: 0.88rem;
  }
  body:not(.kiosk-mode) .banner-content p {
    font-size: 0.75rem;
  }
  body:not(.kiosk-mode) .kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
  }
  body:not(.kiosk-mode) .kpi-card {
    padding: 0.4rem 0.25rem;
    text-align: center;
    align-items: center;
    border-radius: 8px;
  }
  body:not(.kiosk-mode) .kpi-label {
    font-size: 0.58rem;
    letter-spacing: 0.2px;
    white-space: nowrap;
    text-align: center;
  }
  body:not(.kiosk-mode) .kpi-value {
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.15;
    margin: 0.1rem 0;
    text-align: center;
  }
  body:not(.kiosk-mode) .kpi-sub {
    font-size: 0.62rem;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body:not(.kiosk-mode) .card-controls {
    grid-column: 1 / -1;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  }
  body:not(.kiosk-mode) .card-controls .kpi-label {
    font-size: 0.62rem;
    margin-bottom: 0.25rem;
    text-align: center;
  }
  body:not(.kiosk-mode) .btn-big-start,
  body:not(.kiosk-mode) .btn-big-stop {
    width: 100%;
    height: 46px;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  }
  body:not(.kiosk-mode) .control-sub {
    font-size: 0.65rem;
    margin-top: 0.2rem;
    text-align: center;
  }
  body:not(.kiosk-mode) .mobile-tabs {
    display: flex !important;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
    margin: 0.2rem 0 0.35rem 0;
    flex-shrink: 0;
  }
  body:not(.kiosk-mode) .m-tab-btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
  }
  body:not(.kiosk-mode) .m-tab-btn.active {
    background: #ffffff;
    color: #1e40af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  body:not(.kiosk-mode) .tab-badge {
    background: #3b82f6;
    color: #ffffff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
  }
  body:not(.kiosk-mode) .m-tab-btn.active .tab-badge {
    background: #1e40af;
  }
  body:not(.kiosk-mode) .content-split-grid {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  body:not(.kiosk-mode):not(.tab-logs) .plan-section {
    display: flex !important;
    width: 100%;
  }
  body:not(.kiosk-mode):not(.tab-logs) .log-section {
    display: none !important;
  }
  body:not(.kiosk-mode).tab-logs .plan-section {
    display: none !important;
  }
  body:not(.kiosk-mode).tab-logs .log-section {
    display: flex !important;
    width: 100%;
  }
  body:not(.kiosk-mode) .plan-form-panel {
    padding: 0.6rem;
    border-radius: 8px;
    background: #f8fafc;
  }
  body:not(.kiosk-mode) .form-row {
    flex-direction: column;
    gap: 0.55rem;
    align-items: stretch;
  }
  body:not(.kiosk-mode) .form-group {
    width: 100%;
    min-width: 0;
  }
  body:not(.kiosk-mode) .form-group label {
    font-size: 0.75rem;
    font-weight: 700;
  }
  body:not(.kiosk-mode) .form-group select,
  body:not(.kiosk-mode) .form-group input,
  body:not(.kiosk-mode) .tank-auto-box {
    height: 38px;
    font-size: 0.88rem;
    border-radius: 6px;
  }
  body:not(.kiosk-mode) .tank-auto-box {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.6rem;
  }
  body:not(.kiosk-mode) .btn-submit-plan {
    width: 100%;
    height: 42px;
    font-size: 0.95rem;
    font-weight: 800;
    border-radius: 6px;
    margin-top: 0.25rem;
  }
  body:not(.kiosk-mode) .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 420px;
    border-radius: 6px;
    border: 1px solid var(--border);
  }
  body:not(.kiosk-mode) #tblPlans {
    min-width: 560px;
  }
  body:not(.kiosk-mode) #tblScanLogs {
    min-width: 530px;
  }
  body:not(.kiosk-mode) .data-table th,
  body:not(.kiosk-mode) .data-table td {
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  body:not(.kiosk-mode) .data-table th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
    z-index: 2;
  }
  body:not(.kiosk-mode) .btn-sm {
    height: 32px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 5px;
  }
  body:not(.kiosk-mode) .sim-scanner-bar {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    height: auto;
  }
  body:not(.kiosk-mode) .sim-wrapper {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  body:not(.kiosk-mode) .sim-label {
    width: 100%;
    font-size: 0.7rem;
  }
  body:not(.kiosk-mode) .sim-wrapper input {
    flex: 1;
    min-width: 140px;
    height: 28px;
    font-size: 0.8rem;
  }
  body:not(.kiosk-mode) .btn-sim-send,
  body:not(.kiosk-mode) .btn-sim-sample {
    height: 28px;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
  body:not(.kiosk-mode) .modal-card {
    width: 95%;
    max-height: 88vh;
    border-radius: 10px;
    margin: 0 auto;
  }
  body:not(.kiosk-mode) .modal-header h2 {
    font-size: 0.95rem;
  }
  body:not(.kiosk-mode) .modal-table-wrap table {
    min-width: 540px;
  }
  body:not(.kiosk-mode) .modal-actions {
    flex-direction: column;
    gap: 0.4rem;
  }
  body:not(.kiosk-mode) .btn-wa-broadcast,
  body:not(.kiosk-mode) .btn-secondary {
    width: 100%;
    height: 42px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 2. Explicit body.mobile-mode overrides (also works on desktop testing) */
body.mobile-mode:not(.kiosk-mode) {
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
}
body.mobile-mode:not(.kiosk-mode) .main-container {
  height: auto !important;
  overflow: visible !important;
  padding: 0.4rem 0.5rem;
  gap: 0.45rem;
}
body.mobile-mode:not(.kiosk-mode) .navbar {
  display: flex;
  flex-wrap: wrap;
  height: auto;
  padding: 0.45rem 0.65rem;
  gap: 0.35rem;
  align-items: center;
}
body.mobile-mode:not(.kiosk-mode) .nav-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}
body.mobile-mode:not(.kiosk-mode) .nav-left h1 {
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile-mode:not(.kiosk-mode) #subTitle {
  display: none !important;
}
body.mobile-mode:not(.kiosk-mode) .nav-right {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
body.mobile-mode:not(.kiosk-mode) #liveClock,
body.mobile-mode:not(.kiosk-mode) #scannerBadge {
  display: none !important;
}
body.mobile-mode:not(.kiosk-mode) #statusBadge,
body.mobile-mode:not(.kiosk-mode) #btnNavRecon,
body.mobile-mode:not(.kiosk-mode) #userProfileBadge,
body.mobile-mode:not(.kiosk-mode) #btnModeToggle {
  height: 26px;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
}
body.mobile-mode:not(.kiosk-mode) .nav-center {
  width: 100%;
  order: 3;
  margin-top: 0.1rem;
}
body.mobile-mode:not(.kiosk-mode) .line-selector-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
body.mobile-mode:not(.kiosk-mode) .line-selector-wrapper select {
  flex: 1;
  width: 100%;
  height: 36px;
  font-size: 0.88rem;
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 6px;
}
body.mobile-mode:not(.kiosk-mode) .status-banner {
  padding: 0.35rem 0.6rem;
  min-height: 36px;
  gap: 0.5rem;
}
body.mobile-mode:not(.kiosk-mode) .kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
body.mobile-mode:not(.kiosk-mode) .kpi-card {
  padding: 0.4rem 0.25rem;
  text-align: center;
  align-items: center;
  border-radius: 8px;
}
body.mobile-mode:not(.kiosk-mode) .kpi-label {
  font-size: 0.58rem;
  white-space: nowrap;
  text-align: center;
}
body.mobile-mode:not(.kiosk-mode) .kpi-value {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.15;
  margin: 0.1rem 0;
  text-align: center;
}
body.mobile-mode:not(.kiosk-mode) .kpi-sub {
  font-size: 0.62rem;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile-mode:not(.kiosk-mode) .card-controls {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
body.mobile-mode:not(.kiosk-mode) .card-controls .kpi-label {
  font-size: 0.62rem;
  margin-bottom: 0.25rem;
  text-align: center;
}
body.mobile-mode:not(.kiosk-mode) .btn-big-start,
body.mobile-mode:not(.kiosk-mode) .btn-big-stop {
  width: 100%;
  height: 46px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
body.mobile-mode:not(.kiosk-mode) .control-sub {
  font-size: 0.65rem;
  margin-top: 0.2rem;
  text-align: center;
}
body.mobile-mode:not(.kiosk-mode) .mobile-tabs {
  display: flex !important;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
  margin: 0.2rem 0 0.35rem 0;
  flex-shrink: 0;
}
body.mobile-mode:not(.kiosk-mode) .m-tab-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}
body.mobile-mode:not(.kiosk-mode) .m-tab-btn.active {
  background: #ffffff;
  color: #1e40af;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
body.mobile-mode:not(.kiosk-mode) .tab-badge {
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
body.mobile-mode:not(.kiosk-mode) .m-tab-btn.active .tab-badge {
  background: #1e40af;
}
body.mobile-mode:not(.kiosk-mode) .content-split-grid {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
}
body.mobile-mode:not(.kiosk-mode):not(.tab-logs) .plan-section {
  display: flex !important;
  width: 100%;
}
body.mobile-mode:not(.kiosk-mode):not(.tab-logs) .log-section {
  display: none !important;
}
body.mobile-mode:not(.kiosk-mode).tab-logs .plan-section {
  display: none !important;
}
body.mobile-mode:not(.kiosk-mode).tab-logs .log-section {
  display: flex !important;
  width: 100%;
}
body.mobile-mode:not(.kiosk-mode) .plan-form-panel {
  padding: 0.6rem;
  border-radius: 8px;
  background: #f8fafc;
}
body.mobile-mode:not(.kiosk-mode) .form-row {
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
}
body.mobile-mode:not(.kiosk-mode) .form-group {
  width: 100%;
  min-width: 0;
}
body.mobile-mode:not(.kiosk-mode) .form-group label {
  font-size: 0.75rem;
  font-weight: 700;
}
body.mobile-mode:not(.kiosk-mode) .form-group select,
body.mobile-mode:not(.kiosk-mode) .form-group input,
body.mobile-mode:not(.kiosk-mode) .tank-auto-box {
  height: 38px;
  font-size: 0.88rem;
  border-radius: 6px;
}
body.mobile-mode:not(.kiosk-mode) .tank-auto-box {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
}
body.mobile-mode:not(.kiosk-mode) .btn-submit-plan {
  width: 100%;
  height: 42px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 6px;
  margin-top: 0.25rem;
}
body.mobile-mode:not(.kiosk-mode) .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 420px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
body.mobile-mode:not(.kiosk-mode) #tblPlans {
  min-width: 560px;
}
body.mobile-mode:not(.kiosk-mode) #tblScanLogs {
  min-width: 530px;
}
body.mobile-mode:not(.kiosk-mode) .data-table th,
body.mobile-mode:not(.kiosk-mode) .data-table td {
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
body.mobile-mode:not(.kiosk-mode) .data-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 2;
}
body.mobile-mode:not(.kiosk-mode) .btn-sm {
  height: 32px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 5px;
}
body.mobile-mode:not(.kiosk-mode) .sim-scanner-bar {
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  height: auto;
}
body.mobile-mode:not(.kiosk-mode) .sim-wrapper {
  flex-wrap: wrap;
  gap: 0.3rem;
}
body.mobile-mode:not(.kiosk-mode) .sim-label {
  width: 100%;
  font-size: 0.7rem;
}
body.mobile-mode:not(.kiosk-mode) .sim-wrapper input {
  flex: 1;
  min-width: 140px;
  height: 28px;
  font-size: 0.8rem;
}
body.mobile-mode:not(.kiosk-mode) .btn-sim-send,
body.mobile-mode:not(.kiosk-mode) .btn-sim-sample {
  height: 28px;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}
body.mobile-mode:not(.kiosk-mode) .modal-card {
  width: 95%;
  max-height: 88vh;
  border-radius: 10px;
  margin: 0 auto;
}
body.mobile-mode:not(.kiosk-mode) .modal-header h2 {
  font-size: 0.95rem;
}
body.mobile-mode:not(.kiosk-mode) .modal-table-wrap table {
  min-width: 540px;
}
body.mobile-mode:not(.kiosk-mode) .modal-actions {
  flex-direction: column;
  gap: 0.4rem;
}
body.mobile-mode:not(.kiosk-mode) .btn-wa-broadcast,
body.mobile-mode:not(.kiosk-mode) .btn-secondary {
  width: 100%;
  height: 42px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
