/* DEMAI OS — sistema visual unificado de temas claro/escuro.
   Mantém cores de ação (azul, índigo, verde, âmbar e vermelho) como acentos. */
:root {
  color-scheme: dark;
  --theme-bg: #080f1e;
  --theme-bg-soft: #0d1729;
  --theme-surface: #111d31;
  --theme-surface-2: #17243a;
  --theme-surface-3: #1e2d45;
  --theme-border: #2a3a53;
  --theme-text: #edf3fc;
  --theme-text-soft: #c4d0e0;
  --theme-muted: #91a2b8;
  --theme-input: #0d1729;
  --theme-shadow: 0 12px 32px rgba(2, 8, 23, .22);
}
html[data-theme="light"] {
  color-scheme: light;
  --theme-bg: #f3f6fb;
  --theme-bg-soft: #eaf0f7;
  --theme-surface: #ffffff;
  --theme-surface-2: #f8fafd;
  --theme-surface-3: #edf2f8;
  --theme-border: #d5deea;
  --theme-text: #172338;
  --theme-text-soft: #33445d;
  --theme-muted: #60718a;
  --theme-input: #ffffff;
  --theme-shadow: 0 10px 28px rgba(25, 45, 75, .07);
}
html, body { min-height:100%; }
body { background-color:var(--theme-bg); color:var(--theme-text); transition:background-color .2s ease,color .2s ease; }

/* Fundos neutros Tailwind: convertem superfícies sem desbotar botões coloridos. */
html[data-theme="light"] [class~="bg-slate-950"],
html[data-theme="light"] [class~="bg-slate-900"],
html[data-theme="light"] [class~="bg-slate-900/80"],
html[data-theme="light"] [class~="bg-slate-900/70"],
html[data-theme="light"] [class~="bg-slate-900/60"],
html[data-theme="light"] [class~="bg-slate-950/80"],
html[data-theme="light"] [class~="bg-slate-950/70"],
html[data-theme="light"] [class~="bg-slate-950/60"] { background-color:var(--theme-surface) !important; }
html[data-theme="light"] [class~="bg-slate-800"],
html[data-theme="light"] [class~="bg-slate-800/80"],
html[data-theme="light"] [class~="bg-slate-800/70"],
html[data-theme="light"] [class~="bg-slate-800/60"],
html[data-theme="light"] [class~="bg-slate-700"],
html[data-theme="light"] [class~="bg-slate-700/80"] { background-color:var(--theme-surface-3) !important; }
html[data-theme="light"] [class*="bg-slate-950/"],
html[data-theme="light"] [class*="bg-slate-900/"] { background-color:rgba(255,255,255,.88) !important; }
html[data-theme="light"] [class*="bg-slate-800/"] { background-color:rgba(237,242,248,.94) !important; }

/* Texto: primeiro plano escuro no claro, primeiro plano claro no escuro. */
html[data-theme="light"] .text-white,
html[data-theme="light"] [class~="text-slate-100"],
html[data-theme="light"] [class~="text-slate-200"] { color:var(--theme-text) !important; }
html[data-theme="light"] [class~="text-slate-300"] { color:var(--theme-text-soft) !important; }
html[data-theme="light"] [class~="text-slate-400"],
html[data-theme="light"] [class~="text-slate-500"],
html[data-theme="light"] [class~="text-slate-600"] { color:var(--theme-muted) !important; }
html[data-theme="light"] h1, html[data-theme="light"] h2,
html[data-theme="light"] h3, html[data-theme="light"] h4,
html[data-theme="light"] h5, html[data-theme="light"] h6 { color:var(--theme-text); }

