/* Identidade Mult Variedades — cores, tipografia, formas e movimento (vale para os dois apps) */
:root {
  --azul: #2E3095; --azul-escuro: #1C1E66; --tinta: #16183F; --amarelo: #F5E92A; --amarelo-escuro: #E2D20F; --vermelho: #C8242B; --verde: #15803D;
  --bg: #F4F5F9; --surface: #FFFFFF; --text: #16183F; --texto: #33364F; --muted: #6A6D85; --line: #E3E4EE;
  --primary: var(--azul); --primary-h: var(--azul-escuro); --accent: var(--azul);
  --ok: #15803D; --ok-bg: #E3F4EA; --bad: #C8242B; --bad-bg: #FCE9EA; --warn: #7A5E00; --warn-bg: #FFF7C2; --info: #2E3095; --info-bg: #E9EAFA; --mute-bg: #ECEDF3;
  --r: 10px;
  --sombra-1: 0 1px 2px rgba(22, 24, 63, .06), 0 1px 3px rgba(22, 24, 63, .04);
  --sombra-2: 0 18px 40px -18px rgba(22, 24, 63, .28), 0 2px 6px rgba(22, 24, 63, .05);
  --f-titulo: "Montserrat", "Arial Black", Arial, sans-serif;
  --f-texto: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1030; --surface: #161946; --text: #EEF0FF; --texto: #C9CCE8; --muted: #9A9DC2; --line: #2A2E66;
    --primary: #6B6FE0; --primary-h: #8A8DF0; --accent: #A9ACFF;
    --ok: #5AD08E; --ok-bg: #12352A; --bad: #FF8A8F; --bad-bg: #3A1A2A; --warn: #F5E92A; --warn-bg: #34320F; --info: #A9ACFF; --info-bg: #23266A; --mute-bg: #23264F;
  }
}

body { font-family: var(--f-texto); color: var(--texto); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .titulo { font-family: var(--f-titulo); color: var(--text); letter-spacing: -.02em; }
h1 { font-weight: 800; }
a { color: var(--azul); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--accent); } }
::selection { background: var(--amarelo); color: var(--tinta); }
:focus-visible { outline: 3px solid rgba(46, 48, 149, .35); outline-offset: 2px; }

/* botões */
.btn { border-radius: 10px; font-weight: 600; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s, color .18s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--sombra-1); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.primary { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--azul-escuro); border-color: var(--azul-escuro); box-shadow: 0 8px 20px -8px rgba(46, 48, 149, .6); }
.btn.cta { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); font-weight: 700; }
.btn.cta:hover:not(:disabled) { background: var(--amarelo-escuro); border-color: var(--amarelo-escuro); box-shadow: 0 8px 22px -8px rgba(226, 210, 15, .8); }
.btn.contorno { border-color: var(--azul); color: var(--azul); background: transparent; }
.btn.contorno:hover:not(:disabled) { background: var(--azul); color: #fff; }
.btn.danger { color: var(--vermelho); border-color: rgba(200, 36, 43, .4); }
.btn.danger:hover:not(:disabled) { background: var(--vermelho); color: #fff; border-color: var(--vermelho); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } }

input, select, textarea { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 4px rgba(46, 48, 149, .12); }

.card { border-radius: 14px; box-shadow: var(--sombra-1); }
.badge { font-weight: 700; letter-spacing: .01em; }

/* tabelas */
th { background: #F7F8FC; color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) th { background: #1B1F55; } }
tbody tr { transition: background .15s; }
tbody tr.click:hover { background: #F5F6FE; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) tbody tr.click:hover { background: #1E2260; } }

/* modal e avisos */
.overlay { background: rgba(14, 16, 50, .55); backdrop-filter: blur(3px); animation: fade .2s ease both; }
.modal { border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(14, 16, 50, .5); animation: pop .28s var(--ease) both; border: 0; }
.modal-h h3 { font-family: var(--f-titulo); font-weight: 700; }
.toast { background: var(--tinta); color: #fff; border-radius: 12px; padding: 12px 18px 12px 16px; border-left: 4px solid var(--amarelo); box-shadow: 0 16px 40px -12px rgba(14, 16, 50, .55); animation: toast .35s var(--ease) both; font-weight: 500; }
.toast.err { background: var(--vermelho); border-left-color: #fff; }

/* movimento */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes brilho { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.anim { animation: subir .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

/* telhado da marca (motivo do logotipo), usado como elemento decorativo */
.telhado { position: absolute; pointer-events: none; color: var(--amarelo); }
.btn svg { width: 18px; height: 18px; flex: none; }
:root { color-scheme: light; }

/* campo de arquivo (comprovantes, fotos de produto) */
input[type="file"] { width: 100%; padding: 8px; min-height: 0; border: 1.5px dashed #C9CBEA; border-radius: 12px; background: #FBFBFE; color: var(--muted); font-size: .86rem; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
input[type="file"]:hover, input[type="file"]:focus, input[type="file"].arrastando { border-color: var(--azul); background: var(--info-bg); box-shadow: 0 0 0 4px rgba(46, 48, 149, .08); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; font-size: .84rem; border: 0; border-radius: 9px; padding: 9px 16px 9px 36px; margin-right: 12px; cursor: pointer;
  color: #fff; background: var(--azul) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E") no-repeat 12px center / 16px;
  transition: background-color .2s, transform .15s;
}
input[type="file"]::file-selector-button:hover { background-color: var(--azul-escuro); }
input[type="file"]:active::file-selector-button { transform: scale(.97); }
input[type="file"].tem-arquivo { border-style: solid; border-color: var(--ok); background: var(--ok-bg); color: var(--ok); font-weight: 600; }

/* telhado animado: as linhas se desenham uma a uma quando o grafismo aparece na tela (classe .ver via util.js) */
.telhado path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.telhado.ver path { animation: tracar 1.1s cubic-bezier(.65, 0, .35, 1) forwards; }
.telhado.ver path:nth-child(1) { animation-delay: .00s; } .telhado.ver path:nth-child(2) { animation-delay: .15s; }
.telhado.ver path:nth-child(3) { animation-delay: .45s; } .telhado.ver path:nth-child(4) { animation-delay: .30s; }
.telhado.ver path:nth-child(5) { animation-delay: .60s; } .telhado.ver path:nth-child(6) { animation-delay: .80s; }
.telhado.ver path:nth-child(7) { animation-delay: .10s; }
@keyframes tracar { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .telhado path { stroke-dashoffset: 0; } }

/* ---------- Cabeçalho de página: o mesmo nos dois apps (tamanho, alinhamento, espaço) ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin: 0 0 24px; min-width: 0; }
.page-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.page-head h1 { font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.75rem); line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.page-head .titulo-status { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.page-head .titulo-status .badge { font-size: .78rem; vertical-align: middle; }
.page-head .sub { color: var(--muted); font-size: .92rem; line-height: 1.4; margin-top: 6px; }
.page-head .actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; flex: 0 1 auto; max-width: 100%; margin: 0; }
.page-head .actions > .btn { white-space: nowrap; }
@media (max-width: 720px) {
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head .actions { width: 100%; justify-content: stretch; flex-wrap: nowrap; }
  .page-head .actions > * { flex: 1 1 0; min-width: 0; justify-content: center; }
  .page-head .actions > .btn { padding-left: 10px; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; }
}
.page-head .actions > .valor-destaque { flex: 0 0 auto; }
