@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette - Default Theme (Złoty Mrok) */
  --bg-dark: #0f1013;
  --bg-card: rgba(22, 24, 30, 0.75);
  --bg-card-hover: rgba(28, 31, 38, 0.88);
  --bg-card-solid: #16181e;
  --bg-input: rgba(0, 0, 0, 0.25);
  
  --accent-gold: #cfa85c;
  --accent-gold-hover: #b08d43;
  --accent-gold-light: rgba(207, 168, 92, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(207, 168, 92, 0.5);
  
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
  --status-info: #3b82f6;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-gold: 0 4px 20px rgba(207, 168, 92, 0.15);
  
  --nav-active-text: #0f1013;
  --btn-primary-text: #0f1013;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(207, 168, 92, 0.08) 0px, transparent 50%), radial-gradient(at 50% 0%, rgba(59, 130, 246, 0.03) 0px, transparent 50%);

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
}

:root.light-mode {
  --bg-dark: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-card-solid: #ffffff;
  --bg-input: rgba(0, 0, 0, 0.05);
  --accent-gold: #b45309;
  --accent-gold-hover: #92400e;
  --accent-gold-light: rgba(180, 83, 9, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-glass: rgba(15, 23, 42, 0.08);
  --border-focus: rgba(180, 83, 9, 0.4);
  --nav-active-text: #ffffff;
  --btn-primary-text: #ffffff;
}

/* === Color Themes System === */

/* Theme 1: Default / Złoty Mrok */

:root[data-theme="default"],
[data-theme="default"] {
  --bg-dark: #0f1013;
  --bg-card: rgba(22, 24, 30, 0.75);
  --bg-card-hover: rgba(28, 31, 38, 0.88);
  --bg-card-solid: #16181e;
  --bg-input: rgba(0, 0, 0, 0.25);
  
  --accent-gold: #cfa85c;
  --accent-gold-hover: #b08d43;
  --accent-gold-light: rgba(207, 168, 92, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(207, 168, 92, 0.5);
  --shadow-gold: 0 4px 20px rgba(207, 168, 92, 0.15);
  
  --nav-active-text: #0f1013;
  --btn-primary-text: #0f1013;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(207, 168, 92, 0.08) 0px, transparent 50%), radial-gradient(at 50% 0%, rgba(59, 130, 246, 0.03) 0px, transparent 50%);
}

/* Theme 2: Królewski Błękit (#0057ff & #f8f7f4) */

:root[data-theme="cobalt"],
[data-theme="cobalt"] {
  --bg-dark: #f8f7f4;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(240, 244, 255, 0.96);
  --bg-card-solid: #ffffff;
  --bg-input: rgba(0, 87, 255, 0.05);
  
  --accent-gold: #0057ff;
  --accent-gold-hover: #0043c7;
  --accent-gold-light: rgba(0, 87, 255, 0.12);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border-glass: rgba(0, 87, 255, 0.15);
  --border-focus: rgba(0, 87, 255, 0.5);
  --shadow-gold: 0 4px 20px rgba(0, 87, 255, 0.22);
  
  --nav-active-text: #ffffff;
  --btn-primary-text: #ffffff;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(0, 87, 255, 0.08) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(0, 87, 255, 0.04) 0px, transparent 50%);
}

/* Theme 3: Cyber Magenta (#ff4696 & #1e1033) */

:root[data-theme="cyberpunk"],
[data-theme="cyberpunk"] {
  --bg-dark: #1e1033;
  --bg-card: rgba(40, 24, 66, 0.78);
  --bg-card-hover: rgba(55, 34, 90, 0.9);
  --bg-card-solid: #281842;
  --bg-input: rgba(0, 0, 0, 0.3);
  
  --accent-gold: #ff4696;
  --accent-gold-hover: #e0307e;
  --accent-gold-light: rgba(255, 70, 150, 0.18);
  
  --text-primary: #fce7f3;
  --text-secondary: #d8b4fe;
  --text-muted: #a855f7;
  
  --border-glass: rgba(255, 70, 150, 0.18);
  --border-focus: rgba(255, 70, 150, 0.5);
  --shadow-gold: 0 4px 20px rgba(255, 70, 150, 0.25);
  
  --nav-active-text: #ffffff;
  --btn-primary-text: #ffffff;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(255, 70, 150, 0.15) 0px, transparent 50%), radial-gradient(at 100% 80%, rgba(168, 85, 247, 0.12) 0px, transparent 50%);
}

/* Theme 4: Szmaragdowy Piasek (#064e3b & #f8e7c9) */

:root[data-theme="emerald_sand"],
[data-theme="emerald_sand"] {
  --bg-dark: #f8e7c9;
  --bg-card: rgba(255, 252, 245, 0.92);
  --bg-card-hover: rgba(247, 240, 222, 0.96);
  --bg-card-solid: #fefcf7;
  --bg-input: rgba(6, 78, 59, 0.05);
  
  --accent-gold: #064e3b;
  --accent-gold-hover: #04392b;
  --accent-gold-light: rgba(6, 78, 59, 0.15);
  
  --text-primary: #062c22;
  --text-secondary: #2d5a4c;
  --text-muted: #4d7c6f;
  
  --border-glass: rgba(6, 78, 59, 0.18);
  --border-focus: rgba(6, 78, 59, 0.5);
  --shadow-gold: 0 4px 20px rgba(6, 78, 59, 0.2);
  
  --nav-active-text: #f8e7c9;
  --btn-primary-text: #f8e7c9;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(6, 78, 59, 0.1) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(217, 119, 6, 0.05) 0px, transparent 50%);
}

/* Backward compatibility aliases */

[data-theme="ocean"] {
  --accent-gold: #0057ff;
  --accent-gold-hover: #0043c7;
}

[data-theme="amethyst"] {
  --accent-gold: #ff4696;
  --accent-gold-hover: #e0307e;
}

[data-theme="emerald"] {
  --accent-gold: #064e3b;
  --accent-gold-hover: #04392b;
}

/* Base resets */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* Scrollable Container Utilities */

.custom-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Micro-animations */

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

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(207, 168, 92, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(207, 168, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(207, 168, 92, 0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.pulse-gold-btn {
  animation: pulseGold 2s infinite;
}

/* PWA Offline Status Badge */

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  margin-top: 4px;
  transition: var(--transition-smooth);
}

.offline-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.offline-badge.syncing {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

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

.animate-spin {
  animation: spin 1s linear infinite;
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .sidebar, .mobile-header, .no-print, button, .btn {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .card {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  .table th, .table td {
    border: 1px solid #ddd !important;
    color: #000 !important;
    padding: 8px !important;
  }
}
/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (Desktop) */
.sidebar {
  width: 260px;
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-glass);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
  background-color: #000;
}

.logo-fallback {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--btn-primary-text, var(--bg-dark));
  overflow: hidden;
}

.logo-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--text-primary);
  background: linear-gradient(120deg, var(--text-primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.95rem;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--nav-active-text, var(--bg-dark));
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  box-shadow: var(--shadow-gold);
}

.nav-item.active svg {
  color: var(--nav-active-text, var(--bg-dark));
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.username-tag {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.logout-btn:hover {
  color: var(--status-danger);
  background-color: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 40px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

.mobile-header {
  display: none;
}

/* Login/Register Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.auth-logo img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  margin-bottom: 12px;
}

.auth-header {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.auth-subheader {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 8px 16px;
  background: var(--bg-input, rgba(0, 0, 0, 0.2));
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

select.form-input {
  cursor: pointer;
  padding-top: 6px;
  padding-bottom: 6px;
}

.form-input option,
select option {
  background-color: var(--bg-card-solid, #1a1c23);
  color: var(--text-primary);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(207, 168, 92, 0.15);
}

.form-input-checkbox {
  margin-right: 8px;
  accent-color: var(--accent-gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  color: var(--btn-primary-text, var(--bg-dark));
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.auth-toggle {
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-toggle-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
}

.auth-toggle-link:hover {
  text-decoration: underline;
}

/* Page Headers & Cards */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-cols-12 {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.col-span-8 {
  grid-column: span 8 / span 8;
  min-width: 0;
}

.col-span-4 {
  grid-column: span 4 / span 4;
  min-width: 0;
}

.col-span-5 {
  grid-column: span 5 / span 5;
  min-width: 0;
}

.col-span-7 {
  grid-column: span 7 / span 7;
  min-width: 0;
}

.col-span-12 {
  grid-column: span 12 / span 12;
  min-width: 0;
}

.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.card:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Table styling */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: rgba(255, 255, 255, 0.02);
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.9rem;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--status-info);
}

.badge-secondary {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

/* Custom items specifically for recipes and calculators */
.ingredient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.calc-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.calc-metric-card {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  text-align: center;
}

.calc-metric-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.calc-metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.timeline-step {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  position: relative;
}

.timeline-step::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: -16px;
  width: 2px;
  background: var(--border-glass);
}

.timeline-step:last-child::before {
  display: none;
}

.timeline-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 2;
  color: var(--text-secondary);
}

.timeline-marker.active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.timeline-marker.completed {
  border-color: var(--status-success);
  background: var(--status-success);
  color: var(--bg-dark);
}

.timeline-content {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.01);
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
}

/* Alert notifications */
.alert-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease;
}

/* Responsive (Mobile/Tablet) */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    display: none;
    /* Hide desktop sidebar */
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-nav-menu {
    position: fixed;
    top: 73px;
    left: 0;
    right: 0;
    background: rgba(15, 16, 19, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99;
  }

  .main-content {
    padding: 24px 16px;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-12 {
    grid-template-columns: 1fr;
  }

  .col-span-8,
  .col-span-4,
  .col-span-5,
  .col-span-7 {
    grid-column: span 1 / span 1;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* Print Styling */
@media print {
  /* Hide UI elements non-essential for print */
  .no-print,
  .sidebar,
  .mobile-header,
  .mobile-nav-menu,
  .btn,
  .page-header,
  .auth-wrapper,
  .alert-toast,
  button:not(.print-keep) {
    display: none !important;
  }

  svg {
    display: none !important;
  }

  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .grid {
    display: block !important;
  }

  .print-full-width {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body *:not(.print-label-container *) {
    color: #000000 !important;
    text-shadow: none !important;
  }

  .card {
    border: 1px solid #ccc !important;
    background: #ffffff !important;
    box-shadow: none !important;
    padding: 16px !important;
    margin-bottom: 20px !important;
    break-inside: avoid;
  }

  .print-only {
    display: block !important;
  }

  th.print-only,
  td.print-only {
    display: table-cell !important;
  }

  .table-wrapper {
    border: 1px solid #000 !important;
    border-radius: 0 !important;
  }

  .table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  .table th {
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }

  .table td {
    border: 1px solid #000 !important;
    color: #000 !important;
  }

  .calc-metric-card {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
  }

  .calc-metric-value,
  .calc-metric-label {
    color: #000 !important;
  }

  /* Calendar print overrides */
  .calendar-weekdays {
    color: #000 !important;
    font-weight: bold !important;
  }

  .calendar-grid {
    gap: 4px !important;
  }

  .calendar-grid > div {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    color: #000000 !important;
  }
}

.print-only {
  display: none;
}

/* Custom Modals (Confirmation & Edit Product) */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 11, 14, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 2000;
  animation: modalFadeIn 0.2s ease-out;
  overflow-y: auto;
  padding: 40px 0;
}

.custom-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modalScaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
}

.custom-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-modal-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.custom-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalScaleUp {
  from {
    transform: scale(0.92);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Bulk Actions Styling */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(207, 168, 92, 0.08);
  border: 1px solid rgba(207, 168, 92, 0.3);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease;
}

.bulk-actions-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.bulk-actions-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-cell {
  width: 40px;
  text-align: center;
}

.checkbox-cell input[type="checkbox"],
.card-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.card-header-with-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-header-with-checkbox .card-checkbox {
  margin-top: 4px;
}

.bulk-loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: pulse-loading 1.5s infinite ease-in-out;
}

@keyframes pulse-loading {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
    color: var(--accent-gold);
  }
}

/* Calendar Styles */
.calendar-grid {
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.calendar-day:hover {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.calendar-day-sibling {
  opacity: 0.35;
}

.calendar-day-today {
  border-color: var(--accent-gold) !important;
  background-color: rgba(207, 168, 92, 0.08) !important;
}

.calendar-day-selected {
  border-color: var(--status-info) !important;
  background-color: rgba(59, 130, 246, 0.06) !important;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

/* Gantt Chart Styles */
.gantt-container {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 20px;
}

.gantt-header-row {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.gantt-label-col {
  width: 200px;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.gantt-timeline-col {
  flex-grow: 1;
  position: relative;
  display: flex;
}

.gantt-hour-marker {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-left: 1px dashed rgba(255, 255, 255, 0.05);
}

.gantt-hour-marker:first-child {
  border-left: none;
}

.gantt-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-batch-info {
  width: 200px;
  flex-shrink: 0;
  padding-right: 12px;
}

.gantt-batch-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-batch-recipe {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.gantt-bars-container {
  flex-grow: 1;
  height: 32px;
  position: relative;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.gantt-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  pointer-events: none;
}

.gantt-grid-line {
  flex: 1;
  border-left: 1px dashed rgba(255, 255, 255, 0.05);
  height: 100%;
}

.gantt-grid-line:first-child {
  border-left: none;
}

.gantt-bar-item {
  position: absolute;
  height: 24px;
  top: 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .calendar-weekdays {
    font-size: 0.7rem !important;
  }

  .calendar-day {
    min-height: 75px !important;
    padding: 4px !important;
  }

  .gantt-label-col,
  .gantt-batch-info {
    width: 120px !important;
  }

  .gantt-hour-marker {
    font-size: 0.6rem !important;
  }
}

/* Tooltip Help Icon styling */
.tooltip-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: bold;
  cursor: help;
  margin-left: 6px;
  vertical-align: middle;
}

.tooltip-help-text {
  visibility: hidden;
  width: 260px;
  background-color: #1e1e24;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  /* Position the tooltip above the text */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  font-size: 0.8rem;
  font-weight: normal;
  line-height: 1.4;
  pointer-events: none;
  white-space: normal;
  text-transform: none !important;
}

.tooltip-help:hover .tooltip-help-text {
  visibility: visible;
  opacity: 1;
}

/* Tooltip position adjustments to prevent clipping */
.tooltip-left {
  left: 0;
  transform: none;
}

.tooltip-right {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}

/* Voice Control Styles */
.voice-mic-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.voice-mic-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

.voice-mic-btn.listening {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  animation: mic-pulse 1.5s infinite ease-in-out;
}

@keyframes mic-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.voice-assistant-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background-color: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.voice-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
}

.voice-status {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  animation: mic-pulse 1.5s infinite ease-in-out;
}

.voice-transcript-area {
  min-height: 48px;
  max-height: 100px;
  overflow-y: auto;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-style: italic;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.voice-interim-text {
  color: var(--text-muted);
}

.voice-last-cmd {
  font-size: 0.8rem;
  color: var(--accent-gold);
  font-weight: 500;
}

.voice-wave-container {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.voice-wave-bar {
  width: 3px;
  height: 100%;
  background-color: var(--accent-gold);
  border-radius: 3px;
  animation: sound-wave 1.2s infinite ease-in-out;
}

.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 60%; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 80%; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 40%; }
.voice-wave-bar:nth-child(5) { animation-delay: 0.4s; height: 70%; }

@keyframes sound-wave {
  0%, 100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

.voice-help-modal-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.voice-commands-table {
  width: 100%;
  border-collapse: collapse;
}

.voice-commands-table th,
.voice-commands-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-glass);
  text-align: left;
  font-size: 0.85rem;
}

.voice-commands-table th {
  font-weight: 600;
  color: var(--text-secondary);
}

.voice-commands-table td strong {
  color: var(--accent-gold);
}

/* Batch Countdown Timer in Hands-Free Mode */
.handsfree-timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
}

.timer-digital {
  font-size: 4.5rem;
  font-family: monospace;
  font-weight: bold;
  color: var(--accent-gold);
  text-shadow: 0 0 15px rgba(207, 168, 92, 0.4);
  line-height: 1;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.timer-label {
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.timer-controls {
  display: flex;
  gap: 16px;
}

.timer-btn {
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-glass);
  transition: var(--transition-smooth);
}

.timer-btn-primary {
  background: var(--accent-gold);
  color: var(--bg-dark);
  border: none;
}

.timer-btn-primary:hover {
  background: var(--accent-gold-hover);
}

.timer-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.timer-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.timer-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), #f59e0b);
  transition: width 0.3s ease;
}

/* Forecasting Tab Styles */
.stock-ok {
  color: var(--status-success) !important;
  font-weight: 600;
}

.stock-deficit {
  color: var(--status-danger) !important;
  font-weight: 600;
}

.deficit-highlight {
  background-color: rgba(239, 68, 68, 0.05) !important;
  transition: background-color 0.3s ease;
}

.deficit-highlight:hover td {
  background-color: rgba(239, 68, 68, 0.08) !important;
}

.demand-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* PZ Form Grid layouts */
.pz-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.pz-product-row-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.8fr 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

/* Responsive Mobile Layout Overrides */
@media (max-width: 768px) {
  /* Prevent horizontal overflow on mobile body */
  body {
    overflow-x: hidden;
  }

  /* Improve mobile header alignment */
  .mobile-header {
    padding: 10px 16px !important;
    gap: 8px;
  }

  .mobile-header .logo-container {
    margin-bottom: 0 !important;
    gap: 8px !important;
  }

  .mobile-header .app-title {
    font-size: 1rem !important;
    white-space: nowrap;
  }

  /* Grid columns stacking */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-12,
  .grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .col-span-8,
  .col-span-4,
  .col-span-5,
  .col-span-7,
  .col-span-12 {
    grid-column: span 1 / span 1 !important;
  }

  /* Stack flex containers on mobile */
  div[style*="display: flex"][style*="justify-content: flex-end"],
  div[style*="display: flex"][style*="justifyContent: flex-end"],
  div[style*="display: flex"][style*="justify-content: space-between"],
  div[style*="display: flex"][style*="justifyContent: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  /* Prevent table column squishing - display block cards instead of scrolling horizontally */
  .table-wrapper {
    overflow-x: visible !important;
    width: 100% !important;
    margin-bottom: 16px;
    border: none !important;
  }

  .table {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }

  .table thead {
    display: none !important;
  }

  .table tbody,
  .table tr,
  .table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .table tr {
    margin-bottom: 16px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--border-radius-md) !important;
    padding: 12px 16px !important;
    box-shadow: var(--shadow-sm) !important;
  }

  .table tr:last-child {
    margin-bottom: 0 !important;
  }

  .table td {
    border: none !important;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05) !important;
    padding: 10px 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    white-space: normal !important;
    font-size: 0.88rem !important;
    gap: 8px !important;
  }

  .table td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  .table td:first-child {
    padding-top: 0 !important;
  }

  /* Add column header labels via pseudo-elements */
  .table td::before {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
  }

  .table td.checkbox-cell {
    justify-content: flex-start !important;
  }

  .table td.checkbox-cell::before {
    margin-right: 8px;
  }

  /* Label mappings for each table type */
  .dashboard-batches-table td:nth-child(1)::before { content: "Nazwa:"; }
  .dashboard-batches-table td:nth-child(2)::before { content: "Receptura:"; }
  .dashboard-batches-table td:nth-child(3)::before { content: "Ilość:"; }
  .dashboard-batches-table td:nth-child(4)::before { content: "Koszt:"; }
  .dashboard-batches-table td:nth-child(5)::before { content: "Status:"; }

  .warehouse-table td:nth-child(1)::before { content: "Zaznacz:"; }
  .warehouse-table td:nth-child(2)::before { content: "ID:"; }
  .warehouse-table td:nth-child(3)::before { content: "Nazwa:"; }
  .warehouse-table td:nth-child(4)::before { content: "SKU:"; }
  .warehouse-table td:nth-child(5)::before { content: "Stan:"; }
  .warehouse-table td:nth-child(6)::before { content: "Stan min:"; }
  .warehouse-table td:nth-child(7)::before { content: "Koszt:"; }
  .warehouse-table td:nth-child(8)::before { content: "Akcje:"; }

  .pz-table td:nth-child(1)::before { content: "Numer:"; }
  .pz-table td:nth-child(2)::before { content: "Data:"; }
  .pz-table td:nth-child(3)::before { content: "Dostawca:"; }
  .pz-table td:nth-child(4)::before { content: "Status:"; }
  .pz-table td:nth-child(5)::before { content: "Wartość:"; }
  .pz-table td:nth-child(6)::before { content: "Akcje:"; }

  .recipes-table td:nth-child(1)::before { content: "Zaznacz:"; }
  .recipes-table td:nth-child(2)::before { content: "Nazwa:"; }
  .recipes-table td:nth-child(3)::before { content: "Opis:"; }
  .recipes-table td:nth-child(4)::before { content: "Baza:"; }
  .recipes-table td:nth-child(5)::before { content: "Wydajność:"; }
  .recipes-table td:nth-child(6)::before { content: "Marża detal:"; }
  .recipes-table td:nth-child(7)::before { content: "Marża hurt:"; }
  .recipes-table td:nth-child(8)::before { content: "Składniki:"; }
  .recipes-table td:nth-child(9)::before { content: "Etapy:"; }
  .recipes-table td:nth-child(10)::before { content: "Akcje:"; }

  .calculator-ingredients-table td:nth-child(1)::before { content: "Surowiec:"; }
  .calculator-ingredients-table td:nth-child(2)::before { content: "Potrzebna ilość:"; }
  .calculator-ingredients-table td:nth-child(3)::before { content: "Stan magazynu:"; }
  .calculator-ingredients-table td:nth-child(4)::before { content: "Odważono:"; }
  .calculator-ingredients-table td:nth-child(5)::before { content: "Koszt jedn:"; }
  .calculator-ingredients-table td:nth-child(6)::before { content: "Suma koszt:"; }

  .calculator-steps-table td:nth-child(1)::before { content: "Krok:"; }
  .calculator-steps-table td:nth-child(2)::before { content: "Etap:"; }
  .calculator-steps-table td:nth-child(3)::before { content: "Czas:"; }
  .calculator-steps-table td:nth-child(4)::before { content: "Urządzenie:"; }
  .calculator-steps-table td:nth-child(5)::before { content: "Media:"; }
  .calculator-steps-table td:nth-child(6)::before { content: "Robocizna:"; }
  .calculator-steps-table td:nth-child(7)::before { content: "Wykonano:"; }

  .pricelist-items-table td:nth-child(1)::before { content: "Lp:"; }
  .pricelist-items-table td:nth-child(2)::before { content: "Wyrób/Produkt:"; }
  .pricelist-items-table td:nth-child(3)::before { content: "Koszt netto:"; }
  .pricelist-items-table td:nth-child(4)::before { content: "Marża Detal:"; }
  .pricelist-items-table td:nth-child(5)::before { content: "Cena Detal:"; }
  .pricelist-items-table td:nth-child(6)::before { content: "Marża Hurt:"; }
  .pricelist-items-table td:nth-child(7)::before { content: "Cena Hurt:"; }

  .order-details-table td:nth-child(1)::before { content: "Produkt:"; }
  .order-details-table td:nth-child(2)::before { content: "Ilość:"; }
  .order-details-table td:nth-child(3)::before { content: "Cena/kg:"; }
  .order-details-table td:nth-child(4)::before { content: "Suma:"; }
  .order-details-table td:nth-child(5)::before { content: "Status:"; }

  .new-order-items-table td:nth-child(1)::before { content: "Pozycja:"; }
  .new-order-items-table td:nth-child(2)::before { content: "Ilość:"; }
  .new-order-items-table td:nth-child(3)::before { content: "Cena brutto:"; }
  .new-order-items-table td:nth-child(4)::before { content: "Suma:"; }
  .new-order-items-table td:nth-child(5)::before { content: "Status:"; }
  .new-order-items-table td:nth-child(6)::before { content: "Akcje:"; }

  .demand-forecast-table td:nth-child(1)::before { content: "Nazwa:"; }
  .demand-forecast-table td:nth-child(2)::before { content: "SKU:"; }
  .demand-forecast-table td:nth-child(3)::before { content: "Wymagane:"; }
  .demand-forecast-table td:nth-child(4)::before { content: "Na stanie:"; }
  .demand-forecast-table td:nth-child(5)::before { content: "Deficyt:"; }
  .demand-forecast-table td:nth-child(6)::before { content: "Źródła popytu:"; }

  .sales-orders-table td:nth-child(1)::before { content: "ID:"; }
  .sales-orders-table td:nth-child(2)::before { content: "Data:"; }
  .sales-orders-table td:nth-child(3)::before { content: "Klient:"; }
  .sales-orders-table td:nth-child(4)::before { content: "Pozycje:"; }
  .sales-orders-table td:nth-child(5)::before { content: "Kwota:"; }
  .sales-orders-table td:nth-child(6)::before { content: "Status:"; }
  .sales-orders-table td:nth-child(7)::before { content: "Akcje:"; }

  .price-history-table td:nth-child(1)::before { content: "Data:"; }
  .price-history-table td:nth-child(2)::before { content: "Cena:"; }

  .packaging-suggestions-table td:nth-child(1)::before { content: "Zaznacz:"; }
  .packaging-suggestions-table td:nth-child(2)::before { content: "Opakowanie:"; }
  .packaging-suggestions-table td:nth-child(3)::before { content: "Sugerowana ilość:"; }
  .packaging-suggestions-table td:nth-child(4)::before { content: "Cena/szt:"; }
  .packaging-suggestions-table td:nth-child(5)::before { content: "Suma:"; }

  .voice-commands-table td:nth-child(1)::before { content: "Kategoria:"; }
  .voice-commands-table td:nth-child(2)::before { content: "Komendy:"; }
  .voice-commands-table td:nth-child(3)::before { content: "Opis:"; }

  /* Forms & Filters wrapping */
  div[style*="flexWrap: wrap"],
  div[style*="flex-wrap: wrap"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  div[style*="flexWrap: wrap"] > div,
  div[style*="flex-wrap: wrap"] > div {
    width: 100% !important;
  }

  div[style*="flexWrap: wrap"] select,
  div[style*="flexWrap: wrap"] input,
  div[style*="flexWrap: wrap"] button,
  div[style*="flex-wrap: wrap"] select,
  div[style*="flex-wrap: wrap"] input,
  div[style*="flex-wrap: wrap"] button {
    width: 100% !important;
  }

  /* Stack all button rows and make buttons full-width */
  .card div[style*="display: flex"],
  .card div[style*="display:flex"],
  .page-header div[style*="display: flex"],
  .page-header div[style*="display:flex"],
  .page-header > div:last-child {
    flex-wrap: wrap !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .card .btn,
  .page-header .btn,
  .btn {
    width: 100% !important;
    justify-content: center !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Adjust metric card value sizes for small screens */
  .calc-metric-value {
    font-size: 1.25rem !important;
  }

  .calc-metric-card {
    padding: 12px !important;
  }

  /* PZ Form Grid Layouts on Mobile */
  .pz-header-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .pz-product-row-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Document Items Added Table card styling */
  .document-items-table td:nth-child(1)::before { content: "Produkt:"; }
  .document-items-table td:nth-child(2)::before { content: "Ilość:"; }
  .document-items-table td:nth-child(3)::before { content: "Cena:"; }
  .document-items-table td:nth-child(4)::before { content: "Rabat (%):"; }
  .document-items-table td:nth-child(5)::before { content: "Wartość:"; }
  .document-items-table td:nth-child(6)::before { content: "Akcje:"; }
}

/* Sales Filters Grid */
.sales-filters-grid {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1.6fr 1.4fr 1.2fr 1.4fr 1.4fr auto;
  gap: 12px;
  align-items: end;
  width: 100%;
}

@media (max-width: 1350px) {
  .sales-filters-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 992px) {
  .sales-filters-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}
@media (max-width: 600px) {
  .sales-filters-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Table image hover zoom effect */
.table-image-container {
  position: relative;
  width: 36px;
  height: 36px;
  display: block;
}

.table-image-zoom {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
  cursor: pointer;
  display: block;
  transform-origin: center center;
}

.table-image-container:hover .table-image-zoom {
  transform: scale(4.5);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 999;
}

@media (max-width: 768px) {
  .komeracja-active .new-order-items-table td:nth-child(3)::before {
    content: "Cena:";
  }
}

/* Dashboard Responsive Grids */
.dashboard-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

.dashboard-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  width: 100%;
}

/* Dashboard Interactive Clickable Cards */
.card-clickable {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s, border-color 0.2s, background-color 0.2s;
  user-select: none;
}

.card-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(207, 168, 92, 0.12), 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: rgba(207, 168, 92, 0.4);
  background-color: rgba(255, 255, 255, 0.03);
}

.card-clickable:active {
  transform: translateY(-1px);
}

@media (max-width: 992px) {
  .dashboard-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .dashboard-grid-5 {
    grid-template-columns: 1fr;
  }
}

/* AI Chat & Drawer Animations */
.animate-slide-in {
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.chat-messages-container::-webkit-scrollbar {
  width: 6px;
}
.chat-messages-container::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.chat-messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Print Layout for Thermal Labels (Scoped so it does not affect general page printing) */
@media print {
  body:has(.print-label-container) * {
    visibility: hidden;
  }
  
  body:has(.print-label-container) .print-label-container,
  body:has(.print-label-container) .print-label-container * {
    visibility: visible;
  }
  
  /* Reset print body styles for thermal labels */
  html:has(.print-label-container),
  body:has(.print-label-container) {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  body:has(.print-label-container) .print-label-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }
  
  /* Hide any potential headers/footers browser inserts */
  @page {
    margin: 10mm;
  }
}