/* ==================== CSS VARIABLES ==================== */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-tertiary: #1c1f2e;
  --bg-card: #1e2132;
  --bg-card-hover: #252840;
  --bg-input: #1a1d2e;
  --bg-glass: rgba(30, 33, 50, 0.7);

  --text-primary: #e8eaf0;
  --text-secondary: #9ca3b4;
  --text-muted: #636b82;
  --text-accent: #a78bfa;

  --accent-primary: #7c3aed;
  --accent-primary-hover: #6d28d9;
  --accent-primary-glow: rgba(124, 58, 237, 0.25);
  --accent-secondary: #06b6d4;
  --accent-secondary-glow: rgba(6, 182, 212, 0.2);

  --status-waiting: #f59e0b;
  --status-waiting-bg: rgba(245, 158, 11, 0.12);
  --status-producing: #3b82f6;
  --status-producing-bg: rgba(59, 130, 246, 0.12);
  --status-produced: #06b6d4;
  --status-produced-bg: rgba(6, 182, 212, 0.12);
  --status-packing: #8b5cf6;
  --status-packing-bg: rgba(139, 92, 246, 0.12);
  --status-completed: #10b981;
  --status-completed-bg: rgba(16, 185, 129, 0.12);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(124, 58, 237, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--accent-primary-glow);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f1117 0%, #1a1040 50%, #0f1117 100%);
}

.login-bg-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-secondary);
  bottom: -50px;
  left: -50px;
  animation-delay: -3s;
}

