/* Prints Module & Canvas Preparation Stylesheet */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-pink: #eb2371;
  --bg-dark: #0f172a;
  --card-dark: #1e293b;
  --border-dark: rgba(255, 255, 255, 0.12);
  --color-canvas-bg: #e2e8f0;
  --color-canvas-border: #94a3b8;
  --color-canvas-grid: rgba(148, 163, 184, 0.25);
  --status-pending: #f59e0b;
  --status-printed: #10b981;
  --status-collected: #6366f1;
}

body.prints-app-body {
  font-family: 'Rubik', 'Heebo', system-ui, -apple-system, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Page View Switcher */
.page-view {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

.page-view.active {
  display: block;
  opacity: 1;
}

#canvasScreenView.active {
  display: flex;
  flex-direction: column;
}

/* Instant Canvas View on page reload to eliminate flash */
html.init-canvas-view #printsListView {
  display: none !important;
  opacity: 0 !important;
}

html.init-canvas-view #canvasScreenView {
  display: flex !important;
  flex-direction: column !important;
  opacity: 1 !important;
}

/* Nav button to alternate module */
.nav-alt-module-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(15, 23, 42, 0.12);
  transition: all 0.2s ease;
}

.nav-alt-module-btn:hover {
  background: #0f172a;
  color: #ffffff;
}

/* ======================================================== */
/* HERO SECTION */
/* ======================================================== */
.prints-hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e1b4b 100%);
  color: #ffffff;
  border-radius: 24px;
  padding: 36px 40px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}

.prints-hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, transparent 70%);
  pointer-events: none;
}

.prints-hero-content {
  max-width: 680px;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.prints-hero-content h1 {
  font-size: 2.25rem;
  font-weight: 900;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.prints-hero-subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: #94a3b8;
  line-height: 1.5;
}

.prints-hero-actions {
  z-index: 1;
}

.btn-create-print {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-create-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
}

/* ======================================================== */
/* STATS BAR */
/* ======================================================== */
.prints-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card.warning .stat-icon-wrap {
  background: #fef3c7;
  color: #d97706;
}

.stat-card.success .stat-icon-wrap {
  background: #d1fae5;
  color: #059669;
}

.stat-card.info .stat-icon-wrap {
  background: #e0e7ff;
  color: #4f46e5;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: #0f172a;
}

/* ======================================================== */
/* TOOLBAR */
/* ======================================================== */
.prints-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 440px;
}

.search-input-wrap svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 44px 12px 16px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.search-input-wrap input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-clear-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
}

.status-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: #f1f5f9;
}

.pill-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

