:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --brand: #0f766e;
  --brand-dark: #0b5a54;
  --brand-soft: #e6f4f1;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --radius: 14px;
  --sidebar: #0c1a1a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover { background: var(--bg); }
.btn.block { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ---------- Login / landing ---------- */
.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth__side {
  background: linear-gradient(160deg, #0c1a1a 0%, #10403b 60%, #0f766e 100%);
  color: #eafaf7;
  padding: 56px 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth__brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.auth__logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 800;
}
.auth__side h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; max-width: 15ch; }
.auth__side p { color: rgba(234, 250, 247, 0.75); max-width: 42ch; margin-top: 16px; }
.auth__features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 12px; }
.auth__features li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: rgba(234, 250, 247, 0.85); }
.auth__features span { color: #5eead4; }
.auth__note { font-size: 12px; color: rgba(234, 250, 247, 0.5); }

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth__form { width: min(420px, 100%); padding: 32px; }
.auth__form h2 { font-size: 22px; }
.auth__form .hint { color: var(--muted); font-size: 14px; margin-top: 6px; }

.field { display: block; margin-top: 18px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field select,
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
}

.field input:focus,
.field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12); }

.form-grid {
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.form-grid .field { margin-top: 0; }
.form-grid .field.span-2 { grid-column: span 2; }

.inline { display: flex; gap: 8px; align-items: stretch; }
.inline input { flex: 1; }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel__head h2 { margin-bottom: 0; }

.access {
  border: 1px solid #abefc6;
  background: var(--ok-soft);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
  display: grid;
  gap: 6px;
}
.access code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 7px;
  font-size: 13px;
  word-break: break-all;
}
.access strong { color: var(--ok); }

@media (max-width: 640px) {
  .form-grid .field.span-2 { grid-column: span 1; }
}

.alert {
  margin-top: 18px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}
.alert[hidden] { display: none; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #abefc6; }

.foot { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Layout do app ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  color: #cfd8d8;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.sidebar__logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 15px;
}
.sidebar__store { font-size: 12px; color: #8fa3a3; margin-top: 4px; }
.nav { display: grid; gap: 4px; }
.nav button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: #b9c6c6;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav button[aria-current="true"] { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar__foot { margin-top: auto; display: grid; gap: 10px; }
.sidebar__user { font-size: 13px; color: #9fb0b0; word-break: break-word; }
.sidebar .btn.ghost { border-color: rgba(255, 255, 255, 0.16); color: #e6f0f0; }
.sidebar .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }

.main { padding: 28px clamp(16px, 4vw, 40px) 56px; max-width: 1180px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat { padding: 18px 20px; }
.stat__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.stat__meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.panel { padding: 22px; }
.panel > h2 { font-size: 16px; margin-bottom: 16px; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 550; word-break: break-word; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: #f2f4f7; color: #475467; }

.plan { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.plan__price { font-size: 26px; font-weight: 700; }
.plan__price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.plan ul li::before { content: "✓"; color: var(--brand); margin-right: 8px; font-weight: 700; }

.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.section[hidden] { display: none; }
.stack { display: grid; gap: 16px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border-radius: 11px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__side { padding: 32px 24px; gap: 24px; }
  .auth__side h1 { font-size: 26px; }
  .auth__features, .auth__note { display: none; }
  .shell { grid-template-columns: 1fr; }
  body.has-drawer .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(280px, 84vw);
    height: 100dvh;
    padding: 22px 18px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.has-drawer .sidebar.is-open {
    transform: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
  body.has-drawer .nav { grid-auto-flow: row; overflow: visible; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
}

/* ---------- Menu lateral em telas pequenas ---------- */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  flex: none;
}
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
.menu-toggle:hover { border-color: var(--brand); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(6, 18, 18, 0.5); }
body.menu-open { overflow: hidden; }
.page-head__start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sidebar__name { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; display: block; }
.sidebar__label { font-size: 11px; color: #8fa3a3; margin-top: 2px; }
@media (max-width: 900px) { body.has-drawer .menu-toggle { display: inline-flex; } }

/* ---------- Formulários extras (painel da loja) ---------- */
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 76px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12); }
.field input[type="color"] { padding: 4px; height: 44px; cursor: pointer; }
.field.check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.field.check > span { margin: 0; font-weight: 500; }
.field.check input[type="checkbox"] { width: auto; accent-color: var(--brand); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
}

.sidebar__logo.has-image { background: transparent; overflow: hidden; padding: 0; }
.sidebar__logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.brand-preview { display: flex; align-items: center; gap: 14px; }
.brand-preview__logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  overflow: hidden;
  flex: none;
}
.brand-preview__logo img { width: 100%; height: 100%; object-fit: cover; }

/* Ficha do cliente e pagamentos no painel. */
.sale-picker { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .sale-picker { grid-template-columns: 1fr; } }
.detail-block { margin-top: 20px; }
.detail-block h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* O atributo hidden precisa vencer os display dos componentes. */
[hidden] { display: none !important; }

/* --- Upload de imagens do produto ------------------------------------- */
.upload-drop {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  cursor: pointer;
}
.upload-drop__button { pointer-events: none; }
.upload-drop:hover .upload-drop__button { filter: brightness(1.08); }
.upload-drop small { color: var(--muted, #6b6b6b); font-size: 0.78rem; }

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.photo-thumb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line, #ddd);
  background: #f4f4f4;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.photo-thumb--pending { outline: 2px dashed var(--accent, #1f6f5c); outline-offset: -4px; }
.photo-thumb__main {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 0;
  font-size: 0.62rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(31, 111, 92, 0.85);
  color: #fff;
}
.thumb-stack { position: relative; display: inline-flex; }
.thumb-stack .thumb-more {
  position: absolute;
  right: -6px;
  bottom: -6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent, #1f6f5c);
  color: #fff;
  font-size: 0.68rem;
}
.receipt-method-field { max-width: 240px; margin-bottom: 12px; }

/* --- Logomarca (envio de imagem) -------------------------------------- */
.logo-upload { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-upload .brand-preview__logo { flex: none; }

/* --- Banners do site (carrossel do cabeçalho) -------------------------- */
.banner-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.banner-thumb {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.banner-thumb img { width: 100%; aspect-ratio: 16 / 6; object-fit: cover; display: block; }
.banner-thumb figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
