/* Tema claro e escuro do sistema.
   As cores das telas (cinzas, marca, verde, vermelho, amarelo, azul-claro, violeta, ciano, fundo, linha e marinho)
   vêm destas variáveis (ver tailwind.config no base.html). O tema escuro só troca os valores: os tons claros
   (50–200) viram fundos escuros e os tons de texto (700–900) viram claros; 400–600 ficam iguais.
   Valores em "R G B" para o Tailwind aplicar transparência (bg-fundo/60 etc.). */
:root {
  color-scheme: light;  /* campos e controles nativos seguem o tema do sistema, não o do Windows */
  --branco: 255 255 255;
  --fundo: 245 246 248; --linha: 228 231 236; --marinho: 12 20 52;
  --slate-50: 248 250 252; --slate-100: 241 245 249; --slate-200: 226 232 240; --slate-300: 203 213 225;
  --slate-400: 148 163 184; --slate-500: 100 116 139; --slate-600: 71 85 105; --slate-700: 51 65 85;
  --slate-800: 30 41 59; --slate-900: 15 23 42; --slate-950: 2 6 23;
  --marca-50: 239 244 255; --marca-100: 219 229 254; --marca-200: 191 209 253; --marca-300: 147 178 251;
  --marca-400: 96 137 246; --marca-500: 59 102 236; --marca-600: 33 82 217; --marca-700: 27 65 181;
  --marca-800: 28 56 146; --marca-900: 12 20 52;
  --emerald-50: 236 253 245; --emerald-100: 209 250 229; --emerald-200: 167 243 208; --emerald-300: 110 231 183;
  --emerald-400: 52 211 153; --emerald-500: 16 185 129; --emerald-600: 5 150 105; --emerald-700: 4 120 87;
  --emerald-800: 6 95 70; --emerald-900: 6 78 59;
  --rose-50: 255 241 242; --rose-100: 255 228 230; --rose-200: 254 205 211; --rose-300: 253 164 175;
  --rose-400: 251 113 133; --rose-500: 244 63 94; --rose-600: 225 29 72; --rose-700: 190 18 60;
  --rose-800: 159 18 57; --rose-900: 136 19 55;
  --amber-50: 255 251 235; --amber-100: 254 243 199; --amber-200: 253 230 138; --amber-300: 252 211 77;
  --amber-400: 251 191 36; --amber-500: 245 158 11; --amber-600: 217 119 6; --amber-700: 180 83 9;
  --amber-800: 146 64 14; --amber-900: 120 53 15;
  --sky-50: 240 249 255; --sky-100: 224 242 254; --sky-200: 186 230 253; --sky-300: 125 211 252;
  --sky-400: 56 189 248; --sky-500: 14 165 233; --sky-600: 2 132 199; --sky-700: 3 105 161;
  --sky-800: 7 89 133; --sky-900: 12 74 110;
  --violet-50: 245 243 255; --violet-100: 237 233 254; --violet-200: 221 214 254; --violet-300: 196 181 253;
  --violet-600: 124 58 237; --violet-700: 109 40 217; --violet-800: 91 33 182; --violet-900: 76 29 149;
  --cyan-50: 236 254 255; --cyan-100: 207 250 254; --cyan-200: 165 243 252; --cyan-600: 8 145 178;
  --cyan-700: 14 116 144; --cyan-800: 21 94 117; --cyan-900: 22 78 99;
}

html.escuro {
  color-scheme: dark;
  --branco: 23 29 43;              /* superfície dos cartões (bg-white) */
  --fundo: 15 19 30; --linha: 42 50 67; --marinho: 232 237 247;
  --slate-50: 29 36 52; --slate-100: 35 43 61; --slate-200: 46 55 75; --slate-300: 62 72 94;
  --slate-400: 112 124 146; --slate-500: 150 162 182; --slate-600: 172 182 199; --slate-700: 197 205 218;
  --slate-800: 222 228 237; --slate-900: 238 242 247; --slate-950: 248 250 252;
  --marca-50: 25 36 66; --marca-100: 31 46 86; --marca-200: 43 63 117; --marca-300: 64 92 165;
  --marca-600: 53 99 233; --marca-700: 143 176 255; --marca-800: 179 200 255; --marca-900: 219 229 254;
  --emerald-50: 14 41 33; --emerald-100: 16 56 43; --emerald-200: 21 79 59; --emerald-300: 30 110 80;
  --emerald-700: 52 211 153; --emerald-800: 110 231 183; --emerald-900: 167 243 208;
  --rose-50: 55 20 28; --rose-100: 72 24 34; --rose-200: 96 32 45; --rose-300: 130 44 60;
  --rose-600: 244 63 94; --rose-700: 251 113 133; --rose-800: 253 164 175; --rose-900: 254 205 211;
  --amber-50: 50 38 12; --amber-100: 66 50 14; --amber-200: 90 68 18; --amber-300: 122 92 22;
  --amber-700: 251 191 36; --amber-800: 252 211 77; --amber-900: 253 230 138;
  --sky-50: 13 36 52; --sky-100: 16 48 69; --sky-200: 22 70 96; --sky-300: 30 100 135;
  --sky-700: 125 211 252; --sky-800: 186 230 253; --sky-900: 224 242 254;
  --violet-50: 34 26 61; --violet-100: 42 32 78; --violet-200: 59 45 107; --violet-300: 86 66 150;
  --violet-700: 196 181 253; --violet-800: 221 214 254; --violet-900: 237 233 254;
  --cyan-50: 10 42 48; --cyan-100: 13 55 63; --cyan-200: 17 68 77;
  --cyan-700: 103 232 249; --cyan-800: 165 243 252; --cyan-900: 207 250 254;
}

