/* ============================================================================
   Smart Vending Web Console — Unified Theme (Light Default / Dark) & Mobile UX
   ============================================================================ */

:root,
body[data-theme="light"] {
  --bg-dark: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.96);
  --card-bg-secondary: #f8fafc;
  --card-border: #cbd5e1;
  --card-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-blue: #2563eb;
  --accent-hover: #1d4ed8;
  --color-primary: #2563eb;
  --color-info: #0284c7;
  --surface-elevated: #ffffff;
  --surface-muted: #f1f5f9;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --table-row-hover: rgba(37, 99, 235, 0.05);
  --shadow-soft: 0 4px 20px rgba(15, 23, 42, 0.06);
}

body[data-theme="dark"] {
  --bg-dark: #0f172a;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --card-bg: rgba(30, 41, 59, 0.78);
  --card-bg-secondary: rgba(15, 23, 42, 0.65);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-hover: #2563eb;
  --color-primary: #3b82f6;
  --color-info: #06b6d4;
  --surface-elevated: #1e293b;
  --surface-muted: rgba(15, 23, 42, 0.55);
  --input-bg: rgba(15, 23, 42, 0.75);
  --input-border: rgba(255, 255, 255, 0.14);
  --table-row-hover: rgba(255, 255, 255, 0.03);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg-gradient) !important;
  color: var(--text-primary) !important;
  transition: background 0.25s ease, color 0.25s ease;
}

.dashboard-container,
.branch-container,
.control-container,
.dashboard-layout,
.main-content,
.tab-panel,
.card,
.report-card,
.table-card,
.card-inner,
.portfolio-card,
.left-column,
.right-column {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

.table-wrapper table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.table-wrapper th,
.table-wrapper td {
  white-space: nowrap;
  vertical-align: middle;
}

.badge,
.badge-gw-phajay,
.badge-gw-bcel {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portfolio-card strong {
  white-space: nowrap;
}

/* ============================================================================
   EASY PAY TERMINAL — Modern Brand Identity & Logo Styling
   ============================================================================ */
.logo-icon {
  width: 58px !important;
  height: 58px !important;
  min-width: 58px !important;
  background: transparent url('/logo_icon_only.png?v=1') no-repeat center / contain !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.16));
  display: inline-block;
  flex-shrink: 0;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.logo-icon:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: none !important;
  filter: drop-shadow(0 5px 12px rgba(2, 132, 199, 0.32));
}

.logo-icon::after {
  display: none !important;
}

.login-header .logo-icon {
  width: 138px !important;
  height: 138px !important;
  min-width: 138px !important;
  margin: 0 auto 10px !important;
  background: transparent url('/logo_icon_only.png?v=1') no-repeat center / contain !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.18));
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
  min-width: 0;
}

.brand-heading {
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: 0.6px !important;
  font-size: 1.28rem !important;
  margin: 0 !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: none !important;
  white-space: nowrap;
}

body[data-theme="dark"] .brand-heading {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  background: none !important;
}

.brand-heading span {
  font-weight: 800;
  color: #0284c7 !important;
  -webkit-text-fill-color: #0284c7 !important;
  opacity: 1;
}

body[data-theme="dark"] .brand-heading span {
  color: #38bdf8 !important;
  -webkit-text-fill-color: #38bdf8 !important;
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary) !important;
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-badge {
  display: inline-block;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  background: rgba(6, 182, 212, 0.12);
  color: #0284c7;
  border: 1px solid rgba(6, 182, 212, 0.28);
}

body[data-theme="dark"] .brand-badge {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border-color: rgba(52, 211, 153, 0.35);
}

/* Light Mode Surface & Inline Style Harmonization */
body:not([data-theme="dark"]) .app-header,
body:not([data-theme="dark"]) .sidebar,
body:not([data-theme="dark"]) .top-bar,
body:not([data-theme="dark"]) .top-nav,
body:not([data-theme="dark"]) .glass,
body:not([data-theme="dark"]) .glass-panel,
body:not([data-theme="dark"]) .card,
body:not([data-theme="dark"]) .report-card,
body:not([data-theme="dark"]) .portfolio-card,
body:not([data-theme="dark"]) .stat-card,
body:not([data-theme="dark"]) .outlet-card,
body:not([data-theme="dark"]) .machine-card,
body:not([data-theme="dark"]) .control-card,
body:not([data-theme="dark"]) .card-inner,
body:not([data-theme="dark"]) .summary-card,
body:not([data-theme="dark"]) .login-container,
body:not([data-theme="dark"]) .login-box,
body:not([data-theme="dark"]) .modal-content,
body:not([data-theme="dark"]) .custom-dialog-box {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-primary) !important;
}

body:not([data-theme="dark"]) .sidebar {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

body:not([data-theme="dark"]) .app-header,
body:not([data-theme="dark"]) .top-bar,
body:not([data-theme="dark"]) .top-nav {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #cbd5e1 !important;
}

body:not([data-theme="dark"]) .nav-item {
  color: #334155 !important;
}

body:not([data-theme="dark"]) .nav-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

body:not([data-theme="dark"]) .nav-item.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  font-weight: 600;
}

body:not([data-theme="dark"]) input:not([type="checkbox"]):not([type="radio"]),
body:not([data-theme="dark"]) select,
body:not([data-theme="dark"]) textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body:not([data-theme="dark"]) select option {
  background: #ffffff !important;
  color: #0f172a !important;
}

body:not([data-theme="dark"]) th {
  color: #334155 !important;
  background: #f8fafc !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body:not([data-theme="dark"]) td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body:not([data-theme="dark"]) tr:hover td {
  background: var(--table-row-hover) !important;
}

/* Harmonize dark inline backgrounds when in Light Mode (excluding modal-overlay backdrop) */
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0,0,0,0.2)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0, 0, 0, 0.2)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0,0,0,0.25)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0, 0, 0, 0.25)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0,0,0,0.3)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(0, 0, 0, 0.3)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(255,255,255,0.05)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(255, 255, 255, 0.05)"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(15, 23, 42"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="rgba(30, 41, 59"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="background: #1e293b"],
body:not([data-theme="dark"]) :not(.modal-overlay)[style*="background:#1e293b"] {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Ensure Modal Overlay Backdrop is always semi-transparent (never opaque white) */
body:not([data-theme="dark"]) .modal-overlay {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

body[data-theme="dark"] .modal-overlay {
  background: rgba(2, 6, 23, 0.72) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

body:not([data-theme="dark"]) .modal-content,
body:not([data-theme="dark"]) .modal-content h3,
body:not([data-theme="dark"]) .modal-content h4,
body:not([data-theme="dark"]) .custom-dialog-msg {
  color: #0f172a !important;
}

/* ============================================================================
   Interactive Sensor Toggle Switch Card (Device Control Page)
   ============================================================================ */
.sensor-switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.22s ease;
  border: 2px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}

.sensor-switch-card.is-on {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.1) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.14);
}

