/* Identidade Onelink: azul-ardósia #415a68 + vermelho #b42b33 */
:root {
  --brand-slate: #415a68; --brand-red: #b42b33;
  --bg: #f3f5f7; --surface: #fff; --text: #1f2c34; --muted: #5d6e78; --border: #dde3e7;
  --primary: #b42b33; --primary-hover: #962229; --on-primary: #fff;
  --link: #415a68; --nav-active: #e9eef1;
  --ok: #12805c; --ok-bg: #e6f6ef;
  --danger: #b42b33; --danger-bg: #fbeaeb; --warn-bg: #fff6e0; --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-slate: #8fb0c2; --brand-red: #e0505a;
    --bg: #12181c; --surface: #1a2228; --text: #e8edf0; --muted: #9aa9b2; --border: #2a3640;
    --primary: #d23c46; --primary-hover: #c0303a; --on-primary: #fff;
    --link: #9fc0d2; --nav-active: #24313a;
    --ok: #3ccf91; --ok-bg: #12302a;
    --danger: #ff6b6b; --danger-bg: #3a1d1f; --warn-bg: #3a3018;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; color: var(--brand-slate); }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
small, .muted { color: var(--muted); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* layout admin */
.topbar { background: var(--surface); border-top: 4px solid var(--brand-slate); border-bottom: 3px solid var(--brand-red); }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 1rem; height: 56px; overflow-x: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--muted); white-space: nowrap; font-weight: 600; font-size: .85rem; }
.brand:hover { text-decoration: none; }
.logo-sm img { display: block; height: 34px; width: auto; }
.logo img { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { padding: .45rem .6rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: .95rem; }
.nav a.active, .nav a:hover { background: var(--nav-active); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--brand-slate); box-shadow: inset 0 -2px 0 var(--brand-red); border-radius: 8px 8px 0 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card .label { color: var(--muted); font-size: .85rem; }
.card { border-top: 3px solid var(--brand-slate); }
.card .value { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-slate); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 1rem; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.on { color: var(--ok); background: var(--ok-bg); }
.badge.off { color: var(--danger); background: var(--danger-bg); }
.badge.neutral { color: var(--muted); background: var(--bg); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; }
.pills a { padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); }
.pills a.active { background: var(--brand-slate); border-color: var(--brand-slate); color: var(--surface); text-decoration: none; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .3rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.toolbar input, .toolbar select { width: auto; min-width: 0; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: .25rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.btn { display: inline-block; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; }
.btn.block { width: 100%; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 1.2rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--danger-bg); color: var(--danger); }
.flash.warn { background: var(--warn-bg); }
.flash-action { display: block; margin-top: .4rem; color: inherit; font-weight: 600; text-decoration: underline; }
.form-link { text-align: center; margin: .9rem 0 0; font-size: .92rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link, var(--brand-slate)); text-decoration: underline; font: inherit; cursor: pointer; }
pre.script { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre; }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

/* portal / login */
.center-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--brand-red); border-radius: 14px; padding: 28px 24px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.auth-box .logo { margin-bottom: 1.25rem; }
.auth-box h1 { text-align: center; margin-bottom: .25rem; font-size: 1.3rem; }
.auth-box .sub { text-align: center; color: var(--muted); margin: 0 0 1.25rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 1rem; }
.tabs button { border: 0; background: transparent; padding: .55rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab-panel[hidden] { display: none; }
.auth-box .btn.primary { margin-top: 1.2rem; padding: .75rem; }

/* rodapé do portal */
.portal-footer { width: 100%; max-width: 420px; text-align: center; font-size: .85rem; color: var(--muted); line-height: 1.7; }
.portal-footer a { font-weight: 600; }
.portal-footer .contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1rem; }
.portal-footer .legal { font-size: .78rem; margin-top: .5rem; }
.terms { max-width: 720px; }
.terms h2 { color: var(--brand-slate); }

/* logs RADIUS ao vivo */
.live { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ok); font-weight: 600; }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.live.paused { color: var(--muted); } .live.paused .dot { animation: none; }
.live.err { color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live .dot { animation: none; } }
tr.new td { animation: flashrow 2.5s ease-out; }
@keyframes flashrow { from { background: var(--warn-bg); } to { background: transparent; } }

