/* Theme-specific contrast corrections. Keep layout and application behavior intact. */
html[data-theme="light"] { color-scheme: light; --control-border: #7b8798; }
html[data-theme="dark"] { color-scheme: dark; --control-border: #718096; }

/* Pale accent utilities are intended for dark surfaces, not white cards. */
html[data-theme="light"] :is(.text-purple-300,.text-purple-400) { color:#6d28d9!important; }
html[data-theme="light"] :is(.text-amber-200,.text-amber-300,.text-amber-400,.text-yellow-300,.text-yellow-400) { color:#92400e!important; }
html[data-theme="light"] :is(.text-green-300,.text-green-400,.text-emerald-300,.text-emerald-400) { color:#166534!important; }
html[data-theme="light"] :is(.text-blue-300,.text-blue-400) { color:#1d4ed8!important; }
html[data-theme="light"] :is(.text-red-300,.text-red-400) { color:#b91c1c!important; }
html[data-theme="light"] :is(.text-pink-300,.text-pink-400) { color:#9d174d!important; }

/* A field's outline must remain visible against both panel and input surfaces. */
html[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),textarea,select) {
  border-color:var(--control-border)!important;
}
html[data-theme="light"] :is(input,textarea)::placeholder { color:#64748b!important; opacity:1; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color:#a6b2c3!important; opacity:1; }
html[data-theme="dark"] select option { background:#172033; color:#f1f5f9; }
html[data-theme] :is(input,textarea,select):focus-visible {
  outline:2px solid #8b5cf6; outline-offset:2px;
}
html[data-theme="light"] :is(input,textarea,select):focus-visible { outline-color:#6d28d9; }

/* Notifications use opaque surfaces so contrast does not depend on content behind them. */
html[data-theme="light"] .toast { background:#ffffff!important; color:#172033!important; border-color:#7b8798!important; }
html[data-theme="dark"] .toast { background:#172033!important; color:#f1f5f9!important; border-color:#718096!important; }
html[data-theme="light"] .toast .toast-message { color:#172033!important; }
html[data-theme="dark"] .toast .toast-message { color:#f1f5f9!important; }
html[data-theme="light"] .toast.success { background:#ecfdf5!important; color:#166534!important; border-color:#15803d!important; }
html[data-theme="light"] .toast.error { background:#fef2f2!important; color:#b91c1c!important; border-color:#b91c1c!important; }
html[data-theme="dark"] .toast.success { background:#12382b!important; color:#bbf7d0!important; border-color:#4ade80!important; }
html[data-theme="dark"] .toast.error { background:#451d28!important; color:#fecdd3!important; border-color:#fb7185!important; }

/* Selected filters and primary actions need contrast as well as a colored fill. */
html[data-theme="light"] .filter-btn.active { color:#5b21b6; border-color:#6d28d9; }
html[data-theme="dark"] .filter-btn.active { color:#c4b5fd; border-color:#a78bfa; }
html[data-theme="dark"] :is(.hero-primary,#goStripeBtn),
html[data-theme="dark"] :is(#pricing,#contact) button.bg-gradient-to-r.from-purple-600.to-blue-600 {
  background:#6d28d9!important; border-color:#8b5cf6!important; color:#ffffff!important;
}
html[data-theme="dark"] :is(.hero-primary,#goStripeBtn):hover,
html[data-theme="dark"] :is(#pricing,#contact) button.bg-gradient-to-r.from-purple-600.to-blue-600:hover { background:#5b21b6!important; }
html[data-theme="light"] #workingHours { color:#57534e; }
html[data-theme="light"] .loss-card h2, html[data-theme="light"] .message.error { color:#b91c1c; }
html[data-theme="light"] .backup { color:#92400e; }
html[data-theme="light"] #globalCopyrightNotice { color:#4b5563!important; background:#f1f3f6!important; }
html[data-theme="dark"] #globalCopyrightNotice { color:#a6b2c3!important; }
html[data-theme="light"] #sidebar.sidebar { background:#f1f3f6; }
html[data-theme="light"] #sidebar button[onclick="logout()"] { background:#fef2f2; color:#b91c1c!important; border-color:#fca5a5; }
html[data-theme="dark"] #sidebar .text-gray-500 { color:#a6b2c3!important; }
html[data-theme="light"] .btn-tertiary { color:#6d28d9; }
html[data-theme="dark"] .btn-tertiary { color:#c4b5fd; }
html[data-theme="light"] #cancelBtn { background:#fef2f2; color:#b91c1c!important; border-color:#b91c1c; }

/* Consistent select controls: leave room for the arrow instead of pinning it to the edge. */
html[data-theme] select {
  appearance:none!important;
  -webkit-appearance:none!important;
  min-height:42px;
  padding-inline-end:2.75rem!important;
  border-radius:12px!important;
  background-repeat:no-repeat!important;
  background-size:18px 18px!important;
  background-position:right 13px center!important;
  background-image: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='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;
}
html[dir="rtl"][data-theme] select { background-position:left 13px center!important; }
html[data-theme="dark"] select {
  background-image: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='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;
}
html[data-theme] select:disabled { opacity:.68; cursor:not-allowed; }
html[data-theme="light"] select option { background:#fff; color:#172033; }
html[data-theme="dark"] select option { background:#172033; color:#f1f5f9; }
