@import './variables.css';

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-body);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: block;
  overflow-x: hidden;
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================================================
   AUTHENTICATION VIEW
   ========================================================================== */
.auth-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  position: fixed;
  inset: 0;
  z-index: 500;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-tab-pills {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.login-tab-pill {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.login-tab-pill.active {
  background: #ffffff;
  color: #0b4ea2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-logo-img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
  margin-bottom: 4px;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.auth-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SIDEBAR NAVIGATION (Refined, Clean & Subtle)
   ========================================================================== */
aside.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-medium);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.brand {
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-medium);
  cursor: pointer;
  background: var(--bg-surface);
  transition: background 0.15s ease;
}

.brand:hover {
  background: var(--bg-subtle);
}

.brand-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  letter-spacing: 0.2px;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 18px 14px 6px 14px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px;
  list-style: none;
}

.nav-link {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 12px;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

/* Elegant, crisp modern active state */
.nav-link.active {
  background: #eff6ff !important;
  color: #0b4ea2 !important;
  font-weight: 700 !important;
  border-color: #bfdbfe !important;
  box-shadow: 0 1px 3px rgba(11, 78, 162, 0.08);
}

.nav-link i {
  width: 18px;
  height: 18px;
  stroke-width: 1.85px;
  color: #64748b;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.nav-link:hover i {
  color: #0f172a;
  stroke-width: 2px;
}

.nav-link.active i {
  color: #0b4ea2 !important;
  stroke-width: 2.1px;
}

/* ==========================================================================
   MAIN APP SHELL & TOPBAR
   ========================================================================== */
.main-wrapper {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 240px);
  max-width: calc(100% - 240px);
  overflow-x: hidden;
}

header.topbar {
  height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.profile-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.profile-icon-btn:hover {
  background: var(--bg-subtle);
}

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

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: none;
  z-index: 120;
}

.profile-dropdown.active {
  display: block;
  animation: dropdownPop 0.15s ease-out;
}

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

.profile-info-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.profile-info-item:last-child {
  border-bottom: none;
}

.profile-info-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.profile-info-value {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   CONTENT WRAPPER
   ========================================================================== */
main.content-container {
  padding: 24px 28px;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none !important;
}

.tab-pane.active {
  display: block !important;
  animation: fadeIn 0.15s ease-in-out;
}

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

/* ==========================================================================
   BALANCED KPI STATS CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: all 0.15s ease;
  position: relative;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kpi-card-clickable {
  cursor: pointer;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.kpi-icon i {
  width: 16px;
  height: 16px;
}

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

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   PANELS & CONTAINERS
   ========================================================================== */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 14px;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.1px;
}

.badge-count {
  background: var(--bg-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

/* Search Bar Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 340px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

.search-input {
  padding-left: 32px !important;
  width: 100%;
  background: var(--bg-surface) !important;
  border-color: var(--border-medium) !important;
}

.search-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(11, 78, 162, 0.1) !important;
}

/* ==========================================================================
   CALCULATION MODE FORMULA SELECTOR
   ========================================================================== */
.calc-mode-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calc-mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.calc-mode-card:hover {
  border-color: var(--border-strong);
}

.calc-mode-card.active {
  border-color: var(--primary);
  background: var(--primary-subtle);
  box-shadow: 0 0 0 1px var(--primary);
}

.calc-mode-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-mode-card.active .calc-mode-title {
  color: var(--primary);
}

.calc-mode-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   FORM INPUTS & DROPZONE
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: all 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 78, 162, 0.1);
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: all 0.15s ease;
}

.dropzone:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dropzone:hover .dropzone-icon {
  color: var(--primary);
}

.dropzone-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 2px;
}

.dropzone-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  height: 34px;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(11, 78, 162, 0.2);
}

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

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-body);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  height: 28px;
}

.btn-icon-only {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: 1px solid var(--border-medium);
  background: #FFFFFF;
  color: var(--text-body);
}

.btn-icon-only:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-icon-input {
  background: #FFFFFF;
  border-color: var(--border-medium);
  color: var(--text-body);
}

.btn-icon-output {
  background: #FFFFFF;
  border-color: var(--border-medium);
  color: var(--primary);
}

.btn-icon-only i {
  width: 13px;
  height: 13px;
}

