:root {
  --polar: #f8fafc;
  --deep: #121a3f;
  --electric: #0054e9;
  --violet: #6c28ff;
  --cyan: #00c8f4;
  --muted: #46546b;
  --line: #d7dfeb;
  --nav: #f5f7fd;
  --nav-ink: #283756;
  --accent-ink: #303b9e;
  --crystal: linear-gradient(120deg,#eef8ff,#f9faff 48%,#f0edff);
  --primary-fill: linear-gradient(110deg,#164dca,#503ac4);
  --hairline: #d4dced;
  --surface: #fff;
  --wash: #edf2ff;
  --body-font: Inter, "Segoe UI", system-ui, sans-serif;
  --display-font: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --radius: 1rem;
  --space: .75rem;
  --elevation: 0 9px 32px rgba(18,26,63,.07);
  --focus: #5932ca;
  font: 16px/1.5 var(--body-font);
  color: var(--deep);
  background: var(--polar);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, .button {
  border: 1px solid var(--line); color: inherit; background: var(--surface);
  border-radius: .65rem; padding: .58rem .82rem; min-height: 2.65rem;
  cursor: pointer; font-weight: 620; text-decoration: none; text-align: center;
}
button:hover, .button:hover { background: var(--wash); }
button:disabled { cursor: default; opacity: .55; }
button.primary, .button.primary { background: var(--electric); color: white; border-color: var(--electric); }
button.primary:hover, .button.primary:hover { background: #073da4; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.rail :focus-visible { outline-color: var(--focus); }
.skip { position: fixed; top: .5rem; left: .5rem; padding: .7rem 1rem; background: white; z-index: 2; transform: translateY(-200%); }
.skip:focus { transform: none; }
.frame { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.rail { background: var(--nav); color: var(--nav-ink); border-inline-end: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 2rem; padding: 1.55rem 1.15rem; }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand small { display: block; font-weight: 650; letter-spacing: .13em; color: #445475; font-size: .68rem; }
.brand strong { display: block; font-size: 1.55rem; line-height: 1.15; }
.mark { width: 2.7rem; height: 2.7rem; flex: none; }
.rail nav { display: grid; gap: .35rem; }
.rail button { background: transparent; border-color: transparent; text-align: left; }
.rail button:hover, .rail button[aria-current="page"] { background: #e6ebff; color: var(--accent-ink); }
.rail button[aria-current="page"] { box-shadow: inset 3px 0 var(--electric); }
.account { display: grid; border-top: 1px solid var(--hairline); padding-top: .8rem; margin-top: auto; gap: .15rem; overflow-wrap: anywhere; }
.account span { color: #445475; font-size: .85rem; }
.rail-button { font-size: .85rem; }
main { width: 100%; max-width: 1440px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.8rem); }
.page-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
h1, h2, p { margin: 0 0 .5rem; }
h1, h2, .brand strong { font-family: var(--display-font); }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 1.35rem; line-height: 1.2; }
.hint { color: var(--muted); }
.card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--elevation); }
.auth { position: relative; isolation: isolate; max-width: 32rem; padding: clamp(1.1rem, 4vw, 2.2rem); margin: clamp(1rem, 7vh, 5rem) auto; }
.neural-art { display: block; pointer-events: none; width: 8rem; height: 5.2rem; margin: -.5rem 0 .7rem; }
@media (min-width: 1050px) {
  .auth { max-width: 52rem; padding-inline-start: min(29vw, 18rem); min-height: 21rem; }
  .neural-art { position: absolute; z-index: -1; width: 32%; height: 100%; inset: 0 auto 0 0; margin: 0; background: linear-gradient(145deg,var(--polar),var(--wash)); border-radius: var(--radius) 0 0 var(--radius); }
}
.auth form, #dialog-body { display: grid; gap: .85rem; margin: 1rem 0; }
.signed-out .rail { display: none; }
.signed-out .frame { display: block; background: radial-gradient(ellipse at 15% 22%,#e2edff,transparent 52%),radial-gradient(ellipse at 85% 70%,#eee9ff,transparent 50%),#f9fafc; }
.signed-out main { min-height: 100dvh; display: grid; align-content: center; }
.auth.card { width: 100%; max-width: 58rem; margin: 1.25rem auto; padding: 0; display: grid; grid-template-columns: minmax(0,1.03fr) minmax(0,1fr); overflow: hidden; background: white; border-radius: 1.5rem; }
.auth .neural-art { display: grid; place-items: center; overflow: hidden; position: relative; z-index: auto; margin: 0; width: 100%; height: 100%; border-radius: 0; background: radial-gradient(ellipse at 50% 55%,#fbffff 7%,transparent 62%),linear-gradient(148deg,#d7ecff,#eeecff 50%,#ccd2ff); }
.auth-content { min-width: 0; padding: clamp(1.35rem,4vw,3.3rem); align-self: center; }
.auth-brand { color: #334674; font-size: .95rem; margin-bottom: 1.55rem; font-weight: 640; }
.auth-brand strong { padding-left: .5rem; margin-left: .35rem; border-left: 1px solid #9caad0; color: #5038ae; }
.secret-control { display: flex; margin-top: .3rem; position: relative; }
.secret-control input { padding-right: 5.2rem; }
.secret-control button { position: absolute; right: 2px; top: 2px; bottom: 2px; min-height: 0; border: 0; color: #304480; font-size: .85rem; }
.login-options { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .25rem .65rem; font-size: .9rem; }
.text-action { border: 0; color: #2245ac; padding-inline: 0; }
button.primary, .button.primary { background: var(--primary-fill); border-color: transparent; }
button.primary:hover, .button.primary:hover { background: #263ca3; }
.activation { border-top: 1px solid var(--line); padding-top: .6rem; font-size: .9rem; color: var(--muted); }
.activation summary { cursor: pointer; width: fit-content; padding: .45rem 0; color: #324781; }
#email-fields { border: 0; margin: 0; padding: 0; display: grid; gap: .85rem; }
@media (max-width: 720px) {
  .auth.card { grid-template-columns: 1fr; max-width: 29rem; }
  .auth .neural-art { height: clamp(6rem,18vh,9rem); }
  .auth-brand { margin-bottom: .6rem; }
}
@media (prefers-reduced-transparency: reduce) { .signed-out .frame, .auth .neural-art { background: var(--wash); } }
label { font-weight: 630; display: grid; gap: .3rem; min-width: 0; }
input, select {
  min-height: 2.75rem; width: 100%; min-width: 0; padding: .5rem .66rem;
  border: 1px solid #a9afc0; border-radius: .58rem; background: white; color: inherit;
}
.check { display: flex; gap: .55rem; align-items: center; font-weight: 500; }
.check input { width: 1.25rem; min-height: 1.25rem; flex-shrink: 0; accent-color: var(--violet); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.metrics:empty { display: none; }
.metric { padding: 1rem; display: grid; }
.metric span { font-size: .9rem; color: var(--muted); }
.metric strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.metric { border-top: 2px solid var(--electric); }
.metric:nth-child(2n) { border-top-color: var(--violet); }
.metric:nth-child(3n) { border-top-color: var(--cyan); }
.lookup, .smart-search { display: grid; gap: .45rem; min-width: 0; }
.smart-search { padding: var(--space); border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(135deg,var(--polar),#f2efff); }
.smart-search h2 { font-size: 1.05rem; }
.smart-search summary, .manual-search summary { cursor: pointer; padding-block: .45rem; color: #263c80; font-weight: 620; }
.smart-search details[open] label { margin-block: .4rem; }
.place-list { display: grid; gap: var(--space); }
.place-result { padding: var(--space); border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); overflow-wrap: anywhere; }
.lookup .button { min-height: 44px; }
.lookup-status:empty, .smart-search [role="status"]:empty, .place-list:empty { display: none; }
.rail { background-image: linear-gradient(155deg,#fff,#f5f8ff 47%,#eff0fb); }
@media (prefers-reduced-motion: no-preference) {
  button, .button { transition: background-color 120ms ease, border-color 120ms ease; }
}
@media (prefers-reduced-transparency: reduce) {
  .rail, .auth, .smart-search { background-image: none; }
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.content { overflow: hidden; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.filters .search { flex: 1 1 12rem; }
.entry { display: flex; align-items: center; justify-content: space-between; padding: .95rem 1rem; gap: .75rem; flex-wrap: wrap; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry-info { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; }
.entry h2 { font-size: 1rem; margin: 0 0 .25rem; }
.entry p { font-size: .88rem; margin-bottom: .1rem; }
.entry .actions button, .entry .actions a { padding: .45rem .65rem; min-height: 2.55rem; font-size: .87rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .35rem; }
.badge { display: inline-flex; font-size: .78rem; font-weight: 650; border-radius: 1rem; padding: .15rem .55rem; background: #f0edf8; color: #43356c; }
.badge.active { background: #dff4e8; color: #19503a; }
.badge.suspended { background: #fae7e9; color: #7c2737; }
.empty { padding: 1rem; margin: 0; color: var(--muted); }
.pages { display: flex; align-items: center; justify-content: end; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.message { margin-top: .65rem; font-size: .92rem; color: #11543b; }
.message.error { color: #92273c; }
dialog { width: min(34rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); padding: 1.15rem; border: 1px solid var(--line); border-radius: 1rem; color: inherit; }
dialog::backdrop { background: #19162a99; }
.long-url { overflow-wrap: anywhere; font: .86rem/1.5 ui-monospace, monospace; }
ul.history { margin: 0; padding-inline-start: 1.25rem; }
.history li + li { margin-top: .35rem; }
@media (max-width: 770px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .rail { gap: .8rem; padding: .85rem 1rem; }
  .rail nav { display: flex; flex-wrap: wrap; }
  .account { grid-template-columns: auto auto; align-items: center; gap: .2rem .6rem; margin: 0; }
  .entry-info { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .filters > label { flex: 1 1 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Painel de balcão: prioriza a peça e mantém todos os filtros disponíveis. */
.entry .actions .primary { color: #fff; }
.entry .actions > :is(button, a) { min-height: 2.75rem; }
#dialog-message:not(:empty) { margin-bottom: .75rem; }
#dialog-body > .primary { justify-self: start; }
#dialog-body .hint { margin: 0; }
@media (max-width: 600px) {
  .rail { gap: .45rem; }
  .rail nav { gap: .2rem; }
  .rail nav button, .rail-button { min-height: 2.75rem; }
  .account { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .65rem; }
  .account strong { max-width: 100%; }
  .rail-button { padding-inline: .4rem; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
  .metric { padding: .5rem .55rem; align-content: start; }
  .metric span { font-size: .82rem; }
  .metric strong { font-size: 1.3rem; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .75rem; }
  .filters .search { grid-column: 1 / -1; }
  .filters > button { grid-column: 1 / -1; min-height: 2.75rem; }
  .entry { align-items: start; }
  .entry .actions { gap: .4rem; }
  #dialog-form > .actions { gap: .5rem; }
}


/* Materiais institucionais compartilhados pelo acesso e pelas três vistas operacionais. */
.nav-icon { width: 1.12rem; height: 1.12rem; flex: none; }
.rail nav button { display: flex; align-items: center; gap: .55rem; }
.mark { object-fit: contain; border-radius: 50%; }
.auth .neural-art { z-index: 0; background: radial-gradient(ellipse at 55% 38%,#fcfeff 8%,#e8f5ff 51%,#e4ddfc 88%); }
.neural-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#aabddb 1px,transparent 1px); background-size: 22px 22px; opacity: .38; }
.neural-art img { position: relative; width: 125%; height: auto; max-height: 34rem; object-fit: contain; transform: rotate(-10deg); pointer-events: none; }
.auth-brand { display: flex; align-items: center; gap: .35rem; }
.auth-brand::before { content:""; width: 2.35rem; height: 2.35rem; margin-right: .3rem; border-radius: 50%; background: white url("/painel/tap-cristal.webp") center/contain no-repeat; }
.frame { background: linear-gradient(145deg,#fafbfe,#f7f8fd 54%,#f8f6fc); }
.page-head { padding-block: .55rem 1rem; border-bottom: 1px solid var(--hairline); }
.metric { position: relative; overflow: hidden; border: 1px solid var(--hairline); background: linear-gradient(128deg,#fff 58%,#edf4ff); }
.metric:nth-child(2n) { background: linear-gradient(128deg,#fff 58%,#f2edff); }
.metric:nth-child(3n) { background: linear-gradient(128deg,#fff 58%,#e5f6fb); }
.metric::before { content: ""; width: 1.65rem; height: 3px; margin-bottom: .52rem; border-radius: 2px; background: var(--electric); }
.metric:nth-child(2n)::before { background: var(--violet); }
.metric:nth-child(3n)::before { background: #1686a3; }
.metric strong { letter-spacing: -.045em; }
.filters { background: linear-gradient(125deg,#fbfcff,#f5f7fd); }
.smart-search { background: var(--crystal); }
@media (min-width:771px) {
  .rail { position: sticky; top: 0; align-self: start; height: 100dvh; overflow: auto; padding: 1.45rem 1rem; }
  .frame { grid-template-columns: clamp(12.25rem,16vw,14.5rem) minmax(0,1fr); }
  main { padding: clamp(1.1rem,2.4vw,2.25rem); }
}
@media (max-width:770px) {
  .rail { border-inline-end: 0; border-bottom: 1px solid var(--hairline); }
  .rail .brand .mark { width: 2.05rem; height: 2.05rem; }
  .rail nav { flex-wrap: wrap; gap: .2rem; }
  .rail nav button { font-size: .89rem; padding-inline: .42rem; gap: .28rem; }
  .rail .account { border-top: 1px solid var(--hairline); padding-top: .25rem; }
  .metric::before { width: 1.2rem; height: 2px; margin-bottom: .2rem; }
}
@media (max-width:720px) {
  .auth .neural-art { height: clamp(7rem,21vh,11rem); }
  .neural-art img { width: min(85%,22rem); max-height: 17rem; align-self: center; }
}
@media (prefers-reduced-transparency: reduce) {
  .rail, .auth .neural-art, .metric, .filters { background: var(--surface); }
  .neural-art::before { display: none; }
}

/* O formulário de estabelecimento usa mais largura para manter cada filial legível. */
dialog:has(.smart-search) { width: min(54rem, calc(100vw - 2rem)); }
.place-list { display: grid; gap: .65rem; }
.place-result { display: grid; align-content: start; gap: .45rem; }
.place-result .button, .place-result button { justify-self: start; }
.places-credits { color: #5e5e5e; font: 400 .875rem/1.4 Roboto, Arial, sans-serif; }
.places-credits span { white-space: nowrap; }
.places-credits .button { min-height: auto; padding: 0; border: 0; text-decoration: underline; }
@media (min-width: 48rem) {
  dialog:has(.smart-search) #dialog-body { grid-template-columns: 1fr 1fr; }
  dialog:has(.smart-search) #dialog-body > :not(label) { grid-column: 1 / -1; }
  .place-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 38rem) {
  dialog:has(.smart-search) { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-sizing: border-box; }
  dialog:has(.smart-search) :is(button, .button, summary) { min-height: 44px; }
  dialog:has(.smart-search) #dialog-form > .actions { position: sticky; bottom: 0; background: var(--surface); padding-block: .5rem; }
}
