/* 
  app.css - Tablet-Optimized Quality Control UI
  Sharonply QC Automation
*/

:root {
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --border: #cbd5e1;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header */
.app-header {
  background: #ffffff;
  border-bottom: 2px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--slate-200);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-badge {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--slate-600);
  display: block;
}

.header-status-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
}

.status-online {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid #86efac;
}

.status-online .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  animation: pulse-dot 2s infinite;
}

.status-offline {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde047;
}

.status-offline .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #f59e0b;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.btn-sync-icon {
  background: var(--slate-100);
  border: 1px solid var(--slate-300);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.btn-sync-icon:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.autosave-badge, .bottom-autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  transition: all 0.25s ease;
}

.status-saved-green {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-saving-yellow {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde047;
}

.autosave-badge.saved-pulse, .bottom-autosave-indicator.saved-pulse {
  animation: green-flash 0.8s ease-out;
}

@keyframes green-flash {
  0% { transform: scale(1.08); box-shadow: 0 0 10px rgba(34, 197, 94, 0.5); }
  100% { transform: scale(1); box-shadow: none; }
}

/* Nav Tabs */
.app-nav {
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.5rem;
  background-color: #ffffff;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab-btn:hover {
  color: var(--primary);
  background-color: var(--slate-50);
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: var(--primary-light);
}

.badge-count {
  background-color: #ef4444;
  color: white;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-weight: bold;
}

/* Global Action Toolbar */
.toolbar-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
}

/* Print Button & Segmented Switch Group */
.print-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--slate-100);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--slate-300);
}

.print-segmented-control {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.btn-print-opt {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-600);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-print-opt:hover {
  color: var(--slate-900);
}

.btn-print-opt.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 42px; /* Tablet finger tap area */
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  min-height: 34px;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #166534;
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--slate-700);
  border-color: var(--slate-300);
}

.btn-secondary:hover {
  background-color: var(--slate-100);
  border-color: var(--slate-400);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-danger-outline:hover {
  background-color: var(--danger-bg);
}

/* App Main Container */
.app-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Report Form Card */
.report-form-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.report-meta-card {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meta-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-700);
}

.form-input, .form-select {
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--slate-800);
  background-color: #ffffff;
  outline: none;
  min-height: 42px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Batch Helper Bar */
.batch-helper-bar {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-200);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  background-color: var(--slate-50);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.batch-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.batch-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.batch-num-input {
  width: 55px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.9rem;
}

.batch-select {
  min-height: 34px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

/* Real-Time Metrics Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.metric-box {
  background: #ffffff;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}

.metric-box.highlight-metric {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #ffffff;
  border: none;
}

.metric-box.highlight-metric .metric-label {
  color: #dbeafe;
}

.metric-box.highlight-metric .metric-unit {
  color: #bfdbfe;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--slate-600);
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 0.2rem;
}

.metric-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-400);
  align-self: flex-start;
}

/* Table Design */
.table-responsive-wrapper {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.qc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.qc-table th {
  background-color: #1e3a8a;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.85rem 0.6rem;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  user-select: none;
}

.qc-table th:last-child {
  border-right: none;
}

.qc-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--slate-200);
  border-right: 1px solid var(--slate-200);
  font-size: 0.92rem;
}

.qc-table td:last-child {
  border-right: none;
}

.qc-table tr:hover {
  background-color: #f8fafc;
}

.qc-table tr.row-filled {
  background-color: #f0fdf4;
}

.col-sno {
  width: 60px;
  text-align: center;
}

.col-sno-val {
  text-align: center;
  font-weight: 700;
  color: var(--slate-600);
}

.col-machine {
  width: 180px;
}

.col-species {
  width: 220px;
}

.btn-species-add {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  cursor: pointer;
}

.btn-species-add:hover {
  background: rgba(255, 255, 255, 0.35);
}

.col-t {
  width: 110px;
  text-align: center;
}

.col-avg {
  width: 130px;
  text-align: center;
  background-color: #f1f5f9;
}

/* Universal Placeholder & Grey Text Standards */
::placeholder,
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder {
  color: #94a3b8 !important;
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  opacity: 0.9 !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
}

.cell-select {
  width: 100%;
  padding: 0.45rem 0.35rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: #ffffff;
  color: var(--slate-800);
}

.cell-select option[value=""] {
  color: #64748b;
  font-weight: 400;
}

.cell-input {
  width: 100%;
  padding: 0.45rem 0.3rem;
  font-size: 0.95rem;
  text-align: center;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  outline: none;
}

.cell-input::placeholder {
  color: #94a3b8 !important;
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  opacity: 0.9 !important;
  text-align: center !important;
  line-height: normal !important;
  letter-spacing: 0 !important;
}

.cell-input:focus {
  border-color: var(--primary);
  background-color: #eff6ff;
}

.cell-avg-display {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-600);
}

