:root {
  --bg-main: #090d14;
  --bg-sidebar: #0d121c;
  --bg-card: #111723;
  --bg-elevated: #161e2e;
  --border-subtle: rgba(148, 163, 184, 0.14);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --amber: #f59e0b;
}

html.theme-light {
  --bg-main: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f8fafc;
  --border-subtle: rgba(15, 23, 42, 0.12);
  --text-main: #0f172a;
  --text-muted: #475569;
}

body {
  font-family: "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Engineering Blueprint Grid */
.blueprint-grid {
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

html.theme-light .blueprint-grid {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

.eng-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s ease, box-shadow 0.22s ease;
}

.eng-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.55);
}

/* Hazard stripe accent from reference */
.hazard-stripe {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    #f59e0b,
    #f59e0b 6px,
    #1e293b 6px,
    #1e293b 12px
  );
}

.safe-pb {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

/* Animations */
@keyframes viewSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-enter {
  animation: viewSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.modal-pop {
  animation: modalSpring 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.stagger-item {
  animation: cardCascade 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Animated To-Do Checkmark & Confetti */
.todo-check-svg path {
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: stroke-dashoffset 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.todo-done .todo-check-svg path { stroke-dashoffset: 0; }
.todo-done .todo-title { color: #64748b; text-decoration: line-through; }

@keyframes taskPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.2); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.todo-just-completed {
  animation: taskPop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes confettiFall {
  0%   { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate3d(var(--tx), var(--ty), 0) rotate(var(--rot)) scale(0.4); }
}

button:active:not(:disabled) { transform: scale(0.97); }

.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #334155; border-radius: 9999px; }

/* WCAG 2.2 AA Keyboard Focus & Reduced Motion */
:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.font-mono, code, pre {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.skeleton-line {
  background: rgba(148, 163, 184, 0.16);
  border-radius: 0.5rem;
  animation: skeletonPulse 1.4s ease-in-out infinite;
}

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

/* Light theme readability overrides */
html.theme-light body { background-color: #f1f5f9 !important; color: #0f172a !important; }
html.theme-light aside { background-color: #ffffff !important; border-color: rgba(15,23,42,0.12) !important; }
html.theme-light header { background-color: rgba(255,255,255,0.92) !important; border-color: rgba(15,23,42,0.12) !important; }
html.theme-light .bg-\[\#111723\],
html.theme-light .bg-\[\#0d121c\],
html.theme-light .bg-\[\#090d14\],
html.theme-light .bg-slate-900,
html.theme-light .bg-slate-950,
html.theme-light .bg-slate-950\/70,
html.theme-light .bg-slate-950\/80 {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}
html.theme-light .bg-slate-800 { background-color: #e2e8f0 !important; color: #0f172a !important; }
html.theme-light .text-white,
html.theme-light .text-slate-100,
html.theme-light .text-slate-200,
html.theme-light .text-slate-300 { color: #0f172a !important; }
html.theme-light .text-slate-400,
html.theme-light .text-slate-500 { color: #475569 !important; }
html.theme-light .border-slate-800,
html.theme-light .border-slate-800\/80,
html.theme-light .border-slate-800\/90 { border-color: rgba(15,23,42,0.12) !important; }
html.theme-light .bg-amber-500.text-slate-950 { color: #0f172a !important; }
html.theme-light .text-amber-300 { color: #b45309 !important; }
html.theme-light .text-cyan-300 { color: #0e7490 !important; }
html.theme-light .text-emerald-300 { color: #047857 !important; }
html.theme-light #mobile-nav { background-color: rgba(255,255,255,0.96) !important; border-color: rgba(15,23,42,0.12) !important; }
html.theme-light #toast-container .bg-slate-800 { background-color: #0f172a !important; color: #f8fafc !important; }

/* Industry Label Print Presets (All Sizes including Micro IC/SMD) */
.label-card-thermal62 { width: 234px; min-height: 112px; }
.label-card-thermal50 { width: 189px; min-height: 96px; }
.label-card-small25   { width: 118px; min-height: 56px; padding: 4px !important; }
.label-card-micro15   { width: 72px; height: 72px; padding: 3px !important; }

@media print {
  @page { margin: 6mm; }
  body * { visibility: hidden !important; }
  #print-labels-area, #print-labels-area * { visibility: visible !important; }
  #print-labels-area {
    position: absolute; left: 0; top: 0; width: 100%;
    background: #ffffff !important; color: #000000 !important; padding: 0;
  }
}
