/* Dermo · Drogarias Minas Mais — tema claro */
:root {
  color-scheme: light;
  --brand: #7752AC;
  --brand-dark: #533574;
  --brand-soft: #DCCBED;
  --on-brand: #ffffff;
  --gray: #8f8f8f;
  --ink: #30253C;
  --ink-2: #5C5168;
  --muted: #5C5168;
  --line: #E6D9F2;
  --bg: #FFFFFF;
  --header: #FFFFFF;
  --card: #FFFFFF;
  --surface: #F7F3FB;
  --ok: #0F6E45;
  --ok-soft: #E7F6EE;
  --warn: #8A5A00;
  --warn-soft: #FFF4DC;
  --danger: #B42318;
  --danger-soft: #FDECEC;
  --info: #533574;
  --info-soft: #F4ECFA;
  --focus: #7752AC;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 64px;
  --shadow: 0 1px 2px rgba(38, 35, 51, .06), 0 8px 24px rgba(38, 35, 51, .06);
  --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  padding-top: var(--header-h);
}
img { max-width: 100%; }
a { color: var(--brand-dark); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface); padding: .1em .35em; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--brand); color: var(--on-brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--card); color: var(--ink); padding: .75rem 1rem; }
.skip-link:focus { left: 1rem; top: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); }
.strong { font-weight: 700; }
.d-block { display: block; }
.text-danger { color: var(--danger); }
.plain-list { margin: 0; padding-left: 1.1rem; }

/* ---------- Header fixo ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header);
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  padding-top: env(safe-area-inset-top);
}
.site-header__inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; flex-shrink: 1; min-width: 0; }
.brand img { height: 36px; width: auto; display: block; object-fit: contain; }
.header-tag { color: var(--muted); font-size: .875rem; font-weight: 600; }

.page-public .site-header {
  background: #533574;
  border-bottom-color: #7752AC;
}
/* Fundo só da Home pública. A página pede apenas FUNDOHOME.webp; o PNG original permanece no disco. */
body.page-public {
  background-color: #F7F3FB;
  isolation: isolate;
}
body.page-public::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-color: #F7F3FB;
  background-image: url("../img/FUNDOHOME.webp");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: scroll;
}
.page-public .site-main { background: transparent; }
.page-public .card {
  background: #fff;
  box-shadow: 0 1px 2px rgba(48, 37, 60, .06), 0 12px 32px rgba(83, 53, 116, .14);
}
.page-public .brand {
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
}
.btn.btn-help {
  background: #fff;
  color: #533574;
  border: 1.5px solid #DCCBED;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(48, 37, 60, .14);
  flex-shrink: 0;
  white-space: nowrap;
  padding-inline: 16px;
}
.btn.btn-help:hover, .btn.btn-help:focus-visible {
  background: #F7F3FB;
  color: #533574;
  border-color: #7752AC;
}
.btn.btn-help:focus-visible {
  outline: 3px solid rgba(119, 82, 172, .45);
  outline-offset: 2px;
}
.btn-help__short { display: none; }

/* ---------- Layout ---------- */
.site-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.site-main--admin { max-width: 1200px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card--narrow { max-width: 460px; margin: 0 auto 16px; }
.auth-wrap { max-width: 460px; margin: 0 auto; }
.stack > * + * { margin-top: 14px; }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }

