* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1b7a4b;
  --primary-light: #2e9e63;
  --primary-dark: #104e30;
  --accent: #e74c3c;
  --success: #27ae60;
  --success-light: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #eef3f0;
  --bg-grad-1: #1b7a4b;
  --bg-grad-2: #104e30;
  --card-bg: #ffffff;
  --text: #1f2d27;
  --text-light: #6b7d74;
  --border: #dde7e2;
  --surface: #f0f4f8;
  --surface-2: #f8f9fa;
  --accent-bg: #fdf0ee;
  --accent-dark: #c0392b;
  --shadow: 0 8px 30px rgba(16,78,48,0.10);
  --shadow-sm: 0 2px 10px rgba(16,78,48,0.06);
  --radius: 14px;
  --radius-lg: 22px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.screen { min-height: 100vh; }

/* ===== Brand & Layout Utilities ===== */
.login-bg {
  background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.login-bg .center-card { margin: auto; }
.brand-bar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(16,78,48,0.18);
}
.brand-bar .bb-logo { font-weight: 800; font-size: 17px; letter-spacing: 0.6px; }
.brand-bar .bb-user { font-size: 14px; opacity: 0.92; }

/* 系統作者署名 System Author credit (前台 brand-bar / 後台 header / 管理員登入頁) */
.brand-bar .bb-right { display: flex; align-items: center; gap: 14px; }
.brand-bar .bb-author,
.admin-header .admin-author {
  font-size: 12.5px;
  line-height: 1.3;
  opacity: 0.92;
  border-left: 1px solid rgba(255,255,255,0.35);
  padding-left: 14px;
  white-space: nowrap;
}
.brand-bar .bb-author b,
.admin-header .admin-author b { font-weight: 800; letter-spacing: 0.3px; }
.admin-header .admin-author { border-left-color: rgba(255,255,255,0.3); padding-left: 12px; margin-left: 4px; }
.login-author { font-size: 12.5px; color: var(--text, #1f2d3d); opacity: 0.72; margin: -6px 0 20px; }
.login-author b { font-weight: 700; }
@media (max-width: 700px) {
  .brand-bar { padding: 12px 14px; }
  .brand-bar .bb-logo { font-size: 14px; }
  .brand-bar .bb-right { gap: 8px; }
  .brand-bar .bb-author,
  .admin-header .admin-author { font-size: 11px; padding-left: 8px; white-space: normal; }
  .admin-header .header-title-text { font-size: 12px; }
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; }

.center-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 500px;
  width: 90%;
  margin: 80px auto;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 5px solid var(--primary);
}

.wide-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  max-width: 900px;
  width: 95%;
  margin: 40px auto;
  box-shadow: var(--shadow);
}

