/* ============================================================
   components.css — TecnoLalas Taller Pro Component Library
   All reusable component styles
   ============================================================ */

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-interactive);
  text-decoration: none;
  white-space: nowrap;
  min-height: 2.25rem;
}
.btn:active { transform: scale(0.97); }
.btn svg, .btn [data-lucide] { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-offset); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover { background: var(--color-surface-dynamic); color: var(--color-text); }

.btn-success {
  background: var(--color-success);
  color: white;
}
.btn-success:hover { background: var(--color-success-hover); }

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover { background: var(--color-error-hover); }

.btn-warning {
  background: var(--color-warning);
  color: white;
}
.btn-warning:hover { background: var(--color-warning-hover); }

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  min-height: 1.875rem;
}
.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  min-height: 2.75rem;
}

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

/* Icon button */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: color var(--transition-interactive), background var(--transition-interactive);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--color-text); background: var(--color-surface-dynamic); }
.icon-btn svg, .icon-btn [data-lucide] { width: 18px; height: 18px; }

/* Tooltip for icon-btns */
.icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2);
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-interactive), transform var(--transition-interactive);
  z-index: 100;
}
.icon-btn:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-gray   { background: color-mix(in oklab, var(--status-received) 15%, var(--color-surface)); color: var(--status-received); }
.badge-blue   { background: color-mix(in oklab, var(--status-diagnosing) 15%, var(--color-surface)); color: var(--status-diagnosing); }
.badge-amber  { background: color-mix(in oklab, var(--status-waiting-parts) 15%, var(--color-surface)); color: var(--color-warning-hover); }
.badge-purple { background: color-mix(in oklab, var(--status-in-repair) 15%, var(--color-surface)); color: var(--status-in-repair); }
.badge-cyan   { background: color-mix(in oklab, var(--status-quality-check) 15%, var(--color-surface)); color: var(--color-cyan-hover); }
.badge-green  { background: color-mix(in oklab, var(--status-ready) 15%, var(--color-surface)); color: var(--status-ready); }
.badge-emerald { background: color-mix(in oklab, var(--status-delivered) 15%, var(--color-surface)); color: var(--status-delivered); }
.badge-dark   { background: color-mix(in oklab, var(--status-closed) 15%, var(--color-surface)); color: var(--status-closed); }

.badge-primary { background: var(--color-primary-highlight); color: var(--color-primary); }
.badge-success { background: var(--color-success-highlight); color: var(--color-success-hover); }
.badge-warning { background: var(--color-warning-highlight); color: var(--color-warning-hover); }
.badge-danger  { background: var(--color-error-highlight); color: var(--color-error-hover); }

/* Priority badges */
.priority-low    { color: var(--color-text-muted); }
.priority-normal { color: var(--color-primary); }
.priority-high   { color: var(--color-warning-hover); }
.priority-urgent { color: var(--color-error); font-weight: 600; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.card-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* KPI card */
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-card-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-card-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  flex-shrink: 0;
}
.kpi-card-icon svg { width: 16px; height: 16px; }
.kpi-card-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
}
.kpi-card-delta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.kpi-delta-up { color: var(--color-success); }
.kpi-delta-down { color: var(--color-error); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  overflow-x: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.data-table {
  width: 100%;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
}
.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: var(--color-text); }
.data-table th.sort-asc::after  { content: ' ↑'; color: var(--color-primary); }
.data-table th.sort-desc::after { content: ' ↓'; color: var(--color-primary); }
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table td.wrap-cell { white-space: normal; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--transition-interactive);
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--color-surface-offset); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.form-label.required::after {
  content: ' *';
  color: var(--color-error);
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
.form-error-msg {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.input, .select, .textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-sm);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
  min-height: 2.5rem;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 15%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-faint); }
.input.error { border-color: var(--color-error); }

.textarea { resize: vertical; min-height: 5rem; line-height: 1.5; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* Checkbox & Radio */
.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  min-height: 2rem;
}
.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.toggle {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: background var(--transition-interactive);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-interactive);
  box-shadow: var(--shadow-sm);
}
.toggle.on { background: var(--color-primary); }
.toggle.on::after { transform: translateX(1.125rem); }

/* File input */
.file-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
  color: var(--color-text-muted);
}
.file-upload-area:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  color: var(--color-primary);
}
.file-upload-area svg { margin: 0 auto var(--space-2); opacity: 0.6; }

