/* Tokens no padrão shadcn/ui (zinc). */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --destructive: 0 72.2% 50.6%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 71% 35%;
  --warning: 32 95% 44%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 5.5%;
    --card-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --destructive: 0 72% 55%;
    --success: 142 60% 45%;
    --warning: 38 92% 55%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 20%;
    --ring: 240 4.9% 83.9%;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: hsl(var(--background)); color: hsl(var(--foreground));
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 24px; font-weight: 700; }
a { color: inherit; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: hsl(var(--muted)); padding: 2px 6px; border-radius: 4px; }
.icon { flex: none; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.inline { display: inline; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; background: hsl(var(--background) / .85); backdrop-filter: blur(8px); border-bottom: 1px solid hsl(var(--border)); }
.topbar-inner { max-width: 1400px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand-lg { font-size: 18px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground)); text-decoration: none; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.nav-link:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-link.active { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--muted)); font-weight: 600; font-size: 12px; }
.user-name { font-weight: 500; }

/* Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

/* Card */
.card { background: hsl(var(--card)); color: hsl(var(--card-foreground)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05); }
.card-header { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 4px; }
.card-header p { margin: 0; }
.card-title { font-size: 16px; font-weight: 600; }
.card-content { padding: 16px 20px; }
.card-footer { padding: 0 20px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.empty { padding: 32px; text-align: center; color: hsl(var(--muted-foreground)); }
.fila-card { display: flex; flex-direction: column; }
.fila-card .card-content { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px);
  font: 500 14px/1 inherit; font-family: inherit; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, opacity .15s; background: transparent; color: inherit; }
.btn:focus-visible, .input:focus-visible, .toggle:focus-visible, .chip:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { background: hsl(var(--primary) / .9); }
.btn-outline { border-color: hsl(var(--input)); background: hsl(var(--background)); }
.btn-outline:hover, .btn-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; line-height: 1.4; white-space: nowrap; }
.badge-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-outline { border-color: hsl(var(--border)); }
.badge-success { background: hsl(var(--success) / .12); color: hsl(var(--success)); border-color: hsl(var(--success) / .25); }
.badge-destructive { background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / .25); }
.badge-warning { background: hsl(var(--warning) / .12); color: hsl(var(--warning)); border-color: hsl(var(--warning) / .3); }

/* Formulário */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 14px; font-weight: 500; }
.input { height: 36px; width: 100%; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px); background: transparent;
  padding: 0 12px; font: inherit; color: inherit; }
textarea.input { height: auto; padding: 8px 12px; resize: vertical; min-height: 38px; }
select.input { appearance: auto; }

