/* ==========================================================================
   LabelLove - UI Components, Panels, HUD & Dialog Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Header TopBar
   -------------------------------------------------------------------------- */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--header-height, 54px);
  height: auto;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  z-index: 100;
  row-gap: 8px;
  column-gap: 12px;
  box-sizing: border-box;
  transition: background-color var(--transition-fast);
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.topbar-left {
  flex: 0 1 auto;
  min-width: 0;
}

.topbar-center {
  justify-content: center;
}

.topbar-right {
  justify-content: flex-end;
  margin-left: auto;
}

/* Brand Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #ec4899 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.brand-badge {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: uppercase;
}

/* Project Name & Preset Selector */
.project-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  max-width: 100%;
  flex-shrink: 1;
}

.project-name-input {
  font-weight: 600;
  color: var(--text-main);
  width: 170px;
  max-width: 170px;
  min-width: 100px;
  border-bottom: 1px dashed transparent;
  transition: border-color var(--transition-fast);
  text-overflow: ellipsis;
}
.project-name-input:focus {
  border-color: var(--accent-primary);
}

.template-dropdown-select {
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border-left: 1px solid var(--border-subtle);
  padding-left: 8px;
  max-width: 220px;
  text-overflow: ellipsis;
}
.template-dropdown-select option {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
}

/* Segmented Control (Thermal Roll vs Sheet) */
.segmented-control {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segment-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.segment-btn:hover {
  color: var(--text-main);
}
.segment-btn.active {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Substrate Selector */
.substrate-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px 8px;
}
.substrate-pill {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.substrate-pill:hover, .substrate-pill.active {
  transform: scale(1.2);
  border-color: var(--accent-primary);
}
.pill-thermal { background: #ffffff; }
.pill-gloss { background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%); }
.pill-kraft { background: #d6b28d; }
.pill-clear { background: #94a3b8; }

/* Zoom Controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px 4px;
}
.zoom-btn {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}
.zoom-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.zoom-label {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 6px;
  color: var(--text-main);
  min-width: 38px;
  text-align: center;
}

/* Canvas Dimension Badge Button in Topbar */
.canvas-dim-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.canvas-dim-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  padding: 6px 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
  transform: translateY(-0.5px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-main);
  padding: 6px 12px;
  font-weight: 500;
}
.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: rgba(255, 255, 255, 0.25);
}

/* --------------------------------------------------------------------------
   2. Left Creation Ribbon
   -------------------------------------------------------------------------- */
.ribbon {
  position: absolute;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--ribbon-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  z-index: 50;
  transition: top var(--transition-fast);
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 0 8px;
}

.tool-divider {
  width: 32px;
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  transition: all var(--transition-fast);
}

.tool-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.tool-btn.active {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.tool-btn-title {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: -0.2px;
}

/* Tooltip on hover */
.tool-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.tool-btn:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

/* --------------------------------------------------------------------------
   3. Right Properties Inspector
   -------------------------------------------------------------------------- */
.inspector {
  position: absolute;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: var(--inspector-width);
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  transition: top var(--transition-fast);
}

/* Tabs */
.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Inspector Sections */
.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-faint);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}

.form-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-label {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  gap: 6px;
}
.input-with-label:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.input-prefix {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
}

.num-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
}

.text-input, .select-input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-main);
}
.text-input:focus, .select-input:focus {
  border-color: var(--accent-primary);
}

.select-input option {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
}

/* Scanner Gauge Badge */
.scanner-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--accent-success-subtle);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: #34d399;
}

.scanner-gauge.warning {
  background: var(--accent-warning-subtle);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Variable Binding Pill Box */
.binding-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
}

.binding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Empty selection state in inspector */
.inspector-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  text-align: center;
  color: var(--text-faint);
  gap: 12px;
  padding: 20px;
}
.inspector-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. Bottom Drawer: "Data Flow" (Airtable / Linear style)
   -------------------------------------------------------------------------- */
.data-drawer {
  position: absolute;
  left: var(--ribbon-width);
  right: var(--inspector-width);
  bottom: 0;
  height: var(--drawer-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
}

.data-drawer.is-collapsed {
  transform: translateY(calc(100% - 36px));
}

/* Drawer Header Bar */
.drawer-header {
  height: 36px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.drawer-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.drawer-toggle-icon {
  transition: transform 0.2s;
  color: var(--text-muted);
}
.data-drawer.is-collapsed .drawer-toggle-icon {
  transform: rotate(180deg);
}

.drawer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
}

/* Record Scrubber in Drawer Header */
.record-scrubber {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px 8px;
}

.scrubber-btn {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}
.scrubber-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.scrubber-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
  font-weight: 600;
}

.overflow-pill-alert {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-warning-subtle);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

/* Data Table Grid */
.data-table-container {
  flex: 1;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-faint);
  font-weight: 600;
  text-align: left;
  padding: 6px 10px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
}

