/**
 * MMS V2 Tablet Scan Station
 * Distraction-Free High-Contrast Interface for Production Floor Barcode Scanning
 * Optimized for tablet touch interaction (≥56px touch targets)
 * 100dvh canvas, large typography, visual feedback, FIFO blocking
 */

/* ========================================================================
   STATION ROOT: Full-Screen Distraction-Free Canvas
   ======================================================================== */

.v2-station-body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--mms-canvas);
  font-family: var(--mms-font-sans);
  color: var(--mms-obsidian);
}

.v2-station-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--mms-canvas);
}

.v2-station-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Tablet-First Two-Column Grid */
.v2-station-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 20px;
  align-items: start;
  width: 100%;
}

@media (max-width: 960px) {
  .v2-station-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.v2-station-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.v2-station-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.v2-station {
  height: 100dvh;
  overflow: hidden;
  background: var(--mms-surface);
  display: flex;
  flex-direction: column;
}

.v2-station-header {
  height: 60px;
  background: #FFFFFF;
  color: var(--mms-obsidian);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  z-index: 100;
}

.v2-station-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.v2-station-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.v2-station-brand-text {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.03em;
  color: var(--color-brand, #0057b8); /* Official Panasonic Blue */
  font-family: var(--mms-font-sans);
  line-height: 1;
}

.v2-station-brand-divider {
  width: 1px;
  height: 22px;
  background: #E2E8F0;
  flex-shrink: 0;
}

.v2-station-mode-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--color-brand, #0057b8);
  background: rgba(0, 87, 184, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 87, 184, 0.16);
  white-space: nowrap;
}

.v2-station-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.v2-station-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.v2-station-clock .v2-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.v2-station-clock-tz {
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
}

.v2-station-machine-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  color: #0284C7;
  white-space: nowrap;
}

.v2-station-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748B;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  transition: all var(--transition-fast);
  min-height: 36px;
  white-space: nowrap;
}

.v2-station-exit-btn:hover {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #DC2626;
}

.v2-station-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.v2-network-pulse {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.v2-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: v2-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.v2-pulse-text {
  font-weight: 500;
}

.v2-station-exit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all var(--transition-fast);
  min-height: 40px;
}

.v2-station-exit:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.v2-station-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.v2-station-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mms-status-success);
  animation: v2-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* ========================================================================
   BARCODE HERO INPUT: High-Contrast Large Touch Target (≥56px)
   ======================================================================== */

.v2-station-scan-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  background: var(--mms-canvas);
}

.v2-station-scan-hero {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.v2-station-scan-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--mms-obsidian);
  text-align: center;
}

.v2-station-barcode-input {
  width: 100%;
  min-height: var(--touch-target-station);
  padding: 0 24px;
  font-family: var(--mms-font-tabular);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--mms-obsidian);
  background: var(--mms-surface);
  border: 3px solid var(--mms-accent-indigo);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-elevated);
  letter-spacing: 2px;
}

.v2-station-barcode-input:focus {
  border-color: var(--mms-accent-indigo-active);
  box-shadow: 0 0 0 4px var(--mms-accent-indigo-soft), var(--shadow-elevated);
}

.v2-station-barcode-input::placeholder {
  color: var(--mms-obsidian-subtle);
  font-weight: 500;
  letter-spacing: 1px;
}

.v2-station-scan-hint {
  font-size: 14px;
  color: var(--mms-obsidian-subtle);
  text-align: center;
}

/* ========================================================================
   FEEDER SLOT TOUCH MATRIX: Large Touch Grid
   ======================================================================== */

.v2-station-feeder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 800px;
  margin-top: 32px;
}

