:root {
  color-scheme: light;
  --theme-bg: #f8fafc;
  --theme-paper: #ffffff;
  --theme-paper-soft: #f1f5f9;
  --theme-paper-subtle: #e2e8f0;
  --theme-border: #cbd5e1;
  --theme-border-strong: #94a3b8;
  --theme-text: #0f172a;
  --theme-muted: #475569;
  --theme-muted-soft: #64748b;
  --theme-text-muted: #64748b;
  --theme-accent: #0f172a;
  --theme-accent-hover: #334155;
  --theme-primary: #1d4ed8;
  --theme-primary-hover: #1e40af;
  --theme-primary-text: #ffffff;
  --theme-active: #1d4ed8;
  --theme-active-soft: #dbeafe;
  --theme-shadow: rgba(15, 23, 42, 0.14);
  --theme-focus: #2563eb;
  --theme-focus-ring: 0 0 0 3px color-mix(in srgb, var(--theme-focus) 20%, transparent);
  --theme-radius-xs: 4px;
  --theme-radius-sm: 6px;
  --theme-radius-md: 8px;
  --theme-radius-lg: 12px;
  --theme-radius-xl: 14px;
  --theme-radius-pill: 999px;
  --theme-space-1: 4px;
  --theme-space-2: 8px;
  --theme-space-3: 12px;
  --theme-space-4: 16px;
  --theme-space-5: 20px;
  --theme-space-6: 24px;
  --theme-control-height: 44px;
  --theme-font: Inter, Arial, sans-serif;
  --theme-transition-fast: 0.16s ease;
  --theme-transition: 0.2s ease;
  --theme-success: #16a34a;
  --theme-success-soft: #dcfce7;
  --theme-success-text: #166534;
  --theme-warning: #d97706;
  --theme-warning-soft: #fef3c7;
  --theme-warning-text: #92400e;
  --theme-danger: #dc2626;
  --theme-danger-soft: #fee2e2;
  --theme-danger-text: #b91c1c;
  --theme-info: #2563eb;
  --theme-info-soft: #dbeafe;
  --theme-info-text: #1d4ed8;
  --theme-overlay: rgba(15, 23, 42, 0.42);
  --theme-sidebar-bg: #0b1220;
  --theme-sidebar-surface: #111b2d;
  --theme-sidebar-border: rgba(148, 163, 184, 0.16);
  --theme-sidebar-text: #ffffff;
  --theme-sidebar-muted: #e5edf9;
  --theme-shadow-sm: 0 6px 18px color-mix(in srgb, var(--theme-shadow) 74%, transparent);
  --theme-shadow-md: 0 12px 28px color-mix(in srgb, var(--theme-shadow) 82%, transparent);
  --theme-shadow-lg: 0 18px 42px color-mix(in srgb, var(--theme-shadow) 82%, transparent);
  --theme-footer-shadow: 0 -10px 24px color-mix(in srgb, var(--theme-shadow) 56%, transparent);
  --theme-footer-shadow-strong: 0 -10px 24px color-mix(in srgb, var(--theme-shadow) 62%, transparent);
  --theme-danger-ring: 0 0 0 3px color-mix(in srgb, var(--theme-danger) 18%, transparent);
  --theme-inline-danger-marker: inset 4px 0 0 var(--theme-danger);
  --theme-inline-warning-marker: inset 4px 0 0 var(--theme-warning);
  --theme-print-bg: #ffffff;
  --theme-print-text: #0f172a;
  --theme-print-muted: #475569;
  --theme-print-border: #475569;
  --theme-print-surface: #f1f5f9;
  --legacy-bg: var(--theme-bg);
  --legacy-paper: var(--theme-paper);
  --legacy-paper-soft: var(--theme-paper-soft);
  --legacy-border: var(--theme-border);
  --legacy-border-strong: var(--theme-border-strong);
  --legacy-text: var(--theme-text);
  --legacy-muted: var(--theme-muted);
  --legacy-primary: var(--theme-primary);
  --legacy-primary-hover: var(--theme-primary-hover);
  --legacy-primary-text: var(--theme-primary-text);
  --legacy-radius-sm: var(--theme-radius-sm);
  --legacy-radius-md: var(--theme-radius-md);
  --legacy-shadow: var(--theme-shadow-md);
  --new-bg: #f3f6fa;
  --new-canvas: #eef2f7;
  --new-surface: var(--theme-paper);
  --new-surface-soft: var(--theme-paper-soft);
  --new-ink: var(--theme-text);
  --new-muted: var(--theme-muted-soft);
  --new-border: #d8dee8;
  --new-border-strong: var(--theme-border);
  --new-brand: var(--theme-info);
  --new-brand-strong: var(--theme-primary-hover);
  --new-success: var(--theme-success);
  --new-danger: var(--theme-danger);
  --new-warning: #f59e0b;
  --new-purple: #7c3aed;
  --new-sidebar: var(--theme-sidebar-bg);
  --new-sidebar-soft: var(--theme-sidebar-surface);
  --new-shadow: var(--theme-shadow-lg);
  --new-shadow-soft: var(--theme-shadow-md);
  --new-active-gradient: linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 12%, transparent), var(--new-surface) 48%);
  --new-radius: var(--theme-radius-xl);
  --new-radius-sm: 9px;
  --new-font: var(--theme-font);
}

html[data-theme-resolved="dark"] {
  color-scheme: dark;
  --theme-bg: #0b1120;
  --theme-paper: #111827;
  --theme-paper-soft: #172033;
  --theme-paper-subtle: #1f2937;
  --theme-border: #334155;
  --theme-border-strong: #475569;
  --theme-text: #e5edf7;
  --theme-muted: #b6c4d6;
  --theme-muted-soft: #94a3b8;
  --theme-text-muted: #94a3b8;
  --theme-accent: #e5edf7;
  --theme-accent-hover: #cbd5e1;
  --theme-primary: #3b82f6;
  --theme-primary-hover: #60a5fa;
  --theme-primary-text: #06111f;
  --theme-active: #60a5fa;
  --theme-active-soft: #102a52;
  --theme-shadow: rgba(0, 0, 0, 0.32);
  --theme-focus: #60a5fa;
  --theme-success-soft: #12351f;
  --theme-success-text: #bbf7d0;
  --theme-warning-soft: #392d0d;
  --theme-warning-text: #fde68a;
  --theme-danger-soft: #3f1515;
  --theme-danger-text: #fecaca;
  --theme-info-soft: #102a52;
  --theme-info-text: #bfdbfe;
  --theme-overlay: rgba(2, 6, 23, 0.68);
  --theme-sidebar-bg: #030712;
  --theme-sidebar-surface: #0b1220;
  --theme-sidebar-border: rgba(148, 163, 184, 0.24);
  --theme-control-bg: #0f172a;
  --theme-on-dark: #ffffff;
  --theme-danger-border: #7f1d1d;
  --theme-warning-border: #73540c;
  --theme-info-border: #1e3a8a;
  --theme-column-handle: #64748b;
  --theme-column-handle-active: #93c5fd;
  --theme-card-field-bg: rgba(15, 23, 42, 0.28);
  --theme-sidebar-panel-bg: rgba(15, 23, 42, 0.96);
  --theme-modal-backdrop-dark: rgba(2, 6, 23, 0.72);
  --theme-print-bg: #ffffff;
  --theme-print-text: #0f172a;
  --theme-print-muted: #475569;
  --theme-print-border: #475569;
  --theme-print-surface: #f1f5f9;
  --new-bg: #070d19;
  --new-canvas: #0b1220;
  --new-surface: var(--theme-paper);
  --new-surface-soft: var(--theme-paper-soft);
  --new-ink: var(--theme-text);
  --new-muted: var(--theme-muted);
  --new-border: #26344d;
  --new-border-strong: var(--theme-border);
  --new-sidebar: var(--theme-sidebar-bg);
  --new-sidebar-soft: var(--theme-sidebar-surface);
  --new-shadow: var(--theme-shadow-lg);
  --new-shadow-soft: var(--theme-shadow-md);
}