.data-table td {
  padding: 6px 10px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: cell;
}

.data-table tr:hover td {
  background: var(--bg-table-hover);
}

.data-table tr.active-record td {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-main);
  font-weight: 500;
}

.data-table tr.active-record td:first-child {
  border-left: 3px solid var(--accent-primary);
}

.btn-danger-hover:hover:not(:disabled) {
  color: var(--accent-danger) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: var(--accent-danger-subtle) !important;
}

#deleteTableRowBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.data-table .btn-delete-row {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  opacity: 0.45;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.data-table tr:hover .btn-delete-row {
  opacity: 0.85;
}

.data-table .btn-delete-row:hover {
  opacity: 1;
  color: var(--accent-danger);
  background: var(--accent-danger-subtle);
  transform: scale(1.1);
}

.scrubber-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. Modals & Dialogs (Print Hub / ZPL Generator)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop-bg, rgba(0, 0, 0, 0.7));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.6);
  width: 90%;
  max-width: 780px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s var(--ease-smooth);
}
.modal-backdrop.is-open .modal-window {
  transform: scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-muted);
}
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ZPL Code Preview Box */
.zpl-code-box {
  background: #07090e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38bdf8;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. File Operations & Document Management Controls
   -------------------------------------------------------------------------- */
.file-actions-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
}

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.topbar-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.topbar-action-btn:active {
  transform: scale(0.97);
}

/* Dropdown Menu */
.dropdown-container {
  position: relative;
}

.dropdown-arrow {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 2px;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 1px var(--border-default);
  padding: 6px;
  z-index: 200;
  display: none;
  backdrop-filter: blur(12px);
}
.dropdown-menu.is-open {
  display: block;
  animation: fadeInDown 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  transition: background var(--transition-fast);
  cursor: pointer;
}
.dropdown-item:hover {
  background: rgba(99, 102, 241, 0.15);
}

.dropdown-item-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.dropdown-item-content {
  display: flex;
  flex-direction: column;
}

.dropdown-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.dropdown-item-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* Save Status Badge / Pill */
.save-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
  transition: all var(--transition-fast);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-saved {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.dot-unsaved {
  background-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

/* Recent Projects Modal (Expanded) */
.modal-window.modal-lg {
  max-width: 820px;
  width: 90%;
  max-height: 85vh;
}

.recent-projects-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.recent-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  max-height: 440px;
  overflow-y: auto;
  padding: 4px 2px;
}

.recent-project-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
  position: relative;
}
.recent-project-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.recent-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.recent-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.recent-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.spec-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.recent-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.recent-card-date {
  font-size: 10px;
  color: var(--text-faint);
}

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

.btn-card-open {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-card-open:hover {
  background: var(--accent-hover);
}

.btn-card-del {
  padding: 4px 7px;
  font-size: 11px;
  background: transparent;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-card-del:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.recent-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.recent-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* Drag & Drop Screen Overlay */
.dropzone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 11, 17, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.dropzone-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.dropzone-card {
  background: var(--bg-surface-elevated);
  border: 2px dashed var(--accent-primary);
  border-radius: var(--radius-lg);
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.25);
  animation: pulseCard 2s infinite ease-in-out;
}
.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.dropzone-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.dropzone-card p {
  font-size: 13px;
  color: var(--text-muted);
}

@keyframes pulseCard {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Notification Toast */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 999;
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.app-toast.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}
.app-toast.toast-info {
  border-color: rgba(99, 102, 241, 0.4);
}
.app-toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.4);
}

/* --------------------------------------------------------------------------
   10. Unsaved Changes & New Job Modal Styles
   -------------------------------------------------------------------------- */
.modal-window.modal-sm {
  max-width: 480px;
  width: 92%;
}

.modal-window.modal-xl {
  max-width: 920px;
  width: 95%;
  max-height: 90vh;
}

/* Unsaved Changes Confirmation Modal */
.confirm-modal .modal-header {
  padding: 14px 18px;
}

.modal-title-icon.warning-icon {
  color: #f59e0b;
}

.confirm-modal-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 4px 0;
}

.confirm-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.confirm-texts h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.3;
}

.confirm-texts p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.confirm-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
}

.confirm-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Save As Modal */
.save-as-modal {
  max-width: 480px;
  width: 95%;
}

.save-as-modal .modal-header {
  padding: 14px 18px;
}

.save-as-form {
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.save-as-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.save-as-field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.save-as-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.save-as-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.save-as-preview-hint {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.save-as-preview-hint code {
  color: var(--accent-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
}

.save-as-tip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.save-as-tip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.save-as-tip-header strong {
  color: var(--text-main);
  font-size: 12px;
}

.save-as-tip-card p {
  margin: 0;
}

.save-as-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
}

/* New Job Modal Header & Tabs */
.new-job-modal .modal-header {
  padding: 14px 20px;
}

.new-job-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.new-job-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.new-job-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}
.new-job-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.04);
}

