/* Shared HIS interface only. Print documents keep their own stylesheet.
   Legacy neutral text follows its surface; solid actions keep white labels. */
@media screen {
  html.light {
    --foreground: 222 47% 11%;
    --muted-foreground: 215 20% 35%;
  }
  html.light :is(.text-white, [class~="text-white/80"], [class~="text-white/70"],
    [class~="text-white/60"], [class~="text-white/50"],
    .text-slate-100, .text-slate-200, .text-slate-300,
    .text-gray-100, .text-gray-200, .text-gray-300,
    [class~="text-[#f0f6fc]"], [class~="text-[#edf2f6]"],
    [class~="text-[#b7c2cc]"], [class~="text-[#c1ccd5]"],
    [class~="text-[#e6edf3]"], [class~="text-[#c9d1d9]"]) {
    color: #0f172a !important;
  }
  html.light :is(.text-muted-foreground, .text-slate-400, .text-gray-400,
    [class~="text-[#8b949e]"], [class~="text-[#6e7681]"],
    [class~="text-[#484f58]"], [class~="text-[#30363d]"],
    [class~="text-[#9aa7b4]"], [class~="text-[#9ba6b1]"],
    [class~="text-[#778392]"], [class~="text-[#aab5bf]"],
    [class~="text-[#687687]"]) {
    color: #475569 !important;
  }
  html.light [class~="hover:text-white"]:hover { color: #0f172a !important; }
  html.light :is([class~="from-[#1f6feb]"], [class~="from-[#58a6ff]"]) { --tw-gradient-from: #1d4ed8 !important; }
  html.light [class~="from-[#ec4899]"] { --tw-gradient-from: #9d174d !important; }
  html.light [class~="to-[#58a6ff]"] { --tw-gradient-to: #1d4ed8 !important; }
  html.light :is([class~="to-[#8b5cf6]"], [class~="to-[#a371f7]"]) { --tw-gradient-to: #6d28d9 !important; }
  html.light [class~="via-[#3fb950]"] { --tw-gradient-via: #166534 !important; }
  html.light :is([class~="from-[#1f6feb]"], [class~="from-[#58a6ff]"], [class~="from-[#ec4899]"]) {
    color: #ffffff !important;
  }
  html.light :is([class~="from-[#1f6feb]"], [class~="from-[#58a6ff]"], [class~="from-[#ec4899]"])
    :is(.text-white, .text-foreground, [class~="text-white/80"]) { color: #ffffff !important; }
  html.light .rp-on-dark :is([style^="color: rgb(255, 255, 255)"],
    [style*="; color: rgb(255, 255, 255)"]) { color: #ffffff !important; }
  html.light :is([style^="color: rgb(255, 255, 255)"], [style*="; color: rgb(255, 255, 255)"],
    [style^="color: rgb(230, 237, 243)"], [style*="; color: rgb(230, 237, 243)"],
    [style^="color: rgb(201, 209, 217)"], [style*="; color: rgb(201, 209, 217)"],
    [style^="color: rgb(240, 246, 252)"], [style*="; color: rgb(240, 246, 252)"]) {
    color: #0f172a !important;
  }
  html.light svg text:is([fill="#8b949e"], [fill="#6e7681"],
    [fill="#484f58"], [fill="#c9d1d9"], [fill="#e6edf3"]) { fill: #475569 !important; }
  html.light :is([class~="bg-[#111820]"], [class~="bg-[#111827]"],
    [class~="bg-[#151d25]"], [class~="bg-[#162033]"],
    [class~="bg-[#18212b]"], [class~="bg-[#202b35]"],
    [class~="bg-[#202b36]"], [class~="bg-[#241b1d]"],
    [class~="bg-[#2d2a3d]"], [class~="bg-[#47232e]"],
    [class~="bg-[#484f58]"], .bg-slate-950, .bg-zinc-900) {
    background-color: var(--color-card) !important;
    color: #0f172a;
  }
  /* Status hues retain their meaning rather than turning all values black. */
  html.light :is([class~="text-[#f87171]"], [class~="text-[#f85149]"],
    [class~="text-[#ff7b72]"], [class~="text-[#ffb0a8]"],
    [class~="text-[#ffb1b8]"], [class~="text-[#ffb4ad]"],
    [class~="text-[#ef4444]"], [class~="text-[#da3633]"],
    [class~="text-[#ef4444]/70"], .text-red-400, .text-red-500) { color: #b91c1c !important; }
  html.light :is([class~="text-[#10b981]"], [class~="text-[#3fb950]"],
    [class~="text-[#39aa82]"], [class~="text-[#238636]"],
    .text-emerald-400, .text-emerald-500, .text-green-400, .text-green-500) { color: #166534 !important; }
  html.light :is([class~="text-[#f59e0b]"], [class~="text-[#e3b341]"],
    [class~="text-[#d29922]"], [class~="text-[#f5c451]"],
    [class~="text-[#e7a333]"], [class~="text-[#f0883e]"],
    [class~="text-[#f59149]"], [class~="text-[#f97316]"],
    .text-amber-400, .text-amber-500, .text-yellow-400, .text-yellow-500,
    .text-orange-400, .text-orange-500) { color: #92400e !important; }
  html.light :is([class~="text-[#58a6ff]"], [class~="text-[#79b8ff]"],
    [class~="text-[#79c0ff]"], [class~="text-[#3483fa]"],
    [class~="text-[#1f6feb]"], .text-blue-400, .text-blue-500,
    .text-sky-400, .text-sky-500, .text-cyan-400, .text-cyan-500) { color: #1d4ed8 !important; }
  html.light :is([class~="text-[#bc8cff]"], [class~="text-[#bc8cff]/70"],
    [class~="text-[#a371f7]"], [class~="text-[#a78bfa]"],
    [class~="text-[#a5b4fc]"], [class~="text-[#8957e5]"],
    [class~="text-[#8b5cf6]"], [class~="text-[#ec4899]"],
    .text-purple-400, .text-purple-500, .text-violet-400, .text-violet-500,
    .text-pink-400, .text-pink-500, .text-indigo-400) { color: #6d28d9 !important; }

  html.light :is(input, textarea, select) {
    color: #0f172a !important;
    background-color: var(--color-card) !important;
    color-scheme: light;
  }
  html.light :is(input, textarea)::placeholder { color: #475569 !important; opacity: 1 !important; }
  html.light select option { color: #0f172a !important; background-color: #ffffff !important; }
  html.light input[type="date"]::-webkit-calendar-picker-indicator { filter: none; opacity: .8; }
  html.light input[type="month"]::-webkit-calendar-picker-indicator { filter: none; opacity: .8; }

  /* Opaque colored controls: never confuse them with translucent status chips. */
  html.light :is([class~="bg-primary"], [class~="bg-[#1f6feb]"],
    [class~="bg-[#388bfd]"], [class~="bg-[#58a6ff]"],
    [class~="bg-[#3182ce]"], [class~="bg-[#4090e0]"], [class~="bg-[#4493e8]"]) {
    background-color: #1d4ed8 !important;
  }
  html.light :is([class~="bg-primary"]) { background-color: #be123c !important; }
  html.light :is([class~="bg-[#10b981]"], [class~="bg-[#059669]"],
    [class~="bg-[#238636]"], [class~="bg-[#2ea043]"],
    [class~="bg-[#3fb950]"], [class~="bg-[#4db660]"], [class~="bg-[#56d364]"]) {
    background-color: #047857 !important;
  }
  html.light :is([class~="bg-[#f59e0b]"], [class~="bg-[#e3b341]"],
    [class~="bg-[#d97706]"], [class~="bg-[#f97316]"]) { background-color: #b45309 !important; }
  html.light :is([class~="bg-[#ef4444]"], [class~="bg-[#da3633]"],
    [class~="bg-[#dc2626]"], [class~="bg-[#f85149]"], [class~="bg-[#e4574a]"],
    [class~="bg-[#b32d2a]"]) { background-color: #b91c1c !important; }
  html.light :is([class~="bg-[#8b5cf6]"], [class~="bg-[#8957e5]"],
    [class~="bg-[#a371f7]"], [class~="bg-[#bc8cff]"],
    [class~="bg-[#ec4899]"], [class~="bg-[#db2777]"]) { background-color: #7e22ce !important; }

  /* Explicit solid surfaces also protect nested labels from neutral remapping. */
  html.light :is(.rp-on-dark, .academia-hero, .rp-solid-success, .rp-solid-warning,
    [class~="bg-primary"], [class~="bg-destructive"], [class~="bg-[#1f6feb]"],
    [class~="bg-[#388bfd]"], [class~="bg-[#58a6ff]"], [class~="bg-[#3182ce]"],
    [class~="bg-[#4090e0]"], [class~="bg-[#4493e8]"], [class~="bg-[#10b981]"],
    [class~="bg-[#059669]"], [class~="bg-[#238636]"], [class~="bg-[#2ea043]"],
    [class~="bg-[#3fb950]"], [class~="bg-[#4db660]"], [class~="bg-[#56d364]"],
    [class~="bg-[#f59e0b]"], [class~="bg-[#e3b341]"], [class~="bg-[#d97706]"],
    [class~="bg-[#f97316]"], [class~="bg-[#ef4444]"], [class~="bg-[#da3633]"],
    [class~="bg-[#dc2626]"], [class~="bg-[#f85149]"], [class~="bg-[#e4574a]"],
    [class~="bg-[#b32d2a]"], [class~="bg-[#8b5cf6]"], [class~="bg-[#8957e5]"],
    [class~="bg-[#a371f7]"], [class~="bg-[#bc8cff]"], [class~="bg-[#ec4899]"],
    [class~="bg-[#db2777]"]) {
    color: #ffffff !important;
  }
  html.light :is([class~="bg-primary"], [class~="bg-destructive"],
    [class~="bg-[#1f6feb]"], [class~="bg-[#388bfd]"], [class~="bg-[#10b981]"],
    [class~="bg-[#f59e0b]"], [class~="bg-[#ef4444]"], [class~="bg-[#dc2626]"]):hover {
    color: #ffffff !important;
  }
  html.light :is(.rp-on-dark, .academia-hero, .rp-solid-success, .rp-solid-warning,
    [class~="bg-primary"], [class~="bg-destructive"], [class~="bg-[#1f6feb]"],
    [class~="bg-[#388bfd]"], [class~="bg-[#58a6ff]"], [class~="bg-[#10b981]"],
    [class~="bg-[#f59e0b]"], [class~="bg-[#ef4444]"], [class~="bg-[#dc2626]"],
    [class~="bg-[#da3633]"], [class~="bg-[#8b5cf6]"], [class~="bg-[#ec4899]"])
    :is(.text-white, .text-foreground, .text-muted-foreground,
      [class~="text-white/80"], [class~="text-white/70"], [class~="text-white/60"]) {
    color: #ffffff !important;
  }
  html.light :is([class~="bg-[#059669]"], [class~="bg-[#238636]"],
    [class~="bg-[#2ea043]"], [class~="bg-[#3fb950]"], [class~="bg-[#4db660]"],
    [class~="bg-[#56d364]"], [class~="bg-[#8957e5]"], [class~="bg-[#a371f7]"],
    [class~="bg-[#bc8cff]"], [class~="bg-[#d97706]"], [class~="bg-[#e3b341]"],
    [class~="bg-[#f85149]"], [class~="bg-[#3182ce]"], [class~="bg-[#4090e0]"],
    [class~="bg-[#4493e8]"], [class~="bg-[#f97316]"], [class~="bg-[#e4574a]"],
    [class~="bg-[#b32d2a]"], [class~="bg-[#db2777]"])
    :is(.text-white, .text-foreground, .text-muted-foreground,
      [class~="text-white/80"], [class~="text-white/70"], [class~="text-white/60"]) {
    color: #ffffff !important;
  }
  html.light :is(.bg-blue-500, .bg-sky-400, .bg-sky-600, .bg-sky-700) {
    background-color: #1d4ed8 !important; color: #ffffff !important;
  }
  html.light :is(.bg-emerald-500, .bg-emerald-600, .bg-emerald-700,
    .bg-green-400, .bg-green-600, .bg-teal-400, .bg-teal-700) {
    background-color: #047857 !important; color: #ffffff !important;
  }
  html.light :is(.bg-amber-400, .bg-amber-500, .bg-amber-600, .bg-amber-700,
    .bg-amber-900, .bg-orange-500, .bg-yellow-400, .bg-yellow-500) {
    background-color: #b45309 !important; color: #ffffff !important;
  }
  html.light :is(.bg-red-400, .bg-red-500, .bg-red-600, .bg-red-800,
    .bg-rose-400, .bg-rose-600, .bg-rose-700) {
    background-color: #b91c1c !important; color: #ffffff !important;
  }
  html.light :is(.bg-purple-600, .bg-purple-700) {
    background-color: #7e22ce !important; color: #ffffff !important;
  }
  html.light :is(.bg-blue-500, .bg-sky-400, .bg-sky-600, .bg-sky-700,
    .bg-emerald-500, .bg-emerald-600, .bg-emerald-700, .bg-green-400, .bg-green-600,
    .bg-teal-400, .bg-teal-700, .bg-amber-400, .bg-amber-500, .bg-amber-600,
    .bg-amber-700, .bg-amber-900, .bg-orange-500, .bg-yellow-400, .bg-yellow-500,
    .bg-red-400, .bg-red-500, .bg-red-600, .bg-red-800, .bg-rose-400,
    .bg-rose-600, .bg-rose-700, .bg-purple-600, .bg-purple-700)
    :is(.text-white, .text-foreground, .text-muted-foreground, [class~="text-white/80"]) {
    color: #ffffff !important;
  }
}