/* Input with icon */
.input-with-icon {
  position: relative;
}
.input-with-icon .input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
  width: 16px;
  height: 16px;
}
.input-with-icon .input { padding-left: var(--space-8); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 1;
  transition: opacity var(--transition-interactive);
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: scale(1);
  transition: transform var(--transition-interactive);
  border: 1px solid var(--color-border);
}
.modal-overlay.hidden .modal-content { transform: scale(0.96); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  gap: var(--space-4);
}
.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.modal-body {
  padding: var(--space-6);
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 360px;
  border: 1px solid transparent;
  font-size: var(--text-sm);
}
.toast.dismissing { animation: toastOut 0.25s ease forwards; }
.toast-success { background: var(--color-success-highlight); color: var(--color-success-hover); border-color: var(--color-success); }
.toast-error   { background: var(--color-error-highlight); color: var(--color-error-hover); border-color: var(--color-error); }
.toast-info    { background: var(--color-primary-highlight); color: var(--color-primary-hover); border-color: var(--color-primary); }
.toast-warning { background: var(--color-warning-highlight); color: var(--color-warning-hover); border-color: var(--color-warning); }
.toast svg, .toast [data-lucide] { width: 18px; height: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; font-weight: 500; }
.toast-close { margin-left: auto; opacity: 0.6; cursor: pointer; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ============================================================
   TABS
   ============================================================ */
.tabs, .tab-bar {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-interactive), border-color var(--transition-interactive);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab-panel { display: none; padding-top: var(--space-4); }
.tab-panel.active { display: block; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width var(--transition-slow), min-width var(--transition-slow), transform var(--transition-slow);
  z-index: 50;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span:not(.nav-badge),
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed .brand-tagline { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: var(--space-4) var(--space-3); }
.sidebar.collapsed .sidebar-collapse-btn { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: var(--space-3); }
.sidebar.collapsed .user-info { justify-content: center; }

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  min-height: 4rem;
  flex-shrink: 0;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-primary);
  flex: 1;
  min-width: 0;
}
.brand-logo { flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.brand-tagline {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.nav-section-label {
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive);
  text-decoration: none;
  min-height: 2.5rem;
}
.nav-item:hover { background: var(--color-surface-dynamic); color: var(--color-text); }
.nav-item.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
.nav-item svg, .nav-item [data-lucide] { width: 18px; height: 18px; flex-shrink: 0; }

.nav-cta {
  background: var(--color-primary);
  color: white !important;
  margin-bottom: var(--space-2);
}
.nav-cta:hover { background: var(--color-primary-hover) !important; color: white !important; }

.nav-badge {
  margin-left: auto;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  min-width: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-badge-warn { background: var(--color-warning-highlight); color: var(--color-warning-hover); }

/* SLA indicator chip */
.sla-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.sidebar-footer {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-4);
  flex-shrink: 0;
}
.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-avatar-sm { width: 2rem; height: 2rem; font-size: var(--text-xs); }
.user-details { flex: 1; min-width: 0; }
.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: block;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  height: 4rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.hamburger-btn { display: none; }

.search-container {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: all var(--transition-interactive);
  min-height: 2.25rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 12%, transparent);
}
.search-results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-interactive);
  font-size: var(--text-sm);
}
.search-result-item:hover { background: var(--color-surface-offset); }

.notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-interactive);
  min-height: 2.25rem;
}
.user-menu:hover { background: var(--color-surface-dynamic); }
.user-menu-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.user-menu-chevron { width: 14px; height: 14px; color: var(--color-text-muted); }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--space-4);
  min-height: 400px;
  align-items: flex-start;
}
.kanban-column {
  flex-shrink: 0;
  width: 260px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-2);
}
.kanban-col-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.kanban-col-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-full);
  padding: 1px var(--space-2);
  font-variant-numeric: tabular-nums;
}
.kanban-col-body {
  flex: 1;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 80px;
  transition: background var(--transition-interactive);
}
.kanban-col-body.drag-over { background: var(--color-primary-muted); }

.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: grab;
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
  box-shadow: var(--shadow-xs);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; transform: rotate(2deg); }
