/* Mesma identidade do PWA (tokens de index.html). */
:root {
  --bg: #EEF1EC; --surface: #FFFFFF; --surface2: #F6F8F5; --ink: #1A221D; --muted: #5C685F; --line: #D9DFD8;
  --primary: #1E4632; --on-primary: #FFFFFF; --accent: #8E2F1C; --accent-soft: #F3E1DA; --green-soft: #DCE7DD;
  --tip: #F6EFD9; --tip-ink: #5A4410; --danger: #8E2F1C; --danger-soft: #F3E1DA;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; }
h1:focus { outline: none; }
a { color: var(--primary); }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--primary); color: var(--on-primary); }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand small { display: block; font-size: 12px; opacity: .8; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--on-primary); color: var(--primary); font-family: var(--serif); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.nav a, .nav .link { color: var(--on-primary); text-decoration: none; opacity: .85; font: inherit; background: none; border: 0; cursor: pointer; padding: 6px 0; min-height: 44px; }
.nav a.active, .nav a:hover, .nav .link:hover { opacity: 1; text-decoration: underline; }
.content { width: 100%; max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }

.hero { background: var(--surface); border-radius: var(--radius); padding: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; font: 600 15px var(--sans); cursor: pointer; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.notice { padding: 16px; background: var(--surface); border-radius: var(--radius); }

.badge { display: inline-block; white-space: nowrap; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-ok { background: var(--green-soft); color: var(--primary); }
.badge-warn { background: var(--tip); color: var(--tip-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface2); color: var(--muted); }

.plan-lock { display: flex; gap: 12px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface2); }
.plan-lock p { margin: 4px 0 10px; color: var(--muted); }
.lock-icon { font-size: 20px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px; background: var(--tip); color: var(--tip-ink); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
.loading-progress { display: block; width: 6rem; height: 6rem; margin: 20vh auto 1rem; }
.loading-progress circle { fill: none; stroke: var(--line); stroke-width: .6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--primary); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray .05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(20vh + 3.25rem) 0 auto .2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Carregando"); }

/* Formulários e cartões */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 0 auto 16px; }
.card h2 { margin-top: 0; font-size: 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.check input { margin-top: 4px; width: 18px; height: 18px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; box-sizing: border-box;
  font: 16px var(--sans); padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
input.invalid { border-color: var(--danger); }
.validation-message, .form-error { color: var(--danger); font-size: 14px; font-weight: 400; margin: 2px 0 8px; }
.form-ok { color: var(--primary); font-weight: 600; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); text-decoration: underline; font: inherit; cursor: pointer; }
.callout { background: var(--tip); color: var(--tip-ink); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.callout p { margin: 4px 0 10px; }
.prose h2 { font-size: 18px; margin: 20px 0 6px; }

/* Estabelecimentos */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.page-head h1 { margin: 8px 0 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
textarea { resize: vertical; }
.callout.danger { background: var(--danger-soft); color: var(--danger); }
.establishment-list { list-style: none; padding: 0; margin: 0; }
.establishment-item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.establishment-item h2 { margin: 0 0 4px; font-size: 20px; }
.establishment-item h2 a { color: var(--ink); text-decoration: none; }
.cover { width: 96px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--surface2); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.empty { text-align: center; }
.map-picker .map-canvas { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.map-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 8px; }
.photo { margin: 0; background: var(--surface2); border-radius: 12px; overflow: hidden; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; gap: 6px; }
.upload { display: inline-block; margin: 6px 0; }
.upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:focus-within .btn { outline: 2px solid var(--primary); outline-offset: 2px; }

fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface2); color: var(--muted); cursor: not-allowed; }
form > .btn.primary { margin-bottom: 16px; }

/* Admin */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { font: 600 15px var(--sans); padding: 8px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--surface2); color: var(--ink); font-size: 13px; }
.callout.small { padding: 6px 10px; margin: 6px 0 0; font-size: 14px; }
.actions-card, .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.reason-form { flex: 1 1 320px; }
.reason-form textarea { width: 100%; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; }
.photo figcaption.stack { flex-direction: column; align-items: flex-start; }
.history { margin: 0; padding-left: 20px; }
.history li { margin-bottom: 6px; }
/* Filtros: campos e botão alinhados pela base; empilha no celular. */
.filters { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; }
.filters label { margin: 0; }
.filters .btn { margin: 0; height: 44px; }
@media (min-width: 720px) {
  .filters { grid-template-columns: minmax(220px, 1fr) 170px 200px auto; }
}
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-weight: 600; color: var(--muted); }
.pager { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.pager .btn[disabled] { opacity: .45; }
.table td { vertical-align: middle; }

.table-wrap + .btn { margin-bottom: 16px; }

/* Horário detalhado */
.schedule-editor { display: grid; gap: 8px; }
.schedule-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; min-height: 44px; }
.schedule-row label.day { margin: 0; font-weight: 600; }
.shifts { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.time-range { display: inline-flex; gap: 6px; align-items: center; }
.time-range input { width: 5.5em !important; text-align: center; }
.schedule-tools { margin-top: 4px; }
@media (max-width: 520px) { .schedule-row { grid-template-columns: 1fr; } }
.section-lead { margin-top: -6px; }
.callout.muted-callout { background: var(--surface2); color: var(--muted); }
.diff td.new { font-weight: 600; color: var(--primary); white-space: normal; }
.diff td { white-space: normal; }

/* Planos e assinatura */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.plans { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan-card.selected { border-color: var(--primary); }
.price { font: 600 24px var(--sans); }
.price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.price s { font-size: 16px; font-weight: 400; margin-right: 4px; }
.founder-note { background: var(--green-soft); color: var(--primary); border-radius: var(--radius); padding: 10px 14px; }
.tab small { font-weight: 400; }
.compare th[scope=row] { font-weight: 400; color: var(--ink); }
.choices { display: grid; gap: 10px; margin-bottom: 12px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-weight: 400; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--green-soft); }
.choice input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
.confirm { margin-top: 12px; }
.plan-line { margin: -8px 0 16px; }
.plan-link { display: inline-block; margin-left: 10px; font-size: 14px; }
.facts .badge { margin-left: 6px; }

/* Admin: plano, cortesias e preços */
.card h3 { font-size: 17px; margin: 18px 0 8px; }
.plan-now { display: flex; gap: 10px; align-items: center; font-size: 18px; margin: 0 0 8px; }
.grants { list-style: none; padding: 0; margin: 0 0 12px; }
.grants li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grants li:last-child { border-bottom: 0; }
.grant-form { margin-top: 12px; }
.grant-form summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 44px; display: flex; align-items: center; }
.grant-form .grid-2 { margin-top: 8px; }
.prices .money-input { max-width: 160px; }

