/* Visual da marca D'Blun (laranja #D97E31, cinza #818085, grafite #2C2C2C), usado por todas as páginas.
   Carregado depois do <style> de cada página: troca as cores e o menu sem mexer no resto.
   Por dentro os nomes dos temas continuam os antigos: "roxo" = escuro, "turquesa" = claro. */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&display=swap');

html[data-tema="roxo"] {
  --page-a: #161618; --page-b: #161618; --shell: #1b1b1e; --card: #242427; --text: #f2f0ed; --muted: #a3a2a7;
  --line: #34343a; --field: #1c1c1f; --accent: #df8436; --accent-dark: #c8722a; --accent-soft: #3b2a1c;
  --good: #4ade80; --bad: #f87171; --warn: #f2c94c; --shadow: none; color-scheme: dark;
  /* nomes usados pelo Gerador */
  --bg: #1c1c1f; --surface: #242427; --sunken: #1b1b1e; --fg: #f2f0ed; --accent-fg: #ffffff;
  --ok: #4ade80; --ok-soft: #173326; --warn-soft: #3a3012; --bad-soft: #3d1a18;
  /* menu */
  --menu-bg: #141416; --menu-line: #2a2a2e; --menu-txt: #c9c8cc; --menu-grupo: #7d7c82;
  --menu-ativo-bg: rgba(223, 132, 54, .15); --menu-ativo-txt: #f0a35e; --menu-hover: rgba(255, 255, 255, .05);
}
html[data-tema="turquesa"] {
  --page-a: #f6f4f1; --page-b: #f6f4f1; --shell: #f6f4f1; --card: #ffffff; --text: #2c2c2c; --muted: #77767c;
  --line: #e9e5df; --field: #f3f0ec; --accent: #c96f24; --accent-dark: #a85a17; --accent-soft: #fbeadb;
  --good: #16a36a; --bad: #d64545; --warn: #a37800; --shadow: 0 1px 2px rgba(44, 44, 44, .04), 0 6px 20px rgba(44, 44, 44, .05);
  color-scheme: light;
  --bg: #f3f0ec; --surface: #ffffff; --sunken: #efebe6; --fg: #2c2c2c; --accent-fg: #ffffff;
  --menu-bg: #ffffff; --menu-line: #ebe7e1; --menu-txt: #4a4a4d; --menu-grupo: #9a999e;
  --menu-ativo-bg: #fbeadb; --menu-ativo-txt: #a85a17; --menu-hover: #f6f3ef;
}

/* casca: tela inteira, menu fixo à esquerda */
html[data-tema] body { padding: 0; background: var(--shell); }
html[data-tema] .shell { max-width: none; min-height: 100vh; border-radius: 0; box-shadow: none; background: var(--shell); }
html[data-tema] .painel { padding: 30px 36px 48px; }
html[data-tema] h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 34px; letter-spacing: 0; }
html[data-tema] .panel, html[data-tema] .kpi, html[data-tema] .card { border: 1px solid var(--line); }
html[data-tema="roxo"] .panel, html[data-tema="roxo"] .kpi { border-color: transparent; }

/* tabelas largas e compridas: rolam dentro do quadro (a barra de arrastar para o lado fica sempre à vista) e o cabeçalho fica fixo */
html[data-tema] .rolagem { max-height: calc(100vh - 110px); overflow: auto; }
html[data-tema] .rolagem thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -1px 0 var(--line); }

