@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  --bg: #1a140d;
  --fg: #efe6d4;
  --card-bg: rgba(36, 28, 18, 0.65);
  --accent: #c6552e;
  --accent-rgb: 198, 85, 46;
  --accent-hover: #d9673a;
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(255, 255, 255, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --muted: #b6a988;
  
  --font-sans: 'Libre Franklin', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(198, 85, 46, 0.25);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 70px;
}

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

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(198, 85, 46, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.005) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.005) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  color: var(--fg);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Glassmorphic Navigation */
header {
  height: var(--header-height);
  background-color: rgba(13, 17, 23, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 0%, #b6a988 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .logo-tag {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #000;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(198, 85, 46, 0.3);
}

nav {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--fg);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  color: #000;
  background-color: var(--fg);
  box-shadow: var(--shadow-sm);
}

/* App Main Container */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px;
}

.view-section {
  display: none;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Glass Cards */
.card {
  background-color: var(--card-bg);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.09);
}

.split-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 25px;
}

@media (max-width: 950px) {
  .split-layout {
    grid-template-columns: 1fr;
  }
}

/* 3D PERSPECTIVE ELEVATION GRID */
.grid-container {
  overflow-x: auto;
  padding: 20px 10px;
  perspective: 1000px; /* Activates 3D space */
}

.elevation-grid {
  display: grid;
  gap: 6px;
  background-color: rgba(13, 17, 23, 0.8);
  padding: 15px;
  border-radius: var(--radius-lg);
  min-width: 700px;
  border: 1px solid var(--border);
  transform: rotateX(12deg) rotateY(-8deg); /* Isometric perspective tilt */
  transform-style: preserve-3d;
  box-shadow: 
    -10px 15px 35px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
  transition: var(--transition);
}

.elevation-grid:hover {
  transform: rotateX(8deg) rotateY(-5deg); /* Subtle tilt on mouse interaction */
}

/* Custom Timber-Log shape */
.grid-cell {
  background: linear-gradient(180deg, #241c12 0%, #1a140d 100%);
  border: 1px solid rgba(255, 255, 255, 0.03);
  min-height: 48px;
  border-radius: 6px; /* stackable log corners */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 5px;
  position: relative;
  user-select: none;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.02), 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Stacked logs look: horizontal lines */
.grid-cell::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  top: 30%;
}

.grid-cell::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.2);
  bottom: 30%;
}

.grid-cell:hover {
  background: linear-gradient(180deg, #2e2417 0%, #201810 100%);
  border-color: rgba(198, 85, 46, 0.4);
  transform: translateZ(5px); /* Pops cell up in 3D space */
}

.grid-cell.selected {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.22) 0%, rgba(var(--accent-rgb), 0.08) 100%);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(198, 85, 46, 0.2), inset 0 0 10px rgba(198, 85, 46, 0.1);
  transform: translateZ(12px);
}

/* Placed / Occupied Log Style: Wooden Terracotta finish */
.grid-cell.occupied {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent-hover);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

.grid-cell.occupied:hover {
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
  transform: translateZ(10px);
}

.grid-cell.occupied.selected {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(198, 85, 46, 0.4);
}