/* página de login personalizada */
.custom-logo { display: block; max-width: 240px; max-height: 120px; width: auto; height: auto; margin: 0 auto 1.25rem; object-fit: contain; }
.welcome { white-space: pre-line; }
.portal-footer .provided { font-size: .8rem; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.thumb { display: block; max-width: 220px; max-height: 110px; margin: .4rem 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; object-fit: contain; }
input[type=file] { display: block; max-width: 100%; }
input[type=file] + small { display: block; margin-top: .3rem; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; }
.check-list .check { margin: .3rem 0; }

/* ---------------------------------------------------------------- gráficos (relatórios)
   Cores validadas (validate_palette.js, guia dataviz): claro #2a6fb0 + #b42b33; escuro #4a90d9 + #e0505a. */
.viz, :root { --s1: #2a6fb0; --s2: #b42b33; --v-grid: #e7e7e7; --v-axis: #c2c2c2;
  --h0: #eef2f5; --h1: #cce3fd; --h2: #84b9f3; --h3: #338ced; --h4: #1b64be; --h5: #0e3d7e; }
@media (prefers-color-scheme: dark) {
  :root { --s1: #4a90d9; --s2: #e0505a; --v-grid: #2a3640; --v-axis: #46525c;
    --h0: #222c33; --h1: #0e3d7e; --h2: #1757ac; --h3: #257de0; --h4: #6aabf1; --h5: #b6d5f8; }
}
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpis .card .value { font-size: 1.6rem; font-variant-numeric: normal; }
.kpis .card .sub { color: var(--muted); font-size: .8rem; }
.filters input[type=date] { width: auto; }
.inline-label { margin: 0; font-weight: 400; color: var(--muted); }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.chart-card h2 { margin: 0 0 .25rem; font-size: 1rem; }
.chart-card .sub { margin: 0 0 .5rem; font-size: .85rem; }
.charts2 { gap: 0 16px; }
.chart-wrap { overflow-x: auto; }
.viz-svg { display: block; width: 100%; min-width: 360px; height: auto; font: 11px system-ui, sans-serif; }
.viz-svg .grid { stroke: var(--v-grid); stroke-width: 1; }
.viz-svg .axis { stroke: var(--v-axis); stroke-width: 1; }
.viz-svg .tick { fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz-svg .dlabel { fill: var(--text); font-weight: 600; }
.viz-svg path.s1, .viz-svg rect.s1 { fill: var(--s1); }
.viz-svg path.s2, .viz-svg rect.s2 { fill: var(--s2); }
.viz-svg .line.s2 { fill: none; stroke: var(--s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .dot.s2 { fill: var(--s2); stroke: var(--surface); stroke-width: 2; }
.viz-svg .hit { fill: transparent; cursor: default; }
.viz-svg .hit:hover, .viz-svg .hit:focus { fill: var(--text); fill-opacity: .05; outline: none; }
.viz-svg .cell:hover, .viz-svg .cell:focus { stroke: var(--text); stroke-width: 1.5; outline: none; }
.viz-svg .h0 { fill: var(--h0); } .viz-svg .h1 { fill: var(--h1); } .viz-svg .h2 { fill: var(--h2); }
.viz-svg .h3 { fill: var(--h3); } .viz-svg .h4 { fill: var(--h4); } .viz-svg .h5 { fill: var(--h5); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--muted); margin: .25rem 0 .5rem; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend .ln { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.legend .s1, .viz-tip .key.s1 { background: var(--s1); } .legend .s2, .viz-tip .key.s2 { background: var(--s2); }
.heat-legend { gap: 4px; } .heat-legend .sw { width: 18px; }
.legend .h1, .viz-tip .key.h1 { background: var(--h1); } .legend .h2, .viz-tip .key.h2 { background: var(--h2); }
.legend .h3, .viz-tip .key.h3 { background: var(--h3); } .legend .h4, .viz-tip .key.h4 { background: var(--h4); }
.legend .h5, .viz-tip .key.h5 { background: var(--h5); }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: .85rem; }
.viz-tip .tt { color: var(--muted); margin-bottom: 4px; }
.viz-tip .tr { display: flex; align-items: center; gap: 8px; }
.viz-tip .key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.viz-tip strong { font-variant-numeric: tabular-nums; }

pre { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
/* ---- gerenciador de internet */
.foot { max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; color: var(--muted); font-size: .8rem; text-align: center; }
.small { font-size: .85rem; }
.mk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: .75rem; }
.mk-head .spacer { flex: 1; }
.mk-head h1 .badge { vertical-align: middle; margin-left: .4rem; }
.tabs-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs-nav a { padding: .55rem .8rem; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-nav a:hover { color: var(--text); text-decoration: none; }
.tabs-nav a.active { color: var(--brand-slate); border-bottom-color: var(--brand-red); }
.grid-side { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid-side { grid-template-columns: minmax(0, 1fr); } }
.grid-side > *, .grid2 > * { min-width: 0; }
@media (max-width: 600px) { .topbar .inner { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: .5rem; } .brand span { display: none; } .nav { order: 3; flex-basis: 100%; overflow-x: auto; } }
.grid-side .panel { margin-bottom: 16px; }
td.acts { text-align: right; }
td.wrap { white-space: normal; word-break: break-all; min-width: 180px; }
tr.inativo td { opacity: .6; }
.mk-card { display: block; color: var(--text); }
.mk-card:hover { text-decoration: none; border-color: var(--brand-slate); }
.mk-card .mk-nome { font-size: 1.2rem; font-weight: 700; color: var(--brand-slate); margin: .2rem 0 .4rem; }
.mk-card .sub { margin-top: .4rem; font-size: .85rem; }
.form-narrow { max-width: 820px; }
.legend .spacer-l { margin-left: auto; }
.legend .sw.s1 { background: var(--s1); opacity: .6; }
.kpis .card .sub.live { color: var(--ok); font-weight: 600; }
textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.filters .check { margin: 0; align-items: center; }
.check-danger strong { color: var(--danger); }
tr.bloqueado td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
/* ---- horário */
fieldset.horario { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: .9rem 0 0; }
fieldset.horario legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.horario .presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .6rem; }
.horario .dias { display: flex; flex-wrap: wrap; gap: 4px; }
.horario .dia { margin: 0; font-weight: 500; }
.horario .dia input { position: absolute; opacity: 0; pointer-events: none; }
.horario .dia span { display: inline-block; min-width: 42px; text-align: center; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: .85rem; background: var(--surface); }
.horario .dia input:checked + span { background: var(--brand-slate); border-color: var(--brand-slate); color: var(--surface); }
.horario .dia input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.horario .horas { display: flex; gap: 12px; margin: .6rem 0 .3rem; }
.horario .horas label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: .4rem; }
.horario .horas input { width: auto; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.horario.sem-dias .horas { opacity: .45; }
.quando { white-space: normal; min-width: 140px; }
.quando small { display: block; }
/* ---- pizza dos sites (paleta categórica validada: CVD e contraste, claro e escuro) */
:root { --c1: #257de0; --c2: #f47230; --c3: #00b894; --c4: #f2a600; --c5: #ee7fac; --c6: #008a17; --c7: #6a4ce2; --c0: #a3adb3; }
@media (prefers-color-scheme: dark) {
  :root { --c1: #338ced; --c2: #e76624; --c3: #00a888; --c4: #d28e05; --c5: #e24d8b; --c6: #0aac23; --c7: #9887ef; --c0: #56646d; }
}
.c0 { --cor: var(--c0); } .c1 { --cor: var(--c1); } .c2 { --cor: var(--c2); } .c3 { --cor: var(--c3); }
.c4 { --cor: var(--c4); } .c5 { --cor: var(--c5); } .c6 { --cor: var(--c6); } .c7 { --cor: var(--c7); }
.pizza-corpo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.pizza-svg { flex: 0 0 220px; max-width: 220px; }
.viz-svg.pizza { min-width: 0; }
.viz-svg .fatia { fill: var(--cor); stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; transition: opacity .12s; }
.viz-svg.pizza:hover .fatia { opacity: .55; }
.viz-svg.pizza .fatia:hover, .viz-svg.pizza .fatia:focus { opacity: 1; outline: none; }
.pizza-leg { flex: 1 1 280px; width: auto; border-collapse: collapse; font-size: .9rem; }
.pizza-leg th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 0 8px 4px 0; }
.pizza-leg td { padding: 5px 8px 5px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.pizza-leg .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pizza-leg .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--cor); margin-right: 8px; vertical-align: -1px; }
@media (max-width: 600px) { .pizza-svg { flex-basis: 100%; max-width: 220px; margin: 0 auto; } }
/* ---- usuários novos */
details.novos { margin-bottom: 12px; }
details.novos > summary { list-style: none; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
details.novos > summary::-webkit-details-marker { display: none; }
details.novos > summary::after { content: "▾"; color: var(--muted); }
details.novos[open] > summary::after { content: "▴"; }
details.novos .panel { margin-top: 8px; }
label.opcao { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0; font-weight: 400; cursor: pointer; }
label.opcao input { margin-top: .3rem; }
label.opcao small { display: block; }
label.opcao:has(input:checked) { border-color: var(--brand-slate); background: var(--nav-active); }
label.opcao.check-danger:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); }
.aviso { background: var(--warn-bg); border-radius: 8px; padding: .6rem .75rem; font-size: .9rem; }