.sensor-switch-card.is-off {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.1) !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.14);
}

.sensor-switch-card:hover {
  transform: translateY(-1px);
}

.sensor-switch-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sensor-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sensor-dot.on {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
}

.sensor-dot.off {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.sensor-switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sensor-switch-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sensor-switch-text small {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.sensor-switch-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sensor-state-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.sensor-state-pill.on {
  background: rgba(16, 185, 129, 0.2);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

body[data-theme="dark"] .sensor-state-pill.on {
  color: #34d399;
}

.sensor-state-pill.off {
  background: rgba(245, 158, 11, 0.2);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

body[data-theme="dark"] .sensor-state-pill.off {
  color: #fbbf24;
}

.sensor-toggle-track {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  padding: 3px;
  display: flex;
  align-items: center;
  transition: background 0.25s ease, box-shadow 0.25s ease;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sensor-switch-card.is-off .sensor-toggle-track {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.sensor-toggle-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateX(24px);
}

.sensor-switch-card.is-off .sensor-toggle-thumb {
  transform: translateX(0);
}

.sensor-switch-card.is-danger-off {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.14);
}

.sensor-dot.off-danger {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

.sensor-state-pill.off-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

body[data-theme="dark"] .sensor-state-pill.off-danger {
  color: #f87171;
}

.sensor-switch-card.is-danger-off .sensor-toggle-track {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

body:not([data-theme="dark"]) [style*="color: #e2e8f0"],
body:not([data-theme="dark"]) [style*="color: #f8fafc"],
body:not([data-theme="dark"]) [style*="color: #a7f3d0"],
body:not([data-theme="dark"]) [style*="color: #93c5fd"] {
  color: #1e293b !important;
}

/* Keep white text on colored solid buttons in Light Mode */
body:not([data-theme="dark"]) .btn-primary,
body:not([data-theme="dark"]) .btn-success,
body:not([data-theme="dark"]) .btn-danger,
body:not([data-theme="dark"]) .btn-info,
body:not([data-theme="dark"]) .primary-btn,
body:not([data-theme="dark"]) .success-btn,
body:not([data-theme="dark"]) .warning-btn,
body:not([data-theme="dark"]) .danger-btn,
body:not([data-theme="dark"]) .ctrl-btn,
body:not([data-theme="dark"]) .btn-view,
body:not([data-theme="dark"]) .btn-add-machine,
body:not([data-theme="dark"]) .btn-icon-box {
  color: #ffffff !important;
}

body:not([data-theme="dark"]) .btn-outline,
body:not([data-theme="dark"]) .btn-secondary,
body:not([data-theme="dark"]) .secondary-btn,
body:not([data-theme="dark"]) .back-btn,
body:not([data-theme="dark"]) .btn-card {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body:not([data-theme="dark"]) .btn-card small {
  color: #475569 !important;
}

body:not([data-theme="dark"]) .btn-outline:hover,
body:not([data-theme="dark"]) .btn-secondary:hover,
body:not([data-theme="dark"]) .secondary-btn:hover,
body:not([data-theme="dark"]) .back-btn:hover,
body:not([data-theme="dark"]) .btn-card:hover {
  background: #e2e8f0 !important;
}

/* ============================================================================
   Header Theme & Language Switcher Pills
   ============================================================================ */
.header-prefs-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pref-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.pref-toggle-btn:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.pref-toggle-btn .pref-badge {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-blue);
  font-weight: 700;
}

.floating-prefs-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================================
   Custom Roles & Granular Permissions Builder UI (Compact & Complete)
   ============================================================================ */
.roles-management-panel {
  margin-bottom: 14px;
  padding: 12px 16px !important;
}

.role-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.role-item-card {
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.role-item-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.role-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.role-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}

.role-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.role-item-actions .btn-small {
  padding: 2px 7px !important;
  font-size: 0.7rem !important;
  border-radius: 6px !important;
  line-height: 1.2 !important;
}

.role-item-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--card-border);
}

.role-meta-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

.role-meta-pill.sys {
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent-blue);
}

.role-meta-pill.custom {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
}

.role-meta-pill.users {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}

body[data-theme="dark"] .role-meta-pill.users {
  color: #fbbf24;
}

.role-meta-pill.count {
  background: rgba(100, 116, 139, 0.13);
  color: var(--text-secondary);
}

.role-item-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.25;
  flex: 1 1 100%;
  margin-top: 1px;
}

.role-perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3.5px;
  margin-top: 2px;
}

.role-perm-chip {
  font-size: 0.67rem;
  padding: 1.5px 6px;
  border-radius: 5px;
  background: rgba(37, 99, 235, 0.09);
  color: var(--accent-blue);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.role-perm-chip.action-chip {
  background: rgba(16, 185, 129, 0.11);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.26);
}

body[data-theme="dark"] .role-perm-chip.action-chip {
  color: #34d399;
}

.perm-groups-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.perm-group-box {
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  padding: 10px 12px;
}

.perm-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.perm-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perm-check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  transition: background 0.15s ease;
}

.perm-check-item:hover {
  background: var(--table-row-hover);
}

