/* Modern Clean Light Mode CSS */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #059669;
  --accent-hover: #047857;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --freshness-ok: #16a34a;
  --freshness-warn: #f59e0b;
  --freshness-stale: #ef4444;
  --freshness-muted: #9ca3af;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
  --border-radius-lg: 12px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 80px);
}

/* Navigation */
.navbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 24px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 18px;
  padding: 16px 20px 16px 0;
  color: white;
  text-decoration: none;
  margin-right: 20px;
}

.navbar a:not(.navbar-brand),
.dropbtn {
  color: white;
  text-decoration: none;
  padding: 20px 16px;
  border-radius: 0;
  transition: all 0.2s ease;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.navbar a:hover,
.dropbtn:hover {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white !important;
  min-width: 240px;
  z-index: 1000;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  top: 100%;
  left: 0;
  border: 1px solid var(--gray-200);
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  color: var(--gray-700) !important;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 2px 0;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.dropdown-content a:hover {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}

.dropdown-content a.external-link {
  background: #8B0000 !important;
  color: white !important;
  border-radius: 8px !important;
}

.dropdown-content a.external-link:hover {
  background: #A00000 !important;
  color: white !important;
}

.navbar-info {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  padding: 16px 0;
}

/* Typography */
h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 24px 0;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 16px 0;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 12px 0;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--gray-300);
  transform: translateY(-2px);
}

.card-header {
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.card-subtitle {
  color: var(--gray-600);
  font-size: 14px;
  margin-top: 4px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th {
  background: var(--gray-50);
  padding: 16px 20px;
  text-align: center;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-200);
}

.table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
}

/* Compact table variant */
.table.table-compact th,
.table.table-compact td {
  padding: 10px 14px;
  font-size: 13px;
}

/* Inventory analysis layout tweaks */
.inventory-analysis-table th {
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  vertical-align: top;
  font-size: 13px;
}

.inventory-analysis-table td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
  font-size: 13px;
  text-align: center;
}

.inventory-analysis-table td.count-cell {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  text-align: center;
}

/* Freshness dashboard */
.freshness-wrapper {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.freshness-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.freshness-section-title {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 14px;
  margin-bottom: 12px;
}

.freshness-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .freshness-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .freshness-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.freshness-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

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

.freshness-meter-wrapper {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.freshness-meter {
  width: 56px;
  height: 56px;
}

.freshness-meter .meter-track {
  stroke: var(--gray-200);
  stroke-width: 8;
  fill: none;
}

.freshness-meter .meter-progress {
  stroke-width: 8;
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.3s ease;
}

.freshness-meter .meter-progress.meter-state-ok {
  stroke: var(--freshness-ok);
}

.freshness-meter .meter-progress.meter-state-warning {
  stroke: var(--freshness-warn);
}

.freshness-meter .meter-progress.meter-state-stale,
.freshness-meter .meter-progress.meter-state-error {
  stroke: var(--freshness-stale);
}

.freshness-meter .meter-progress.meter-state-syncing {
  stroke: var(--primary);
  animation: freshness-rotate 1.4s linear infinite;
}

@keyframes freshness-rotate {
  0% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(270deg);
  }
}

.freshness-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--freshness-stale);
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transform: translate(35%, -35%);
}

.freshness-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.freshness-title {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 14px;
}

.freshness-relative {
  font-size: 12px;
  font-weight: 600;
}

.freshness-relative.freshness-state-ok {
  color: var(--freshness-ok);
}

.freshness-relative.freshness-state-warning {
  color: var(--freshness-warn);
}

.freshness-relative.freshness-state-stale,
.freshness-relative.freshness-state-error {
  color: var(--freshness-stale);
}

.freshness-relative.freshness-state-syncing {
  color: var(--primary);
}

.freshness-absolute,
.freshness-cadence,
.freshness-description {
  font-size: 12px;
  color: var(--gray-600);
}

.freshness-empty {
  font-size: 13px;
  color: var(--gray-600);
  padding: 12px 0;
}
.table tbody tr:hover {
  background: var(--gray-50);
}

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

