/* Admin light/dark theme. Applied when <html class="dark"> is set by admin-theme.js. */
html.dark {
  color-scheme: dark;
}

[data-theme-icon="moon"] { display: none; }
html.dark [data-theme-icon="moon"] { display: block; }
html.dark [data-theme-icon="sun"] { display: none; }

html.dark body {
  background-color: #0b1220;
  color: #e2e8f0;
}

/* Surfaces */
html.dark .bg-white { background-color: #1e293b !important; }
html.dark .bg-slate-50 { background-color: #0b1220 !important; }
html.dark .bg-slate-100 { background-color: #1e293b !important; }
html.dark .bg-slate-50\/80 { background-color: #162033 !important; }
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-50\/60:hover,
html.dark .hover\:bg-slate-50\/80:hover { background-color: #1e293b !important; }
html.dark .hover\:bg-white:hover { background-color: #334155 !important; }
html.dark .hover\:bg-blue-50:hover { background-color: #1e3a5f !important; }

/* Text */
html.dark .text-slate-900 { color: #f8fafc !important; }
html.dark .text-slate-800 { color: #e2e8f0 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600 { color: #94a3b8 !important; }
html.dark .text-slate-500 { color: #94a3b8 !important; }
html.dark .text-slate-400 { color: #64748b !important; }
html.dark .text-slate-300 { color: #94a3b8 !important; }
html.dark .hover\:text-slate-500:hover { color: #cbd5e1 !important; }

html.dark .text-blue-600,
html.dark .text-blue-700,
html.dark .text-blue-800 { color: #93c5fd !important; }
html.dark .hover\:text-blue-600:hover { color: #bfdbfe !important; }
html.dark .text-emerald-700,
html.dark .text-emerald-800 { color: #6ee7b7 !important; }
html.dark .text-amber-600,
html.dark .text-amber-700,
html.dark .text-amber-800 { color: #fcd34d !important; }
html.dark .text-red-600,
html.dark .text-red-700,
html.dark .text-red-800 { color: #fca5a5 !important; }
html.dark .text-violet-700 { color: #c4b5fd !important; }

/* Device status column — works in light and dark (not Tailwind-purged). */
.device-status-ready { color: #16a34a; }
.device-status-scheduled { color: #4f46e5; }
.device-status-sleep { color: #64748b; }
.device-status-paused { color: #ca8a04; }
.device-stats-paused { color: #eab308; }
.device-status-testing { color: #ca8a04; }
.device-status-history { color: #d97706; }
.device-status-busy { color: #ea580c; }
.device-status-offline,
.device-status-disconnected,
.device-status-switch-failed,
.device-status-relogin-failed { color: #dc2626; }
.device-status-switching,
.device-status-relogging { color: #2563eb; }
.device-status-pending-approval { color: #9333ea; }

html.dark .device-status-ready { color: #4ade80 !important; }
html.dark .device-status-scheduled { color: #a5b4fc !important; }
html.dark .device-status-sleep { color: #94a3b8 !important; }
html.dark .device-status-paused { color: #facc15 !important; }
html.dark .device-stats-paused { color: #facc15 !important; }
html.dark .device-status-testing { color: #facc15 !important; }
html.dark .device-status-history { color: #fbbf24 !important; }
html.dark .device-status-busy { color: #fb923c !important; }
html.dark .device-status-offline,
html.dark .device-status-disconnected,
html.dark .device-status-switch-failed,
html.dark .device-status-relogin-failed { color: #fca5a5 !important; }
html.dark .device-status-switching,
html.dark .device-status-relogging { color: #93c5fd !important; }
html.dark .device-status-pending-approval { color: #c084fc !important; }

/* Borders */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300 { border-color: #334155 !important; }
html.dark .border-blue-200 { border-color: #1d4ed8 !important; }
html.dark .border-emerald-200,
html.dark .border-emerald-300 { border-color: #047857 !important; }
html.dark .border-amber-200 { border-color: #b45309 !important; }
html.dark .border-red-200 { border-color: #b91c1c !important; }
html.dark .divide-slate-50 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: #1e293b; }

/* Soft status chips / alerts */
html.dark .bg-emerald-50 { background-color: #064e3b !important; }
html.dark .bg-amber-50 { background-color: #78350f !important; }
html.dark .bg-red-50 { background-color: #7f1d1d !important; }
html.dark .bg-blue-50 { background-color: #1e3a5f !important; }
html.dark .bg-violet-50 { background-color: #4c1d95 !important; }
html.dark .border-emerald-200 { border-color: #065f46 !important; }
html.dark .border-amber-200 { border-color: #92400e !important; }
html.dark .border-red-200 { border-color: #991b1b !important; }

/* Form controls */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b;
}
html.dark option {
  background-color: #1e293b;
  color: #e2e8f0;
}

/* Cards / tables that use shadow on white */
html.dark .shadow-sm {
  --tw-shadow-color: rgb(0 0 0 / 0.45);
}

/* Keep primary actions readable */
html.dark .bg-blue-600 { background-color: #2563eb !important; }
html.dark .hover\:bg-blue-700:hover { background-color: #1d4ed8 !important; }
html.dark .bg-slate-800 { background-color: #334155 !important; }
html.dark .hover\:bg-slate-900:hover { background-color: #1e293b !important; }

/* Custom filter multi-select (dp-ms) — hardcoded light colors in admin-multiselect.css */
html.dark .dp-ms-control {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
html.dark .dp-ms-placeholder { color: #64748b; }
html.dark .dp-ms-input,
html.dark .dp-ms-input:focus {
  background: transparent !important;
  color: #e2e8f0 !important;
  border: 0 !important;
  box-shadow: none !important;
}
html.dark .dp-ms-input::placeholder { color: #64748b; }
html.dark .dp-ms-toggle { color: #94a3b8; }
html.dark .dp-ms-toggle:hover { color: #e2e8f0; }
html.dark .dp-ms-chip {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}
html.dark .dp-ms-chip-remove { color: #94a3b8; }
html.dark .dp-ms-chip-remove:hover {
  background: #334155;
  color: #f8fafc;
}
html.dark .dp-ms-dropdown {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}
html.dark .dp-ms-actions {
  background: #0f172a;
  border-bottom-color: #334155;
}
html.dark .dp-ms-action { color: #93c5fd; }
html.dark .dp-ms-action:hover:not(:disabled) {
  background: #1e3a5f;
  color: #bfdbfe;
}
html.dark .dp-ms-action:disabled { color: #64748b; }
html.dark .dp-ms-action-sep { background: #334155; }
html.dark .dp-ms-option:hover { background: #0f172a; }
html.dark .dp-ms-option span { color: #e2e8f0; }

/* Date inputs stay readable in Chromium */
html.dark input[type="date"] {
  color-scheme: dark;
}

/* Company portal sidebar collapse — icons only */
[data-admin-sidebar] {
  width: 14rem;
  transition: width 0.2s ease;
}
[data-sidebar-brand-mini],
[data-sidebar-icon-out],
[data-sidebar-chevron="expand"] { display: none; }
html.sidebar-collapsed [data-sidebar-chevron="collapse"] { display: none; }
html.sidebar-collapsed [data-sidebar-chevron="expand"] { display: block; }
html.sidebar-collapsed [data-admin-sidebar] {
  width: 3.75rem;
}
html.sidebar-collapsed [data-sidebar-label],
html.sidebar-collapsed [data-sidebar-brand-text],
html.sidebar-collapsed [data-sidebar-user] {
  display: none;
}
html.sidebar-collapsed [data-sidebar-brand-mini],
html.sidebar-collapsed [data-sidebar-icon-out] {
  display: block;
}
html.sidebar-collapsed [data-admin-sidebar] nav a,
html.sidebar-collapsed [data-theme-toggle] {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
html.sidebar-collapsed [data-admin-sidebar] .border-b,
html.sidebar-collapsed [data-admin-sidebar] .border-t {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
html.sidebar-collapsed [data-sidebar-header] {
  justify-content: center;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
html.sidebar-collapsed [data-theme-toggle] {
  margin-bottom: 0.5rem;
}
html.sidebar-collapsed [data-admin-sidebar] form {
  display: flex;
  justify-content: center;
}
html.sidebar-collapsed [data-admin-sidebar] form button {
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-sidebar-group-toggle] {
  display: flex;
  align-items: center;
  width: 100%;
}
[data-sidebar-group-toggle] [data-sidebar-label] {
  flex: 1 1 auto;
}
[data-sidebar-group-chevron] {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  overflow: visible;
  transition: transform 0.15s ease;
}
[data-sidebar-sub] { display: block; }
[data-sidebar-sub] a { padding-left: 2.25rem; }
[data-sidebar-group].is-closed [data-sidebar-sub] { display: none; }
[data-sidebar-group]:not(.is-closed) [data-sidebar-group-chevron] { transform: rotate(180deg); }
html.sidebar-collapsed [data-sidebar-sub] { display: none !important; }
html.sidebar-collapsed [data-sidebar-group-chevron] { display: none; }
html.sidebar-collapsed [data-sidebar-group-toggle] {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

[data-sidebar-alert-badge] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  margin-left: auto;
  border-radius: 9999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
[data-sidebar-alert-badge].is-new {
  animation: device-alert-badge-pop 0.55s ease;
}
@keyframes device-alert-badge-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
html.sidebar-collapsed [data-sidebar-alert-badge] {
  position: absolute;
  top: 0.12rem;
  right: 0.12rem;
  margin-left: 0;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.18rem;
  font-size: 9px;
}
