/* Sistema da Deodato.Up — painel interno (/painel/), área do cliente
   (/conta/, relatórios) e telas de login (/entrar/, /esqueci-senha/).
   Cores e tipo traduzidos de clientes/deodatodev/marca.md (mesmos valores
   de site/deodatoup/docs/style-guide.md). Escuro é a base; o claro entra
   com [data-theme="light"] (assets/js/theme-init.js) ou, sem JS, pela
   preferência do sistema. Não usa o Tailwind do resto do tema. */

/* ---------- tokens ---------- */
:root {
  --bg: #0E1116;
  --bg-side: #080B10;
  --surface: #161B23;
  --surface-2: #1B2029;
  --field: #0E1116;
  --border: #20262E;
  --border-strong: #2C333D;
  --hover: rgba(244, 242, 236, 0.05);
  --text: #F4F2EC;
  --text-muted: #9AA3AE;
  --text-faint: #69717C;
  --accent: #4D7CFF;
  --accent-hover: #6690FF;
  --on-accent: #0E1116;
  --accent-text: #4D7CFF;
  --accent-soft: rgba(77, 124, 255, 0.14);
  --accent-line: rgba(77, 124, 255, 0.45);
  --ok: #3FCF8E;
  --ok-soft: rgba(63, 207, 142, 0.12);
  --warn: #F2B544;
  --warn-soft: rgba(242, 181, 68, 0.12);
  --err: #FF7070;
  --err-soft: rgba(255, 112, 112, 0.12);
  --guide: rgba(244, 242, 236, 0.07);
  --scrim: rgba(8, 11, 16, 0.72);
  --shadow: 0 14px 32px -22px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 28px 64px -20px rgba(0, 0, 0, 0.8);
  --chart-1: #4D7CFF;
  --chart-2: #3FCF8E;
  --chart-3: #F2B544;
  color-scheme: dark;

  /* o ponto do logo é sempre este azul, nos dois temas */
  --dot: #4D7CFF;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --side-w: 264px;
  --rail-w: 88px;
  --top-h: 60px;
  --tab-h: 64px;
}

:root[data-theme="light"] {
  --bg: #F4F2EC;
  --bg-side: #FBFAF7;
  --surface: #FBFAF7;
  --surface-2: #EFECE5;
  --field: #FFFFFF;
  --border: #E2DED5;
  --border-strong: #CDC8BD;
  --hover: rgba(14, 17, 22, 0.045);
  --text: #0E1116;
  --text-muted: #5B626C;
  --text-faint: #7A8089;
  --accent: #1D3FBF;
  --accent-hover: #2A4FD6;
  --on-accent: #F4F2EC;
  --accent-text: #1D3FBF;
  --accent-soft: rgba(29, 63, 191, 0.08);
  --accent-line: rgba(29, 63, 191, 0.35);
  --ok: #157A4E;
  --ok-soft: rgba(21, 122, 78, 0.1);
  --warn: #94590A;
  --warn-soft: rgba(148, 89, 10, 0.1);
  --err: #B83A32;
  --err-soft: rgba(184, 58, 50, 0.09);
  --guide: rgba(14, 17, 22, 0.08);
  --scrim: rgba(14, 17, 22, 0.42);
  --shadow: 0 1px 2px rgba(14, 17, 22, 0.04), 0 12px 28px -22px rgba(14, 17, 22, 0.35);
  --shadow-pop: 0 28px 64px -24px rgba(14, 17, 22, 0.4);
  --chart-1: #1D3FBF;
  --chart-2: #157A4E;
  --chart-3: #94590A;
  color-scheme: light;
}