/* Bordas e componentes de superfície. */
html[data-theme="light"] [class*="border-slate-800"],
html[data-theme="light"] [class*="border-slate-700"],
html[data-theme="light"] [class*="border-slate-600"] { border-color:var(--theme-border) !important; }
html[data-theme="light"] .glass-panel,
html[data-theme="light"] .glass,
html[data-theme="light"] .glass-card { background:rgba(255,255,255,.92) !important; border-color:var(--theme-border) !important; box-shadow:var(--theme-shadow); }
html[data-theme="light"] .glass-card:hover { background:#fff !important; border-color:#b9c9df !important; }
html[data-theme="light"] aside { background-color:#eaf0f7 !important; }
html[data-theme="light"] table { color:var(--theme-text); }
html[data-theme="light"] table thead,
html[data-theme="light"] thead [class*="bg-slate"] { background-color:#eaf0f7 !important; }
html[data-theme="light"] table tbody tr { border-color:var(--theme-border) !important; }
html[data-theme="light"] table tbody tr:hover,
html[data-theme="light"] [class*="hover:bg-slate-800"]:hover,
html[data-theme="light"] [class*="hover:bg-slate-700"]:hover { background-color:#edf3fa !important; }

/* Formulários legíveis e consistentes nos dois temas. */
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea { background-color:var(--theme-input) !important; color:var(--theme-text) !important; border-color:#c4d0df !important; color-scheme:light; }
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color:#8493a7 !important; opacity:1; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color-scheme:dark; }
html[data-theme="light"] option { background:#fff; color:#172338; }
html[data-theme="light"] label { color:var(--theme-text-soft); }
html[data-theme="light"] code { color:#475569; }
html[data-theme="light"] ::-webkit-scrollbar-track { background:#eaf0f7; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background:#c2cede; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background:#9eafc4; }

/* Paleta de alertas/cartões translúcidos: fundos claros com texto colorido preservado. */
html[data-theme="light"] [class*="bg-indigo-950/"],
html[data-theme="light"] [class*="bg-violet-950/"],
html[data-theme="light"] [class*="bg-blue-950/"] { background-color:#eef2ff !important; }
html[data-theme="light"] [class*="bg-rose-950/"] { background-color:#fff1f2 !important; }
html[data-theme="light"] [class*="bg-emerald-950/"] { background-color:#ecfdf5 !important; }
html[data-theme="light"] [class*="bg-amber-950/"] { background-color:#fffbeb !important; }

/* Controle de tema: é criado apenas nas páginas index.php. */
#demai-theme-toggle, #demaiThemeToggle {
  position:static; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:40px; padding:9px 13px; border:1px solid var(--theme-border); border-radius:12px;
  background:var(--theme-surface-2); color:var(--theme-text); font:600 12px/1.1 system-ui,sans-serif;
  white-space:nowrap; cursor:pointer; transition:background .18s ease,border-color .18s ease,transform .18s ease;
}
#demai-theme-toggle:hover, #demaiThemeToggle:hover { background:var(--theme-surface-3); border-color:#8295b2; transform:translateY(-1px); }
#demai-theme-toggle .demai-theme-icon { font-size:16px; line-height:1; }
@media(max-width:640px) { #demai-theme-toggle .demai-theme-label { display:none; } #demai-theme-toggle { width:40px; min-width:40px; padding:8px; } }
@media print { #demai-theme-toggle, #demaiThemeToggle { display:none !important; } }


/* Banner de boas-vindas — contraste específico e confortável no tema claro. */
html[data-theme="light"] .demai-welcome-banner {
  background:linear-gradient(115deg,#ffffff 0%,#fbfdff 72%,#f4f7ff 100%) !important;
  border:1px solid #d8e1ed !important;
  box-shadow:0 12px 30px rgba(31,52,82,.07) !important;
}
html[data-theme="light"] .demai-welcome-glow { opacity:.12; }
html[data-theme="light"] .demai-welcome-banner h1 { color:#172338 !important; }
html[data-theme="light"] .demai-welcome-banner p { color:#586b84 !important; }
html[data-theme="light"] .demai-welcome-btn {
  min-height:42px; border-radius:12px !important; font-weight:700 !important;
  box-shadow:0 3px 9px rgba(24,42,68,.07); transition:background .18s ease,border-color .18s ease,box-shadow .18s ease;
}
html[data-theme="light"] .demai-welcome-btn-primary {
  background:#e8eef8 !important; color:#20334f !important; border:1px solid #cbd7e7 !important;
}
html[data-theme="light"] .demai-welcome-btn-primary:hover { background:#dce7f5 !important; border-color:#aebfd6 !important; }
html[data-theme="light"] .demai-welcome-btn-disabled,
html[data-theme="light"] .demai-welcome-btn-disabled:disabled {
  background:#e9edf3 !important; color:#8996a8 !important; border:1px solid #d5dde8 !important;
  box-shadow:none !important; cursor:not-allowed; opacity:1 !important;
}
html[data-theme="light"] .demai-welcome-btn-secondary {
  background:#344f78 !important; color:#ffffff !important; border:1px solid #344f78 !important;
}
html[data-theme="light"] .demai-welcome-btn-secondary:hover { background:#263f65 !important; border-color:#263f65 !important; }
html[data-theme="light"] .demai-welcome-btn-secondary svg,
html[data-theme="light"] .demai-welcome-btn-primary svg { color:inherit !important; }
@media(max-width:767.98px) {
  .demai-welcome-actions { width:100%; }
  .demai-welcome-actions .demai-welcome-btn { flex:1 1 100%; justify-content:center; }
}
