/* ============== Base ============== */
* { box-sizing: border-box; }
html, body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f7fb; color: #1d2433; }
a { color: #2956d3; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0 0 .5rem; font-size: 1.55rem; }
h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.muted { color: #6b7388; }
.small { font-size: .85rem; }

/* ============== Topbar ============== */
.topbar { background: #1d2433; color: #fff; }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: .65rem 1rem;
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.topnav a { color: #c9d1e6; padding: .25rem 0; }
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav a.cta { background: #2956d3; color: #fff; padding: .35rem .8rem; border-radius: 6px; }
.user { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: #c9d1e6; }

/* ============== Content ============== */
.content { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.rodape { text-align: center; padding: 1rem; color: #6b7388; font-size: .85rem; }

/* ============== Cards ============== */
.card { background: #fff; border-radius: 10px; padding: 1.1rem 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .75rem; gap: 1rem; flex-wrap: wrap; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
    gap: 1rem; margin-bottom: 1rem; }
.stat { text-align: center; }
.stat-n { font-size: 2rem; font-weight: 700; color: #2956d3; }
.stat-l { color: #6b7388; font-size: .9rem; }
.stat-warn .stat-n { color: #c98012; }
.stat-danger .stat-n { color: #b3261e; }

/* ============== Tables ============== */
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid #ecedf3;
    font-size: .92rem; }
.tabela th { background: #f7f9fc; font-weight: 600; color: #444c5e; }
.tabela .acoes { white-space: nowrap; display: flex; gap: .3rem; flex-wrap: wrap; }
.tabela .acoes form { margin: 0; }
.tabela.espelho td { font-variant-numeric: tabular-nums; }
.tabela.espelho tr.rd-fds td { background: #fafbfd; color: #777e92; }
.tabela.espelho .pos { color: #157347; }
.tabela.espelho .neg { color: #b3261e; }

/* ============== Forms & buttons ============== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .filtro label { display: flex; flex-direction: column; font-size: .85rem;
    color: #4a5266; gap: .25rem; }
.form-grid label.check { flex-direction: row; align-items: center; gap: .4rem; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=date], input[type=time], input[type=datetime-local],
input[type=month], select, textarea {
    border: 1px solid #d0d5dd; border-radius: 6px; padding: .5rem .65rem; font: inherit;
    background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #2956d3; outline-offset: 0; border-color: #2956d3; }
textarea { resize: vertical; }
fieldset { border: 1px dashed #d0d5dd; border-radius: 8px; padding: .75rem 1rem; }
fieldset legend { padding: 0 .35rem; color: #555c6e; font-weight: 600; font-size: .9rem; }
fieldset > label { display: inline-flex; flex-direction: column; margin-right: 1rem; margin-bottom: .5rem; }

.btn { display: inline-block; padding: .55rem 1rem; border-radius: 6px;
    border: 1px solid #d0d5dd; background: #fff; color: #1d2433; cursor: pointer; font: inherit;
    text-decoration: none; }
.btn:hover { background: #f5f7fb; }
.btn-primary { background: #2956d3; border-color: #2956d3; color: #fff; }
.btn-primary:hover { background: #1f47b8; }
.btn-mini { display: inline-block; padding: .25rem .55rem; border-radius: 5px;
    border: 1px solid #d0d5dd; background: #fff; color: #1d2433; cursor: pointer;
    font-size: .82rem; text-decoration: none; }
.btn-mini:hover { background: #f5f7fb; }
.btn-mini.b-danger, .btn.b-danger { background: #b3261e; color: #fff; border-color: #b3261e; }
.btn.big { font-size: 1.1rem; padding: .8rem 1.4rem; }
.actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }

/* ============== Filter row ============== */
.filtro { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }

/* ============== Badges ============== */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 10px;
    font-size: .78rem; background: #ecedf3; color: #444c5e; }
.b-ok { background: #d8f0df; color: #157347; }
.b-off, .b-rejeitado { background: #fadcd9; color: #b3261e; }
.b-pendente { background: #fdecc8; color: #b06800; }
.b-ajustado, .b-valido { background: #d8e7fb; color: #1f47b8; }
.b-danger { background: #fadcd9; color: #b3261e; }

/* ============== Flash ============== */
.flash { padding: .65rem 1rem; border-radius: 7px; margin-bottom: 1rem; font-size: .92rem; }
.flash-ok { background: #d8f0df; color: #157347; }
.flash-erro { background: #fadcd9; color: #b3261e; }
.flash-warn { background: #fdecc8; color: #6a3e00; }

/* ============== Login/install ============== */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { width: 360px; max-width: 92vw; }
.auth-card form { display: flex; flex-direction: column; gap: .85rem; margin-top: 1rem; }
.auth-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }

/* ============== Page head ============== */
.page-head { display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }

/* ============== Totem ============== */
.totem { display: grid; grid-template-columns: auto 1fr; gap: 2rem;
    background: #1d2433; color: #fff; padding: 2rem; border-radius: 12px; align-items: center; }
.totem-qr { background: #fff; padding: 1.25rem; border-radius: 10px; text-align: center; }
.totem-qr canvas { display: block; margin: 0 auto; }
.totem-timer { margin-top: .75rem; color: #444c5e; font-size: .9rem; }
.totem-info h2 { font-size: 1.5rem; }
.totem-info .muted { color: #aab3cc; }

/* ============== Face cards ============== */
.face-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.face-stage { position: relative; aspect-ratio: 4/3; background: #000; border-radius: 8px; overflow: hidden; }
.face-stage video, .face-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.face-side { display: flex; flex-direction: column; gap: 1rem; }
.face-status { padding: .55rem .8rem; background: #f5f7fb; border-radius: 6px; font-size: .92rem; }
.grid-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: .75rem; }
.thumb { text-align: center; }
.thumb img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }

/* ============== Registrar ponto ============== */
.registrar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.reg-passo { background: #f9fafd; padding: 1rem; border-radius: 8px; }
.reg-video-wrap { position: relative; aspect-ratio: 4/3; background: #000; border-radius: 8px; overflow: hidden; }
.reg-video-wrap video { width: 100%; height: 100%; object-fit: cover; }
#qr-overlay { position: absolute; inset: 0; border: 3px dashed rgba(41,86,211,.6); border-radius: 8px;
    pointer-events: none; }
.lista-pontos { list-style: none; padding: 0; margin: 0; }
.lista-pontos li { display: flex; justify-content: space-between; padding: .4rem 0;
    border-bottom: 1px solid #ecedf3; }
.lista-pontos li:last-child { border-bottom: none; }

/* ============== Correção cards ============== */
.correcao-card { padding: 1rem; border: 1px solid #ecedf3; border-radius: 8px; margin-bottom: .75rem; }
.cc-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.cc-body > div { margin-bottom: .25rem; }
.cc-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }

@media (max-width: 800px) {
    .form-grid, .face-card, .registrar-grid, .totem { grid-template-columns: 1fr; }
    .topnav { gap: .6rem; font-size: .9rem; }
}