.module-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 200px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.module-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(27,122,75,0.18);
}
.module-icon {
  font-size: 36px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 8px 18px rgba(27,122,75,0.28);
}
.module-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.module-desc { font-size: 13px; color: var(--text-light); }
.lead-chip { display: inline-block; padding: 4px 10px; margin: 2px 4px 2px 0; border: 1px solid #ccc; border-radius: 16px; cursor: pointer; background: #f8f9fa; font-size: 14px; }
.lead-chip input { margin-right: 4px; vertical-align: middle; }
.lead-chip:has(input:checked) { background: #d6eaf8; border-color: #2980b9; }

.perm-chip { display: inline-block; padding: 2px 8px; margin: 2px; border-radius: 10px; background: #e8f4fd; color: #1f6fb2; font-size: 12px; }

/* ===== Fleet (車輛里數記錄) ===== */
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.fleet-card {
  position: relative; padding: 14px 12px; border: 2px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; text-align: center; transition: border-color .15s, box-shadow .15s;
}
.fleet-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.fleet-card.status-out { border-color: var(--accent); background: #fdf0ee; }
.fleet-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.fleet-dot.out { background: var(--accent); }
.fleet-plate { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.fleet-alias { font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
.fleet-status { font-size: 13px; font-weight: 600; }
.fleet-status.out { color: var(--accent); }
.fleet-status.in { color: var(--success); }
.fleet-today { margin-top: 6px; font-size: 12px; color: var(--text-light); }
.fleet-last { margin-top: 2px; font-size: 11px; color: var(--text-light); }
.fleet-form-box { margin: 10px 0; padding: 12px; border: 1px dashed #ccc; border-radius: 8px; background: #fbfcfd; }
.fleet-stat-box { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 8px; background: #f0f4f8; }
.fleet-stat-label { font-size: 12px; color: var(--text-light); }
.fleet-stat-value { font-size: 18px; font-weight: 700; color: var(--primary); }

.logo {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.logo img {
  max-height: 120px;
  width: auto;
  display: block;
}

.logo-sm {
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
}
.logo-sm img {
  height: 28px;
  width: auto;
  display: block;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}
.header-title .logo-icon {
  height: 24px;
  width: auto;
  margin-right: 6px;
  vertical-align: middle;
}

h1 { font-size: 24px; color: var(--primary); margin-bottom: 4px; }
h2 { font-size: 18px; color: var(--text-light); margin-bottom: 24px; }

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
  display: block;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,122,75,0.16);
}

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

.error-msg {
  background: #fdecea;
  color: var(--accent);
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 14px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
  font-size: 15px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--accent); color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* ===== EXAM HEADER ===== */
.exam-header {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-left { display: flex; align-items: center; gap: 8px; }
.header-title { font-size: 16px; font-weight: 700; }
.header-subtitle { font-size: 13px; opacity: 0.8; }
.header-right { display: flex; align-items: center; gap: 12px; }

.timer {
  font-size: 18px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
}

.timer.warning { color: var(--warning); animation: pulse 1s infinite; }
.timer.danger { color: var(--accent); animation: pulse 0.5s infinite; }

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

.progress-bar-container { background: var(--border); height: 6px; }
.progress-bar { background: var(--primary-light); height: 100%; transition: width 0.5s; border-radius: 3px; }

/* ===== QUESTION CARD ===== */
.exam-body {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.question-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.q-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }

.q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.q-type {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.q-type.mc { background: #e8f4fd; color: var(--primary); }
.q-type.essay { background: #fff3cd; color: var(--warning); }

.q-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 20px;
}

.q-zh { color: var(--primary); font-size: 14px; margin-left: 4px; }

.q-main { margin-bottom: 8px; }

.q-subitem {
  color: #2c3e50;
  font-size: 15px;
  font-weight: 400;
  margin: 4px 0 4px 20px;
  line-height: 1.5;
}

.options-list { margin-bottom: 8px; }

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.option-item:hover { border-color: var(--primary-light); background: #f0f7fc; }
.option-item.selected { border-color: var(--primary); background: #e8f4fd; }
.option-item.selected .option-letter { background: var(--primary); color: white; }

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: #f0f4f8;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.option-text { font-size: 14px; line-height: 1.4; }

.essay-area { margin-top: 8px; }
.essay-input {
  width: 100%;
  min-height: 150px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s;
}
.essay-input:focus { outline: none; border-color: var(--primary-light); }
.essay-info { font-size: 12px; color: var(--text-light); margin-top: 8px; }

.exam-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.question-counter { font-size: 13px; color: var(--text-light); }
.footer-nav { display: flex; gap: 8px; }

/* ===== RESULT ===== */
.result-card { max-width: 600px; }

.score-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.score-circle.pass { background: linear-gradient(135deg, var(--success), var(--success-light)); color: white; }
.score-circle.fail { background: linear-gradient(135deg, var(--accent), #ff6b6b); color: white; }

.score-number { font-size: 36px; font-weight: 800; }
.score-label { font-size: 12px; opacity: 0.8; }

.result-title { font-size: 22px; margin-bottom: 16px; }

.score-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.score-detail { padding: 12px; border-radius: 10px; background: #f0f4f8; }
.score-detail .dl { font-size: 11px; color: var(--text-light); }
.score-detail .dv { font-size: 20px; font-weight: 700; }
.score-detail .dv.green { color: var(--success); }
.score-detail .dv.red { color: var(--accent); }

/* ===== ADMIN HEADER ===== */
.admin-header {
  background: var(--primary-dark);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-nav {
  background: var(--primary);
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-btn {
  padding: 10px 16px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.nav-btn:hover { color: white; }
.nav-btn.active { color: white; background: rgba(255,255,255,0.15); border-bottom: 3px solid white; }

.admin-body {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-val { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-light); }

.section-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.section-card h3 { font-size: 18px; color: var(--primary); margin-bottom: 16px; }

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 手機橫向滾動容器（JS 自動幾 .data-table 套上） */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

.data-table th {
  background: #eef6f0;
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

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

.data-table tbody tr:hover { background: #f8fafc; }

/* Results table (employee view) */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}

.results-table th, .results-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.results-table th { background: #eef6f0; font-size: 12px; font-weight: 700; color: var(--primary-dark); border-bottom: 2px solid var(--primary); }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: #e8f8ef; color: var(--success); }
.badge-gray { background: #f0f4f8; color: var(--text-light); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

/* Grading */
.grading-list { margin-top: 16px; }

.grading-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.grading-info { font-size: 14px; }

.essay-grade-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
}

.essay-question { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.essay-response { font-size: 14px; padding: 12px; background: #f0f4f8; border-radius: 8px; margin-bottom: 12px; }

.essay-grade-form { display: flex; align-items: center; gap: 8px; }
.essay-grade-form input { width: 60px; padding: 8px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; }

/* ---- Worktime (Module 6) responsive ---- */
.wt-job { text-align: left; }
.wt-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wt-types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wt-type-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f0f4f8; border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 14px;
  font-size: 14px; cursor: pointer; user-select: none; white-space: nowrap;
}
.wt-type-chip input { margin: 0; accent-color: var(--primary); }
.wt-type-chip:has(input:checked) { background: var(--primary); color: #fff; border-color: var(--primary); }
.wt-type-chip.is-checked { background: var(--primary); color: #fff; border-color: var(--primary); }
.wt-time {
  font-size: 15px; padding: 7px 8px; border: 2px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text);
  width: 92px; text-align: center; letter-spacing: 1px; box-sizing: border-box;
}
.wt-full { width: 100%; max-width: 100%; box-sizing: border-box; }
#worktimeScreen label { font-size: 14px; color: var(--text); }
#worktimeScreen .btn { touch-action: manipulation; }

/* Horizontal scroll wrapper for wide tables on small screens */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Responsive */
@media (max-width: 600px) {
  .center-card { padding: 32px 24px; margin: 40px auto; }
  .form-grid { grid-template-columns: 1fr; }
  .score-details { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .question-card { padding: 20px; }
  .q-text { font-size: 15px; }
  .admin-nav { padding: 0 8px; }
  .nav-btn { padding: 8px 10px; font-size: 11px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .results-table { font-size: 12px; }
  .results-table th, .results-table td { padding: 6px 8px; }

  /* Module grid -> 2 columns on phone */
  .module-grid { flex-direction: row; flex-wrap: wrap; gap: 12px; justify-content: center; }
  .module-card {
    width: calc(50% - 8px);
    max-width: calc(50% - 8px);
    flex: 0 0 calc(50% - 8px);
    padding: 20px 10px;
    box-sizing: border-box;
  }
  .module-icon { width: 44px; height: 44px; font-size: 22px; margin-bottom: 8px; box-shadow: 0 4px 10px rgba(27,122,75,0.22); }
  .module-title { font-size: 15px; }
  .module-desc { font-size: 11px; }

  /* Tab strip -> horizontal scroll instead of squashing */
  .tab-strip { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tab-btn { flex: 0 0 auto; }

  /* Card rows -> stack vertically */
  .card-row { flex-direction: column; align-items: stretch; gap: 8px; }

  /* Prevent iOS auto-zoom on focus: inputs >= 16px */
  .form-group input, .form-group select { font-size: 16px; }

  /* Modal near full-width */
  .modal-content { width: 95%; max-width: 95%; }

  /* Tighter main padding */
  .app-main { padding: 12px 8px; }

  /* Tables: let the direct container scroll horizontally instead of breaking layout */
  div:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Worktime phone tweaks */
  #worktimeScreen .center-card { padding: 24px 16px; margin: 16px auto; width: 96%; }
  #worktimeScreen input, #worktimeScreen select { font-size: 16px; }
  #worktimeScreen input[type="time"], #worktimeScreen input[type="date"] { padding: 9px 8px; min-height: 46px; }
  #worktimeScreen .wt-time { font-size: 16px; padding: 9px 8px; min-height: 46px; }
  .wt-inline { gap: 8px; }
  .wt-types { gap: 6px; }
  .wt-type-chip { font-size: 13px; padding: 7px 11px; }
  .wt-nosync { font-size: 14px; }
  .wt-client { width: 100% !important; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.modal-close:hover {
  background: #f0f4f8;
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Question list */
.question-list {
  margin-top: 12px;
}

.question-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

@media print {
  .exam-header, .admin-header, .admin-nav, .btn { display: none; }
  .section-card { box-shadow: none; border: 1px solid #ccc; }
}

/* Review Section */
.review-section {
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-top: 32px;
}

.review-question {
  transition: all 0.3s ease;
}

.review-question:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.review-question strong {
  font-size: 15px;
}

.review-question .q-text {
  font-size: 14px;
  line-height: 1.6;
}

.review-question .option-item {
  padding: 6px 0;
  font-size: 14px;
}

/* ===== Utility & Component layer (module refinement) ===== */
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--accent); }
.text-warning { color: var(--warning); }
.small { font-size: 13px; }
.fw-bold { font-weight: 700; }

.mt-8{margin-top:8px}.mt-10{margin-top:10px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-18{margin-top:18px}.mt-22{margin-top:22px}.mt-24{margin-top:24px}
.mb-0{margin:0!important}.mb-8{margin-bottom:8px}.mb-10{margin-bottom:10px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.my-8{margin:8px 0}.my-10{margin:10px 0}.my-12{margin:12px 0}.my-16{margin:16px 0}.my-20{margin:20px 0}.my-24{margin:24px 0}
.ml-6{margin-left:6px}.ml-12{margin-left:12px}.mr-6{margin-right:6px}
.py-4{padding-top:4px;padding-bottom:4px}

.page-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.h-between { display:flex; justify-content:space-between; align-items:center; }
.h-center { display:flex; gap:12px; justify-content:center; }
.h-center-wrap { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
.inline-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.field-row { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.field-row-lg { gap:14px; }
.module-grid { display:flex; flex-wrap:wrap; gap:16px; justify-content:center; margin:24px 0; }

.panel {
  margin:12px 0; padding:14px 16px;
  border:1px solid var(--border); border-radius:12px;
  background:var(--card-bg);
}
.panel-soft { background: var(--surface); }

.tab-strip { display:flex; gap:6px; margin:10px 0 14px; border-bottom:2px solid var(--border); }
.tab-btn { border-radius:8px 8px 0 0; }
.tab-btn.active { background: var(--primary); color:#fff; border-color: var(--primary); }

.section-title { margin-top:18px; font-size:16px; font-weight:700; color:var(--text); }
.divider { border:none; border-top:1px solid var(--border); margin:20px 0; }

.card-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 16px; border:1px solid var(--border); border-radius:10px;
  margin-bottom:8px; background:var(--surface-2);
}
.chip-inline { display:inline-flex; align-items:center; margin:6px 16px 6px 0; cursor:pointer; }

/* Align previously-blue accents to brand */
.lead-chip:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color:#fff; }
.perm-chip { background: var(--surface); color: var(--primary); }

/* ===== Feedback Box (意見箱) ===== */
.feedback-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.feedback-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.feedback-unread { border-left: 5px solid var(--warning); background: #fffdf5; }
.feedback-read { border-left: 5px solid var(--success); }
.feedback-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.feedback-category {
  font-weight: 700; color: var(--primary); font-size: 14px;
  background: #e8f4ef; padding: 4px 10px; border-radius: 6px;
}
.feedback-date { color: var(--text-light); font-size: 13px; margin-left: auto; }
.feedback-body { font-size: 15px; color: var(--text); line-height: 1.6; }
.feedback-body pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; line-height: 1.6;
}
.badge-read { background: #e8f8ef; color: var(--success); }
.badge-unread { background: #fff3cd; color: var(--warning); }

#feedbackScreen .form-group textarea {
  width: 100%; min-height: 160px; padding: 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; resize: vertical;
}
#feedbackScreen .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,122,75,0.16);
}

/* ===== 手機版（技術員出邊境用電話入單）：大掣、防誤撳、防止 iOS 縮放 ===== */
@media (max-width: 768px) {
  body { font-size: 14px; line-height: 1.5; }

  /* 輸入框／下拉：16px 字（防 iOS 自動放大）；高度收細啲但仲掂得中 */
  input, select, textarea, .form-group input, .form-group select {
    min-height: 38px;
    font-size: 16px !important;
    padding: 8px 10px;
  }
  input[type="month"], input[type="date"] { font-size: 16px; }

  /* 掣：收細（技術員嫌太大）；仲要夠大掂得中防誤撳 */
  .btn, .btn-sm, .btn-primary, .btn-outline, .nav-btn {
    min-height: 38px;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
  }
  .btn-xs {
    min-height: 32px;
    font-size: 13px;
    padding: 6px 10px;
  }

  /* 過濾列堆疊，唔好擠埋 */
  .section-card > div[style*="flex"] {
    gap: 8px !important;
  }
  .section-card label { margin-top: 4px; }

  /* 表格保持表格排版（❌ 唔好用 display:block，會炸版面：日期逐隻字打直疊） */
  .data-table { display: table; width: 100%; }
  .data-table th, .data-table td { padding: 6px 8px; font-size: 12px; white-space: nowrap; }
  /* 太闊嘅表：由直接母 div / 卡片做橫向滾動容器 */
  div:has(> .data-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 卡片/格仔堆疊 */
  .stat-card, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .section-card { padding: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 導航掣可以橫向滾 */
  .nav-tabs, .top-nav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .nav-btn { flex: 0 0 auto; }
}


/* ==================================================================
   UI PRO 2026-11-13 — 專業風格（只加新規則，唔改任何舊規則）
   全部 selector 用 ID scope，唔會 spill 去其他分頁；
   節日主題 / print / 600px / 768px 嘅舊規則喺下面逐項補返。
   ================================================================== */

/* ---------- 兩個登入頁：同一套品牌 ---------- */
#loginScreen.login-bg { background: linear-gradient(135deg, #0d3323 0%, #1b7a4b 100%); }
#adminLogin {
  background: linear-gradient(135deg, #0d3323 0%, #1b7a4b 100%);
  min-height: 100vh; display: flex; flex-direction: column;
}
#adminLogin::before {
  content: 'BIOCYCLE  \00b7  ADMIN'; display: flex; align-items: center;
  height: 52px; padding: 0 24px; background: rgba(0,0,0,.18); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
#loginScreen .brand-bar {
  background: rgba(0,0,0,.18); box-shadow: none; padding: 0 24px; height: 52px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
#loginScreen .brand-bar .bb-logo { font-size: 13px; letter-spacing: 1px; }
#loginScreen .brand-bar .bb-user { font-size: 11px; opacity: .72; }
#loginScreen .brand-bar .bb-author { font-size: 11px; opacity: .72; }
#loginScreen .center-card, #adminLogin .center-card {
  max-width: 420px; width: calc(100% - 32px); margin: 56px auto; padding: 36px 34px;
  border-top: 0; border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
#adminLogin .center-card { margin: auto; }
#loginScreen .center-card .logo img, #adminLogin .center-card .logo img { max-height: 54px; }
#loginScreen .center-card h1, #adminLogin .center-card h1 { font-size: 19px; font-weight: 700; color: var(--text); }
#loginScreen .center-card h2, #adminLogin .center-card h2 {
  font-size: 11px; letter-spacing: 1.4px; font-weight: 600; color: var(--text-light); margin-top: 4px;
}
#loginScreen .form-group, #adminLogin .form-group { text-align: left; margin-top: 16px; }
#loginScreen .form-group label, #adminLogin .form-group label { font-size: 12px; font-weight: 600; color: var(--text-light); }
#loginScreen .btn-block, #adminLogin .btn-block {
  margin-top: 22px; min-height: 44px; border-radius: 9px; background: var(--primary-dark);
}
#loginScreen .login-author, #adminLogin .login-author {
  margin: 14px 0 0; font-size: 11px; color: var(--text-light); opacity: .8;
}

/* ---------- 前台首頁：功能優先、單色線性 icon ---------- */
#homeScreen .brand-bar {
  background: #0d3323; padding: 0 20px; height: 52px; box-shadow: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
#homeScreen .brand-bar .bb-logo { font-size: 14px; font-weight: 700; letter-spacing: 1px; }
#homeScreen .brand-bar .bb-sub {
  display: inline-block; margin-left: 10px; font-size: 11px; font-weight: 400;
  letter-spacing: 0; opacity: .62; border-left: 1px solid rgba(255,255,255,.3); padding-left: 10px;
}
#homeScreen .brand-bar .bb-user { font-size: 11px; opacity: .66; }
#homeScreen .app-main { padding: 22px 12px 10px; align-items: flex-start; flex: 0 0 auto; }
#homeScreen .center-card {
  max-width: 820px; width: 100%; margin: 0 auto; padding: 26px 28px 22px;
  border-top: 0; border-radius: 14px; box-shadow: 0 2px 14px rgba(16,78,48,.07);
  display: flex; flex-direction: column; align-items: stretch; text-align: left;
}
/* display:contents 令 #homeHeader 嘅子項目直接參予 flex 排序 —— 唔使改 showHome() 一行 JS */
#homeScreen #homeHeader { display: contents; }
#homeScreen #homeHeader h1 { order: 0; font-size: 19px; font-weight: 700; color: var(--text); margin: 0; }
#homeScreen #homeHeader p { order: 1; font-size: 12px; color: var(--text-light); margin: 3px 0 0; }
#homeScreen .fest-banner { order: 1; margin: 14px 0 0; }
#homeScreen .module-grid {
  order: 2; display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px; margin: 20px 0 0;
}
#homeScreen .module-card {
  width: auto; max-width: none; min-height: 128px; padding: 16px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  box-shadow: none; text-align: left; display: flex; flex-direction: column;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
#homeScreen .module-card:hover {
  transform: none; border-color: var(--primary-light); background: #f7fbf9;
  box-shadow: 0 0 0 3px rgba(27,122,75,.07);
}
#homeScreen .module-icon {
  width: 34px; height: 34px; border-radius: 9px; margin: 0 0 12px;
  background: #e8f4ed; color: var(--primary-dark); font-size: 0; box-shadow: none;
}
#homeScreen .module-icon svg { width: 18px; height: 18px; stroke: currentColor; }
#homeScreen .module-title { font-size: 13.5px; font-weight: 650; color: var(--text); margin: 0 0 3px; }
#homeScreen .module-desc { font-size: 11.5px; color: #5f6f67; line-height: 1.5; }
#homeScreen .h-center {
  order: 3; justify-content: flex-start; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border); gap: 8px;
}
#homeScreen #homeHeader .quote-bar {
  order: 4; margin: 12px 0 0 !important; padding: 9px 14px !important;
  background: #f6f9f7 !important; border-left: 0 !important;
  box-shadow: inset 3px 0 0 var(--primary) !important; border-radius: 8px !important;
}
#homeScreen #homeHeader .quote-bar span {
  font-size: 12px !important; line-height: 1.6 !important;
  color: var(--text-light) !important; font-weight: 400 !important;
}
#homeScreen #homeHeader > div[style*="margin:6px 0 0"] { order: 5; margin: 8px 0 0 !important; }
#homeScreen #bgMusicBtn { font-size: 11px; padding: 4px 10px; min-height: 0; background: transparent; }
#homeScreen .home-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 820px; width: calc(100% - 24px); margin: 0 auto 20px; padding: 10px 4px 0;
  border-top: 1px solid rgba(16,78,48,.12); font-size: 11px; color: #7b8a83;
}
#homeScreen .home-footer b { font-weight: 700; color: #5f6f67; }

/* 節日主題補色：新 icon 底、center-card 頂位（舊 inline CSS 仍然生效） */
body.fest-midautumn #homeScreen .module-icon { background: #fff3d0; color: #8a5a00; }
body.fest-halloween #homeScreen .module-icon { background: #2c2c2c; color: #ff9f1c; }
body.fest-midautumn #homeScreen .center-card { padding-top: 88px; border-top: 5px solid #d4a017; }
body.fest-halloween #homeScreen .center-card { border-top: 5px solid #ff7518; }
body.fest-halloween #homeScreen .home-footer { color: #c9c9c9; border-top-color: #333; }
body.fest-halloween #homeScreen .home-footer b { color: #ffd6a5; }

/* ---------- 後台：深墨綠薄頂欄 + 236px 白底左側欄 ---------- */
#adminPanel {
  position: relative; display: grid;
  grid-template-columns: 236px minmax(0,1fr); grid-template-rows: 52px minmax(0,1fr);
  min-height: 100vh; background: var(--bg);
}
#adminPanel > .admin-header {
  grid-column: 1 / -1; grid-row: 1; height: 52px; padding: 0 18px;
  background: #0d3323; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
#adminPanel .admin-header .header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#adminPanel .admin-header .logo-sm img { height: 22px; width: auto; }
#adminPanel .admin-header .header-title-text {
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#adminPanel .admin-header .header-right { display: flex; align-items: center; gap: 8px; font-size: 11px; white-space: nowrap; }
#adminPanel .admin-header .header-right .btn { min-height: 0; padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.admin-burger {
  display: none; width: 30px; height: 30px; flex: 0 0 auto;
  align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.35); border-radius: 7px;
  background: transparent; color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
}
#adminPanel > .admin-nav {
  grid-column: 1; grid-row: 2; background: #fbfdfc; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 14px 10px; overflow-y: auto;
}
#adminPanel .admin-nav .nav-group-label {
  font-size: 12px; letter-spacing: 1.2px; font-weight: 700;
  color: #7a8a82; padding: 13px 12px 5px; white-space: nowrap;
}
#adminPanel .admin-nav .nav-btn {
  width: 100%; min-height: 0; padding: 9px 11px; margin: 0;
  display: flex; align-items: center; gap: 8px; text-align: left;
  font-size: 15px; font-weight: 500; color: #4c5c54; line-height: 1.35;
  border: 0; border-radius: 7px; flex: 0 0 auto;
  transition: background .15s, color .15s;
}
/* 舊選單掣內嵌彩色 emoji：唔改任何掣，只用灰階令佢同前台單色 icon 一致 */
#adminPanel .admin-nav .nav-btn:not(.active) { filter: grayscale(.9); }
#adminPanel .admin-nav .nav-btn:hover { background: #f0f7f3; color: var(--primary-dark); }
#adminPanel .admin-nav .nav-btn.active {
  background: #e1f5ee; color: var(--primary-dark); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
#adminPanel .admin-nav .admin-nav-author {
  margin-top: auto; padding: 12px 12px 4px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: #7a8a82; line-height: 1.5;
}
#adminPanel > .admin-body {
  grid-column: 2; grid-row: 2; padding: 22px 24px;
  max-width: none; margin: 0; min-width: 0;
}
#adminPanel .admin-mask { display: none; }

/* 窄屏：手機／平板都用左側漢堡抽屜（同一個 .admin-nav，唔郁任何掣） */
@media (max-width: 900px) {
  #adminPanel { display: block; }
  #adminPanel > .admin-header { height: 52px; padding: 0 12px; }
  #adminPanel .admin-header .header-title-text { display: none; }
  #adminPanel .admin-header .logo-sm img { height: 20px; }
  #adminPanel .admin-header .header-right .btn { padding: 4px 8px; font-size: 10px; }
  #adminPanel .admin-header .header-right { gap: 5px; }
  .admin-burger { display: flex; }
  #adminPanel > .admin-nav {
    position: absolute; z-index: 30; left: 0; top: 52px; bottom: 0; width: 272px;
    transform: translateX(-101%); transition: transform .22s ease;
    border-bottom: 0; box-shadow: 8px 0 24px rgba(13,51,35,.16);
  }
  #adminPanel.drawer-open > .admin-nav { transform: translateX(0); }
  #adminPanel > .admin-body { padding: 14px; }
  #adminPanel .admin-mask {
    display: none; position: absolute; z-index: 25;
    inset: 52px 0 0 0; background: rgba(13,51,35,.34);
  }
  #adminPanel.drawer-open .admin-mask { display: block; }
  #homeScreen .module-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  #homeScreen .center-card { padding: 20px 16px; }
  #homeScreen .brand-bar .bb-sub { display: none; }
}

/* print：舊 @media print 用 .admin-header/.admin-nav，特異性低過上面 ID scope，喺度補返 */
@media print {
  #adminPanel { display: block !important; }
  #adminPanel > .admin-header, #adminPanel > .admin-nav,
  #adminPanel .admin-mask, .admin-burger { display: none !important; }
  #adminPanel > .admin-body { padding: 0 !important; }
}
/* ===== END UI PRO 2026-11-13 ===== */

/* ==================================================================
   WT MOBILE 2026-11-13 — 工時記錄手機排版整理
   只加 @media (max-width:700px) + #worktimeScreen scope 嘅新規則
   （700px 對齊舊有 `.wt-inline` 手機斷點，601–700px 都唔再亂）。
   唔改任何舊規則、唔郁 HTML / JS / 資料。
   目標：所有輸入框同工作類型 chip 等闊對齊，掣等闊、易撳。
   ================================================================== */
@media (max-width: 700px) {
  #worktimeScreen .center-card { padding: 18px 14px; }
  #worktimeScreen .center-card > .h-between { gap: 10px; }
  #worktimeScreen .center-card > .h-between h2 { font-size: 17px; line-height: 1.3; margin: 0; min-width: 0; }
  #worktimeScreen .center-card > .h-between > .btn { flex: 0 0 auto; }

  /* 日期 / 狀態：兩格等闊 */
  #worktimeScreen .field-row-lg {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
  }
  #worktimeScreen .field-row-lg > div { min-width: 0; }
  #worktimeScreen .field-row-lg input,
  #worktimeScreen .field-row-lg select { width: 100%; box-sizing: border-box; }
  #worktimeScreen .field-row-lg > span { grid-column: 1 / -1; }

  /* 上班 / 實際上班 / 下班：三格等闊；儲存掣另起一行全闊 */
  #wtTimesBox > .wt-inline {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
  }
  #wtTimesBox > .wt-inline > div { min-width: 0; }
  #wtTimesBox > .wt-inline > div:last-child { grid-column: 1 / -1; align-self: auto !important; }
  #wtTimesBox > .wt-inline .wt-time { width: 100%; }
  #wtTimesBox > .wt-inline > div:last-child .btn { width: 100%; }

  /* 兩個 REMARK checkbox 改直排，唔好一長一短 */
  #wtNightRecoveryBox { flex-direction: column; gap: 10px !important; align-items: stretch !important; }

  /* 今日隊員：每行 select 等闊、× 掣固定闊 */
  #wtMembers { display: grid !important; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #wtMembers > div {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    width: 100%;
  }
  #wtMembers .wt-member { width: 100%; min-width: 0; }
  #wtMembers > div > .btn { width: 38px; padding: 0; }

  #wtRemarkBox input { width: 100%; box-sizing: border-box; }

  /* 工作單標題列：兩粒掣等闊並排 */
  #wtJobsBox > .h-between { flex-direction: column; align-items: stretch; gap: 10px; }
  #wtJobsBox > .h-between > div { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  #wtJobsBox > .h-between .btn { width: 100%; padding: 8px 6px; font-size: 13px; }

  /* 每張工作單 */
  #wtJobs .wt-job { padding: 12px !important; margin: 10px 0 !important; }
  #wtJobs .wt-job > .wt-inline {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
  }
  #wtJobs .wt-job > .wt-inline > span {
    min-width: 0 !important;
    display: flex; flex-direction: column; gap: 4px;
  }
  #wtJobs .wt-job > .wt-inline > span:first-child { grid-column: 1 / -1; }
  #wtJobs .wt-job > .wt-inline input { width: 100% !important; min-width: 0; box-sizing: border-box; }

  /* 工作類型：等闊格仔（窄機 2 欄、闊機自動 3 欄） */
  #wtJobs .wt-types {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 8px;
    margin-top: 8px;
  }
  #wtJobs .wt-type-chip {
    width: 100%; box-sizing: border-box;
    justify-content: flex-start; text-align: left;
    padding: 8px 10px; font-size: 13px; min-height: 38px;
    white-space: normal; line-height: 1.25;
  }
  #wtJobs .wt-type-chip input { flex: 0 0 auto; }

  /* 備註：文字上一行、輸入框全闊 */
  #wtJobs .wt-job > .wt-full { display: flex !important; flex-direction: column; gap: 4px; }
  #wtJobs .wt-remarks { width: 100%; box-sizing: border-box; }

  /* 卡底兩粒掣等闊 */
  #wtJobs .wt-job > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch !important;
    gap: 8px;
  }
  #wtJobs .wt-job > div:last-child .btn { width: 100%; text-align: center; }

  /* 最底主儲存掣全闊 */
  #worktimeScreen .center-card > .mt-16 > .btn-primary { width: 100%; }
  #worktimeScreen .center-card > .mt-16 > #wtMsg { display: block; text-align: center; margin: 8px 0 0; }
}
/* ===== END WT MOBILE 2026-11-13 ===== */

/* ==================================================================
   FRONT MOBILE 2026-11-13 — 前台其他功能頁 手機排版整理
   倉存／車隊／佣金 hub／意見箱／考試頂欄。
   只喺 <=700px 加 ID-scope 新規則，唔改任何舊規則、唔郁 HTML / JS / 資料。
   ================================================================== */
@media (max-width: 700px) {

  /* 頂欄「標題＋返回掣」手機容許換行 */
  #warehouseScreen .page-head, #fleetScreen .page-head,
  #commissionHubScreen .page-head, #feedbackScreen .h-between { flex-wrap: wrap; gap: 8px; }

  /* ---- 倉存：記錄出入倉一行 → grid 2 欄；radio 一行全闊；提交掣全闊 ---- */
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px; align-items: end;
  }
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) > .form-group { min-width: 0; margin: 0 !important; }
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) input,
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) select { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) > .form-group:nth-child(3) { grid-column: 1 / -1; }
  #warehouseScreen h3.mt-18 + div:not(#whHistoryTable):not(#whStockPanel) > .btn { grid-column: 1 / -1; width: 100%; }

  /* 倉存：新增物資盒 → 直排、輸入框全闊 */
  #whAddNewBox { display: grid !important; grid-template-columns: 1fr; gap: 8px; }
  #whAddNewBox input { width: 100% !important; box-sizing: border-box; }
  #whAddNewBox .btn { width: 100%; }

  /* ---- 車隊：篩選 3 格 → 2 欄、月份全闊 ---- */
  #fleetScreen .field-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
  #fleetScreen .field-row > .form-group { min-width: 0; margin: 0 !important; }
  #fleetScreen .field-row input, #fleetScreen .field-row select { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
  #fleetScreen .field-row > .form-group:nth-child(3) { grid-column: 1 / -1; }

  /* 車隊：出車／返回／入油／保養／維修 表單盒 → grid 2 欄、確認掣全闊 */
  #fleetScreen .fleet-form-box > div { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
  #fleetScreen .fleet-form-box > div > .form-group { min-width: 0; margin: 0 !important; }
  #fleetScreen .fleet-form-box input, #fleetScreen .fleet-form-box select { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
  #fleetScreen .fleet-form-box > div > .btn { grid-column: 1 / -1; width: 100%; }

  /* ---- 佣金 hub ---- */
  /* 渠網：日期／客戶編號行直排、輸入框全闊 */
  #commChannelSub .panel > .inline-row { display: flex !important; flex-direction: column; align-items: stretch; gap: 6px; }
  #commChannelSub .panel > .inline-row input { width: 100% !important; box-sizing: border-box; }
  /* 服務佣金：客戶編號／姓名／電話 3 欄 → 1 欄 */
  #commTechSub .panel > div[style*='1fr 1fr 1fr'] { grid-template-columns: 1fr !important; }
  /* 渠網隊員行：select 全闊、兩個件數 2 欄、移除掣全闊 */
  #commChannelSub .comm-member-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #commChannelSub .comm-member-row > .comm-emp { grid-column: 1 / -1; width: 100%; min-width: 0; }
  #commChannelSub .comm-member-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
  #commChannelSub .comm-member-row label input { width: 100% !important; box-sizing: border-box; }
  #commChannelSub .comm-member-row > .btn { grid-column: 1 / -1; width: 100%; }
  /* 服務佣金隊員行：select 全闊 + 移除掣固定闊 */
  #commTechSub .lead-member-row { display: grid !important; grid-template-columns: minmax(0, 1fr) 64px; gap: 8px; }
  #commTechSub .lead-member-row .lead-emp { min-width: 0 !important; width: 100%; }
  #commTechSub .lead-member-row > .btn { width: 100%; padding: 0; }
  /* 服務佣金提交掣全闊 */
  #commTechSub .panel > .inline-row .btn { width: 100%; }

  /* ---- 考試頁頂欄：手機慳位 ---- */
  #examScreen .exam-header { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  #examScreen .header-subtitle { font-size: 11.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #examScreen .timer { font-size: 16px; padding: 3px 10px; }
}
/* ===== END FRONT MOBILE 2026-11-13 ===== */