/* 2D Grid Wall Color Overrides */
.elevation-grid.wall-north {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: -10px 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.12), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.elevation-grid.wall-north .grid-cell.occupied {
  background: linear-gradient(180deg, #2563eb 0%, #1e3a8a 100%);
  border-color: #3b82f6;
}
.elevation-grid.wall-north .grid-cell.occupied:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.elevation-grid.wall-east {
  border-color: rgba(230, 126, 34, 0.3);
  box-shadow: -10px 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(230, 126, 34, 0.12), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.elevation-grid.wall-east .grid-cell.occupied {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent-hover);
}
.elevation-grid.wall-east .grid-cell.occupied:hover {
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
}

.elevation-grid.wall-south {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: -10px 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.12), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.elevation-grid.wall-south .grid-cell.occupied {
  background: linear-gradient(180deg, #7c3aed 0%, #4c1d95 100%);
  border-color: #8b5cf6;
}
.elevation-grid.wall-south .grid-cell.occupied:hover {
  background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
}

.elevation-grid.wall-west {
  border-color: rgba(20, 184, 166, 0.3);
  box-shadow: -10px 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(20, 184, 166, 0.12), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.elevation-grid.wall-west .grid-cell.occupied {
  background: linear-gradient(180deg, #0d9488 0%, #115e59 100%);
  border-color: #14b8a6;
}
.elevation-grid.wall-west .grid-cell.occupied:hover {
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
}


/* Damaged Logs: Red warning stripes */
.grid-cell.damaged {
  border-color: var(--warning);
}

.grid-cell.damaged::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(245, 158, 11, 0.15) 10px, rgba(245, 158, 11, 0.15) 20px);
  pointer-events: none;
  border-radius: 6px;
}

.grid-cell.damaged.occupied {
  background: linear-gradient(180deg, #c0392b 0%, #78281f 100%);
  border-color: var(--danger);
}

.grid-cell.damaged.occupied::after {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(239, 68, 68, 0.25) 10px, rgba(239, 68, 68, 0.25) 20px);
}

.grid-cell .cell-coords {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.6;
}

.grid-cell .cell-tag {
  font-size: 0.85rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

/* Buttons & Inputs styling */
.btn {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: var(--accent);
  color: #000;
  box-shadow: 0 4px 15px rgba(198, 85, 46, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #c6552e 100%);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(198, 85, 46, 0.35);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  width: 100%;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(198, 85, 46, 0.1);
  background-color: rgba(0, 0, 0, 0.5);
}

/* List group styling */
.list-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Custom Scrollbar for premium feel */
.list-group::-webkit-scrollbar {
  width: 6px;
}
.list-group::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
.list-group::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.list-item {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--border-focus);
  transform: translateX(2px);
}

.list-item.selected {
  background-color: rgba(198, 85, 46, 0.03);
  border-color: var(--accent);
}

/* Kanban Board Column layout */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
}

.kanban-col {
  background-color: rgba(255, 255, 255, 0.005);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.kanban-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 250px;
}

.kanban-card {
  background-color: rgba(36, 28, 18, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Status Badges */
.status-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.status-badge.pending { background-color: rgba(245, 158, 11, 0.08); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-badge.active { background-color: rgba(16, 185, 129, 0.08); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.error { background-color: rgba(239, 68, 68, 0.08); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* QR Scanner Mock overlay */
.scanner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #05070a;
  border-radius: var(--radius-lg);
  aspect-ratio: 4/3;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 30px #000;
}

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

.scanner-laser {
  position: absolute;
  top: 50%;
  left: 8%;
  right: 8%;
  height: 3px;
  background-color: var(--accent);
  box-shadow: 0 0 15px var(--accent);
  animation: scan 2.5s infinite ease-in-out;
  z-index: 2;
}

@keyframes scan {
  0% { top: 12%; }
  50% { top: 88%; }
  100% { top: 12%; }
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(3, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  border-color: rgba(255,255,255,0.08);
}

/* QR Tags Layout */
.qr-tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.qr-tag-card {
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-md);
  padding: 15px;
  border: 2px solid #000000;
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  page-break-inside: avoid;
}

.qr-tag-graphics {
  width: 70px;
  height: 70px;
  border: 1px solid #000;
  padding: 4px;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-tag-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.qr-tag-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.2px;
}

.qr-tag-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #333333;
}

.qr-tag-type {
  font-size: 0.7rem;
  background: #efe6d4;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  font-weight: 600;
  margin-top: 2px;
}

.qr-tag-defect-stamp {
  position: absolute;
  top: -5px;
  right: -25px;
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 25px 3px;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Paintbrush active highlights */
.btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #000;
  box-shadow: 0 0 10px rgba(198, 85, 46, 0.4);
}

/* Heatmap Overlays */
.grid-cell.heatmap-mode {
  background: rgba(13, 17, 23, 0.9) !important;
  opacity: 0.35;
  border-color: rgba(255,255,255,0.01) !important;
  box-shadow: none !important;
}

.grid-cell.heatmap-mode.occupied {
  opacity: 0.6;
  background: #241c12 !important;
}

.grid-cell.heatmap-mode.has-rot {
  opacity: 1 !important;
  border-color: var(--warning) !important;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.45) !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0.1) 100%) !important;
}

.grid-cell.heatmap-mode.has-rot-severe {
  opacity: 1 !important;
  border-color: var(--danger) !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.7), inset 0 0 10px rgba(239, 68, 68, 0.3) !important;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.45) 0%, rgba(239, 68, 68, 0.15) 100%) !important;
  animation: pulse-rot-heat 1.5s infinite alternate ease-in-out;
}

@keyframes pulse-rot-heat {
  from { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4), inset 0 0 5px rgba(239, 68, 68, 0.2); }
  to { box-shadow: 0 0 30px rgba(239, 68, 68, 0.85), inset 0 0 15px rgba(239, 68, 68, 0.4); }
}