.shape-3 {
  width: 200px;
  height: 200px;
  background: #ec4899;
  top: 50%;
  left: 50%;
  animation-delay: -5s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -30px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

.login-card {
  position: relative;
  width: 420px;
  max-width: 90vw;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.logo-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.login-logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: shake 0.4s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #9333ea);
  color: white;
  box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-success {
  background: var(--status-completed-bg);
  color: var(--status-completed);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-login {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
}

.login-footer {
  text-align: center;
  margin-top: 28px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-viewer {
  border: 1.5px solid rgba(124, 58, 237, 0.3) !important;
  background: rgba(124, 58, 237, 0.08) !important;
  justify-content: center;
  gap: 8px;
}

.btn-viewer:hover {
  border-color: var(--accent-primary) !important;
  background: rgba(124, 58, 237, 0.15) !important;
}

/* ==================== APP LAYOUT ==================== */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 100vh;
}

/* ==================== HEADER ==================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.header-logo svg {
  width: 20px;
  height: 20px;
  color: white;
}

.header-title h1 {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  text-transform: uppercase;
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.btn-logout {
  padding: 8px;
  border-radius: 50%;
  border: none;
}

.btn-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-logout svg {
  width: 20px;
  height: 20px;
}

/* ==================== NAVIGATION ==================== */
.nav {
  display: flex;
  gap: 4px;
  padding: 12px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 3px;
}

/* ==================== CONTENT ==================== */
.content {
  padding: 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.btn-refresh {
  gap: 6px;
}

.btn-refresh svg {
  width: 16px;
  height: 16px;
}

/* ==================== STATS GRID ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-total .stat-icon {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-primary);
}

.stat-waiting .stat-icon {
  background: var(--status-waiting-bg);
  color: var(--status-waiting);
}

.stat-producing .stat-icon {
  background: var(--status-produced-bg);
  color: var(--status-produced);
}

.stat-completed .stat-icon {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==================== SECTIONS ==================== */
.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.section-header h3 {
  margin-bottom: 0;
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
  display: flex;
  gap: 8px;
}

.select-filter {
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.select-filter:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Date input type - high visibility */
input[type="date"].select-filter,
input[type="date"] {
  padding: 10px 14px;
  background: rgba(25, 28, 45, 0.95);
  border: 2px solid rgba(124, 58, 237, 0.4);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

input[type="date"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow), 0 0 15px rgba(124, 58, 237, 0.15);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6) sepia(1) saturate(4) hue-rotate(220deg);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  transition: var(--transition);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(0.4) sepia(1) saturate(5) hue-rotate(220deg);
  background: rgba(124, 58, 237, 0.25);
  transform: scale(1.15);
}

/* ==================== TABLES ==================== */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ==================== STATUS BADGES ==================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.waiting {
  background: var(--status-waiting-bg);
  color: var(--status-waiting);
}

.status-badge.waiting::before {
  background: var(--status-waiting);
}

.status-badge.producing {
  background: var(--status-producing-bg);
  color: var(--status-producing);
}

.status-badge.producing::before {
  background: var(--status-producing);
}

.status-badge.produced {
  background: var(--status-produced-bg);
  color: var(--status-produced);
}

.status-badge.produced::before {
  background: var(--status-produced);
}

.status-badge.packing-status {
  background: var(--status-packing-bg);
  color: var(--status-packing);
}

.status-badge.packing-status::before {
  background: var(--status-packing);
}

.status-badge.completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.status-badge.completed::before {
  background: var(--status-completed);
}

/* ==================== FORM CARD ==================== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(30, 35, 55, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group select {
  cursor: pointer;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(156, 163, 180, 0.6);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* ==================== DATE FIELDS HIGHLIGHT ==================== */
.date-row {
  margin-bottom: 8px;
}

.date-group {
  padding: 16px;
  background: rgba(124, 58, 237, 0.08);
  border: 1.5px solid rgba(124, 58, 237, 0.25);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
}

.date-group label {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #c4b5fd !important;
  letter-spacing: 0.3px;
}

.date-group input[type="date"] {
  background: rgba(40, 45, 70, 0.95) !important;
  border: 1.5px solid rgba(124, 58, 237, 0.35) !important;
  font-size: 1rem !important;
  font-weight: 600;
  padding: 14px 16px !important;
  color: #e8eaf0 !important;
}

.date-group input[type="date"]:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px var(--accent-primary-glow), 0 0 20px rgba(124, 58, 237, 0.15) !important;
}

/* Calendar picker icon styling */
.date-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(3) hue-rotate(220deg);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.date-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(0.5) sepia(1) saturate(5) hue-rotate(220deg);
  background: rgba(124, 58, 237, 0.2);
}

/* ==================== ORDER LINES TABLE ==================== */
.order-lines-section {
  margin: 16px 0;
  padding: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.order-lines-table-wrapper {
  overflow-x: auto;
}

.order-lines-table {
  width: 100%;
  border-collapse: collapse;
}

.order-lines-table thead {
  background: rgba(124, 58, 237, 0.12);
}

.order-lines-table th {
  padding: 10px 8px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.order-lines-table td {
  padding: 4px 4px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.order-lines-table td {
  padding: 5px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

.order-line-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.order-line-row:hover {
  background: rgba(124, 58, 237, 0.08);
}

.col-stt {
  width: 40px;
  text-align: center;
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
}

.row-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), #9333ea);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.col-product {
  width: 28%;
}

.col-pellet {
  width: 22%;
}

.col-delivery {
  width: 22%;
}

.col-qty {
  width: 28%;
}

.line-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(25, 28, 45, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.line-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.line-input::placeholder {
  color: rgba(156, 163, 180, 0.4);
  font-size: 0.8rem;
}

.line-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(25, 28, 45, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.line-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.qty-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-qty-input {
  flex: 1;
  text-align: center;
  font-weight: 600;
}

.qty-unit {
  padding: 6px 10px;
  background: linear-gradient(135deg, var(--accent-primary), #9333ea);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
}

@media (max-width: 768px) {

  .order-lines-table th,
  .order-lines-table td {
    padding: 4px 2px;
    font-size: 0.8rem;
  }

  .line-input,
  .line-select {
    padding: 6px 6px;
    font-size: 0.8rem;
  }
}

/* ==================== CARDS GRID (Mixer/Packing) ==================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.order-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.order-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.order-card.card-waiting::before {
  background: linear-gradient(90deg, var(--status-waiting), var(--status-producing));
}

.order-card.card-produced::before {
  background: linear-gradient(90deg, var(--status-produced), var(--status-completed));
}

.order-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.order-card-id {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
  padding: 4px 10px;
  border-radius: 20px;
}

.order-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.order-card-body {
  margin-bottom: 20px;
}

.order-card-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.order-card-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.order-card-detail strong {
  color: var(--text-primary);
  font-weight: 600;
}

.order-card-actions {
  display: flex;
  gap: 8px;
}

.order-card-actions .form-group {
  margin-bottom: 0;
  flex: 1;
}

.order-card-actions .form-group input,
.order-card-actions .form-group textarea {
  padding: 10px 12px;
  font-size: 0.85rem;
}

.order-card-actions .form-group label {
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.card-action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.card-action-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.card-confirm-btn {
  margin-top: 16px;
  width: 100%;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 300px;
  max-width: 420px;
}

.toast.toast-success {
  border-left: 4px solid var(--status-completed);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--accent-secondary);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-close {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.25rem;
  border-radius: 50%;
  border: none;
}

.modal-body {
  padding: 24px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }

  .nav {
    padding: 8px 16px;
  }

  .content {
    padding: 20px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .user-name {
    display: none;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 32px 24px;
  }

  .nav-btn span {
    display: none;
  }

  .nav-btn {
    padding: 10px 14px;
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ==================== TABLE OVERFLOW ==================== */
.table-wrapper {
  overflow-x: auto;
}

/* Action buttons in table */
.table-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

/* ==================== DELIVERY OPTIONS ==================== */
.delivery-section {
  margin: 16px 0;
  padding: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.delivery-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  min-width: 140px;
}

.radio-option:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.radio-option input[type="radio"]:checked+.radio-label {
  color: var(--text-primary);
  font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
  border-color: var(--accent-primary);
  background: var(--accent-primary-glow);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.radio-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.unit-display {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent-primary), #9333ea);
  color: white;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  min-height: 46px;
}

.delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 26px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent-primary), #9333ea);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ==================== WEEKLY CALENDAR ==================== */
.weekly-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.week-day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  transition: var(--transition);
  cursor: default;
  min-height: 100px;
}

.week-day-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.week-day-card.today {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-primary-glow);
}

.week-day-card.has-overdue {
  border-color: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.week-day-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.week-day-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.week-day-card.today .week-day-date {
  color: var(--accent-primary);
}

.week-day-orders {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.week-day-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.week-day-badge.waiting { background: var(--status-waiting-bg); color: var(--status-waiting); }
.week-day-badge.produced { background: var(--status-produced-bg); color: var(--status-produced); }
.week-day-badge.completed { background: var(--status-completed-bg); color: var(--status-completed); }
.week-day-badge.total-badge { background: rgba(124,58,237,0.15); color: var(--accent-primary); font-size: 0.8rem; }
.week-day-badge.overdue { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 768px) {
  .weekly-calendar {
    grid-template-columns: repeat(3, 1fr);
  }
  .weekly-calendar .week-day-card:nth-child(7) {
    grid-column: 2;
  }
}