.btn-danger {
  background: #dc2626;
  color: #FFFFFF;
  border-color: #dc2626;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-danger-soft {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-danger-soft:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.step-row-selected {
  background-color: #eff6ff !important;
}

.step-select-all,
.step-select-item {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}

/* Floating Bulk Action Bar for Multi-Step Deletion */
.floating-bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  animation: slideUpFloating 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 13px;
  border: 1px solid #334155;
}

@keyframes slideUpFloating {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Subtab Buttons */
.active-subtab {
  background: var(--primary) !important;
  color: #FFFFFF !important;
  border-color: var(--primary) !important;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
}

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

table.data-table th {
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: #FAFAFC;
  border-bottom: 1px solid var(--border-medium);
  font-weight: 600;
  white-space: nowrap;
}

/* Official Loading Chart Dark Header (Doc No GMV-L4-F-PRD-14B) */
tr.table-loading-header th,
.table-loading-header th {
  background: #0b4ea2 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 11px 12px !important;
  border: none !important;
  border-bottom: 2px solid #083b7a !important;
  white-space: nowrap !important;
}

table.data-table td {
  padding: 11px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  white-space: nowrap;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

table.data-table tr:hover td {
  background: var(--bg-hover);
}

.link-batch-no {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.link-batch-no:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}

.pagination-info {
  font-size: 11px;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.status-pill-ok {
  background: var(--status-ok-bg);
  color: var(--status-ok-text);
  border: 1px solid var(--status-ok-border);
}

.status-pill-fs, .status-pill-error {
  background: var(--status-fs-bg);
  color: var(--status-fs-text);
  border: 1px solid var(--status-fs-border);
}

/* ==========================================================================
   MODAL POPUPS
   ========================================================================== */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(3px) !important;
  z-index: 999999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  width: 92%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.1px;
}

.btn-close-modal {
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-close-modal:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.modal-body {
  padding: 18px;
  max-height: 72vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Machine Work Center Filter Pills */
.mc-pill {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mc-pill:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.mc-pill.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================================
   PREMIUM SEGMENTED TOGGLE CONTROLS & STUDIO BUTTONS
   ========================================================================== */
.segmented-control-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.segmented-control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
}

.segmented-control-btn:hover:not(.active) {
  background: #e2e8f0;
  color: #0f172a;
}

.segmented-control-btn.active {
  background: #0b4ea2;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(11, 78, 162, 0.28);
}

.segmented-control-btn .badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 12px;
  background: #e2e8f0;
  color: #334155;
  transition: all 0.18s ease;
}

.segmented-control-btn.active .badge-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.segmented-control-btn i {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

/* Studio Action Buttons */
.btn-studio-close-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.btn-studio-close-icon:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
  transform: scale(1.05);
}

.btn-studio-close-icon i {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.btn-studio-export {
  background: linear-gradient(135deg, #0b4ea2 0%, #0284c7 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(11, 78, 162, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-export:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 4px 10px rgba(11, 78, 162, 0.35);
  transform: translateY(-1px);
}

.btn-studio-export:active {
  transform: translateY(0);
}

.btn-studio-action {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-studio-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-studio-action.btn-danger-action:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Routing Image Thumbnails & Upload Elements */
.routing-thumb {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease;
}

.routing-thumb:hover {
  transform: scale(1.18);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18) !important;
  border-color: var(--primary) !important;
  z-index: 5;
  position: relative;
}

#box-tooling-upload:hover, #box-drawing-upload:hover {
  border-color: var(--primary) !important;
  background-color: #eff6ff !important;
}

/* ==========================================================================
   HOLISTIC ROUTING MASTER (Parent-Child Table & Machine Badges)
   ========================================================================== */
.parent-product-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.parent-product-row:hover {
  background-color: #f1f5f9 !important;
}

.parent-product-row.is-expanded {
  background-color: #f8fafc !important;
  border-bottom-color: transparent !important;
}

.chevron-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  color: #64748b;
}

.chevron-icon.is-expanded {
  transform: rotate(90deg);
  color: var(--primary);
}

.badge-steps-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
}

.badge-total-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
  font-family: var(--font-mono);
}

/* Machine Color-Coded Accents */
.badge-mc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.badge-mc-cnc {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.badge-mc-lathe {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

.badge-mc-drill {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.badge-mc-vmc {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  color: #7e22ce;
}

.badge-mc-spm {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
}

.badge-step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

/* ==========================================================================
   LIVE SHOP FLOOR STAGE TRACKER (Product Batch Progression)
   ========================================================================== */
.live-stage-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
}

.live-stage-card:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  border-color: #94a3b8;
}

.stage-stepper-container {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.stage-step-node {
  flex: 1;
  min-width: 170px;
  padding: 12px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

/* Stage: Done */
.stage-step-node.stage-done {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
}

/* Stage: Running / Active */
.stage-step-node.stage-running {
  background: #eff6ff;
  border: 2px solid #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Stage: Queued / Waiting */
.stage-step-node.stage-queued {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  opacity: 0.85;
}

.stage-connector {
  display: flex;
  align-items: center;
  color: #94a3b8;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.btn-stage-transfer {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid #059669;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  margin-top: 4px;
}

.btn-stage-transfer:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-stage-transfer:active {
  transform: translateY(0);
}

.mc-filter-chip {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mc-filter-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.mc-filter-chip.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 2px 6px rgba(11, 78, 162, 0.25);
}

/* High-Density Live Shopfloor Table */
.shopfloor-table-wrapper {
  width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  background: #ffffff;
  margin-top: 0;
}

.shopfloor-table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.shopfloor-table-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.shopfloor-table-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.shopfloor-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

#tbl-live-shopfloor {
  width: 100%;
  border-collapse: collapse;
}

#tbl-live-shopfloor th,
#tbl-live-shopfloor td {
  border-bottom: 1px solid var(--border-light);
}

.shopfloor-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-transfer-action {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1px solid #0369a1;
  color: #ffffff;
  border-radius: 6px;
  gap: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2);
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn-transfer-action:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.3);
}

.btn-revert-action {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  gap: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn-revert-action:hover {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #78350f;
}

.tbl-shopfloor-row {
  transition: background 0.15s ease;
  cursor: pointer;
}

.tbl-shopfloor-row:hover {
  background: #f8fafc !important;
}

.tbl-shopfloor-row.is-expanded {
  background: #eff6ff !important;
}

.shopfloor-detail-row {
  background: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
}

.shopfloor-pipeline-container {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 4px;
}

.shopfloor-pipeline-node {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 6px;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
}

.shopfloor-pipeline-node.node-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.shopfloor-pipeline-node.node-running {
  background: #eff6ff;
  border: 1.5px solid #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.shopfloor-pipeline-node.node-queued {
  background: #ffffff;
  border-color: #e2e8f0;
  opacity: 0.75;
}

/* ==========================================================================
   GLOBAL ANIMATED LOADERS & SPINNER SYSTEM
   ========================================================================== */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.spin,
.animate-spin,
.lucide-spin,
svg.spin,
i.spin {
  animation: spin 0.75s linear infinite !important;
  display: inline-block !important;
  transform-origin: center center !important;
}

/* Button Loading States */
.btn:disabled,
button:disabled {
  cursor: not-allowed !important;
  opacity: 0.7 !important;
}

.btn .spin,
button .spin {
  margin-right: 2px;
  vertical-align: middle;
}

/* Modal / Container Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: inherit;
  gap: 12px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}

.loading-spinner-lg {
  width: 36px;
  height: 36px;
  border: 3.5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ==========================================================================
   MASTER USER EXECUTIVE CONTROL TOWER & FLEET VISUALIZER
   ========================================================================== */

/* Low-Profile Executive Header Bar */
.executive-header-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.executive-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.executive-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
  margin: 0;
}

.executive-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.live-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.executive-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Workshop Fleet Toolbar */
.fleet-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.fleet-search-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  width: 220px;
  max-width: 100%;
}