.nav-btn,
.filter-btn,
.checklist-btn,
.btn-submit,
.system-settings-btn,
.tab-btn,
.calendar-mode-btn,
.calendar-arrow-btn,
.theme-toggle-fab,
.system-settings-fab {
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.nav-btn,
.filter-btn,
.checklist-btn,
.btn-submit,
.system-settings-btn {
  min-height: var(--control-height, 44px);
}

.calendar-toolbar .nav-btn,
.calendar-arrow-btn,
.calendar-mode-btn {
  height: 40px;
  min-height: 40px;
}

.calendar-toolbar .nav-btn {
  padding-top: 0;
  padding-bottom: 0;
}

.calendar-arrow-btn {
  display: inline-flex;
  padding: 0;
}

.calendar-mode-switch {
  align-items: stretch;
}

.calendar-mode-btn {
  display: inline-flex;
  line-height: 1;
}

.tab-btn {
  display: inline-flex;
  min-height: 40px;
}

.view-selector {
  width: fit-content;
  align-items: center;
  gap: 6px !important;
  padding: 6px !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 12px;
  background: var(--theme-paper-soft) !important;
}

.view-selector .tab-btn {
  min-height: 42px;
  height: 42px;
  min-width: 176px;
  padding: 0 18px;
  border: 1px solid transparent !important;
  border-radius: 8px;
  justify-content: center;
  line-height: 1.15;
  white-space: nowrap;
}

.view-selector .tab-btn:not(.active) {
  background: transparent !important;
  color: var(--theme-muted) !important;
}

.view-selector .tab-btn.active {
  background: var(--theme-active-soft) !important;
  border-color: #93c5fd !important;
  color: #1e40af !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.view-selector .tab-btn:hover:not(.active) {
  background: var(--theme-paper) !important;
  color: var(--theme-text) !important;
}

.data-loading-active > :not(.data-loading-overlay):not(script):not(style) {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.data-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--theme-overlay) 58%, transparent);
}

.data-loading-overlay[hidden] {
  display: none !important;
}

.data-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: min(360px, calc(100vw - 32px));
  padding: 18px 20px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  background: var(--theme-paper);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-lg);
}

.data-loading-card strong,
.data-loading-card span {
  display: block;
}

.data-loading-card strong {
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
}

