/* KINTIN — baseado no LAYOUT ADM (mono, bordas sutis, degradê nos cards) */
:root {
  --c-bg: #FFFFFF; --c-surface: #FFFFFF; --c-sidebar: #F3F4F6;
  --c-border: #E5E7EB; --c-border-md: #D1D5DB;
  --c-text: #111827; --c-text-2: #6B7280; --c-text-3: #9CA3AF;
  --c-brand: #303030;
  --c-green: #3B6D11; --c-green-bg: #EAF3DE; --c-green-text: #27500A;
  --c-red: #A32D2D;   --c-red-bg: #FCEBEB;   --c-red-text: #791F1F;
  --c-amber: #854F0B; --c-amber-bg: #FAEEDA; --c-amber-text: #633806;
  --c-purple: #534AB7; --c-purple-bg: #EEEDFE; --c-purple-text: #3C3489;
  --c-blue: #1D6FA3; --c-blue-bg: #E3F0F8; --c-blue-text: #144E73;
  --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;
  --shadow-sm: 0 1px 4px 0 rgba(0,0,0,.05), 0 1px 2px -1px rgba(0,0,0,.05);
  --shadow-md: 0 1px 4px 0 rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px -8px rgba(0,0,0,.18);
  --font-sans: 'Geist Mono', ui-monospace, monospace;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidebar-w: 232px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font-sans); font-size: 13.5px; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--c-text-2); }
.fraco { color: var(--c-text-3); }
[hidden] { display: none !important; }
td.num, td .num, .pc-linha .num { white-space: nowrap; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--c-sidebar); border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column; padding: 14px 12px; position: sticky; top: 0; height: 100vh; z-index: 100;
  transition: width .18s ease, padding .18s ease; overflow: hidden; }
.app.sidebar-collapsed .sidebar { width: 0; padding-left: 0; padding-right: 0; border-right: none; }
.sidebar-logo { display: flex; align-items: center; gap: 9px; padding: 6px 10px 16px; font-size: 14px; font-weight: 700;
  letter-spacing: .08em; color: var(--c-text); text-decoration: none; white-space: nowrap; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-label { font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-3); padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-md); font-size: 13.5px;
  color: var(--c-text-2); text-decoration: none; white-space: nowrap; transition: background .12s, color .12s; }
.nav-item svg { flex-shrink: 0; opacity: .75; }
.nav-item:hover { background: var(--c-surface); color: var(--c-text); }
.nav-item.active { background: var(--c-text); color: #fff; font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--c-border); }
.sidebar-conta { padding: 4px 10px 10px; display: flex; flex-direction: column; font-size: 12px; white-space: nowrap; overflow: hidden; }
.sidebar-conta strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sidebar-conta span { color: var(--c-text-3); overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--c-border);
  background: var(--c-surface); position: sticky; top: 0; z-index: 90; }
.sidebar-toggle { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: none;
  background: transparent; border-radius: var(--r-sm); color: var(--c-text-2); }
.sidebar-toggle:hover { background: var(--c-sidebar); color: var(--c-text); }
.topbar-sep { width: 1px; height: 18px; background: var(--c-border); }
.topbar-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-acoes { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.main { flex: 1; min-width: 0; width: 100%; max-width: 1500px; margin: 0; padding: 28px 36px 60px; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; align-items: center; gap: 6px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--c-border); padding: 8px 12px; position: static; }
  .sidebar-logo { padding: 0 8px 0 4px; }
  .sidebar-logo, .sidebar-conta { display: none; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-label { display: none; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; display: flex; }
  .sidebar-toggle, .topbar-sep { display: none; }
  .app.sidebar-collapsed .sidebar { width: 100%; padding: 8px 12px; }
  .topbar { padding: 0 16px; }
  .main { padding: 18px 16px 48px; }
}

.sidebar-logo .logo-light { font-weight: 400; color: var(--c-text-3); }
.faixa-master { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--c-purple-bg); color: var(--c-purple-text); padding: 9px 20px; font-size: 12.5px; border-bottom: 1px solid #d9d6fb; }

/* ---------- cabeçalho de página ---------- */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pg-head h1 { font-size: 22px; }
.pg-head p { margin: 4px 0 0; color: var(--c-text-2); }
.barra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.barra .busca { flex: 1; min-width: 200px; max-width: 380px; }