.cell-avg-display.has-avg {
  color: #1e40af;
  background-color: #dbeafe;
  border-radius: 6px;
  padding: 0.35rem 0;
}

.cell-row-action {
  text-align: center;
  width: 56px;
}

.btn-clear-row,
.btn-clear-row-8ft,
.btn-row-del {
  background: #f1f5f9;
  border: 1px solid var(--slate-300);
  color: var(--slate-600);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.15s ease;
}

.btn-clear-row:hover,
.btn-clear-row:active,
.btn-clear-row-8ft:hover,
.btn-clear-row-8ft:active,
.btn-row-del:hover,
.btn-row-del:active {
  color: var(--danger);
  background-color: var(--danger-bg);
  border-color: #fca5a5;
  transform: scale(1.08);
}

/* ==========================================================================
   CPIL 301 A QC Digitalisation Form & Table Styles
   ========================================================================== */

.cpil-container {
  width: 100%;
}

.cpil-card-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid var(--slate-200);
}

.cpil-badge {
  display: inline-block;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.cpil-title-label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--slate-800);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* CPIL 301 A Grouped Headers */
.cpil-qc-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.cpil-qc-table thead tr.header-group-row th {
  background-color: #1e3a8a;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  padding: 0.6rem 0.4rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.cpil-qc-table thead tr.header-sub-row th {
  background-color: #2563eb;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  padding: 0.4rem 0.3rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid #1e3a8a;
}

.cpil-qc-table thead th.th-sno {
  width: 50px;
  min-width: 45px;
}

.cpil-qc-table thead th.th-mc {
  width: 68px;
  min-width: 58px;
  text-align: center;
}

.col-machine-cell {
  width: 68px;
  min-width: 58px;
  text-align: center;
}

.cell-machine-select {
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.45rem 0.2rem;
  width: 100%;
  min-width: 48px;
  text-align-last: center;
  -moz-text-align-last: center;
  color: var(--slate-800);
  background-color: #ffffff;
}

.batch-machine-select {
  min-width: 65px;
  text-align: center;
  font-weight: 700;
}

.cpil-qc-table thead th.th-species {
  width: 170px;
  min-width: 150px;
}

.cpil-qc-table thead th.th-length {
  width: 70px;
  min-width: 65px;
}

.cpil-qc-table thead th.th-width-group {
  background-color: #1e40af;
}

.cpil-qc-table thead th.th-diag-group {
  background-color: #1d4ed8;
}

.cpil-qc-table thead th.th-thick-group {
  background-color: #1e40af;
}

.cpil-qc-table thead th.th-diff {
  background-color: #0f766e;
  width: 110px;
  min-width: 95px;
}

.cpil-qc-table thead th.th-avg {
  background-color: #1e3a8a;
  width: 95px;
  min-width: 85px;
}

.cpil-qc-table thead th.th-action {
  width: 72px;
  min-width: 65px;
  font-size: 0.72rem;
  line-height: 1.15;
  text-align: center;
  padding: 4px 2px;
  white-space: normal;
}

.sub-header-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.9;
  letter-spacing: 0.3px;
}

/* CPIL Cell Sizing & Formatting */
.cell-dim {
  min-width: 55px;
  max-width: 70px;
  text-align: center;
  font-weight: 600;
}

.cell-measure {
  min-width: 58px;
  max-width: 75px;
  text-align: center;
  font-weight: 600;
}

.cell-diag {
  min-width: 62px;
  max-width: 80px;
  text-align: center;
  font-weight: 600;
}

.cell-t {
  min-width: 58px;
  max-width: 75px;
  text-align: center;
  font-weight: 600;
}

.cell-calc-display {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-500);
  padding: 0.35rem 0.25rem;
  border-radius: 6px;
  background-color: #f8fafc;
  transition: all 0.2s ease;
  user-select: none;
}

.cell-diff.has-val {
  color: #0f766e;
  background-color: #ccfbf1;
  font-weight: 800;
  border: 1px solid #99f6e4;
}

.cell-diff.has-exceeded {
  color: #b91c1c;
  background-color: #fee2e2;
  font-weight: 800;
  border: 1px solid #fca5a5;
}

.cell-avg.has-avg {
  color: #1e40af;
  background-color: #dbeafe;
  font-weight: 800;
  border: 1px solid #bfdbfe;
}

.batch-num-input {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  background: #ffffff;
  outline: none;
}

.batch-num-input:focus {
  border-color: var(--primary);
  background-color: #eff6ff;
}

/* ==========================================================================
   Smooth Deletion & Clear Animations
   ========================================================================== */