.v2-station-feeder-slot {
  min-height: 80px;
  padding: 16px;
  background: var(--mms-surface);
  border: 2px solid var(--mms-surface-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.v2-station-feeder-slot:hover {
  border-color: var(--mms-accent-indigo);
  background: var(--mms-accent-indigo-soft);
  box-shadow: var(--shadow-elevated);
}

.v2-station-feeder-slot.active {
  background: var(--mms-accent-indigo);
  border-color: var(--mms-accent-indigo-active);
  color: white;
}

.v2-station-feeder-slot-number {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.v2-station-feeder-slot-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.v2-station-feeder-slot.active .v2-station-feeder-slot-label {
  opacity: 1;
}

/* ========================================================================
   SCAN FLASH OVERLAY: Visual Feedback Animation
   ======================================================================== */

.v2-scan-flash {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
}

.v2-scan-flash.flash-success {
  background: var(--mms-status-success);
  animation: v2-flash-success 200ms ease-out;
}

.v2-scan-flash.flash-error {
  background: var(--mms-status-danger);
  animation: v2-flash-error 200ms ease-out;
}

@keyframes v2-flash-success {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}

@keyframes v2-flash-error {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
  }
}

/* ========================================================================
   GLOBAL DEFENSIVE HIDDEN RULE & FIFO BLOCKER
   ======================================================================== */

[hidden],
[hidden="true"],
.v2-alert-banner[hidden],
.v2-hud-card[hidden],
.v2-station-fifo-blocker[hidden],
.v2-camera-modal-backdrop[hidden],
.v2-station-card[hidden],
.v2-alert-banner[style*="display: none"],
.v2-hud-card[style*="display: none"],
.v2-station-fifo-blocker[style*="display: none"],
.v2-camera-modal-backdrop[style*="display: none"] {
  display: none !important;
}

.v2-station-fifo-blocker:not([hidden]) {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
  animation: v2-fade-in 200ms ease-out;
}

.v2-station-fifo-modal {
  background: var(--mms-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.4);
  max-width: 500px;
  width: 100%;
  overflow: hidden;
  animation: v2-bounce-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.v2-station-fifo-header {
  padding: 24px;
  background: var(--mms-status-danger);
  color: white;
  text-align: center;
}

.v2-station-fifo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 32px;
}

.v2-station-fifo-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.v2-station-fifo-subtitle {
  font-size: 14px;
  opacity: 0.95;
  font-weight: 500;
}

.v2-station-fifo-body {
  padding: 32px 24px;
  text-align: center;
}

.v2-station-fifo-message {
  font-size: 16px;
  color: var(--mms-obsidian);
  line-height: 1.6;
  margin-bottom: 24px;
}

.v2-station-fifo-details {
  background: var(--mms-status-danger-bg);
  border: 2px solid var(--mms-status-danger-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.v2-station-fifo-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.v2-station-fifo-detail-label {
  color: var(--mms-obsidian-muted);
  font-weight: 500;
}

.v2-station-fifo-detail-value {
  color: var(--mms-obsidian);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mms-font-tabular);
}

.v2-station-fifo-actions {
  display: flex;
  gap: 12px;
}

.v2-station-fifo-actions .v2-btn {
  flex: 1;
  min-height: var(--touch-target-station);
  font-size: 16px;
}

@keyframes v2-bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  60% {
    opacity: 1;
    transform: scale(1.05) translateY(-5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* ========================================================================
   STATION FOOTER: Session Info & Quick Actions
   ======================================================================== */

.v2-station-footer {
  padding: 16px 20px;
  background: var(--mms-surface-subtle);
  border-top: 1px solid var(--mms-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.v2-station-footer-info {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--mms-obsidian-muted);
}

.v2-station-footer-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-station-footer-label {
  font-weight: 500;
}

.v2-station-footer-value {
  color: var(--mms-obsidian);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.v2-station-footer-actions {
  display: flex;
  gap: 8px;
}

/* ========================================================================
   STATION CARD & SCANNER HERO
   ======================================================================== */

.v2-station-card {
  background: var(--mms-surface);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.v2-station-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mms-obsidian);
  margin: 0 0 16px 0;
  letter-spacing: -0.01em;
}

.v2-station-checkpoint-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.v2-checkpoint-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.v2-checkpoint-badge {
  background: var(--color-brand, #0057b8); /* Official Panasonic Blue */
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
}

.v2-checkpoint-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mms-obsidian);
}

.v2-station-location-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-brand, #0057b8);
  background: rgba(0, 87, 184, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 87, 184, 0.15);
}

.v2-scan-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.v2-scan-input-wrapper {
  position: relative;
  flex: 1;
}

.v2-scan-input {
  width: 100%;
  min-height: 60px;
  padding: 0 54px 0 20px;
  font-family: var(--mms-font-tabular);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--mms-obsidian);
  background: var(--mms-surface);
  border: 2.5px solid var(--color-brand, #0057b8);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.v2-scan-input:focus {
  border-color: var(--color-brand-strong, #00458f);
  box-shadow: 0 0 0 4px rgba(0, 87, 184, 0.15);
}

.v2-scan-input::placeholder {
  color: var(--mms-obsidian-subtle);
  font-size: 16px;
  font-weight: 400;
}

.v2-scan-camera-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--mms-obsidian-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.v2-scan-camera-btn:hover {
  background: var(--mms-canvas);
  color: var(--color-brand, #0057b8);
}

.v2-scan-submit-btn {
  min-height: 60px;
  min-width: 130px;
  padding: 0 28px;
  background: var(--color-brand, #0057b8);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 87, 184, 0.25);
}

.v2-scan-submit-btn:hover {
  background: var(--color-brand-strong, #00458f);
  box-shadow: 0 4px 10px rgba(0, 87, 184, 0.35);
}

.v2-scan-submit-btn:active {
  transform: scale(0.98);
}

/* Submit Button Danger / Scrap Variant */
.v2-scan-submit-btn.v2-btn-danger {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border: 1px solid #B91C1C;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.v2-scan-submit-btn.v2-btn-danger svg {
  stroke: #FFFFFF !important;
}

.v2-scan-submit-btn.v2-btn-danger:hover {
  background: #B91C1C !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.45);
}

.v2-scan-submit-btn.v2-btn-danger:active {
  background: #991B1B !important;
  transform: scale(0.98);
}

/* ========================================================================
   HUD & FEEDBACK COMPONENTS
   ======================================================================== */

.v2-hud-card {
  margin-top: 16px;
  background: #F0FDF4;
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: v2-fade-in 200ms ease-out;
}

.v2-hud-card[hidden],
.v2-hud-card[style*="display: none"] {
  display: none !important;
}

.v2-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(16, 185, 129, 0.12);
  border-bottom: 1px solid #86EFAC;
}

.v2-hud-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #166534;
  letter-spacing: 0.5px;
}

.v2-hud-badge {
  background: #10B981;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
}

.v2-hud-body {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.v2-hud-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  margin-bottom: 4px;
}

.v2-hud-part-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--mms-obsidian);
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
  margin: 0 0 4px 0;
}

.v2-hud-desc {
  font-size: 14px;
  color: #475569;
  margin: 0 0 8px 0;
}

.v2-hud-qty-box {
  text-align: right;
  flex-shrink: 0;
  background: #FFFFFF;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #BBF7D0;
}

.v2-hud-qty-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-brand, #0057b8);
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.1;
}

.v2-alert-banner {
  margin-top: 16px;
  padding: 14px 18px;
  background: #FEF2F2;
  border: 1.5px solid #F87171;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: v2-fade-in 200ms ease-out;
}

.v2-alert-banner[hidden],
.v2-alert-banner[style*="display: none"] {
  display: none !important;
}

.v2-alert-banner-icon {
  color: #DC2626;
  flex-shrink: 0;
  margin-top: 2px;
}

.v2-alert-banner-title {
  font-size: 14px;
  font-weight: 800;
  color: #DC2626;
  letter-spacing: 0.5px;
  margin: 0 0 3px 0;
}

.v2-alert-banner-text {
  font-size: 13px;
  color: #1E293B;
  margin: 0;
  line-height: 1.4;
}

/* ========================================================================
   SESSION FEED TABLE
   ======================================================================== */

.v2-station-feed-card {
  background: var(--mms-surface);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.v2-station-feed-card .v2-table-container {
  max-height: calc(100dvh - 190px);
  overflow-y: auto;
}

@media (max-width: 960px) {
  .v2-station-feed-card .v2-table-container {
    max-height: 380px;
  }
}

.v2-station-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--mms-canvas);
  border-bottom: 1px solid var(--mms-surface-subtle);
}

.v2-station-feed-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-station-feed-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mms-obsidian);
}