/* ======================================================== */
/* PRINTS TABLE */
/* ======================================================== */
.prints-table-container {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.table-header-row {
  display: grid;
  grid-template-columns: 180px 1fr 140px 100px 180px 180px;
  gap: 16px;
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.prints-list-body {
  min-height: 200px;
}

.print-row-card {
  display: grid;
  grid-template-columns: 180px 1fr 140px 100px 180px 180px;
  gap: 16px;
  padding: 20px 24px;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.print-row-card:last-child {
  border-bottom: none;
}

.print-row-card:hover {
  background: #f8fafc;
}

.td-date {
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.td-date svg {
  color: #94a3b8;
}

.td-identifier {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.identifier-clean-text {
  font-family: 'Outfit', monospace;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.identifier-subtext {
  font-size: 0.8rem;
  color: #64748b;
}

.td-material {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-block;
  text-align: center;
  width: fit-content;
}

.td-elements {
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
}

/* Status Badges & Dropdown */
.status-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-badge.pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-badge.printed {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-badge.collected {
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.status-badge svg {
  transition: transform 0.2s ease;
}

.status-badge:hover svg {
  transform: translateY(2px);
}

.status-quick-select {
  appearance: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
  transition: all 0.2s ease;
}

.status-quick-select.pending {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.status-quick-select.printed {
  background: #d1fae5;
  color: #047857;
  border-color: #a7f3d0;
}

.status-quick-select.collected {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* Actions in row */
.td-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-row-action {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-row-action:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-row-action.danger:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Empty & Loading states */
.prints-loading-state,
.prints-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: #64748b;
  font-size: 1.05rem;
}

.spinner-circle {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ======================================================== */
/* CANVAS SCREEN VIEW */
/* ======================================================== */
#canvasScreenView {
  background: #0b1120;
  min-height: 100vh;
  display: none;
  flex-direction: column;
}

#canvasScreenView.active {
  display: flex;
}

/* Top Sticky Control Panel */
.canvas-top-panel {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.canvas-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.canvas-panel-row.primary-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 20px;
}

.canvas-panel-row.elements-toolbar-row {
  background: #131d35;
  padding: 10px 24px;
  flex-wrap: wrap;
  gap: 16px;
}

/* Left Group */
.panel-left-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-panel-back {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-panel-back:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.panel-screen-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-screen-title .screen-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.panel-screen-title .screen-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: #ffffff;
}

.canvas-dimensions-tag {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'Outfit', monospace;
}

/* Material Selection Group */
.panel-material-group {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
  max-width: 720px;
  justify-content: center;
}

.material-field,
.identifier-field,
.status-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.material-field label,
.identifier-field label,
.status-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}

.select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrapper select,
.identifier-field input {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 30px 8px 12px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.identifier-field input {
  padding: 8px 12px;
  width: 160px;
  font-family: 'Outfit', monospace;
}

.select-wrapper select:focus,
.identifier-field input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.select-chevron {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
}

/* Primary actions */
.panel-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-canvas-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 9px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-canvas-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-canvas-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-canvas-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Elements Toolbar */
.add-elements-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
}

.add-elements-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-add-element {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.btn-add-element:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-add-element.btn-accent-order {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.btn-add-element.btn-accent-order:hover {
  background: #2563eb;
  color: #ffffff;
}

.btn-add-element.btn-accent-assets {
  background: rgba(235, 35, 113, 0.18);
  border-color: rgba(235, 35, 113, 0.35);
  color: #f472b6;
}

.btn-add-element.btn-accent-assets:hover {
  background: #eb2371;
  color: #ffffff;
}

/* Canvas Tools: pack, clear, zoom */
.canvas-tools-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.btn-tool.danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.grid-step-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
}

.grid-step-control label {
  color: #94a3b8;
  white-space: nowrap;
}

.grid-step-control input {
  width: 44px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #ffffff;
  padding: 3px 6px;
  font-family: 'Outfit', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.grid-step-control input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.grid-step-control .grid-unit {
  font-size: 0.78rem;
  color: #64748b;
}

.zoom-controls {
  display: flex;
  align-items: center;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.btn-zoom,
.btn-zoom-fit {
  background: none;
  border: none;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-zoom:hover,
.btn-zoom-fit:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.zoom-level {
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 0 6px;
  font-family: monospace;
}

/* Canvas Info Bar */
.canvas-info-bar {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.82rem;
  color: #94a3b8;
}

.info-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-metric .metric-val {
  color: #f1f5f9;
  font-weight: 700;
}

.selected-tag {
  background: #2563eb;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
}

/* ======================================================== */
/* CANVAS WORKSPACE LAYOUT (SIDEBAR BESIDE CANVAS) */
/* ======================================================== */
.canvas-workspace-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  height: calc(100vh - 120px);
  min-height: 600px;
  overflow: hidden;
  position: relative;
  contain: layout;
}

/* Right-side available elements sidebar (Permanent, not covering canvas) */
.available-elements-sidebar {
  width: 270px;
  min-width: 270px;
  max-width: 270px;
  flex: 0 0 270px;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  direction: rtl;
  position: relative;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #131d35;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #38bdf8;
  font-weight: 800;
  font-size: 0.95rem;
}

.sidebar-heading-text {
  letter-spacing: -0.01em;
}

.sidebar-elements-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-elements-scrollable::-webkit-scrollbar {
  width: 6px;
}
.sidebar-elements-scrollable::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

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

.sidebar-group-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 4px;
}

.sidebar-grid-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.sidebar-grid-assets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sidebar-elem-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-elem-btn:hover {
  background: #2563eb;
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.sidebar-elem-btn:active {
  transform: translateY(0);
}

.sidebar-elem-thumb-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
}

.sidebar-elem-thumb-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.sidebar-elem-btn:hover .sidebar-elem-thumb-box img {
  filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 0.4));
}

.mini-board-shape {
  width: 82%;
  height: 60%;
  border: 2px solid #38bdf8;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
}

.mini-separator-shape {
  width: 85%;
  height: 16%;
  background: #cbd5e1;
  border-radius: 2px;
}

.mini-frame-shape {
  width: 70%;
  height: 70%;
  border: 2px dashed #94a3b8;
  border-radius: 4px;
}

/* SECTION 1: INLINE ORDERS LIST */
.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
}

.sidebar-orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-orders-list::-webkit-scrollbar {
  width: 4px;
}
.sidebar-orders-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

.sidebar-orders-loading,
.sidebar-orders-empty {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.spinner-circle-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.sidebar-orders-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  transition: all 0.18s ease;
}

.sidebar-order-row:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: #24324a;
}

.sidebar-order-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sidebar-order-class {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-order-id {
  font-size: 0.72rem;
  color: #38bdf8;
  font-family: monospace;
}

.btn-sidebar-add-order-compact {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-sidebar-add-order-compact:hover {
  background: #3b82f6;
  transform: scale(1.1);
}

/* SECTION 3: SYSTEM COMPONENTS */
.sidebar-system-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sidebar-system-btn {
  aspect-ratio: 1;
}

/* Mini Hanger Couple Icon */
.mini-hanger-icon {
  width: 80%;
  height: 70%;
  border: 1.5px solid #a855f7;
  border-radius: 3px;
  position: relative;
  background: rgba(168, 85, 247, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mini-hanger-icon .hanger-shape-male {
  height: 35%;
  background: rgba(168, 85, 247, 0.35);
  border-bottom: 1.5px dashed #c084fc;
}

.mini-hanger-icon .hanger-shape-female {
  flex: 1;
  background: rgba(168, 85, 247, 0.18);
}

/* Mini Hangers Cluster Icon */
.mini-hangers-cluster-icon {
  width: 80%;
  height: 80%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

.mini-hanger-tile {
  background: rgba(168, 85, 247, 0.3);
  border: 1px solid #c084fc;
  border-radius: 2px;
}

/* Mini Stencil Icon */
.mini-stencil-icon {
  width: 80%;
  height: 60%;
  border: 1.5px solid #f59e0b;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-stencil-notch {
  width: 30%;
  height: 30%;
  border: 1.5px dashed #fbbf24;
  border-radius: 2px;
}

/* Canvas Item Visuals for Hanger Couple & Glueing Stencil */
.hanger-couple-canvas-preview {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1.5px solid #a855f7;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.1);
  box-sizing: border-box;
  overflow: hidden;
}

.hanger-male-part {
  height: 33.33%;
  border-bottom: 1.5px dashed #c084fc;
  background: rgba(168, 85, 247, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #e9d5ff;
}

.hanger-female-part {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #c084fc;
}

.stencil-canvas-preview {
  width: 100%;
  height: 100%;
  border: 1.5px solid #f59e0b;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.12);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 2px;
}

.stencil-notch-hole {
  width: 28%;
  height: 28%;
  border: 1.5px dashed #fbbf24;
  border-radius: 3px;
  background: rgba(251, 191, 36, 0.2);
}

.stencil-label {
  font-size: 8px;
  font-weight: 800;
  color: #fbbf24;
}

/* ======================================================== */
/* CANVAS WORKSPACE (LIGHT GREY BACKGROUND, 120 x 240 CM) */
/* ======================================================== */
.canvas-viewport-wrapper {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 60px;
  display: flex;
  direction: ltr; /* Canvas coordinate system is left-to-right */
  background: #0b1120;
  position: relative;
  z-index: 1;
}

.canvas-centering-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  user-select: none;
  margin: auto; /* Centers when scale <= 1.0, aligns cleanly to (0,0) when zooming in */
  flex-shrink: 0;
}

.canvas-and-ruler-row {
  display: flex;
  align-items: flex-start;
}

/* Rulers */
.ruler-horizontal-wrap {
  height: 24px;
  margin-right: 28px; /* account for vertical ruler */
  background: #1e293b;
  border: 1px solid #334155;
  border-bottom: none;
  position: relative;
  overflow: hidden;
}

.ruler-horizontal {
  height: 100%;
  position: relative;
}

.ruler-vertical-wrap {
  width: 28px;
  background: #1e293b;
  border: 1px solid #334155;
  border-left: none;
  position: relative;
  overflow: hidden;
}

.ruler-vertical {
  width: 100%;
  position: relative;
}

.ruler-tick {
  position: absolute;
  background: #64748b;
}

.ruler-tick-label {
  position: absolute;
  font-size: 9px;
  font-family: monospace;
  color: #94a3b8;
}

/* The 120 x 240 CM Canvas Sheet */
.sheet-canvas-container {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  position: relative;
}

.sheet-canvas {
  /* Dimensions in px computed dynamically by JS based on zoom */
  background-color: var(--color-canvas-bg); /* Light Grey Background as requested */
  border: 2px solid #cbd5e1;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.canvas-grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, var(--color-canvas-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-canvas-grid) 1px, transparent 1px);
  /* background-size set dynamically in JS matching 10cm grid */
  pointer-events: none;
}

/* 5 mm Margins Guideline on all 4 ends of canvas (no text label) */
.canvas-margin-guideline {
  position: absolute;
  border: 1.5px dashed rgba(239, 68, 68, 0.6);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 3;
}

.canvas-elements-stage {
  position: absolute;
  inset: 0;
}

/* Rubberband Multi-Selection Box */
.canvas-selection-box {
  position: absolute;
  border: 1.5px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  pointer-events: none;
  z-index: 50;
  border-radius: 3px;
}

/* ======================================================== */
/* CANVAS ELEMENTS (NATURAL CONTOUR OUTLINE, NO RECTANGULAR CARD BG) */
/* ======================================================== */
.canvas-item {
  position: absolute;
  box-sizing: border-box;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease, outline 0.15s ease;
  z-index: 10;
}

.canvas-item:active {
  cursor: grabbing;
}

.canvas-item:hover {
  /* Clean outline without fuzzy glow */
}

.canvas-item.selected {
  outline: none !important;
  z-index: 20;
}

/* Cut line overlays: Crisp black when placed well, Pure red on collision */
.element-cut-line-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: fill;
  filter: none; /* Native crisp black cut line */
  z-index: 5;
  transition: filter 0.08s ease;
}

/* Child token circular cut line: thin hairline matching sign cut lines */
.element-cut-line-overlay circle,
.child-cut-svg circle {
  stroke: #000000;
  stroke-width: 0.35;
  transition: stroke 0.08s ease, stroke-width 0.08s ease;
}

/* Hanger & Stencil vector cut outlines */
.hanger-cut-svg rect,
.hanger-cut-svg path,
.stencil-cut-svg path,
.stencil-cut-svg rect {
  stroke: #000000;
  stroke-width: 0.4;
  transition: stroke 0.08s ease, stroke-width 0.08s ease;
}

/* ======================================================== */
/* SELECTED STATE: Cut line becomes twice thicker and BLUE (#2563eb) */
/* ======================================================== */
.canvas-item.selected .element-cut-line-overlay {
  /* Crisp solid royal blue cut line, thickened 2x via zero-blur shadow offsets */
  filter: invert(35%) sepia(88%) saturate(2255%) hue-rotate(213deg) brightness(98%) contrast(97%)
          drop-shadow(0.5px 0 0 #2563eb) drop-shadow(-0.5px 0 0 #2563eb)
          drop-shadow(0 0.5px 0 #2563eb) drop-shadow(0 -0.5px 0 #2563eb);
}

.canvas-item.selected .element-cut-line-overlay circle,
.canvas-item.selected .child-cut-svg circle {
  stroke: #2563eb !important;
  stroke-width: 0.7 !important; /* Exactly twice thicker */
}

.canvas-item.selected .hanger-cut-svg rect,
.canvas-item.selected .hanger-cut-svg path,
.canvas-item.selected .stencil-cut-svg path,
.canvas-item.selected .stencil-cut-svg rect {
  stroke: #2563eb !important;
  stroke-width: 0.8 !important; /* Twice thicker */
}

/* ======================================================== */
/* OVERLAP COLLISION & OUT-OF-BOUNDS WARNING: RED (#ef4444) */
/* ======================================================== */
.canvas-item.has-collision,
.canvas-item.out-of-bounds {
  outline: none !important;
  z-index: 25;
}

/* SVG image cut line turns pure red (#ef4444) on collision with 2x thickness */
.canvas-item.has-collision .element-cut-line-overlay,
.canvas-item.out-of-bounds .element-cut-line-overlay {
  filter: invert(36%) sepia(87%) saturate(2250%) hue-rotate(338deg) brightness(98%) contrast(93%)
          drop-shadow(0.5px 0 0 #ef4444) drop-shadow(-0.5px 0 0 #ef4444)
          drop-shadow(0 0.5px 0 #ef4444) drop-shadow(0 -0.5px 0 #ef4444) !important;
}

/* Child circular cut line turns pure red on collision */
.canvas-item.has-collision .element-cut-line-overlay circle,
.canvas-item.has-collision .child-cut-svg circle,
.canvas-item.out-of-bounds .element-cut-line-overlay circle,
.canvas-item.out-of-bounds .child-cut-svg circle {
  stroke: #ef4444 !important;
  stroke-width: 0.7 !important;
}

.canvas-item.has-collision .hanger-cut-svg rect,
.canvas-item.has-collision .hanger-cut-svg path,
.canvas-item.has-collision .stencil-cut-svg path,
.canvas-item.has-collision .stencil-cut-svg rect,
.canvas-item.out-of-bounds .hanger-cut-svg rect,
.canvas-item.out-of-bounds .hanger-cut-svg path,
.canvas-item.out-of-bounds .stencil-cut-svg path,
.canvas-item.out-of-bounds .stencil-cut-svg rect {
  stroke: #ef4444 !important;
  stroke-width: 0.8 !important;
}

/* Element preview content styles - transparent without drop shadows */
.element-inner-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  background: transparent;
  transform-origin: center center;
}

.element-image-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

/* Specific Element Types */
.canvas-item[data-type="child_token"] {
  background: transparent;
  border-radius: 50%;
}

.child-token-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.child-token-disc-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* ======================================================== */
/* MODALS */
/* ======================================================== */
.prints-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.prints-modal-backdrop.open {
  display: flex;
}

.prints-modal-card {
  background: #ffffff;
  border-radius: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.prints-modal-card.modal-wide {
  max-width: 900px;
}

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

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #0f172a;
}

.modal-title-wrap h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease;
}

.btn-close-modal:hover {
  color: #0f172a;
}

.modal-card-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-instructions {
  margin: 0 0 16px 0;
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.5;
}

.modal-card-footer {
  padding: 16px 28px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.btn-modal-cancel {
  background: #e2e8f0;
  border: none;
  color: #475569;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-modal-cancel:hover {
  background: #cbd5e1;
}

/* Orders Modal List */
.orders-selection-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.order-select-item:hover {
  border-color: #2563eb;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.order-select-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-select-id {
  font-family: 'Outfit', monospace;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.order-select-class {
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
}

.btn-pick-order {
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-pick-order:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* Assets Gallery Modal */
.asset-category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.asset-category-tabs .tab-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.asset-category-tabs .tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.assets-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.asset-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  transition: all 0.2s ease;
}

.asset-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
}

.asset-thumb-box {
  width: 100%;
  height: 110px;
  background: #f8fafc;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
}

.asset-thumb-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.asset-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.asset-card-dims {
  font-size: 0.78rem;
  color: #64748b;
  font-family: monospace;
  margin-bottom: 12px;
}

.btn-add-asset-to-canvas {
  margin-top: auto;
  background: #0f172a;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-add-asset-to-canvas:hover {
  background: #2563eb;
}

.assets-footer-tip {
  font-size: 0.85rem;
  color: #64748b;
}

/* Toast */
.prints-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: slideInToast 0.25s ease-out;
}

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

@media (max-width: 900px) {
  .prints-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .table-header-row,
  .print-row-card {
    grid-template-columns: 140px 1fr 120px 140px;
  }
  .th-elements, .td-elements {
    display: none;
  }
}