.kanban-card-ticket { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.kanban-card-device { font-size: var(--text-sm); font-weight: 600; margin: var(--space-1) 0; }
.kanban-card-customer { font-size: var(--text-xs); color: var(--color-text-muted); }
.kanban-card-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}
.kanban-card-actions .kanban-move-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-interactive);
}
.kanban-card-actions .kanban-move-btn:active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
@media (pointer: coarse), (max-width: 768px) {
  .kanban-card-actions .kanban-move-btn { display: flex; }
  .kanban-card { cursor: default; }
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  gap: var(--space-2);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}
.timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--space-4) - 1px);
  top: var(--space-3);
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--space-5);
}
.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + var(--space-1));
  top: var(--space-1);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.timeline-dot svg { width: 12px; height: 12px; }
.timeline-dot.blue  { border-color: var(--color-primary); color: var(--color-primary); }
.timeline-dot.green { border-color: var(--color-success); color: var(--color-success); }
.timeline-dot.amber { border-color: var(--color-warning); color: var(--color-warning-hover); }
.timeline-dot.red   { border-color: var(--color-error); color: var(--color-error); }
.timeline-dot.purple { border-color: var(--color-purple); color: var(--color-purple); }
.timeline-content { }
.timeline-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-1);
}
.timeline-text { font-size: var(--text-sm); color: var(--color-text); }

/* ============================================================
   PHOTO GALLERY
   ============================================================ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--color-border);
  transition: border-color var(--transition-interactive), transform var(--transition-interactive);
}
.photo-thumb:hover { border-color: var(--color-primary); transform: scale(1.02); }
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-thumb-del {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-interactive);
  cursor: pointer;
}
.photo-thumb:hover .photo-thumb-del { opacity: 1; }
.photo-thumb-del svg { width: 12px; height: 12px; }
.photo-thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 0.6rem;
  text-align: center;
  padding: 2px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ============================================================
   SIGNATURE PAD
   ============================================================ */
.signature-pad-wrap {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-2);
  position: relative;
}
.signature-pad-canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;
}
.signature-pad-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-border);
}
.signature-pad-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============================================================
   STAR RATING
   ============================================================ */
.star-rating {
  display: flex;
  gap: var(--space-1);
}
.star-rating .star {
  color: var(--color-text-faint);
  cursor: pointer;
  width: 20px;
  height: 20px;
  transition: color var(--transition-interactive);
}
.star-rating .star.filled { color: var(--color-warning); }
.star-rating .star:hover ~ .star { color: var(--color-text-faint) !important; }
.star-rating:hover .star { color: var(--color-warning); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.filter-bar .input, .filter-bar .select {
  min-width: 160px;
  max-width: 200px;
}

/* ---- Multi-Check Filter Dropdown ---- */
.mcheck-wrap {
  position: relative;
  min-width: 170px;
}
.mcheck-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
  width: 100%;
  white-space: nowrap;
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.mcheck-btn:hover { border-color: var(--color-primary); }
.mcheck-btn.open {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-primary) 20%, transparent);
}
.mcheck-btn .mcheck-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.mcheck-btn .mcheck-count {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.mcheck-btn .mcheck-chevron {
  width: 16px; height: 16px;
  opacity: 0.5;
  transition: transform var(--transition-interactive);
}
.mcheck-btn.open .mcheck-chevron { transform: rotate(180deg); }

.mcheck-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  padding: var(--space-1) 0;
}
.mcheck-panel.open { display: block; }

.mcheck-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}
.mcheck-actions button {
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.mcheck-actions button:hover { background: var(--color-primary-muted); }

.mcheck-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background var(--transition-interactive);
  user-select: none;
}
.mcheck-item:hover { background: var(--color-surface-offset); }

