/* ===== CSS Variables ===== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-50: #e0e7ff;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e1b4b;
  --bg-sidebar-hover: #312e81;
  --bg-sidebar-active: #3730a3;

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-sidebar: #c7d2fe;
  --text-sidebar-active: #ffffff;

  --border: #e2e8f0;
  --border-focus: #4f46e5;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-width: 260px;
  --navbar-height: 64px;

  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
}

/* ===== 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, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-content {
  flex: 1;
  padding: 24px 32px;
  margin-top: var(--navbar-height);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-brand .brand-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(199, 210, 254, 0.5);
  padding: 12px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item:hover .nav-icon {
  transform: scale(1.1);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 90;
  transition: left 0.3s ease;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
  width: auto;
  margin: 0;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 260px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  width: 320px;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.user-menu:hover {
  background: var(--bg);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  display: none;
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.user-dropdown a,
.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
  border-radius: 0;
  margin: 0;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--bg);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ===== KPI Cards ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  cursor: default;
}

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

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

.kpi-card-clickable:hover {
  border-color: var(--primary);
  background: var(--hover);
}

.kpi-arrow {
  margin-left: auto;
  font-size: 20px;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s, transform 0.2s;
}

.kpi-card-clickable:hover .kpi-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Breakdown modal stats */
.breakdown-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.breakdown-stat.highlight {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.breakdown-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.breakdown-stat-value {
  font-size: 18px;
  font-weight: 700;
}

.breakdown-stat-value.blue   { color: var(--primary); }
.breakdown-stat-value.green  { color: var(--success); }
.breakdown-stat-value.red    { color: var(--danger); }
.breakdown-stat-value.purple { color: #8b5cf6; }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.purple { background: #f5f3ff; color: #7c3aed; }
.kpi-icon.indigo { background: var(--primary-light); color: var(--primary); }

.kpi-content h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.kpi-content .kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

/* ===== Chart Containers ===== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

/* ===== Tables ===== */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.table-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

thead {
  background: var(--bg);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  transition: var(--transition-fast);
}

tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.5);
}

tbody tr:hover {
  background: var(--primary-light);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-orange { background: #fff7ed; color: #ea580c; }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-teal { background: #ccfbf1; color: #0f766e; }

/* Stock indicators */
.stock-ok { color: var(--success); font-weight: 600; }
.stock-low { color: var(--warning); font-weight: 600; }
.stock-warning { color: var(--warning); font-weight: 600; }
.stock-critical { color: var(--danger); font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  width: auto;
  margin: 0;
  text-decoration: none;
  line-height: 1.5;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

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

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

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

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

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

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
  color: var(--text-light);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: var(--transition);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  width: auto;
  margin: 0;
  border-radius: var(--radius);
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.modal-body {
  padding: 24px;
}

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

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ===== Search Filter Bar ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar .form-control {
  width: auto;
  min-width: 200px;
}

/* ===== File Upload ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area .upload-icon {
  font-size: 36px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-list {
  margin-top: 12px;
}

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

.file-item .file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.file-item .file-date {
  font-size: 12px;
  color: var(--text-light);
}

.file-item .file-actions {
  display: flex;
  gap: 4px;
}

/* ===== Product Search (Order Form) ===== */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-item:hover {
  background: var(--primary-light);
}

.search-result-item .result-name {
  font-weight: 600;
}

.search-result-item .result-price {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ===== Order Items Table ===== */
.order-items-list {
  margin: 16px 0;
}

.order-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.order-item-row:last-child {
  border-bottom: none;
}

.order-summary {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ===== Toast / Notifications ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-card .login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .login-brand .brand-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.login-card .login-brand h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.login-card .login-brand p {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card .form-control {
  padding: 11px 14px;
  font-size: 14px;
}

.login-card .btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  margin-top: 8px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

/* ===== Warning List ===== */
.warning-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.warning-icon {
  color: var(--warning);
  font-size: 16px;
}

/* ===== Production List ===== */
.production-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.production-amount {
  font-weight: 700;
  color: var(--danger);
}

/* ===== Utility Classes ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .navbar {
    left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .main-content {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .search-box input {
    width: 160px;
  }

  .search-box input:focus {
    width: 200px;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    width: 95%;
    margin: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .order-item-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ===== Sidebar overlay for mobile ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.show {
  display: block;
}

/* ===== Loading spinner ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Tabs ===== */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: var(--transition-fast);
  width: auto;
  margin-top: 0;
  border-radius: 0;
}

.tab-btn:hover {
  color: var(--text);
  box-shadow: none;
  transform: none;
}

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

/* ===== Status Dropdown (inline in table) ===== */
.status-dropdown {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 28px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  width: auto;
  min-width: 130px;
}
.status-dropdown:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.status-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.status-dropdown.status-Neu { background-color: var(--info-bg); color: var(--info); }
.status-dropdown.status-In_Produktion { background-color: #fff7ed; color: #ea580c; }
.status-dropdown.status-Fertig { background-color: var(--success-bg); color: var(--success); }
.status-dropdown.status-Versandt { background-color: #f1f5f9; color: #475569; }
.status-dropdown.status-Storniert { background-color: var(--danger-bg); color: var(--danger); }

/* ===== Shipping Date Row Colors ===== */
tr.row-warning {
  background-color: #fffbeb !important;
  border-left: 3px solid var(--warning);
}
tr.row-warning:hover {
  background-color: #fef3c7 !important;
}
tr.row-overdue {
  background-color: #fef2f2 !important;
  border-left: 3px solid var(--danger);
}
tr.row-overdue:hover {
  background-color: #fee2e2 !important;
}

/* ===== Assignment Badge ===== */
.assign-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--primary-light);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  margin: 2px 0;
  transition: all 0.2s ease;
}
.assign-badge:hover {
  background: var(--primary-50);
  transform: translateY(-1px);
}

/* ===== Enhanced Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.kpi-card { animation: fadeInUp 0.4s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }

.chart-card { animation: fadeInUp 0.5s ease both; animation-delay: 0.15s; }
.table-container { animation: fadeInUp 0.4s ease both; animation-delay: 0.1s; }
.card { animation: fadeInUp 0.4s ease both; animation-delay: 0.1s; }

/* ===== Enhanced Button Styles ===== */
.btn {
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}
.btn:active::after {
  width: 200px;
  height: 200px;
}

.btn-primary {
  box-shadow: 0 2px 4px rgba(79,70,229,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

.btn-danger {
  box-shadow: 0 2px 4px rgba(239,68,68,0.3);
}
.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.btn-success {
  box-shadow: 0 2px 4px rgba(16,185,129,0.3);
}
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16,185,129,0.4);
}

/* ===== Enhanced Table Rows ===== */
tbody tr {
  transition: all 0.2s ease;
}
tbody tr:hover {
  transform: translateX(2px);
}

/* ===== Enhanced Nav Items ===== */
.nav-item {
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #fff;
  transform: scaleY(0);
  transition: transform 0.2s ease;
  border-radius: 0 3px 3px 0;
}
.nav-item:hover::before,
.nav-item.active::before {
  transform: scaleY(1);
}

/* ===== Modal Animations Enhanced ===== */
.modal-overlay.show .modal {
  animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== Page Header Enhanced ===== */
.page-header h2 {
  position: relative;
}
.page-header h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===== EK Price Breakdown Link ===== */
.ek-price-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline dotted;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: var(--transition-fast);
}
.ek-price-link:hover {
  color: var(--primary-hover);
}

/* ===== File Links ===== */
.file-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
  font-size: 12px;
  margin: 2px 0;
}
.file-link:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ===== Production Need Alert ===== */
#productionNavItem.production-need-alert {
  position: relative;
  animation: productionNeedPulse 2s ease-in-out infinite;
}

#productionNavItem.production-need-alert::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  opacity: 0;
  animation: productionNeedFade 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes productionNeedPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
  }
}

@keyframes productionNeedFade {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
}

/* ===== Materials Low Stock Alert ===== */
/* Warning (Yellow) - Bestand < Mindestbestand aber > 0 */
#materialsNavItem.materials-alert-warning {
  position: relative;
  animation: materialsAlertWarningPulse 2s ease-in-out infinite;
}