tr.row-deleting {
  animation: rowDeleteSlideOut 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

tr.row-deleting td {
  background-color: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

tr.row-deleting .btn-clear-row,
tr.row-deleting .btn-clear-row-8ft {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(0.9) rotate(20deg) !important;
  border-color: #dc2626 !important;
}

@keyframes rowDeleteSlideOut {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  45% {
    opacity: 0.65;
    transform: translateX(-18px);
    background-color: #fecaca;
  }
  100% {
    opacity: 0;
    transform: translateX(-60px);
  }
}

tbody.tbody-clearing tr {
  animation: sheetClearWipe 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes sheetClearWipe {
  0% {
    opacity: 1;
    transform: translateY(0);
    background-color: #fee2e2;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

/* Table Footer Controls */
.table-footer-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.spacer {
  flex: 1;
}

/* Outbox & History Section */
.card-section {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--slate-600);
  margin-bottom: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--slate-600);
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.data-list-table {
  width: 100%;
  border-collapse: collapse;
}

.data-list-table th {
  background-color: var(--slate-100);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--slate-200);
}

.data-list-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--slate-200);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.full-width-card {
  grid-column: 1 / -1;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-700);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--slate-600);
}

.species-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.species-chip {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.del-species-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
}

.add-species-inline-row {
  display: flex;
  gap: 0.5rem;
}

.backup-actions-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.file-upload-label {
  cursor: pointer;
}

/* Scaffold Card (8ft / Core Composer) */
.scaffold-card {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  text-align: center;
  max-width: 800px;
  margin: 2rem auto;
}

.scaffold-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.scaffold-subtitle {
  color: var(--slate-600);
  font-size: 1.05rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.scaffold-info-box {
  background-color: var(--slate-50);
  border: 1.5px dashed var(--slate-300);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: left;
}

.scaffold-info-box h3 {
  margin-bottom: 0.75rem;
  color: var(--slate-800);
}

.scaffold-info-box ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--slate-700);
}

.scaffold-note {
  font-weight: 600;
  color: var(--primary);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 300px;
  max-width: 480px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-danger {
  border-left: 4px solid #ef4444;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

.toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
}

.toast-fade {
  opacity: 0;
  transform: translateY(10px);
}

/* Hide Print Area during normal screen display */
#printArea {
  display: none;
}

/* Home Dashboard */
.home-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-hero-card {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  padding: 2rem 2.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.hero-content {
  max-width: 650px;
}

.hero-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 0.6rem;
}

.hero-content h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.hero-content p {
  color: #dbeafe;
  font-size: 0.95rem;
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
}

.hero-stat-item {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  min-width: 120px;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-lbl {
  font-size: 0.78rem;
  color: #bfdbfe;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0.25rem;
  display: block;
}

.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.module-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.module-card-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
}

.module-card-info {
  flex: 1;
}

.module-card-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 0.4rem;
}

.module-desc {
  font-size: 0.9rem;
  color: var(--slate-600);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.module-status-chip {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background-color: var(--slate-100);
  color: var(--slate-600);
  margin-bottom: 1.25rem;
}

.chip-active {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.chip-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde047;
}

.module-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-block {
  width: 100%;
}

/* Settings Subnav */
.settings-subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  border-bottom: 2px solid var(--slate-200);
  padding-bottom: 0.5rem;
}

.settings-subnav-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.settings-subnav-btn:hover {
  background-color: var(--slate-200);
  color: var(--slate-900);
}

.settings-subnav-btn.active {
  background-color: var(--primary);
  color: #ffffff;
}

.gas-guide-box {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  padding: 1.25rem;
}

.gas-guide-box h3 {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: var(--slate-800);
}

.gas-guide-box ol {
  padding-left: 1.25rem;
  font-size: 0.88rem;
  color: var(--slate-700);
  line-height: 1.6;
}

.gas-guide-box a {
  color: var(--primary);
  font-weight: 600;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.modal-visible {
  display: flex;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--slate-200);
  background-color: #f8fafc;
}

.modal-header h3 {
  font-size: 1.15rem;
  color: var(--slate-900);
}

.modal-close-x {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-400);
  cursor: pointer;
  line-height: 1;
}

.modal-close-x:hover {
  color: var(--slate-700);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-attachment-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--primary-light);
  border: 1px solid #bfdbfe;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.attach-icon {
  font-size: 1.2rem;
}

.preview-pre {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  padding: 0.75rem;
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.8rem;
  max-height: 140px;
  overflow-y: auto;
  color: var(--slate-700);
  white-space: pre-wrap;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--slate-200);
  background-color: #f8fafc;
}

/* Bottom Action Banner */
.bottom-action-banner {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.bottom-action-banner .banner-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.bottom-action-banner .banner-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-800);
}

