/* Base visual comum (painel do fotógrafo e galeria do cliente).
   Direção: branco neutro carrega a tela, tinta quase preta nos botões principais, e um único
   acento: o vermelho do lápis de marcar folha de contato, reservado para "foto escolhida".
   Cantos: painéis 12px, controles 8px, selos em pílula. Fonte: Figtree (servida daqui). */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #F6F6F4;
  --surface: #FFFFFF;
  --surface-2: #F1F1EE;
  --ink: #18191B;
  --ink-2: #2B2D30;
  --muted: #5B5E63;
  --line: #E3E3DF;
  --line-strong: #CFCFC9;
  --mark: #B3302A;          /* foto escolhida, destaque */
  --mark-soft: #F7E4E1;
  --mark-ink: #8E241D;
  --ok: #276445;
  --info: #2457C5;          /* azul: contagem de fotos escolhidas no painel */
  --ok-soft: #E2F0E7;
  --warn: #7A5200;
  --warn-soft: #FBEFD6;
  --danger: #A3271F;
  --on-ink: #FFFFFF;
  --on-danger: #FFFFFF;     /* texto sobre --danger (botões de apagar, aviso de erro) */
  --on-mark: #FFFFFF;       /* texto sobre --mark */
  --focus: #B3302A;
  --shadow: 0 1px 2px rgba(24, 25, 27, .06), 0 8px 24px rgba(24, 25, 27, .08);
  --shadow-lg: 0 2px 6px rgba(24, 25, 27, .08), 0 24px 64px rgba(24, 25, 27, .18);
  --overlay: rgba(18, 19, 21, .55);

  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-panel: 12px;
  --r-ctl: 8px;
  --r-pill: 999px;
  --t-fast: 140ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --surface: #191A1D; --surface-2: #212226; --ink: #ECECE8; --ink-2: #D6D6D2;
    --muted: #A5A8AD; --line: #2C2E32; --line-strong: #3B3E43; --mark: #EF6A5F; --mark-soft: #3A201D;
    --mark-ink: #F6A39B; --ok: #7CC69B; --ok-soft: #17301F; --warn: #E8B85C; --warn-soft: #33270F;
    --danger: #F08077; --on-ink: #111214; --on-danger: #1A0E0D; --on-mark: #1A0E0D; --focus: #EF6A5F;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 24px 64px rgba(0,0,0,.55);
    --overlay: rgba(0,0,0,.65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --surface: #191A1D; --surface-2: #212226; --ink: #ECECE8; --ink-2: #D6D6D2;
  --muted: #A5A8AD; --line: #2C2E32; --line-strong: #3B3E43; --mark: #EF6A5F; --mark-soft: #3A201D;
  --mark-ink: #F6A39B; --ok: #7CC69B; --ok-soft: #17301F; --warn: #E8B85C; --warn-soft: #33270F;
  --danger: #F08077; --on-ink: #111214; --on-danger: #1A0E0D; --on-mark: #1A0E0D; --focus: #EF6A5F;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 24px 64px rgba(0,0,0,.55);
  --overlay: rgba(0,0,0,.65);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--mark-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ico { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sem-quebra { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botões */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--b-line); background: var(--b-bg); color: var(--b-fg);
  font: 600 14px/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.btn:hover { --b-bg: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primario { --b-bg: var(--ink); --b-fg: var(--on-ink); --b-line: var(--ink); }
.btn-primario:hover { --b-bg: var(--ink-2); }
.btn-marca { --b-bg: var(--mark); --b-fg: var(--on-mark); --b-line: var(--mark); }
.btn-marca:hover { --b-bg: var(--mark-ink); }
.btn-perigo { --b-fg: var(--danger); }
.btn-perigo-cheio { --b-bg: var(--danger); --b-fg: var(--on-danger); --b-line: var(--danger); }
/* Sem isto o .btn:hover (fundo claro) vencia e o texto branco sumia ao passar o mouse. */
.btn-perigo-cheio:hover { --b-bg: color-mix(in srgb, var(--danger) 86%, var(--ink)); }
.btn-fantasma { --b-bg: transparent; --b-line: transparent; }
.btn-fantasma:hover { --b-bg: var(--surface-2); }
.btn-pequeno { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-grande { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn-icone { width: 38px; padding: 0; }
.btn-icone.btn-pequeno { width: 32px; }

/* Campos */
.campo { display: grid; gap: 6px; min-width: 0; }
.campo > label, .rotulo { font-size: 13px; font-weight: 600; color: var(--ink); }
.campo .ajuda { font-size: 13px; color: var(--muted); }
.campo .erro { font-size: 13px; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 400 15px/1.35 var(--font); transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
textarea.input { min-height: 96px; resize: vertical; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 14%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-prefixo { display: flex; align-items: stretch; }
.input-prefixo > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-ctl) 0 0 var(--r-ctl); background: var(--surface-2); color: var(--muted); font-size: 14px; }
.input-prefixo > .input { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.input-sufixo { display: flex; align-items: stretch; }
.input-sufixo > .input { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.input-sufixo > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--r-ctl) var(--r-ctl) 0; background: var(--surface-2); color: var(--muted); font-size: 14px; }

/* Escolha em cartões (como os modos da Alboom) */
.opcoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.opcao { position: relative; display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--surface); cursor: pointer; transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out); }
.opcao:hover { border-color: var(--muted); }
.opcao input { position: absolute; opacity: 0; pointer-events: none; }
.opcao b { font-weight: 650; }
.opcao span { font-size: 13px; color: var(--muted); }
.opcao:has(input:checked) { border-color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ink); }
.opcao:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Interruptor */
.interruptor { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.interruptor input { appearance: none; flex: none; width: 38px; height: 22px; margin: 1px 0 0; border-radius: var(--r-pill); background: var(--line-strong); position: relative; cursor: pointer; transition: background-color var(--t-fast) var(--ease-out); }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--t-fast) var(--ease-out); }
.interruptor input:checked { background: var(--ink); }
.interruptor input:checked::after { transform: translateX(16px); }
.interruptor input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.interruptor .texto { display: grid; gap: 2px; }
.interruptor .texto b { font-weight: 600; }
.interruptor .texto span { font-size: 13px; color: var(--muted); }

/* Selos */
.selo { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; line-height: 1.3; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.selo-ok { background: var(--ok-soft); color: var(--ok); }
.selo-aviso { background: var(--warn-soft); color: var(--warn); }
.selo-marca { background: var(--mark-soft); color: var(--mark-ink); }
.selo-tinta { background: var(--ink); color: var(--on-ink); }

/* Painel (superfície) */
.painel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.painel-corpo { padding: 20px; }
.secao-titulo { display: grid; gap: 4px; margin-bottom: 18px; }
.secao-titulo p { color: var(--muted); }
.divisor { height: 1px; background: var(--line); border: 0; margin: 20px 0; }
.pilha { display: grid; gap: 16px; }
.linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.linha-entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .grade-2 { grid-template-columns: 1fr; } }

/* Aviso em linha */
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.aviso-info { background: var(--surface-2); color: var(--ink); }
.aviso-ok { background: var(--ok-soft); color: var(--ok); }
.aviso-marca { background: var(--mark-soft); color: var(--mark-ink); }

/* Indicador de salvamento */
.salvo {
  display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 10px 0 9px;
  border-radius: var(--r-pill); font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.salvo:empty { display: none; }
.salvo::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; transition: transform 200ms var(--ease-out); }
.salvo[data-estado="editando"] { background: var(--warn-soft); color: var(--warn); }
.salvo[data-estado="salvando"] { background: var(--surface-2); color: var(--muted); }
.salvo[data-estado="salvando"]::before { width: 11px; height: 11px; background: none; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: girar 700ms linear infinite; }
.salvo[data-estado="salvo"] { background: var(--ok-soft); color: var(--ok); }
.salvo[data-estado="salvo"]::before, .salvo[data-estado="salvo-antes"]::before {
  width: 9px; height: 5px; border-radius: 0; background: none; border: solid currentColor; border-width: 0 0 2px 2px;
  transform: translateY(-2px) rotate(-45deg);
}
.salvo[data-estado="salvo-antes"] { background: transparent; color: var(--ok); }
.salvo[data-estado="erro"] { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); white-space: normal; }
@media (prefers-reduced-motion: no-preference) {
  .salvo[data-estado="salvo"]::before { animation: marcar-salvo 260ms var(--ease-out); }
  @keyframes marcar-salvo { from { transform: translateY(-2px) rotate(-45deg) scale(.4); opacity: 0; } to { transform: translateY(-2px) rotate(-45deg) scale(1); opacity: 1; } }
}
@keyframes girar { to { transform: rotate(360deg); } }

