/* ============================================================
   MAIAS POS — sistema de design v2 (identidade Maias Mult Service)
   Preto · vermelho · branco. Serigrafia, reprografia e gráfica.
   Regras: nenhum ID, rota ou regra de negócio muda. Só a pele.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  /* marca */
  --red: #e10600;
  --red-deep: #b80000;
  --red-soft: #fff1f0;
  --red-glow: rgba(225, 6, 0, .18);
  --ink: #0b0b0d;
  --charcoal: #15151a;
  --graphite: #1f1f26;
  --slate: #2b2b34;

  /* aliases legados (o JS antigo pode referi-los) */
  --maias-red: var(--red);
  --maias-red-deep: var(--red-deep);
  --maias-black: var(--ink);
  --maias-charcoal: var(--charcoal);
  --maias-graphite: var(--graphite);
  --azul: var(--ink); --azul2: var(--red-deep); --azul3: var(--charcoal); --vermelho: var(--red);

  /* superfícies (tema claro) */
  --bg: #f3f4f6;
  --bg-2: #e9ebef;
  --card: #ffffff;
  --card-soft: #f7f8fa;
  --text: #16161a;
  --muted: #6b6f7a;
  --line: #e3e5ea;
  --line-soft: #eef0f3;
  --ok: #17a05a; --ok-bg: #e6f7ee; --ok-line: #bfe7d0;
  --warn: #c77700; --warn-bg: #fff5e0; --warn-line: #f2d59a;
  --danger: #d12b2b; --danger-bg: #fdeceb; --danger-line: #f3c4c1;
  --info: #3b5bdb; --info-bg: #eaf0ff; --info-line: #c7d4fb;
  --shadow-sm: 0 1px 2px rgba(15, 15, 20, .05), 0 1px 1px rgba(15, 15, 20, .03);
  --shadow: 0 1px 3px rgba(15, 15, 20, .06), 0 10px 30px -12px rgba(15, 15, 20, .14);
  --shadow-lg: 0 24px 60px -18px rgba(15, 15, 20, .35);
  --ring: 0 0 0 3px var(--red-glow);
  --r-lg: 18px; --r: 14px; --r-sm: 10px; --r-xs: 8px;
  --radius: var(--r); --radius-sm: var(--r-sm);
  --top-h: 60px;
  --side-w: 250px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0f0f13;
  --bg-2: #15151b;
  --card: #1a1a21;
  --card-soft: #20202a;
  --text: #ecedf1;
  --muted: #9a9eab;
  --line: #2b2c36;
  --line-soft: #24252e;
  --red-soft: #3a1210;
  --ok-bg: #0f2a1c; --ok-line: #1f4a30; --ok: #3ccf7f;
  --warn-bg: #2f2410; --warn-line: #574117; --warn: #f0b040;
  --danger-bg: #331515; --danger-line: #5a2222; --danger: #ff6b6b;
  --info-bg: #171e35; --info-line: #2b3a6b; --info: #8ea6ff;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; width: 100%; max-width: 100vw; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
img, svg, canvas { max-width: 100%; }
b, strong { font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .88rem; }
.mt { margin-top: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--red); color: #fff; }