.bottom-action-banner .banner-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Header Sync Button & Spinner */
.btn-sync-icon {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-sync-icon:hover {
  background: var(--slate-50);
  color: var(--primary);
  border-color: var(--primary-light);
}

.btn-sync-icon.syncing-active {
  color: var(--primary);
  border-color: var(--primary);
  background-color: #eff6ff;
}

@keyframes spin-sync {
  100% { transform: rotate(360deg); }
}

.btn-sync-icon.syncing-active {
  animation: pulse 1.5s ease infinite;
}

/* ==========================================================================
   Mobile & Tablet Responsive Optimizations (< 768px & < 480px)
   ========================================================================== */

@media (max-width: 768px) {
  /* 1. Header Layout */
  .app-header {
    padding: 0;
  }

  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
  }

  .brand-section {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .brand-logo-badge {
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .brand-subtitle {
    font-size: 0.72rem;
  }

  .header-status-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    width: 100%;
    padding-top: 0.35rem;
    border-top: 1px solid var(--slate-100);
  }

  .btn-sync-icon {
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .autosave-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* 2. Navigation Tabs (Horizontal Touch Swipe) */
  .app-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    min-height: 38px;
  }

  /* 3. Global Action Toolbar */
  .toolbar-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.6rem 0.75rem;
    position: static;
  }

  .toolbar-container > button,
  .toolbar-container > .btn {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 130px;
    font-size: 0.82rem;
    padding: 0.55rem 0.6rem;
    justify-content: center;
    text-align: center;
  }

  #actionNewBtn {
    flex: 1 1 100%;
    order: 1;
  }

  #actionSaveBtn {
    order: 2;
  }

  #actionExcelBtn {
    order: 3;
  }

  .print-btn-group {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    order: 4;
    width: 100%;
  }

  .print-segmented-control {
    width: 100%;
    display: flex;
  }

  .print-segmented-control .btn-print-opt {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.45rem 0.35rem;
    text-align: center;
  }

  #actionPrintBtn {
    width: 100%;
    justify-content: center;
  }

  #actionMailBtn {
    flex: 1 1 100%;
    order: 5;
    font-size: 0.95rem;
    padding: 0.7rem;
    font-weight: 700;
  }

  /* 4. App Main & Form Inputs */
  .app-main {
    padding: 0.75rem 0.65rem;
  }

  .report-meta-card {
    padding: 0.85rem;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .form-input, .form-select {
    font-size: 16px; /* Prevents auto-zoom on mobile Safari/Chrome */
  }

  /* Quick Batch Apply */
  .batch-helper-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .batch-group {
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }

  .batch-group select {
    flex: 1;
    min-width: 140px;
  }

  .batch-group .btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.2rem;
  }

  /* Inspection Table */
  .table-responsive-wrapper {
    margin: 0 -0.65rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .qc-table th, .qc-table td {
    padding: 0.4rem 0.35rem;
  }

  .cell-input {
    font-size: 15px !important;
    height: 38px;
  }

  .cell-input::placeholder {
    font-size: 0.80rem !important;
    font-weight: 400 !important;
    color: #94a3b8 !important;
    opacity: 0.9 !important;
    letter-spacing: 0 !important;
  }

  .cell-select {
    font-size: 14px !important;
    height: 38px;
    padding: 0.4rem 0.25rem !important;
  }

  /* 5. Home Dashboard */
  .home-hero-card {
    padding: 1.25rem 1rem;
    flex-direction: column;
    gap: 1.25rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 0.6rem;
  }

  .hero-stat-item {
    padding: 0.75rem;
    text-align: center;
  }

  .module-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* 6. Settings & Outbox Archive */
  .settings-subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.4rem;
    padding-bottom: 0.35rem;
  }

  .settings-subnav-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .history-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  /* Bottom Action Banner on mobile */
  .bottom-action-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
  }

  .bottom-action-banner .banner-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .bottom-action-banner .banner-buttons #bottomSaveBtn {
    grid-column: 1 / -1;
  }

  .bottom-action-banner .banner-buttons #bottomMailBtn {
    grid-column: 1 / -1;
  }
}

/* ==========================================================================
   HAND-DRAWN DOODLE SIGNATURES & VERIFICATION SECTION
   ========================================================================== */

.field-with-doodle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.field-with-doodle input {
  flex: 1;
}

.btn-doodle-icon {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-doodle-icon:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.btn-doodle-icon.has-sig {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

/* Signatures & Verification Bottom Card */
.signatures-verification-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.signatures-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 0.5rem;
}

.signatures-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.signatures-card-hint {
  font-size: 0.8rem;
  color: var(--slate-500);
}

.signatures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.sig-slot-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 135px;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.sig-slot-box.is-signed {
  border-style: solid;
  border-color: #93c5fd;
  background: #f0f9ff;
}

.sig-slot-role {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sig-preview-img {
  max-height: 52px;
  max-width: 90%;
  object-fit: contain;
  margin: 0.25rem 0;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 2px;
}

.sig-person-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-800);
  margin-top: 0.25rem;
}