.perm-check-item input[type="checkbox"] {
  width: 17px !important;
  height: 17px !important;
  accent-color: var(--accent-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================================
   Mobile Slide-Over Left Drawer & Responsive Layout (<= 900px)
   ============================================================================ */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 2400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-close-mobile {
  display: none;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  html,
  body {
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 8px !important;
  }

  .dashboard-container,
  .branch-container,
  .control-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 100vh !important;
    gap: 12px !important;
  }

  .dashboard-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    gap: 12px !important;
  }

  .main-content,
  .tab-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .sidebar,
  #main-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 285px !important;
    max-width: 84vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 2500 !important;
    border-radius: 0 16px 16px 0 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 18px 14px 32px 14px !important;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.28) !important;
  }

  body.sidebar-open .sidebar,
  body.sidebar-open #main-sidebar,
  .sidebar.open,
  #main-sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar .nav-menu,
  #main-sidebar .nav-menu {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 6px !important;
  }

  .sidebar .nav-item,
  #main-sidebar .nav-item {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    padding: 10px 12px !important;
    font-size: 0.87rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .sidebar .nav-item.sub-item,
  #main-sidebar .nav-item.sub-item {
    padding-left: 12px !important;
    font-size: 0.87rem !important;
  }

  .sidebar-close-mobile {
    display: inline-flex !important;
  }

  .mobile-menu-btn,
  #btn-mobile-menu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--card-border) !important;
    background: var(--surface-elevated) !important;
    color: var(--text-primary) !important;
  }

  .app-header {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 60px !important;
    padding: 12px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .header-logo {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    text-align: left !important;
  }

  .header-logo .logo-icon {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    flex-shrink: 0 !important;
  }

  .app-header h1 {
    font-size: 1.05rem !important;
    line-height: 1.3 !important;
    text-align: left !important;
    flex: 1 !important;
  }

  .user-profile {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--card-border) !important;
  }

  .user-info {
    align-items: flex-start !important;
    text-align: left !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .user-info strong {
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
  }

  .user-info small {
    font-size: 0.7rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 155px !important;
  }

  .header-action-btns {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  .header-prefs-bar {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
  }

  .pref-toggle-btn {
    padding: 5px 8px !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
  }

  .pref-toggle-btn .pref-label,
  .pref-toggle-btn .pref-badge,
  .hide-on-mobile {
    display: none !important;
  }

  #btn-logout {
    padding: 5px 10px !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
  }

  .card,
  .report-card,
  .table-card,
  .portfolio-card {
    padding: 14px !important;
  }

  .portfolio-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .portfolio-card strong {
    white-space: nowrap !important;
    font-size: 1.65rem !important;
  }

  .control-actions-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .control-actions-grid .btn-cmd {
    width: 100% !important;
    white-space: nowrap !important;
    padding: 11px 14px !important;
  }

  .ota-action-row {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .ota-action-row input,
  .ota-action-row button {
    width: 100% !important;
    min-width: 0 !important;
  }

  .admin-grid,
  .control-layout,
  .portfolio-charts-container,
  .machines-grid,
  .outlets-grid,
  .gateway-config-grid,
  .report-grid-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    height: auto !important;
    gap: 14px !important;
  }

  .filters-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .filters-grid .input-group,
  .filters-grid > button,
  .filters-grid > .btn {
    width: 100% !important;
    min-width: 0 !important;
  }

  .pagination-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: center !important;
  }

  .pagination-wrapper > div {
    justify-content: center !important;
  }

  .table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   Impeccable Financial Precision & Operational Polish
   ============================================================ */
.portfolio-card strong,
.outlet-card-row strong,
.data-table td,
.badge,
code,
#fleet-online-count,
#fleet-working-count,
#fleet-offline-count,
#fleet-outlets-count {
  font-variant-numeric: tabular-nums;
}

body:not([data-theme="dark"]) #home-fleet-health-strip {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
}

body:not([data-theme="dark"]) #fleet-online-count {
  color: #059669 !important;
}

body:not([data-theme="dark"]) #fleet-working-count {
  color: #d97706 !important;
}

body:not([data-theme="dark"]) #fleet-offline-count {
  color: #dc2626 !important;
}

body:not([data-theme="dark"]) #fleet-outlets-count {
  color: #2563eb !important;
}

.header-action-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Compact Abbreviated Screen Type Badges (3.5" / 4.3") */
.badge-screen-35,
.badge-screen-43 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge-screen-35 {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-screen-43 {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

body[data-theme="dark"] .badge-screen-35 {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.38);
}

body[data-theme="dark"] .badge-screen-43 {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.38);
}

/* Single-Line Table Rows for Clean Filtering & Scanning */
.single-line-table th,
.single-line-table td,
#home-tracker-table th,
#home-tracker-table td,
#home-tracker-table .badge,
#home-tracker-table .btn,
#home-tracker-table .action-cell-content {
  white-space: nowrap !important;
  vertical-align: middle !important;
}

#home-tracker-table td {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

/* ==========================================================================
   HOME: SALES BY MACHINE TYPE CARDS GRID
   ========================================================================== */
.machine-type-sales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.machine-type-analytics-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.machine-type-donut-box {
  padding: 16px;
  border-radius: 14px;
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.machine-type-donut-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.machine-type-ranked-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.machine-type-rank-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.machine-type-rank-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
}

.machine-type-rank-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.machine-type-rank-bar-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.machine-type-rank-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

@media (max-width: 820px) {
  .machine-type-analytics-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

.machine-type-sales-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.machine-type-sales-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
}

.machine-type-sales-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.machine-type-sales-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.machine-type-sales-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--card-border);
}

.machine-type-metric-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.machine-type-metric-box span {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.machine-type-metric-box strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.machine-type-metric-box small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   DEVICE SETTINGS: MASTER-DETAIL SPLIT LAYOUT (LEFT LIST + DETAIL/EDIT PANEL)
   ========================================================================== */
.device-master-detail-grid {
  display: grid;
  grid-template-columns: minmax(310px, 410px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.device-select-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 4px;
}

.device-select-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-bg-secondary);
  border: 1.5px solid var(--card-border);
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-select-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.05);
}

.device-select-card.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.14);
}

.device-select-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.device-select-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@media (max-width: 960px) {
  .device-master-detail-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .device-select-cards-list {
    max-height: 360px;
  }
}

/* ==========================================================================
   PROFESSIONAL OUTLET CARDS (DARK HEADER BANNER + DEVICE COUNTS + SALES)
   ========================================================================== */
.outlets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
  gap: 20px !important;
}

.outlet-card.outlet-card-pro {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 16px !important;
  display: flex;
  flex-direction: column;
  gap: 0 !important;
  border: 1px solid var(--card-border) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.outlet-card.outlet-card-pro:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.55) !important;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22) !important;
}

.outlet-card-header-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #ffffff !important;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
}

.outlet-banner-title-group {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.outlet-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.16) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  flex-shrink: 0;
}

.outlet-banner-name {
  font-size: 1.06rem;
  font-weight: 800;
  color: #ffffff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.outlet-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.outlet-gw-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  line-height: 1.2;
}

.outlet-gw-chip.gw-pj {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
}

.outlet-gw-chip.gw-bcel {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(16, 185, 129, 0.5) !important;
}

.outlet-card-header-banner .btn-share-outlet-card {
  padding: 4px 9px !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
}

.outlet-card-header-banner .btn-share-outlet-card:hover {
  background: rgba(56, 189, 248, 0.28) !important;
  border-color: #38bdf8 !important;
}

