/* ============== CSS VARIABLES ============== */
:root {
  --primary: #1e3a5f;
  --primary-light: #2a4a73;
  --primary-dark: #152a45;
  --accent: #d4a853;
  --accent-light: #e0bb6e;
  --accent-dark: #b89240;
  
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============== RESET & BASE ============== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

/* ============== TYPOGRAPHY ============== */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

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

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

.btn-secondary:hover:not(:disabled) {
  background: var(--background);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--border-light);
}

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

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: 0.625rem 1rem;
}

.btn-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
}

.btn-row .btn {
  flex: 1;
}

/* ============== FORM ELEMENTS ============== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

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

/* ============== AUTH PAGES ============== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--background) 0%, #eef2f7 100%);
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--primary);
}

.logo-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.tagline {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
}

.headline {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-top: 0.5rem;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.auth-title {
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.auth-description {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.auth-form {
  margin-bottom: 1rem;
}

.auth-links {
  text-align: center;
  margin-bottom: 1rem;
}

.auth-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  position: relative;
  background: var(--surface);
  padding: 0 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.auth-switch {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.auth-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============== APP LAYOUT ============== */
.app-page {
  min-height: 100vh;
  padding-bottom: 80px;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 700;
  color: var(--primary);
}

.logo-small .logo-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.logo-small span {
  font-size: 1.125rem;
}