.sig-slot-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn-sig-draw {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-sig-draw:hover {
  background: var(--primary-light);
}

.btn-sig-clear {
  background: transparent;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-sig-clear:hover {
  background: #fee2e2;
}

/* Signature Drawing Modal */
.signature-modal-card {
  max-width: 520px;
  width: 95%;
}

.sig-canvas-wrapper {
  position: relative;
  background: #ffffff;
  border: 2px solid var(--slate-300);
  border-radius: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 200px;
  cursor: crosshair;
  touch-action: none; /* Critical: blocks touch scroll when signing on mobile/tablet */
}

.sig-baseline-guide {
  position: absolute;
  bottom: 35px;
  left: 20px;
  right: 20px;
  border-bottom: 1.5px dashed #cbd5e1;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}

.sig-baseline-guide span {
  font-size: 0.75rem;
  color: #94a3b8;
  padding-bottom: 3px;
}

.sig-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sig-modal-footer .spacer {
  flex: 1;
}

/* ==========================================================================
   DRYER TEMPERATURE REPORT GRID SPECIFICS
   ========================================================================== */

.th-dryer-group {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
}

.cell-dryer-temp {
  font-weight: 700;
  color: #c2410c;
}

.cell-dryer-mc {
  font-weight: 700;
  color: #047857;
}

.cell-shift-select {
  width: 100% !important;
  min-width: 54px !important;
  font-weight: 700 !important;
  text-align: center !important;
  padding: 0.45rem 0.2rem !important;
}

.dryer-no-select {
  width: 100% !important;
  min-width: 66px !important;
  font-weight: 700 !important;
  text-align: center !important;
  color: #1e3a8a !important;
  padding: 0.45rem 0.25rem !important;
}

.cell-date-note {
  min-width: 86px !important;
  font-size: 0.88rem !important;
  text-align: center !important;
}

.tag-condition {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag-condition.green {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.tag-condition.half-dry {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Glowing Indicators & Condition Column */
.th-dryer-condition {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  font-size: 0.82rem;
  white-space: nowrap;
}

.cell-condition-col {
  padding: 0.25rem 0.3rem !important;
  text-align: center;
  vertical-align: middle;
}

.condition-cell-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.condition-dot {
  width: 13px;
  height: 13px;
  min-width: 13px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.condition-dot.dot-green {
  background-color: #10b981;
  border: 1.5px solid #059669;
  box-shadow: 0 0 7px 2px rgba(16, 185, 129, 0.75);
  animation: glow-green-pulse 2s infinite alternate ease-in-out;
}

.condition-dot.dot-brown {
  background-color: #8b4513;
  border: 1.5px solid #5c2c09;
  box-shadow: 0 0 7px 2px rgba(139, 69, 19, 0.75);
  animation: glow-brown-pulse 2s infinite alternate ease-in-out;
}

@keyframes glow-green-pulse {
  0% {
    box-shadow: 0 0 4px 1px rgba(16, 185, 129, 0.45);
    transform: scale(0.96);
  }
  100% {
    box-shadow: 0 0 10px 3px rgba(16, 185, 129, 0.85);
    transform: scale(1.08);
  }
}

@keyframes glow-brown-pulse {
  0% {
    box-shadow: 0 0 4px 1px rgba(139, 69, 19, 0.45);
    transform: scale(0.96);
  }
  100% {
    box-shadow: 0 0 10px 3px rgba(139, 69, 19, 0.85);
    transform: scale(1.08);
  }
}

.dryer-condition-select {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 0.35rem 0.3rem !important;
  border-radius: 4px !important;
  color: #1e293b;
  width: 84px !important;
}

/* ==========================================================================
   MOISTURE CHECKING REPORT GRID SPECIFICS
   ========================================================================== */

.moisture-table th.th-core-group {
  background-color: #1e3a8a !important;
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.moisture-table th.th-panel-group {
  background-color: #065f46 !important;
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.moisture-table .sub-dim {
  font-size: 0.7rem;
  opacity: 0.85;
  font-weight: normal;
}

.moisture-table .cell-core {
  color: #1e40af;
  font-weight: 600;
}

.moisture-table .cell-panel {
  color: #047857;
  font-weight: 600;
}

.moisture-table .cell-gl {
  color: #b45309;
  font-weight: 600;
}

.moisture-table .cell-mat {
  color: #dc2626;
  font-weight: 600;
}

.moisture-brand-select {
  font-weight: 600;
  color: #1e293b;
}

/* ==========================================================================
   Full Grey Text & Column Visibility Across All Screens
   ========================================================================== */

/* 1. Moisture Table Minimum Widths */
.moisture-table {
  min-width: 1420px;
}

.moisture-brand-select {
  min-width: 160px !important;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.35rem !important;
}

.cell-gsp,
.cell-input[data-field="gspNo"] {
  min-width: 90px !important;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.25rem !important;
}

.cell-time,
.cell-input[data-field="time"] {
  min-width: 82px !important;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.25rem !important;
}

.cell-core,
.cell-panel,
.cell-gl,
.cell-mat {
  min-width: 62px !important;
  padding: 0.45rem 0.2rem !important;
  font-size: 0.95rem !important;
}

/* 2. Dryer Table Minimum Widths */
.cpil-qc-table#dryerTable {
  min-width: 1260px;
}

.dryer-species-select {
  min-width: 130px !important;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.35rem !important;
}

.cell-date-note {
  min-width: 95px !important;
  font-size: 0.88rem !important;
  text-align: center !important;
}

/* 3. Peeling Tables Minimum Widths */
.cpil-qc-table#peeling4ftTable {
  min-width: 1060px;
}

.cpil-qc-table#peeling8ftTable {
  min-width: 980px;
}

.row-species {
  min-width: 130px !important;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.35rem !important;
}

.cell-machine-select {
  min-width: 95px !important;
  font-size: 0.88rem !important;
  padding: 0.45rem 0.35rem !important;
}

/* ===================================================
   Hot Press, Core Composer, CPIL-348 & Custom Tab UI
   =================================================== */

.hot-press-view,
.core-composer-view,
.hp-daylight-view,
.custom-tab-view {
  padding: 0.5rem 0 2rem 0;
}

.glass-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
}

.badge-primary { background: #e0e7ff; color: #4338ca; }
.badge-danger { background: #ffe4e6; color: #be123c; }
.badge-info { background: #cffafe; color: #0e7490; }

.cc-table {
  min-width: 820px;
}

.cc-table th, .cc-table td {
  padding: 0.4rem 0.5rem;
}

.animate-fade-in {
  animation: fadeIn 0.25s ease-in-out;
}

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

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* Unified Hot Press Styles */
.shift-view-segmented {
  display: inline-flex;
  background: var(--slate-100);
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}

.shift-view-segmented .btn-shift-view {
  background: transparent;
  border: none;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-600);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shift-view-segmented .btn-shift-view:hover {
  color: var(--slate-900);
  background: rgba(255, 255, 255, 0.6);
}

.shift-view-segmented .btn-shift-view.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.hotpress-shifts-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hotpress-shift-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hotpress-shift-card.shift-hidden {
  display: none !important;
}

.shift-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--slate-200);
}

.shift-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shift-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.badge-shift1 {
  background: linear-gradient(135deg, #1e40af, #2563eb);
}

.badge-shift2 {
  background: linear-gradient(135deg, #475569, #0f172a);
}

.shift-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-800);
}

.shift-summary-pill {
  background: var(--slate-100);
  border: 1px solid var(--slate-300);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-700);
}

.hotpress-cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.25rem;
}

.hotpress-cycle-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cycle-meta-card {
  background: #f8fafc;
  border-bottom: 1px solid var(--slate-200);
  padding: 0.75rem 1rem;
}

.cycle-card-top-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cycle-title-tag {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cycle-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.5rem;
}

.cycle-meta-table th {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  padding: 0.25rem 0.4rem;
  text-align: center;
}

.cycle-meta-table td {
  padding: 0.25rem 0.35rem;
}

.cycle-req-temp-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-700);
  margin-top: 0.4rem;
}

.hotpress-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.hotpress-table thead tr.header-group-row th {
  background-color: #1e3a8a;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  padding: 0.6rem 0.4rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.hotpress-table thead tr.header-sub-row th {
  background-color: #2563eb;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  padding: 0.4rem 0.3rem;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid #1e3a8a;
}

.hotpress-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--slate-200);
  border-right: 1px solid var(--slate-200);
  text-align: center;
}