.fleet-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--text-main);
  width: 100%;
}

.fleet-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-filter-pill:hover {
  border-color: #0b4ea2;
  color: #0b4ea2;
  background: #eff6ff;
}

.btn-filter-pill.active {
  background: #0b4ea2;
  border-color: #0b4ea2;
  color: #ffffff;
}

.pill-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #334155;
  transition: all 0.15s ease;
}

.btn-filter-pill.active .pill-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.view-mode-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
}

.view-mode-btn {
  border: none;
  background: transparent;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.view-mode-btn:hover {
  color: var(--text-main);
}

.view-mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* ==========================================================================
   WORKSHOP BAYS & VISUAL MACHINE CARDS WITH RADIAL LOAD GAUGES
   ========================================================================== */
.bay-group-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.bay-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 8px;
}

.bay-group-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bay-group-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  flex-wrap: wrap;
}

.mc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.mc-visual-card {
  background: #FFFFFF;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.mc-visual-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(11, 78, 162, 0.08);
  transform: translateY(-1px);
}

.mc-visual-card.state-running {
  border-top: 3px solid #10B981;
}

.mc-visual-card.state-idle {
  border-top: 3px solid #CBD5E1;
  background: #FAFAFC;
}

.mc-visual-card.state-maint {
  border-top: 3px solid #EF4444;
}