.outlet-card-body-pro {
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.outlet-devices-section {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outlet-devices-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.outlet-type-pills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.outlet-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(56, 189, 248, 0.26);
}

.outlet-type-pill.zero {
  opacity: 0.58;
  background: transparent;
  border-color: var(--card-border);
  font-weight: 600;
}

.outlet-type-pill strong {
  color: #0284c7;
  font-weight: 800;
}

body[data-theme="dark"] .outlet-type-pill strong {
  color: #38bdf8;
}

.outlet-sales-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.outlet-sales-box {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--card-bg-secondary);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.outlet-sales-box.today {
  border-left: 3px solid #10b981;
}

.outlet-sales-box.month {
  border-left: 3px solid #6366f1;
}

.outlet-sales-box span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.outlet-sales-box strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.outlet-sales-box.today strong {
  color: #059669;
}

body[data-theme="dark"] .outlet-sales-box.today strong {
  color: #34d399;
}

.outlet-card-footer-bar {
  padding: 10px 16px;
  border-top: 1px solid var(--card-border);
  background: var(--card-bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

/* ============================================================================
   Realistic 3-Type Machine Control Visuals (Washer / Dryer / Detergent Vending)
   Modeled after actual commercial machines:
   1. Commercial Washer (OASIS stainless steel + top dark header + blue LCD + round door)
   2. Industrial Tumble Dryer (Stainless stacked dryer + honeycomb drum + middle dark console)
   3. Detergent Vending Machine (4-shelf spiral coils + red LED 0000 + 4 yellow push buttons)
   ============================================================================ */

.machine-type-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.machine-type-pill-badge.type-washer {
  background: rgba(56, 189, 248, 0.16) !important;
  color: #0284c7 !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
}

body[data-theme="dark"] .machine-type-pill-badge.type-washer {
  color: #38bdf8 !important;
}

.machine-type-pill-badge.type-dryer {
  background: rgba(249, 115, 22, 0.16) !important;
  color: #ea580c !important;
  border: 1px solid rgba(249, 115, 22, 0.42) !important;
}

body[data-theme="dark"] .machine-type-pill-badge.type-dryer {
  color: #fb923c !important;
}

.machine-type-pill-badge.type-vending {
  background: rgba(234, 179, 8, 0.18) !important;
  color: #b45309 !important;
  border: 1px solid rgba(234, 179, 8, 0.48) !important;
}

body[data-theme="dark"] .machine-type-pill-badge.type-vending {
  color: #facc15 !important;
}

.mv-unit {
  width: 106px;
  height: 138px;
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.26), inset 0 1px 1px rgba(255, 255, 255, 0.65);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  box-sizing: border-box;
}

.mv-unit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.34);
}

.mv-unit.mv-lg {
  width: 118px;
  height: 152px;
}

/* Status Glow Ring on Active/Working */
.mv-unit.working {
  box-shadow: 0 0 0 2px #f59e0b, 0 8px 20px rgba(245, 158, 11, 0.35) !important;
}

.mv-unit.offline {
  filter: saturate(0.65);
  opacity: 0.9;
}

/* ----------------------------------------------------------------------------
   1. COMMERCIAL WASHER (.mv-washer — OASIS Stainless Steel Style)
   ---------------------------------------------------------------------------- */
.mv-unit.mv-washer {
  background: linear-gradient(155deg, #e2e8f0 0%, #cbd5e1 48%, #94a3b8 100%) !important;
  border: 1.5px solid #64748b !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mv-washer-header {
  width: 100%;
  height: 27px;
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%) !important;
  border-bottom: 2px solid #475569 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 5px;
  box-sizing: border-box;
}

.mv-washer-brand {
  display: flex;
  flex-direction: column;
  gap: 1.5px;
}

.mv-washer-brand-txt {
  font-size: 5.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #f8fafc !important;
  font-family: 'Outfit', sans-serif;
  line-height: 1;
}

.mv-washer-green-bar {
  width: 20px;
  height: 3px;
  background: #84cc16 !important;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(132, 204, 22, 0.6);
}

.mv-washer-lcd {
  width: 36px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
  border: 1px solid #7dd3fc !important;
  box-shadow: 0 0 7px rgba(56, 189, 248, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 6.5px;
  font-weight: 900;
  color: #ffffff !important;
  letter-spacing: 0.3px;
}

.mv-unit.mv-washer.working .mv-washer-lcd {
  background: linear-gradient(135deg, #0369a1, #06b6d4) !important;
  border-color: #fde047 !important;
  color: #fef08a !important;
  animation: led-blink 0.9s infinite alternate;
}

.mv-unit.mv-washer.offline .mv-washer-lcd {
  background: #0f172a !important;
  border-color: #475569 !important;
  box-shadow: none !important;
  color: #ef4444 !important;
}

.mv-washer-paybox {
  width: 18px;
  height: 18px;
  background: #0f172a !important;
  border: 1px solid #475569 !important;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2px;
  box-sizing: border-box;
}

.mv-washer-slot {
  width: 2px;
  height: 7px;
  background: #94a3b8 !important;
  border-radius: 1px;
}

.mv-washer-paystrip {
  width: 100%;
  height: 2.5px;
  background: #84cc16 !important;
  border-radius: 1px;
}

.mv-washer-body {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px;
  box-sizing: border-box;
}

.mv-washer-bezel {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f1f5f9 0%, #cbd5e1 60%, #94a3b8 100%) !important;
  border: 1.5px solid #64748b !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.9), 0 4px 8px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mv-washer-top-badge {
  position: absolute;
  top: 3px;
  width: 20px;
  height: 4px;
  border-radius: 3px;
  background: #15803d !important;
  border: 0.5px solid #86efac;
}

.mv-washer-door {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 7px solid #1e293b !important;
  background: radial-gradient(circle at 30% 30%, #1e293b 0%, #090d16 80%) !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 2px 6px rgba(0, 0, 0, 0.85);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-unit.mv-washer.working .mv-washer-door {
  border-color: #0284c7 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.55), inset 0 2px 6px rgba(0, 0, 0, 0.85);
}

.mv-washer-handle {
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: #020617 !important;
  border: 1px solid #475569 !important;
  z-index: 3;
}

.mv-washer-drum {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #1e293b 45%, #0f172a 100%) !important;
}

.mv-washer-water-idle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px dashed rgba(56, 189, 248, 0.45);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, transparent 70%);
  box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.35);
}

.mv-washer-spin-load {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #0284c7, #38bdf8, #e0f2fe, #2563eb, #06b6d4, #0284c7) !important;
  animation: drum-spin 1.1s linear infinite;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.mv-washer-suds {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 28%, rgba(255, 255, 255, 0.85) 2px, transparent 3px),
    radial-gradient(circle at 70% 35%, rgba(255, 255, 255, 0.8) 2.5px, transparent 3.5px),
    radial-gradient(circle at 40% 72%, rgba(255, 255, 255, 0.85) 2px, transparent 3px),
    radial-gradient(circle at 65% 68%, rgba(255, 255, 255, 0.75) 1.8px, transparent 3px);
  animation: bubbles-float 1.2s ease-in-out infinite alternate;
  pointer-events: none;
}

.mv-washer-plinth {
  width: 100%;
  height: 8px;
  background: #475569 !important;
  border-top: 1px solid #334155 !important;
}

/* ----------------------------------------------------------------------------
   2. INDUSTRIAL TUMBLE DRYER (.mv-dryer — Stainless Steel + Honeycomb Drum + Dark Console)
   ---------------------------------------------------------------------------- */
.mv-unit.mv-dryer {
  background: linear-gradient(155deg, #e2e8f0 0%, #cbd5e1 48%, #94a3b8 100%) !important;
  border: 1.5px solid #64748b !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mv-dryer-header-bar {
  width: 100%;
  height: 18px;
  background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%) !important;
  border-bottom: 1.5px solid #64748b !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  box-sizing: border-box;
}