.v2-station-feed-count {
  background: var(--mms-accent-indigo);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

.v2-station-feed-clear-btn {
  background: transparent;
  border: none;
  color: var(--mms-obsidian-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.v2-station-feed-clear-btn:hover {
  background: var(--mms-surface-subtle);
  color: var(--mms-obsidian);
}

.v2-station-feed-table {
  width: 100%;
  border-collapse: collapse;
}

.v2-station-feed-table th {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mms-obsidian-muted);
  background: var(--mms-surface);
  border-bottom: 1px solid var(--mms-surface-subtle);
  text-align: left;
}

.v2-station-feed-table th.numeric {
  text-align: right;
}

.v2-station-feed-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--mms-obsidian);
  border-bottom: 1px solid var(--mms-surface-subtle);
  vertical-align: middle;
}

.v2-station-feed-table td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mms-font-tabular);
}

.v2-station-feed-table tr:last-child td {
  border-bottom: none;
}

.v2-station-empty-feed {
  padding: 32px 16px;
  text-align: center;
  color: var(--mms-obsidian-subtle);
  font-size: 14px;
}

/* ========================================================================
   MACHINE CONTEXT BAR & FEEDER SLOT PICKER
   ======================================================================== */

.v2-station-machine-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--mms-surface-subtle);
}