.mc-visual-card.state-overloaded {
  border: 2px solid #ef4444 !important;
  border-top: 4px solid #dc2626 !important;
  background: #fffafa !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.22) !important;
}

.mc-visual-card.state-overloaded:hover {
  border-color: #dc2626 !important;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3) !important;
}

.badge-overloaded-7d {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #f87171 !important;
  font-weight: 800 !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  animation: pulse-red-border 2s infinite ease-in-out;
}

@keyframes pulse-red-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.fleet-matrix-tile.matrix-overloaded {
  border: 2px solid #ef4444 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2) !important;
}

.badge-machine-overloaded {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  font-weight: 800 !important;
  border: 1.5px solid #ef4444 !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.25) !important;
}

.mc-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mc-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.mc-gauge-subtext {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.mc-card-meta {
  flex: 1;
  min-width: 0;
}

.mc-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.mc-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.mc-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill-running {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.pill-idle {
  background: #F8FAFC;
  color: #64748B;
  border: 1px solid #CBD5E1;
}

.pill-maint {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.mc-model-label {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.mc-job-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  padding: 3px 6px;
  border-radius: 4px;
}

.mc-job-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.mc-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 10.5px;
  color: var(--text-muted);
}

.live-pulse-green {
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Bay Summary Rollup Cards (Legacy Fallback) */
.bay-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.bay-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

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

.bay-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bay-stat-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.bay-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin: 4px 0 10px;
}

.bay-progress-running {
  background: #22c55e;
  height: 100%;
  transition: width 0.3s ease;
}

.bay-progress-maint {
  background: #ef4444;
  height: 100%;
  transition: width 0.3s ease;
}

.bay-machines-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 0;
}

.bay-machine-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-medium);
  cursor: pointer;
  transition: all 0.1s ease;
}