.tab-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
}

.new-job-modal-body {
  padding: 18px 22px;
  max-height: 65vh;
  overflow-y: auto;
}

.new-job-tab-content {
  display: none;
}
.new-job-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.new-job-section-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.section-title-main {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.section-title-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Standard Presets Grid */
.standard-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.preset-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}
.preset-card:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.preset-card.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.14);
  box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 12px rgba(99, 102, 241, 0.25);
}

.preset-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.preset-card-icon {
  font-size: 18px;
}
.preset-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.preset-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.preset-card-dims {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
}
.preset-card-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Blank Custom Layout (Form + Preview) */
.blank-custom-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.blank-form-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.form-dims-row {
  align-items: flex-end;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.form-field-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select {
  padding: 7px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-suffix .form-input {
  padding-right: 32px;
}
.input-suffix {
  position: absolute;
  right: 9px;
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
  pointer-events: none;
}

.dim-converted-inch {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.swap-dim-btn-container {
  display: flex;
  align-items: flex-end;
  padding-bottom: 18px;
}
.btn-swap-dims {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}
.btn-swap-dims:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  transform: rotate(180deg);
}

/* Blank Preview Widget */
.blank-preview-col {
  display: flex;
  flex-direction: column;
}

.blank-preview-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.blank-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.preview-aspect-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.blank-preview-stage-container {
  flex: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
}

.blank-preview-stage {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
}

.blank-preview-safe-area {
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(239, 68, 68, 0.45);
  border-radius: 2px;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.safe-margin-tag {
  font-size: 7.5px;
  color: rgba(239, 68, 68, 0.85);
  font-family: var(--font-mono);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.blank-preview-dim-tag {
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2;
  white-space: nowrap;
}

.blank-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-faint);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Templates Catalog Tab */
.templates-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.templates-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.templates-search-box .search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--text-faint);
  pointer-events: none;
}
.templates-search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.templates-search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.template-category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-pill {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.cat-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.templates-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.template-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.template-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(99, 102, 241, 0.2);
}

.template-card-preview {
  height: 110px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

.template-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.85);
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.template-labels-per-sheet {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.template-mini-svg {
  width: 100%;
  height: 100%;
  max-width: 140px;
  max-height: 90px;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.template-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.template-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.template-card-dims {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
}

.template-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.template-card-actions {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-subtle);
}

.btn-template-use {
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-template-use:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.new-job-modal-footer {
  padding: 14px 22px;
}
.new-job-footer-left {
  flex: 1;
}
.new-job-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 768px) {
  .blank-custom-layout {
    grid-template-columns: 1fr;
  }
  .standard-presets-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --------------------------------------------------------------------------
   11. Excel / CSV Multi-Sheet Import Styles
   -------------------------------------------------------------------------- */
.drawer-sheet-selector-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-left: 6px;
}
.drawer-sheet-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.drawer-sheet-select {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  padding: 1px 2px;
}
.drawer-sheet-select option {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.excel-import-modal-body {
  padding: 18px 22px;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.excel-file-info-bar {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.excel-file-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.excel-icon {
  font-size: 28px;
}
.excel-file-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}
.excel-file-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.excel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.excel-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  gap: 6px;
  align-items: center;
}

.excel-sheets-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.excel-sheet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.excel-sheet-pill:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}
.excel-sheet-pill.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.2);
  box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 12px rgba(99, 102, 241, 0.25);
  color: #ffffff;
}

.excel-sheet-count-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
}
.excel-sheet-pill.active .excel-sheet-count-tag {
  background: rgba(0, 0, 0, 0.6);
  color: #a5b4fc;
}

.excel-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.excel-preview-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.excel-stat-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.excel-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.excel-checkbox-label:hover {
  color: var(--text-main);
}
.excel-checkbox-label input {
  accent-color: var(--accent-primary);
}

.excel-preview-table-container {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
}

.excel-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}
.excel-preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-surface-subtle);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  z-index: 1;
}
.excel-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.excel-preview-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.excel-tip-banner {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--text-main);
  line-height: 1.4;
}
.excel-tip-banner .tip-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.excel-tip-banner code {
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 5px;
  border-radius: 3px;
  color: #38bdf8;
  font-family: var(--font-mono);
}