.mv-dryer-badge {
  background: linear-gradient(135deg, #ea580c, #dc2626) !important;
  color: #ffffff !important;
  font-size: 5px;
  font-weight: 900;
  padding: 1.5px 4px;
  border-radius: 3px;
  letter-spacing: 0.4px;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.4);
}

.mv-dryer-header-leds {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mv-dryer-led-dot {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: #f97316 !important;
  box-shadow: 0 0 4px #f97316;
}

.mv-unit.mv-dryer.offline .mv-dryer-led-dot {
  background: #64748b !important;
  box-shadow: none;
}

.mv-dryer-upper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2px 0;
}

.mv-dryer-door {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 7px solid #1e293b !important;
  background: #0f172a !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.42), inset 0 2px 6px rgba(0, 0, 0, 0.85);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-unit.mv-dryer.working .mv-dryer-door {
  border-color: #ea580c !important;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.7), inset 0 0 10px rgba(249, 115, 22, 0.55);
}

.mv-dryer-hinge {
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4.5px;
  height: 18px;
  background: linear-gradient(180deg, #f8fafc, #94a3b8) !important;
  border: 1px solid #475569 !important;
  border-radius: 1.5px;
  z-index: 3;
}

.mv-dryer-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4.5px;
  height: 22px;
  background: #020617 !important;
  border: 1px solid #475569 !important;
  border-radius: 3px;
  z-index: 3;
}

.mv-dryer-honeycomb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #475569 !important;
  background-image:
    radial-gradient(circle, rgba(251, 146, 60, 0.28) 0%, rgba(15, 23, 42, 0.4) 85%),
    radial-gradient(#0f172a 28%, transparent 32%),
    radial-gradient(#0f172a 28%, transparent 32%) !important;
  background-size: 100% 100%, 6px 6px, 6px 6px !important;
  background-position: 0 0, 0 0, 3px 3px !important;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.mv-dryer-heat-idle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px dashed rgba(251, 146, 60, 0.65);
  background: radial-gradient(circle, rgba(249, 115, 22, 0.32) 0%, rgba(234, 88, 12, 0.08) 70%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fb923c !important;
  filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.5));
}

.mv-unit.mv-dryer.offline .mv-dryer-heat-idle {
  border-color: rgba(148, 163, 184, 0.4);
  background: radial-gradient(circle, rgba(15, 23, 42, 0.45) 0%, transparent 75%);
  color: #94a3b8 !important;
  filter: none;
}

.mv-dryer-tumble-load {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ea580c, #fb923c, #fde047, #ef4444, #f97316, #ea580c) !important;
  animation: drum-spin 1.2s linear infinite;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.9);
  opacity: 0.92;
}

.mv-dryer-heat-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(254, 240, 138, 0.4) 10%, rgba(249, 115, 22, 0.3) 60%, transparent 90%);
  animation: led-blink 0.8s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Dark Control Console Band (Directly matching Photo 3) */
.mv-dryer-console {
  width: 100%;
  height: 28px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
  border-top: 1.5px solid #475569 !important;
  border-bottom: 1px solid #334155 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  box-sizing: border-box;
}

.mv-dryer-lcd {
  min-width: 36px;
  height: 16px;
  padding: 0 4px;
  border-radius: 2.5px;
  background: #090d16 !important;
  border: 1px solid #f97316 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 7px;
  font-weight: 900;
  color: #fb923c !important;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.5);
}

.mv-unit.mv-dryer.working .mv-dryer-lcd {
  background: #431407 !important;
  border-color: #fde047 !important;
  color: #fde047 !important;
  animation: led-blink 0.85s infinite alternate;
}

.mv-unit.mv-dryer.offline .mv-dryer-lcd {
  border-color: #475569 !important;
  color: #ef4444 !important;
  box-shadow: none !important;
}

.mv-dryer-lock {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1 !important;
  border: 1px solid #475569 !important;
}

.mv-dryer-coins {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mv-dryer-coin-slot {
  width: 7px;
  height: 15px;
  background: #334155 !important;
  border: 1px solid #64748b !important;
  border-radius: 1.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 1px;
}

.mv-dryer-coin-slot::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 3px #22c55e;
}

.mv-dryer-coin-slot::after {
  content: '';
  width: 1.5px;
  height: 5px;
  background: #020617;
}

.mv-dryer-plinth {
  width: 100%;
  height: 6px;
  background: #475569 !important;
}

/* ----------------------------------------------------------------------------
   3. DETERGENT VENDING MACHINE (.mv-vending — 4-Shelf Spiral Coils + Yellow Panel)
   ---------------------------------------------------------------------------- */
.mv-unit.mv-vending {
  background: #f8fafc !important;
  border: 2px solid #94a3b8 !important;
  display: flex;
  flex-direction: column;
}

.mv-vend-top-bar {
  width: 100%;
  height: 13px;
  background: linear-gradient(90deg, #ffffff 0%, #ffffff 58%, #facc15 58%, #eab308 100%) !important;
  border-bottom: 1.5px solid #cbd5e1 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  box-sizing: border-box;
}

.mv-vend-brand-pill {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-size: 5px;
  font-weight: 900;
  padding: 1px 3px;
  border-radius: 2px;
  letter-spacing: 0.3px;
}

.mv-vend-top-led-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #16a34a !important;
  box-shadow: 0 0 4px #16a34a;
}

.mv-unit.mv-vending.working .mv-vend-top-led-dot {
  background: #ef4444 !important;
  box-shadow: 0 0 6px #ef4444;
  animation: led-blink 0.6s infinite alternate;
}

.mv-unit.mv-vending.offline .mv-vend-top-led-dot {
  background: #64748b !important;
  box-shadow: none;
}

.mv-vend-body {
  flex: 1;
  width: 100%;
  display: flex;
  min-height: 0;
}

/* Left Illuminated Glass Window with 4 Spiral Coil Shelves */
.mv-vend-window {
  width: 58%;
  height: 100%;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%) !important;
  border-right: 2px solid #94a3b8 !important;
  padding: 3px 3px 2px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.mv-unit.mv-vending.offline .mv-vend-window {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
}

.mv-vend-shelves {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 2px;
  margin-bottom: 3px;
}

.mv-vend-shelf {
  flex: 1;
  border-bottom: 1.5px solid #334155 !important;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 1px 1px;
  position: relative;
}

.mv-vend-coil-item {
  width: 12px;
  height: 14px;
  border-radius: 2px 2px 1px 1px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Spiral wire ring overlay across each pouch */
.mv-vend-coil-item::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  border: 1.2px solid rgba(226, 232, 240, 0.92);
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.6);
}