/* Desempenho */
.metrics-filters { grid-template-columns: 1fr; margin-bottom: 8px; }
@media (min-width: 720px) { .metrics-filters { grid-template-columns: minmax(220px, 360px) auto; justify-content: start; } }
.metrics-filters .tabs { margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.metric-card { background: var(--surface); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.metric-icon { font-size: 22px; }
.metric-label { color: var(--muted); font-size: 14px; }
.metric-value { font: 600 30px var(--sans); color: var(--ink); }
.metric-card.locked { background: var(--surface2); border: 1px dashed var(--line); }
.metric-lock { font-size: 14px; }
.views-line { margin: 6px 0 0; font-size: 14px; }

/* Toasts */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px;
  width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 12px;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 600;
  animation: toast-in .2s ease-out; }
.toast-error { background: var(--danger); }
.toast-msg { flex: 1; }
.toast-close { background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; }
.toast-close:focus-visible { outline: 2px solid currentColor; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Cartões de plano: mesma estrutura em todos (nome, preço, descrição, rodapé de altura fixa) para alinharem lado a lado. */
.plan-card { margin: 0; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; }
.plan-card p { margin: 0; }
.plan-name { margin: 0; display: flex; align-items: center; gap: 8px; }
.plan-desc { min-height: 3em; }
.plan-foot { margin-top: auto; padding-top: 8px; display: grid; gap: 6px; min-height: 52px; align-content: end; }
.plan-state { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px;
  background: var(--green-soft); color: var(--primary); font-weight: 600; font-size: 15px; }
.plan-note { font-size: 13px; color: var(--muted); text-align: center; }
.plan-card.current { border-color: var(--green-soft); }
/* Tabela comparativa: recurso à esquerda, planos em colunas iguais e centralizadas (cabeçalho e valores). */
.compare { table-layout: fixed; }
.compare th, .compare td { white-space: normal; }
.compare thead th:first-child { width: 40%; }
.compare thead th:not(:first-child), .compare td { text-align: center; }
.plans.browsing .plan-foot { display: none; }