#materialsNavItem.materials-alert-warning::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  opacity: 0;
  animation: materialsAlertWarningFade 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes materialsAlertWarningPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50%       { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3); }
}

@keyframes materialsAlertWarningFade {
  0%, 100% { opacity: 0; }
  50%       { opacity: 0.8; }
}

/* Critical (Red) - Bestand < 0 */
#materialsNavItem.materials-alert-critical {
  position: relative;
  animation: materialsAlertCriticalPulse 2s ease-in-out infinite;
}

#materialsNavItem.materials-alert-critical::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  opacity: 0;
  animation: materialsAlertCriticalFade 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes materialsAlertCriticalPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50%       { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3); }
}

@keyframes materialsAlertCriticalFade {
  0%, 100% { opacity: 0; }
  50%       { opacity: 0.8; }
}

/* ===== Material row styling ===== */
/* Warning (Yellow) - Bestand < Mindestbestand aber > 0 */
.row-stock-warning {
  background-color: rgba(245, 158, 11, 0.08) !important;
}
.row-stock-warning td {
  border-color: rgba(245, 158, 11, 0.2);
}

/* Critical (Red) - Bestand < 0 */
.row-stock-critical {
  background-color: rgba(239, 68, 68, 0.08) !important;
}
.row-stock-critical td {
  border-color: rgba(239, 68, 68, 0.2);
}

/* ===== Orders Alert (Warning & Overdue) ===== */
#ordersNavItem.orders-warning-alert {
  position: relative;
  animation: ordersWarningPulse 2s ease-in-out infinite;
}

#ordersNavItem.orders-warning-alert::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  opacity: 0;
  animation: ordersWarningFade 2s ease-in-out infinite;
  pointer-events: none;
}

#ordersNavItem.orders-overdue-alert {
  position: relative;
  animation: ordersOverduePulse 2s ease-in-out infinite;
}

#ordersNavItem.orders-overdue-alert::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  opacity: 0;
  animation: ordersOverdueFade 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ordersWarningPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
  }
}

@keyframes ordersWarningFade {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes ordersOverduePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
  }
}

@keyframes ordersOverdueFade {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
}