.mv-vend-coil-item.pouch-blue {
  background: linear-gradient(180deg, #38bdf8, #0284c7) !important;
}

.mv-vend-coil-item.pouch-pink {
  background: linear-gradient(180deg, #f472b6, #db2777) !important;
}

.mv-vend-coil-item.pouch-green {
  background: linear-gradient(180deg, #4ade80, #16a34a) !important;
}

.mv-vend-coil-item.pouch-purple {
  background: linear-gradient(180deg, #a78bfa, #7c3aed) !important;
}

.mv-unit.mv-vending.working .mv-vend-coil-item {
  animation: bubbles-float 0.55s ease-in-out infinite alternate;
}

.mv-vend-chute {
  height: 14px;
  width: 100%;
  background: #0f172a !important;
  border: 1px solid #475569 !important;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5px;
  font-weight: 900;
  color: #cbd5e1 !important;
  letter-spacing: 0.4px;
  position: relative;
  overflow: hidden;
}

.mv-unit.mv-vending.working .mv-vend-chute {
  border-color: #22c55e !important;
  color: #4ade80 !important;
  box-shadow: inset 0 0 6px rgba(34, 197, 94, 0.45);
}

/* Right Yellow Control Column (Red 0000 LED + 4 Product Cards + 4 Yellow Push Buttons) */
.mv-vend-panel {
  width: 42%;
  height: 100%;
  background: linear-gradient(180deg, #fde047 0%, #facc15 55%, #eab308 100%) !important;
  padding: 3px 3px 2px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.mv-vend-led-box {
  width: 100%;
  height: 15px;
  background: #090d16 !important;
  border: 1.5px solid #1e293b !important;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-size: 7.5px;
  font-weight: 900;
  color: #ef4444 !important;
  text-shadow: 0 0 5px rgba(239, 68, 68, 0.9);
  letter-spacing: 0.5px;
}

.mv-unit.mv-vending.working .mv-vend-led-box {
  color: #22c55e !important;
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.95);
  animation: led-blink 0.6s infinite alternate;
}

.mv-unit.mv-vending.offline .mv-vend-led-box {
  color: #64748b !important;
  text-shadow: none !important;
}

.mv-vend-btn-rows {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  margin: 2px 0;
}

.mv-vend-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.55) !important;
  border: 0.5px solid rgba(161, 98, 7, 0.35);
  border-radius: 2px;
  padding: 1.5px 2.5px;
}

.mv-vend-tag {
  width: 16px;
  height: 7px;
  border-radius: 1px;
}

.mv-vend-tag.t1 { background: #0284c7 !important; }
.mv-vend-tag.t2 { background: #db2777 !important; }
.mv-vend-tag.t3 { background: #16a34a !important; }
.mv-vend-tag.t4 { background: #059669 !important; }

.mv-vend-pushbtn {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef9c3, #facc15) !important;
  border: 1.2px solid #b45309 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.mv-unit.mv-vending.working .mv-vend-pushbtn {
  background: #4ade80 !important;
  border-color: #15803d !important;
  box-shadow: 0 0 4px #22c55e;
}

.mv-vend-coinbox {
  width: 92%;
  height: 15px;
  background: #1e293b !important;
  border: 1px solid #090d16 !important;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 3px;
  box-sizing: border-box;
}

.mv-vend-coin-btn {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ef4444 !important;
}

.mv-vend-coin-slot {
  width: 2px;
  height: 8px;
  background: #94a3b8 !important;
}

/* ============================================================================
   Device Settings Form Responsive Grid & Machine Card Control Bar Refinements
   ============================================================================ */

/* Fix WiFi bars visibility & vibrant signal colors in both Light and Dark Mode */
.wifi-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  width: 27px;
  vertical-align: middle;
}

.wifi-bars .bar {
  width: 4.5px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.25);
  transition: background 0.25s ease, transform 0.25s ease;
}

body:not([data-theme="dark"]) .wifi-bars .bar {
  background: rgba(100, 116, 139, 0.25);
}

.wifi-bars.excellent .bar1,
.wifi-bars.excellent .bar2,
.wifi-bars.excellent .bar3,
.wifi-bars.excellent .bar4 {
  background: #10b981 !important;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}

.wifi-bars.good .bar1,
.wifi-bars.good .bar2,
.wifi-bars.good .bar3 {
  background: #22c55e !important;
  box-shadow: 0 0 3px rgba(34, 197, 94, 0.35);
}

.wifi-bars.fair .bar1,
.wifi-bars.fair .bar2 {
  background: #f59e0b !important;
  box-shadow: 0 0 3px rgba(245, 158, 11, 0.35);
}

.wifi-bars.poor .bar1 {
  background: #ef4444 !important;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.wifi-quality-text {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.wifi-quality-text.excellent,
.wifi-quality-text.good {
  color: #10b981;
}
body:not([data-theme="dark"]) .wifi-quality-text.excellent,
body:not([data-theme="dark"]) .wifi-quality-text.good {
  color: #059669;
}
.wifi-quality-text.fair {
  color: #f59e0b;
}
body:not([data-theme="dark"]) .wifi-quality-text.fair {
  color: #d97706;
}
.wifi-quality-text.poor {
  color: #ef4444;
}
body:not([data-theme="dark"]) .wifi-quality-text.poor {
  color: #dc2626;
}
.wifi-quality-text.offline {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Side-by-side Machine Card Body (Never stack vertically on mobile) */
.machine-card-body.machine-card-body-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100%;
}

/* Labeled Machine Card Control Buttons */
.machine-ctrl-btn-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.machine-ctrl-btn-grid.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.btn-ctrl-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg-secondary);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  line-height: 1.15;
  white-space: nowrap;
}

.btn-ctrl-pill .ctrl-ico {
  font-size: 0.98rem;
  line-height: 1;
}

.btn-ctrl-pill:hover {
  transform: translateY(-1px);
}

.btn-ctrl-pill.btn-inject {
  background: rgba(37, 99, 235, 0.1) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #2563eb !important;
}

body[data-theme="dark"] .btn-ctrl-pill.btn-inject {
  color: #60a5fa !important;
}

.btn-ctrl-pill.btn-enable {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #059669 !important;
}

body[data-theme="dark"] .btn-ctrl-pill.btn-enable {
  color: #34d399 !important;
}

.btn-ctrl-pill.btn-disable {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #dc2626 !important;
}

body[data-theme="dark"] .btn-ctrl-pill.btn-disable {
  color: #f87171 !important;
}

.btn-ctrl-pill.btn-reboot {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.38) !important;
  color: #d97706 !important;
}

body[data-theme="dark"] .btn-ctrl-pill.btn-reboot {
  color: #fbbf24 !important;
}

.btn-ctrl-pill.btn-stop {
  background: rgba(220, 38, 38, 0.14) !important;
  border-color: rgba(220, 38, 38, 0.45) !important;
  color: #dc2626 !important;
}

/* ============================================================================
   Scroll-Safe Modal Layout & Sticky Bottom Action Bar (Mobile & Desktop)
   ============================================================================ */
.modal-overlay.hidden,
.hidden {
  display: none !important;
}

.modal-overlay:not(.hidden) {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 10px !important;
  box-sizing: border-box !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.modal-content {
  max-height: calc(100vh - 20px) !important;
  max-height: calc(100dvh - 20px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  margin: auto !important;
  gap: 10px !important;
}

.modal-header {
  flex-shrink: 0 !important;
  padding-bottom: 8px !important;
  margin-bottom: 0 !important;
}

.modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  padding-right: 2px;
}

.modal-sticky-actions {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 15 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  padding: 10px 0 2px 0 !important;
  margin-top: 6px !important;
  background: var(--card-bg, #ffffff) !important;
  border-top: 1px solid var(--card-border, rgba(148, 163, 184, 0.25)) !important;
}

body:not([data-theme="dark"]) .modal-sticky-actions {
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
}

body[data-theme="dark"] .modal-sticky-actions {
  background: #0f172a !important;
  border-top: 1px solid rgba(148, 163, 184, 0.2) !important;
}

/* Responsive 2-Column Grid for Device Settings & Register Device Modal */
.device-form-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.device-dryer-no-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.device-form-grid-2col > .input-group,
.device-dryer-no-grid > .input-group,
#form-edit-device-modal .input-group,
#form-edit-device .input-group,
#form-create-device .input-group {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#form-edit-device-modal input:not([type="checkbox"]):not([type="radio"]),
#form-edit-device-modal select,
#form-edit-device input:not([type="checkbox"]):not([type="radio"]),
#form-edit-device select,
#form-create-device input:not([type="checkbox"]):not([type="radio"]),
#form-create-device select {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 4-Option Price Row inside Device Settings Modal & Forms */
.device-option-price-row {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) minmax(86px, 112px) !important;
  gap: 6px !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.device-option-price-row > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  font-size: 0.8rem !important;
  line-height: 1.2 !important;
  flex-shrink: 0 !important;
}

.device-option-price-row > input[type="text"],
.device-option-price-row > input[type="number"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 7px 8px !important;
  font-size: 0.84rem !important;
  margin: 0 !important;
}

@media (max-width: 640px) {
  .modal-content {
    padding: 14px !important;
    gap: 8px !important;
  }

  #form-edit-device-modal.form-vertical,
  #form-create-device.form-vertical {
    gap: 10px !important;
  }

  .device-form-grid-2col,
  .device-dryer-no-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .device-form-grid-2col label,
  .device-dryer-no-grid label {
    font-size: 0.74rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
  }

  #form-edit-device-modal input:not([type="checkbox"]):not([type="radio"]),
  #form-edit-device-modal select {
    padding: 8px 9px !important;
    font-size: 0.84rem !important;
  }

  .device-option-price-row {
    grid-template-columns: auto minmax(0, 1fr) 92px !important;
    gap: 5px !important;
  }

  .device-option-price-row > label {
    font-size: 0.76rem !important;
    gap: 3px !important;
  }

  .device-option-price-row > input[type="text"],
  .device-option-price-row > input[type="number"] {
    padding: 6px 7px !important;
    font-size: 0.82rem !important;
  }
}

/* ============================================================================
   1. Fix Missing .btn-success (Crisp Emerald Button in Light & Dark Mode)
   ============================================================================ */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(5, 150, 105, 0.4) !important;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.25);
  font-weight: 700;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(16, 185, 129, 0.35);
}

/* ============================================================================
   2. Organized Sub-Page Top Header (branch_detail.html & device_control.html)
      & Single-Line Sidebar Navigation Items (Desktop & Mobile)
   ============================================================================ */
.sidebar .nav-item,
#main-sidebar .nav-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  padding: 9px 11px !important;
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  border-radius: 10px !important;
}