.bay-machine-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.bay-machine-chip.running {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.bay-machine-chip.idle {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.bay-machine-chip.maint {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* High-Density Scalable Machine Matrix (100+ Machines) */
.fleet-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
}

.fleet-matrix-tile {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-medium);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fleet-matrix-tile:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.fleet-matrix-tile.running {
  border-color: #86efac;
  background: #f0fdf4;
}

.fleet-matrix-tile.maint {
  border-color: #fca5a5;
  background: #fef2f2;
}

.fleet-matrix-tile.idle {
  border-color: #cbd5e1;
  background: #ffffff;
}

.fleet-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fleet-tile-code {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
  color: var(--text-main);
}

.fleet-tile-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.fleet-tile-job {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.fleet-tile-load {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #15803d;
  font-weight: 600;
}

/* ==========================================================================
   OPERATOR TOUCH TERMINAL & WORK SPLITS (EXECUTIVE INDUSTRIAL THEME)
   ========================================================================== */
.terminal-job-hero {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-top: 3px solid #0b4ea2;
  border-radius: 12px;
  padding: 24px;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: relative;
}

.terminal-kpi-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  text-align: left;
  transition: all 0.2s ease;
}

.terminal-kpi-pill.emerald {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.terminal-kpi-pill.amber {
  background: #fffbeb;
  border-color: #fde68a;
}

.terminal-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
}

.terminal-kpi-pill.emerald .terminal-kpi-label {
  color: #166534;
}

.terminal-kpi-pill.amber .terminal-kpi-label {
  color: #92400e;
}

.terminal-kpi-val {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0f172a;
  margin-top: 4px;
}

.terminal-kpi-pill.emerald .terminal-kpi-val {
  color: #15803d;
}

.terminal-kpi-pill.amber .terminal-kpi-val {
  color: #b45309;
}

.terminal-action-deck {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
}

.touch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.touch-btn:active {
  transform: translateY(1px);
}

.touch-btn i {
  width: 16px;
  height: 16px;
}

.touch-btn-start {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.2);
}
.touch-btn-start:hover {
  background: #15803d;
}

.touch-btn-pause {
  background: #d97706;
  border-color: #b45309;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.2);
}
.touch-btn-pause:hover {
  background: #b45309;
}

.touch-btn-log {
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.touch-btn-log:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.touch-btn-custom {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.touch-btn-custom:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.touch-btn-complete {
  background: #0b4ea2;
  border: 1.5px solid #083c7d;
  color: #ffffff;
  margin-left: auto;
  box-shadow: 0 1px 3px rgba(11, 78, 162, 0.25);
}
.touch-btn-complete:hover {
  background: #093d80;
}

/* Split Progress Meter in tables */
.split-progress-bar-container {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.split-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.split-progress-bar-fill.completed {
  background: #10b981;
}

.split-progress-bar-fill.paused {
  background: #f59e0b;
}

.empty-terminal-state {
  text-align: center;
  padding: 44px 24px;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
}

/* Screen 2: Operation & Machine Assignment Select Dropdowns */
.assign-op-select,
.assign-mc-select {
  height: 38px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  padding: 6px 32px 6px 12px !important;
  cursor: pointer !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.15s ease !important;
}

.assign-op-select:hover,
.assign-mc-select:hover {
  border-color: #94a3b8 !important;
  background-color: #f8fafc !important;
}

.assign-op-select:focus,
.assign-mc-select:focus {
  outline: none !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
  background-color: #ffffff !important;
}

.assign-mc-select {
  font-family: var(--font-mono) !important;
}

/* ==========================================================================
   UNIFIED MASTER LOADING SCHEDULE & PAGINATION
   ========================================================================== */
.unified-pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #ffffff;
  border-top: 1.5px solid var(--border-medium);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.page-btn:hover:not(:disabled):not(.active) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.page-btn.active {
  background: var(--primary, #0b4ea2) !important;
  border-color: var(--primary, #0b4ea2) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(11, 78, 162, 0.25);
  cursor: default;
  pointer-events: none;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  user-select: none;
}

#tbl-unified-loading tbody tr {
  transition: background-color 0.12s ease;
}

#tbl-unified-loading tbody tr:hover {
  background-color: #f8fafc;
}

/* Date Range Filter Card & Presets */
.date-preset-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-preset-pill:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.date-preset-pill.active {
  background: var(--primary, #0b4ea2) !important;
  border-color: var(--primary, #0b4ea2) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(11, 78, 162, 0.25);
}

/* ==========================================================================
   ENTERPRISE RESPONSIVE SYSTEM (ALL PAGES & SCREENS)
   ========================================================================== */

/* 1. Global Box Model & Viewport Protections */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* 2. Responsive Table Wrappers & Smooth Touch Scrolling */
.table-responsive,
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  position: relative;
}

.table-responsive::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Ensure tables inside responsive containers keep readable column widths without squishing */
.table-responsive table,
.table-wrapper table {
  min-width: 650px;
}

/* ==========================================================================
   PRODUCTION & SHOPFLOOR REPORTS TABLE ENHANCEMENTS
   ========================================================================== */
#tbl-production-reports.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
  background: #ffffff;
}

#tbl-production-reports thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#tbl-production-reports thead tr th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 12px 14px !important;
  border-bottom: 2px solid #cbd5e1 !important;
  border-top: none !important;
  white-space: nowrap !important;
}

#tbl-production-reports tbody tr.report-master-row {
  border-bottom: 1px solid #e2e8f0 !important;
  transition: all 0.15s ease;
  cursor: pointer;
}

#tbl-production-reports tbody tr.report-master-row:hover {
  background-color: #f8fafc !important;
}

#tbl-production-reports tbody tr.report-master-row.expanded {
  background-color: #eff6ff !important;
  border-left: 4px solid #0b4ea2 !important;
}

#tbl-production-reports tbody tr.report-master-row.expanded td {
  border-bottom-color: #bfdbfe !important;
  font-weight: 600;
}