.data-loading-card span {
  margin-top: 3px;
  color: var(--theme-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.data-loading-spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 3px solid color-mix(in srgb, var(--theme-primary) 18%, transparent);
  border-top-color: var(--theme-primary);
  border-radius: 50%;
  animation: data-loading-spin 0.85s linear infinite;
}

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

.tab-btn.active,
.calendar-mode-btn.active {
  background: var(--theme-active) !important;
  border-color: var(--theme-active) !important;
  color: var(--theme-primary-text) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.nav-btn,
.filter-btn,
.checklist-btn,
.btn-submit,
.system-settings-btn {
  background: var(--theme-primary) !important;
  border-color: var(--theme-primary) !important;
  color: var(--theme-primary-text) !important;
}

.nav-btn:hover,
.filter-btn:hover,
.checklist-btn:hover,
.btn-submit:hover,
.system-settings-btn:hover {
  background: var(--theme-primary-hover) !important;
  border-color: var(--theme-primary-hover) !important;
}

.nav-btn.secondary,
.filter-btn.secondary,
.checklist-btn.secondary,
.system-settings-btn.secondary,
.calendar-arrow-btn,
.calendar-mode-btn,
.tab-btn:not(.active) {
  background: var(--theme-paper-soft) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

.theme-toggle-fab {
  position: fixed;
  right: 18px;
  bottom: 68px;
  z-index: 900;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-paper) 86%, transparent);
  color: var(--theme-muted);
  box-shadow: 0 8px 24px var(--theme-shadow);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.76;
  transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s;
}

.theme-toggle-fab:hover,
.theme-toggle-fab:focus-visible {
  background: var(--theme-paper);
  color: var(--theme-text);
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.theme-toggle-fab span {
  transform: translateY(-1px);
}

html[data-theme-resolved="dark"] body,
html[data-theme-resolved="dark"] .sheet,
html[data-theme-resolved="dark"] .container {
  background: var(--theme-bg) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .sheet,
html[data-theme-resolved="dark"] .container {
  background: var(--theme-bg) !important;
}

html[data-theme-resolved="dark"] .control-bar,
html[data-theme-resolved="dark"] .filter-bar,
html[data-theme-resolved="dark"] .payment-summary-card,
html[data-theme-resolved="dark"] .top,
html[data-theme-resolved="dark"] .section-title,
html[data-theme-resolved="dark"] .view-selector,
html[data-theme-resolved="dark"] .pay-box,
html[data-theme-resolved="dark"] .signature-box,
html[data-theme-resolved="dark"] .catalog-category,
html[data-theme-resolved="dark"] .checklist-category,
html[data-theme-resolved="dark"] .catalog-modal,
html[data-theme-resolved="dark"] .checklist-modal,
html[data-theme-resolved="dark"] .modal,
html[data-theme-resolved="dark"] .system-modal,
html[data-theme-resolved="dark"] .system-settings-section,
html[data-theme-resolved="dark"] .settings-section,
html[data-theme-resolved="dark"] .history-item,
html[data-theme-resolved="dark"] .system-history-item,
html[data-theme-resolved="dark"] .identity-modal,
html[data-theme-resolved="dark"] .service-suggestions,
html[data-theme-resolved="dark"] .installation-modal-tab,
html[data-theme-resolved="dark"] .installation-task-item,
html[data-theme-resolved="dark"] .installation-empty-state,
html[data-theme-resolved="dark"] .followup-section,
html[data-theme-resolved="dark"] .followup-card,
html[data-theme-resolved="dark"] .followup-empty,
html[data-theme-resolved="dark"] .followup-chip,
html[data-theme-resolved="dark"] .automation-setting-toggle,
html[data-theme-resolved="dark"] .activity-mini-btn,
html[data-theme-resolved="dark"] .installation-badge,
html[data-theme-resolved="dark"] table,
html[data-theme-resolved="dark"] th,
html[data-theme-resolved="dark"] td,
html[data-theme-resolved="dark"] .calendar-toolbar,
html[data-theme-resolved="dark"] .calendar-day,
html[data-theme-resolved="dark"] .week-day,
html[data-theme-resolved="dark"] .day-drop-zone,
html[data-theme-resolved="dark"] .day-timeline-row,
html[data-theme-resolved="dark"] .calendar-agenda-day,
html[data-theme-resolved="dark"] .calendar-empty-state {
  background: var(--theme-paper) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
  box-shadow: none;
}

html[data-theme-resolved="dark"] .service-suggestion-item {
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .service-suggestion-item:hover,
html[data-theme-resolved="dark"] .service-suggestion-item.active {
  background: #102a52 !important;
}

html[data-theme-resolved="dark"] .service-suggestion-variation,
html[data-theme-resolved="dark"] .service-suggestion-meta,
html[data-theme-resolved="dark"] .service-suggestion-empty {
  color: var(--theme-text-muted) !important;
}

html[data-theme-resolved="dark"] .installation-modal-tab.active {
  background: var(--theme-primary) !important;
  border-color: var(--theme-primary) !important;
  color: #ffffff !important;
}

html[data-theme-resolved="dark"] .automation-resolution-task,
html[data-theme-resolved="dark"] .automation-resolution-option {
  background: var(--theme-paper) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .automation-resolution-select-all {
  background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-paper) 82%) !important;
  border-color: var(--theme-primary) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .automation-resolution-lead,
html[data-theme-resolved="dark"] .automation-resolution-note,
html[data-theme-resolved="dark"] .automation-resolution-option em,
html[data-theme-resolved="dark"] .automation-resolution-option small {
  color: var(--theme-text-muted) !important;
}

html[data-theme-resolved="dark"] .automation-resolution-option strong {
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .installation-task-main strong,
html[data-theme-resolved="dark"] .followup-card-head strong,
html[data-theme-resolved="dark"] .followup-card-task,
html[data-theme-resolved="dark"] .followup-section-title {
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .installation-task-main span,
html[data-theme-resolved="dark"] .installation-empty-state,
html[data-theme-resolved="dark"] .followup-card-head span,
html[data-theme-resolved="dark"] .followup-card-service,
html[data-theme-resolved="dark"] .followup-empty {
  color: var(--theme-text-muted) !important;
}

html[data-theme-resolved="dark"] .installation-task-item.overdue,
html[data-theme-resolved="dark"] .installation-badge.danger {
  background: var(--theme-danger-soft) !important;
  border-color: var(--theme-danger-border) !important;
  color: var(--theme-danger-text) !important;
}

html[data-theme-resolved="dark"] .installation-badge.warning,
html[data-theme-resolved="dark"] .followup-chip.type-entrega {
  background: var(--theme-warning-soft) !important;
  border-color: var(--theme-warning-border) !important;
  color: var(--theme-warning-text) !important;
}

html[data-theme-resolved="dark"] .installation-badge.info,
html[data-theme-resolved="dark"] .followup-chip.type-pos-entrega,
html[data-theme-resolved="dark"] .followup-chip.type-followup {
  background: var(--theme-info-soft) !important;
  border-color: var(--theme-info-border) !important;
  color: var(--theme-info-text) !important;
}

html[data-theme-resolved="dark"] .followup-chip.type-cobranca {
  background: var(--theme-danger-soft) !important;
  border-color: var(--theme-danger-border) !important;
  color: var(--theme-danger-text) !important;
}

html[data-theme-resolved="dark"] .control-bar,
html[data-theme-resolved="dark"] .filter-bar,
html[data-theme-resolved="dark"] .calendar-toolbar {
  box-shadow: 0 10px 28px var(--theme-shadow);
}

html[data-theme-resolved="dark"] thead,
html[data-theme-resolved="dark"] .calendar-weekday,
html[data-theme-resolved="dark"] .calendar-mode-switch,
html[data-theme-resolved="dark"] .calendar-day.other-month,
html[data-theme-resolved="dark"] .calendar-day-header,
html[data-theme-resolved="dark"] .followup-section-title,
html[data-theme-resolved="dark"] .modal-header,
html[data-theme-resolved="dark"] .system-modal-header,
html[data-theme-resolved="dark"] .catalog-modal-header,
html[data-theme-resolved="dark"] .checklist-modal-header {
  background: var(--theme-paper-soft) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] tr,
html[data-theme-resolved="dark"] tbody tr,
html[data-theme-resolved="dark"] .catalog-row,
html[data-theme-resolved="dark"] .checklist-row {
  border-color: var(--theme-border) !important;
}

html[data-theme-resolved="dark"] input,
html[data-theme-resolved="dark"] select,
html[data-theme-resolved="dark"] textarea,
html[data-theme-resolved="dark"] .filter-control,
html[data-theme-resolved="dark"] .form-control {
  background: var(--theme-control-bg) !important;
  border-color: var(--theme-border-strong) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] input::placeholder,
html[data-theme-resolved="dark"] textarea::placeholder {
  color: var(--theme-muted-soft) !important;
}

html[data-theme-resolved="dark"] input:focus,
html[data-theme-resolved="dark"] select:focus,
html[data-theme-resolved="dark"] textarea:focus,
html[data-theme-resolved="dark"] .filter-control:focus,
html[data-theme-resolved="dark"] .form-control:focus {
  border-color: var(--theme-focus) !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18) !important;
}

html[data-theme-resolved="dark"] .timestamp,
html[data-theme-resolved="dark"] .filter-meta,
html[data-theme-resolved="dark"] .top-note,
html[data-theme-resolved="dark"] .settings-note,
html[data-theme-resolved="dark"] .system-settings-note,
html[data-theme-resolved="dark"] .calendar-item-meta,
html[data-theme-resolved="dark"] .calendar-item-chassi,
html[data-theme-resolved="dark"] .calendar-item-info,
html[data-theme-resolved="dark"] .calendar-card-sub,
html[data-theme-resolved="dark"] .calendar-card-compact-line,
html[data-theme-resolved="dark"] .calendar-card-service,
html[data-theme-resolved="dark"] .calendar-info-label,
html[data-theme-resolved="dark"] .product-variation,
html[data-theme-resolved="dark"] .desc-text,
html[data-theme-resolved="dark"] .support,
html[data-theme-resolved="dark"] .history-meta,
html[data-theme-resolved="dark"] .system-history-meta,
html[data-theme-resolved="dark"] label {
  color: var(--theme-muted) !important;
}

html[data-theme-resolved="dark"] .calendar-item-chassi,
html[data-theme-resolved="dark"] .chassi-text {
  color: var(--theme-on-dark) !important;
}

html[data-theme-resolved="dark"] h1,
html[data-theme-resolved="dark"] h2,
html[data-theme-resolved="dark"] h3,
html[data-theme-resolved="dark"] .section-title,
html[data-theme-resolved="dark"] .box-title,
html[data-theme-resolved="dark"] .settings-section-title,
html[data-theme-resolved="dark"] .system-settings-title,
html[data-theme-resolved="dark"] .calendar-title,
html[data-theme-resolved="dark"] .calendar-item-client,
html[data-theme-resolved="dark"] .product-name,
html[data-theme-resolved="dark"] .product,
html[data-theme-resolved="dark"] .option-text,
html[data-theme-resolved="dark"] .check,
html[data-theme-resolved="dark"] .price-value,
html[data-theme-resolved="dark"] .code-text,
html[data-theme-resolved="dark"] .nobrk,
html[data-theme-resolved="dark"] .pay-options-col span,
html[data-theme-resolved="dark"] .signature-label,
html[data-theme-resolved="dark"] .field label,
html[data-theme-resolved="dark"] .pay-field label,
html[data-theme-resolved="dark"] .catalog-field,
html[data-theme-resolved="dark"] .checklist-field,
html[data-theme-resolved="dark"] .catalog-modal-header,
html[data-theme-resolved="dark"] .checklist-modal-header {
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .desc-text,
html[data-theme-resolved="dark"] .support,
html[data-theme-resolved="dark"] .product-variation,
html[data-theme-resolved="dark"] .section-title span,
html[data-theme-resolved="dark"] .option-line,
html[data-theme-resolved="dark"] .catalog-add-btn,
html[data-theme-resolved="dark"] .checklist-add-btn,
html[data-theme-resolved="dark"] .catalog-empty,
html[data-theme-resolved="dark"] .checklist-empty {
  color: var(--theme-muted) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn:hover,
html[data-theme-resolved="dark"] .catalog-icon-btn:focus,
html[data-theme-resolved="dark"] .checklist-icon-btn:hover,
html[data-theme-resolved="dark"] .checklist-icon-btn:focus,
html[data-theme-resolved="dark"] .catalog-add-btn:hover,
html[data-theme-resolved="dark"] .catalog-add-btn:focus,
html[data-theme-resolved="dark"] .checklist-add-btn:hover,
html[data-theme-resolved="dark"] .checklist-add-btn:focus {
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn,
html[data-theme-resolved="dark"] .checklist-icon-btn {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--theme-muted-soft) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="drag"],
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="drag"],
html[data-theme-resolved="dark"] .catalog-icon-btn.drag-handle,
html[data-theme-resolved="dark"] .checklist-icon-btn.drag-handle {
  color: #a78bfa !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="edit"],
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="edit"] {
  color: var(--theme-primary-hover) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="delete"],
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="delete"],
html[data-theme-resolved="dark"] .catalog-icon-btn.danger,
html[data-theme-resolved="dark"] .checklist-icon-btn.danger {
  color: var(--theme-danger) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="drag"]:hover,
html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="drag"]:focus,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="drag"]:hover,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="drag"]:focus {
  background: rgba(124, 58, 237, 0.16) !important;
  border-color: rgba(167, 139, 250, 0.45) !important;
  color: #ddd6fe !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="edit"]:hover,
html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="edit"]:focus,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="edit"]:hover,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="edit"]:focus {
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.48) !important;
  color: var(--theme-info-text) !important;
}

