/* 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: 1.5rem; 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 .75rem; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.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); }
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; }