/* Esqueleto de carregamento */
.esqueleto { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; border-radius: var(--r-ctl); animation: brilho 1.2s ease-in-out infinite; }
@keyframes brilho { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .esqueleto, .salvo[data-estado="salvando"]::before { animation: none; } }

/* Janela (diálogo) */
dialog.janela { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--r-panel); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: auto; }
dialog.janela::backdrop { background: var(--overlay); }
dialog.janela[open] { animation: entrar-janela 220ms var(--ease-out); }
@keyframes entrar-janela { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.janela[open] { animation: none; } }
.janela-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.janela-corpo { padding: 20px; display: grid; gap: 16px; }
.janela-rodape { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

/* Avisos rápidos (toast) */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-lg); font-size: 14px; animation: entrar-toast 220ms var(--ease-out); }
.toast.erro { background: var(--danger); color: var(--on-danger); }
@keyframes entrar-toast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Confirmação na própria tela (substitui confirm(), que não funciona em todo lugar) */
.confirmar { display: grid; gap: 12px; padding: 14px; border-radius: var(--r-ctl); border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.confirmar p { font-size: 14px; }

/* Tabela simples */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.tabela td { padding: 12px 12px 12px 0; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tabela tr:last-child td { border-bottom: 0; }

/* Barra de progresso (envio) */
.progresso { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progresso > i { display: block; height: 100%; width: var(--p, 0%); background: var(--ink); border-radius: inherit; transition: width 300ms var(--ease-out); }

/* Grade de miniaturas genérica (painel) */
.miniaturas { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.miniatura { position: relative; display: grid; gap: 6px; min-width: 0; }
.miniatura .quadro { position: relative; aspect-ratio: 1; border-radius: var(--r-ctl); overflow: hidden; background: var(--surface-2); }
.miniatura .quadro img { width: 100%; height: 100%; object-fit: cover; }
.miniatura .nome { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Calendário (shared/calendario.js) */
.cal { position: relative; min-width: 0; }
.cal-campo { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.cal-campo .ico { color: var(--muted); }
.cal-campo .cal-vazio { color: var(--muted); }
.cal-quadro {
  position: fixed; z-index: 1000; top: 0; left: 0; width: 304px; max-width: calc(100vw - 16px);
  padding: 14px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-lg);
}
@media (prefers-reduced-motion: no-preference) {
  .cal-quadro:not([hidden]) { animation: entrar-cal 160ms var(--ease-out); }
  @keyframes entrar-cal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}
.cal-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-topo b { font-weight: 650; font-size: 15px; }
.cal-seta { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.cal-seta:hover { background: var(--surface-2); color: var(--ink); }
.cal-semana, .cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-semana span { text-align: center; font-size: 12.5px; color: var(--muted); padding-bottom: 6px; }
.cal-dia {
  height: 38px; margin: 1px; border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  font: 400 14.5px/1 var(--font); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.cal-dia:hover { background: var(--surface-2); }
.cal-dia:active { transform: scale(.94); }
.cal-dia:disabled { color: var(--line-strong); cursor: default; background: transparent; transform: none; }
.cal-dia.cal-hoje { font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-dia.cal-escolhido { background: var(--ink); color: var(--on-ink); font-weight: 650; box-shadow: none; }
.cal-rodape { display: flex; gap: 8px; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