.v2-station-machine-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.v2-station-machine-code {
  font-size: 18px;
  font-weight: 700;
  color: var(--mms-obsidian);
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.v2-station-machine-desc {
  font-size: 13px;
  color: var(--mms-obsidian-muted);
}

.v2-station-btn-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-brand, #0057b8);
  background: #FFFFFF;
  border: 1.5px solid var(--color-brand, #0057b8);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  min-height: 48px;
}

.v2-station-btn-switch:hover {
  background: rgba(0, 87, 184, 0.08);
  color: var(--color-brand-strong, #00458f);
}

.v2-feeder-slot-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  background: var(--mms-canvas);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--mms-surface-subtle);
}

.v2-feeder-slot-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.v2-feeder-slot-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mms-obsidian);
}

.v2-feeder-slot-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 52px;
  min-width: 154px;
  padding: 0 46px 0 18px;
  font-family: var(--mms-font-tabular);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--color-brand, #0057b8);
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230057b8' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  border: 2px solid var(--color-brand, #0057b8);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 2px 6px rgba(0, 87, 184, 0.12);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.v2-feeder-slot-select:hover {
  background-color: var(--color-brand-soft, #ebf3fb);
  border-color: var(--color-brand-strong, #00458f);
  box-shadow: 0 3px 10px rgba(0, 87, 184, 0.2);
}

.v2-feeder-slot-select:focus {
  background-color: #FFFFFF;
  border-color: var(--color-brand-strong, #00458f);
  box-shadow: 0 0 0 4px rgba(0, 87, 184, 0.2), 0 3px 10px rgba(0, 87, 184, 0.25);
}

.v2-feeder-slot-select option {
  padding: 10px 16px;
  font-family: var(--mms-font-tabular);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink, #122033);
  background: #FFFFFF;
}

.v2-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.v2-toggle-input {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--color-brand, #0057b8);
}

.v2-toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--mms-obsidian);
}