.bar-name,
.item-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.app-main {
  padding: 1.25rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

/* ============== BOTTOM NAV ============== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-item svg {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.25rem;
}

.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item:hover {
  color: var(--primary);
  text-decoration: none;
}

/* ============== SUMMARY CARDS ============== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border);
}

.summary-card.critical {
  border-color: var(--danger);
  background: var(--danger-light);
}

.summary-card.warning {
  border-color: var(--warning);
  background: var(--warning-light);
}

.summary-card.success {
  border-color: var(--success);
  background: var(--success-light);
}

.summary-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.summary-card.critical .summary-number {
  color: var(--danger);
}

.summary-card.warning .summary-number {
  color: var(--warning);
}

.summary-card.success .summary-number {
  color: var(--success);
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============== INVENTORY SECTIONS ============== */
.inventory-section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.critical-title {
  color: var(--danger);
}

.warning-title {
  color: var(--warning);
}

.success-title {
  color: var(--success);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.item-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.item-card.critical {
  border-left: 3px solid var(--danger);
}

.item-card.low {
  border-left: 3px solid var(--warning);
}

.item-card.good {
  border-left: 3px solid var(--success);
}

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

.item-name {
  font-weight: 600;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-details {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.item-stock {
  text-align: right;
}

.stock-level {
  font-size: 1.25rem;
  font-weight: 600;
}

.stock-level.critical {
  color: var(--danger);
}

.stock-level.low {
  color: var(--warning);
}

.stock-level.good {
  color: var(--success);
}

.stock-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============== ACTION BUTTONS ============== */
.action-buttons {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.action-buttons .btn {
  flex: 1;
}

/* ============== INVENTORY LIST ============== */
.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ============== EMPTY & LOADING STATES ============== */
.empty-state,
.loading-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-state svg,
.loading-state svg {
  width: 4rem;
  height: 4rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state .btn {
  margin-top: 1rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ============== MODAL ============== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ============== SCANNER MODAL ============== */
.scanner-modal .modal-content {
  max-height: 95vh;
}

.scanner-content {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.scanner-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  margin-bottom: 1rem;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-region {
  width: 80%;
  height: 60%;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-status {
  text-align: center;
  padding: 0.75rem;
  background: var(--background);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.detected-items {
  margin-bottom: 1rem;
}

.detected-items h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.detected-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
}

.detected-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--background);
  border-radius: var(--radius);
}

.detected-item input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary);
}

.detected-item-info {
  flex: 1;
}

.detected-item-name {
  font-weight: 500;
}

.detected-item-category {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.scanner-actions {
  padding-top: 0.5rem;
}

/* ============== SETTINGS ============== */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.settings-section .section-title {
  margin-bottom: 1rem;
  padding-left: 0;
  color: var(--text-primary);
  text-transform: none;
  font-size: 1rem;
}

.settings-form .btn {
  margin-top: 0.5rem;
}

.about-info p {
  margin-bottom: 0.5rem;
}

/* ============== ORDER PREVIEW ============== */
.order-preview {
  background: var(--background);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  max-height: 150px;
  overflow-y: auto;
}

.order-preview-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

/* ============== TOAST NOTIFICATIONS ============== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  z-index: 2000;
  animation: toastIn 0.3s ease;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-hide {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(1rem);
  }
}

/* ============== RESPONSIVE ============== */
@media (min-width: 640px) {
  .modal-content {
    border-radius: var(--radius-xl);
    margin: 2rem;
  }
  
  .modal {
    align-items: center;
  }
}

/* Inventory Card Styles */
.inventory-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: opacity 0.2s;
}

.inventory-card.item-inactive {
  opacity: 0.5;
  background: #f5f5f5;
}

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

.item-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.item-category {
  font-size: 0.8rem;
  color: #666;
  background: #e8e8e8;
  padding: 2px 8px;
  border-radius: 12px;
}

.card-body {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.stock-display, .par-display {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: #f0f0f0;
}

.stock-value, .par-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.stock-label, .par-label {
  font-size: 0.75rem;
  color: #666;
}

.stock-good .stock-value { color: #22c55e; }
.stock-medium .stock-value { color: #f59e0b; }
.stock-low .stock-value { color: #ef4444; }

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  flex: 1;
}

.btn-edit { background: #3b82f6; color: white; }
.btn-toggle { background: #22c55e; color: white; }
.btn-toggle.btn-inactive { background: #9ca3af; }
.btn-delete { background: #ef4444; color: white; }

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
}

/* Dashboard Styles */
.dashboard-main {
  padding-bottom: 100px;
}

.dashboard-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
  margin: 0 0 16px 0;
  font-size: 1.2rem;
  color: #1e3a5f;
}

.dashboard-section h3 {
  margin: 16px 0 12px 0;
  font-size: 1rem;
  color: #444;
}

.status-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.status-card {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
}

.status-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e3a5f;
}

.status-label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
}

.status-low .status-value { color: #ef4444; }
.status-medium .status-value { color: #f59e0b; }
.status-good .status-value { color: #22c55e; }

.low-stock-list {
  max-height: 200px;
  overflow-y: auto;
}

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fff5f5;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid #ef4444;
}

.low-stock-item .item-name {
  font-weight: 500;
}

.low-stock-item .item-stock {
  font-weight: 700;
  color: #ef4444;
}

/* Forecast Styles */
.slider-container {
  margin-bottom: 20px;
}

.slider-container label {
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.days-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  -webkit-appearance: none;
  background: #e0e0e0;
}

.days-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1e3a5f;
  cursor: pointer;
}

.days-value {
  font-weight: 700;
  color: #1e3a5f;
  min-width: 70px;
}

.slider-hint {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

.forecast-loading {
  text-align: center;
  padding: 40px;
}

.forecast-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #1e3a5f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.forecast-empty {
  text-align: center;
  padding: 40px 20px;
}

.forecast-empty p {
  margin-bottom: 16px;
  color: #666;
}

.forecast-summary {
  background: #f0f7ff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.forecast-summary p {
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.confidence {
  font-size: 0.8rem;
  color: #666;
}

.forecast-alerts {
  margin-bottom: 20px;
}

.alert {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.alert-warning {
  background: #fff3cd;
  border-left: 4px solid #f59e0b;
  color: #856404;
}

.forecast-section h3 {
  margin: 20px 0 12px;
}

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

.projection-item {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid #22c55e;
}

.projection-item.urgency-critical { border-left-color: #ef4444; background: #fef2f2; }
.projection-item.urgency-high { border-left-color: #f59e0b; background: #fffbeb; }
.projection-item.urgency-medium { border-left-color: #3b82f6; background: #eff6ff; }
.projection-item.urgency-low { border-left-color: #22c55e; background: #f0fdf4; }

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

.projection-name {
  font-weight: 600;
}

.projection-urgency {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.1);
}

.projection-details {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.projection-stat {
  text-align: center;
}

.projection-stat .stat-value {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
}

.projection-stat .stat-label {
  font-size: 0.7rem;
  color: #666;
}

.projection-arrow {
  color: #999;
  font-size: 1.2rem;
}

.projection-rec {
  font-size: 0.85rem;
  color: #555;
  margin: 0;
  font-style: italic;
}

.daily-forecasts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.daily-forecast {
  flex: 0 0 auto;
  width: 60px;
  padding: 12px 8px;
  text-align: center;
  border-radius: 8px;
  background: #f5f5f5;
}

.daily-forecast .day-name {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
}

.daily-forecast .day-traffic {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-top: 4px;
}

.traffic-high { background: #fee2e2; }
.traffic-high .day-traffic { color: #dc2626; }
.traffic-medium { background: #fef3c7; }
.traffic-medium .day-traffic { color: #d97706; }
.traffic-low { background: #dcfce7; }
.traffic-low .day-traffic { color: #16a34a; }

.text-success { color: #22c55e; }
.text-error { color: #ef4444; }
.text-secondary { color: #888; }

/* Filter Buttons */
.filter-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.filter-btn {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-btn.active {
  background: #1e3a5f;
  color: white;
  border-color: #1e3a5f;
}

.filter-btn:hover:not(.active) {
  background: #f0f0f0;
}

/* Mobile / PWA Optimizations */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body.app-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.app-container {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-main {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #888;
  font-size: 0.7rem;
  padding: 4px 12px;
  transition: color 0.2s;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

.nav-item.active {
  color: #1e3a5f;
}

.nav-item:hover {
  color: #1e3a5f;
}

/* Responsive Grid */
.inventory-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 400px) {
  .inventory-list {
    grid-template-columns: 1fr;
  }
}

/* Button Improvements */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-appearance: none;
}

.btn-primary {
  background: #1e3a5f;
  color: white;
}

.btn-primary:hover, .btn-primary:active {
  background: #2d4a6f;
}

.btn-secondary {
  background: #e5e5e5;
  color: #333;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  gap: 8px;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

/* Logo */
.logo-small {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #1e3a5f;
}

.logo-icon {
  width: 24px;
  height: 24px;
}

/* Page Header */
.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 4px 0;
  font-size: 1.5rem;
  color: #1e3a5f;
}

.page-subtitle {
  margin: 0;
  color: #888;
  font-size: 0.9rem;
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  
  .bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Prevent zoom on input focus (iOS) */
input, select, textarea {
  font-size: 16px !important;
}

/* Modal mobile fixes */
.modal {
  padding: 16px;
}

.modal-content {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

/* Refresh Forecast Button */
.refresh-forecast-btn {
  margin-top: 16px;
}