/* ==================================================================
   EXAM CONFIG PICKER 2026-11-24 — 後台考試日期／時間選單
   只喺 #configForm scope 加新規則，唔改任何舊規則。
   ================================================================== */
#configForm .cfg-hint {
  font-size: 13px; color: #4a5d52; background: #f1f7f3;
  border: 1px solid #d6e6db; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 14px;
}
#configForm .cfg-datetime { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#configForm .cfg-date-in {
  flex: 1 1 155px; min-width: 135px; padding: 7px 9px;
  border: 1px solid #cfd9d2; border-radius: 6px; font-size: 14px; box-sizing: border-box;
}
#configForm .cfg-time-sel {
  flex: 0 0 70px; padding: 7px 5px;
  border: 1px solid #cfd9d2; border-radius: 6px; font-size: 14px; box-sizing: border-box;
}
#configForm .cfg-colon { font-weight: 700; color: #4a5d52; }
#configForm .cfg-preview { font-size: 12px; color: #6b7b72; margin-top: 5px; }
#configForm .cfg-preview b { color: #1a6b45; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
@media (max-width: 700px) {
  #configForm .cfg-date-in { flex: 1 1 100%; min-width: 0; }
  #configForm .cfg-time-sel { flex: 1 1 62px; }
}
/* ===== END EXAM CONFIG PICKER 2026-11-24 ===== */