/* menu lateral */
html[data-tema] .side {
  width: 236px; margin: 0; padding: 22px 14px 16px; border-radius: 0; gap: 0; align-items: stretch;
  background: var(--menu-bg); border-right: 1px solid var(--menu-line); color: var(--menu-txt);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
html[data-tema] .side .topo-menu { display: flex; align-items: center; gap: 2px; padding: 0 0 14px; }
html[data-tema] .side .marca { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); text-decoration: none; }
html[data-tema] .side .marca svg { width: 30px; height: 30px; flex: none; }
html[data-tema] .side .marca b { font: 600 22px/1 'Cormorant Garamond', Georgia, serif; }
html[data-tema] .side .marca small { display: block; font-size: 11px; color: var(--menu-grupo); margin-top: 3px; letter-spacing: .02em; }
html[data-tema] .side nav { gap: 2px; flex: 1; }
html[data-tema] .side .grupo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--menu-grupo); margin: 16px 10px 6px; }
html[data-tema] .side .grupo:first-child { margin-top: 4px; }
html[data-tema] .side a { justify-content: flex-start; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--menu-txt); font-weight: 500; font-size: 14px; }
html[data-tema] .side a svg { width: 18px; height: 18px; opacity: .85; }
html[data-tema] .side a span { display: inline; }
html[data-tema] .side a:hover { background: var(--menu-hover); }
html[data-tema] .side a[aria-current] { background: var(--menu-ativo-bg); color: var(--menu-ativo-txt); font-weight: 600; }
html[data-tema] .side a[aria-current] svg { opacity: 1; }
html[data-tema] .side .rodape { display: flex; align-items: center; gap: 8px; padding: 14px 8px 0; border-top: 1px solid var(--menu-line); margin-top: 14px; font-size: 12px; color: var(--menu-grupo); }
html[data-tema] .side .tema { margin: 0 0 0 auto; width: 34px; height: 34px; border-radius: 9px; color: var(--menu-txt); background: var(--menu-hover); }
html[data-tema] .side .tema svg { width: 18px; height: 18px; }
html[data-tema] .side .abrir, html[data-tema] .side .so-cel { display: none; }

/* botões de ícone (sininho, ajuda, fechar) */
html[data-tema] .ico { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; flex: none;
  border: 0; border-radius: 9px; background: transparent; color: var(--menu-txt); cursor: pointer; }