.sidebar .nav-item.sub-item,
#main-sidebar .nav-item.sub-item {
  padding-left: 11px !important;
  font-size: 0.86rem !important;
}

.sidebar .nav-item-label,
#main-sidebar .nav-item-label {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.sidebar .nav-item-badge,
#main-sidebar .nav-item-badge {
  flex-shrink: 0 !important;
}

.sidebar .sidebar-title,
#main-sidebar .sidebar-title {
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.2px !important;
  margin-left: 4px !important;
  margin-bottom: 4px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Sub-Page Header (branch_detail.html & device_control.html) */
.app-header.page-sub-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 14px 22px !important;
  border-radius: 16px !important;
  margin-bottom: 18px !important;
}

.page-sub-header .sub-header-left {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.page-sub-header .sub-header-back-group {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
}

.page-sub-header .sub-header-back-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 4px 10px !important;
  height: 30px !important;
  min-height: 30px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
}

.page-sub-header .sub-header-brand-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.page-sub-header .sub-header-brand-group .logo-icon {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
}

.page-sub-header .sub-header-brand-line {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.page-sub-header .sub-header-brand-line .brand-heading {
  font-size: 0.84rem !important;
  letter-spacing: 0.4px !important;
}

.page-sub-header .sub-header-title {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  margin: 2px 0 0 0 !important;
  color: var(--text-primary) !important;
  line-height: 1.22 !important;
  word-break: break-word !important;
}

.page-sub-header .sub-header-right {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
}

.page-sub-header .sub-header-user-pill {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 1px !important;
  padding: 5px 12px !important;
  border-radius: 10px !important;
  background: var(--card-bg-secondary) !important;
  border: 1px solid var(--card-border) !important;
  line-height: 1.2 !important;
}

.page-sub-header .sub-header-user-pill strong {
  font-size: 0.88rem !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
}

.page-sub-header .sub-header-user-pill small {
  font-size: 0.68rem !important;
  color: var(--text-secondary) !important;
  white-space: nowrap !important;
}

.page-sub-header .sub-header-actions-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.page-sub-header .sub-header-actions-group .header-prefs-bar {
  margin-right: 0 !important;
}

.page-sub-header .sub-header-actions-group .btn {
  padding: 7px 12px !important;
  font-size: 0.82rem !important;
  border-radius: 9px !important;
  white-space: nowrap !important;
}

@media (max-width: 960px) {
  .app-header.page-sub-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }

  .page-sub-header .sub-header-left {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .page-sub-header .sub-header-brand-group {
    width: 100% !important;
    gap: 10px !important;
  }

  .page-sub-header .sub-header-brand-group .logo-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }

  .page-sub-header .sub-header-title {
    font-size: 1.08rem !important;
  }

  .page-sub-header .sub-header-right {
    width: 100% !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--card-border) !important;
  }

  .page-sub-header .sub-header-user-pill {
    align-items: flex-start !important;
    padding: 4px 10px !important;
  }
}

/* ============================================================================
   3. Master-Detail Device Editor Toggle & Organized Header (#tab-devices)
   ============================================================================ */