/* ==========================================================================
   10. Theme Switcher (Claro / Oscuro / Sistema)
   ========================================================================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.theme-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--border-default);
  background: var(--bg-surface-subtle);
}
.theme-toggle-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-dropdown-menu {
  min-width: 210px !important;
  right: 0 !important;
  left: auto !important;
}
.theme-option {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  gap: 10px;
  text-align: left;
  transition: background var(--transition-fast);
  background: transparent;
  cursor: pointer;
}
.theme-option:hover {
  background: var(--bg-surface-subtle);
}
.theme-option.is-active {
  background: var(--accent-primary-subtle);
}
.theme-option.is-active .dropdown-item-title {
  color: var(--accent-primary);
  font-weight: 600;
}
.theme-check {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
  display: none;
}
.theme-option.is-active .theme-check {
  display: inline-block;
}

/* Numeric Mask Badge & Preview */
.numeric-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.mask-preview-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.mask-preview-box strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   14. Sheet & Matrix Print Modal (Carta / A4 / Sistema)
   -------------------------------------------------------------------------- */
.sheet-print-modal {
  max-width: 1280px;
  width: 96vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.sheet-modal-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex: 1;
  min-height: 0;
}

.sheet-modal-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Left Controls Column */
.sheet-controls-col {
  width: 370px;
  min-width: 350px;
  max-width: 390px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-settings-group {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.sheet-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.sheet-badges-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.sheet-badge-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.sheet-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.sheet-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-primary);
}

/* Right Preview Viewport */
.sheet-preview-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #0b0d13;
}

.sheet-preview-toolbar {
  height: 44px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
}

.sheet-toolbar-left, .sheet-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-tb-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sheet-tb-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.sheet-tb-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sheet-tb-btn.btn-text-tb {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
}

.sheet-tb-page-info {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  min-width: 80px;
  text-align: center;
}

.sheet-tb-zoom-level {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
  font-family: var(--font-mono);
}

.sheet-preview-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.sheet-preview-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.sheet-preview-zoom-wrapper {
  transform-origin: top center;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sheet Paper Styling in Preview */
.sheet-print-page.for-preview {
  background: #ffffff !important;
  color: #000000 !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  position: relative;
  border-radius: 2px;
}

.sheet-label-cell {
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.sheet-label-cell.has-cut-guide {
  outline: 0.5px dashed rgba(0, 0, 0, 0.22);
}

.sheet-label-cell.cell-skipped {
  background: repeating-linear-gradient(45deg, #f8f9fa, #f8f9fa 6px, #e9ecef 6px, #e9ecef 12px) !important;
  opacity: 0.7;
}

.cell-skipped-badge {
  font-size: 8px;
  font-weight: 600;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 5px;
  border-radius: 2px;
  border: 1px dashed #9ca3af;
}

.sheet-label-cell.cell-empty {
  opacity: 0.25;
}

.cell-num-badge {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 7px;
  color: rgba(0, 0, 0, 0.45);
  font-weight: bold;
  pointer-events: none;
  z-index: 5;
}

.sheet-footer-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.sheet-footer-summary .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* --------------------------------------------------------------------------
   Physical System Printing Styles (@media print)
   -------------------------------------------------------------------------- */
#sheetPrintArea {
  display: none;
}

@media print {
  /* When printing sheet matrix */
  body.is-printing-sheet > *:not(#sheetPrintArea) {
    display: none !important;
  }

  body.is-printing-sheet {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    height: auto !important;
  }

  #sheetPrintArea {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sheet-print-page.for-print {
    display: block !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    background: #ffffff !important;
    page-break-after: always !important;
    break-after: page !important;
    overflow: hidden !important;
  }

  .sheet-print-page.for-print:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .sheet-print-page.for-print .sheet-label-cell.has-cut-guide {
    outline: 0.5px dashed rgba(0, 0, 0, 0.25) !important;
  }

  .sheet-print-page.for-print .sheet-label-cell:not(.has-cut-guide) {
    outline: none !important;
  }

  .sheet-print-page.for-print .cell-skipped,
  .sheet-print-page.for-print .cell-empty {
    background: transparent !important;
    outline: none !important;
  }

  .barcode-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }

  .el-image img {
    image-rendering: high-quality;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Range Slider & Image Inspector Components */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
  border: 1.5px solid #ffffff;
}

.range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
  border: 1.5px solid #ffffff;
}

.image-presets-row button:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

/* --------------------------------------------------------------------------
   Topbar Responsive Layout Rules & Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 2100px) {
  .topbar-left {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .topbar-center {
    flex: 0 1 auto;
    justify-content: flex-start;
  }

  .topbar-right {
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 960px) {
  .topbar-left {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 6px 10px;
  }

  .topbar-center {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .topbar-right {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 6px 10px;
    row-gap: 6px;
  }

  .project-selector {
    width: 100%;
  }

  .project-name-input {
    width: auto;
    flex: 1 1 auto;
    min-width: 80px;
  }

  .template-dropdown-select {
    max-width: 140px;
  }

  .file-actions-group {
    flex-wrap: wrap;
  }

  .btn-primary, .btn-secondary {
    padding: 5px 10px;
    font-size: 11px;
  }
}