/* Status Pills */
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pill-active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.pill-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.pill-disabled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.pill-unknown {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

.pill-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Forms */
.form-row {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: white;
  color: var(--gray-900);
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: not-allowed;
}

input[type="file"] {
  padding: 8px 12px;
  border: 2px dashed var(--gray-300);
  background: var(--gray-50);
  border-radius: var(--border-radius);
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: var(--accent);
  color: var(--menu-font-color);
  border: 1px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-hover);
  color: var(--menu-font-color);
  border-color: var(--accent-hover);
}

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

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

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-error {
  background: var(--error);
  color: white;
}

.btn-disabled {
  background: var(--gray-400);
  color: var(--gray-600);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 24px;
  font-size: 16px;
}

/* Messages */
.message {
  padding: 16px 20px;
  margin: 16px 0;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary-hover);
  font-weight: 500;
}

.message-success {
  border-left-color: var(--success);
  background: #ecfdf5;
  color: #047857;
}

.message-warning {
  border-left-color: var(--warning);
  background: #fffbeb;
  color: #92400e;
}

.message-error {
  border-left-color: var(--error);
  background: #fef2f2;
  color: #dc2626;
}

/* Layout utilities */
.flex {
  display: flex;
  gap: 12px;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right {
  margin-left: auto;
}

.center {
  text-align: center;
}

.muted {
  color: var(--gray-500);
  font-size: 13px;
}

.text-sm {
  font-size: 13px;
}

.text-lg {
  font-size: 16px;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* Status indicators */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: #d1fae5;
  color: #047857;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-error {
  background: #fee2e2;
  color: #dc2626;
}


/* Quick action cards */
.quick-action-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Inventory item cards */
.inventory-item-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

/* Chart components for responsive bar charts */
.chart-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chart-value {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Mobile adjustments for charts */
@media (max-width: 767px) {
  .chart-label {
    font-size: 13px;
  }

  .chart-value {
    font-size: 12px;
  }
}

/* OHLQ download cards */
.ohlq-download-card {
  display: inline-block;
  margin-right: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  min-width: 200px;
}

/* Responsive adjustments for OHLQ cards */
@media (max-width: 480px) {
  .ohlq-download-card {
    display: block;
    width: 100%;
    min-width: unset;
    margin-right: 0;
  }
}

/* Mobile-responsive table forms */
.desktop-table-view {
  display: block;
}

.mobile-card-view {
  display: none;
}

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

.products-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Mobile product cards */
.product-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: white;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--gray-800);
}

.product-id {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 2px;
}

.product-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 12px;
}

.product-inventory {
  margin-bottom: 16px;
}

.product-inventory label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.product-quantity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-control label {
  font-weight: 600;
  margin: 0;
  font-size: 14px;
}

.quantity-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quantity-stepper .btn {
  min-width: 32px;
  padding: 6px 10px;
}

.quantity-stepper input {
  width: 72px;
  text-align: center;
}

.mobile-quantity-input {
  width: 80px;
  text-align: center;
}

.line-total-mobile {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.recommendation {
  color: var(--gray-600);
  font-style: italic;
}

/* Wholesale-specific inventory display */
.inventory-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inventory-count {
  font-family: var(--font-mono, monospace);
}

/* Daily retail sales mobile improvements */
.date-nav-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.date-nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  width: 100%;
  max-width: 400px;
}

.date-nav-btn {
  padding: 8px 16px;
  white-space: nowrap;
}

.date-picker-input {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  min-width: 150px;
  text-align: center;
  flex: 1;
}

.ohlq-status-btn {
  padding: 8px 16px;
  font-size: 0.9em;
  text-decoration: none;
  white-space: nowrap;
}

.retail-stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.retail-stat-card {
  text-align: center;
  padding: 16px 12px;
}

.retail-stat-label {
  color: var(--gray-600);
  font-size: 0.8em;
  margin-bottom: 4px;
}

.retail-stat-value {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary);
}