.mcheck-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.mcheck-item .mcheck-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mcheck-item .mcheck-name { flex: 1; }
.mcheck-item .mcheck-num {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  background: var(--color-surface-offset);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* ============================================================
   DATE FILTER DROPDOWN
   ============================================================ */

/* Active-filter state: tint the trigger button */
.mcheck-btn.mcheck-btn-active {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  color: var(--color-primary);
  font-weight: 600;
}
.mcheck-btn.mcheck-btn-active .mcheck-chevron { opacity: 0.8; }

/* Clear-filter "×" badge inside the button */
.df-clear-btn {
  background: color-mix(in oklab, var(--color-primary) 18%, transparent);
  color: var(--color-primary);
  font-weight: 900;
  font-size: 0.7rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
.df-clear-btn:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Panel sizing */
.df-panel {
  min-width: 210px;
}

/* Radio option rows */
.df-opt {
  cursor: pointer;
}
.df-opt.df-opt-selected {
  background: var(--color-primary-muted);
  color: var(--color-primary);
  font-weight: 600;
}
.df-opt.df-opt-selected:hover {
  background: var(--color-primary-highlight);
}

/* Radio dot */
.df-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  display: inline-block;
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
}
.df-radio.df-radio-checked {
  border-color: var(--color-primary);
  background: var(--color-primary);
  box-shadow: inset 0 0 0 3px var(--color-surface);
}

/* Custom date-range section */
.df-custom {
  display: none;
  padding: var(--space-3);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-offset);
}
.df-custom.df-custom-visible { display: block; }

.df-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.df-input {
  flex: 1;
  min-width: 0;
  font-size: var(--text-xs) !important;
  padding: 0.35rem 0.5rem !important;
}
.df-arrow {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

/* ============================================================
   PROGRESS / WIZARD STEPS
   ============================================================ */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
  counter-reset: step;
}
.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  gap: var(--space-2);
}
.wizard-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1.125rem;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.wizard-step.done:not(:last-child)::after { background: var(--color-primary); }
.wizard-step-num {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-surface-offset);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  z-index: 1;
  transition: all var(--transition-interactive);
}
.wizard-step.active .wizard-step-num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 0 0 4px var(--color-primary-highlight);
}
.wizard-step.done .wizard-step-num {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}
.wizard-step-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
}
.wizard-step.active .wizard-step-label { color: var(--color-primary); }
.wizard-step.done .wizard-step-label { color: var(--color-success); }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}
.empty-state-icon {
  width: 3rem;
  height: 3rem;
  opacity: 0.35;
  color: var(--color-text-muted);
}
.empty-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}
.empty-state-desc {
  font-size: var(--text-sm);
  max-width: 36ch;
}

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-offset) 25%,
    var(--color-surface-dynamic) 50%,
    var(--color-surface-offset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.skeleton-text { height: 1em; width: 100%; }
.skeleton-text.w-3\/4 { width: 75%; }
.skeleton-text.w-1\/2 { width: 50%; }
.skeleton-header { height: 2rem; width: 40%; margin-bottom: var(--space-6); }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}
.skeleton-row { height: 3rem; margin-bottom: var(--space-2); border-radius: var(--radius-md); }
.skeleton-page { padding: var(--space-6); }

/* ============================================================
   SECTION / PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ============================================================
   STATUS STEPPER (public tracking)
   ============================================================ */
