@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Design system tokens matching the screenshot */
  --brand-primary: #0A4D8D; /* Blue system default */
  --brand-gradient: linear-gradient(135deg, #10599c, #0A4D8D);
  --bg-workspace: #f4f6fa;
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);
  
  --accent-rgb: 10, 77, 141;
  --accent-color: var(--brand-primary);
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
}

/* Dark Mode Theme */
body.dark-theme {
  --bg-workspace: #0f172a;
  --card-bg: #1e293b;
  --sidebar-bg: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 25px rgba(0,0,0,0.5);
}

body.brand-zen {
  --brand-primary: #ff6600; /* Bright Orange */
  --brand-gradient: linear-gradient(135deg, #ff8c00, #ff6600);
}
body.brand-aka {
  --brand-primary: #d32f2f; /* Logo Red */
  --brand-gradient: linear-gradient(135deg, #e53935, #d32f2f);
}
body.brand-tummour {
  --brand-primary: #800c0c; /* Spicy Chili Red */
  --brand-gradient: linear-gradient(135deg, #a81c1c, #800c0c);
}
body.brand-ott {
  --brand-primary: #0b3b66; /* Navy Blue */
  --brand-gradient: linear-gradient(135deg, #1a4d80, #0b3b66);
}
body.brand-zengroup {
  --brand-primary: #00b4db; /* Sea Blue */
  --brand-gradient: linear-gradient(135deg, #00d2ff, #00b4db);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
}

body {
  background-color: var(--bg-workspace);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* -------------------------------------------------------------
   AUTHENTICATION INTERFACE
   ------------------------------------------------------------- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  min-height: 100vh;
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  padding: 20px;
}

body.dark-theme .auth-wrapper {
  background: linear-gradient(145deg, #0f172a, #020617);
}

.auth-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 36px 30px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  display: none;
  animation: authFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.dark-theme .auth-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 20px 25px rgba(0,0,0,0.3);
}

.auth-card.active {
  display: block;
}

@keyframes authFadeIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
}

.auth-brand h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-brand p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-submit-btn {
  width: 100%;
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.2);
  margin-top: 15px;
}

.auth-submit-btn:hover {
  opacity: 0.95;
}

.auth-switch-link {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 20px;
}

.auth-switch-link a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch-link a:hover {
  text-decoration: underline;
}

.auth-error-alert {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger-color);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 15px;
}

.auth-success-alert {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success-color);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 15px;
}

/* -------------------------------------------------------------
   MAIN PANEL LAYOUTS
   ------------------------------------------------------------- */
.app-container {
  display: flex;
  width: 100%;
}

.sidebar {
  width: 290px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  z-index: 100;
  justify-content: space-between;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.brand-title-wrap h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-title-wrap p {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
}

.nav-item:hover {
  background: rgba(var(--accent-rgb), 0.04);
  color: var(--brand-primary);
}

.nav-item.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.15);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-selectors {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.selector-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selector-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selector-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gear-icon {
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
  cursor: pointer;
}

.gear-icon:hover {
  fill: var(--brand-primary);
}

.custom-select-dark {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.main-content-layout {
  flex-grow: 1;
  padding: 24px 30px;
  max-width: 1300px;
  margin: 0 auto;
  width: calc(100% - 290px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.top-bar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-badge {
  background: var(--brand-primary);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#topbar-main-title {
  font-size: 18px;
  font-weight: 700;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.branch-pill-badge {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.theme-toggle-btn:hover {
  color: var(--brand-primary);
}

.profile-badge-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 4px 14px 4px 4px;
  box-shadow: var(--shadow-sm);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--brand-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.profile-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.profile-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-name {
  font-size: 10px;
  color: var(--text-muted);
}

.panel-view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.panel-view.active {
  display: block;
}

.dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.form-header-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-header-title-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.form-icon-svg {
  width: 36px;
  height: 36px;
  fill: var(--brand-primary);
  background: rgba(var(--accent-rgb), 0.06);
  padding: 8px;
  border-radius: 8px;
  margin-top: 2px;
}

.form-header-title-row h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.form-header-title-row p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.mode-toggles-row {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mode-btn:hover {
  background: rgba(var(--accent-rgb), 0.02);
}

.mode-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.mode-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.inner-subtabs-row {
  display: flex;
  gap: 10px;
}

.subtab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.subtab-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.subtab-icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
  opacity: 0.6;
}

.subtab-icon:hover {
  opacity: 1;
}
/* Fullscreen Editor Mode */
.smartphone-shell-container.fullscreen-editor {
  max-width: 100% !important;
  padding: 0 !important;
}
.smartphone-shell-container.fullscreen-editor .phone-device {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  min-height: calc(100vh - 200px);
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: var(--card-bg) !important;
}
.smartphone-shell-container.fullscreen-editor .phone-screen {
  border-radius: 12px !important;
  border: none !important;
}
.smartphone-shell-container.fullscreen-editor .phone-header-banner {
  border-radius: 12px 12px 0 0 !important;
}


.smartphone-shell-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  width: 100%;
}

.phone-device {
  width: 100%;
  height: auto;
  min-height: 500px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  position: relative;
}

.phone-device::before {
  display: none;
}

.phone-screen {
  width: 100%;
  height: auto;
  min-height: 500px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.phone-header-banner {
  background: var(--brand-primary);
  color: #ffffff;
  padding: 30px 16px 15px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phone-logo-sub {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.8;
}

.phone-header-banner h4 {
  font-size: 13px;
  font-weight: 700;
}

.phone-header-banner p {
  font-size: 9px;
  opacity: 0.9;
}

#phone-brand-logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto;
}

.phone-progress-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand-primary);
  width: 0%;
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.phone-scrollable-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.phone-question-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.phone-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.photo-required-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 77, 141, 0.05);
  border: 1px dashed rgba(10, 77, 141, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  color: var(--brand-primary);
}

.photo-required-badge svg {
  width: 10px;
  height: 100%;
  fill: currentColor;
}

.phone-toggles-row {
  display: flex;
  gap: 10px;
}

.phone-btn-toggle {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.phone-btn-toggle.pass.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border-color: var(--success-color);
}

.phone-btn-toggle.fail.active {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.phone-camera-uploader {
  border: 1.5px dashed var(--border-color);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.phone-camera-uploader:hover {
  border-color: var(--brand-primary);
}

.phone-camera-uploader svg {
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
}

.phone-camera-uploader span {
  font-size: 9.5px;
  color: var(--text-secondary);
}

.phone-footer-action {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
}

.phone-submit-btn {
  width: 100%;
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.2);
}

.phone-submit-btn:hover {
  opacity: 0.95;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.stat-card {
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: 10px;
  background: var(--bg-workspace);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 15px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-workspace);
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

/* Passport Table Card Style */
#passport-table-container {
  border: none;
  background: transparent;
  padding: 0;
}
#panel-passport-table {
  border-collapse: separate !important;
  border-spacing: 0 12px !important;
  background: transparent;
}
#panel-passport-table thead th {
  border-bottom: none !important;
  background: transparent !important;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 15px !important;
}
#panel-passport-table tbody tr {
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}
#panel-passport-table tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
#panel-passport-table tbody td {
  border: none !important;
  border-top: 1px solid var(--border-color) !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 16px 15px !important;
  vertical-align: middle;
}
#panel-passport-table tbody td:first-child {
  border-left: 1px solid var(--border-color) !important;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
#panel-passport-table tbody td:last-child {
  border-right: 1px solid var(--border-color) !important;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.certified {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.badge.inprogress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.badge.notstarted {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.badge.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.form-field-group {
  margin-bottom: 16px;
}

.form-field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Base Input & Form Element Theme Styles */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--card-bg);
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
}

.form-input:focus {
  border-color: var(--brand-primary);
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  width: 550px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.draggable-nav-item {
  cursor: grab;
}
.draggable-nav-item:active {
  cursor: grabbing;
}

/* -------------------------------------------------------------
   RESPONSIVE MOBILE DESIGN
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
  /* 1. App Container & Body */
  body {
    overflow-x: hidden;
  }
  .app-container {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }
  .main-content-layout {
    padding: 16px !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 2. Topbar Adjustments */
  .top-bar-container {
    padding: 12px 16px;
    flex-wrap: nowrap !important;
    align-items: center;
  }
  .top-bar-left {
    flex: 1;
    min-width: 0; /* allows truncation */
    display: flex;
    align-items: center;
  }
  .mobile-menu-btn {
    display: block !important;
    flex-shrink: 0;
  }
  .system-badge {
    display: none;
  }
  #topbar-main-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
  }
  .top-bar-right {
    gap: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  #local-server-badge, #topbar-branch-badge, .profile-info-text {
    display: none;
  }
  
  /* Sidebar Off-canvas */
  .sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 9999;
    transition: left 0.3s ease;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
  }
  .sidebar-close-btn {
    display: block !important;
  }

  /* Dashboard Stats / Grid */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  /* 3. OpsBot Layout Fixes (Crucial Fix) */
  .opsbot-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }
  .opsbot-header > div {
    width: 100%;
  }
  .opsbot-header h3 {
    font-size: 16px !important;
  }
  .opsbot-header p {
    font-size: 13px !important;
  }
  #btn-chatbot-manage {
    width: 100% !important;
    justify-content: center !important;
  }

  .opsbot-layout {
    flex-direction: column !important;
  }
  .opsbot-layout > div:first-child,
  .opsbot-layout > div:last-child {
    flex-basis: auto !important;
    min-width: 100% !important;
  }
  .opsbot-layout > div:last-child {
    border-left: none !important;
    border-top: 1px dashed var(--border-color);
    padding-left: 0 !important;
    padding-top: 20px;
    margin-top: 10px;
  }

  /* 4. Chatbot Form (Bottom button) */
  #chatbot-form {
    flex-direction: column !important;
  }
  #chatbot-form button {
    width: 100% !important;
    justify-content: center;
  }
  
  /* Zen Group Times (Newsletter) Fixes */
  #panel-newsletter .dashboard-card {
    padding: 10px !important;
    overflow-x: hidden !important;
  }
  #newsletter-title-lg {
    font-size: 26px !important;
    letter-spacing: 1px !important;
  }
  #newsletter-title-sm {
    font-size: 9px !important;
    letter-spacing: 0px !important;
  }
  #newsletter-header-container > div:last-child {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 5px !important;
    text-align: center !important;
  }
  #newsletter-volume-issue,
  #newsletter-date-stamp,
  #newsletter-edition {
    font-size: 9px !important;
  }
  #panel-newsletter [style*="display: grid"] {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  #panel-newsletter h2 {
    font-size: 20px !important;
  }
  #panel-newsletter h3 {
    font-size: 18px !important;
  }
  #panel-newsletter p, #panel-newsletter li {
    font-size: 14px !important;
  }
  /* 5. Modals */
  /* Passport UI on Mobile */
  #modal-view-passport {
    align-items: flex-start !important;
  }
  #modal-view-passport .modal-content {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    height: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 15px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
  }
  #passport-bio-layout {
    flex-direction: column !important;
    align-items: center !important;
  }
  #passport-bio-layout > div {
    width: 100% !important;
    max-width: 100% !important;
  }
  .passport-bio-item {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 0 !important;
    font-size: 13px !important;
  }
  .passport-bio-item > strong {
    flex: 0 0 auto !important;
    color: #64748b !important;
  }
  .passport-bio-item > span {
    flex: 1 1 auto !important;
    text-align: right !important;
    word-break: break-word;
  }
  .passport-bio-item > input {
    flex: 1 1 auto !important;
    max-width: 180px !important;
    text-align: right !important;
    margin: 0 !important;
    padding: 6px 8px !important;
  }
  .passport-bio-table {
    width: 100% !important;
  }
  .passport-bio-table td, .passport-bio-table th {
    font-size: 11px !important;
    padding: 6px !important;
    white-space: normal !important;
  }
  .passport-book-layout {
    flex-direction: column !important;
    background: #f8fafc !important;
  }
  .passport-book-seam {
    display: none !important;
  }
  .passport-page {
    width: 100% !important;
    border-right: none !important;
    padding: 15px !important;
  }
  .passport-page.left {
    border-bottom: 2px dashed #cbd5e1 !important;
  }
  .passport-page table, #table-standard-courses, #table-development-courses {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    width: 100% !important;
  }
  .passport-page table td, .passport-page table th {
    font-size: 11px !important;
    padding: 6px !important;
  }
  .passport-page .station-card {
    min-width: 130px !important;
    padding: 10px !important;
  }
  .passport-page .station-card h5 {
    font-size: 13px !important;
  }

  .auth-card {
    width: 90% !important;
    padding: 24px 20px !important;
  }
  .modal-content {
    width: 95% !important;
    max-width: 400px;
    margin: 20px auto;
  }

  /* Tables Scroll */
  .panel-view table,
  #table-action-plans {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Phone Runner UI */
  .phone-checklist-container, #phone-checklist-container {
    width: 100% !important;
    height: auto !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 10px !important;
    box-shadow: none !important;
  }
  #smartphone-preview {
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .phone-progress-bar {
    position: sticky !important;
    top: 0;
    z-index: 50;
  }
}