html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="delete"]:hover,
html[data-theme-resolved="dark"] .catalog-icon-btn[data-action="delete"]:focus,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="delete"]:hover,
html[data-theme-resolved="dark"] .checklist-icon-btn[data-action="delete"]:focus {
  background: rgba(220, 38, 38, 0.16) !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
  color: var(--theme-danger-text) !important;
}

.price-col,
.price-value {
  text-align: left !important;
}

html[data-theme-resolved="dark"] .nav-btn,
html[data-theme-resolved="dark"] .filter-btn,
html[data-theme-resolved="dark"] .checklist-btn,
html[data-theme-resolved="dark"] .btn-submit,
html[data-theme-resolved="dark"] .system-settings-btn {
  background: var(--theme-primary) !important;
  border-color: var(--theme-primary) !important;
  color: var(--theme-primary-text) !important;
}

html[data-theme-resolved="dark"] .nav-btn.secondary,
html[data-theme-resolved="dark"] .filter-btn.secondary,
html[data-theme-resolved="dark"] .checklist-btn.secondary,
html[data-theme-resolved="dark"] .system-settings-btn.secondary,
html[data-theme-resolved="dark"] .calendar-arrow-btn,
html[data-theme-resolved="dark"] .calendar-mode-btn,
html[data-theme-resolved="dark"] .tab-btn,
html[data-theme-resolved="dark"] .close-btn,
html[data-theme-resolved="dark"] .system-modal-close {
  background: var(--theme-paper-soft) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .nav-btn.danger {
  background: var(--theme-danger) !important;
  border-color: var(--theme-danger) !important;
  color: var(--theme-on-dark) !important;
}

html[data-theme-resolved="dark"] .activity-mini-btn.danger {
  border-color: color-mix(in srgb, #ef4444 42%, var(--theme-border)) !important;
  color: #fca5a5 !important;
}

html[data-theme-resolved="dark"] .calendar-mode-btn.active,
html[data-theme-resolved="dark"] .tab-btn.active {
  background: var(--theme-active) !important;
  border-color: var(--theme-active) !important;
  color: var(--theme-primary-text) !important;
}

html[data-theme-resolved="dark"] .view-selector {
  background: var(--theme-control-bg) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme-resolved="dark"] .view-selector .tab-btn.active {
  background: var(--theme-active-soft) !important;
  border-color: var(--theme-primary) !important;
  color: var(--theme-info-text) !important;
}

html[data-theme-resolved="dark"] .view-selector .tab-btn:not(.active) {
  background: transparent !important;
  color: var(--theme-muted-soft) !important;
}

html[data-theme-resolved="dark"] .nav-btn:hover,
html[data-theme-resolved="dark"] .filter-btn:hover,
html[data-theme-resolved="dark"] .checklist-btn:hover,
html[data-theme-resolved="dark"] .system-settings-btn:hover,
html[data-theme-resolved="dark"] .calendar-arrow-btn:hover,
html[data-theme-resolved="dark"] .tab-btn:hover {
  filter: brightness(1.08);
}

html[data-theme-resolved="dark"] .system-settings-fab {
  background: rgba(17, 24, 39, 0.86) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-muted) !important;
  box-shadow: 0 8px 24px var(--theme-shadow);
}

html[data-theme-resolved="dark"] .system-settings-fab:hover {
  background: var(--theme-paper) !important;
  color: var(--theme-text) !important;
}

html[data-theme-resolved="dark"] .modal-backdrop,
html[data-theme-resolved="dark"] .system-modal-backdrop,
html[data-theme-resolved="dark"] .catalog-modal-backdrop,
html[data-theme-resolved="dark"] .checklist-modal-backdrop,
html[data-theme-resolved="dark"] .identity-modal-backdrop,
html[data-theme-resolved="dark"] .identity-backdrop,
html[data-theme-resolved="dark"] .identity-lock-backdrop {
  background: var(--theme-modal-backdrop-dark) !important;
}

html[data-theme-resolved="dark"] .line,
html[data-theme-resolved="dark"] .signature-line {
  border-color: var(--theme-border-strong) !important;
}

html[data-theme-resolved="dark"] .calendar-day.drag-over,
html[data-theme-resolved="dark"] .week-day.drag-over,
html[data-theme-resolved="dark"] .day-drop-zone.drag-over {
  outline: 2px solid var(--theme-focus);
  background: #10213d !important;
}

html[data-theme-resolved="dark"] .calendar-item-time,
html[data-theme-resolved="dark"] .calendar-payment {
  background: rgba(15, 23, 42, 0.34) !important;
}

html[data-theme-resolved="dark"] .calendar-payment.paid {
  background: rgba(34, 197, 94, 0.18) !important;
}

html[data-theme-resolved="dark"] .calendar-payment.pending {
  background: rgba(239, 68, 68, 0.2) !important;
}

html[data-theme-resolved="dark"] .calendar-payment.scheduled {
  background: rgba(59, 130, 246, 0.2) !important;
}

html[data-theme-resolved="dark"] .calendar-payment.today {
  background: rgba(234, 179, 8, 0.22) !important;
}

html[data-theme-resolved="dark"] .calendar-payment.overdue {
  background: rgba(220, 38, 38, 0.28) !important;
}

html[data-theme-resolved="dark"] .payment-due-text,
html[data-theme-resolved="dark"] .calendar-payment-due {
  color: var(--theme-text-muted) !important;
}

html[data-theme-resolved="dark"] .column-resize-handle::after {
  background: var(--theme-column-handle) !important;
}

html[data-theme-resolved="dark"] th:hover .column-resize-handle::after,
html[data-theme-resolved="dark"] .column-resize-handle:focus-visible::after,
html[data-theme-resolved="dark"] body.is-resizing-columns .column-resize-handle::after {
  background: var(--theme-column-handle-active) !important;
}

html[data-theme-resolved="dark"] th.is-column-drop-before::before,
html[data-theme-resolved="dark"] th.is-column-drop-after::after {
  background: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22) !important;
}