/* sem JS (theme-init não rodou): segue a preferência do sistema */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F4F2EC;
    --bg-side: #FBFAF7;
    --surface: #FBFAF7;
    --surface-2: #EFECE5;
    --field: #FFFFFF;
    --border: #E2DED5;
    --border-strong: #CDC8BD;
    --hover: rgba(14, 17, 22, 0.045);
    --text: #0E1116;
    --text-muted: #5B626C;
    --text-faint: #7A8089;
    --accent: #1D3FBF;
    --accent-hover: #2A4FD6;
    --on-accent: #F4F2EC;
    --accent-text: #1D3FBF;
    --accent-soft: rgba(29, 63, 191, 0.08);
    --accent-line: rgba(29, 63, 191, 0.35);
    --ok: #157A4E;
    --ok-soft: rgba(21, 122, 78, 0.1);
    --warn: #94590A;
    --warn-soft: rgba(148, 89, 10, 0.1);
    --err: #B83A32;
    --err-soft: rgba(184, 58, 50, 0.09);
    --guide: rgba(14, 17, 22, 0.08);
    --scrim: rgba(14, 17, 22, 0.42);
    --shadow: 0 1px 2px rgba(14, 17, 22, 0.04), 0 12px 28px -22px rgba(14, 17, 22, 0.35);
    --shadow-pop: 0 28px 64px -24px rgba(14, 17, 22, 0.4);
    --chart-1: #1D3FBF;
    --chart-2: #157A4E;
    --chart-3: #94590A;
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 0.9375rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], .list, .checklist, .app-nav ul { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

.ic { width: 20px; height: 20px; flex: none; }
.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.pt { color: var(--dot); }

/* logo: arquivo original, versão por tema */
.logo { height: 22px; width: auto; }
.logo--on-light { display: none; }
:root[data-theme="light"] .logo--on-dark { display: none; }
:root[data-theme="light"] .logo--on-light { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .logo--on-dark { display: none; }
  :root:not([data-theme]) .logo--on-light { display: block; }
}

/* ---------- casca: sidebar / trilho / gaveta ---------- */
.app { min-height: 100dvh; }

.app-side {
  position: fixed; inset: 0 auto 0 0; z-index: 70;
  width: min(300px, 86vw);
  display: flex; flex-direction: column;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0s linear 0.32s;
}
.app-side.is-open {
  transform: none;
  visibility: visible;
  transition: transform 0.32s var(--ease);
}
.app-scrim {
  position: fixed; inset: 0; z-index: 65;
  background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.app-scrim.is-open { opacity: 1; pointer-events: auto; }

.app-side__brand {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: var(--top-h); padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.app-logo { display: inline-flex; align-items: center; text-decoration: none; }
/* a reduzida só aparece no trilho do tablet (ver 768–1023) */
.app-logo__mark { display: none !important; }
.app-side__context {
  padding: 18px 20px 6px;
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
}
.app-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.app-nav__group {
  padding: 16px 8px 6px;
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
}
.app-nav__group:first-child { padding-top: 8px; }
.app-nav ul { margin: 0; display: grid; gap: 2px; }
.app-nav__item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav__item:hover { background: var(--hover); color: var(--text); }
.app-nav__item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.app-nav__item.is-active .ic { color: var(--accent-text); }
.app-nav__item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.app-nav__ext { margin-left: auto; width: 15px; height: 15px; opacity: 0.6; }

.app-side__foot {
  flex: none;
  display: grid; gap: 4px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.app-side__foot .btn { justify-content: flex-start; }
.user-chip {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 8px; border-radius: var(--radius-sm);
  color: inherit; text-decoration: none;
}
a.user-chip:hover { background: var(--hover); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text);
}
.user-chip__text { display: grid; min-width: 0; line-height: 1.3; }
.user-chip__name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__mail { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- casca: topo e conteúdo ---------- */
.app-main { min-width: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
.app-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--top-h); padding: 0 12px 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(1px)) {
  .app-top { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); }
}
.app-top__logo { display: inline-flex; }
.app-top__crumb {
  display: none; align-items: center; gap: 8px; min-width: 0;
  font-size: 0.875rem; color: var(--text-muted);
}
.app-top__crumb strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top__crumb .ic { width: 14px; height: 14px; opacity: 0.6; }
.app-top__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.app-top__help { display: none; }
.app-top .avatar { width: 32px; height: 32px; text-decoration: none; }

.app-content {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 20px 16px 40px;
}

/* tema: o botão mostra para onde vai */
.theme-toggle .ic--sun { display: block; }
.theme-toggle .ic--moon { display: none; }
:root[data-theme="light"] .theme-toggle .ic--sun { display: none; }
:root[data-theme="light"] .theme-toggle .ic--moon { display: block; }

/* ---------- casca: barra de abas (celular) ---------- */
.app-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-side);
  border-top: 1px solid var(--border);
}
.app-tabbar__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: var(--tab-h); padding: 6px 2px;
  background: none; border: 0;
  color: var(--text-muted); text-decoration: none;
  font-size: 0.6875rem; font-weight: 500; line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
}
.app-tabbar__item .ic { width: 22px; height: 22px; }
.app-tabbar__item.is-active { color: var(--text); font-weight: 600; }
.app-tabbar__item.is-active .ic { color: var(--accent-text); }
.app-tabbar__item.is-active::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%;
  height: 2px; border-radius: 0 0 2px 2px; background: var(--accent);
}