.hotpress-table td.col-platen-no {
  font-weight: 800;
  color: var(--primary);
  background-color: #eff6ff;
  width: 55px;
}

.hp-read-input {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.hotpress-table tfoot tr.hp-summary-labels td {
  background-color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--slate-600);
  padding: 0.4rem 0.5rem;
  border-top: 2px solid var(--slate-300);
}

.hotpress-table tfoot tr.hp-summary-values td {
  padding: 0.45rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
}

.hotpress-table tfoot .cell-min {
  background-color: #eff6ff;
  color: #1e40af;
}

.hotpress-table tfoot .cell-max {
  background-color: #fef2f2;
  color: #b91c1c;
}

.hotpress-table tfoot .cell-diff {
  background-color: #f0fdf4;
  color: #15803d;
}

/* Core Composer Grouping & Badges */
.cc-mc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e3a8a;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.cc-status-chip {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cc-status-chip.status-pass {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.cc-status-chip.status-exceeded {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Platten Visual Inspection (CPIL-348) */
.cpil348-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.cpil348-status-dot.dot-ok {
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.cpil348-status-dot.dot-issue {
  background-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.row-sig-preview-box {
  width: 85px;
  height: 38px;
  border: 1.5px dashed var(--slate-300);
  border-radius: 6px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.row-sig-preview-box img {
  max-height: 34px;
  max-width: 80px;
  object-fit: contain;
}

.row-sig-empty {
  font-size: 0.72rem;
  color: var(--slate-400);
}

.shift-signatures-section {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-200);
}

.signatures-grid.single-sig-grid {
  display: flex;
  justify-content: center;
}

.signatures-grid.single-sig-grid .sig-slot-box {
  width: 100%;
  max-width: 380px;
}

/* Developer Studio Styles */
.dev-align-btn-group {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.dev-align-btn-group .btn {
  border: none;
  border-radius: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  transition: all 0.15s ease;
}

.dev-align-btn-group .btn:not(:last-child) {
  border-right: 1px solid #e2e8f0;
}

.dev-col-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dev-col-card:hover {
  border-color: #818cf8 !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08) !important;
}

.dev-top-row, .dev-sig-row {
  transition: border-color 0.2s ease;
}

.dev-top-row:hover, .dev-sig-row:hover {
  border-color: #818cf8 !important;
}

.dev-quick-chips .btn {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9999px;
  border-color: #cbd5e1;
  color: #475569;
  background: #f8fafc;
}

.dev-quick-chips .btn:hover {
  background: #e2e8f0;
  color: #4f46e5;
  border-color: #4f46e5;
}

/* ==========================================================================
   Retractable Settings Sections Drawer & Modern Navigation
   ========================================================================== */

.settings-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.settings-active-section-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-section-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.6px;
}

.settings-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-drawer-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-drawer-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.drawer-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

/* Floating Quick Pull Tab on the Right Edge */
.floating-settings-drawer-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #ffffff;
  padding: 10px 10px 10px 14px;
  border-radius: 24px 0 0 24px;
  border: none;
  cursor: pointer;
  box-shadow: -3px 4px 16px rgba(15, 23, 42, 0.25);
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.floating-settings-drawer-tab:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  padding-right: 14px;
  box-shadow: -4px 6px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-50%) translateX(-3px);
}

.floating-settings-drawer-tab .tab-icon {
  font-size: 1rem;
}

.floating-settings-drawer-tab .tab-arrow {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Drawer Backdrop Overlay */
.settings-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.settings-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Right Retractable Panel */
.settings-right-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  background: #ffffff;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-right-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-header-icon {
  font-size: 1.5rem;
}

.drawer-header-title h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.drawer-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.drawer-sections-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.drawer-section-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.drawer-section-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(-2px);
}

.drawer-section-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(79, 70, 229, 0.14));
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.drawer-item-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.drawer-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.drawer-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.drawer-section-item.active .drawer-item-title {
  color: var(--primary);
}

.drawer-item-desc {
  font-size: 0.74rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item-arrow {
  font-size: 1rem;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
}

.drawer-section-item.active .drawer-item-arrow {
  color: var(--primary);
}

/* Custom Tab Engine layout styling */
.custom-tab-module .status-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.custom-tab-module .status-indicator-badge.status-ok {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.custom-tab-module .status-indicator-badge.status-issue {
  background: #ffe4e6;
  color: #b91c1c;
  border-color: #fca5a5;
}

.custom-tab-module .custom-data-row.row-group-last td {
  border-bottom: 2px solid #cbd5e1;
}

.custom-tab-module .custom-qc-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Universal Dropdown Edit & Catalog Management */
.btn-dropdown-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.btn-dropdown-edit:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
  transform: scale(1.05);
}

.btn-dropdown-edit:active {
  transform: scale(0.95);
}

/* Header pencil icons */
th .btn-dropdown-edit {
  font-size: 0.72rem;
  padding: 2px 4px;
  margin-left: 5px;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

th .btn-dropdown-edit:hover {
  background: #ffffff;
  border-color: #0f172a;
}

.select-with-edit-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.select-with-edit-wrapper select {
  flex: 1;
  min-width: 0;
}

.row-dropdown-edit {
  padding: 1px 3px;
  font-size: 0.68rem;
  border-radius: 3px;
  opacity: 0.7;
}

tr:hover .row-dropdown-edit,
.select-with-edit-wrapper:hover .row-dropdown-edit {
  opacity: 1;
}

/* Dropdown Manager Modal */
.dropdown-manager-card {
  max-width: 480px;
  width: 95%;
}

.dropdown-manager-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  transition: background 0.15s ease;
}

.dropdown-manager-item:hover {
  background: #ffffff;
  border-color: var(--slate-300);
}

.dropdown-manager-item-name {
  font-weight: 600;
  color: var(--slate-800);
  font-size: 0.9rem;
  word-break: break-word;
  flex: 1;
  margin-right: 0.5rem;
}

.dropdown-manager-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-mgr-edit {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e40af;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mgr-edit:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-mgr-delete {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mgr-delete:hover {
  background: #fecaca;
  border-color: #ef4444;
}

.dropdown-inline-edit-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.dropdown-inline-edit-wrapper input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
}

/* Chip Edit Button in Settings */
.species-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.edit-catalog-chip-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 1px 3px;
  border-radius: 3px;
  color: var(--primary);
  opacity: 0.85;
  transition: all 0.15s ease;
}

.edit-catalog-chip-btn:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(30, 64, 175, 0.1);
}

/* ==========================================================================
   Tab Title and Order Customization Component
   ========================================================================== */

.tab-order-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tab-order-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  user-select: none;
}