/* E-Learning Custom Styles (Netflix Style) */
.scrollbar-none::-webkit-scrollbar {
  display: none !important;
}
.scrollbar-none {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Plyr Video Player Overrides */
:root {
  --plyr-color-main: #ff5500;
  --plyr-video-background: #000000;
}
.plyr--video {
  border-radius: 12px;
  overflow: hidden;
  height: 100%;
}
.plyr__video-wrapper {
  height: 100% !important;
}
.plyr__controls {
  padding: 10px 15px !important;
  display: flex !important;
  flex-flow: row wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

/* Force progress bar to span full width on the top row */
.plyr__progress {
  width: 100% !important;
  flex: 1 1 100% !important;
  order: -10 !important; /* Put progress bar first */
  margin: 0 0 10px 0 !important;
}

/* Align play control and time display to the left on the bottom row */
.plyr__control[data-plyr="play"] {
  order: 1 !important;
  flex-shrink: 0 !important;
}

.plyr__time {
  order: 2 !important;
  flex-shrink: 0 !important;
}

/* Push volume and subsequent controls to the right side of the bottom row */
.plyr__volume {
  order: 3 !important;
  flex-shrink: 0 !important;
  margin-left: auto !important; /* Push volume and everything after it to the right */
}

.plyr__control[data-plyr="captions"] {
  order: 4 !important;
  flex-shrink: 0 !important;
}

.plyr__menu {
  order: 5 !important;
  flex-shrink: 0 !important;
}

.plyr__control[data-plyr="pip"] {
  order: 6 !important;
  flex-shrink: 0 !important;
}

.plyr__control[data-plyr="fullscreen"] {
  order: 7 !important;
  flex-shrink: 0 !important;
}

/* Ensure no element other than progress wraps */
.plyr__controls > *:not(.plyr__progress) {
  flex-wrap: nowrap !important;
}

/* Phone Simulator Dark Theme Overrides */
body.dark-theme .phone-screen {
  background: var(--bg-workspace) !important;
}
body.dark-theme .phone-question-card {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
body.dark-theme .phone-progress-bar {
  background: var(--card-bg) !important;
  border-bottom: 1px solid var(--border-color) !important;
}
body.dark-theme .phone-comment-input {
  background: var(--bg-workspace) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
body.dark-theme .phone-camera-uploader {
  background: rgba(255,255,255,0.03) !important;
  border-color: var(--border-color) !important;
}
body.dark-theme .phone-btn-toggle {
  background: var(--bg-workspace) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}
body.dark-theme .phone-btn-toggle.active.pass {
  background: var(--success-color) !important;
  color: white !important;
}
body.dark-theme .phone-btn-toggle.active.fail {
  background: var(--danger-color) !important;
  color: white !important;
}

/* Elearning Modal Responsive Overrides for iPad and Mobile */
@media (max-width: 1024px) {
  #modal-elearning-play {
    align-items: center !important;
    justify-content: center !important;
  }
  #modal-elearning-play .elearning-modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
  }
}

/* -------------------------------------------------------------
   OPERATIONS DASHBOARD FOR CHECKLISTS
   ------------------------------------------------------------- */
.dashboard-ops-wrapper {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ops-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 5px;
}

.ops-dashboard-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.ops-dashboard-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.ops-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
}

.ops-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ops-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ops-kpi-info {
  display: flex;
  flex-direction: column;
}

.ops-kpi-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.ops-kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
}