.site-footer {
  text-align: center;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .9rem;
  border-top: 1px solid var(--line);
  background: var(--header);
}
.site-footer p { margin: 0; }
.site-footer a { font-weight: 700; color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 1; cursor: not-allowed;
  background: var(--surface); color: var(--muted); border-color: var(--line);
}
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand-dark); color: var(--ink); }
.btn-outline { background: transparent; color: var(--brand-dark); border-color: var(--brand); border-style: dashed; }
.btn-outline:hover:not(:disabled) { background: var(--brand-soft); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.btn-success { background: #0f6e45; color: #fff; border-color: #0f6e45; }
.btn-success:hover:not(:disabled) { background: #14925c; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #9E3B34; color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #F4C1BC; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  border-radius: 10px; border: 1.5px solid #F4C1BC; background: var(--card); color: var(--danger); cursor: pointer;
}
.btn-icon:hover { background: var(--danger-soft); }
.btn-file { position: relative; }
.btn-file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Formulários ---------- */
.field { margin-bottom: 16px; }
.field__label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--brand); }
.optional { color: var(--muted); font-weight: 400; }
.field__hint { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
.field__error { color: var(--danger); font-size: .9rem; font-weight: 600; margin: 6px 0 0; min-height: 0; }
.field__error:empty { display: none; }
.input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* evita zoom automático no iOS */
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea.input { min-height: 96px; resize: vertical; }
.input::placeholder { color: #8d8798; }
.input:focus { border-color: var(--brand); outline: 3px solid rgba(119, 82, 172, .28); outline-offset: 0; }
.input:disabled { background: var(--surface); color: var(--muted); cursor: not-allowed; }
.has-error .input, .input[aria-invalid="true"] { border-color: var(--danger); background: #FFF8F7; }
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--surface) inset;
}
.input-sm { min-height: 40px; padding: 6px 10px; font-size: .9rem; width: auto; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { padding: 0; }

/* ---------- Alertas ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); border-color: #B7DFC8; color: var(--ok); }
.alert-error { background: var(--danger-soft); border-color: #F4C1BC; color: var(--danger); }
.alert-warning { background: var(--warn-soft); border-color: #F1D79C; color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: #D9CEF8; color: var(--info); }
.form-feedback { background: var(--danger-soft); border: 1px solid #F4C1BC; color: var(--danger); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }

/* ---------- Página pública ---------- */
.intro { text-align: center; margin: 8px 0 20px; }
.intro h1 { font-size: 2rem; color: var(--brand-dark); letter-spacing: -.01em; }
.intro p { color: var(--ink-2); font-size: 1.05rem; margin: 0; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface);
  padding: 6px;
  border-radius: 14px;
  margin-bottom: 16px;
}
.tab {
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-weight: 700;
  font-size: .98rem;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--ink); background: #fff; }
.tab.is-active { background: var(--brand); color: var(--on-brand); box-shadow: 0 2px 8px rgba(83, 53, 116, .28); }

.form-title { font-size: 1.25rem; }
.form-lead { color: var(--muted); margin-bottom: 18px; }

.item-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "main main" "unit remove";
  align-items: center;
  gap: 8px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.item-row.has-error { border-color: #F4C1BC; background: #FFF8F7; }
.item-row__main { grid-area: main; min-width: 0; }
.item-row .badge-unit { grid-area: unit; justify-self: start; }
.item-row .btn-icon { grid-area: remove; }
.item-row .field__label { font-size: .9rem; }
.btn-add { width: 100%; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink-2);
  vertical-align: middle;
  white-space: nowrap;
}
.badge-unit { background: var(--brand-soft); color: var(--brand-dark); }
.badge-muted { background: var(--surface); color: var(--muted); margin-left: 4px; }
.badge-danger { background: var(--danger-soft); color: var(--danger); margin-left: 4px; }

/* Combobox */
.combo { position: relative; }
.combo__field { position: relative; }
.combo__input { padding-right: 40px; }
.combo__state { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ok); font-weight: 800; pointer-events: none; }
.combo[data-state="loading"] .combo__state::after {
  content: ""; display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid #E7E2EF; border-top-color: var(--brand); animation: spin .7s linear infinite;
}
.combo[data-state="ok"] .combo__input { border-color: #8FCAA8; background: #F6FBF8; }
.combo[data-state="error"] .combo__input { border-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.combo__list {
  position: absolute;
  z-index: 30;
  left: 0; right: 0; top: 100%;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: min(320px, 50vh);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .16);
  -webkit-overflow-scrolling: touch;
}
.combo__option { padding: 12px; min-height: var(--tap); border-radius: 8px; cursor: pointer; line-height: 1.35; }
.combo__option.is-active, .combo__option:hover { background: var(--brand-soft); }
.combo__code { font-family: var(--mono); font-weight: 700; }
.combo__desc { color: var(--ink-2); }
.combo__msg { font-size: .85rem; color: var(--muted); margin: 6px 0 0; min-height: 1.2em; }
.combo__msg:empty { min-height: 0; margin: 0; }
.combo__msg--error { color: var(--danger); font-weight: 600; }
.combo__msg--warn { color: var(--warn); }

/* Foto */
.photo__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo__actions .btn { width: 100%; padding-left: 10px; padding-right: 10px; }
.photo__preview {
  margin-top: 12px; display: flex; gap: 12px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.photo__preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--surface); flex-shrink: 0; }