.tab-order-item:hover {
  border-color: #93c5fd;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.1);
}

.tab-order-item.dragging {
  opacity: 0.4;
  border: 2px dashed #3b82f6;
  background: #eff6ff;
}

.tab-order-item.drag-over {
  border-color: #2563eb;
  background: #f0fdf4;
  transform: scale(1.01);
}

.tab-order-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--slate-400);
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-order-drag-handle:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

.tab-order-drag-handle:active {
  cursor: grabbing;
}

.tab-order-drag-handle .grip-dots {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.tab-order-rank {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--slate-500);
  background: var(--slate-100);
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 34px;
  text-align: center;
}

.tab-order-icon-badge {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
}

.tab-order-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.tab-order-orig-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-custom-tab {
  background: #e0e7ff;
  color: #4338ca;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.tab-order-title-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tab-order-title-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

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

.btn-swap-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-swap-tab:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.btn-swap-tab:active:not(:disabled) {
  transform: translateY(0);
}

.btn-swap-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--slate-200);
  background: var(--slate-50);
}

@media (max-width: 640px) {
  .tab-order-item {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }
  .tab-order-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* -------------------------------------------------------------
   Universal Browser Autofill & Popup Suppression
   ------------------------------------------------------------- */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: var(--slate-800) !important;
  transition: background-color 5000s ease-in-out 0s;
}