#tbl-production-reports tbody tr.report-master-row.expanded td i[data-lucide^="chevron"] {
  transform: rotate(90deg);
  color: #0b4ea2 !important;
}

#tbl-production-reports tbody td {
  padding: 12px 14px !important;
  vertical-align: middle !important;
  color: #1e293b !important;
  border-bottom: 1px solid #f1f5f9 !important;
  font-size: 12.5px !important;
}

#tbl-production-reports tbody tr:last-child td {
  border-bottom: none !important;
}

.report-master-row td i[data-lucide^="chevron"] {
  color: #64748b;
  transition: transform 0.2s ease, color 0.15s ease;
}

.report-master-row:hover td i[data-lucide^="chevron"] {
  color: #0b4ea2;
}

/* Redesigned 2-Column Detail Drawer & Activity Timeline */
.report-drawer-row td {
  padding: 0 !important;
  background: #f1f5f9 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

.report-detail-wrapper {
  padding: 12px 18px 20px 18px;
}

.report-detail-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.report-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: minmax(310px, 1fr) minmax(420px, 1.8fr);
  gap: 18px;
  padding: 18px;
}

@media (max-width: 960px) {
  .report-detail-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }
}

.report-timeline-container {
  position: relative;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-timeline-track {
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e2e8f0;
}

.report-timeline-item {
  position: relative;
}

.report-timeline-node {
  position: absolute;
  left: -24px;
  top: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #0b4ea2;
  box-shadow: 0 0 0 2px #f8fafc;
}

.report-timeline-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.15s ease;
}

.report-timeline-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 3. Global Modal Safeguard for All Screen Sizes */
.modal-overlay {
  padding: 12px !important;
  overflow-y: auto !important;
}

.modal-card {
  max-width: min(96vw, 680px) !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  margin: auto !important;
}

/* 4. Sidebar Toggle Button & Backdrop Styles */
.sidebar-toggle-btn {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
}

.sidebar-toggle-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--primary);
}

.sidebar-toggle-btn i {
  width: 20px;
  height: 20px;
}

.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.sidebar-close-btn i {
  width: 16px;
  height: 16px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

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

/* Responsive Floating Bulk Bar */
.floating-bulk-bar {
  max-width: min(92vw, 560px);
}

/* ==========================================================================
   BREAKPOINT: DESKTOPS & STANDARD LAPTOPS (max-width: 1280px)
   ========================================================================== */
@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ==========================================================================
   BREAKPOINT: TABLETS & SMALL LAPTOPS (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Off-canvas sidebar */
  aside.sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 260px !important;
    max-width: 82vw !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 1000 !important;
    box-shadow: none !important;
    overflow-y: auto !important;
  }

  body.sidebar-open aside.sidebar {
    transform: translateX(0) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25) !important;
  }

  .sidebar-toggle-btn {
    display: inline-flex !important;
  }

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

  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  header.topbar {
    padding: 0 18px !important;
  }

  main.content-container {
    padding: 18px 20px !important;
    max-width: 100% !important;
  }

  /* Multi-column grid conversions */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1.5fr 2fr 1fr"],
  div[style*="grid-template-columns: 1.2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   BREAKPOINT: TABLETS & LARGE MOBILE (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  header.topbar {
    height: 54px !important;
    padding: 0 12px !important;
  }

  .page-title {
    font-size: 15px !important;
  }

  #topbar-user-pill {
    padding: 3px 8px !important;
  }

  #topbar-operator-text {
    display: none !important;
  }

  main.content-container {
    padding: 12px 10px !important;
  }

  .panel {
    padding: 14px 12px !important;
    margin-bottom: 14px !important;
    border-radius: var(--radius-sm) !important;
  }

  .panel-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .panel-header > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .kpi-card {
    padding: 12px 14px !important;
  }

  .kpi-value {
    font-size: 19px !important;
  }

  /* Universal 2-column input grids switch to 1-column */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Fleet Toolbars */
  .fleet-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .fleet-search-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  .fleet-filter-group {
    overflow-x: auto !important;
    padding-bottom: 4px !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .btn-filter-pill {
    flex-shrink: 0 !important;
    padding: 5px 10px !important;
    font-size: 11px !important;
  }

  .view-mode-toggle {
    align-self: flex-start !important;
  }

  /* Bay cards grid */
  .mc-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Search input wrappers */
  .search-input-wrapper {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Calculation mode pills */
  .calc-mode-group {
    grid-template-columns: 1fr !important;
  }

  /* Dropzone responsive */
  .dropzone {
    padding: 24px 14px !important;
  }

  /* Table pagination controls */
  .table-pagination {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }

  /* Reports Tab Filter Toolbar */
  #tab-reports .panel > div:first-child > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  #tab-reports .fleet-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Floating Bulk Bar */
  .floating-bulk-bar {
    bottom: 14px !important;
    width: calc(100% - 24px) !important;
    padding: 8px 12px !important;
    font-size: 11.5px !important;
    gap: 8px !important;
  }

  /* Modals */
  .modal-header {
    padding: 12px 14px !important;
  }

  .modal-title {
    font-size: 13.5px !important;
  }

  .modal-body {
    padding: 12px !important;
    max-height: 80vh !important;
  }
}

/* ==========================================================================
   BREAKPOINT: COMPACT MOBILE PHONES (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .brand-title {
    font-size: 14px !important;
  }

  .brand-subtitle {
    font-size: 9px !important;
  }

  #topbar-live-indicator span:last-child {
    display: none !important;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .btn {
    font-size: 11px !important;
    padding: 5px 9px !important;
  }

  .btn-sm {
    font-size: 10.5px !important;
    padding: 3px 8px !important;
  }

  .modal-overlay {
    padding: 6px !important;
  }

  .modal-card {
    max-width: 98vw !important;
    border-radius: 8px !important;
  }

  .auth-card {
    padding: 24px 16px !important;
    max-width: 94vw !important;
  }
}




/* ==========================================================================
   COMPLETED WAREHOUSE PRODUCTS DATA TABLE
   ========================================================================== */
#tbl-completed-products.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
  background: #ffffff;
}

