/* ==========================================================================
   Modo XP: visual opcional (botão "XP" no cabeçalho, montado por js/xp.js).
   Tudo aqui só vale com html[data-estilo="xp"], menos o próprio botão.
   O modo XP é sempre claro, como o original.
   ========================================================================== */

/* Botão no cabeçalho (visual normal) */
.xp-botao {
  display: inline-grid; place-items: center; height: 34px; min-width: 34px; padding: 0 8px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted);
  font: italic 700 .78rem/1 "Trebuchet MS", Tahoma, sans-serif; letter-spacing: .02em;
}
.xp-botao:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 860px) { .xp-botao { margin: 8px 0 0 8px; align-self: flex-start; } }

/* ---------- Cores, letras e formas ---------- */
html:root[data-estilo="xp"] {
  --bg: #ffffff;
  --bg-alt: #f1efe2;
  --surface: #ffffff;
  --text: #000000;
  --muted: #4d4d4d;
  --border: #d0cdbd;
  --accent: #245edb;
  --accent-2: #ff3483;
  --accent-soft: #dce7fb;
  --accent-text: #ffffff;
  --link: #0b3fb3;
  --ok: #2f8f2f;
  --shadow: 1px 1px 3px rgba(0, 0, 0, .25);
  --shadow-lg: 2px 3px 12px rgba(0, 0, 0, .4);
  --font-body: "Bandeiras", Tahoma, Verdana, "Segoe UI", sans-serif;
  --font-display: "Bandeiras", "Trebuchet MS", Tahoma, Verdana, sans-serif;
  --radius: 3px;
  --radius-sm: 2px;
  --xp-borda: #0831a8;
  color-scheme: light;
}
html[data-estilo="xp"] body {
  font-size: 13px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(60% 18% at 22% 18%, rgba(255, 255, 255, .55), transparent 70%),
    radial-gradient(40% 14% at 70% 10%, rgba(255, 255, 255, .45), transparent 70%),
    radial-gradient(150% 60% at 30% 108%, #6dbb3c 0 47%, transparent 47.4%),
    radial-gradient(120% 55% at 92% 112%, #4fa52c 0 45%, transparent 45.4%),
    linear-gradient(#2c6fe0, #5d9cf0 45%, #a9cdf5 72%);
  background-attachment: fixed;
  background-color: #3a6ea5;
}
html[data-estilo="xp"] h1, html[data-estilo="xp"] h2, html[data-estilo="xp"] h3 { font-weight: 700; letter-spacing: 0; }

/* O cabeçalho e o rodapé dão lugar à barra de tarefas */
html[data-estilo="xp"] .topo,
html[data-estilo="xp"] .rodape,
html[data-estilo="xp"] .barra-admin { display: none; }

/* ---------- A página vira uma janela ---------- */
html[data-estilo="xp"] #conteudo {
  position: relative; max-width: 1180px; margin: 24px auto 30px; padding-top: 0;
  background: var(--bg); border: 3px solid var(--xp-borda); border-top: 0; border-radius: 8px 8px 0 0;
  box-shadow: 2px 3px 14px rgba(0, 0, 0, .45);
}
html[data-estilo="xp"] body.xp-max #conteudo { max-width: none; margin: 0; border-width: 0 0 3px; border-radius: 0; }
html[data-estilo="xp"] body.xp-min #conteudo { display: none; }
.xp-titulo {
  position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 5px 0 8px;
  margin: 0 -3px; border-radius: 7px 7px 0 0; color: #fff; user-select: none;
  background: linear-gradient(180deg, #0997ff 0%, #0a5fd8 8%, #3a8cf4 40%, #0a5fd8 88%, #0347c2 100%);
}
body.xp-max .xp-titulo { margin: 0; border-radius: 0; }
html.radio-barra-ativa .xp-titulo { top: 56px; }
.xp-titulo strong { flex: 1; min-width: 0; font: 700 13px "Trebuchet MS", Tahoma, sans-serif; text-shadow: 1px 1px 1px #0c2d82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-titulo button {
  width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 1px solid #fff; border-radius: 3px; cursor: pointer;
  background: linear-gradient(180deg, #5c8ef6, #2d63e0 60%, #1f4fcf); box-shadow: inset 0 0 1px rgba(255, 255, 255, .7);
}
.xp-titulo button svg { width: 12px; height: 12px; }
.xp-titulo .xp-fechar { background: linear-gradient(180deg, #e7856b, #d4502d 60%, #c13f1d); }
.xp-titulo button:hover { filter: brightness(1.12); }
.xp-titulo button:focus-visible { outline: 1px dotted #fff; outline-offset: 1px; }

/* ---------- Botões e campos no estilo da época ---------- */
html[data-estilo="xp"] .botao,
html[data-estilo="xp"] .botao-sec {
  padding: 4px 14px; min-height: 26px; border: 1px solid #003c74; border-radius: 3px; color: #000; font: 12px/1.2 Tahoma, Verdana, sans-serif;
  background: linear-gradient(180deg, #fff, #ece9d8 85%, #d6d0c5); box-shadow: none; transform: none;
}
html[data-estilo="xp"] .botao:hover,
html[data-estilo="xp"] .botao-sec:hover { color: #000; box-shadow: inset 0 0 0 2px #f8b330; transform: none; }
html[data-estilo="xp"] .botao:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
html[data-estilo="xp"] input[type="text"], html[data-estilo="xp"] input[type="search"], html[data-estilo="xp"] input[type="email"],
html[data-estilo="xp"] input[type="number"], html[data-estilo="xp"] input[type="date"], html[data-estilo="xp"] input[type="time"],
html[data-estilo="xp"] input[type="url"], html[data-estilo="xp"] input[type="password"], html[data-estilo="xp"] textarea, html[data-estilo="xp"] select {
  border: 1px solid #7f9db9; border-radius: 0; background-color: #fff; color: #000;
}
html[data-estilo="xp"] a { text-underline-offset: 2px; }

/* A rádio e o "Fale comigo" ficam acima da barra de tarefas */
html[data-estilo="xp"] .fc-flutuante { bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
html[data-estilo="xp"] .fc-botao { border-radius: 3px; border: 1px solid #003c74; color: #000; background: linear-gradient(180deg, #fff, #ece9d8 85%, #d6d0c5); box-shadow: 1px 1px 4px rgba(0, 0, 0, .35); }
html[data-estilo="xp"] .radio-video { bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Ícones da área de trabalho (só em telas largas) ---------- */
.xp-icones { display: none; }
@media (min-width: 1400px) {
  html[data-estilo="xp"] .xp-icones {
    position: fixed; left: 0; top: 0; z-index: 1; display: grid; gap: 8px; padding: 18px 10px; align-content: start;
  }
  html.radio-barra-ativa[data-estilo="xp"] .xp-icones { top: 56px; }
}
.xp-icone { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; color: #fff; text-align: center; text-decoration: none; border: 1px dotted transparent; }
.xp-icone svg { filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .35)); }
.xp-icone span { padding: 0 3px; font: 12px/1.25 Tahoma, Verdana, sans-serif; text-shadow: 1px 1px 2px #000, 0 0 2px #000; }
.xp-icone:hover span, .xp-icone:focus-visible span { background: #316ac5; text-shadow: none; }
.xp-icone:focus-visible { outline: none; border-color: #fff; }

/* ---------- Barra de tarefas ---------- */
.xp-barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; align-items: stretch;
  height: calc(30px + env(safe-area-inset-bottom, 0px));
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  font: 12px Tahoma, Verdana, sans-serif;
  background: linear-gradient(180deg, #3d95ff 0%, #245edb 9%, #3f8cf3 18%, #245edb 55%, #1d4fc5 100%);
}
.xp-iniciar {
  display: flex; align-items: center; gap: 6px; padding: 0 18px 0 8px; border: 0; cursor: pointer; flex-shrink: 0;
  border-radius: 0 12px 12px 0; color: #fff; font: italic 700 17px "Trebuchet MS", Tahoma, sans-serif; text-shadow: 1px 1px 2px #1a4d1a;
  background: linear-gradient(180deg, #6ec96e 0%, #58c058 10%, #3c9a3c 55%, #2f7f2f 100%); box-shadow: inset -2px 0 3px rgba(0, 0, 0, .25);
}
.xp-iniciar:hover, .xp-iniciar[aria-expanded="true"] { filter: brightness(1.1); }
.xp-iniciar:focus-visible { outline: 1px dotted #fff; outline-offset: -4px; }
.xp-logo {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font: italic 700 13px Georgia, serif; color: #fff; text-shadow: none;
  background: radial-gradient(circle at 35% 30%, #d873d8, #91008d 60%, #5c005a); box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
}
.xp-tarefas { flex: 1; min-width: 0; display: flex; gap: 3px; padding: 3px 6px; overflow: hidden; }
.xp-tarefa {
  flex: 0 1 220px; min-width: 40px; display: flex; align-items: center; gap: 5px; padding: 0 8px; border: 0; border-radius: 3px; cursor: pointer;
  color: #fff; background: #3c81f3; box-shadow: inset 0 0 1px #1b4fd0, inset 1px 1px 0 rgba(255, 255, 255, .25);
}
.xp-tarefa.ativa { background: #1e52c9; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, .45); }
.xp-tarefa span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-bandeja {
  display: flex; align-items: center; gap: 8px; padding: 0 12px 0 10px; color: #fff; flex-shrink: 0;
  background: linear-gradient(180deg, #19b9f3, #0f8ff0 50%, #0b77e0); border-left: 1px solid #1042af; box-shadow: inset 1px 0 0 #3fbfff;
}
.xp-bandeja button { display: grid; place-items: center; padding: 2px; border: 0; background: none; color: #fff; cursor: pointer; }
.xp-bandeja button svg { width: 16px; height: 16px; }
.xp-bandeja .xp-sair { font: italic 700 11px "Trebuchet MS", Tahoma, sans-serif; border: 1px solid rgba(255, 255, 255, .7); border-radius: 3px; padding: 1px 4px; }
.xp-bandeja button:focus-visible { outline: 1px dotted #fff; }

/* ---------- Menu iniciar ---------- */
.xp-menu {
  position: fixed; left: env(safe-area-inset-left, 0px); bottom: calc(30px + env(safe-area-inset-bottom, 0px)); z-index: 901; width: min(400px, 100vw);
  border: 2px solid #0b4ac9; border-radius: 8px 8px 0 0; overflow: hidden; background: #fff; box-shadow: 3px -2px 12px rgba(0, 0, 0, .45);
  font: 12px Tahoma, Verdana, sans-serif; color: #000;
}
.xp-menu-cab {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #fff; font: 700 15px "Trebuchet MS", Tahoma, sans-serif; text-shadow: 1px 1px 2px #0c2d82;
  background: linear-gradient(180deg, #1868ce, #0e60cb 15%, #2b7be3 60%, #0c58c5);
}
.xp-menu-cab .xp-logo { width: 42px; height: 42px; font-size: 24px; border-radius: 4px; box-shadow: 0 0 0 2px #fff; }
.xp-menu-colunas { display: grid; grid-template-columns: 1fr 1fr; }
.xp-menu-colunas ul { list-style: none; margin: 0; padding: 6px 4px; display: flex; flex-direction: column; gap: 2px; }
.xp-menu-dir { background: #d3e5fa; border-left: 1px solid #95bdee; }
.xp-menu-colunas a { display: flex; align-items: center; gap: 8px; padding: 4px 6px; color: #000; text-decoration: none; }
.xp-menu-colunas a:hover, .xp-menu-colunas a:focus-visible { background: #316ac5; color: #fff; outline: none; }
.xp-menu-colunas strong { display: block; font-weight: 700; }
.xp-menu-dir strong { font-weight: 400; }
.xp-menu-pe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; padding: 6px 10px; background: linear-gradient(180deg, #4282d6, #3b72d4 50%, #2b5cc4); }
.xp-menu-pe a, .xp-menu-pe button { display: flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: #fff; font: inherit; cursor: pointer; text-decoration: none; }
.xp-menu-pe a:hover, .xp-menu-pe button:hover { text-decoration: underline; }

@media (max-width: 760px) {
  html[data-estilo="xp"] #conteudo { margin: 0 0 20px; border-width: 0 0 3px; border-radius: 0; }
  html[data-estilo="xp"] .xp-titulo { margin: 0; border-radius: 0; }
  .xp-tarefa { flex: 1 1 auto; }
  .xp-iniciar { padding-right: 12px; }
}
@media print {
  .xp-barra, .xp-menu, .xp-icones, .xp-titulo { display: none !important; }
  html[data-estilo="xp"] body { background: #fff; }
  html[data-estilo="xp"] #conteudo { border: 0; box-shadow: none; margin: 0; }
}