input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  height: 0;
  width: 0;
  margin: 0;
}

/* -------------------------------------------------------------
   Reface Analysis & Generation Styling
   ------------------------------------------------------------- */
.reface-analysis-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reface-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.reface-kpi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.reface-kpi-card.kpi-alert {
  border-color: #f59e0b;
  background: #fffbeb;
}

.reface-kpi-card .kpi-icon {
  font-size: 1.8rem;
}

.reface-kpi-card .kpi-body {
  display: flex;
  flex-direction: column;
}

.reface-kpi-card .kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-500, #64748b);
  letter-spacing: 0.5px;
}

.reface-kpi-card .kpi-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--slate-900, #0f172a);
}

.reface-table {
  border-collapse: collapse;
  width: 100%;
}

.reface-table thead .header-grouped-row th {
  background: #1e3a8a;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 10px;
  text-align: center;
  border: 1px solid #0f172a;
}

.reface-table thead .header-grouped-row .right-th {
  background: #1d4ed8;
}

.reface-table thead .header-sub-row th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px;
  text-align: center;
  border: 1px solid #cbd5e1;
}

.reface-table tbody td {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

.reface-table .section-title-cell {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
  vertical-align: middle;
  border-right: 2px solid #cbd5e1;
  padding-left: 14px;
}

.reface-table .sub-item-cell {
  color: #334155;
  font-weight: 500;
}

.reface-row.row-has-defect {
  background: #fef2f2;
}

.reface-row.row-has-defect .sub-item-cell {
  color: #dc2626;
  font-weight: 700;
}

.reface-qty-input {
  text-align: center;
  font-weight: 700;
  max-width: 140px;
  margin: 0 auto;
}

.tfoot-total-checked-row td {
  background: #f8fafc;
  font-size: 0.95rem;
  padding: 10px;
  border-top: 2px solid #cbd5e1;
}

.reface-total-checked-input {
  max-width: 140px;
  margin: 0 auto;
  text-align: center;
  font-weight: 800;
}

.tfoot-summary-row td {
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 1rem;
  padding: 10px;
  border-top: 1px solid #bfdbfe;
}

.total-reface-val-cell {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: #2563eb;
}

/* ==========================================================================
   Universal Column Headers Management UI
   ========================================================================== */

.column-mgmt-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
}

.column-mgmt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.column-mgmt-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.column-mgmt-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #ffffff;
}

.column-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.column-mgmt-table th {
  background-color: #f8fafc;
  color: var(--slate-700);
  font-weight: 700;
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
}

.column-mgmt-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

.column-mgmt-table tr:hover {
  background-color: #f8fafc;
}

.column-mgmt-table tr.col-hidden-row {
  background-color: #fef2f2;
  opacity: 0.78;
}

.column-mgmt-table tr.col-hidden-row td.col-name-cell {
  text-decoration: line-through;
  color: #991b1b;
}

.col-group-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  text-transform: uppercase;
}

.btn-toggle-col-vis {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-toggle-col-vis.btn-vis-active {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.btn-toggle-col-vis.btn-vis-active:hover {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-toggle-col-vis.btn-vis-hidden {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-toggle-col-vis.btn-vis-hidden:hover {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.col-action-btns {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-col-action {
  background: transparent;
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-col-action:hover {
  background: var(--slate-100);
  border-color: var(--slate-400);
}

.btn-col-action.btn-col-del:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Dynamic Column Visibility Classes */
.qc-col-hidden,
th.qc-col-hidden,
td.qc-col-hidden {
  display: none !important;
}
