/* RuteoFleet — design tokens (claro / oscuro) */
:root,
html[data-theme="light"] {
  --rf-bg: #f1f5f9;
  --rf-panel: #ffffff;
  --rf-panel-2: #f8fafc;
  --rf-border: #cbd5e1;
  --rf-text: #0f172a;
  --rf-muted: #64748b;
  --rf-accent: #16a34a;
  --rf-accent-soft: rgba(22, 163, 74, 0.12);
  --rf-moving: #22c55e;
  --rf-idle: #f59e0b;
  --rf-stopped: #ef4444;
  --rf-map-bg: #dbe3ea;
  --rf-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  --rf-wa: #25d366;
  --rf-history: #2563eb;
  /* Desconexión: sombreado fila (alineado al WiFi: ámbar → rojo → gris) */
  --rf-stale-1: #fef3c7;
  --rf-stale-1-hover: #fde68a;
  --rf-stale-1-border: #d97706;
  --rf-stale-2: #fee2e2;
  --rf-stale-2-hover: #fecaca;
  --rf-stale-2-border: #dc2626;
  --rf-stale-3: #e2e8f0;
  --rf-stale-3-hover: #cbd5e1;
  --rf-stale-3-border: #475569;
  --rf-signal-ok: #16a34a;
  --rf-signal-warn: #d97706;
  --rf-signal-bad: #dc2626;
  --rf-signal-off: #64748b;
  --sidebar-w: 320px;
  --topbar-h: 56px;
}

html[data-theme="dark"] {
  --rf-bg: #0f172a;
  --rf-panel: #1e293b;
  --rf-panel-2: #0f172a;
  --rf-border: #334155;
  --rf-text: #f8fafc;
  --rf-muted: #94a3b8;
  --rf-accent: #22c55e;
  --rf-accent-soft: rgba(34, 197, 94, 0.15);
  --rf-moving: #22c55e;
  --rf-idle: #f59e0b;
  --rf-stopped: #ef4444;
  --rf-map-bg: #0f172a;
  --rf-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  --rf-wa: #25d366;
  --rf-history: #3b82f6;
  --rf-stale-1: rgba(245, 158, 11, 0.32);
  --rf-stale-1-hover: rgba(245, 158, 11, 0.48);
  --rf-stale-1-border: #fbbf24;
  --rf-stale-2: rgba(239, 68, 68, 0.34);
  --rf-stale-2-hover: rgba(239, 68, 68, 0.5);
  --rf-stale-2-border: #f87171;
  --rf-stale-3: rgba(100, 116, 139, 0.4);
  --rf-stale-3-hover: rgba(100, 116, 139, 0.55);
  --rf-stale-3-border: #94a3b8;
  --rf-signal-ok: #4ade80;
  --rf-signal-warn: #fbbf24;
  --rf-signal-bad: #f87171;
  --rf-signal-off: #94a3b8;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  background: var(--rf-bg);
  color: var(--rf-text);
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
}

#map {
  height: 100%;
  width: 100%;
}

.leaflet-container {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--rf-map-bg);
}

.leaflet-container img.leaflet-tile,
.leaflet-container .leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  width: 256px;
  height: 256px;
}

.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-marker-shadow,
.leaflet-container .leaflet-image-layer,
.leaflet-container .leaflet-pane > svg {
  max-width: none !important;
}

html[data-theme="dark"] .leaflet-control-zoom a,
html[data-theme="dark"] .leaflet-control-layers,
html[data-theme="dark"] .leaflet-bar a {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

html[data-theme="dark"] .leaflet-bar a:hover {
  background: #334155;
}

html[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.85);
  color: #94a3b8;
}

html[data-theme="dark"] .leaflet-popup-content-wrapper {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: var(--rf-shadow);
}

html[data-theme="dark"] .leaflet-popup-tip {
  background: #1e293b;
}

html[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #fff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}

/* Brand */
.brand-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.05;
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--rf-text);
}

.brand-mark .brand-fleet {
  color: var(--rf-accent);
}

.brand-sub {
  color: var(--rf-muted);
  font-size: 0.58rem;
  font-weight: 600;
  margin-top: 0.15rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

/* Topbar */
#topbar {
  height: var(--topbar-h);
  background: var(--rf-panel);
  border-bottom: 1px solid var(--rf-border);
  box-shadow: var(--rf-shadow);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--rf-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--rf-text);
}

