/* Mini Store — painel administrativo, instalação e login. */
:root {
  --ink: #151C2C; --muted: #535D70; --brand: #174EA6; --brand-deep: #0E3473; --yellow: #FFD60A;
  --red: #A61D24; --paper: #F2F4F8; --card: #FFFFFF; --line: #D9DFEA;
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--body); }
h1, h2 { font-family: var(--display); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); }
img { max-width: 100%; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted, .help { color: var(--muted); font-size: .92rem; }
.crumb { margin-bottom: .25rem; font-size: .9rem; font-weight: 600; }

/* Barra superior e menu */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .9rem; background: var(--brand-deep); color: #fff; padding: calc(.6rem + env(safe-area-inset-top, 0px)) 1rem .6rem; }
.bar__brand { color: #fff; text-decoration: none; font: 800 1.15rem/1 var(--display); margin-right: auto; }
.bar__user { display: none; font-size: .9rem; color: #D5E0F5; }
.bar form { margin: 0; }
.bar .link { color: #fff; }
.bar__menu { background: none; border: 1px solid rgba(255, 255, 255, .5); color: #fff; font: 600 .9rem var(--body); padding: .4rem .7rem; border-radius: 8px; min-height: 40px; }
.shell { display: block; }
.side { display: none; flex-direction: column; background: var(--card); border-bottom: 1px solid var(--line); padding: .5rem; }
.side.is-open { display: flex; }
.side a { color: var(--ink); text-decoration: none; font-weight: 600; padding: .7rem .9rem; border-radius: 8px; }
.side a[aria-current] { background: var(--brand); color: #fff; }
.side__site { margin-top: .5rem; border-top: 1px solid var(--line); border-radius: 0 !important; color: var(--brand) !important; }
.main { padding: 1.25rem 1rem 3rem; max-width: 1040px; }

/* Botões e links de ação */
.btn { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; border: 2px solid var(--brand); font: 700 .98rem/1 var(--body); padding: .7rem 1.1rem; border-radius: 10px; text-decoration: none; min-height: 44px; cursor: pointer; }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--danger { background: var(--red); border-color: var(--red); }
.btn:active { transform: scale(.97); }
.link { background: none; border: 0; padding: 0; font: 600 .95rem var(--body); color: var(--brand); text-decoration: underline; cursor: pointer; }
.link--danger { color: var(--red); }

/* Avisos */
.flash { padding: .75rem 1rem; border-radius: 10px; font-weight: 600; background: #DDF0DF; border: 1px solid #9CCBA3; }
.flash--erro { background: #FBE1E4; border-color: #E5A1AA; color: #7A0F1D; }
.callout { background: #FFF6C2; border: 2px solid var(--yellow); border-radius: 12px; padding: 1rem; margin-bottom: 1.25rem; }
.callout form { margin: 0; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 1.25rem; color: var(--muted); }

/* Números do painel */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0 0 1.25rem; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stats dt { color: var(--muted); font-size: .88rem; }
.stats dd { margin: 0; font: 800 2.2rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1.25rem; }
.chart { width: 100%; max-width: 560px; height: auto; display: block; margin-bottom: .5rem; }
.chart rect { fill: var(--brand); }
.chart text { font: 600 7px var(--body); fill: var(--muted); }
.chart .chart__n { fill: var(--ink); }

/* Tabelas */
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.title-row h1 { margin: 0; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .82rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { white-space: nowrap; text-align: right; }
.actions form { display: inline; margin: 0 0 0 .75rem; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: block; background: var(--paper); }
.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pill--on { background: #DDF0DF; border-color: #9CCBA3; color: #0B5A31; }
.pill--wait { background: #FFF6C2; border-color: #E6C200; color: #5C4B00; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; font-size: .92rem; }

/* Formulários */
.form { display: grid; gap: 1rem; max-width: 420px; }
.form--wide { max-width: 640px; }
.form label, .field > label { display: block; font-weight: 600; }
.field > label small, .check small { font-weight: 400; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; font: 400 16px/1.4 var(--body); color: var(--ink); background: #fff; border: 1.5px solid #B4BED0; border-radius: 8px; padding: .65rem .75rem; }
input[type="file"] { padding: .5rem; }
input[aria-invalid], select[aria-invalid], textarea[aria-invalid] { border-color: var(--red); }
.check { display: flex !important; gap: .6rem; align-items: flex-start; font-weight: 600; }
.check input { width: 1.25rem; height: 1.25rem; margin: .15rem 0 0; flex: none; accent-color: var(--brand); }
.check--inline { margin-top: .5rem; font-weight: 400; }
.field .help, .field .err { margin: .3rem 0 0; }
.err { color: var(--red); font-weight: 600; font-size: .9rem; display: block; margin-top: .3rem; }
.preview { display: block; width: 160px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-top: .4rem; }
.form__actions { display: flex; gap: 1.25rem; align-items: center; margin-top: .5rem; }

/* QR Codes */
.qrs { display: grid; gap: 1rem; }
.qr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.qr canvas { width: 100%; max-width: 240px; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .75rem; }
.qr__link { word-break: break-all; font-size: .9rem; margin-bottom: .25rem; }
.qr__actions { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: .75rem; }

/* Instalação, login e mensagens */
.plain { display: grid; place-items: center; min-height: 100svh; padding: 1rem; background: var(--brand); }
.plain__card { background: var(--card); border-radius: 16px; padding: 1.75rem 1.5rem; width: 100%; max-width: 440px; }
.plain__brand { margin: 0 0 1.25rem; }
.plain__brand img { display: block; width: 180px; height: auto; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
  .btn--danger:hover { background: #8C1021; border-color: #8C1021; }
  .side a:hover { background: var(--paper); }
  .side a[aria-current]:hover { background: var(--brand); }
  tbody tr:hover { background: #F8FAF4; }
}
@media (min-width: 900px) {
  .bar__menu { display: none; }
  .bar__user { display: inline; }
  .shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 56px); }
  .side { display: flex; border-bottom: 0; border-right: 1px solid var(--line); padding: 1rem .75rem; }
  .main { padding: 2rem 2.5rem 4rem; }
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .qrs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