.status-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}
.stepper-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  min-width: 80px;
}
.stepper-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1.125rem;
  left: calc(50% + 1.125rem);
  width: calc(100% - 2.25rem);
  height: 2px;
  background: var(--color-border);
}
.stepper-step.done:not(:last-child)::after { background: var(--color-success); }
.stepper-step.active:not(:last-child)::after { background: var(--color-primary); }
.stepper-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-surface-offset);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: all var(--transition-interactive);
}
.stepper-step.done .stepper-dot { background: var(--color-success); border-color: var(--color-success); color: white; }
.stepper-step.active .stepper-dot { background: var(--color-primary); border-color: var(--color-primary); color: white; box-shadow: 0 0 0 4px var(--color-primary-highlight); }
.stepper-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 500;
}
.stepper-step.active .stepper-label { color: var(--color-primary); font-weight: 600; }
.stepper-step.done .stepper-label { color: var(--color-success); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.tabular-nums { font-variant-numeric: tabular-nums lining-nums; }
.divider { height: 1px; background: var(--color-divider); margin: var(--space-4) 0; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid transparent;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-warning { background: var(--color-warning-highlight); color: var(--color-warning-hover); border-color: var(--color-warning); }
.alert-error { background: var(--color-error-highlight); color: var(--color-error-hover); border-color: var(--color-error); }
.alert-info { background: var(--color-primary-highlight); color: var(--color-primary); border-color: var(--color-primary); }
.alert-success { background: var(--color-success-highlight); color: var(--color-success-hover); border-color: var(--color-success); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.pagination-info { font-size: var(--text-xs); color: var(--color-text-muted); }
.pagination-btns { display: flex; gap: var(--space-1); }
.pagination-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-interactive);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pagination-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.pagination-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Two column layout */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
@media (min-width: 900px) {
  .two-col-layout { grid-template-columns: 1.5fr 1fr; }
}

/* Section card with header */
.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  gap: var(--space-3);
}
.section-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-card-body { padding: var(--space-5); }

/* ── Collapsible section-cards ─────────────────────── */
.section-card.collapsible > .section-card-header {
  cursor: pointer;
  user-select: none;
}
.section-card.collapsible > .section-card-header::after {
  content: '';
  width: 18px; height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.45;
  transition: transform 0.25s ease;
  margin-left: auto;
}
.section-card.collapsible.collapsed > .section-card-header::after {
  transform: rotate(-90deg);
}
.section-card.collapsible.collapsed > .section-card-header {
  border-bottom-color: transparent;
}
.section-card.collapsible > .section-card-body,
.section-card.collapsible > div:not(.section-card-header):not(.section-card-footer) {
  overflow: hidden;
  max-height: 5000px;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
}
.section-card.collapsible.collapsed > .section-card-body,
.section-card.collapsible.collapsed > div:not(.section-card-header):not(.section-card-footer) {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

/* ── Collapsible cards (.card) ─────────────────────── */
.card.collapsible > .card-header {
  cursor: pointer;
  user-select: none;
}
.card.collapsible > .card-header::after {
  content: '';
  width: 18px; height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.45;
  transition: transform 0.25s ease;
}
.card.collapsible.collapsed > .card-header::after {
  transform: rotate(-90deg);
}
.card.collapsible.collapsed > *:not(.card-header) {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease, margin 0.25s ease;
}
.card.collapsible > *:not(.card-header) {
  max-height: 5000px;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}
.card.collapsible.collapsed { padding-bottom: var(--space-2); }

.section-card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-2);
}

/* Number input with +/- */
.qty-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}
.qty-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--transition-interactive);
  border: none;
  flex-shrink: 0;
}
.qty-btn:hover { background: var(--color-surface-dynamic); color: var(--color-text); }
.qty-input {
  width: 3rem;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  padding: 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  height: 2rem;
  background: var(--color-surface);
  color: var(--color-text);
}
.qty-input:focus { outline: none; }

/* Autocomplete dropdown */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background var(--transition-interactive);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.autocomplete-item:hover, .autocomplete-item.focused { background: var(--color-surface-offset); }
.autocomplete-item-sub { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Chart containers */
.chart-wrap {
  position: relative;
  min-height: 220px;
}
.chart-wrap canvas { max-height: 280px; }

/* ============================================================
   WIZARD ENHANCEMENTS — Intake Flow v2
   ============================================================ */

/* Device type selector */
.device-type-grid {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.device-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--transition-interactive), background var(--transition-interactive), box-shadow var(--transition-interactive);
  min-width: 80px;
  flex: 1 1 80px;
  max-width: 120px;
  user-select: none;
}

.device-type-card:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-offset);
}

.device-type-card.selected {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.device-type-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.device-type-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.device-type-card.selected .device-type-label {
  color: var(--color-primary);
}

/* Condition groups */
.condition-group {
  margin-bottom: var(--space-4);
}

.condition-group:last-child {
  margin-bottom: 0;
}

.condition-group-header {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--color-divider);
}

/* Service items table */
.service-items-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.service-items-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.service-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.service-item-row:last-child {
  border-bottom: none;
}

.service-item-row .input {
  padding: var(--space-2) var(--space-3);
  height: 36px;
  font-size: var(--text-sm);
}

.service-items-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-border);
}

.service-items-total {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.service-items-total strong {
  color: var(--color-text);
  font-size: var(--text-base);
}

/* ── Smart Budget (Step 4 redesign) ──────────────────────── */
.budget-items-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: visible;
}

.budget-items-header {
  display: none;
}

@media (min-width: 640px) {
  .budget-items-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-offset);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