/* Mobile adjustments for retail sales */
@media (max-width: 768px) {
  .date-nav-container {
    gap: 12px;
  }

  .date-nav-controls {
    gap: 8px;
    max-width: 100%;
  }

  .date-nav-btn {
    padding: 8px 12px;
    font-size: 14px;
    flex-shrink: 0;
  }

  .date-picker-input {
    min-width: 0;
    font-size: 16px; /* Prevent iOS zoom */
    flex: 1;
  }

  .ohlq-status-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .retail-stats-container {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .retail-stat-card {
    padding: 12px 8px;
  }

  .retail-stat-label {
    font-size: 0.7em;
  }

  .retail-stat-value {
    font-size: 1.2rem;
  }
}

.mobile-total {
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 16px;
  background: var(--primary-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.total-label {
  font-weight: 600;
  font-size: 16px;
}

.total-amount {
  font-weight: 700;
  font-size: 20px;
  color: var(--primary);
}

/* Responsive behavior */
@media (max-width: 768px) {
  .desktop-table-view {
    display: none;
  }

  .mobile-card-view {
    display: block;
  }

  .products-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .products-actions {
    width: 100%;
    justify-content: center;
  }

  .products-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 8px 4px;
  }
}

/* Status pills - same styling as pill-btn for consistency */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  text-decoration: none;
  cursor: default;
}

/* Interactive status pills (buttons) have hover effects */
button.status-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

button.status-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button.status-pill:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.status-pill-success {
  background: var(--success);
  color: white;
}

.status-pill-warning {
  background: var(--warning);
  color: white;
}

.status-pill-info {
  background: var(--primary);
  color: white;
}

.status-pill-muted {
  background: var(--gray-400);
  color: var(--gray-600);
  cursor: not-allowed;
}

/* Clickable statistics cards - uses main .card:hover rule above */

a .card {
  transition: all 0.2s ease;
}

/* Home page status cards */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

/* Statistics cards - narrower for 5-card layout */
.status-grid.stats-desktop {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.status-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.status-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.status-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.status-card-empty {
  color: var(--gray-400);
  font-style: italic;
}

/* Mobile Navigation */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 16px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

/* Improved touch targets */
.btn {
  min-height: 44px;
  min-width: 44px;
}

.navbar a:not(.navbar-brand),
.dropbtn {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Better table responsiveness */
.table-container {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Remove fade gradient across entire application */
.table-container::after {
  display: none;
}

/* Responsive table - mobile column control */
@media (max-width: 768px) {
  .table {
    width: 100%;
    font-size: 12px;
  }
  
  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  .table th {
    position: sticky;
    top: 0;
    background: var(--gray-50);
    text-align: center;
    white-space: nowrap;
    z-index: 2;
  }
  
  /* Mobile table header buttons */
  .table th .btn {
    font-size: 10px !important;
    padding: 2px 6px !important;
    margin: 0 !important;
  }
  
  .table th div {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  
  /* Fix grid overlaps on mobile */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  /* Statistics cards mobile layout - 3 cards per row */
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
  }
  
  .stats-grid .card {
    padding: 12px 8px !important;
    text-align: center !important;
  }
  
  .stats-grid .card .stat-value {
    font-size: 18px !important;
    line-height: 1.2 !important;
  }
  
  .stats-grid .card .stat-label {
    font-size: 11px !important;
    margin-top: 2px !important;
  }
  
  /* Show mobile stats layout, hide desktop */
  .stats-desktop {
    display: none !important;
  }
  
  .stats-mobile {
    display: block !important;
  }
  
  /* Hide columns marked as mobile-hidden */
  .table:not(.mobile-optimized):not(.square-table) th:nth-child(n+5),
  .table:not(.mobile-optimized):not(.square-table) td:nth-child(n+5) {
    display: none;
  }

  /* Mobile grid layouts */
  .quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }

  .inventory-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Touch-friendly minimum sizes for mobile */
  .btn {
    min-height: 44px;
    padding: 8px 16px;
  }

  .form-control {
    min-height: 44px;
  }
  
  
}

/* Desktop statistics layout */
@media (min-width: 768px) {
  .stats-desktop {
    display: grid !important;
  }

  .stats-mobile {
    display: none !important;
  }

  /* Ensure desktop dropdown text is visible */
  .navbar-nav .dropdown-content a {
    color: var(--gray-700) !important;
    background: transparent !important;
  }

  .navbar-nav .dropdown-content a:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
  }

  /* Desktop grid layouts */
  .quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* Date navigation responsive */
.date-nav-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}

.date-nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ohlq-submission {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Statistics cards responsive */
.stats-container {
  display: flex;
  gap: 16px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.stats-container .card {
  flex: 1;
  min-width: 200px;
  text-align: center;
  padding: 12px 16px;
}

/* Responsive design */
@media (max-width: 768px) {
  /* Mobile navigation */
  .mobile-nav-toggle {
    display: block;
  }
  
  .navbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    flex-direction: column;
    padding: 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
  }
  
  .navbar-nav.active {
    display: flex;
  }
  
  .navbar .dropdown {
    width: 100%;
  }
  
  .navbar a:not(.navbar-brand),
  .dropbtn {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
  }
  
  .dropdown-content {
    position: static;
    display: none;
    background: rgba(0, 0, 0, 0.2) !important;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }
  
  .dropdown.active .dropdown-content {
    display: block;
  }
  
  .navbar-nav .dropdown-content a {
    color: white !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 32px !important;
    font-weight: 500 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background: transparent !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  
  .navbar-nav .dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
  }
  
  .navbar-nav .dropdown-content a.external-link {
    background: rgba(139, 0, 0, 0.9) !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  }
  
  .navbar-nav .dropdown-content a.external-link:hover {
    background: rgba(160, 0, 0, 0.9) !important;
    color: white !important;
  }
  
  .navbar-info {
    width: 100%;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Layout adjustments */
  .wrap {
    padding: 16px;
  }
  
  .navbar-content {
    padding: 0 16px;
    flex-wrap: nowrap;
    position: relative;
  }
  
  .navbar-brand {
    margin-right: auto;
  }
  
  /* Date navigation mobile - keep horizontal */
  .ohlq-submission {
    position: static;
    transform: none;
    margin-top: 12px;
    width: 100%;
    text-align: center;
  }
  
  .date-nav-container {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  
  .date-nav-controls {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  
  .date-nav-controls .btn {
    padding: 8px !important;
    font-size: 11px !important;
    flex-shrink: 0;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 32px !important;
    box-sizing: border-box !important;
  }
  
  .date-nav-controls input[type="date"] {
    min-width: 100px;
    font-size: 12px;
    padding: 6px 8px;
    flex-shrink: 0;
  }
  
  /* Force date controls to stay horizontal at all mobile sizes */
  .date-nav-controls > * {
    flex-shrink: 0 !important;
  }
  
  .date-nav-controls a.btn {
    display: inline-block !important;
    white-space: nowrap !important;
  }
  
  /* Statistics cards mobile - keep horizontal */
  .stats-container {
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .stats-container .card {
    flex: 1;
    min-width: 120px;
    font-size: 11px;
  }
  
  .stats-container .card > div:first-child {
    font-size: 10px;
  }
  
  .stats-container .card > div:last-child {
    font-size: 16px;
  }
  
  /* Typography */
  h1 {
    font-size: 22px;
    margin-bottom: 16px;
  }
  
  h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  .card {
    padding: 12px !important;
    margin: 12px 0 !important;
  }
  
  .status-grid:not(.stats-desktop) {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  /* Form improvements */
  .form-row {
    margin-bottom: 16px;
  }

  .form-row label {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
  }

  .form-control, .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    padding: 12px 16px;
  }

  .form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 10px 12px;
  }
  
  /* Button improvements */
  .btn {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
  
  .btn-sm {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  
  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  /* Stack flex items on very small screens */
  .flex:not(.stats-container):not(.date-nav-controls) {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .btn {
    justify-content: center;
    width: 100%;
  }
  
  .flex .btn,
  .date-nav-controls .btn {
    width: auto !important;
  }
  
  /* Smaller cards */
  .card {
    padding: 10px !important;
    margin: 8px 0 !important;
  }
  
  /* Smaller typography */
  h1 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  h2 {
    font-size: 16px;
    margin-bottom: 4px;
  }
  
  /* Even smaller buttons */
  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  /* Keep date navigation horizontal even on smallest screens */
  .date-nav-controls {
    display: flex !important;
    flex-direction: row !important;
  }
  
  .date-nav-controls .btn {
    flex-shrink: 0 !important;
  }
  
  /* Date picker improvements */
  input[type="date"] {
    min-width: 140px;
    font-size: 14px;
  }
  
  /* Table further optimizations */
  .table {
    min-width: 100%;
  }
  
  .table th,
  .table td {
    padding: 4px 6px;
    font-size: 10px;
    max-width: 100px;
  }
  
  .table th:first-child,
  .table td:first-child {
    max-width: 60px;
  }
}

/* ---- Extracted from components.html ---- */
.filter-bar {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.filter-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}
.filter-btn { padding: 6px 12px; }

.status-alert-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--error);
  color: white;
  font-size: 10px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