/* ícones SVG inline */
.ic-svg { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- tipografia ---------- */
h1 { margin: 0; font-size: 1.05rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
h2::before { content: ""; width: 4px; height: 1em; border-radius: 4px; background: linear-gradient(180deg, var(--red), var(--red-deep)); flex: none; }
.spread > h2 { margin-bottom: 0; }
h3 { margin: 16px 0 8px; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }

/* ---------- feedback ---------- */
.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-top: 10px;
  line-height: 1.4;
  font-weight: 500;
}
.error:empty { display: none; }
.loginStatus { display: none; margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.loginStatus.show { display: flex; gap: 9px; align-items: center; }
.loginStatus.loading { color: var(--text); background: var(--card-soft); border: 1px solid var(--line); }
.loginStatus.success { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.loginStatus.errorState { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); }
.spinner { width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- botões ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--card-soft);
  color: var(--text);
  padding: 10px 14px;
  font-size: .9rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, box-shadow .15s ease, color .15s ease;
  border-color: var(--line);
}
.btn:hover { background: var(--bg-2); border-color: #d3d6dd; }
html[data-theme="dark"] .btn:hover { border-color: #3a3b47; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(225, 6, 0, .55);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px -6px rgba(225, 6, 0, .65); }
.btn.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: inherit; border-color: var(--line); }
.btn.ghost:hover { background: var(--card-soft); }
.btn.sm { padding: 6px 11px; min-height: 32px; font-size: .8rem; border-radius: var(--r-xs); }
.btn.full { width: 100%; }
.btn.big { padding: 13px 18px; min-height: 50px; font-size: 1rem; border-radius: 12px; }
.btn.icon { padding: 0; width: 36px; min-width: 36px; height: 36px; min-height: 36px; border-radius: 10px; }

/* ---------- campos ---------- */
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 600; min-width: 0; }
input, select, textarea {
  width: 100%; max-width: 100%; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--text);
  outline: none;
  font-size: .94rem;
  font-weight: 500;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #a5a9b4; font-weight: 400; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--red); }
select option { color: var(--text); background: var(--card); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.checkRow { flex-direction: row; align-items: center; gap: 8px; }

/* ---------- cartões ---------- */
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card { padding: 20px; }
.panel { padding: 16px; min-width: 0; }
.card > .card, .card .tableWrap { box-shadow: none; }

/* ---------- pastilhas ---------- */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; font-size: .74rem; font-weight: 700;
  padding: 4px 10px; white-space: nowrap; line-height: 1.2;
}
.badge { border: 1px solid var(--line); background: var(--card-soft); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.pill { background: rgba(255, 255, 255, .12); color: inherit; }

/* ============================================================
   LOGIN — ecrã dividido: marca à esquerda, formulário à direita
   ============================================================ */
.pos-page .wrap { min-height: 100vh; }
.loginWrap {
  position: fixed; inset: 0; z-index: 120;
  width: 100%; max-width: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; box-shadow: none;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  background: var(--bg);
}
.loginBrand {
  position: relative;
  overflow: hidden;
  color: #fff;
  /* foto real da loja (static/img/fundo.webp do site) por baixo de um véu escuro com o vermelho da marca */
  background:
    radial-gradient(900px 600px at -10% -10%, rgba(225, 6, 0, .55), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(225, 6, 0, .30), transparent 55%),
    linear-gradient(160deg, rgba(20, 20, 25, .84) 0%, rgba(11, 11, 13, .93) 100%),
    url("../img/loja.webp") center / cover no-repeat #0b0b0d;
  padding: 52px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.loginBrand::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}
.loginBrand > * { position: relative; }
.brandMark { display: flex; align-items: center; gap: 12px; }
.brandMark .mark {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; color: #fff;
  box-shadow: 0 12px 30px -8px rgba(225, 6, 0, .8);
}
.brandMark .wm { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; line-height: 1.1; }
.brandMark .wm small { display: block; font-family: var(--font); font-weight: 500; font-size: .7rem; letter-spacing: .18em; color: rgba(255, 255, 255, .6); margin-top: 3px; }
.loginHero h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 3.2vw, 2.8rem); line-height: 1.08; font-weight: 700; letter-spacing: -.02em; margin: 0 0 14px; max-width: 14ch; }
.loginHero h1 em { font-style: normal; color: var(--red); }
.loginHero p { color: rgba(255, 255, 255, .7); font-size: 1rem; max-width: 46ch; margin: 0 0 28px; line-height: 1.55; }
.loginFeat { display: grid; gap: 12px; max-width: 460px; }
.loginFeat div { display: flex; gap: 12px; align-items: center; font-size: .92rem; color: rgba(255, 255, 255, .86); font-weight: 500; }
.loginFeat span.i { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: #ff8a85; flex: none; }
.loginFoot { font-size: .78rem; color: rgba(255, 255, 255, .45); display: flex; gap: 16px; flex-wrap: wrap; }
.loginFormSide { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.loginInner {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow-lg);
}
.loginLogo { display: flex; justify-content: center; margin-bottom: 10px; }
.loginLogo img { height: 60px; width: auto; object-fit: contain; }
.loginWrap h2 { justify-content: center; margin: 4px 0 4px; font-size: 1.35rem; }
.loginWrap h2::before { display: none; }
.loginWrap .loginLead { text-align: center; margin: 0 0 22px; font-size: .88rem; color: var(--muted); }
.loginFields { display: flex; flex-direction: column; gap: 13px; }
.loginWrap input { padding: 12px 13px; font-size: 1rem; }
.loginWrap .btn.big { margin-top: 4px; }
.loginHint { text-align: center; margin-top: 16px; font-size: .78rem; color: var(--muted); }
.loginHint kbd { font-family: var(--mono); font-size: .72rem; background: var(--card-soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

/* ============================================================
   BARRA SUPERIOR
   ============================================================ */
.top {
  width: 100%; min-height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px;
  background: linear-gradient(90deg, #0d0d10 0%, #16161c 60%, #1c1418 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 6px 24px -10px rgba(0, 0, 0, .6);
}
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--red) 0%, var(--red-deep) 40%, transparent 100%); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logoHeader { height: 36px; width: auto; max-width: 92px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.brand h1 { color: #fff; font-size: 1rem; white-space: nowrap; font-family: var(--font-display); letter-spacing: 0; }
.brand h1 span { color: rgba(255, 255, 255, .5); font-weight: 500; }
.brand .muted { color: rgba(255, 255, 255, .6); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 330px; }
.top .pill { background: rgba(255, 255, 255, .09); color: #fff; border: 1px solid rgba(255, 255, 255, .1); }
.top .btn { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .1); box-shadow: none; }
.top .btn:hover { background: rgba(255, 255, 255, .16); }
.top .btn.primary { background: linear-gradient(135deg, var(--red), var(--red-deep)); border-color: transparent; }
.top .btn.ghost { background: transparent; }
.navToggle { display: none; background: rgba(255, 255, 255, .12) !important; color: #fff !important; font-size: 18px !important; min-width: 40px; }
#userPill { gap: 8px; padding-left: 4px; }
#userPill::before {
  content: attr(data-initials);
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  display: inline-grid; place-items: center;
  font-size: .68rem; font-weight: 800; letter-spacing: .02em;
}
#userPill:not([data-initials])::before { display: none; }

/* ============================================================
   POS
   ============================================================ */
.pos-page .wrap { width: 100%; max-width: none; margin: 0; padding: 0; }
#posApp { gap: 0 !important; min-height: 100vh; }
.posSplit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px; padding: 16px;
  min-height: calc(100vh - var(--top-h));
  align-items: start;
}
.posSplit > .panel { display: flex; flex-direction: column; min-height: 0; }
.posSplit > .panel:last-child { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); }

.posSearch { position: relative; flex: 1 1 auto; min-width: 200px; }
.posSearch .ic-svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.posSearch input { padding-left: 38px; height: 44px; font-size: .95rem; }
.posSearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: .68rem; color: var(--muted); background: var(--card-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.segmented { display: inline-flex; background: var(--card-soft); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented .btn { background: transparent; border-color: transparent; color: var(--muted); min-height: 36px; border-radius: 9px; }
.segmented .btn.primary { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); border-color: var(--line); filter: none; }
html[data-theme="dark"] .segmented .btn.primary { background: var(--slate); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 10px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 13px; font-size: .78rem; font-weight: 650; cursor: pointer;
  transition: all .12s ease; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: #f1a6a3; color: var(--red-deep); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
html[data-theme="dark"] .chip.on { background: var(--red); border-color: var(--red); }

.productGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 2px 4px 10px 2px;
  align-content: start;
  max-height: calc(100vh - 250px);
}
.pcard {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 132px;
  transition: border-color .14s ease, transform .1s ease, box-shadow .14s ease;
  user-select: none;
}
.pcard:hover { border-color: #f0a19d; box-shadow: 0 10px 26px -12px rgba(184, 0, 0, .35); transform: translateY(-2px); }
.pcard:active { transform: translateY(0); }
.pcard .ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--red-soft); color: var(--red-deep);
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  margin-bottom: 2px;
}
.pcard .ico.t-REPROGRAFIA { background: var(--info-bg); color: var(--info); }
.pcard .ico.t-SERIGRAFIA { background: var(--red-soft); color: var(--red-deep); }
.pcard .ico.t-GRAFICA { background: var(--ok-bg); color: var(--ok); }
.pcard .nm { font-weight: 650; font-size: .88rem; line-height: 1.28; min-height: 2.3em; color: var(--text); letter-spacing: -.005em; }
.pcard .cd { font-size: .68rem; color: var(--muted); font-family: var(--mono); letter-spacing: .02em; }
.pcard .pr { margin-top: auto; font-family: var(--font-display); font-weight: 700; color: var(--text); font-size: 1.02rem; letter-spacing: -.01em; }
.pcard .pr small { font-size: .68rem; color: var(--muted); font-family: var(--font); font-weight: 600; margin-left: 2px; }
.pcard .st { font-size: .72rem; color: var(--muted); }
.pcard .un { position: absolute; top: 10px; right: 10px; max-width: calc(100% - 58px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--card-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.pcard.out { opacity: .55; background: var(--card-soft); }
.pcard.out:hover { transform: none; box-shadow: none; border-color: var(--line); }

.cartList { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 110px; max-height: calc(100vh - 440px); padding-right: 2px; }
.cartEmpty { text-align: center; color: var(--muted); padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cartEmpty .ic-svg { width: 34px; height: 34px; color: #c9ccd4; stroke-width: 1.5; }
.cartRow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  background: var(--card-soft); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px;
  animation: rowIn .16s ease-out;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cartRow .n { font-weight: 650; font-size: .86rem; min-width: 0; line-height: 1.3; }
.cartRow .muted { font-size: .76rem; }
.qtyCtl { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.qtyCtl button { width: 28px; min-height: 28px; height: 28px; padding: 0; border-radius: 8px; border: 0; background: transparent; font-size: 1rem; }
.qtyCtl button:hover { background: var(--bg-2); }
.qtyCtl input { width: 48px; text-align: center; padding: 4px 2px; border: 0; background: transparent; font-weight: 700; }
.qtyCtl input:focus { box-shadow: none; }

.totals { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.totals .line { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; }
.totals .line b { color: var(--text); font-variant-numeric: tabular-nums; }
.totals .grand {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin-top: 4px; padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(135deg, #141419, #26262e);
  color: #fff;
}
.totals .grand > span:first-child { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .6); font-weight: 700; }
.totals .grand > span:last-child { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.totals .grand > span:last-child::after { content: " MZN"; font-size: .75rem; color: var(--red); letter-spacing: .05em; font-family: var(--font); font-weight: 700; }
.totals input { width: 120px; text-align: right; padding: 7px 10px; }

.payMethods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.payMethods .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
html[data-theme="dark"] .payMethods .btn.on { background: var(--red); border-color: var(--red); }
.payLine { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 8px; align-items: end; margin-top: 8px; }
.bigChange { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; text-align: right; color: var(--ok); font-variant-numeric: tabular-nums; }
.bigChange.neg { color: var(--warn); }

#saleResult { border-left: 0; background: var(--card); border: 1px solid var(--ok-line); box-shadow: inset 0 0 0 1px var(--ok-bg); }
#saleResult .muted::before { content: "✓ "; color: var(--ok); font-weight: 800; }
#saleNo { font-family: var(--font-display); }
#saleResult .row .btn { flex: 1 1 auto; }

/* ============================================================
   GESTÃO / BACK-OFFICE
   ============================================================ */
.admin-page .wrap { width: 100%; max-width: none; margin: 0; padding: 0; min-height: 100vh; }
.adminLayout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 0; min-height: calc(100vh - var(--top-h)); align-items: stretch; }
.sidebar {
  background: linear-gradient(180deg, #121217 0%, #0d0d11 100%);
  border: 0; border-radius: 0; box-shadow: none;
  padding: 12px 10px 24px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  z-index: 42;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.navGroup { display: flex; flex-direction: column; }
.navHead {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 12px; margin-top: 4px;
  border: 0; border-radius: 10px; background: transparent;
  color: rgba(255, 255, 255, .45);
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; text-align: left;
  transition: background .12s ease, color .12s ease;
}
.navHead:hover { background: rgba(255, 255, 255, .05); color: rgba(255, 255, 255, .8); }
.navHead .ic-svg { transition: transform .18s ease; opacity: .7; }
.navGroup.open .navHead .ic-svg { transform: rotate(180deg); }
.navGroup.hasActive:not(.open) .navHead { color: #ff8a85; }
.navItems { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.navGroup.open .navItems { grid-template-rows: 1fr; }
.navItems > div { overflow: hidden; display: flex; flex-direction: column; gap: 2px; visibility: hidden; transition: visibility .2s; }
.navGroup.open .navItems > div { visibility: visible; }
.navBtn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 12px;
  border: 0; border-radius: 11px; background: transparent;
  color: #b9bcc7; font-size: .86rem; font-weight: 600; text-align: left; line-height: 1.2;
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.navBtn .ic-svg { width: 18px; height: 18px; opacity: .85; }
.navBtn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.navBtn.on { background: linear-gradient(90deg, rgba(225, 6, 0, .28), rgba(225, 6, 0, .08)); color: #fff; }
.navBtn.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--red); }
.navBtn.on .ic-svg { opacity: 1; color: #ff8a85; }
.navSep { border-top: 1px solid rgba(255, 255, 255, .08); margin: 8px 10px; }
.navFoot { margin-top: auto; padding: 14px 12px 4px; color: rgba(255, 255, 255, .35); font-size: .7rem; line-height: 1.4; }
.content { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 40px; overflow-x: hidden; }
.navBackdrop { display: none; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(0, 0, 0, .5); backdrop-filter: blur(2px); z-index: 41; }

/* ---------- Cabeçalho de página ---------- */
.pageHead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 2px; }
.pageHead h1 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin: 0; }
.pageHead p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.pageHead .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Loja online (fotos, secção nos modais, portfólio, mensagens) ---------- */
.rowThumb { display: flex; align-items: center; gap: 10px; }
.rowThumb img, .rowThumb .noThumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none; border: 1px solid var(--line); background: var(--card-soft); }
.rowThumb .noThumb { display: grid; place-items: center; color: #c9ccd4; }
.siteSection { margin-top: 16px; border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px 14px; background: var(--card-soft); }
.siteSectionHead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .86rem; }
.siteSectionHead .ic-svg { color: var(--red); }
.siteSectionHead .muted { font-size: .74rem; font-weight: 500; }
.siteSectionBody { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.photoBox { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 150px; flex: none; }
.photoPreview { width: 150px; height: 150px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .74rem; text-align: center; }
.photoPreview img { width: 100%; height: 100%; object-fit: cover; }
.photoPreview span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.photoPreview .ic-svg { width: 26px; height: 26px; color: #c9ccd4; }
.portfolioGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pfCard { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.pfCard.off { opacity: .55; }
.pfImg { height: 170px; background: var(--card-soft); display: grid; place-items: center; color: var(--muted); font-size: .78rem; }
.pfImg img { width: 100%; height: 100%; object-fit: cover; }
.pfBody { padding: 10px 12px; font-size: .86rem; }
.pfBody .muted { font-size: .76rem; margin-top: 2px; }
.row > input.grow { flex: 1 1 200px; width: auto; }
.msgItems { margin: 6px 0 0; padding-left: 18px; font-size: .78rem; color: var(--muted); }
.tbl tr.unread td { background: var(--red-soft); }
h3.mt { margin-top: 18px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
textarea { width: 100%; resize: vertical; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(15, 15, 20, .25); }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #c9ccd4, #e3e5ea); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 0, 0, .04), transparent 70%); }
.kpi.accent::before { background: linear-gradient(90deg, var(--red), var(--red-deep)); }
.kpi.accent::after { background: radial-gradient(circle, rgba(225, 6, 0, .10), transparent 70%); }
.kpi.ok::before { background: linear-gradient(90deg, var(--ok), #7ad9a3); }
.kpi.warn::before { background: linear-gradient(90deg, var(--warn), #f5c86a); }
.kpi .lb { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.kpi .vl { color: var(--text); font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin-top: 6px; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.warn .vl { color: var(--warn); }
.kpi.ok .vl { color: var(--ok); }
.kpi.accent .vl { color: var(--red-deep); }
html[data-theme="dark"] .kpi.accent .vl { color: #ff6b66; }
.kpi .sub { color: var(--muted); font-size: .74rem; margin-top: 6px; line-height: 1.4; }

/* ---------- tabelas ---------- */
.tableWrap {
  width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th {
  padding: 11px 12px; text-align: left; color: var(--muted); background: var(--card-soft);
  border-bottom: 1px solid var(--line); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s ease; }
.tbl tbody tr:hover { background: var(--card-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn { margin-left: 4px; }
.tbl td b { font-weight: 700; }
.emptyState { padding: 36px 20px; text-align: center; color: var(--muted); font-weight: 500; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: .85rem; }

/* ---------- gráficos ---------- */
.chartBox { width: 100%; overflow: hidden; }
.chartBox svg { display: block; width: 100%; height: auto; }
.barRow { display: grid; grid-template-columns: 120px minmax(0, 1fr) 100px; gap: 10px; align-items: center; font-size: .84rem; margin-top: 9px; }
.barRow > div { background: var(--card-soft); border-radius: 999px; height: 10px; overflow: hidden; }
.barRow .bar { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--ink), var(--red)); min-width: 3px; }
html[data-theme="dark"] .barRow .bar { background: linear-gradient(90deg, #4a4a58, var(--red)); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 14px; overflow-y: auto;
  background: rgba(8, 8, 12, .62); backdrop-filter: blur(4px);
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modalBox {
  width: 100%; max-width: 560px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 20px 22px;
  animation: popIn .18s cubic-bezier(.2, .8, .3, 1.1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modalBox.wide { max-width: 860px; }
.modalHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.modalHead b { color: var(--text); font-size: 1.05rem; font-family: var(--font-display); font-weight: 700; }
.modalFoot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------- toasts ---------- */
.toastWrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 230; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: #121217; color: #fff;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .55);
  animation: toastIn .2s cubic-bezier(.2, .8, .3, 1.1);
}
.toast .ic { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; flex: none; background: rgba(255, 255, 255, .1); }
.toast.ok .ic { color: #fff; background: var(--ok); }
.toast.err .ic { color: #fff; background: var(--danger); }
.toast.warn .ic { color: #1a1a1a; background: #f5b940; }
.toast.info .ic { color: #fff; background: #4a5568; }
.toast .t { font-weight: 700; font-size: .88rem; }
.toast .d { color: #b8bcc8; font-size: .79rem; margin-top: 2px; line-height: 1.4; }
.toast .x { margin-left: auto; border: 0; background: none; color: #8b90a0; padding: 0 2px; font-size: .85rem; }
.toast .x:hover { color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- alertas ---------- */
.bellWrap { position: relative; }
.bellBadge { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: .64rem; font-weight: 800; border-radius: 999px; padding: 1px 5px; min-width: 17px; text-align: center; box-shadow: 0 0 0 2px #121217; }
.bellMenu {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(360px, 90vw); z-index: 75;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; max-height: 62vh; overflow-y: auto;
}
.alertItem { padding: 10px; border-bottom: 1px solid var(--line-soft); font-size: .83rem; border-radius: 8px; }
.alertItem:hover { background: var(--card-soft); }
.alertItem:last-child { border-bottom: none; }

/* ---------- caixa ---------- */
.sessionChip { display: inline-flex; align-items: center; gap: 7px; }
.syncChip { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border: 1px solid rgba(255, 255, 255, .1); font: inherit; font-size: .78rem; font-weight: 600; }
.syncChip.off { background: rgba(225, 6, 0, .22) !important; border-color: rgba(255, 138, 133, .5); color: #ffd6d4; }
.syncChip.busy .dot { animation: pulse 1s ease-in-out infinite; }
@media (max-width: 680px) { .syncChip { font-size: 0; gap: 0; padding: 6px; } .syncChip b { font-size: .72rem; margin-left: 4px; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: #43e08a; box-shadow: 0 0 0 3px rgba(67, 224, 138, .25); animation: pulse 2s ease-in-out infinite; }
.dot.off { background: #ff6b66; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(67, 224, 138, .25); } 50% { box-shadow: 0 0 0 6px rgba(67, 224, 138, .08); } }

/* ---------- barras de rolagem ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd2da; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b3b7c2; background-clip: padding-box; }
.sidebar::-webkit-scrollbar-thumb { background: #33343e; background-clip: padding-box; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a3b47; background-clip: padding-box; }

/* ============================================================
   RESPONSIVO — computador, tablet e telemóvel
   ============================================================ */
@media (max-width: 1180px) {
  .loginWrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .loginBrand { padding: 40px 36px; }
}
@media (max-width: 1100px) {
  .posSplit { grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; padding: 12px; }
  .productGrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  :root { --top-h: 54px; }
  .top { min-height: var(--top-h); padding: 7px 10px; gap: 7px; }
  .logoHeader { height: 31px; max-width: 80px; }
  .brand h1 { font-size: .9rem; }
  .brand .muted { max-width: 170px; font-size: .68rem; }
  .top .right { margin-left: auto; gap: 5px; }
  .top .btn.sm { padding: 6px 8px; }
  .top .pill { padding: 3px 7px; font-size: .7rem; }

  .loginWrap { grid-template-columns: 1fr; overflow-y: auto; }
  .loginBrand { padding: 28px 22px 26px; min-height: 0; }
  .loginHero h1 { font-size: 1.6rem; max-width: none; }
  .loginHero p { font-size: .9rem; margin-bottom: 16px; }
  .loginFeat { grid-template-columns: 1fr 1fr; gap: 8px; max-width: none; }
  .loginFeat div { font-size: .8rem; }
  .loginFoot { display: none; }
  .loginFormSide { padding: 20px 16px 32px; align-items: flex-start; }
  .loginInner { padding: 24px 22px 22px; }

  .posSplit { grid-template-columns: 1fr; }
  .posSplit > .panel:last-child { position: static; max-height: none; }
  .productGrid { max-height: 45vh; }
  .cartList { max-height: 34vh; }

  .adminLayout { grid-template-columns: 1fr; }
  .navToggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: calc(-1 * var(--side-w) - 16px); top: var(--top-h); bottom: 0;
    width: var(--side-w); height: auto; transition: left .22s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
  }
  .sidebar.open { left: 0; }
  .navBackdrop.open { display: block; }
  .content { padding: 14px; }
}
@media (max-width: 680px) {
  body { font-size: 13px; }
  .top .brand > div { min-width: 0; }
  .brand .muted { max-width: 125px; }
  .sessionChip { display: none; }
  #userPill { font-size: 0; padding: 2px; gap: 0; max-width: none; }
  #userPill::before { font-size: .68rem; width: 26px; height: 26px; }
  .top [data-theme-toggle] { display: none; }
  .top .right { flex-wrap: nowrap; min-width: 0; }
  .top .right .btn { min-width: 0; white-space: nowrap; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .payMethods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payLine { grid-template-columns: 1fr; }
  .payLine .bigChange { text-align: left; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 13px; min-width: 0; }
  .kpi .vl { font-size: 1.25rem; overflow-wrap: anywhere; }
  .card, .panel { padding: 13px; border-radius: 14px; }
  .content { padding: 10px; }
  .modal { padding: 8px; align-items: flex-start; }
  .modalBox { max-height: 94dvh; overflow-y: auto; padding: 16px; border-radius: 16px; }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 42px; }
  .productGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pcard { min-height: 118px; padding: 10px; }
  .cartRow { grid-template-columns: minmax(0, 1fr) auto; }
  .cartRow > :last-child { grid-column: 2; }
  .barRow { grid-template-columns: 90px minmax(0, 1fr) 76px; font-size: .76rem; }
  .segmented { width: 100%; }
  .segmented .btn { flex: 1; }
  .loginFeat { display: none; }
  .loginHero p { margin-bottom: 0; }
}
@media (max-width: 440px) {
  .brand h1 { display: none; }
  .brand .muted { max-width: 100px; }
  .logoHeader { max-width: 72px; }
  .brand .muted { display: none; }
  .logoHeader { max-width: 64px; height: 28px; }
  .top .btn.sm { padding: 6px 7px; font-size: .78rem; }
  .posSplit { padding: 8px; }
  .kpis { grid-template-columns: 1fr; }
  .modalFoot .btn { flex: 1 1 120px; }
}
@media (orientation: landscape) and (max-height: 650px) {
  :root { --top-h: 48px; }
  .top { min-height: 48px; padding-top: 5px; padding-bottom: 5px; }
  .logoHeader { height: 29px; }
  .productGrid { max-height: calc(100vh - 190px); }
  .loginInner { padding-top: 16px; padding-bottom: 16px; }
  .loginLogo img { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .top, .toastWrap, .navBackdrop { display: none !important; }
  body, html { background: #fff; }
  .card, .panel { box-shadow: none; }
}