html[data-theme-resolved="dark"] .status-toggle:hover,
html[data-theme-resolved="dark"] .status-toggle:focus-visible,
html[data-theme-resolved="dark"] .calendar-chip-action:hover,
html[data-theme-resolved="dark"] .calendar-chip-action:focus-visible {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28) !important;
  filter: brightness(1.08);
}

html[data-theme-resolved="dark"] .calendar-card-field,
html[data-theme-resolved="dark"] .calendar-card-section {
  background: var(--theme-card-field-bg) !important;
}

html[data-theme-resolved="dark"] .calendar-card-field strong {
  color: inherit !important;
}

html[data-theme-resolved="dark"] .calendar-item.green { background: #12351f !important; color: #bbf7d0 !important; border-color: #1f5a35 !important; border-left-color: #22c55e !important; }
html[data-theme-resolved="dark"] .calendar-item.yellow { background: #392d0d !important; color: #fde68a !important; border-color: #73540c !important; border-left-color: #eab308 !important; }
html[data-theme-resolved="dark"] .calendar-item.red { background: #3f1515 !important; color: #fecaca !important; border-color: #7f1d1d !important; border-left-color: #ef4444 !important; }
html[data-theme-resolved="dark"] .calendar-item.blue { background: #102a52 !important; color: #bfdbfe !important; border-color: #1e3a8a !important; border-left-color: #3b82f6 !important; }

@media screen and (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .sheet,
  .container {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow-x: hidden;
  }

  .catalog-shell,
  .checklist-catalog,
  .section,
  table,
  tbody,
  tr,
  td {
    max-width: 100%;
    min-width: 0;
  }

  tr {
    overflow: hidden;
  }

  td,
  td > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  td::before {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .filter-bar,
  .control-bar,
  .top,
  .bottom,
  .pay-box,
  .signature-box {
    width: 100%;
    max-width: 100%;
  }

  .system-modal,
  .catalog-modal,
  .checklist-modal,
  .modal {
    width: min(100%, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
  }

  .theme-toggle-fab {
    right: 16px;
    bottom: 142px;
  }

}

@media print {
  :root,
  html,
  html[data-theme-resolved="dark"] {
    color-scheme: light !important;
    --theme-bg: #ffffff !important;
    --theme-paper: #ffffff !important;
    --theme-paper-soft: #f1f5f9 !important;
    --theme-paper-subtle: #e2e8f0 !important;
    --theme-border: #cbd5e1 !important;
    --theme-border-strong: #94a3b8 !important;
    --theme-text: #0f172a !important;
    --theme-muted: #475569 !important;
    --theme-muted-soft: #64748b !important;
  }

  html,
  body,
  .sheet,
  .container,
  table,
  th,
  td,
  .top,
  .pay-box,
  .signature-box {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: none !important;
  }

  .theme-toggle-fab {
    display: none !important;
  }
}

/* Premium visual polish: screen-only layer, preserving print output. */
@media screen {
  :root {
    --premium-radius: 8px;
    --premium-radius-sm: 6px;
    --premium-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
    --premium-shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
    --premium-shadow-hover: 0 18px 42px rgba(15, 23, 42, 0.12);
    --premium-ring: 0 0 0 3px rgba(37, 99, 235, 0.14);
    --premium-success: #16a34a;
    --premium-warning: #d97706;
    --premium-danger: #dc2626;
    --premium-info: #2563eb;
  }

  html[data-theme-resolved="dark"] {
    --premium-shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
    --premium-shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.22);
    --premium-shadow-hover: 0 20px 48px rgba(0, 0, 0, 0.4);
    --premium-ring: 0 0 0 3px rgba(96, 165, 250, 0.2);
  }

  body {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--theme-bg) 84%, #ffffff 16%) 0%, var(--theme-bg) 320px),
      var(--theme-bg) !important;
    color: var(--theme-text);
    text-rendering: geometricPrecision;
  }

  .sheet,
  .container {
    padding: clamp(16px, 2vw, 28px) !important;
  }

  body[data-page="catalogo"] .sheet,
  body[data-page="checklist"] .sheet,
  body[data-page="gestao"] .container {
    max-width: 1240px;
    margin-inline: auto;
  }

  body[data-page="gestao"] .container {
    max-width: 1280px;
  }

  .control-bar,
  .filter-bar,
  .calendar-toolbar,
  .view-selector,
  .top,
  .pay-box,
  .signature-box,
  .payment-summary-card,
  .followup-section,
  .system-settings-section,
  .history-item,
  .system-history-item {
    border-color: var(--theme-border) !important;
    border-radius: var(--premium-radius) !important;
    background: color-mix(in srgb, var(--theme-paper) 94%, var(--theme-bg) 6%) !important;
    box-shadow: var(--premium-shadow-soft);
  }

  .control-bar,
  .filter-bar,
  .calendar-toolbar {
    backdrop-filter: blur(10px);
  }

  body[data-page="gestao"] .control-bar {
    display: grid !important;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    min-height: 78px;
  }

  .page-heading {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .page-kicker {
    color: var(--theme-primary);
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    text-transform: uppercase;
  }

  .page-heading h1 {
    margin: 0;
    color: var(--theme-text);
    font-size: clamp(18px, 1.8vw, 24px);
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.08;
  }

  .page-heading p {
    margin: 0;
    color: var(--theme-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
  }

  .timestamp,
  .filter-meta {
    color: var(--theme-muted) !important;
    font-weight: 750 !important;
  }

  .top {
    align-items: center;
    border-color: var(--theme-border-strong) !important;
    padding: 12px 14px !important;
  }

  .top h1,
  .title-row h1 {
    color: var(--theme-text) !important;
    font-size: clamp(17px, 1.6vw, 22px);
    letter-spacing: 0;
    line-height: 1.1;
  }

  .top-note {
    color: var(--theme-muted) !important;
    letter-spacing: 0;
  }

  input:not([type="checkbox"]),
  select,
  textarea,
  .filter-control,
  .form-control {
    border-color: var(--theme-border) !important;
    border-radius: var(--premium-radius-sm) !important;
    background: var(--theme-paper) !important;
    color: var(--theme-text) !important;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  }

  input:not([type="checkbox"]):hover,
  select:hover,
  textarea:hover,
  .filter-control:hover,
  .form-control:hover {
    border-color: var(--theme-border-strong) !important;
  }

  input:not([type="checkbox"]):focus,
  select:focus,
  textarea:focus,
  .filter-control:focus,
  .form-control:focus,
  .price-value:focus {
    border-color: var(--theme-focus) !important;
    box-shadow: var(--premium-ring) !important;
    outline: none !important;
  }

  .nav-btn,
  .filter-btn,
  .checklist-btn,
  .btn-submit,
  .system-settings-btn,
  .activity-mini-btn {
    border-radius: var(--premium-radius-sm) !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  }

  .nav-btn:not(.secondary),
  .filter-btn:not(.secondary),
  .checklist-btn:not(.secondary),
  .btn-submit,
  .system-settings-btn:not(.secondary) {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: var(--theme-primary-text) !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  }

  .nav-btn:hover,
  .filter-btn:hover,
  .checklist-btn:hover,
  .btn-submit:hover,
  .system-settings-btn:hover,
  .activity-mini-btn:hover {
    transform: translateY(-1px);
  }

  .nav-btn.secondary,
  .filter-btn.secondary,
  .checklist-btn.secondary,
  .system-settings-btn.secondary,
  .activity-mini-btn,
  .calendar-arrow-btn,
  .calendar-mode-btn,
  .tab-btn:not(.active) {
    background: var(--theme-paper-soft) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
    box-shadow: none !important;
  }

  .nav-btn.danger {
    background: var(--premium-danger) !important;
    border-color: var(--premium-danger) !important;
    color: #ffffff !important;
  }

  .activity-mini-btn.danger {
    color: var(--premium-danger) !important;
  }

  .view-selector,
  .calendar-mode-switch {
    overflow: visible;
    width: fit-content;
  }

  .view-selector .tab-btn,
  .calendar-mode-btn {
    border-radius: var(--premium-radius-sm) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  .tab-btn.active,
  .calendar-mode-btn.active,
  .view-selector .tab-btn.active {
    background: var(--theme-active-soft) !important;
    border-color: color-mix(in srgb, var(--theme-primary) 42%, var(--theme-border) 58%) !important;
    color: var(--theme-primary) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--theme-primary) 18%, transparent) !important;
  }

  .section {
    border-radius: var(--premium-radius);
  }

  .section-title,
  .followup-section-title,
  .modal-header,
  .system-modal-header,
  .catalog-modal-header,
  .checklist-modal-header,
  .identity-modal-header {
    letter-spacing: 0 !important;
  }

  .section-title {
    border-color: #111827 !important;
    border-radius: var(--premium-radius) var(--premium-radius) 0 0 !important;
    background: #111827 !important;
    color: #ffffff !important;
    min-height: 32px;
  }

  .section-count {
    min-width: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.86) !important;
    text-align: center;
  }

  table {
    border-color: var(--theme-border) !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    overflow: hidden;
  }

  th,
  td {
    border-color: var(--theme-border) !important;
  }

  th {
    background: var(--theme-paper-soft) !important;
    color: var(--theme-muted) !important;
    letter-spacing: 0 !important;
  }

  .installations-table th,
  .installations-table td {
    padding: 5px 8px !important;
    font-size: 10px;
    line-height: 1.22;
    vertical-align: middle;
  }

  .installations-table th {
    height: 30px;
    font-size: 9px;
  }

  .installations-table tbody tr {
    height: 34px;
  }

  .installations-table .vehicle-cell,
  .installations-table .service-cell {
    line-height: 1.2;
  }

  .installations-table .chassi-text,
  .installations-table .code-text {
    padding: 1px 4px;
    font-size: 9px;
  }

  .installations-table .payment-due-text,
  .installations-table .muted {
    margin-top: 2px;
    font-size: 8px;
    line-height: 1.15;
  }

  tbody tr,
  .catalog-row,
  .checklist-row {
    transition: background 0.16s ease, box-shadow 0.16s ease;
  }

  tbody tr:hover td {
    background: color-mix(in srgb, var(--theme-active-soft) 28%, var(--theme-paper) 72%) !important;
  }

  .product-name,
  .product,
  .first-column-cell,
  .calendar-item-client,
  .followup-card-head strong,
  .followup-card-task {
    color: var(--theme-text) !important;
    font-weight: 850 !important;
  }

  .code-text,
  .chassi-text {
    border-radius: 5px;
    background: color-mix(in srgb, var(--theme-paper-soft) 74%, var(--theme-paper) 26%);
    padding: 2px 5px;
  }

  #installations-table .chassi-text,
  #installations-delivered-table .chassi-text {
    background: transparent !important;
    border-radius: 0 !important;
    color: inherit !important;
    font: inherit !important;
    padding: 0 !important;
  }

  .price-value {
    color: var(--theme-text) !important;
    font-weight: 850 !important;
  }

  .catalog-row-actions,
  .checklist-row-actions {
    gap: 4px !important;
    opacity: 0.72 !important;
  }

  tr:hover .catalog-row-actions,
  tr:hover .checklist-row-actions,
  .catalog-row-actions:focus-within,
  .checklist-row-actions:focus-within {
    opacity: 1 !important;
  }

  .catalog-icon-btn,
  .checklist-icon-btn {
    width: 28px !important;
    height: 28px !important;
    flex-basis: 28px !important;
    border-color: var(--theme-border) !important;
    border-radius: var(--premium-radius-sm) !important;
    background: var(--theme-paper-soft) !important;
    color: var(--theme-muted) !important;
  }

  .catalog-icon-btn:hover,
  .catalog-icon-btn:focus,
  .checklist-icon-btn:hover,
  .checklist-icon-btn:focus {
    background: var(--theme-paper) !important;
    border-color: var(--theme-border-strong) !important;
    color: var(--theme-text) !important;
    box-shadow: var(--premium-ring);
  }

  .catalog-icon-btn[data-action="edit"],
  .checklist-icon-btn[data-action="edit"] {
    color: var(--premium-info) !important;
  }

  .catalog-icon-btn.danger,
  .checklist-icon-btn.danger {
    color: var(--premium-danger) !important;
  }

  .catalog-section-actions,
  .checklist-section-actions {
    padding-top: 8px !important;
  }

  .catalog-add-btn,
  .checklist-add-btn {
    border: 1px solid var(--theme-border);
    border-radius: var(--premium-radius-sm);
    background: var(--theme-paper);
    color: var(--theme-primary) !important;
    padding: 7px 10px !important;
    font-size: 10px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  .catalog-add-btn:hover,
  .catalog-add-btn:focus,
  .checklist-add-btn:hover,
  .checklist-add-btn:focus {
    border-color: var(--theme-primary);
    box-shadow: var(--premium-ring);
  }

  .payment-dashboard {
    align-items: stretch;
  }

  .payment-summary-card {
    position: relative;
    overflow: hidden;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  }

  .payment-summary-card:hover {
    box-shadow: var(--premium-shadow-hover);
    transform: translateY(-1px);
  }

  .payment-summary-card.active {
    background: color-mix(in srgb, var(--theme-active-soft) 42%, var(--theme-paper) 58%) !important;
    border-color: var(--theme-primary) !important;
  }

  .payment-summary-card span,
  .status-badge,
  .installation-badge,
  .followup-chip,
  .followup-priority {
    letter-spacing: 0 !important;
  }

  .status-badge,
  .installation-badge,
  .followup-chip,
  .calendar-payment,
  .calendar-item-status {
    border-radius: 999px !important;
  }

  #installations-table .status-badge {
    min-height: 18px;
    padding: 2px 6px;
    font-size: 8px;
    line-height: 1;
  }

  #installations-table .installation-badges {
    gap: 3px;
    margin-top: 3px;
  }

  #installations-table .installation-badge {
    min-height: 16px;
    padding: 1px 5px;
    font-size: 8px;
    line-height: 1;
  }

  #installations-table .action-link {
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 10px;
    line-height: 1.1;
  }

  .status-toggle,
  .calendar-chip-action {
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  }

  .status-toggle:hover,
  .calendar-chip-action:hover {
    box-shadow: var(--premium-shadow-soft) !important;
    transform: translateY(-1px);
  }

  .followup-section {
    overflow: hidden;
  }

  .followup-section-title {
    background: var(--theme-paper-soft) !important;
    border-color: var(--theme-border) !important;
  }

  .followup-card {
    border-radius: var(--premium-radius) !important;
    box-shadow: none;
    transition: box-shadow 0.16s ease, transform 0.16s ease;
  }

  .followup-card:hover {
    box-shadow: var(--premium-shadow-soft);
    transform: translateY(-1px);
  }

  .calendar-toolbar {
    border-radius: var(--premium-radius) var(--premium-radius) 0 0 !important;
    margin-bottom: 0 !important;
  }

  .calendar-month {
    position: relative;
  }

  .calendar-grid {
    border-color: var(--theme-border) !important;
    border-radius: 0 0 var(--premium-radius) var(--premium-radius);
    box-shadow: var(--premium-shadow-soft);
    overflow: hidden;
  }

  .calendar-weekday,
  .calendar-day,
  .week-day,
  .day-drop-zone {
    border-color: var(--theme-border) !important;
  }

  .calendar-day,
  .week-day,
  .day-drop-zone {
    background: var(--theme-paper) !important;
  }

  .calendar-day.other-month {
    background: color-mix(in srgb, var(--theme-paper-soft) 78%, var(--theme-paper) 22%) !important;
  }

  .calendar-day-header,
  .week-day-header,
  .agenda-day-header {
    color: var(--theme-muted);
  }

  .day-count {
    background: var(--theme-active-soft) !important;
    color: var(--theme-primary) !important;
  }

  .calendar-item {
    border-radius: var(--premium-radius-sm) !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  .calendar-month-empty {
    position: absolute;
    top: 210px;
    left: 50%;
    z-index: 3;
    width: min(360px, calc(100% - 32px));
    min-height: 96px;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .modal,
  .catalog-modal,
  .checklist-modal,
  .system-modal,
  .identity-modal {
    border: 1px solid var(--theme-border) !important;
    border-radius: var(--premium-radius) !important;
    background: var(--theme-paper) !important;
    box-shadow: var(--premium-shadow-hover) !important;
  }

  .modal-header,
  .catalog-modal-header,
  .checklist-modal-header,
  .system-modal-header,
  .identity-modal-header {
    background: #111827 !important;
    border-color: color-mix(in srgb, #111827 84%, #ffffff 16%) !important;
    color: #ffffff !important;
  }

  .modal-body,
  .catalog-modal-body,
  .checklist-modal-body,
  .system-modal-body,
  .identity-form {
    background: color-mix(in srgb, var(--theme-paper) 96%, var(--theme-bg) 4%) !important;
  }

  .catalog-modal-actions,
  .checklist-modal-actions {
    background: var(--theme-paper);
    border-color: var(--theme-border) !important;
  }

  .installation-modal-tabs {
    gap: 8px !important;
    padding: 0 0 12px !important;
  }

  .installation-modal-tab {
    border-radius: var(--premium-radius-sm) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  .installation-modal-tab.active {
    background: #111827 !important;
    border-color: #111827 !important;
    color: #ffffff !important;
  }

  .catalog-field,
  .checklist-field,
  .form-group label,
  .identity-field label,
  .automation-settings-grid label {
    color: var(--theme-muted) !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  .system-settings-fab,
  .theme-toggle-fab {
    border-color: var(--theme-border) !important;
    background: color-mix(in srgb, var(--theme-paper) 88%, transparent) !important;
    color: var(--theme-muted) !important;
    box-shadow: var(--premium-shadow) !important;
  }

  .system-settings-fab:hover,
  .theme-toggle-fab:hover {
    color: var(--theme-text) !important;
    transform: translateY(-2px);
  }

  .catalog-empty,
  .checklist-empty,
  .empty-table-state,
  .calendar-empty-state,
  .day-empty,
  .agenda-empty,
  .followup-empty-wide,
  .installation-empty-state,
  .service-suggestion-empty,
  .history-empty,
  .system-history-empty {
    display: grid;
    gap: 6px;
    place-items: center;
    border: 1px dashed var(--theme-border) !important;
    border-radius: var(--premium-radius) !important;
    background: color-mix(in srgb, var(--theme-paper) 78%, var(--theme-paper-soft) 22%) !important;
    color: var(--theme-muted) !important;
    padding: 24px !important;
    text-align: center;
  }

  .catalog-empty strong,
  .checklist-empty strong,
  .empty-table-state strong,
  .calendar-empty-state strong,
  .day-empty strong,
  .followup-empty-wide strong {
    color: var(--theme-text) !important;
    font-size: 13px;
  }

  .catalog-empty span,
  .checklist-empty span,
  .empty-table-state span,
  .calendar-empty-state span,
  .day-empty span,
  .followup-empty-wide span {
    max-width: 360px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.45;
  }

  .empty-table-result {
    padding: 0 !important;
  }

  html[data-theme-resolved="dark"] .modal-header,
  html[data-theme-resolved="dark"] .catalog-modal-header,
  html[data-theme-resolved="dark"] .checklist-modal-header,
  html[data-theme-resolved="dark"] .system-modal-header,
  html[data-theme-resolved="dark"] .identity-modal-header,
  html[data-theme-resolved="dark"] .section-title,
  html[data-theme-resolved="dark"] .installation-modal-tab.active {
    background: #0b1220 !important;
    border-color: #1f2937 !important;
    color: #e5edf7 !important;
  }

  html[data-theme-resolved="dark"] tbody tr:hover td {
    background: color-mix(in srgb, var(--theme-active-soft) 26%, var(--theme-paper) 74%) !important;
  }

  html[data-theme-resolved="dark"] table,
  html[data-theme-resolved="dark"] tbody,
  html[data-theme-resolved="dark"] tr,
  html[data-theme-resolved="dark"] td {
    background: var(--theme-paper) !important;
    color: var(--theme-text) !important;
  }

  html[data-theme-resolved="dark"] th {
    background: var(--theme-paper-soft) !important;
    color: var(--theme-muted) !important;
  }

  html[data-theme-resolved="dark"] .code-text,
  html[data-theme-resolved="dark"] .chassi-text {
    background: rgba(15, 23, 42, 0.34) !important;
  }
}

@media screen and (max-width: 900px) {
  body[data-page="gestao"] .control-bar {
    grid-template-columns: 1fr;
  }

  .page-heading {
    order: -1;
  }

  body[data-page="gestao"] .timestamp {
    margin-left: 0;
  }
}

@media screen and (max-width: 640px) {
  .sheet,
  .container {
    padding: 12px !important;
  }

  body[data-page="catalogo"] .sheet,
  body[data-page="checklist"] .sheet,
  body[data-page="gestao"] .container {
    max-width: none;
  }

  body[data-page="gestao"] .control-bar {
    gap: 12px;
  }

  .page-heading h1,
  .top h1,
  .title-row h1 {
    font-size: 18px !important;
    overflow-wrap: anywhere;
  }

  .page-heading p {
    font-size: 11px;
  }

  .control-bar,
  .filter-bar {
    padding: 12px !important;
  }

  .view-selector {
    width: 100%;
    gap: 6px !important;
    padding: 6px !important;
  }

  .view-selector .tab-btn {
    justify-content: center;
    flex: 1 1 160px;
    min-width: 0;
    width: auto;
    white-space: normal;
  }

  .payment-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .payment-summary-card {
    min-width: 0;
  }

  .payment-summary-card span {
    overflow-wrap: anywhere;
  }

  tr {
    border-radius: var(--premium-radius) !important;
  }

  td::before {
    letter-spacing: 0 !important;
  }

  .installations-table th,
  .installations-table td {
    font-size: 11px;
    line-height: 1.25;
  }

  .installations-table tbody tr {
    height: auto;
  }

  .installations-table .status-badge,
  .installations-table .action-link {
    min-height: 34px;
    font-size: 10px;
  }

  .catalog-row-actions,
  .checklist-row-actions {
    width: 100%;
  }

  .catalog-icon-btn,
  .checklist-icon-btn {
    min-width: 38px !important;
    height: 38px !important;
  }

  .catalog-add-btn,
  .checklist-add-btn {
    width: 100%;
    justify-content: center;
  }

  .catalog-filter-empty,
  .checklist-filter-empty,
  .empty-table-state,
  .calendar-empty-state,
  .followup-empty-wide {
    padding-right: 96px !important;
  }

  .system-settings-fab {
    right: 14px !important;
    bottom: 104px !important;
    width: 40px !important;
    height: 40px !important;
    opacity: 0.72;
  }

  .theme-toggle-fab {
    right: 62px !important;
    bottom: 104px !important;
    width: 40px !important;
    height: 40px !important;
    opacity: 0.72;
  }

  .system-settings-fab:hover,
  .system-settings-fab:focus-visible,
  .theme-toggle-fab:hover,
  .theme-toggle-fab:focus-visible {
    opacity: 1;
  }

  .modal,
  .catalog-modal,
  .checklist-modal,
  .system-modal,
  .identity-modal {
    border-radius: var(--premium-radius) !important;
  }

  body[data-page="gestao"] .modal {
    border-radius: 0 !important;
  }
}