.device-master-detail-grid.editor-closed {
  grid-template-columns: minmax(0, 1fr) !important;
}

@media (min-width: 960px) {
  .device-master-detail-grid.editor-closed #device-cards-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 10px !important;
    max-height: 720px !important;
  }
}

.device-edit-header-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
  width: 100%;
  box-sizing: border-box;
}

.device-edit-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.device-edit-title {
  margin: 0 !important;
  font-size: 1.12rem !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  line-height: 1.25 !important;
  min-width: 0;
  flex: 1;
  word-break: break-word;
}

.btn-hide-editor {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 12px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  border-radius: 9px !important;
  background: rgba(100, 116, 139, 0.12) !important;
  border: 1px solid rgba(100, 116, 139, 0.32) !important;
  color: var(--text-primary) !important;
  flex-shrink: 0 !important;
  cursor: pointer;
}

.btn-hide-editor:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.38) !important;
  color: #ef4444 !important;
}

.device-edit-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.device-edit-meta-bar {
  margin: 0 !important;
  padding: 7px 11px !important;
  border-radius: 9px !important;
  background: var(--card-bg-secondary) !important;
  border: 1px solid var(--card-border) !important;
  font-size: 0.8rem !important;
  color: var(--text-secondary) !important;
  line-height: 1.4 !important;
  word-break: break-word !important;
}

.device-edit-actions-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  width: 100%;
}

.device-edit-actions-bar .btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 8px 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  white-space: nowrap !important;
  text-align: center !important;
  margin: 0 !important;
}

/* ============================================================================
   4. Manage Machine Types Modal Form (#form-add-machine-type) Mobile Fix
   ============================================================================ */
.machine-type-add-form {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.machine-type-add-form > .input-group,
.machine-type-add-form input,
.machine-type-add-form select {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.machine-type-add-form .machine-type-submit-btn {
  height: 42px;
  padding: 0 16px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

@media (max-width: 560px) {
  .machine-type-add-form {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .machine-type-add-form .machine-type-submit-btn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    height: 40px !important;
    margin-top: 2px !important;
  }
}

/* ============================================================================
   5. Collapsible Add User Form (#tab-users)
   ============================================================================ */
.users-section-grid.form-closed {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ============================================================================
   6. Compact Single-Screen Callback Logs Table (#tab-callback-logs)
   ============================================================================ */
#tab-callback-logs .cb-compact-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: auto;
}

#tab-callback-logs .cb-compact-table th,
#tab-callback-logs .cb-compact-table td {
  padding: 9px 7px !important;
  font-size: 0.82rem;
}

#tab-callback-logs .cb-compact-table th {
  font-size: 0.74rem !important;
  letter-spacing: 0.02em;
}

/* ============================================================================
   7. Global Password Show/Hide Toggle Button (.pw-input-wrap / .pw-toggle-btn)
   ============================================================================ */
.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.pw-input-wrap input {
  width: 100%;
  padding-right: 44px !important;
}

.pw-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 2;
}

.pw-toggle-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #0284c7;
}

body[data-theme="dark"] .pw-toggle-btn {
  color: #94a3b8;
}

body[data-theme="dark"] .pw-toggle-btn:hover {
  background: rgba(148, 163, 184, 0.18);
  color: #38bdf8;
}

/* ============================================================================
   8. Dual Dryer 2-Cabinet Status Visuals (🔴 ຕູ້ເທິງ #1 & 🟡 ຕູ້ລຸ່ມ #2)
   ============================================================================ */
.dc-visual-status-box.is-dual-dryer {
  display: flex !important;
  flex-direction: column-reverse !important;
  align-items: stretch !important;
  gap: 12px !important;
  padding: 12px !important;
}

.dc-visual-status-box.is-dual-dryer .dc-visual-meta {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px dashed var(--card-border) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.dc-visual-status-box.is-dual-dryer .dc-visual-slot {
  width: 100% !important;
}

.mv-dual-dryer-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.mv-dryer-cab-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--card-border, #cbd5e1);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mv-dryer-cab-card.cab-upper {
  border-color: rgba(239, 68, 68, 0.42);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.06) 0%, var(--card-bg, #ffffff) 65%);
}

.mv-dryer-cab-card.cab-lower {
  border-color: rgba(245, 158, 11, 0.48);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--card-bg, #ffffff) 65%);
}

body[data-theme="dark"] .mv-dryer-cab-card.cab-upper {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, rgba(15, 23, 42, 0.78) 70%);
}

body[data-theme="dark"] .mv-dryer-cab-card.cab-lower {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, rgba(15, 23, 42, 0.78) 70%);
}

.mv-dryer-cab-head {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mv-dryer-cab-card.cab-upper .mv-dryer-cab-head {
  color: #dc2626;
}

.mv-dryer-cab-card.cab-lower .mv-dryer-cab-head {
  color: #d97706;
}

body[data-theme="dark"] .mv-dryer-cab-card.cab-upper .mv-dryer-cab-head {
  color: #f87171;
}

body[data-theme="dark"] .mv-dryer-cab-card.cab-lower .mv-dryer-cab-head {
  color: #fbbf24;
}

.mv-dryer-badge.cab-upper {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
}

.mv-dryer-badge.cab-lower {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
}

.mv-unit.mv-dryer.cab-upper {
  border-color: #ef4444 !important;
}

.mv-unit.mv-dryer.cab-lower {
  border-color: #f59e0b !important;
}

.mv-unit.mv-dryer.cab-lower .mv-dryer-led-dot {
  background: #f59e0b !important;
  box-shadow: 0 0 4px #f59e0b;
}

.mv-unit.mv-dryer.cab-lower.working .mv-dryer-door {
  border-color: #f59e0b !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.75), inset 0 0 10px rgba(245, 158, 11, 0.55) !important;
}

.mv-dryer-cab-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  text-align: center;
  box-sizing: border-box;
}

.mv-dryer-cab-pill.idle {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.38);
}

body[data-theme="dark"] .mv-dryer-cab-pill.idle {
  color: #34d399;
}

.mv-dryer-cab-pill.heating {
  background: rgba(249, 115, 22, 0.16);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.45);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.25);
}

body[data-theme="dark"] .mv-dryer-cab-pill.heating {
  color: #fb923c;
}

.mv-dryer-cab-pill.cooldown {
  background: rgba(56, 189, 248, 0.16);
  color: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

body[data-theme="dark"] .mv-dryer-cab-pill.cooldown {
  color: #38bdf8;
}

.mv-dryer-cab-pill.offline {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

body[data-theme="dark"] .mv-dryer-cab-pill.offline {
  color: #f87171;
}

/* Branch Detail Card Dual Dryer Row */
.machine-card-body.machine-card-body-row.is-dual-dryer-row {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
}

.machine-card-body.machine-card-body-row.is-dual-dryer-row .mv-clickable-wrap {
  width: 100% !important;
}


