/* Mídia Mix — tema white label.
   As cores do tenant entram por custom properties (App.applyBranding), então
   trocar a marca não exige rebuild. */
:root {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --bg: #0f172a;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .1), 0 8px 24px -12px rgba(15, 23, 42, .2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--bg), var(--brand-dark));
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.brand.small { font-size: 16px; color: #fff; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: var(--brand); color: #fff;
  border-radius: 9px; font-size: 14px; font-weight: 800; letter-spacing: .5px;
}
.brand-sub { color: var(--muted); font-size: 13px; margin-bottom: 6px; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; }
input, select {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------------------------------------------------------------- shell */
/* Sidebar fixa no desktop; no celular vira gaveta sobre o conteúdo. A largura
   é fixa (não colapsável) porque o operador do balcão precisa reconhecer o
   item pelo rótulo, não pelo ícone. */
.app { display: flex; min-height: 100dvh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 30;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-text { font-weight: 700; font-size: 16px; color: #fff; }

.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group {
  display: block;
  padding: 14px 10px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #64748b;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; margin-bottom: 2px;
  font: inherit; font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
  color: #cbd5e1; background: transparent; border: 0; border-radius: 8px;
  cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: .9; }

.sidebar-footer {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.user-box { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-store { font-size: 11px; color: #94a3b8; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 16px; font-weight: 600; }
.menu-toggle {
  display: none;
  font: inherit; font-size: 20px; line-height: 1;
  background: transparent; border: 0; cursor: pointer; color: var(--text);
  padding: 4px 8px;
}
.overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 25;
}
.overlay.show { display: block; }

.view { padding: 24px; max-width: 1200px; width: 100%; }
.store-link {
  display: block; text-align: center; margin-top: 4px;
  font-size: 13px; color: var(--brand); text-decoration: none; font-weight: 600;
}
.store-link:hover { text-decoration: underline; }

h2 { font-size: 20px; margin-bottom: 4px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .value.warn { color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.tag.ok { background: #d1fae5; color: #065f46; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.danger { background: #fee2e2; color: #991b1b; }
.tag.info { background: #dbeafe; color: #1e40af; }

/* ------------------------------------------------------------------ pdv */
.pos { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.pos-search input { font-size: 17px; padding: 14px; }
.cart-item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
             padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .name { font-weight: 600; }
.cart-item .meta { font-size: 12px; color: var(--muted); }
.total-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.total-line.big { font-size: 26px; font-weight: 700; border-top: 2px solid var(--text); margin-top: 8px; padding-top: 12px; }
.pay-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.result-list { max-height: 300px; overflow-y: auto; }
.result-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; }
.result-item:hover { background: var(--surface-2); }

.drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: #eff6ff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg); color: #fff; padding: 12px 20px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 100; max-width: 90vw; font-size: 14px;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .view { padding: 16px; }
  .menu-toggle { display: block; }

  /* Gaveta: sai da esquerda por cima do conteúdo e escurece o fundo. */
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(15,23,42,.3);
  }
  .sidebar.open { transform: translateX(0); }
}