/* ---------- cards ---------- */
.card, .metric-card { background: linear-gradient(to top, rgba(48,48,48,.05), var(--c-surface)); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card { margin-bottom: 16px; }
.card h2 { font-size: 14px; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-label { font-size: 12px; color: var(--c-text-2); margin-bottom: 8px; }
.metric-value { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-family: var(--font-mono); }
.metric-sub { font-size: 11.5px; color: var(--c-text-2); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- tabelas ---------- */
.tabela-wrap { border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow-x: auto; background: var(--c-surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-3); text-align: left; font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--c-border); white-space: nowrap; background: var(--c-surface); }
td { padding: 11px 12px; border-bottom: .5px solid var(--c-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: rgba(48,48,48,.025); }
tbody tr:hover td { background: var(--c-sidebar); }
th.r, td.r { text-align: right; }
td.acoes { white-space: nowrap; text-align: right; width: 1%; }
td.acoes .btn + .btn { margin-left: 4px; }
tr.clicavel { cursor: pointer; }
tr.arquivado td { opacity: .55; }
.nome-cel strong { font-weight: 600; display: block; }
.nome-cel small { color: var(--c-text-2); font-size: 11.5px; }
.vazio { padding: 48px 20px; text-align: center; color: var(--c-text-2); }
.vazio h3 { color: var(--c-text); font-size: 15px; margin-bottom: 6px; }
.vazio .btn { margin-top: 14px; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--r-md); border: 1px solid var(--c-border-md);
  background: var(--c-surface); color: var(--c-text); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s; line-height: 1.3; }
.btn:hover { background: var(--c-sidebar); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary, .btn-edit { background: var(--c-text); border-color: var(--c-text); color: #fff; }
.btn-primary:hover, .btn-edit:hover { background: #3A3A38; border-color: #3A3A38; }
.btn-danger { background: var(--c-red); border-color: var(--c-red); color: #fff; }
.btn-danger:hover { background: #8a2424; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { color: var(--c-text); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 11px 18px; font-size: 14px; justify-content: center; }
.btn-ico { padding: 0; width: 28px; height: 28px; justify-content: center; line-height: 0; flex-shrink: 0; border-radius: var(--r-sm); }
.btn-ico svg { display: block; }
.btn-danger.btn-ico { font-size: 18px; line-height: 1; font-weight: 400; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-full); font-size: 11px; font-weight: 500;
  background: var(--c-sidebar); color: var(--c-text-2); white-space: nowrap; font-family: var(--font-mono); }
.b-ok { background: var(--c-green-bg); color: var(--c-green-text); }
.b-err { background: var(--c-red-bg); color: var(--c-red-text); }
.b-warn { background: var(--c-amber-bg); color: var(--c-amber-text); }
.b-info { background: var(--c-purple-bg); color: var(--c-purple-text); }
.b-blue { background: var(--c-blue-bg); color: var(--c-blue-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-2); }
.t-ok { color: var(--c-green); } .t-err { color: var(--c-red); } .t-warn { color: var(--c-amber); }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--c-text-2); font-weight: 500; }
label small { font-weight: 400; color: var(--c-text-3); }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.check input { margin-top: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--c-border-md); border-radius: var(--r-md); background: #fff; color: var(--c-text);
  font-size: 13.5px; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--c-text); box-shadow: 0 0 0 3px rgba(17,24,39,.08); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input.num-in { font-family: var(--font-mono); text-align: right; }
.linha { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ajuda { font-size: 11.5px; color: var(--c-text-3); font-weight: 400; }
.campo-sufixo { position: relative; }
.campo-sufixo input { padding-right: 46px; }
.campo-sufixo span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); font-size: 12px; pointer-events: none; }
.seg { display: inline-flex; border: 1px solid var(--c-border-md); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.seg button { border: none; background: transparent; padding: 7px 12px; font-size: 12.5px; color: var(--c-text-2); }
.seg button + button { border-left: 1px solid var(--c-border); }
.seg button.on { background: var(--c-text); color: #fff; }

.alerta { padding: 10px 13px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 14px; }
.alerta-erro { background: var(--c-red-bg); color: var(--c-red-text); }
.alerta-ok { background: var(--c-green-bg); color: var(--c-green-text); }
.alerta-info { background: var(--c-amber-bg); color: var(--c-amber-text); }

/* ---------- modal ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 500; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto; animation: fade .12s ease; }
.modal { background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: sobe .16s ease; }
.modal.largo { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--c-border); }
.modal-head h2 { font-size: 15px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--c-border); background: #FAFAFA; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-foot .esq { margin-right: auto; }
@keyframes fade { from { opacity: 0 } }
@keyframes sobe { from { transform: translateY(8px); opacity: 0 } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--c-text); color: #fff; padding: 10px 15px; border-radius: var(--r-md); font-size: 13px; box-shadow: var(--shadow-lg);
  max-width: 360px; animation: sobe .16s ease; }
.toast.err { background: var(--c-red); }

/* ---------- ingrediente: calculadora de custo ---------- */
.calc-box { background: var(--c-sidebar); border-radius: var(--r-lg); padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.calc-box .k { font-size: 11px; color: var(--c-text-2); text-transform: uppercase; letter-spacing: .04em; }
.calc-box .v { font-family: var(--font-mono); font-size: 17px; font-weight: 600; }
.hist { margin-top: 6px; }
.hist table td, .hist table th { padding: 7px 10px; font-size: 12.5px; }

/* ---------- editor de ficha ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.painel-custo { position: sticky; top: 72px; }
@media (max-width: 1100px) { .painel-custo { position: static; } }
.pc-linha { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--c-border); gap: 10px; }
.pc-linha:last-child { border-bottom: none; }
.pc-linha span:first-child { color: var(--c-text-2); font-size: 12.5px; }
.pc-linha .num { font-weight: 600; }
.pc-grande { font-size: 30px; font-weight: 600; font-family: var(--font-mono); letter-spacing: -.02em; line-height: 1.1; }
.margem-barra { height: 8px; background: var(--c-sidebar); border-radius: var(--r-full); position: relative; margin: 10px 0 4px; overflow: hidden; }
.margem-barra i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-full); transition: width .2s, background .2s; }
.margem-barra b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--c-text); }
.sugerido { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--c-sidebar); border-radius: var(--r-md); padding: 9px 12px; margin-top: 10px; }

.add-item { display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px auto; gap: 8px; align-items: start; }
@media (max-width: 640px) { .add-item { grid-template-columns: 1fr 1fr; } .add-item .ac { grid-column: 1 / -1; } }
.ac { position: relative; }
.ac-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--c-border-md); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); z-index: 200; max-height: 300px; overflow-y: auto; padding: 4px; }
.ac-op { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.ac-op small { color: var(--c-text-3); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.ac-op.on, .ac-op:hover { background: var(--c-sidebar); }
.ac-op.novo { color: var(--c-text); font-weight: 500; border-top: 1px solid var(--c-border); margin-top: 2px; }
.itens-tab td { padding: 8px 10px; }
.itens-tab input { padding: 5px 8px; font-size: 13px; }
.itens-tab .q { width: 96px; }
.itens-tab .u { width: 74px; }
.peso { height: 4px; background: var(--c-sidebar); border-radius: var(--r-full); margin-top: 5px; overflow: hidden; max-width: 160px; }
.peso i { display: block; height: 100%; background: var(--c-text-3); border-radius: var(--r-full); }
.item-erro { color: var(--c-red); font-size: 11.5px; }
.foto-box { width: 100%; aspect-ratio: 4/3; border: 1px dashed var(--c-border-md); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center;
  color: var(--c-text-3); font-size: 12px; overflow: hidden; background: var(--c-sidebar); cursor: pointer; position: relative; }
.foto-box img { width: 100%; height: 100%; object-fit: cover; }
.thumb { width: 38px; height: 38px; border-radius: var(--r-sm); object-fit: cover; background: var(--c-sidebar); display: block; flex-shrink: 0; }
.thumb-vazio { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--c-sidebar); flex-shrink: 0; }
.nome-com-foto { display: flex; align-items: center; gap: 10px; }
.salvo-info { font-size: 12px; color: var(--c-text-3); }
.sujo .salvo-info { color: var(--c-amber); }

/* ---------- auth / site ---------- */
.auth-body { background: var(--c-sidebar); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .1em; font-size: 16px; text-decoration: none; margin-bottom: 22px; color: var(--c-text); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-sub { color: var(--c-text-2); margin: 0 0 18px; }
.auth-card h1 + .alerta, .auth-card h1 + .form { margin-top: 16px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 18px; font-size: 12.5px; color: var(--c-text-2); }
.auth-rodape { color: var(--c-text-3); font-size: 12px; margin-top: 20px; }
.site { background: #fff; }
.site-topo { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; max-width: 1180px; margin: 0 auto; gap: 12px; }
.site-topo .auth-logo { margin: 0; }
.site-topo nav { display: flex; gap: 8px; }
.site-hero { max-width: 1180px; margin: 0 auto; padding: 56px 28px 40px; }
.site-tag { display: inline-block; font-size: 12px; color: var(--c-text-2); border: 1px solid var(--c-border); border-radius: var(--r-full); padding: 4px 12px; margin: 0 0 18px; }
.site-hero h1 { font-size: clamp(28px, 5vw, 48px); line-height: 1.1; letter-spacing: -.03em; max-width: 820px; }
.site-lead { font-size: 15px; color: var(--c-text-2); max-width: 640px; margin: 18px 0 26px; line-height: 1.6; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 56px; }
.site-grid h3 { font-size: 14px; margin-bottom: 6px; }
.site-grid p { margin: 0; color: var(--c-text-2); font-size: 13px; line-height: 1.6; }
.site-rodape { text-align: center; color: var(--c-text-3); font-size: 12px; padding: 30px 16px; }
@media (max-width: 560px) { .site-topo nav .btn:first-child { display: none; } .site-topo { padding: 14px 16px; } .site-hero { padding: 32px 16px; } }

/* ---------- impressão ---------- */
.ficha-print { max-width: 820px; margin: 0 auto; padding: 32px; }
.ficha-print h1 { font-size: 24px; }
.ficha-print table { margin: 12px 0 20px; }
.ficha-print .cab { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; border-bottom: 2px solid var(--c-text); padding-bottom: 14px; margin-bottom: 18px; }
.ficha-print .cab img { width: 160px; height: 120px; object-fit: cover; border-radius: var(--r-md); }
.ficha-print .preparo { white-space: pre-wrap; line-height: 1.7; }
.so-tela { margin-bottom: 18px; display: flex; gap: 8px; }
@media print { .so-tela { display: none !important; } .ficha-print { padding: 0; } body { font-size: 12px; } tbody tr:nth-child(even) td { background: none; } }
