* {
  -webkit-tap-highlight-color: transparent;
}

/* Shared state indicator. No quantity thresholds belong in the UI. */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--status-dot-color);
  box-shadow: none;
}
.status-dot.status-green { --status-dot-color: #15956d; }
.status-dot.status-yellow { --status-dot-color: #c77813; }
.status-dot.status-red { --status-dot-color: #d8455f; }
@media (prefers-color-scheme: dark) {
  .status-dot.status-green { --status-dot-color: #3bd4a0; }
  .status-dot.status-yellow { --status-dot-color: #f3ad42; }
  .status-dot.status-red { --status-dot-color: #ff7186; }
}

.coffeeza-app .hidden {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg-primary);
}

body.coffeeza-app {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 16% -8%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 36%),
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--accent-strong) 17%, transparent), transparent 30%),
    linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  transition: background-color 180ms ease, color 180ms ease;
}

.coffeeza-app main {
  width: min(100%, var(--content-width));
  max-width: var(--content-width);
  padding: max(16px, env(safe-area-inset-top)) clamp(14px, 3vw, 28px)
    calc(var(--bottom-nav-height) + max(24px, env(safe-area-inset-bottom)));
}

.glass-card,
.glass-panel,
.coffeeza-app .hero,
.coffeeza-app .card {
  position: relative;
  background: linear-gradient(145deg, var(--glass-highlight), transparent 42%), var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow-glass);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(130%);
  backdrop-filter: blur(var(--blur-md)) saturate(130%);
}

.glass-elevated,
.bottom-sheet,
.modal-panel {
  background: var(--glass-bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow-elevated);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(140%);
  backdrop-filter: blur(var(--blur-md)) saturate(140%);
}

.glass-active {
  background: var(--glass-bg-active);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--glass-border));
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card,
  .glass-panel,
  .coffeeza-app .hero,
  .coffeeza-app .card,
  .glass-elevated,
  .bottom-sheet,
  .modal-panel,
  .bottom-navigation {
    background: var(--glass-bg-fallback);
  }
}

.coffeeza-app h1 {
  color: var(--text-primary);
  font-size: clamp(30px, 7vw, 46px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.coffeeza-app h2 {
  color: var(--text-primary);
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 760;
  letter-spacing: -0.025em;
}

.coffeeza-app h3 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 720;
}

.coffeeza-app p,
.coffeeza-app .muted,
.coffeeza-app .small {
  color: var(--text-secondary);
}

.glass-button,
.primary-button,
.secondary-button,
.icon-button,
.coffeeza-app button,
.coffeeza-app .ghost-button,
.coffeeza-app .browser-cabinet-link {
  min-height: var(--touch-target);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  font: inherit;
  font-weight: 720;
  cursor: pointer;
  transition: transform 120ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button,
.coffeeza-app button:not(.secondary-button):not(.icon-button):not(.bottom-navigation__item):not(.swipe-tab):not(.location-stock-filter):not(.inbound-delivery-card):not(.inbound-metric):not(.finance-view-nav button):not(.sales-dynamics-nav button) {
  color: var(--text-on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
}

.secondary-button,
.coffeeza-app .ghost-button,
.coffeeza-app .browser-cabinet-link,
.icon-button {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--glass-bg-elevated) 82%, transparent);
}

.coffeeza-app button:active,
.coffeeza-app a:active {
  transform: scale(0.985);
}

.coffeeza-app :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 48%, transparent);
  outline-offset: 2px;
}

.coffeeza-app input,
.coffeeza-app select,
.coffeeza-app textarea {
  min-height: var(--touch-target);
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.metric-card,
.coffeeza-app .metric {
  min-width: 0;
  padding: 14px;
  background: color-mix(in srgb, var(--glass-bg-elevated) 72%, transparent);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.coffeeza-app .metric span {
  color: var(--text-secondary);
  line-height: 1.25;
}

.coffeeza-app .metric strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 760;
}

.status-badge--success { background: var(--success-soft); color: var(--success); }
.status-badge--warning { background: var(--warning-soft); color: var(--warning); }
.status-badge--danger { background: var(--danger-soft); color: var(--danger); }

.segmented-control,
.swipe-tabs {
  display: grid;
  gap: 4px;
  padding: 4px;
  background: color-mix(in srgb, var(--bg-elevated) 58%, transparent);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.swipe-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.swipe-tab {
  min-height: var(--touch-target);
  padding: 8px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 13px;
}

.swipe-tab.active {
  color: var(--text-primary);
  background: var(--glass-bg-active);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--glass-border));
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.swipe-indicators {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.swipe-indicator {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: var(--text-muted);
  opacity: 0.38;
  transition: width 160ms ease, opacity 160ms ease, background-color 160ms ease;
}

.swipe-indicator.active {
  width: 20px;
  background: var(--accent);
  opacity: 1;
}

.list-row,
.coffeeza-app .stock-row,
.coffeeza-app .warehouse-item,
.coffeeza-app .location-stock-card {
  background: color-mix(in srgb, var(--bg-elevated) 66%, transparent);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glass-highlight) 72%, transparent);
}

.bottom-navigation {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(calc(100% - 20px), 640px);
  min-height: var(--bottom-nav-height);
  padding: 7px;
  transform: translateX(-50%);
  border: 1px solid var(--glass-border);
  border-radius: 25px;
  background: var(--glass-bg-elevated);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow-elevated);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(145%);
  backdrop-filter: blur(var(--blur-md)) saturate(145%);
}

.bottom-navigation__item {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 56px;
  padding: 5px 2px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 18px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 650;
}

.bottom-navigation__item svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-navigation__item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 14%, transparent);
}

@media (max-width: 430px) {
  .bottom-navigation {
    width: min(calc(100% - 16px), 430px);
    min-height: 64px;
    padding: 6px;
  }

  .bottom-navigation__item {
    min-height: 50px;
    padding: 5px;
  }

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

  .bottom-navigation__item svg {
    width: 24px;
    height: 24px;
  }
}

@media (pointer: coarse) {
  .glass-card,
  .glass-panel,
  .coffeeza-app .hero,
  .coffeeza-app .card,
  .glass-elevated,
  .bottom-sheet,
  .modal-panel,
  .bottom-navigation {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: var(--glass-bg-fallback);
  }
}

.empty-state,
.error-state,
.skeleton {
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--bg-elevated) 62%, transparent);
  border: 1px solid var(--glass-border);
}

.skeleton {
  min-height: 72px;
  background: linear-gradient(100deg, transparent 20%, var(--glass-highlight) 42%, transparent 64%), var(--glass-bg);
  background-size: 220% 100%;
  animation: coffeeza-shimmer 1.25s ease-in-out infinite;
}

@keyframes coffeeza-shimmer {
  to { background-position-x: -220%; }
}

@media (min-width: 860px) {
  .bottom-navigation {
    bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