.nav-item.active {
  color: var(--rf-accent);
  border-bottom-color: var(--rf-accent);
}

.mobile-nav-item {
  border-bottom: none;
  border-left: 3px solid transparent;
  padding: 0.75rem 1rem;
  color: var(--rf-muted);
}

.mobile-nav-item.active {
  border-left-color: var(--rf-accent);
  background: var(--rf-accent-soft);
  color: var(--rf-accent);
}

.topbar-search {
  width: 11rem;
  max-width: 28vw;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-text);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
}

.topbar-search::placeholder {
  color: var(--rf-muted);
}

.theme-toggle {
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.theme-toggle:hover {
  color: var(--rf-text);
  border-color: var(--rf-accent);
}

#sync-meta,
#live-clock {
  display: none !important;
}

.profile-menu {
  position: relative;
}

.profile-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-text);
  cursor: pointer;
}

.profile-btn:hover,
.profile-menu.is-open .profile-btn {
  border-color: var(--rf-accent);
  color: var(--rf-accent);
}

.profile-btn-icon {
  display: block;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 14rem;
  background: var(--rf-panel);
  border: 1px solid var(--rf-border);
  border-radius: 10px;
  box-shadow: var(--rf-shadow);
  z-index: 1200;
  overflow: hidden;
}

.profile-dropdown-head {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--rf-border);
}

.profile-dropdown-name {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rf-text);
  word-break: break-all;
}

.profile-dropdown-meta {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  color: var(--rf-muted);
  line-height: 1.35;
}

.profile-dropdown-item {
  width: 100%;
  display: block;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--rf-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}

.profile-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--rf-stopped);
}

/* Login — inspirado en portales telemáticos (fondo full-bleed + tarjeta centrada) */
#login-screen.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: #0b1220;
}

/* Debe ganar a display:flex del login (si no, la sesión entra pero la pantalla tapa el mapa) */
#login-screen.login-screen.hidden {
  display: none !important;
}

.login-bg {
  position: absolute;
  inset: 0;
  background-image: url("/static/assets/login-bg.png");
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  animation: loginBgDrift 28s ease-in-out infinite alternate;
}

.login-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(8, 15, 28, 0.72) 0%,
    rgba(11, 22, 40, 0.55) 45%,
    rgba(8, 15, 28, 0.78) 100%
  );
}

@keyframes loginBgDrift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.06) translate3d(-1.2%, -0.8%, 0);
  }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
}

.login-card {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  padding: 1.75rem 1.6rem 1.35rem;
  backdrop-filter: blur(10px);
}

html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.login-brand-mark {
  font-size: 1.85rem;
}

.login-tagline {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

html[data-theme="light"] .login-tagline {
  color: #64748b;
}

.login-title {
  margin: 1.35rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

html[data-theme="light"] .login-field label {
  color: #64748b;
}

.login-field input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
}

html[data-theme="light"] .login-field input {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.login-field input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap input {
  padding-right: 2.6rem;
}

.login-eye {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.7;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.35rem;
}

.login-eye:hover {
  opacity: 1;
}

.login-error {
  margin: 0;
  font-size: 0.82rem;
  color: #f87171;
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
  border: none;
  border-radius: 999px;
  background: #22c55e;
  color: #04140a;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.78rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.login-submit:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.login-submit:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.login-footer {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.login-bypass {
  font-size: 0.72rem;
  color: #94a3b8;
}

.login-legal {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.72);
  letter-spacing: 0.01em;
}

.login-legal a {
  color: #86efac;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-legal a:hover {
  color: #bbf7d0;
}

html[data-theme="light"] .login-legal {
  color: rgba(51, 65, 85, 0.75);
}

html[data-theme="light"] .login-legal a {
  color: var(--rf-accent);
}

.btn-primary {
  background: var(--rf-accent);
  color: #04140a;
  font-weight: 700;
}

html[data-theme="light"] .btn-primary {
  color: #fff;
}

/* Markers: flecha verde / STOP octágono (sin círculo) */
.fleet-marker {
  background: transparent;
  border: none;
}

.marker-arrow-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.marker-arrow {
  display: block;
}

.marker-stop-pin {
  line-height: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.marker-stop-pin svg {
  display: block;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.status-moving {
  background: rgba(34, 197, 94, 0.18);
  color: var(--rf-moving);
}

.status-idle {
  background: rgba(245, 158, 11, 0.18);
  color: var(--rf-idle);
}

.status-stopped {
  background: rgba(239, 68, 68, 0.18);
  color: var(--rf-stopped);
}

/* Popup */
.vehicle-popup h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.vehicle-popup .meta {
  font-size: 0.75rem;
  color: var(--rf-muted);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.btn-history,
.btn-whatsapp {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  color: #ffffff !important;
}

.btn-history {
  background: var(--rf-history);
  color: #ffffff !important;
}

.btn-whatsapp {
  background: var(--rf-wa);
  color: #ffffff !important;
}

.vehicle-popup a.btn-history,
.vehicle-popup button.btn-history,
.vehicle-popup a.btn-whatsapp {
  color: #ffffff !important;
}

.leaflet-container a.btn-history,
.leaflet-container a.btn-whatsapp {
  color: #ffffff !important;
}

/* Layout mapa */
#view-mapa:not(.hidden) {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

#view-mapa.hidden {
  display: none !important;
}

#mapa-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  max-width: 85vw;
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: var(--rf-panel);
  border-right: 1px solid var(--rf-border);
  min-height: 0;
}

#mapa-sidebar.mapa-sidebar-closed {
  display: none;
}

#mapa-show-list {
  display: none;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  background: var(--rf-panel);
  border-right: 1px solid var(--rf-border);
  color: var(--rf-text);
  z-index: 1;
}