/* Alert */
.alert { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.alert-destructive { border-color: hsl(var(--destructive) / .5); color: hsl(var(--destructive)); }
.alert-success { border-color: hsl(var(--success) / .4); }

/* Progress */
.progress { height: 8px; width: 100%; background: hsl(var(--secondary)); border-radius: 9999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: hsl(var(--primary)); border-radius: inherit; transition: width .3s; }
.progress-sm { height: 6px; min-width: 120px; }

/* Tabela */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { height: 40px; padding: 0 12px; text-align: left; font-weight: 500; color: hsl(var(--muted-foreground)); border-bottom: 1px solid hsl(var(--border)); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: hsl(var(--muted) / .5); }
.table th.right, .table td.right { text-align: right; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: hsl(var(--muted) / .4); }
.login-card { width: 100%; max-width: 380px; }

/* ---------- Tela de revisão ---------- */
.revisar .container { padding-bottom: 140px; }
.rev-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.rev-head .crumbs { display: flex; align-items: center; gap: 8px; color: hsl(var(--muted-foreground)); font-size: 13px; }
.rev-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rev-progress { display: flex; align-items: center; gap: 10px; min-width: 240px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 16px; margin-bottom: 16px; }
.meta .item { display: flex; flex-direction: column; }
.meta .k { font-size: 12px; color: hsl(var(--muted-foreground)); }
.meta .v { font-weight: 500; }
.hint-bar { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; color: hsl(var(--muted-foreground)); margin: -4px 0 16px; }

.fotos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.foto { display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.foto.ok { border-color: hsl(var(--success) / .55); }
.foto.nok { border-color: hsl(var(--destructive) / .7); box-shadow: 0 0 0 1px hsl(var(--destructive) / .4); }
.foto.duvida { border-color: hsl(var(--warning) / .7); box-shadow: 0 0 0 1px hsl(var(--warning) / .4); }
/* Guia */
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.guia h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 4px; }
.guia-grupo { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: hsl(var(--muted-foreground)); margin: 20px 0 10px; }
.guia-regras { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.guia-regra { display: flex; gap: 12px; padding: 16px; }
.guia-regra h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.guia-regra p { margin: 0; font-size: 14px; }
.guia-num { flex: none; width: 26px; height: 26px; border-radius: 999px; background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.guia-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.guia-cat { overflow: hidden; }
.guia-cat h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.guia-cat p { margin: 0; }
.guia-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: hsl(240 10% 6%); }
.guia-fotos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.guia-fim { display: flex; justify-content: center; margin: 32px 0 16px; }

.foto.pendente { border-style: dashed; }
.foto.faltando { border: 1px solid hsl(var(--destructive)); box-shadow: 0 0 0 3px hsl(var(--destructive) / .25); }
.foto .a-decidir { display: none; }
.foto.pendente .a-decidir { display: inline-flex; }
.foto .lembrete { display: none; font-size: 12px; font-weight: 500; color: hsl(var(--destructive)); }
.foto.nok .lembrete { display: block; }
.regra { border: 1px solid hsl(var(--border)); border-left: 3px solid hsl(var(--primary)); border-radius: var(--radius);
  background: hsl(var(--card)); padding: 10px 14px; margin: 0 0 16px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.regra .hint-bar { margin: 0; }
.regra a { color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.estado-salvar { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 150px; }
.contador { font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.contador.completo { color: hsl(var(--success)); }
.foto .img { position: relative; background: hsl(240 10% 6%); aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  cursor: zoom-in; overflow: hidden; }
.foto .img img { width: 100%; height: 100%; object-fit: contain; }
.foto .img .erro-img { color: hsl(0 0% 70%); font-size: 13px; padding: 16px; text-align: center; }
.foto .num { position: absolute; top: 8px; left: 8px; background: rgb(0 0 0 / .6); color: #fff; font-size: 12px; font-weight: 600;
  border-radius: 6px; padding: 2px 8px; }
.foto .corpo { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.foto .vista { font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.aval { font-size: 12px; display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.aval .motivo { color: hsl(var(--muted-foreground)); flex-basis: 100%; }
.pista { display: flex; flex-direction: column; gap: 6px; font-size: 12px; padding: 8px 10px; border-radius: calc(var(--radius) - 2px);
  border: 1px dashed hsl(var(--warning) / .6); background: hsl(var(--warning) / .07); }
.pista .row-between b { font-variant-numeric: tabular-nums; }
.pista .bar { height: 4px; border-radius: 9999px; background: hsl(var(--warning) / .2); overflow: hidden; }
.pista .bar span { display: block; height: 100%; background: hsl(var(--warning)); }
.pista.baixa { border-style: dotted; border-color: hsl(var(--border)); background: transparent; }
.pista.baixa .bar span { background: hsl(var(--muted-foreground)); }

.toggle-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: hsl(var(--muted)); border-radius: var(--radius); }
.toggle { height: 32px; border: 0; border-radius: calc(var(--radius) - 3px); background: transparent; font: 600 13px inherit; font-family: inherit;
  color: hsl(var(--muted-foreground)); cursor: pointer; transition: background .15s, color .15s; }
.toggle:hover { color: hsl(var(--foreground)); }
.toggle.on { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.toggle.on[data-e="ok"] { color: hsl(var(--success)); }
.toggle.on[data-e="nok"] { color: hsl(var(--destructive)); }
.toggle.on[data-e="duvida"] { color: hsl(var(--warning)); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .grupo { flex-basis: 100%; font-size: 11px; font-weight: 500; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.chip { height: 26px; padding: 0 10px; border-radius: 9999px; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  font: 500 12px inherit; font-family: inherit; color: inherit; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.chip:hover { background: hsl(var(--accent)); }
.chip.on { background: hsl(var(--destructive) / .1); border-color: hsl(var(--destructive) / .5); color: hsl(var(--destructive)); }

.revs-admin { margin-bottom: 16px; }
.revs-admin .card-content { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: hsl(var(--background) / .92); backdrop-filter: blur(8px);
  border-top: 1px solid hsl(var(--border)); }
.actionbar-inner { max-width: 1400px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 12px; align-items: center; }
.actionbar textarea { flex: 1; }
.actionbar .status { font-size: 13px; min-width: 120px; text-align: right; }
.actionbar .status.erro { color: hsl(var(--destructive)); }
.actionbar .status.ok { color: hsl(var(--success)); }
kbd { font: 11px ui-monospace, monospace; border: 1px solid hsl(var(--border)); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.btn-primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .6; }

.vazio { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.skeleton-line { height: 28px; width: 40%; border-radius: var(--radius); background: hsl(var(--muted)); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.zoom { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; background: rgb(0 0 0 / .92); }
.zoom::backdrop { background: rgb(0 0 0 / .8); }
.zoom[open] { display: flex; align-items: center; justify-content: center; overflow: auto; }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.zoom.real img { max-width: none; max-height: none; cursor: zoom-out; }
.zoom.real { align-items: flex-start; justify-content: flex-start; }
.zoom-hint { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); color: #ddd; font-size: 12px; background: rgb(0 0 0 / .5); padding: 4px 10px; border-radius: 6px; }

@media (max-width: 1100px) { .fotos { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two-col { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .fotos { grid-template-columns: 1fr; }
  .user-name, .nav-link span, .topbar .brand span { display: none; }
  .actionbar-inner { flex-wrap: wrap; }
  .actionbar textarea { flex-basis: 100%; }
  .actionbar .status { min-width: 0; text-align: left; flex: 1; }
  .estado-salvar { flex-basis: 100%; flex-direction: row; justify-content: space-between; align-items: center; min-width: 0; }
  .actionbar .btn { flex: 1 1 auto; }
  .actionbar #salvar { flex-basis: 100%; }
  .actionbar kbd, .hint-bar .atalhos { display: none; }
  .actionbar-inner { padding: 10px 16px; gap: 8px; }
  h1 { font-size: 20px; }
}