/* Fundos sólidos que levam texto branco: no escuro continuam escuros (não seguem a inversão do texto). */
html.escuro .bg-marinho, html.escuro .hover\:bg-marinho:hover { background-color: rgb(42 52 78); }
html.escuro .bg-marinho\/90 { background-color: rgb(42 52 78 / .9); }
html.escuro .border-marinho { border-color: rgb(120 135 165); }
html.escuro .bg-marca-700, html.escuro .hover\:bg-marca-700:hover { background-color: rgb(27 65 181); }
html.escuro .bg-marca-800, html.escuro .hover\:bg-marca-800:hover { background-color: rgb(28 56 146); }
html.escuro .bg-emerald-700, html.escuro .hover\:bg-emerald-700:hover { background-color: rgb(4 120 87); }
html.escuro .bg-rose-700, html.escuro .hover\:bg-rose-700:hover { background-color: rgb(190 18 60); }
html.escuro .bg-rose-800 { background-color: rgb(159 18 57); }
html.escuro .bg-amber-700, html.escuro .hover\:bg-amber-700:hover { background-color: rgb(180 83 9); }
html.escuro .bg-slate-800, html.escuro .bg-slate-900 { background-color: rgb(8 11 20); }
/* "white" vira a superfície escura (bg-white); texto branco continua branco */
html.escuro .text-white, html.escuro .hover\:text-white:hover, html.escuro .group:hover .group-hover\:text-white,
html.escuro .file\:text-white::file-selector-button { color: #fff; }
html.escuro .text-white\/80 { color: rgb(255 255 255 / .8); }
html.escuro .text-white\/70 { color: rgb(255 255 255 / .7); }
html.escuro .text-white\/60 { color: rgb(255 255 255 / .6); }
/* Véu branco sobre fundo sempre escuro (painel do login) */
html.escuro .bg-white\/10 { background-color: rgb(255 255 255 / .1); }
html.escuro .ring-white\/15 { --tw-ring-color: rgb(255 255 255 / .15); }

/* Sombras de fundo de janelas (modais, menu no celular) */
html.escuro [class*="bg-slate-900/"] { background-color: rgb(0 0 0 / .6); }
html.escuro dialog::backdrop { background-color: rgb(0 0 0 / .6) !important; }

/* Campos de formulário e controles nativos */
html.escuro input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
html.escuro select, html.escuro textarea {
  background-color: rgb(var(--branco)); color: rgb(var(--slate-800)); border-color: rgb(var(--slate-300));
}
html.escuro input[type=checkbox], html.escuro input[type=radio] { background-color: rgb(var(--slate-100)); border-color: rgb(var(--slate-300)); }
html.escuro input[type=checkbox]:checked, html.escuro input[type=radio]:checked { background-color: rgb(var(--marca-600)); border-color: transparent; }
html.escuro input::placeholder, html.escuro textarea::placeholder { color: rgb(var(--slate-400)); }
html.escuro option { background-color: rgb(var(--branco)); color: rgb(var(--slate-800)); }

/* Logo: a parte escrita fica clara e o símbolo mantém o azul */
html.escuro .logo-tema { filter: invert(1) hue-rotate(180deg) brightness(1.15); }

/* Barra de rolagem e seleção no tema escuro */
html.escuro { scrollbar-color: rgb(var(--slate-300)) rgb(var(--fundo)); }
html.escuro ::selection { background: rgb(53 99 233 / .45); color: #fff; }

/* Troca de tema sem piscar as transições */
html.trocando-tema *, html.trocando-tema *::before, html.trocando-tema *::after { transition: none !important; }

/* Botão do tema na barra superior: mostra o ícone do tema para o qual vai trocar */
.tema-ir-escuro { display: inline-flex; }
.tema-ir-claro { display: none; }
html.escuro .tema-ir-escuro { display: none; }
html.escuro .tema-ir-claro { display: inline-flex; }