/* Event audit logs */
.audit-log-item {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: var(--transition);
}
.audit-log-item:hover {
  background: rgba(255,255,255,0.01);
}
.audit-log-time {
  font-size: 0.65rem;
  color: var(--muted);
}
.audit-log-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
}

/* 3D Canvas Range Input Styling */
input[type="range"] {
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  outline: none;
  border: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(198, 85, 46, 0.5);
  transition: var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

/* PRINT STYLESHEET */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: sans-serif;
  }
  
  /* Hide all normal app structures */
  header, main, nav, .card, .split-layout, .view-section, footer {
    display: none !important;
  }
  
  /* Reset modal overlay for full page flow */
  .modal-overlay {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
  }
  
  .modal-card {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-height: none !important;
    max-width: none !important;
    overflow: visible !important;
    display: block !important;
  }
  
  .modal-card h3, 
  .modal-card p,
  .modal-card button {
    display: none !important; /* Hide controls inside print view */
  }
  
  .qr-tags-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px !important;
    margin: 0 !important;
    width: 100% !important;
  }
  
  .qr-tag-card {
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid !important;
    box-shadow: none !important;
  }
}

/* AR View Mode Scanline Overlay Animation */
@keyframes arScan {
  0% { transform: translateY(0); }
  50% { transform: translateY(478px); }
  100% { transform: translateY(0); }
}

#ar-mock-bg::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  top: 0;
  animation: arScan 5s linear infinite;
  pointer-events: none;
}

/* FEA Structural Stress Heatmap Grid Colors */
.grid-cell.occupied.stress-low {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important;
  border-color: #34d399 !important;
}
.grid-cell.occupied.stress-mod {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%) !important;
  border-color: #fbbf24 !important;
}
.grid-cell.occupied.stress-sev {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%) !important;
  border-color: #f87171 !important;
}
@keyframes stressPulse {
  0% { box-shadow: 0 0 10px rgba(219, 39, 119, 0.4), inset 0 0 10px rgba(219, 39, 119, 0.2); border-color: #f472b6; }
  50% { box-shadow: 0 0 25px rgba(219, 39, 119, 0.95), inset 0 0 20px rgba(219, 39, 119, 0.5); border-color: #ffffff; }
  100% { box-shadow: 0 0 10px rgba(219, 39, 119, 0.4), inset 0 0 10px rgba(219, 39, 119, 0.2); border-color: #f472b6; }
}
.grid-cell.occupied.stress-ext {
  background: linear-gradient(180deg, #db2777 0%, #831843 100%) !important;
  border-color: #f472b6 !important;
  animation: stressPulse 1.2s ease-in-out infinite !important;
}

/* Laser Scan Deviation Tolerances Grid Styles */
.grid-cell.occupied.dev-pass {
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25) !important;
}
.grid-cell.occupied.dev-warn {
  border: 2px solid #f59e0b !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.25) !important;
}
.grid-cell.occupied.dev-fail {
  border: 2px dashed #ef4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35) !important;
}

/* RFID REAL-TIME PORTAL STYLES */
.rfid-terminal {
  font-family: var(--font-mono);
  height: 180px;
  overflow-y: auto;
  background: #020408;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #10b981;
  text-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
  box-shadow: inset 0 0 15px rgba(0,0,0,0.9), 0 4px 10px rgba(0,0,0,0.3);
}

.rfid-terminal::-webkit-scrollbar {
  width: 4px;
}
.rfid-terminal::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.25);
  border-radius: 2px;
}

.rfid-terminal-line {
  margin-bottom: 4px;
  border-bottom: 1px dashed rgba(16, 185, 129, 0.05);
  padding-bottom: 2px;
}
.rfid-terminal-line.critical {
  color: var(--danger);
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}
.rfid-terminal-line.warning {
  color: var(--warning);
  text-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}
.rfid-terminal-line.info {
  color: var(--success);
}

.rfid-zone-list {
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
}
.rfid-zone-list::-webkit-scrollbar {
  width: 3px;
}
.rfid-zone-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1.5px;
}

.rfid-chip-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.rfid-chip-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.rfid-chip-pill .chip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}
.rfid-chip-pill .chip-epc {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.2px;
}

/* JIT LOGISTICS & OPERATIONS ALERTS */
@keyframes alertPulse {
  0% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.6); border-color: rgba(239, 68, 68, 0.95); }
  100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }
}

.jit-alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.jit-alert.stock-out {
  background: rgba(239, 68, 68, 0.05);
  border-color: var(--danger);
  animation: alertPulse 1.8s infinite ease-in-out;
}
.jit-alert.over-stock {
  background: rgba(245, 158, 11, 0.04);
  border-color: var(--warning);
}

/* MARKETING & DEMO VIEW STYLING */
.marketing-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