/* ========================================================================
   MACHINE PICKER (GRID SELECTION)
   ======================================================================== */

.v2-machine-picker-card {
  background: var(--mms-surface);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.v2-machine-picker-header {
  margin-bottom: 24px;
}

.v2-machine-picker-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--mms-obsidian);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.v2-machine-picker-header p {
  font-size: 14px;
  color: #64748B;
  margin: 0;
}

.v2-machine-search-box {
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 500;
  color: var(--mms-obsidian);
  background: var(--mms-canvas);
  border: 2px solid var(--mms-surface-subtle);
  border-radius: var(--radius-md);
  outline: none;
  box-sizing: border-box;
  margin-bottom: 24px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.v2-machine-search-box:focus {
  border-color: var(--color-brand, #0057b8);
  background: var(--mms-surface);
  box-shadow: 0 0 0 4px rgba(0, 87, 184, 0.12);
}

.v2-machine-group {
  margin-bottom: 28px;
}

.v2-machine-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-brand, #0057b8);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid rgba(0, 87, 184, 0.12);
}

.v2-machine-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.v2-machine-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--mms-canvas);
  border: 1.5px solid var(--mms-surface-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  min-height: 72px;
  box-sizing: border-box;
}

.v2-machine-card:hover {
  border-color: var(--color-brand, #0057b8);
  background: var(--mms-surface);
  box-shadow: 0 4px 12px rgba(0, 87, 184, 0.12);
  transform: translateY(-2px);
}

.v2-machine-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(0, 87, 184, 0.08);
  color: var(--color-brand, #0057b8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v2-machine-card-code {
  font-size: 16px;
  font-weight: 700;
  color: var(--mms-obsidian);
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
  display: block;
}

.v2-machine-card-name {
  font-size: 12px;
  color: var(--mms-obsidian-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================================
   UNIVERSAL TABLET CAMERA MODAL
   ======================================================================== */

.v2-camera-modal-backdrop[hidden],
.v2-camera-modal-backdrop[style*="display: none"] {
  display: none !important;
}

.v2-camera-modal-backdrop:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(15, 23, 42, 0.92);
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: v2ModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.v2-camera-modal-container {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.v2-camera-modal-header {
  padding: 14px 20px;
  background: #1E293B;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-camera-close-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.v2-camera-close-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.v2-camera-viewport-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#v2Html5QrReader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

#v2Html5QrReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}

#v2Html5QrReader img {
  display: none !important;
}

.v2-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v2-camera-reticle {
  position: absolute;
  width: 220px;
  height: 220px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.v2-camera-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #38BDF8;
  box-shadow: 0 0 12px #38BDF8, 0 0 20px #0284C7;
  animation: v2LaserScan 2s ease-in-out infinite alternate;
}

@keyframes v2LaserScan {
  0% { top: 5%; }
  100% { top: 95%; }
}

.v2-reticle-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #38BDF8;
  border-style: solid;
}

.v2-rc-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 8px; }
.v2-rc-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 8px; }
.v2-rc-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 8px; }
.v2-rc-br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 8px; }

.v2-camera-modal-footer {
  padding: 14px 20px;
  background: #1E293B;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-station-fifo-modal {
  background: var(--mms-surface);
  border: 2px solid var(--mms-accent-crimson);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(225, 29, 72, 0.35);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  animation: v2ModalPop var(--transition-fast) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes v2ModalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.v2-station-fifo-header {
  background: var(--mms-accent-crimson);
  color: #ffffff;
  padding: 24px;
  text-align: center;
}

.v2-station-fifo-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.v2-station-fifo-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
  color: #ffffff;
}

.v2-station-fifo-subtitle {
  font-size: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.95);
}

.v2-station-fifo-body {
  padding: 24px;
}

