/* Portal Vértice — tokens e base.
   Identidade oficial: roxo + amarelo sobre preto (ver "Identidade Visual/" e img/logo-slogan.png). */
:root {
  --ink: #0b0b0f;
  --ink-2: #353546;
  --ink-3: #6c6c80;
  --line: #e6e4ef;
  --paper: #ffffff;
  --paper-2: #f6f4fb;
  --brand: #8459dd;          /* roxo Vértice (manual da marca) */
  --brand-dark: #6339bf;
  --brand-soft: #f0eafc;
  --accent: #eeb32b;         /* amarelo Vértice (manual da marca) */
  --accent-dark: #d39a14;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --danger: #c0392b;
  --font-head: "Montserrat", "Archivo", Arial, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-ui: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --radius: 6px;
  --max: 1180px;
  --shadow: 0 2px 10px rgba(11, 11, 15, .08);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* clip (e não hidden): corta o que vaza para o lado sem virar caixa de rolagem, o que quebraria o position: sticky
   do menu lateral e do topo do painel. hidden fica só para navegadores antigos sem clip. */
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 32px, var(--max)); margin-inline: auto; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 48px; width: auto; flex: none; }
.brand-stack { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-sub { font-family: var(--font-ui); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* Botões */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; line-height: 1; }
.btn:hover { background: #000; text-decoration: none; }
.btn-brand { background: var(--brand); border-color: var(--brand); }
.btn-brand:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-accent:hover { background: var(--accent-dark); }

/* Chips / etiquetas */
.kicker { display: inline-block; font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.kicker::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--ed, var(--brand)); transform: rotate(45deg) translateY(-1px); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pub { background: #e3f4ea; color: var(--ok); }
.badge-draft { background: #fff4d6; color: var(--warn); }
.badge-sim { background: var(--brand-soft); color: var(--brand-dark); }
.meta { color: var(--ink-3); font-size: 13px; }
.meta b { color: var(--ink-2); font-weight: 600; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 12px; color: var(--ink-3); }
.field .error { font-size: 12px; color: var(--danger); display: none; }
.field.has-error .error { display: block; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }

/* Campos de texto, listas e datas: borda lilás, foco roxo com halo, seta e calendário no roxo da marca.
   Os controles nativos (seleção, caixas de marcar, zoom, arquivo, cor) são redesenhados para não sair no azul/cinza do sistema. */
:root { accent-color: var(--brand); color-scheme: light; --field-line: #d9d3ec; --halo: 0 0 0 3px rgba(132, 89, 221, .22); }
::selection { background: var(--accent); color: var(--ink); }
.input, input[type=text], input[type=search], input[type=url], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: var(--radius); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
:where(.input, input, select, textarea):hover:not(:disabled, :focus) { border-color: #b9aee0; }
:is(.input, input, select, textarea):focus { outline: none; border-color: var(--brand); box-shadow: var(--halo); }
.field.has-error :is(input, select, textarea):focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, .18); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::placeholder { color: #9a98b0; opacity: 1; }
:is(.input, input, select, textarea):disabled { background: var(--paper-2); color: var(--ink-3); cursor: not-allowed; }
/* Preenchimento automático do navegador (login): lilás da marca em vez do azul/amarelo do sistema */
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--brand-soft) inset; -webkit-text-fill-color: var(--ink); caret-color: var(--ink); }
input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 40px var(--brand-soft) inset, var(--halo); }
textarea { min-height: 120px; resize: vertical; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
.req::after { content: " *"; color: var(--brand); }

/* Lista de opções: seta própria em roxo */
select {
  -webkit-appearance: none; appearance: none; padding-right: 38px; cursor: pointer; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238459dd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center / 12px 8px;
}
select::-ms-expand { display: none; }
option { color: var(--ink); background: #fff; }

/* Datas: ícone de calendário em roxo */
input[type=date], input[type=datetime-local], input[type=time] { min-height: 42px; }
input::-webkit-calendar-picker-indicator { width: 18px; height: 18px; padding: 0; cursor: pointer; opacity: .9; color: transparent; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input:is([type=date], [type=datetime-local], [type=time])::-webkit-calendar-picker-indicator {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238459dd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / 18px no-repeat;
}
/* Campo com sugestões (datalist, ex.: Autor): mesma seta roxa das listas */
input[list]::-webkit-calendar-picker-indicator {
  width: 12px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238459dd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px 8px no-repeat;
}

/* Caixas de marcar e opções: quadrado/círculo com borda lilás, marcado em roxo */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; margin: 0; display: inline-grid; place-content: center;
  border: 1.5px solid #b9aee0; background: #fff; cursor: pointer; vertical-align: -4px; transition: background .12s, border-color .12s;
}
input[type=checkbox] { border-radius: 4px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before { content: ""; width: 11px; height: 11px; background: #fff; transform: scale(0); transition: transform .12s;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
input[type=radio]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
input:is([type=checkbox], [type=radio]):checked { background: var(--brand); border-color: var(--brand); }
input:is([type=checkbox], [type=radio]):checked::before { transform: scale(1); }
input:is([type=checkbox], [type=radio]):hover:not(:disabled) { border-color: var(--brand); }
input:is([type=checkbox], [type=radio]):focus { box-shadow: none; }
input:is([type=checkbox], [type=radio]):focus-visible { box-shadow: var(--halo); }
input:is([type=checkbox], [type=radio]):disabled { opacity: .5; cursor: not-allowed; background: var(--paper-2); }

/* Controle deslizante (zoom do editor de imagem): trilho lilás, parte preenchida e botão em roxo. --p = posição, vem do JS. */
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 6px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, var(--brand) var(--p, 0%), var(--line) var(--p, 0%));
}
input[type=range]:focus { box-shadow: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(11, 11, 15, .35); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(11, 11, 15, .35); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand); }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--halo); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: var(--halo); }

/* Envio de arquivo: botão no estilo dos botões da marca */
input[type=file] { font-size: 13px; color: var(--ink-3); cursor: pointer; }
input[type=file]:focus { box-shadow: none; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 8px 12px; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  background: var(--brand-soft); color: var(--brand-dark); font: 600 13px var(--font-ui); transition: background .15s, color .15s;
}
input[type=file]::file-selector-button:hover { background: var(--brand); color: #fff; }
input[type=file]:focus-visible::file-selector-button { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Seletor de cor: só a amostra, com a mesma borda dos campos */
input[type=color] { -webkit-appearance: none; appearance: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 4px; }

/* Blocos que abrem e fecham */
summary { cursor: pointer; }
summary::marker { color: var(--brand); }

/* Toast */
.toast-host { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; width: min(92vw, 420px); }
.toast { padding: 12px 16px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 14px; animation: toast-in .2s ease; }
.toast-ok { background: var(--ok); }
.toast-err { background: var(--danger); }
.toast-info { background: var(--brand-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Estados vazios */
.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-3); background: var(--paper-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }

/* Modal */
/* Modal: fundo preto Vértice com leve desfoque, cartão com faixa roxa no topo e losango amarelo no título; vermelho nas confirmações de exclusão */
.modal-bg { position: fixed; inset: 0; background: rgba(11,11,15,.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal-bg.open { display: flex; animation: modal-fade .18s ease; }
.modal { background: #fff; border-radius: 12px; border-top: 4px solid var(--brand); width: min(100%, 460px); padding: 22px; box-shadow: 0 24px 64px rgba(11,11,15,.4); animation: modal-in .2s ease; }
.modal.is-danger { border-top-color: var(--danger); }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.modal h3::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 10px; background: var(--accent); transform: rotate(45deg) translateY(-3px); }
.modal.is-danger h3::before { background: var(--danger); }
.modal .cm-text { color: var(--ink-2); font-size: 15px; margin: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
@media (max-width: 480px) { .modal-actions .btn { flex: 1; justify-content: center; } }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal-bg.open, .modal, .toast { animation: none; } }

/* Aviso */
.notice { padding: 10px 14px; border-left: 4px solid var(--accent); background: #fffbea; color: #5c4a00; font-size: 13px; border-radius: 0 var(--radius) var(--radius) 0; }
.notice-future { border-left-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