#mapa-show-list.mapa-show-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-mapa > main,
.mapa-main {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
}

#view-mapa > main #map {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}

.map-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rf-panel);
  border: 1px solid var(--rf-border);
  border-radius: 4px;
  box-shadow: var(--rf-shadow);
  color: var(--rf-text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.leaflet-top.leaflet-right {
  top: 3.1rem;
  right: 10px;
}

#view-mapa:fullscreen,
#view-mapa:-webkit-full-screen {
  background: var(--rf-bg);
  width: 100%;
  height: 100%;
}

.writing-mode-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* Sidebar controls */
.sidebar-select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.sidebar-check-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--rf-text);
  cursor: pointer;
  user-select: none;
}

.sidebar-check-all input {
  accent-color: var(--rf-accent);
}

.sidebar-select-btn {
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-text);
  cursor: pointer;
  border-radius: 4px;
}

.sidebar-select-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vehicle-item {
  cursor: pointer;
  color: var(--rf-text);
  border-left: 3px solid transparent;
}

/* 30 min–2 h → ámbar (mismo nivel que WiFi amarillo) */
.vehicle-item.stale-blue {
  background: var(--rf-stale-1);
  border-left-color: var(--rf-stale-1-border);
}

/* 2–6 h → rojo (mismo nivel que WiFi rojo) */
.vehicle-item.stale-yellow {
  background: var(--rf-stale-2);
  border-left-color: var(--rf-stale-2-border);
}

/* > 6 h → gris pizarra (mismo nivel que WiFi gris) */
.vehicle-item.stale-gray {
  background: var(--rf-stale-3);
  border-left-color: var(--rf-stale-3-border);
}

.vehicle-item:hover,
.vehicle-item.is-selected {
  background: var(--rf-accent-soft);
}

.vehicle-item.stale-blue:hover,
.vehicle-item.stale-blue.is-selected {
  background: var(--rf-stale-1-hover);
}

.vehicle-item.stale-yellow:hover,
.vehicle-item.stale-yellow.is-selected {
  background: var(--rf-stale-2-hover);
}

.vehicle-item.stale-gray:hover,
.vehicle-item.stale-gray.is-selected {
  background: var(--rf-stale-3-hover);
}