.v2-station-fifo-message {
  font-size: 15px;
  font-weight: 600;
  color: var(--mms-accent-crimson);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.v2-station-fifo-details {
  background: var(--mms-canvas);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.v2-station-fifo-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.v2-station-fifo-detail-row:last-child {
  margin-bottom: 0;
}

.v2-station-fifo-detail-label {
  color: var(--mms-obsidian-muted);
  font-weight: 500;
}

.v2-station-fifo-detail-value {
  color: var(--mms-obsidian);
  font-weight: 700;
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
}

.v2-station-fifo-actions {
  display: flex;
  justify-content: stretch;
  margin-top: 20px;
}

.v2-station-fifo-actions .v2-btn {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 600;
  justify-content: center;
}

/* ========================================================================
   UNMOUNT & DISCARD STATIONS
   ======================================================================== */

.v2-unmount-summary-card {
  background: var(--mms-canvas);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.v2-unmount-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.v2-unmount-preset-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--mms-canvas);
  border: 2px solid var(--mms-surface-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  min-height: 72px;
  box-sizing: border-box;
}

.v2-unmount-preset-btn:hover {
  border-color: var(--mms-accent-indigo);
  background: var(--mms-surface);
}

.v2-unmount-preset-btn.active {
  border-color: var(--mms-accent-indigo);
  background: var(--mms-accent-indigo-soft);
  box-shadow: 0 0 0 1px var(--mms-accent-indigo);
}

.v2-unmount-preset-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--mms-obsidian);
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-unmount-preset-btn.active .v2-unmount-preset-title {
  color: var(--mms-accent-indigo);
}

.v2-unmount-preset-desc {
  font-size: 13px;
  color: var(--mms-obsidian-muted);
}

.v2-num-adjust-pad {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 20px;
}

.v2-num-adjust-btn {
  flex: 1;
  min-height: 48px;
  background: var(--mms-canvas);
  border: 1px solid var(--mms-surface-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--mms-font-tabular);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: var(--mms-obsidian);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.v2-num-adjust-btn:hover {
  background: var(--mms-surface);
  border-color: var(--mms-accent-indigo);
  color: var(--mms-accent-indigo);
}

.v2-btn-danger {
  background: var(--mms-accent-crimson, #DC2626);
  color: #ffffff;
  border: 1px solid var(--mms-accent-crimson-hover, #B91C1C);
}

.v2-btn-danger:hover {
  background: var(--mms-accent-crimson-hover, #B91C1C);
  color: #ffffff;
}

.v2-discard-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  min-height: 50px;
  padding: 0 44px 0 16px;
  font-family: var(--mms-font-sans);
  font-size: 15px;
  font-weight: 700;
  color: #BE123C;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23BE123C' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  border: 2px solid #BE123C;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(190, 18, 60, 0.12);
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  margin-bottom: 20px;
  transition: all var(--transition-fast);
}

.v2-discard-select:hover {
  background-color: #FFF1F2;
  border-color: #9F1239;
  box-shadow: 0 3px 10px rgba(190, 18, 60, 0.2);
}

.v2-discard-select:focus {
  background-color: #FFFFFF;
  border-color: #9F1239;
  box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.2), 0 3px 10px rgba(190, 18, 60, 0.25);
}

.v2-discard-select option {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #0F172A;
  background: #FFFFFF;
}

/* ========================================================================
   RESPONSIVE ADJUSTMENTS (Portrait Tablets & Smaller Screens)
   ======================================================================== */

@media (max-width: 768px) {
  .v2-station-scan-hero {
    max-width: 100%;
  }

  .v2-station-barcode-input {
    font-size: 20px;
  }

  .v2-station-feeder-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }

  .v2-station-feeder-slot {
    min-height: 72px;
  }

  .v2-station-fifo-modal {
    max-width: 100%;
  }

  .v2-station-footer-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
