:root {
  --ink: #13211b;
  --ink-2: #1d3329;
  --paper: #f3ead9;
  --paper-2: #efe4ce;
  --card: #fffaf0;
  --line: #dccdb0;
  --copper: #c45c26;
  --copper-2: #a3491c;
  --moss: #2f6f6a;
  --wine: #8a4a6a;
  --muted: #6d6456;
  --ok: #2c6e49;
  --warn: #b45309;
  --bad: #9b2c2c;
  --shadow: 0 18px 40px rgba(19, 33, 27, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Figtree, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

h1, h2, h3, .brand-type { font-family: Fraunces, Georgia, serif; font-weight: 650; letter-spacing: -0.03em; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.hidden { display: none !important; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
}
.mark {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: contain;
  background: transparent;
  display: block;
}
.login-card .mark { width: 92px; height: 92px; }
.login-card h1 { margin: 18px 0 6px; font-size: 32px; }
.login-card p.lead { margin: 0 0 22px; color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--copper); box-shadow: 0 0 0 3px rgba(196,92,38,.15); }
.btn {
  border: 0;
  background: var(--copper);
  color: #fff;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--copper-2); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.block { width: 100%; margin-top: 18px; }
.btn.sm { padding: 6px 10px; font-size: 12px; margin: 0 6px 0 0; width: auto; }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted); background: var(--paper-2); padding: 10px 12px; border-radius: 12px; }
.login-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--copper);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.hint.ok { color: var(--ok); }

/* Shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #efe4ce;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.side .brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 18px; }
.side .brand strong { display: block; color: var(--paper); font-size: 18px; }
.side .brand span { font-size: 12px; color: #c9b896; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; color: inherit; border: 0;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
}
.nav-btn:hover, .nav-btn.ativo { background: var(--ink-2); color: #fffaf0; }
.side .spacer { flex: 1; }
.user-chip { font-size: 12px; padding: 12px; border-top: 1px solid #2a4036; color: #c9b896; }
.user-chip b { color: var(--paper); display: block; margin-bottom: 2px; }

.main { padding: 22px 28px 40px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 30px; }
.muted { color: var(--muted); font-size: 14px; }

select.tenant {
  min-width: 220px;
  background: var(--card);
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kpi b { font-family: Fraunces, serif; font-size: 28px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(19,33,27,.05);
}
.pay-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(19,33,27,.05);
  max-width: 560px;
}
.pay-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.pay-valor { font-family: Fraunces, serif; font-size: 28px; color: var(--copper); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--paper-2); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--paper-2);
}
.badge.ok { background: #dcedd4; color: #2c6e49; }
.badge.warn { background: #fde7c7; color: #b45309; }
.badge.bad { background: #f8d4d4; color: #9b2c2c; }
.badge.trial { background: #d7ebe8; color: #2f6f6a; }

.tipo-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }

.empty { padding: 28px; text-align: center; color: var(--muted); }

.erro { color: var(--bad); font-size: 13px; margin: 8px 0 0; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 40;
}
.modal-card {
  width: min(520px, 100%);
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow: auto;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted);
}
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--ink); color: var(--paper);
  padding: 12px 16px; border-radius: 12px; z-index: 50;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; }
  .side .spacer, .user-chip { display: none; }
  .nav-btn { width: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .midia-grid { grid-template-columns: 1fr; }
}

/* Vitrine estilo iFood (cores da marca) */
.ifood-home { max-width: 720px; }
.ifood-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin: 4px 0 14px;
}
.ifood-search input { border: 0; background: transparent; padding: 12px 0; }
.ifood-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.ifood-cat {
  flex: 0 0 auto; border: 0; background: var(--paper-2); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-weight: 600; cursor: pointer;
}
.ifood-cat.ativo { background: var(--copper); color: #fff; }
.ifood-card {
  display: grid; grid-template-columns: 56px 1fr 92px; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; margin-bottom: 10px;
}
.ifood-logo, .ifood-thumb {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--paper-2);
  display: grid; place-items: center; font-weight: 800; color: var(--ink);
}
.ifood-thumb { width: 92px; height: 72px; border-radius: 12px; }
.ifood-card b { display: block; font-size: 16px; }
.ifood-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ifood-meta .ok { color: var(--moss); font-weight: 700; }
.ifood-chip {
  display: inline-block; margin-top: 6px; background: #dcedd4; color: #2c6e49;
  font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px;
}
code.user-code {
  font-size: 22px; letter-spacing: .18em; font-weight: 800;
  background: var(--paper-2); padding: 10px 16px; border-radius: 12px; display: inline-block;
}

.midia-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 16px; }
.midia-card {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--paper-2);
  position: relative;
}
.midia-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.midia-preview.logo { width: 96px; height: 96px; border-radius: 50%; }
.midia-preview.vazio { border: 1px solid var(--line); }
.midia-card input[type="file"] {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 0;
}
.midia-card .btn { display: inline-block; text-align: center; pointer-events: none; }
details { margin: 8px 0 14px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