.placa-row,
.popup-placa-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.signal-wifi {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.signal-wifi svg {
  display: block;
}

.signal-wifi .sw-dot {
  fill: currentColor;
}

.signal-wifi .sw-bar {
  stroke: currentColor;
  opacity: 0.28;
}

.signal-wifi[data-level="1"] .sw-b1,
.signal-wifi[data-level="2"] .sw-b1,
.signal-wifi[data-level="2"] .sw-b2,
.signal-wifi[data-level="3"] .sw-b1,
.signal-wifi[data-level="3"] .sw-b2,
.signal-wifi[data-level="3"] .sw-b3 {
  opacity: 1;
}

.signal-fresh {
  color: var(--rf-signal-ok);
}

.signal-blue {
  color: var(--rf-signal-warn);
}

.signal-yellow {
  color: var(--rf-signal-bad);
}

.signal-gray {
  color: var(--rf-signal-off);
}

.flota-filters {
  max-width: 28rem;
}

.cuentas-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

@media (min-width: 640px) {
  .cuentas-filters {
    grid-template-columns: 1.4fr 1fr 0.85fr;
  }
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.th-sort:hover,
.th-sort.is-active {
  color: var(--rf-text);
}

.th-sort .sort-ind {
  font-size: 0.65rem;
  opacity: 0.85;
  min-width: 0.7rem;
}

.flota-table tbody tr.stale-blue,
.flota-table tbody tr.stale-yellow,
.flota-table tbody tr.stale-gray {
  border-left: 3px solid transparent;
}

.flota-table tbody tr.stale-blue {
  background: var(--rf-stale-1);
  border-left-color: var(--rf-stale-1-border);
}

.flota-table tbody tr.stale-yellow {
  background: var(--rf-stale-2);
  border-left-color: var(--rf-stale-2-border);
}

.flota-table tbody tr.stale-gray {
  background: var(--rf-stale-3);
  border-left-color: var(--rf-stale-3-border);
}

.sidebar-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.sidebar-filter {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.sidebar-filter > span {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rf-muted);
}

.sidebar-filter select {
  width: 100%;
  font-size: 0.7rem;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-text);
}

.vehicle-item-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.vehicle-item-check {
  margin-top: 0.15rem;
  accent-color: var(--rf-accent);
}

.vehicle-item-body {
  flex: 1;
  min-width: 0;
}

.placa {
  font-weight: 800;
  font-size: 0.8rem;
}

/* Panels Flota / Proveedores */
.rf-page {
  background: var(--rf-bg);
}

.rf-card {
  background: var(--rf-panel);
  border: 1px solid var(--rf-border);
  box-shadow: var(--rf-shadow);
  color: var(--rf-text);
}

.rf-card h2,
.rf-muted {
  color: var(--rf-muted);
}

.rf-card h2.rf-title {
  color: var(--rf-text);
}

.rf-input,
.rf-card input,
.rf-card select,
#provider-form input,
#provider-form select {
  background: var(--rf-panel-2);
  border: 1px solid var(--rf-border);
  color: var(--rf-text);
}

.provider-card {
  border: 1px solid var(--rf-border);
  padding: 0.75rem;
  background: var(--rf-panel-2);
  border-radius: 8px;
}

.provider-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.provider-card .actions button {
  flex: 1;
  min-width: 5rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.4rem;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel);
  color: var(--rf-text);
  cursor: pointer;
  border-radius: 4px;
}

.provider-card .actions button.danger {
  color: var(--rf-stopped);
}

.provider-rename-btn {
  border: none;
  background: transparent;
  color: var(--rf-muted);
  cursor: pointer;
}

.provider-rename-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--rf-border);
  background: var(--rf-panel);
  color: var(--rf-text);
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.provider-rename-save,
.provider-rename-cancel {
  border: 1px solid var(--rf-border);
  background: var(--rf-panel);
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
}

.provider-rename-save {
  color: var(--rf-moving);
}

.provider-rename-cancel {
  color: var(--rf-stopped);
}

.terms-scroll {
  max-height: 9.5rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.terms-block {
  border: 1px solid var(--rf-border);
  background: var(--rf-panel-2);
  color: var(--rf-text);
}

.terms-block.terms-locked {
  opacity: 0.72;
  filter: grayscale(0.25);
}

#provider-modal {
  background: rgba(15, 23, 42, 0.65);
}

#provider-form {
  background: var(--rf-panel);
  color: var(--rf-text);
}

#mobile-nav > div:last-child {
  background: var(--rf-panel);
  border-color: var(--rf-border);
}

@media (max-width: 640px) {
  :root {
    --sidebar-w: 260px;
  }

  .brand-sub {
    max-width: 7.5rem;
  }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--rf-panel-2);
}

::-webkit-scrollbar-thumb {
  background: var(--rf-border);
  border-radius: 4px;
}