.ops-kpi-subtext {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.ops-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
}

/* Charts Grid */
.ops-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .ops-charts-grid {
    grid-template-columns: 1fr;
  }
}

.ops-chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.ops-chart-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  border-left: 4px solid var(--brand-primary);
  padding-left: 10px;
}

/* Bar Chart columns styling */
.ops-bar-chart-container {
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border-color);
}

.ops-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 60px;
}

.ops-bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 4px;
}

.ops-bar-fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--brand-primary) 0%, rgba(var(--accent-rgb), 0.6) 100%);
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 5px;
}

.ops-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
  white-space: nowrap;
}

/* Tables Section */
.ops-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .ops-tables-grid {
    grid-template-columns: 1fr;
  }
}

.ops-table-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.ops-table-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
  border-left: 4px solid var(--brand-primary);
  padding-left: 10px;
}

/* Custom styles for tables inside dark theme */
body.dark-theme .ops-kpi-card,
body.dark-theme .ops-chart-card,
body.dark-theme .ops-table-card {
  background: #1e293b;
  border-color: #334155;
}

/* Drag-and-Drop & Moveable Checklist Tabs */
.checklist-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--brand-primary);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 600;
  background: var(--card-bg);
  color: var(--brand-primary);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.checklist-tab:hover {
  background: rgba(var(--accent-rgb), 0.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.checklist-tab.active {
  background: var(--brand-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.2);
}

.checklist-tab.dragging {
  opacity: 0.5;
  border: 2px dashed var(--brand-primary);
  background: rgba(var(--accent-rgb), 0.1);
}

.tab-move-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.tab-move-btn:hover {
  background: rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

.checklist-tab.active .tab-move-btn {
  background: rgba(255, 255, 255, 0.2);
}

.checklist-tab.active .tab-move-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* 4 forms per row layout container for checklist tabs selector */
#checklist-form-select {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 1200px;
  flex-grow: 1;
}

@media (max-width: 1024px) {
  #checklist-form-select {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  #checklist-form-select {
    grid-template-columns: 1fr;
  }
}

/* Add form button specific styling */
.checklist-tab.add-new-tab-btn {
  border: 1.5px dashed var(--brand-primary);
  background: transparent;
  color: var(--brand-primary);
  justify-content: center;
  font-weight: 700;
  transition: all 0.2s ease;
}

.checklist-tab.add-new-tab-btn:hover {
  background: rgba(var(--accent-rgb), 0.05);
  border-style: solid;
}

/* Mobile-friendly overrides for Runner Mode */
@media (max-width: 768px) {
  .smartphone-shell-container {
    padding: 0;
  }
  .phone-screen {
    border-radius: 0;
    border: none;
    min-height: 100vh;
  }
}