@media (max-width: 950px) {
  .marketing-layout {
    grid-template-columns: 1fr;
  }
}

.marketing-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.marketing-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.value-prop-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.value-prop-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.value-prop-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(198, 85, 46, 0.25);
  transform: translateX(4px);
}

.value-prop-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.market-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.segment-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  text-align: center;
  transition: var(--transition);
}

.segment-tile:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--success);
  transform: translateY(-3px);
}

.segment-tile strong {
  font-size: 0.78rem;
  margin-top: 6px;
  color: var(--fg);
}

/* DEMO CENTER CARDS */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.demo-card {
  background: rgba(36, 28, 18, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}

.demo-card:hover {
  background: rgba(36, 28, 18, 0.7);
  border-color: rgba(198, 85, 46, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-3px);
}

.demo-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.demo-icon {
  font-size: 1.4rem;
  background: rgba(198, 85, 46, 0.08);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(198, 85, 46, 0.15);
}

.demo-card h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--fg);
}

.demo-card p {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  flex-grow: 1;
}

/* FLOATING TOUR GUIDE OVERLAY */
.tour-overlay-card {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  background: rgba(13, 18, 28, 0.85);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(198, 85, 46, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  padding: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

@media (max-width: 480px) {
  .tour-overlay-card {
    width: calc(100% - 32px);
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
}

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

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tour-accent-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: tourDotPulse 1.5s infinite;
}

@keyframes tourDotPulse {
  0% { transform: scale(0.8); opacity: 0.5; box-shadow: 0 0 0 0 rgba(198, 85, 46, 0.7); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(198, 85, 46, 0); }
  100% { transform: scale(0.8); opacity: 0.5; box-shadow: 0 0 0 0 rgba(198, 85, 46, 0); }
}

.btn-close-tour {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  padding: 2px;
}

.btn-close-tour:hover {
  color: var(--danger);
  transform: rotate(90deg);
}

.tour-highlight-ring {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  box-shadow: 0 0 15px var(--accent);
  border-radius: var(--radius-sm);
  z-index: 999;
  animation: highlightPulse 1.2s infinite ease-in-out;
  transition: all 0.3s ease-in-out;
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0px var(--accent); opacity: 0.6; }
  50% { box-shadow: 0 0 15px var(--accent); opacity: 1; }
  100% { box-shadow: 0 0 0px var(--accent); opacity: 0.6; }
}

.tour-highlight-glow {
  animation: elementGlow 1.5s infinite alternate ease-in-out !important;
  border-color: var(--accent) !important;
  outline: 2px solid var(--accent) !important;
}

@keyframes elementGlow {
  from {
    box-shadow: 0 0 4px rgba(198, 85, 46, 0.2);
  }
  to {
    box-shadow: 0 0 15px rgba(198, 85, 46, 0.6);
  }
}

.tour-autoplay-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-size: 0.58rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
  letter-spacing: 0.5px;
  animation: autoplayPulse 1.5s infinite ease-in-out;
  display: inline-block;
}

@keyframes autoplayPulse {
  0% { opacity: 0.6; box-shadow: 0 0 2px rgba(239, 68, 68, 0.2); }
  50% { opacity: 1; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
  100% { opacity: 0.6; box-shadow: 0 0 2px rgba(239, 68, 68, 0.2); }
}




/* ── Brand cohesion (Field skin) — serif display headings + warm wordmark ── */
h1, h2, h3, .brand h1, .section-title, .panel-title {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  letter-spacing: normal;
}

/* ── Theme switching (customer choice) — the tool re-skins with the app. ──
   Default (Shipping Tag) is :root above. These map the tool's tokens to the
   Field values of the other two themes. Driven by <html data-theme> set by
   /hewmark-theme.js, sharing one localStorage choice with the app. */
html[data-theme="registry"] {
  --bg: #17140f;
  --fg: #ece6d4;
  --card-bg: rgba(33, 29, 22, 0.65);
  --accent: #b84a40;
  --accent-rgb: 184, 74, 64;
  --accent-hover: #c85a50;
  --muted: #b3a88f;
  --shadow-glow: 0 0 20px rgba(184, 74, 64, 0.25);
}
html[data-theme="blueprint"] {
  --bg: #0e1721;
  --fg: #e4ebf1;
  --card-bg: rgba(21, 33, 45, 0.65);
  --accent: #4e86b4;
  --accent-rgb: 78, 134, 180;
  --accent-hover: #5e96c4;
  --muted: #9db0c0;
  --shadow-glow: 0 0 20px rgba(78, 134, 180, 0.25);
}
