:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #22262f;
  --line: #2c313c;
  --text: #e9ecf1;
  --muted: #9aa3b2;
  --accent: #e0683c;      /* terracota Villa */
  --accent-2: #2e9e6b;    /* verde confirmar */
  --danger: #d8504a;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* Topo */
header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 18px; margin: 0; font-weight: 600; }
nav { display: flex; gap: 4px; }
.navlink {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: 6px 12px; border-radius: 8px;
}
.navlink:hover { color: var(--text); background: var(--panel-2); }
.navlink.ativo { color: #fff; background: var(--accent); }
.navlink .soon { font-size: 9px; opacity: .6; vertical-align: super; }
header .modo { margin-left: auto; font-size: 12px; color: var(--muted); }
.userbox { display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 12px; color: var(--muted); }
.btn-sair { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.btn-sair:hover { border-color: var(--accent); }

/* Tela de login */
.login { max-width: 360px; margin: 60px auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.login h2 { margin: 0 0 4px; }
.login p { margin: 0 0 18px; font-size: 13px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.login input { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px; }
.login .btn { width: 100%; margin-top: 18px; }
.login-erro { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }
header .modo b { color: var(--accent); }

main { padding: 20px; max-width: 1100px; margin: 0 auto; }

/* Botão voltar */
.voltar {
  background: none; border: none; color: var(--muted); font-size: 14px;
  padding: 4px 0; margin-bottom: 12px;
}
.voltar:hover { color: var(--text); }

/* Grid de ambientes/mesas */
h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 24px 0 10px; text-transform: uppercase; letter-spacing: .5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.mesa {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 12px; text-align: center; transition: .15s;
}
.mesa:hover { border-color: var(--accent); transform: translateY(-2px); }
.mesa .num { font-size: 22px; font-weight: 700; }
.mesa .st { font-size: 11px; margin-top: 6px; color: var(--muted); }
.mesa.ocupada { border-color: var(--accent); background: var(--panel-2); }
.mesa.ocupada .st { color: var(--accent); }
.mesa .valor { font-size: 12px; color: var(--accent-2); margin-top: 4px; font-weight: 600; }

/* Comanda: layout 2 colunas */
.comanda-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 820px){ .comanda-wrap { grid-template-columns: 1fr; } }

.cardapio-grupo { margin-bottom: 18px; }
.cardapio-grupo h3 { font-size: 13px; color: var(--accent); margin: 0 0 8px; }
.produto {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 7px; color: var(--text); text-align: left;
}
.produto:hover { border-color: var(--accent); }
.produto .nome { flex: 1; font-size: 14px; }
.produto .preco { color: var(--muted); font-size: 13px; }
.produto .mais { color: var(--accent); font-size: 20px; font-weight: 700; line-height: 1; }

/* Painel da conta */
.conta { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 76px; }
.conta h3 { margin: 0 0 4px; font-size: 16px; }
.conta .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.item .q { color: var(--muted); min-width: 28px; }
.item .n { flex: 1; }
.item .v { color: var(--text); }
.item .x { background: none; border: none; color: var(--danger); font-size: 16px; padding: 0 2px; }
.vazio { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }

.totais { margin-top: 14px; font-size: 14px; }
.totais .lin { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totais .lin.total { color: var(--text); font-size: 20px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

.btns { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.btn { border: none; border-radius: 10px; padding: 13px; font-size: 15px; font-weight: 600; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ok { background: var(--accent-2); color: #fff; }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 420px; }
.modal h3 { margin: 0 0 16px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.modal input, .modal select { width: 100%; padding: 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px; }
.fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.fp { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); text-align: center; font-size: 14px; }
.fp.sel { border-color: var(--accent); background: var(--accent); color: #fff; }
.modal .totalbox { background: var(--panel-2); border-radius: 8px; padding: 12px 14px; margin: 14px 0; }
.modal .totalbox .lin { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 2px 0; }
.modal .totalbox .lin.g { color: var(--text); font-size: 18px; font-weight: 700; }
.modal-acoes { display: flex; gap: 8px; margin-top: 18px; }
.modal-acoes .btn { flex: 1; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent-2); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.4); }

/* Sub-navegação (abas dentro de um módulo) */
.subnav { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.subtab { background: none; border: none; color: var(--muted); font-size: 14px; padding: 10px 14px; border-bottom: 2px solid transparent; }
.subtab:hover { color: var(--text); }
.subtab.sel { color: var(--accent); border-bottom-color: var(--accent); }

/* Tabelas */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabela td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
.tabela td.r, .tabela th.r { text-align: right; }
.tabela td.muted { color: var(--muted); }
.tabela tr.alerta td { background: rgba(216,80,74,.07); }
.badge { font-size: 10px; background: var(--danger); color: #fff; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }

.btn-mini { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; font-size: 13px; }
.btn-mini:hover { border-color: var(--accent); }
.btn-mini.ok { border-color: var(--accent-2); color: var(--accent-2); }

.status { font-size: 11px; padding: 3px 9px; border-radius: 20px; text-transform: capitalize; }
.status.aberto, .status.entrada { background: rgba(46,158,107,.18); color: #58c891; }
.status.recebido { background: rgba(46,158,107,.18); color: #58c891; }
.status.cancelado { background: rgba(216,80,74,.18); color: #e07a75; }
.status.saida, .status.venda { background: rgba(224,104,60,.18); color: #e8906a; }
.status.ajuste, .status.transferencia { background: var(--panel-2); color: var(--muted); }

.linha-item { display: grid; grid-template-columns: 1fr 70px 80px auto; gap: 6px; align-items: center; }
.linha-item select, .linha-item input { padding: 9px; }
#mvCustoBox { margin-top: 2px; }

/* Cards de resumo */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-left: 3px solid var(--line); }
.card.verde { border-left-color: var(--accent-2); }
.card.laranja { border-left-color: var(--accent); }
.card.vermelho { border-left-color: var(--danger); }
.card-rotulo { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.card-valor { font-size: 24px; font-weight: 700; }

/* OFX */
.ofx-import { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.ofx-import label { color: var(--muted); font-size: 13px; }
.ofx-import select { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.ofx-import input[type=file] { color: var(--muted); font-size: 13px; }

select { font-family: inherit; }

/* Fiscal */
.fiscal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.badge-info { font-size: 10px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.cupom { max-width: 360px; font-family: "SF Mono", ui-monospace, Menlo, monospace; }
.cupom-head { text-align: center; border-bottom: 1px dashed var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.cupom-itens { width: 100%; border-collapse: collapse; font-size: 12px; }
.cupom-itens th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 2px; border-bottom: 1px solid var(--line); }
.cupom-itens td { padding: 4px 2px; }
.cupom-itens .r, .cupom-total span:last-child { text-align: right; }
.cupom-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.cupom-chave { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }

/* Delivery — kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 820px){ .kanban { grid-template-columns: 1fr 1fr; } }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.col-head { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.col-head .muted { background: var(--panel-2); padding: 1px 7px; border-radius: 10px; margin-left: 4px; }
.pedido-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-bottom: 8px; }
.pc-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 2px; }

/* ---------- Fase 7: Cadastros (formulário maior) ---------- */
.modal.modal-lg { max-width: 640px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fg-item.fg-full { grid-column: 1 / -1; }
.form-secao { grid-column: 1 / -1; margin: 16px 0 2px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line); color: var(--accent-2);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.modal .form-grid label { margin-top: 10px; }
.modal textarea { width: 100%; padding: 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 15px; font-family: inherit; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 16px 0 2px; cursor: pointer; }
.check input { width: auto !important; }
.btn-mini.perigo { border-color: var(--danger); color: #e07a75; }
.btn-mini.perigo:hover { border-color: var(--danger); background: rgba(216,80,74,.1); }

/* ---------- Fase 8: Caixa / PDV ---------- */
.caixa-status { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; border-left: 4px solid var(--line); flex-wrap: wrap; }
.caixa-status.aberto { border-left-color: var(--accent-2); }
.caixa-status.fechado { border-left-color: var(--danger); }
.cs-rotulo { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.cs-valor { font-size: 30px; font-weight: 700; margin-bottom: 4px; }
.caixa-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.grande { padding: 14px 26px; font-size: 16px; }
.aviso-caixa { background: rgba(224,104,60,.12); border: 1px solid var(--accent); color: var(--text);
  font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; }
.aviso-caixa a { color: var(--accent); margin-left: 6px; }