.photo__preview img.is-broken { object-fit: contain; font-size: .7rem; color: var(--muted); }
.photo__meta { min-width: 0; flex: 1; font-size: .9rem; word-break: break-word; }
.photo__buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.progress { height: 8px; border-radius: 999px; background: var(--surface); overflow: hidden; margin-bottom: 12px; }
.progress__bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.success { text-align: center; padding: 16px 4px; }
.success:focus { outline: none; }
.success__icon {
  width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft); color: var(--ok);
}
.success h2 { font-size: 1.4rem; color: var(--ok); }
.success__label { margin: 16px 0 4px; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; }
.protocol {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 800; letter-spacing: .04em;
  background: var(--surface); border: 1px dashed #C9C3D4; border-radius: 10px; display: inline-block; padding: 8px 16px; color: var(--ink);
  user-select: all; word-break: break-all;
}
.success__hint { color: var(--muted); margin: 12px auto 20px; max-width: 420px; }

/* ---------- Autenticação ---------- */
.auth-title { font-size: 1.5rem; }
.auth-links { text-align: center; margin: 16px 0 0; }
.message-card { text-align: center; }
.debug { text-align: left; white-space: pre-wrap; font-size: .75rem; background: var(--surface); color: var(--ink-2); padding: 12px; overflow: auto; }

/* ---------- Painel ---------- */
.site-header--admin .site-header__inner { gap: 16px; }
.admin-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--ink-2); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.admin-nav a:hover { background: var(--surface); color: var(--ink); }
.admin-nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-short { display: none; }
@media (max-width: 520px) {
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .admin-nav { justify-content: space-between; }
  .admin-nav a { flex: 1; justify-content: center; }
}
.admin-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.admin-tools form { margin: 0; }
.link-muted { color: var(--muted); font-size: .9rem; text-decoration: none; padding: 8px; }
.link-muted.is-active { color: var(--brand-dark); font-weight: 600; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0 0 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--brand-dark); margin: 0; }
.breadcrumb { margin: 0 0 8px; }
.breadcrumb a { text-decoration: none; font-weight: 600; }

.status-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.status-box {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.status-box:hover { transform: translateY(-1px); color: var(--ink); }
.status-box__count { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.status-box__label { font-weight: 600; color: var(--ink-2); }
.status-box--pending .status-box__count { color: var(--warn); }
.status-box--done .status-box__count { color: var(--ok); }
.status-box--pending.is-active { border-color: var(--warn); background: var(--warn-soft); }
.status-box--done.is-active { border-color: var(--ok); background: var(--ok-soft); }

.filters summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; gap: 8px; }
.filters__form { display: grid; grid-template-columns: 1fr; gap: 0 14px; margin-top: 14px; }
.filters__actions { display: flex; gap: 8px; align-items: flex-end; padding-bottom: 16px; }

.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.list-head p { margin: 0; }
.export-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.status--pendente { background: var(--warn-soft); color: var(--warn); }
.status--concluido { background: var(--ok-soft); color: var(--ok); }
.status--inativo { background: var(--surface); color: var(--muted); }
.status--neutro { background: var(--surface); color: var(--ink-2); }
.status--erro { background: var(--danger-soft); color: var(--danger); }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); white-space: nowrap; }
.table tbody tr:hover { background: var(--surface); }
.table tr.is-archived td { color: var(--muted); }
.table--compact th, .table--compact td { padding: 6px 10px; font-size: .85rem; }
.col-code { background: rgba(245, 193, 108, .16); }
.col-desc { background: rgba(140, 107, 255, .16); }
.cell-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; text-align: right; }
.cell-actions form { margin: 0; }
.table td a.mono { white-space: nowrap; }
.cell-products { min-width: 220px; }
.items-expand summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; }
.items-expand ul { margin: 8px 0 0; padding-left: 18px; }
.items-expand li { margin-bottom: 4px; }

