/* Identidade visual: Donato Gold — Brand Guidelines v1.0 */
@font-face {
  font-family: 'Roboto Condensed';
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/fonts/roboto-condensed-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto Condensed';
  font-weight: 700;
  font-display: swap;
  src: url('/vendor/fonts/roboto-condensed-latin-700-normal.woff2') format('woff2');
}

:root {
  --gold: #B38F40;          /* cor primária */
  --gold-light: #DFB94E;    /* degradê dourado */
  --navy: #0D1733;          /* secundária / degradê azul */
  --navy-light: #182B61;
  --cream: #EFD6AA;
  --copper: #B86E36;
  --brown: #8D4623;

  --grad-gold: linear-gradient(45deg, var(--gold), var(--gold-light));
  --grad-navy: linear-gradient(45deg, var(--navy), var(--navy-light));

  --bg: #FAF7F1;
  --surface: #FFFFFF;
  --text: var(--navy);
  --muted: #5A6178;
  --line: #E6E0D2;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 18px/1.4 'Roboto Condensed', 'Arial Narrow', system-ui, sans-serif;
}

h1, h2 { margin: 0 0 4px; font-weight: 700; line-height: 1.15; text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---------- topo ---------- */
.topbar {
  background: var(--grad-navy);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.topbar-inner, .statusbar-inner, .container { max-width: 760px; margin: 0 auto; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-logo { height: 44px; width: auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { color: var(--gold-light); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-app { font-weight: 700; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .04em; }
.side-nav { display: none; } /* lista de ações da barra lateral: só no visual "lateral" */
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-name { font-size: .9rem; opacity: .85; max-width: 22ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .user-name { display: none; } }

/* ---------- barra de status ---------- */
.statusbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px; position: sticky; top: 0; z-index: 5; }
.statusbar-warn { background: #FBF3E2; border-bottom-color: var(--cream); }
.statusbar-inner { display: flex; align-items: center; gap: 10px; }
.status-text { flex: 1; min-width: 0; font-size: .92rem; color: var(--muted); }
.statusbar-warn .status-text { color: var(--brown); }
.chip { flex: none; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px; }
.chip-on { background: #E3F1E6; color: #1F6B36; }
.chip-off { background: var(--navy); color: #fff; }

/* ---------- conteúdo ---------- */
.container { padding: 16px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
/* ---------- tela de login: formulário à esquerda, painel da marca à direita ---------- */
.login-tela {
  position: fixed; inset: 0; z-index: 20; overflow: auto; background: var(--navy);
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.login-quadro {
  display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; gap: 12px;
  min-height: 100%; padding: 12px; border-radius: 28px; background: var(--surface); color: var(--text);
  /* a tela de login tem visual fixo (Editorial), igual em qualquer tema */
  --surface: #FFFFFF; --text: var(--navy); --muted: #5A6178; color-scheme: light;
}
.login-lado { display: flex; flex-direction: column; padding: 18px 20px; }
.login-marca { display: flex; flex-direction: column; }
.login-marca-app { font-weight: 700; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .04em; }
.login-marca-nome { color: var(--gold); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.login-form { width: 100%; max-width: 340px; margin: auto; padding: 32px 0; }
.login-tela .login-form h1 { font-size: 2.3rem; margin-bottom: 0; color: var(--navy); }
.login-tela .login-form h1::after { content: ''; display: block; width: 56px; height: 4px; margin: 10px 0 12px; background: var(--grad-gold); }
.login-tela .login-form .btn { width: 100%; margin: 16px 0 18px; border-radius: 999px; background: var(--navy); color: var(--gold-light); }
.login-tela .login-form .btn:focus-visible { outline-color: var(--gold); }
.login-aviso { text-align: center; margin: 0; }
.login-erro { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #FBEAE8; color: #8C1D18; font-size: .9rem; overflow-wrap: anywhere; }
.login-painel {
  position: relative; display: flex; align-items: flex-end; min-height: 220px; padding: 36px; overflow: hidden;
  border-radius: 20px; color: #fff;
  background: var(--navy);
}
/* grafismo da marca: contornos de olho concêntricos, só a metade esquerda aparece, encostada na borda direita */
.login-olhos { position: absolute; left: 100%; top: 46%; width: 150%; max-width: none; transform: translate(-50%, -50%); pointer-events: none; }
.login-painel::after { content: ''; position: absolute; inset: 55% 0 0; background: linear-gradient(to top, var(--navy) 12%, rgba(13, 23, 51, 0)); pointer-events: none; }
.login-frase, .login-logo { z-index: 1; }
/* logo oficial na área livre à esquerda do grafismo */
.login-logo {
  position: absolute; left: 36px; top: 36px;
  display: flex; align-items: center; justify-content: center;
  width: min(34%, 220px);
}
.login-logo img { max-width: 100%; max-height: 100%; }
@media (max-width: 820px) {
  .login-quadro { grid-template-columns: 1fr; grid-template-rows: auto 1fr; border-radius: 22px; }
  .login-painel { order: -1; padding: 22px; border-radius: 14px; }
  .login-lado { padding: 14px 12px; }
  .login-marca { display: none; }
  .login-painel { min-height: 300px; }
  .login-logo { left: 22px; top: 22px; width: min(30%, 120px); }
  .login-olhos { top: 42%; }
}
/* ---------- login aprovado: o olho da marca pisca e a aplicação aparece ---------- */
.entrando body { background: var(--navy); }
.entrando body > :not(.splash) { visibility: hidden; }
.splash {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: #0D1733; transition: opacity .45s ease;
}
.splash.saindo { opacity: 0; pointer-events: none; }
.splash-olho { position: relative; width: min(56vw, 260px); overflow: hidden; animation: olho-surge .55s ease-out both; }
.splash-olho img { display: block; width: 100%; height: auto; }
/* pálpebra: uma forma da cor do fundo que desce por cima do olho. A borda desce reta até a altura dos cantos
   e depois se curva para baixo, acompanhando o contorno inferior; ela para um pouco antes do fim, e o filete
   dourado que sobra vira a linha do olho fechado. */
.splash-palpebra {
  position: absolute; left: 6.2%; top: -100%; width: 88.8%; height: 103%;
  background: #0D1733; border-radius: 0 0 50% 50% / 0 0 0% 0%;
  animation: palpebra 2.6s linear both;
}
@keyframes olho-surge { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
/* uma única piscada, calma: desce devagar, fica fechada um instante e sobe mais devagar ainda */
@keyframes palpebra {
  0%, 40% { height: 103%; border-radius: 0 0 50% 50% / 0 0 0% 0%; animation-timing-function: cubic-bezier(.5, 0, 1, .7); }
  48% { height: 156%; border-radius: 0 0 50% 50% / 0 0 0% 0%; animation-timing-function: cubic-bezier(0, .3, .6, 1); }
  54% { height: 193.1%; border-radius: 0 0 50% 50% / 0 0 42% 42%; }
  58% { height: 193.1%; border-radius: 0 0 50% 50% / 0 0 42% 42%; animation-timing-function: cubic-bezier(.4, 0, 1, .7); }
  66% { height: 156%; border-radius: 0 0 50% 50% / 0 0 0% 0%; animation-timing-function: cubic-bezier(0, .4, .3, 1); }
  84%, 100% { height: 103%; border-radius: 0 0 50% 50% / 0 0 0% 0%; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-palpebra { animation: palpebra-parada 1.2s linear both; }
  @keyframes palpebra-parada { from { transform: none; } to { transform: none; } }
}
/* frase com efeito de digitação na tela de login */
.login-frase { position: relative; min-height: 2.5em; margin: 0; font-size: clamp(1.25rem, 2.6vw, 2rem); font-weight: 700; line-height: 1.25; }
.digitar-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.digitar-cursor {
  display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -0.2em;
  border-radius: 1px; background: var(--gold); animation: digitar-pisca 1s ease-in-out infinite;
}
.digitar-cursor.ativo { animation: none; }
@keyframes digitar-pisca { 0%, 45% { opacity: 1; } 60%, 90% { opacity: 0; } 100% { opacity: 1; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.back { display: inline-block; padding: 6px 0 12px; color: var(--navy-light); font-weight: 700; text-decoration: none; }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-weight: 700; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.hint { font-size: .85rem; color: var(--muted); }

input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid #C9C2B2;
  border-radius: 10px;
  appearance: none;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(179, 143, 64, .3); }
input.invalid { border-color: #B3261E; }

.phones { display: flex; flex-direction: column; gap: 8px; }
.phone-row { display: flex; gap: 8px; }
.phone-row input { flex: 1; min-width: 0; }

@media (min-width: 640px) {
  .form-row { flex-direction: row; align-items: flex-end; }
  .field-date { flex: 0 0 190px; }
  .field-grow { flex: 1; }
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 22px;
  font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border: 0; border-radius: 10px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--navy-light); outline-offset: 2px; }
.btn-primary { background: var(--grad-gold); color: var(--navy); }
.btn-primary:active { filter: brightness(.94); }
.btn-lg { min-height: 58px; font-size: 1.1rem; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .85rem; }
.btn-ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .45); }
.btn-ghost-dark { background: transparent; color: var(--brown); border: 1.5px solid var(--line); flex: none; }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); flex: none; }
.btn-icon { flex: none; width: 52px; padding: 0; font-size: 1.7rem; line-height: 1; }
.btn-add { background: var(--navy); color: var(--gold-light); }
.btn-remove { background: transparent; color: var(--brown); border: 1.5px solid #C9C2B2; }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.list > .item:first-child { border-top: 0; }
.item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.avatar { display: none; } /* iniciais: usadas só no visual "painel" */
.item-title { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.count { flex: none; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--cream); color: var(--brown); }

/* ---------- aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 20px;
  background: var(--navy); color: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(13, 23, 51, .3);
  z-index: 10;
}

/* ---------- menu suspenso (Exportar) ---------- */
.card-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.menu-wrap { position: relative; }
.caret { margin-left: 6px; font-size: .8em; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 8; min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(13, 23, 51, .22);
}
.menu-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; min-height: 52px; padding: 8px 12px;
  font: inherit; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: rgba(179, 143, 64, .16); outline: none; }
.menu-item-title { font-weight: 700; letter-spacing: .04em; }
.menu-item-sub { font-size: .85rem; color: var(--muted); }
