:root {
    --pine: #1f4b3f;
    --pine-2: #2c6454;
    --sun: #f0b323;
    --bg: #eef2ec;
    --card: #ffffff;
    --ink: #1b2a25;
    --muted: #5b6b65;
    --line: #d5ddd6;
    --err: #b3261e;
    --r: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 12px; }
a { color: var(--pine); }
code { background: #e3e9e4; padding: 2px 6px; border-radius: 6px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 110px; }
.wrap.larga { max-width: 1000px; padding-bottom: 48px; }

.topo { background: var(--pine); color: #fff; }
.topo .wrap { padding-top: 28px; padding-bottom: 30px; }
.topo.larga .wrap { max-width: 1000px; }
.topo h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; }
.topo p { margin: 6px 0 0; color: #cfe3da; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- painéis e campos ---------- */
.painel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 18px 16px;
    margin-bottom: 18px;
}
.painel > h2 { margin-bottom: 12px; }

.campo { margin-bottom: 16px; }
.campo:last-child { margin-bottom: 0; }
.campo label, .rotulo { display: block; font-weight: 600; margin-bottom: 6px; }
.rotulo { margin-top: 0; }
.dica { color: var(--muted); font-size: 0.92rem; margin: 6px 0 0; }

input[type=text], input[type=tel], input[type=password], input[type=date], input[type=number], textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    padding: 12px 14px;
    min-height: 50px;
    border: 1.5px solid #9db0a7;
    border-radius: 10px;
    background: #fff;
}
textarea { min-height: 180px; line-height: 1.5; }

:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- botões ---------- */
.btn {
    appearance: none;
    border: 2px solid var(--pine);
    background: var(--pine);
    color: #fff;
    font: inherit;
    font-weight: 600;
    min-height: 50px;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.btn.sec { background: #fff; color: var(--pine); }
.btn.peq { min-height: 40px; padding: 6px 14px; font-size: 0.95rem; }
.btn.perigo { background: #fff; color: var(--err); border-color: var(--err); }
.btn[disabled] { opacity: 0.6; cursor: wait; }

/* ---------- alertas ---------- */
.alerta { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-weight: 500; }
.alerta.erro { background: #fbe9e7; color: #7a1710; border: 1px solid #e8b4ae; }
.alerta.ok { background: #e3f3ea; color: #14543a; border: 1px solid #a8d5be; }

/* ---------- escolha da refeição ---------- */
.refeicoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ref { position: relative; }
.ref input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ref span {
    display: flex; align-items: center; justify-content: center;
    min-height: 54px; border: 2px solid var(--line); border-radius: 12px;
    font-weight: 600; background: #fff; cursor: pointer;
}
.ref input:checked + span { border-color: var(--pine); background: var(--pine); color: #fff; }
.ref input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- cardápio ---------- */
.sec-titulo { margin: 8px 0 14px; }

.grupo {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 16px;
    overflow: hidden;
}
.grupo-cab {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 14px 16px; background: #f7faf6; border-bottom: 1px solid var(--line);
}
.cont { color: var(--muted); font-size: 0.95rem; }

/* compartimentos da quentinha: enchem conforme a pessoa escolhe */
.vagas { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.vagas i {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--pine); background: transparent; display: block;
}
.vagas i.cheia { background: var(--sun); }

.op {
    display: flex; align-items: center; gap: 12px;
    min-height: 52px; padding: 10px 16px;
    border-top: 1px solid var(--line);
    cursor: pointer; position: relative;
}
.grupo-cab + .op { border-top: 0; }
.op input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.marca {
    width: 26px; height: 26px; flex: none;
    border: 2px solid #7f958b; border-radius: 8px; background: #fff;
}
.op input:checked + .marca {
    background: var(--pine) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 80% no-repeat;
    border-color: var(--pine);
}
.op input:checked ~ .txt { font-weight: 600; }
.op input:focus-visible + .marca { outline: 3px solid var(--sun); outline-offset: 2px; }
.op input:disabled + .marca { opacity: 0.35; }
.op input:disabled ~ .txt { color: #9aa8a2; }

/* ---------- barra fixa do botão ---------- */
.barra {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(238, 242, 236, 0.97);
    border-top: 1px solid var(--line);
}
.barra .btn { display: flex; width: 100%; max-width: 528px; margin: 0 auto; }

/* ---------- pop-up ---------- */
dialog {
    border: 0; border-radius: 18px; padding: 22px;
    width: min(92vw, 420px); color: var(--ink);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(20, 35, 30, 0.55); }
dialog h2 { margin-bottom: 10px; }
.faltas { margin: 0 0 14px; padding-left: 20px; }
.faltas li { margin-bottom: 4px; }
.acoes { display: grid; gap: 10px; margin-top: 18px; }

/* ---------- confirmação ---------- */
.resumo-grupo { margin-bottom: 4px; }
.resumo-itens { margin-bottom: 16px; }
.resumo-itens:last-child { margin-bottom: 0; }

/* ---------- admin ---------- */
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.nav a {
    padding: 9px 14px; border-radius: 10px; text-decoration: none; font-weight: 600;
    background: #fff; border: 1.5px solid var(--line); color: var(--pine);
}
.nav a.ativo { background: var(--pine); border-color: var(--pine); color: #fff; }

.linha { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.linha .campo { margin-bottom: 0; flex: 1 1 160px; }
.etiqueta {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
    background: #e3f3ea; color: #14543a;
}
.etiqueta.fechado { background: #fbe9e7; color: #7a1710; }
.etiqueta.neutro { background: #eceeed; color: var(--muted); }
.painel-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.senha-atual { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.04em; }

.tabela-rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.92rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.vazio { color: var(--muted); }

/* relatório */
.rel-pedido { padding: 10px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.rel-pedido:last-child { border-bottom: 0; }
.rel-nome { font-weight: 700; }
.rel-linha { margin: 2px 0 0; }
.rel-linha b { font-weight: 600; }
.rel-total-grupo { margin: 14px 0 4px; }

@media (min-width: 700px) {
    .wrap { padding-top: 28px; }
    .vagas { max-width: none; }
}

@media print {
    .nao-imprimir, .barra, .nav, .topo { display: none !important; }
    body { background: #fff; font-size: 12pt; }
    .wrap, .wrap.larga { max-width: none; padding: 0; }
    .painel { border: 0; padding: 0; margin-bottom: 12px; }
    .imprimir-titulo { display: block !important; }
}
.imprimir-titulo { display: none; margin-bottom: 12px; }