.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h2 { font-size: 1.15rem; }
.empty-state p { color: var(--muted); }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 16px 0; }
.page-link {
  min-width: 44px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600;
}
.page-link.is-current { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.page-gap { align-self: center; color: var(--muted); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions form { margin: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.item-admin-list { list-style: none; margin: 0 0 16px; padding: 0; }
.item-admin-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.item-admin-list form { margin: 0; flex-shrink: 0; }
.add-item-form { display: grid; gap: 10px; }
.attachments { display: grid; gap: 16px; }
.attachment { margin: 0; }
.attachment img { max-height: 420px; width: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.attachment figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.attachment__placeholder { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 4px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline__title { font-weight: 700; margin: 0; }
.timeline__meta { font-size: .8rem; color: var(--muted); margin: 0 0 4px; }
.timeline__diff { font-size: .88rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
.timeline__diff p { margin: 0 0 4px; }
.diff-label { font-weight: 700; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stats--import { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.stat__n { font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.stat--ok .stat__n { color: var(--ok); }
.stat--bad .stat__n { color: var(--danger); }
.toolbar { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.import-form { display: grid; gap: 10px; }
.imports-log, .raw-sample, .problems, .preview-rows { margin-top: 14px; }
.imports-log summary, .raw-sample summary, .problems summary, .preview-rows summary { cursor: pointer; font-weight: 600; }
.mapping-form { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.checks { display: grid; gap: 2px; margin-bottom: 14px; }
.confirm-bar__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.add-product { display: grid; gap: 0 14px; }
.conflict-list { display: grid; gap: 12px; margin-top: 14px; }
.conflict { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.conflict__option { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.warning-list { margin: 8px 0 0; padding-left: 18px; }
.product-notice { border-color: var(--brand); }
.confirm-bar__actions form { margin: 0; }
.qr-card { text-align: center; }
.qr-img { background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- Telas pequenas ---------- */
@media (max-width: 480px) {
  :root { --header-h: 58px; }
  .brand img { height: 28px; }
  .btn-help { min-height: 44px; padding: 8px 12px; font-size: .92rem; gap: 6px; }
  .intro h1 { font-size: 1.7rem; }
  .tab { font-size: .9rem; }
  .card { padding: 16px; }
  .site-main { padding: 18px 12px 32px; }
}
@media (max-width: 400px) {
  .brand img { height: 24px; }
  .btn-help { padding: 8px 10px; font-size: .84rem; }
  .btn-help svg { width: 18px; height: 18px; }
  .site-header__inner { padding: 0 12px; gap: 8px; }
}
@media (max-width: 359px) {
  .btn-help { font-size: .82rem; padding-inline: 10px; }
}
@media (max-width: 340px) {
  .photo__actions { grid-template-columns: 1fr; }
}

/* Painel em telas estreitas: tabela vira cartões */
@media (max-width: 760px) {
  :root { --header-h: 108px; }
  .site-header--admin .site-header__inner { flex-wrap: wrap; align-content: center; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .site-header--admin .admin-nav { order: 3; width: 100%; }
  .site-header--admin .admin-nav a { min-height: 40px; padding: 0 10px; font-size: .92rem; }
  .page-admin .brand img { height: 28px; }
  .table--responsive thead { display: none; }
  .table--responsive, .table--responsive tbody, .table--responsive tr, .table--responsive td { display: block; width: 100%; }
  .table--responsive tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  .table--responsive td { border: 0; padding: 4px 12px; }
  .table--responsive td[data-label]::before {
    content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
  }
  .table--responsive .cell-actions { text-align: left; padding-top: 8px; }
  .table--responsive .cell-actions .btn { width: 100%; }
  .export-form { width: 100%; }
  .export-form .input-sm { flex: 1 1 140px; }
}
.page-public, .page-auth { --header-h: 64px; }
@media (max-width: 480px) {
  .page-public, .page-auth { --header-h: 58px; }
}

@media (min-width: 600px) {
  .more-filters .filters__form { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .item-row { grid-template-columns: 1fr auto auto; grid-template-areas: "main unit remove"; align-items: start; }
  .item-row .badge-unit { margin-top: 38px; }
  .item-row .btn-icon { margin-top: 30px; }
  .btn-add { width: auto; }
  .filters__form { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 2fr 1fr auto; align-items: end; }
  .mapping-form { grid-template-columns: 1fr 1fr; }
  .add-product { grid-template-columns: 1.1fr 2fr .8fr auto; align-items: end; }
  .mapping-form .checks, .mapping-form > .btn { grid-column: 1 / -1; justify-self: start; }
  .stats--import { grid-template-columns: repeat(3, 1fr); }
  .add-item-form { grid-template-columns: 1fr auto; align-items: start; }
  .add-item-form .btn { margin-top: 30px; }
}
@media (min-width: 960px) {
  .filters__form { grid-template-columns: repeat(4, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
  .stats--import { grid-template-columns: repeat(6, 1fr); }
  .mapping-form { grid-template-columns: 1fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 760px) {
  body.page-public { overflow-x: hidden; }
  body.page-public::before {
    background-position: center center;
    background-size: cover;
    background-attachment: scroll;
  }
}

@media print {
  .site-header, .site-footer, .detail-actions, .btn, .sidebar, .admin-topbar { display: none !important; }
  body.page-public::before { content: none; display: none; }
  body { padding-top: 0; background: #fff; color: #1d2025; }
  .card, .site-main { background: #fff; color: #1d2025; }
  .admin-main { margin: 0; }
}

/* O aparelho em modo escuro não altera o tema. */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}

/* ---------- Banner ---------- */
.hero {
  position: relative;
  margin: 0 0 18px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 168px;
}
.hero picture { display: block; width: 100%; }
.hero__art { display: block; width: 100%; height: 220px; object-fit: cover; object-position: 78% center; }
.hero__copy {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(40%, 280px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 16px 18px 22px;
  color: var(--ink);
}
.hero__copy h1, .hero__copy p { margin: 0; }
.hero__lead { margin-top: 6px !important; font-weight: 650; }
.hero__copy p:last-child { margin-top: 4px; color: var(--muted); }
.hero--admin { min-height: 0; }
.hero--admin .hero__art { height: 200px; object-position: 92% center; }
.hero--admin .hero__copy {
  width: min(42%, 320px);
  background: linear-gradient(90deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .72) 78%, rgba(255, 255, 255, 0) 100%);
}
.eyebrow { margin: 0 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }

/* ---------- Painel ---------- */
.page-admin { --header-h: 0px; padding-top: 0; overflow-x: hidden; background: var(--surface); }
.page-admin .install-banner { display: none; }
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 248px;
  display: flex;
  flex-direction: column;
  background: #533574;
  color: #F7F3FB;
  border-right: 0;
  padding: 18px 14px 14px;
}
.sidebar__brand { margin-bottom: 18px; background: #fff; border-radius: 12px; padding: 8px 10px; }
.sidebar__brand img { height: 34px; }
.sidebar__nav { display: grid; gap: 4px; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #F7F3FB;
  text-decoration: none;
  font-weight: 600;
}
.sidebar__nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar__nav a.is-active { background: #DCCBED; color: #30253C; }
.sidebar .btn-ghost { color: #F7F3FB; }
.sidebar .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar .btn-secondary { background: #DCCBED; color: #30253C; border-color: transparent; }
.sidebar__foot { margin-top: auto; display: grid; gap: 8px; }
.admin-main { margin-left: 248px; min-width: 0; flex: 1; display: flex; flex-direction: column; }
.admin-topbar { display: none; }
.site-main--admin { max-width: none; }
.btn-block { width: 100%; }
.board-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 14px; }
.board-bar__total { margin: 0; }
.board-bar__switch { display: none; }
.board-bar__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.column-pick {
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.15;
  text-align: center;
}
.column-pick[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.column-pick:focus-visible, .drag-handle:focus-visible { outline: 3px solid rgba(119, 82, 172, .45); outline-offset: 2px; }
.drag-handle {
  display: none;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #533574;
  cursor: grab;
}
.board__col.is-drop-ready { outline: 2px dashed var(--brand); outline-offset: -6px; }
.board__col.is-drop-over { background: var(--brand-soft); }
.order-card.is-dragging, .order-card.is-saving { opacity: .55; }
.empty-state[hidden] { display: none; }
.export-dialog {
  width: min(440px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  color: var(--ink);
  background: #fff;
}
.export-dialog::backdrop { background: rgba(38, 35, 51, .45); }
.export-dialog__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.export-dialog__head h2 { margin: 0; }
.qr-card { display: grid; justify-items: start; gap: 12px; }
.qr-img { background: #fff; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-link { margin: 0; overflow-wrap: anywhere; }
.board { display: grid; gap: 16px; }
.board > [data-kanban-error] { grid-column: 1 / -1; margin: 0; }
.board__col { scroll-margin-top: 72px; }
.board__col .empty-state { padding: 16px 12px; }
.board__col .empty-state h3 { margin: 0 0 4px; font-size: 1rem; }
.board__col .empty-state p { margin: 0; }
.board__head h2 { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.status-box__count { font-size: 1.6rem; color: var(--brand); }
.order-list { display: grid; gap: 8px; }
.order-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #DCCBED;
  border-radius: 12px;
  background: #F4ECFA;
  padding: 8px 10px;
}
.order-card:hover, .order-card:focus-within {
  border-color: #7752AC;
  box-shadow: 0 0 0 3px rgba(119, 82, 172, .22);
}
.order-card__open {
  display: grid;
  gap: 1px;
  flex: 1;
  min-width: 0;
  color: #30253C;
  text-decoration: none;
}
.order-card__store { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.order-card__who, .order-card__when { font-size: .86rem; line-height: 1.3; color: #533574; overflow-wrap: anywhere; }
.order-card__open:hover, .order-card__open:focus-visible { color: #30253C; }
.archive-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.archive-all { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.archive-count { margin: 0; color: #533574; font-weight: 700; }
.order-check { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; flex-shrink: 0; }
.order-check input, .archive-all input { width: 20px; height: 20px; accent-color: #7752AC; }
.archive-review { margin: 8px 0 12px; padding-left: 18px; max-height: 40vh; overflow: auto; }
.archive-dialog__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.archive-dialog__actions .btn { min-height: 44px; }
.pending-dot {
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px #fff;
  flex-shrink: 0;
}
.control-tab.is-active .pending-dot { box-shadow: 0 0 0 2px #DCCBED; }
.tester-panel { background: #F4ECFA; border-color: #DCCBED; }
.tester-panel > h2 { color: #7752AC; }
.tester-panel .item-admin-list li { border-bottom-color: #DCCBED; padding: 12px 0; }
.tester-panel .mono { color: #533574; font-size: 1.02rem; }
.tester-add { margin-top: 8px; padding-top: 12px; border-top: 1px solid #DCCBED; }
.alert .btn { margin-left: 8px; vertical-align: middle; }
.control-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.control-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: .98rem;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.control-tab:hover { color: var(--ink); background: #fff; }
.control-tab.is-active,
.control-tab[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
}
.control-tab.is-active:hover,
.control-tab[aria-selected="true"]:hover { color: #fff; background: var(--brand-dark); }
.control-tab:focus-visible { outline: 3px solid rgba(119, 82, 172, .45); outline-offset: 2px; }
.list-head { align-items: flex-end; gap: 12px 16px; margin-bottom: 14px; }
.list-head__lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-head__lead p { min-width: 0; }
.filter-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.filter-toggle:hover { background: var(--surface); }
.filter-toggle:focus-visible { outline: 3px solid rgba(119, 82, 172, .45); outline-offset: 2px; }
.filter-toggle[aria-expanded="true"]:not(.has-filters) {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-dark);
}
.filter-toggle.has-filters {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.filter-toggle.has-filters:hover { background: var(--brand-dark); color: #fff; }
.filter-toggle__count {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  border: 1.5px solid var(--brand);
  font-size: .7rem;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}
.export-form { margin-left: auto; align-items: flex-end; }
.export-field { display: grid; gap: 4px; min-width: 0; }
.export-field label { font-size: .75rem; font-weight: 700; color: var(--muted); }
.filters[hidden], .form-feedback[hidden] { display: none; }
.page-admin .filters { margin-bottom: 16px; }
.page-admin .filters > .filters__form { margin-top: 0; }
.page-admin .filters__actions { flex-wrap: wrap; align-items: center; padding-bottom: 0; }
.more-filters { margin-top: 4px; }
.more-filters summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::marker { content: ""; }
.more-filters summary svg { flex-shrink: 0; transition: transform .15s ease; }
.more-filters[open] summary svg { transform: rotate(180deg); }
.more-filters summary:focus-visible { outline: 3px solid rgba(119, 82, 172, .45); outline-offset: 2px; }
.more-filters .filters__form { grid-template-columns: 1fr; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(38, 35, 51, .4); z-index: 35; }
.sidebar-backdrop[hidden] { display: none; }

.install-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 16px 16px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.install-banner[hidden] { display: none; }
.install-banner p { margin: 0; }
.install-banner__actions { display: flex; gap: 8px; }
.install-dialog { width: min(520px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 16px; padding: 18px; color: var(--ink); background: #fff; }
.install-dialog::backdrop { background: rgba(38, 35, 51, .45); }
.install-dialog__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.install-tabs { display: flex; gap: 8px; margin: 8px 0 12px; }
.install-tabs button { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 0 12px; color: var(--ink); }
.install-tabs button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }

@media (max-width: 860px) {
  .hero { display: grid; }
  .hero__art { grid-area: 1 / 1; height: 100%; min-height: 132px; object-position: 70% center; }
  .hero__copy { position: relative; grid-area: 1 / 1; width: min(56%, 220px); align-self: center; padding: 12px 14px; }
  .hero__copy h1 { font-size: 1.35rem; }
  .hero__lead, .hero__copy p { font-size: .86rem; }
  .page-admin { --header-h: 0px; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; }
  .admin-main { margin-left: 0; }
  .admin-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
    height: 58px;
    padding: 0 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .admin-topbar__menu { justify-self: start; }
  .admin-topbar__logo { justify-self: center; display: flex; }
  .admin-topbar__logo img { height: 26px; width: auto; }
  .admin-topbar__balance { justify-self: end; width: 100%; }
  .board-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px 44px;
    gap: 6px;
    align-items: stretch;
  }
  .board-bar--archive { grid-template-columns: 1fr 44px 44px; }
  .board-bar__total { display: none; }
  .board-bar__switch, .board-bar__tools { display: contents; }
  .column-pick { padding: 6px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .board[data-column="pendente"] #coluna-concluidos,
  .board[data-column="concluido"] #coluna-pendentes { display: none; }
  .hero--admin .hero__art { object-position: 100% center; min-height: 156px; }
  .hero--admin .hero__copy {
    width: min(58%, 240px);
    background: linear-gradient(90deg, rgba(255, 255, 255, .94) 0%, rgba(255, 255, 255, .8) 82%, rgba(255, 255, 255, 0) 100%);
  }
  .control-tab { font-size: .95rem; white-space: normal; }
  .board { grid-template-columns: 1fr; }
}
@media (min-width: 861px) {
  .board { grid-template-columns: 1fr 1fr; align-items: start; }
  .drag-handle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-backdrop { display: none !important; }
}
@media (max-width: 760px) {
  .page-admin { --header-h: 0px; }
}
.nav-unseen {
  margin-left: auto;
  min-width: 1.4rem;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #533574;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.sidebar__nav a.is-active .nav-unseen { background: #7752AC; color: #fff; }
.push-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.push-help { display: grid; gap: 8px; }
.push-help p, .push-state { margin: 0; }
.push-devices { list-style: none; margin: 0; padding: 0; display: grid; }
.push-device {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.push-device__meta { margin: 4px 0 0; color: #5c5168; font-size: .92rem; overflow-wrap: anywhere; }