html[data-tema] .ico:hover { background: var(--menu-hover); }
html[data-tema] .ico svg { width: 18px; height: 18px; }
html[data-tema] .sino .conta { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font: 700 10px/16px "Segoe UI", system-ui, sans-serif; font-style: normal; text-align: center; }
html[data-tema] .sino .conta.grave { background: var(--bad); }
html[data-tema] .side .buscar-largo { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 6px; padding: 8px 10px;
  border: 1px solid var(--menu-line); border-radius: 9px; background: var(--field); color: var(--menu-grupo); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
html[data-tema] .side .buscar-largo:hover { border-color: var(--accent); }
html[data-tema] .side .buscar-largo svg { width: 16px; height: 16px; }
html[data-tema] .side .buscar-largo span { flex: 1; }
html[data-tema] kbd { font: 600 11px "Segoe UI", system-ui, sans-serif; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }

/* janelas: busca (centro), avisos e ajuda (lateral direita) */
html.dl-travado { overflow: hidden; }
.dl-camada { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 10, 12, .45); display: flex; }
.dl-camada[hidden] { display: none; }
.dl-janela { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
.dl-janela.centro { margin: 10vh auto auto; width: min(640px, calc(100vw - 24px)); max-height: 76vh; border-radius: 16px; overflow: hidden; }
.dl-janela.lado { margin-left: auto; width: min(400px, 100vw); height: 100%; border-radius: 0; border-width: 0 0 0 1px; }
.dl-cab { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.dl-cab b { font: 600 22px/1.1 'Cormorant Garamond', Georgia, serif; }
.dl-cab .ico { margin-left: auto; }
.dl-sub { font-size: 12px; color: var(--muted); }
.dl-corpo { overflow-y: auto; padding: 14px 16px 18px; flex: 1; }
.dl-corpo.texto { padding: 16px 20px 22px; font-size: 14.5px; }
.dl-corpo.texto ul { padding-left: 18px; margin: 8px 0 14px; } .dl-corpo.texto li { margin: 6px 0; }
.dl-dicas { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 18px; }
.dl-botao { display: inline-block; margin-top: 6px; padding: 9px 14px; border-radius: 10px; background: var(--accent); color: #fff !important; text-decoration: none; font-weight: 600; font-size: 14px; }
.dl-campo { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.dl-campo > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.dl-campo input { flex: 1; min-width: 0; border: 0 !important; outline: 0; background: transparent !important; color: var(--text); font: inherit; font-size: 17px; padding: 6px 0; box-shadow: none !important; }
.dl-campo input::-webkit-search-cancel-button { display: none; }
.dl-busca-corpo, .dl-janela.busca .dl-corpo { padding: 6px 8px 10px; }
.dl-grupo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 10px 4px; }
.dl-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.dl-item > svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.dl-item.sel, .dl-item:hover { background: var(--accent-soft); }
.dl-item.sel > svg { color: var(--accent); }
.dl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-t b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-t small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-v { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-vazio { padding: 14px 10px; color: var(--muted); font-size: 14px; }
.dl-janela .neg { color: var(--bad); } .dl-janela .pos { color: var(--good); } .dl-janela .nw { white-space: nowrap; }
.dl-janela .alertas { display: flex; flex-direction: column; gap: 8px; }
.dl-janela .alerta { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 0;
  padding: 10px 12px; font-size: 14px; line-height: 1.45; text-decoration: none; color: inherit; background: transparent; }
.dl-janela .alerta.grave { border-left-color: var(--bad); } .dl-janela .alerta.ok { border-left-color: var(--good); }
.dl-janela a.alerta:hover { background: var(--field); }
.dl-janela .alerta .ic { font-weight: 700; flex: none; width: 16px; text-align: center; color: var(--warn); }
.dl-janela .alerta.grave .ic { color: var(--bad); } .dl-janela .alerta.ok .ic { color: var(--good); }
/* janela "Registrar devolução" (comum.js) */
dialog.dl-dev { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--text); width: min(540px, calc(100% - 24px));
  max-height: calc(100vh - 24px); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
dialog.dl-dev::backdrop { background: rgba(10, 10, 12, .55); }
.dl-dev form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dl-dev h3 { margin: 0; font: 600 24px/1.1 'Cormorant Garamond', Georgia, serif; }
.dl-dev .dl-dica { font-size: 12.5px; color: var(--muted); }
.dl-dev .dl-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dl-dev .inteiro { grid-column: 1 / -1; }
.dl-dev label { display: block; font-size: 12px; color: var(--muted); }
.dl-dev input:not([type=checkbox]), .dl-dev select { display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 14px; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--text); }
.dl-dev input:focus, .dl-dev select:focus { outline: none; border-color: var(--accent); }
.dl-dev .ck { display: flex; align-items: flex-end; padding-bottom: 8px; }
.dl-dev .ck label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.dl-dev .ck input { width: 18px; height: 18px; accent-color: var(--accent); }
.dl-dev .achou { margin-top: 6px; }
.dl-dev .dl-resumo { font-size: 13px; background: var(--field); border-radius: 10px; padding: 10px 12px; }
.dl-dev .dl-rodape { display: flex; justify-content: flex-end; gap: 8px; }
.dl-dev .dl-rodape button { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.dl-dev .dl-rodape .dl-primario { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.dl-dev .dl-primario:disabled { opacity: .6; }
.dl-dev .neg { color: var(--bad); } .dl-dev .pos { color: var(--good); } .dl-dev .warn { color: var(--warn); }
@media (max-width: 560px) { .dl-dev .dl-campos { grid-template-columns: 1fr; } }

@media (max-width: 820px) {
  .dl-janela.centro { margin: 0; width: 100vw; max-height: none; height: 100%; border-radius: 0; }
}

/* celular: barra no topo com o botão de menu */
@media (max-width: 820px) {
  html[data-tema] .shell { flex-direction: column; }
  html[data-tema] .side {
    width: auto; height: auto; position: sticky; top: 0; z-index: 40; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--menu-line); overflow: visible;
  }
  html[data-tema] .side .topo-menu { width: 100%; padding: 0; }
  html[data-tema] .side .marca { padding: 0; }
  html[data-tema] .side .marca small { display: none; }
  html[data-tema] .side .so-cel, html[data-tema] .side .abrir { display: grid; width: 38px; height: 38px; }
  html[data-tema] .side .abrir { background: var(--menu-hover); color: var(--text); }
  html[data-tema] .side .ico svg { width: 20px; height: 20px; }
  html[data-tema] .side .buscar-largo { display: none; }
  html[data-tema] .side nav, html[data-tema] .side .rodape { display: none; flex: none; width: 100%; }
  html[data-tema] .side.aberta nav { display: flex; flex-direction: column; flex-wrap: nowrap; max-height: calc(100vh - 140px); overflow-y: auto; padding-top: 8px; }
  html[data-tema] .side.aberta .rodape { display: flex; }
  html[data-tema] .side a { padding: 11px 10px; }
  html[data-tema] .painel { padding: 18px 16px 40px; }
  html[data-tema] h1 { font-size: 28px; }
}

/* usuário logado e botão Sair (rodapé do menu) */
html[data-tema] .side .rodape.usuario { justify-content: space-between; margin-top: 8px; border-top: 0; padding-top: 4px; }
html[data-tema] .side .rodape.usuario .quem { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
html[data-tema] .side .rodape.usuario .sair { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--menu-line); background: transparent; color: inherit; cursor: pointer; }
html[data-tema] .side .rodape.usuario .sair:hover { border-color: var(--accent); color: var(--accent); }