/* ---------- cabeçalho de página (folha numerada da planta) ---------- */
.page-head { display: grid; gap: 16px; margin-bottom: 24px; }
.folha {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  font-size: 0.6875rem; font-weight: 500; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.folha b { font-weight: 600; color: var(--accent-text); }
.folha__ln { flex: 1; height: 1px; background: var(--guide); }
.folha__cx {
  width: 9px; height: 9px; flex: none;
  background:
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
}
.page-title {
  font-size: clamp(1.625rem, 6.4vw, 2.25rem); font-weight: 800;
  letter-spacing: -0.045em; line-height: 1.02;
  text-wrap: balance;
}
.page-lead { margin-top: 10px; max-width: 64ch; color: var(--text-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-actions .btn { flex: 1 1 auto; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted); text-decoration: none;
}
.back-link:hover { color: var(--text); }
.back-link .ic { width: 16px; height: 16px; }

.section { margin-top: 32px; }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.section-title { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em; }
.section-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.8125rem; font-weight: 600; color: var(--accent-text); text-decoration: none;
}
.section-link:hover { text-decoration: underline; }
.section-link .ic { width: 14px; height: 14px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 0.875rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn--secondary:hover { border-color: var(--accent-line); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--hover); color: var(--text); }
.btn--ok { background: var(--ok-soft); color: var(--ok); }
.btn--ok:hover { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.btn--danger { background: var(--err-soft); color: var(--err); }
.btn--danger:hover { border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn--ghost.btn--danger { background: transparent; }
.btn--ghost.btn--danger:hover { background: var(--err-soft); }
.btn--sm { min-height: 38px; padding: 8px 12px; font-size: 0.8125rem; border-radius: 10px; }
.btn--icon { width: 40px; min-height: 40px; padding: 0; border-radius: 10px; }
.btn--icon .ic { width: 20px; height: 20px; }
.btn--block { width: 100%; }
.inline-form { display: contents; }

/* ---------- superfícies ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.card__sub { margin-top: 2px; font-size: 0.8125rem; color: var(--text-muted); }
.card__body { padding: 18px; }
.card__body > * + * { margin-top: 14px; }

.grid { display: grid; gap: 12px; }
.grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }

/* ---------- indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.kpi {
  display: block; min-width: 0;
  padding: 14px 16px;
  color: inherit; text-decoration: none;
}
a.kpi:hover { border-color: var(--accent-line); }
.kpi--wide { grid-column: 1 / -1; }
.label {
  font-size: 0.6875rem; font-weight: 500; line-height: 1.3; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}
.kpi__value {
  margin-top: 8px;
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kpi__meta { margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); }
.kpi--warn .kpi__value { color: var(--warn); }
.kpi--err .kpi__value { color: var(--err); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge--ok, .badge--warn, .badge--err, .badge--accent { border-color: transparent; }
.badge--ok::before, .badge--warn::before, .badge--err::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--err { background: var(--err-soft); color: var(--err); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge--muted { background: transparent; color: var(--text-faint); }

.dot {
  display: inline-block; flex: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-faint);
}
.dot--ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot--warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot--err { background: var(--err); box-shadow: 0 0 0 4px var(--err-soft); }

.meter { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: var(--accent); }
.meter--warn > span { background: var(--warn); }
.meter--err > span { background: var(--err); }

/* ---------- avisos ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 0.875rem;
}
.alert .ic { width: 20px; height: 20px; margin-top: 1px; }
.alert--ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert--err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert--warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert p { color: var(--text); }

.empty {
  display: grid; justify-items: center; gap: 6px;
  padding: 40px 20px; text-align: center;
}
.empty .ic { width: 28px; height: 28px; margin-bottom: 6px; color: var(--text-faint); }
.empty__title { font-weight: 700; }
.empty__text { max-width: 44ch; font-size: 0.875rem; color: var(--text-muted); }

/* ---------- formulários ---------- */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field__label { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field__hint { font-size: 0.75rem; color: var(--text-muted); }
.field__hint code { font-family: var(--mono); font-size: 0.75rem; color: var(--text); }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--field); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 1rem; line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: color-mix(in srgb, var(--text-faint) 60%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 92px; resize: vertical; }
.input--mono { font-family: var(--mono); font-size: 0.875rem; }
.input[readonly] { color: var(--text-muted); }
.input[type="file"] { padding: 6px; font-size: 0.875rem; }
.input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 8px 12px;
  border: 0; border-radius: 8px;
  background: var(--surface-2); color: var(--text);
  font: 600 0.8125rem/1.2 var(--font); cursor: pointer;
}
.select { position: relative; display: block; }
.select .input { padding-right: 36px; }
.select::after {
  content: ""; position: absolute; right: 15px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.check--field { align-self: end; align-items: center; min-height: 44px; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.checks { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-actions .btn { flex: 1 1 auto; }

/* escolha de tema (perfil) */
.segmented {
  min-width: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--field);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 6px; border-radius: 9px;
  font-size: 0.8125rem; font-weight: 600; color: var(--text-muted);
}
.segmented .ic { width: 16px; height: 16px; }
.segmented input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- filtros ---------- */
.filters { margin-bottom: 16px; }
.filters__toggle { display: inline-flex; }
.filters__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--accent); color: var(--on-accent);
  font-size: 0.6875rem; font-weight: 700;
}
.filters[open] .filters__toggle { margin-bottom: 10px; }
.filters__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px; }
.filters__form .field { flex: 1 1 100%; }
.filters__actions { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; }

/* ---------- listas (linhas de dados) ---------- */
.list { margin: 0; }
.list__row {
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main aside" "actions actions";
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.list__row:first-child { border-top: 0; }
.list__row--link { grid-template-areas: "main aside"; position: relative; transition: background 0.15s ease; }
.list__row--link:hover { background: var(--hover); }
.list__row--link:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.list__row--link:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.list__row--link:only-child { border-radius: var(--radius-lg); }
.list__main { grid-area: main; min-width: 0; }
.list__aside { grid-area: aside; display: flex; align-items: flex-start; gap: 8px; justify-content: flex-end; }
.list__actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.list__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.75rem; color: var(--text-muted);
}
.list__title { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.list__title a { text-decoration: none; }
.list__title a::after { content: ""; position: absolute; inset: 0; }
.list__sub { margin-top: 4px; font-size: 0.8125rem; color: var(--text-muted); overflow-wrap: anywhere; }
.list__value { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list__chev { width: 18px; height: 18px; color: var(--text-faint); align-self: center; }
.list__lead { display: flex; align-items: center; gap: 14px; }
.list__lead > div { min-width: 0; }
.list__icon {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); color: var(--accent-text);
}

/* menu de ações (⋯) */
.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 9px 10px;
  background: none; border: 0; border-radius: 8px;
  color: var(--text); text-align: left; text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
}
.menu__item .ic { width: 18px; height: 18px; color: var(--text-muted); }
.menu__item:hover { background: var(--hover); }
.menu__item--danger, .menu__item--danger .ic { color: var(--err); }
.menu__sep { height: 1px; margin: 6px 4px; background: var(--border); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-size: 0.875rem; color: var(--text-muted); }

/* ---------- diálogos (folha de baixo no celular) ---------- */
.dialog {
  width: 100%; max-width: 100%; max-height: 92dvh;
  margin: auto 0 0; padding: 0;
  border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 20px 20px 0 0;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.32s var(--ease); }
.dialog::backdrop { background: rgba(8, 11, 16, 0.6); }
.dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 12px 14px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog__title { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em; }
.dialog__body { padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
@keyframes dialog-in { from { transform: translateY(24px); opacity: 0; } }

/* ---------- gráficos ---------- */
.chart { display: block; width: 100%; height: 96px; }
.chart-dates { display: flex; justify-content: space-between; margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart-card { padding: 16px; }
.chart-card .label { margin-bottom: 12px; }

/* ---------- métricas (sites, relatório) ---------- */
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.metric dt { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.metric dd { margin-top: 4px; font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric dd small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }

.site-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.site-card__name { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.disclosure { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.disclosure > summary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8125rem; font-weight: 600; color: var(--accent-text);
}
.disclosure > summary .ic { width: 16px; height: 16px; transition: transform 0.2s ease; }
.disclosure[open] > summary .ic { transform: rotate(180deg); }
.disclosure__body { margin-top: 14px; }
.disclosure__body .label { margin-bottom: 10px; }

/* ---------- relatório (cliente) ---------- */
.doc { max-width: 920px; }
.status-card { padding: 18px; }
.status-card__top { display: flex; align-items: flex-start; gap: 12px; }
.status-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted);
}
.status-icon .ic { width: 20px; height: 20px; }
.status-icon--ok { background: var(--ok-soft); color: var(--ok); }
.status-icon--atencao { background: var(--warn-soft); color: var(--warn); }
.status-icon--erro { background: var(--err-soft); color: var(--err); }
.status-card__value { margin-top: 2px; font-size: 1.375rem; font-weight: 800; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.status-card__text { margin-top: 12px; font-size: 0.875rem; color: var(--text-muted); }
.checklist { margin: 0; display: grid; gap: 12px; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9375rem; }
.checklist .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--ok); }
.checklist--pontos { margin-top: 14px; padding-left: 4px; }
.checklist--pontos .dot { width: 8px; height: 8px; margin-top: 7px; }
.site-hero { display: grid; gap: 14px; padding: 18px; }
.site-hero__url { font-size: 1.125rem; font-weight: 700; overflow-wrap: anywhere; }
.help-card { display: grid; gap: 14px; padding: 18px; }
.prose { color: var(--text-muted); }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { color: var(--text); font-weight: 700; letter-spacing: -0.02em; margin-top: 1.6em; }
.prose a { color: var(--accent-text); }
.prose ul, .prose ol { padding-left: 1.25em; }
.fine { font-size: 0.8125rem; color: var(--text-muted); }

/* ---------- pagamentos (cliente) ---------- */
.bill > summary:hover { background: var(--hover); }
.bill:first-child > summary { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.bill:last-child:not([open]) > summary { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bill:only-child:not([open]) > summary { border-radius: var(--radius-lg); }
.bill .list__row { border-top: 0; grid-template-areas: "main aside"; }
.bill + .bill { border-top: 1px solid var(--border); }
.bill__chev { width: 18px; height: 18px; color: var(--text-muted); transition: transform 0.2s ease; align-self: center; }
.bill[open] .bill__chev { transform: rotate(180deg); }
.bill__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pix {
  display: grid; justify-items: center; gap: 16px;
  margin: 0 16px 16px; padding: 18px;
  border: 1px dashed var(--accent-line); border-radius: var(--radius);
  background: var(--field);
}
.pix-qr-target {
  width: 184px; height: 184px; padding: 8px;
  border-radius: 12px; background: #fff;
  display: grid; place-items: center;
}
/* sem isso o <svg> do QR fica inline e ganha espaço de baseline embaixo */
.pix-qr-target svg { display: block; width: 100%; height: 100%; }
.pix__info { width: 100%; display: grid; gap: 10px; }
.pix__copy { display: flex; gap: 8px; }
.pix__copy .input { min-width: 0; font-family: var(--mono); font-size: 0.8125rem; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; }
.auth__brand { display: none; }
.auth__main { display: flex; flex-direction: column; min-height: 100dvh; padding: 0 16px; }
.auth__top { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.auth__card { width: 100%; max-width: 420px; margin: auto; padding: 24px 0 40px; }
.auth__card .page-title { font-size: clamp(1.75rem, 7vw, 2.25rem); }
.auth__card .form { margin-top: 24px; }
.auth__foot { padding: 20px 0 24px; font-size: 0.75rem; color: var(--text-faint); text-align: center; }
.auth__foot a { color: inherit; }
.auth__link { font-size: 0.875rem; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.auth__link:hover { text-decoration: underline; }
.auth__alt { margin-top: 18px; text-align: center; font-size: 0.875rem; color: var(--text-muted); }

/* ============ 640+: formulários em colunas, diálogo centralizado ============ */
@media (min-width: 640px) {
  .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-actions .btn, .page-actions .btn { flex: 0 0 auto; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi--wide { grid-column: auto; }
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters__form .field { flex: 1 1 calc(50% - 10px); }

  .dialog {
    width: min(600px, calc(100% - 48px));
    margin: auto;
    border-bottom: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    max-height: min(86dvh, 820px);
  }
  .dialog__body { padding-bottom: 20px; }
  @keyframes dialog-in { from { transform: translateY(10px) scale(0.98); opacity: 0; } }

  .pix { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; margin: 0 18px 18px; }
  .list__row { padding: 16px 18px; }
}

/* ============ 768+: trilho de ícones (tablet) ============ */
@media (min-width: 768px) {
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .app-side {
    position: sticky; top: 0; height: 100dvh; width: auto;
    transform: none; visibility: visible; transition: none;
  }
  .app-side__close, .app-scrim, .app-tabbar, .app-top__logo { display: none; }
  .app-main { padding-bottom: 0; }
  .app-top { padding: 0 20px 0 28px; height: 64px; }
  .app-top__crumb { display: flex; }
  .app-top__help { display: inline-flex; }
  .app-content { padding: 28px 28px 56px; }

  .page-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px; margin-bottom: 28px; }
  .page-head--solo { grid-template-columns: minmax(0, 1fr); }
  .page-actions { justify-content: flex-end; }

  .form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .list__row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main aside actions"; align-items: center; }
  .list__row--link, .bill .list__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main aside"; }
  .list__actions { justify-content: flex-end; flex-wrap: nowrap; }
  .list__aside { align-items: center; }

  .auth__main { padding: 0 32px; }
  .auth__top { height: 76px; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
  .app-side__brand { justify-content: center; padding: 0; height: 64px; }
  .app-logo__full { display: none !important; }
  .app-logo__mark.logo--on-dark { display: block !important; }
  :root[data-theme="light"] .app-logo__mark.logo--on-dark { display: none !important; }
  :root[data-theme="light"] .app-logo__mark.logo--on-light { display: block !important; }
  .app-side__context, .app-nav__group, .app-nav__ext, .user-chip__text { display: none; }
  .app-nav { padding: 10px 8px; }
  .app-nav ul { gap: 4px; }
  .app-nav ul ~ ul { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
  .app-nav__item {
    flex-direction: column; justify-content: center; gap: 5px;
    min-height: 60px; padding: 8px 4px;
    font-size: 0.6875rem; text-align: center; line-height: 1.15;
  }
  .app-nav__item .ic { width: 22px; height: 22px; }
  .app-nav__item.is-active::before { left: -8px; }
  .app-side__foot { justify-items: center; padding: 10px 8px; }
  .user-chip { padding: 6px; }
  .app-side__foot .btn span { display: none; }
  .app-side__foot .btn { width: 44px; padding: 0; justify-content: center; }
}

/* ============ 1024+: sidebar completa ============ */
@media (min-width: 1024px) {
  .app { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .app-side__brand { height: 64px; }
  .app-content { padding: 32px 40px 64px; }
  .page-title { font-size: 2.25rem; }

  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px 18px; }
  .kpi__value { font-size: 1.75rem; }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
  .metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  .js .filters__toggle { display: none; }
  .js .filters[open] .filters__toggle { margin-bottom: 0; }
  .filters__form .field { flex: 1 1 160px; }
  .filters__form .field--wide { flex: 2 1 240px; }
  .filters__actions { flex: 0 0 auto; }

  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* painel da marca: sempre escuro, nos dois temas. As guias da planta
     marcam só as bordas do conteúdo, nunca uma grade cheia. */
  .auth__brand {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 56px 48px;
    color: #F4F2EC;
    background:
      linear-gradient(rgba(244, 242, 236, 0.07), rgba(244, 242, 236, 0.07)) 56px 0 / 1px 100% no-repeat,
      linear-gradient(rgba(244, 242, 236, 0.07), rgba(244, 242, 236, 0.07)) calc(100% - 56px) 0 / 1px 100% no-repeat,
      linear-gradient(rgba(244, 242, 236, 0.07), rgba(244, 242, 236, 0.07)) 0 calc(100% - 48px) / 100% 1px no-repeat,
      #080B10;
    border-right: 1px solid #20262E;
  }
  .auth__brand .folha { color: #69717C; }
  .auth__brand .folha b { color: #4D7CFF; }
  .auth__brand .folha__ln { background: rgba(244, 242, 236, 0.09); }
  .auth__headline {
    max-width: 13ch;
    font-size: clamp(2.5rem, 4.4vw, 4rem); font-weight: 800; letter-spacing: -0.055em; line-height: 0.98;
  }
  .auth__brand-text { margin-top: 18px; max-width: 40ch; color: #9AA3AE; font-size: 1rem; }
  /* foguetinho: pequeno, apagado, sempre subindo na diagonal */
  .auth__rocket {
    position: absolute; right: 22%; top: 26%;
    width: 20px; height: 20px;
    animation: rocket-up 9s linear infinite;
  }
  .auth__rocket::before {
    content: ""; position: absolute; inset: 0;
    background: #4D7CFF;
    -webkit-mask: var(--rocket) center / contain no-repeat; mask: var(--rocket) center / contain no-repeat;
  }
  .auth__rocket::after {
    content: ""; position: absolute; left: -12px; bottom: -6px;
    width: 16px; height: 1px; background: linear-gradient(90deg, transparent, #4D7CFF);
    transform: rotate(-45deg); transform-origin: right center;
  }
  @keyframes rocket-up {
    0% { transform: translate(-60px, 60px); opacity: 0; }
    20%, 75% { opacity: 0.3; }
    100% { transform: translate(60px, -60px); opacity: 0; }
  }
  .auth__top .app-logo { visibility: hidden; }
}