.budget-item-row {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.budget-item-row:last-child {
  border-bottom: none;
}

.budget-item-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

@media (max-width: 639px) {
  .budget-item-top {
    flex-direction: column;
    align-items: stretch;
  }
  .budget-type-select { width: 100% !important; }
  .budget-qty-wrap { justify-content: flex-start !important; }
  .budget-price-wrap { width: 100% !important; }
  .budget-price-input { width: 100% !important; }
  .budget-remove-btn { align-self: flex-end; }
}

.budget-type-select {
  width: 110px;
  height: 36px;
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
  flex-shrink: 0;
}

.budget-item-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.budget-item-input {
  height: 36px;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

.budget-qty-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.budget-qty-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.budget-qty-input {
  height: 36px;
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-1);
}

.budget-price-wrap {
  position: relative;
  flex-shrink: 0;
}

.budget-price-input {
  height: 36px;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

.budget-remove-btn {
  flex-shrink: 0;
}

/* Stock badge */
.budget-stock-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.budget-stock-badge.ok  { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.budget-stock-badge.low { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: var(--color-warning); }
.budget-stock-badge.out { background: color-mix(in srgb, var(--color-error) 15%, transparent);   color: var(--color-error); }

/* Price range hint */
.budget-price-hint {
  position: absolute;
  bottom: -16px;
  right: 0;
  font-size: 0.6rem;
  color: var(--color-text-faint);
  white-space: nowrap;
}

/* Autocomplete dropdown */
.budget-ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}

.budget-ac-option {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--color-divider);
  transition: background 0.12s;
}

.budget-ac-option:hover {
  background: var(--color-surface-offset);
}

.budget-ac-option:last-child {
  border-bottom: none;
}

.budget-ac-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.budget-ac-label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.budget-ac-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.budget-ac-stock {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 99px;
}
.budget-ac-stock.ok  { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.budget-ac-stock.low { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: var(--color-warning); }
.budget-ac-stock.out { background: color-mix(in srgb, var(--color-error) 15%, transparent);   color: var(--color-error); }

.budget-items-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.budget-add-buttons {
  display: flex;
  gap: var(--space-2);
}

.budget-items-total {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.budget-items-total strong {
  color: var(--color-text);
  font-size: var(--text-base);
}

/* Confirmation step */
.confirmation-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.confirmation-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: var(--text-sm);
}

.confirmation-section-body {
  padding: var(--space-4);
}

.conf-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}

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

.conf-label {
  min-width: 140px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conf-value {
  flex: 1;
  color: var(--color-text);
  word-break: break-word;
}

/* Battery indicator */
.battery-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.battery-indicator-shell {
  width: 80px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  position: relative;
  background: var(--color-surface-offset);
  overflow: hidden;
}

.battery-indicator-shell::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  background: var(--color-border);
  border-radius: 0 2px 2px 0;
}

.battery-indicator-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}

.battery-indicator-label {
  font-size: var(--text-xs);
  font-weight: 700;
  min-width: 32px;
}

/* Terms box */
.terms-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--color-surface-offset);
}

/* Disabled muted button state */
.btn-disabled-muted {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* btn-xs variant */
.btn-xs {
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  height: auto;
  line-height: 1.5;
  gap: 4px;
}

/* ============================================================
   UNLOCK METHOD SELECTOR
   ============================================================ */
.unlock-method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.unlock-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-interactive);
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  user-select: none;
}

.unlock-method-card:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background: var(--color-surface-raised);
}

.unlock-method-card.selected {
  border-color: var(--color-primary);
  background: oklch(from var(--color-primary) l c h / 0.08);
  color: var(--color-primary);
}

@media (max-width: 480px) {
  .unlock-method-grid {
    grid-template-columns: 1fr;
  }
  .unlock-method-card {
    flex-direction: row;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
  }
}

/* Pattern Canvas */
.pattern-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.pattern-canvas {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: crosshair;
  touch-action: none;
  background: var(--color-surface);
}

.pattern-sequence {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  min-height: 24px;
  font-variant-numeric: tabular-nums;
}

.pattern-sequence strong {
  color: var(--color-primary);
  font-weight: 600;
}

/* Warning box for no-auth */
.unlock-warning-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: oklch(0.95 0.04 85);
  border: 1px solid oklch(0.85 0.1 85);
}

/* ── Label with voice button ──────────────────────────────────────────── */
.label-with-voice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}
.label-with-voice .form-label {
  margin-bottom: 0;
}