#tbl-completed-products thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#tbl-completed-products thead tr th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 12px 14px !important;
  border-bottom: 2px solid #cbd5e1 !important;
  border-top: none !important;
  white-space: nowrap !important;
}

#tbl-completed-products tbody tr {
  border-bottom: 1px solid #e2e8f0 !important;
  transition: all 0.15s ease;
}

#tbl-completed-products tbody tr:hover {
  background-color: #f8fafc !important;
}

#tbl-completed-products tbody td {
  padding: 12px 14px !important;
  vertical-align: middle !important;
  color: #1e293b !important;
  border-bottom: 1px solid #f1f5f9 !important;
  font-size: 12.5px !important;
}

#tbl-completed-products tbody tr:last-child td {
  border-bottom: none !important;
}

/* ==========================================================================
   URGENT PRODUCT & ORDER BADGE / ACCENT SYSTEM
   ========================================================================== */
.badge-urgent {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #f87171 !important;
  font-weight: 800 !important;
  font-size: 10.5px !important;
  padding: 2px 7px !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.08) !important;
}

.row-urgent {
  background-color: #fff1f2 !important;
  outline: 2.5px solid #ef4444 !important;
  outline-offset: -2.5px !important;
  position: relative !important;
  z-index: 2 !important;
}

.row-urgent > td {
  background-color: #fff1f2 !important;
  border-top: 2.5px solid #ef4444 !important;
  border-bottom: 2.5px solid #ef4444 !important;
}

.row-urgent > td:first-child {
  border-left: 5px solid #dc2626 !important;
}

.row-urgent > td:last-child {
  border-right: 4px solid #dc2626 !important;
}

.row-urgent:hover,
.row-urgent:hover > td {
  background-color: #fee2e2 !important;
}

.btn-urgent-active {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1.5px solid #b91c1c !important;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.35) !important;
  font-weight: 800 !important;
}

.btn-urgent-active:hover {
  background: #b91c1c !important;
  border-color: #991b1b !important;
  color: #ffffff !important;
}

.btn-urgent-inactive {
  background: #ffffff !important;
  color: #475569 !important;
  border: 1.5px solid #cbd5e1 !important;
  font-weight: 700 !important;
}

.btn-urgent-inactive:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #1e293b !important;
}

.card-urgent {
  border: 1.5px solid #f87171 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
}