/* ── Voice dictation button ──────────────────────────────────────────── */
.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 180ms ease;
  flex-shrink: 0;
}
.voice-btn:hover {
  background: var(--color-surface-overlay);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.voice-btn-active {
  background: oklch(0.55 0.22 27) !important;
  border-color: oklch(0.55 0.22 27) !important;
  color: white !important;
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.55 0.22 27 / 0.5); }
  50% { box-shadow: 0 0 0 8px oklch(0.55 0.22 27 / 0); }
}

/* ── Help tooltip ──────────────────────────────────────────────────── */
.help-tooltip-wrap {
  position: relative;
  display: inline-flex;
  cursor: help;
}
.help-tooltip-icon {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
  opacity: 0.7;
  transition: opacity 180ms ease;
}
.help-tooltip-wrap:hover .help-tooltip-icon {
  opacity: 1;
}
.help-tooltip-box {
  display: none;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: oklch(0.18 0.02 260);
  border: 1px solid oklch(0.3 0.02 260);
  color: oklch(0.92 0 0);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.6;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.5);
  z-index: 100;
  pointer-events: none;
}
.help-tooltip-box::after {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: oklch(0.3 0.02 260);
}
.help-tooltip-wrap:hover .help-tooltip-box {
  display: block;
}
@media (max-width: 640px) {
  .help-tooltip-box {
    width: 260px;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
  }
  .help-tooltip-box::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 100%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: oklch(0.3 0.02 260);
  }
}

/* ── Inventario General — Semáforo Checklist v2 ─────────────────── */
.checklist-grouped {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.checklist-category {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.checklist-category-header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
}
.checklist-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
}
.checklist-item-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  gap: var(--space-2);
  min-height: 38px;
}
.checklist-item-v2:last-child {
  border-bottom: none;
}
.checklist-item-label-v2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checklist-semaforo {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.sem-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  color: var(--color-text-faint);
  padding: 0;
  line-height: 1;
}
.sem-btn:hover {
  transform: scale(1.15);
}
.sem-green.active {
  background: oklch(0.72 0.19 145);
  border-color: oklch(0.62 0.19 145);
  color: white;
}
.sem-yellow.active {
  background: oklch(0.80 0.16 85);
  border-color: oklch(0.70 0.16 85);
  color: oklch(0.30 0.10 60);
}
.sem-red.active {
  background: oklch(0.62 0.22 25);
  border-color: oklch(0.52 0.22 25);
  color: white;
}
.sem-gray.active {
  background: var(--color-surface-offset);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}
.sem-legend {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.sem-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sem-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sem-dot-green  { background: oklch(0.72 0.19 145); }
.sem-dot-yellow { background: oklch(0.80 0.16 85); }
.sem-dot-red    { background: oklch(0.62 0.22 25); }
.sem-dot-gray   { background: var(--color-surface-offset); border: 1px solid var(--color-border); }
.checklist-notes-row {
  padding: var(--space-3) var(--space-3) var(--space-2);
}
@media (max-width: 640px) {
  .checklist-category-grid {
    grid-template-columns: 1fr;
  }
  .sem-legend {
    gap: var(--space-2);
  }
}

/* ── Mapa de Daños Físicos ──────────────────────────────────────── */
.damage-map-section {
  margin-top: var(--space-4);
}
.damage-map-views {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  padding: var(--space-4) 0;
}
.damage-map-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.damage-map-view-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.damage-map-canvas {
  position: relative;
  cursor: crosshair;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.damage-map-canvas svg {
  display: block;
}
.damage-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(0.62 0.22 25);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px oklch(0 0 0 / 0.3);
  pointer-events: none;
  z-index: 2;
  border: 2px solid white;
}
.damage-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.damage-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
}
.damage-list-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(0.62 0.22 25);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.damage-list-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
}
.damage-list-input::placeholder {
  color: var(--color-text-faint);
}
.damage-list-remove {
  cursor: pointer;
  color: var(--color-text-faint);
  transition: color 150ms;
}
.damage-list-remove:hover {
  color: var(--color-error);
}

/* ── Power-on toggle ────────────────────────────────────────── */
.power-toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  margin-bottom: var(--space-4);
}
.power-toggle-label {
  font-size: var(--text-base);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.power-toggle-btns {
  display: flex;
  gap: var(--space-2);
}
.power-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 600;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all 150ms ease;
}
.power-btn.power-yes.active {
  background: oklch(0.72 0.19 145);
  border-color: oklch(0.62 0.19 145);
  color: white;
}
.power-btn.power-no.active {
  background: oklch(0.62 0.22 25);
  border-color: oklch(0.52 0.22 25);
  color: white;
}
.power-warning {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: oklch(0.95 0.04 25);
  border: 1px solid oklch(0.80 0.12 25);
  color: oklch(0.40 0.12 25);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ========================================
   QR Photo Upload Session
   ======================================== */
.qr-session-modal {
  padding: var(--space-2) 0;
}
.qr-session-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.qr-session-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.qr-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.qr-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.qr-code-container {
  display: flex;
  justify-content: center;
  padding: var(--space-5);
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.qr-code-container img {
  display: block;
}
.qr-session-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.qr-poll-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.qr-poll-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: qrPulse 1.5s ease-in-out infinite;
}
@keyframes qrPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.qr-photo-count {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: oklch(0.72 0.19 145);
  background: oklch(0.72 0.19 145 / 0.1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}
.qr-session-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ============================================================
   MOBILE RESPONSIVE: WIZARD STEPS
   ============================================================ */
@media (max-width: 480px) {
  .wizard-step-label { display: none; }
  .wizard-step-num { width: 1.75rem; height: 1.75rem; font-size: var(--text-xs); }
  .wizard-step:not(:last-child)::after { top: 0.875rem; }
}

/* Spinner animation for loading states */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }


/* ============================================================
   BLOQUE 2: Loading States & Polish
   ============================================================ */

/* Smooth scroll behavior */
html { scroll-behavior: smooth; }

/* Button loading state */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--color-text-inverse);
}
.btn-outline.is-loading::after,
.btn-ghost.is-loading::after {
  color: var(--color-primary);
}

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

/* Page transition */
.view-transition {
  animation: viewEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Empty state improved */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}
.empty-state svg,
.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.empty-state-desc {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* Table responsive wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--space-4));
  padding: 0 var(--space-4);
}
@media (min-width: 769px) {
  .table-responsive {
    margin: 0;
    padding: 0;
  }
}

/* Mobile action bar — stack buttons vertically */
@media (max-width: 480px) {
  .action-buttons-row {
    flex-direction: column !important;
    gap: var(--space-2) !important;
  }
  .action-buttons-row .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Mobile KPI grid fix */
@media (max-width: 480px) {
  .dashboard-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-2) !important;
  }
  .kpi-card {
    padding: var(--space-3) !important;
  }
  .kpi-card .kpi-value {
    font-size: var(--text-lg) !important;
  }
  .kpi-card .kpi-label {
    font-size: var(--text-xs) !important;
  }
}

/* Mobile header top bar */
@media (max-width: 480px) {
  .top-bar {
    gap: var(--space-2) !important;
    padding: 0 var(--space-3) !important;
  }
  .top-bar .search-bar {
    min-width: 0 !important;
    flex: 1;
  }
  .top-bar .search-bar input {
    font-size: 14px !important; /* prevent iOS zoom */
  }
  .top-bar-actions {
    gap: var(--space-1) !important;
  }
  .btn-new-repair span.hidden-mobile { display: none; }
}

/* Mobile content padding */
@media (max-width: 480px) {
  .content {
    padding: var(--space-3) !important;
  }
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-2) !important;
  }
  .page-header .btn { width: 100%; justify-content: center; }
  .page-actions {
    flex-wrap: wrap !important;
    width: 100%;
  }
  .page-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--text-xs) !important;
    padding: var(--space-2) var(--space-3) !important;
  }
}

/* Mobile tabs scrollable */
@media (max-width: 640px) {
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 0 !important;
  }
  .tabs .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
}

/* Mobile repair detail action buttons */
@media (max-width: 640px) {
  .repair-action-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--space-1) !important;
  }
  .repair-action-tabs .btn {
    font-size: 11px !important;
    padding: var(--space-2) var(--space-1) !important;
    white-space: nowrap;
  }
  .repair-action-tabs .btn span { display: none; }
}

/* Mobile section cards */
@media (max-width: 640px) {
  .section-card {
    padding: var(--space-3) !important;
  }
  .detail-row {
    flex-direction: column !important;
    gap: var(--space-1) !important;
  }
  .detail-row .detail-label {
    min-width: auto !important;
    font-size: var(--text-xs);
  }
}

/* Inline loading spinner for data fetches */
.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
}
.inline-loader::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
