/* DNSBL v2.9 — estilos do backoffice */

/* Fontes alojadas no próprio servidor (licença SIL Open Font License, ver assets/fonts/OFL-*.txt) */
@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/figtree-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/figtree-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --navy:        #13293d;
    --navy-2:      #1a3550;
    --navy-line:   rgba(255, 255, 255, .055);
    --blue:        #215f8c;
    --blue-hover:  #1b5179;
    --blue-soft:   #e3edf5;
    --blue-mute:   #8ea9c1;
    --bg:          #e9eef2;
    --card:        #ffffff;
    --ink:         #172433;
    --ink-2:       #33475b;
    --muted:       #66788a;
    --line:        #e4eaef;
    --field:       #f3f6f9;
    --danger:      #b4372b;
    --danger-soft: #fbeceb;
    --ok:          #1f7a4d;
    --ok-soft:     #e6f4ec;
    --warn:        #8a5a00;
    --warn-soft:   #fdf3dc;
    --radius-lg:   22px;
    --radius:      14px;
    --radius-sm:   10px;
    --font-head:   "Outfit", "Segoe UI", system-ui, sans-serif;
    --font-body:   "Figtree", "Segoe UI", system-ui, sans-serif;
    --font-mono:   ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; color: var(--ink); letter-spacing: -.01em; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--field); padding: .1em .35em; border-radius: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(33, 95, 140, .35); outline-offset: 2px; }

.icon     { width: 20px; height: 20px; flex: none; }
.icon-sm  { width: 16px; height: 16px; }
.mono     { font-family: var(--font-mono); font-size: .92em; }
.muted    { color: var(--muted); }
.small    { font-size: 13px; }
.nowrap   { white-space: nowrap; }
.right    { text-align: right; }
.inline   { display: inline; }

/* ---------- Login ---------- */

body.login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    background: #fff;
}
.login-side {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 52px 56px 44px;
    color: #fff;
    background-color: var(--navy);
    background-image:
        linear-gradient(var(--navy-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
    background-size: 46px 46px;
}
.login-brand .brand-mark { color: #fff; }
.login-pitch { margin: auto 0; max-width: 560px; }
.login-pitch h1 {
    color: #fff;
    font-size: clamp(34px, 3.4vw, 50px);
    line-height: 1.08;
    font-weight: 700;
}
.login-pitch h1 span { display: block; color: var(--blue-mute); }
.login-pitch p { margin: 22px 0 0; max-width: 440px; color: rgba(255, 255, 255, .78); font-size: 16px; }
.login-foot { color: rgba(255, 255, 255, .5); font-size: 13px; }

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 26px; font-weight: 700; }
.login-form > .muted { margin: 4px 0 26px; }
.login-form .field { margin-bottom: 18px; }
.login-form .alert { margin-bottom: 18px; }
.login-form .btn { margin-top: 6px; }

/* ---------- Marca ---------- */

.brand-mark { display: inline-flex; align-items: center; gap: 12px; color: #fff; }
.brand-mark svg { width: 38px; height: 38px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--font-head); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.brand-text em { font-style: italic; font-size: 12px; color: rgba(255, 255, 255, .7); margin-top: 3px; }
.brand-logo { max-width: 200px; max-height: 56px; display: block; }

/* ---------- Estrutura da aplicação ---------- */

body.app { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 12px;
    flex: none;
    width: 248px;
    height: calc(100vh - 24px);
    margin: 12px 0 12px 12px;
    padding: 26px 12px 20px;
    overflow-y: auto;
    background: var(--navy);
    border-radius: var(--radius-lg);
    color: #fff;
}
.sidebar .brand { display: block; padding: 0 12px 22px; }
.sidebar .brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group {
    padding: 14px 14px 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, .5);
}
.nav-group:first-child { padding-top: 4px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .88);
    font-weight: 600;
    font-size: 15px;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav-link.is-active { background: var(--blue); color: #fff; }
.nav-link span:first-of-type { flex: 1; white-space: nowrap; }
.nav-count {
    flex: none !important;
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .8);
}
.nav-link.is-active .nav-count { background: rgba(255, 255, 255, .2); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 26px 28px 18px 32px;
}
.page-heading { flex: 1; min-width: 0; }
.crumb { font-size: 13px; color: var(--muted); font-weight: 500; }
.page-heading h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    background: var(--card);
    border: 0;
    border-radius: var(--radius);
    color: var(--ink);
    font: 600 14.5px var(--font-body);
    cursor: pointer;
    white-space: nowrap;
}
.pill:hover { text-decoration: none; background: #f7f9fb; }
.pill .icon { width: 18px; height: 18px; }
.pill-version { height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; cursor: default; }
.pill-version:hover { background: var(--card); }
.top-date { color: var(--muted); font-size: 14px; padding: 0 4px; }
.pill-status .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.pill-status.is-ok    { color: var(--ok); }
.pill-status.is-error { color: var(--danger); }
.pill-status.is-warn  { color: var(--warn); }

.user-menu { position: relative; }
.user-btn { padding: 0 14px 0 8px; }
.avatar {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    min-width: 230px;
    padding: 6px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(19, 41, 61, .16);
    display: none;
}
.user-menu.is-open .dropdown { display: block; }
.dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-weight: 500;
}
.dropdown a:hover { background: var(--field); text-decoration: none; }
.dropdown .icon { width: 18px; height: 18px; color: var(--muted); }
.dropdown a.is-current { background: var(--blue-soft); color: var(--blue); }
.dropdown a.is-current .icon { color: var(--blue); }
/* Definições e sistema no canto superior direito (v2.9) */
.menu-sistema > .pill { gap: 8px; cursor: pointer; }
.menu-sistema > .pill.is-active { background: var(--blue-soft); color: var(--blue); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    vertical-align: middle;
}
.icon-btn:hover { background: var(--field); color: var(--ink); text-decoration: none; }
.icon-btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn .icon { width: 18px; height: 18px; }
.menu-btn { display: none; background: var(--card); width: 44px; height: 44px; }

.content { padding: 0 28px 32px 32px; display: flex; flex-direction: column; gap: 24px; }
.flashes { padding: 0 28px 0 32px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

/* ---------- Grelhas e cartões ---------- */

.grid { display: grid; gap: 24px; }
.grid-main { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 24px; }

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    min-width: 0;
}
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 19px; font-weight: 600; }
.card-head p { margin: 4px 0 0; font-size: 14.5px; }
.card-body { padding: 24px 28px 28px; }

.card-head-filters { align-items: center; flex-wrap: wrap; }
.card-head-filters .filters { flex: 1; min-width: 260px; }
.card-head-filters .count { font-size: 14px; }

/* Cartão de destaque */
.card-feature {
    position: relative;
    overflow: hidden;
    background: var(--blue);
    color: #fff;
    display: flex;
    flex-direction: column;
}
.feature-body { padding: 28px 28px 0; position: relative; z-index: 1; }
.card-feature h2 { color: #fff; font-size: 16px; font-weight: 600; }
.feature-number {
    font-family: var(--font-head);
    font-size: clamp(52px, 5vw, 68px);
    font-weight: 700;
    line-height: 1;
    margin: 14px 0 12px;
    letter-spacing: -.02em;
}
.card-feature p { margin: 0; color: rgba(255, 255, 255, .86); font-weight: 500; }
.spark { display: block; width: 100%; height: 120px; margin-top: auto; }
.spark-area { fill: rgba(255, 255, 255, .12); }
.spark-line { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* Gráfico */
.chart-wrap { padding-top: 18px; }
.chart { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 300; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-ylabel { fill: var(--muted); font: 500 14px var(--font-body); text-anchor: end; }
.chart-xlabel { fill: var(--muted); font: 500 15px var(--font-body); text-anchor: middle; }
.chart-area { fill: rgba(33, 95, 140, .07); }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--blue); }

/* Barras */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 56px; align-items: center; gap: 18px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-track { height: 7px; background: var(--blue-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.bar-value { text-align: right; font-weight: 700; }

/* Lista de estatísticas */
.stats { margin: 0 0 18px; display: flex; flex-direction: column; }
.stats > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.stats > div:last-child { border-bottom: 0; }
.stats dt { color: var(--ink-2); }
.stats dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* ---------- Tabelas ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 28px; }
.table th:last-child, .table td:last-child { padding-right: 28px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafb; }
.table th.right, .table td.right { text-align: right; }
.cell-wrap { min-width: 200px; max-width: 520px; overflow-wrap: anywhere; color: var(--ink-2); }

.empty { color: var(--muted); margin: 0; }
.empty.pad { padding: 26px 28px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 28px 22px; border-top: 1px solid var(--line); }
.pager-info { color: var(--muted); font-size: 14px; }

/* ---------- Distintivos ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-lg { font-size: 14px; padding: 6px 14px; }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-ok      { background: var(--ok-soft); color: var(--ok); }
.badge-warn    { background: var(--warn-soft); color: var(--warn); }
.badge-neutral { background: var(--field); color: var(--ink-2); }

/* ---------- Formulários ---------- */

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.field small { color: var(--muted); font-size: 13px; }
.field-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
.field-row > .field-grow { flex: 3 1 260px; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"],
input[type="date"], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: var(--field);
    border: 1px solid #d9e2ea;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    min-height: 46px;
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366788a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(33, 95, 140, .15); }
.login-form input { background: #eaf1f9; border-color: #d4e0ec; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.form-stack { display: flex; flex-direction: column; gap: 18px; }
.form-section { font-size: 15px; font-weight: 600; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 22px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.form-add { display: flex; flex-direction: column; gap: 18px; }
.form-add-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: stretch; }
.form-add-grid textarea { min-height: 170px; height: 100%; }
.form-add-grid > .field { height: 100%; }
.form-add-side { display: flex; flex-direction: column; gap: 18px; justify-content: space-between; }
.form-add-side .btn { align-self: flex-start; }

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-width: 210px; }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 220px; max-width: 520px; }
.search .icon { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px; }
.search-lg { max-width: none; }

.tabs { display: flex; gap: 4px; background: var(--field); padding: 4px; border-radius: 12px; }
.tab { padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.tab:hover { text-decoration: none; background: rgba(255, 255, 255, .6); }
.tab.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(19, 41, 61, .08); }

.test-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.test-form .search { flex: 1 1 320px; }

.copy-field { display: flex; gap: 10px; margin-bottom: 14px; }
.copy-field input { font-size: 13px; }

/* ---------- Botões ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius-sm);
    font: 600 15px var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-soft { background: var(--blue-soft); color: var(--blue); }
.btn-soft:hover { background: #d6e5f1; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--field); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }

.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin: 0; }
.content > p:has(.back-link) { margin: -8px 0 -8px; }

/* ---------- Avisos ---------- */

.alert { padding: 14px 18px; border-radius: var(--radius); font-size: 14.5px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert .check { margin-top: 12px; }
.alert-success { background: var(--ok-soft); color: #145c39; }
.alert-error   { background: var(--danger-soft); color: #8c2a20; }
.alert-warn    { background: var(--warn-soft); color: #6b4600; }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

.note { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin: 0 0 12px; }
.note-ok   { background: var(--ok-soft); color: #145c39; }
.note-warn { background: var(--warn-soft); color: #6b4600; }

/* Atualizações */
.upload-form { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.upload-form .field { flex: 1 1 320px; }
input[type="file"] {
    width: 100%;
    min-height: 46px;
    padding: 9px 12px;
    font: inherit;
    background: var(--field);
    border: 1px solid #d9e2ea;
    border-radius: var(--radius-sm);
}
.update-box .stats { margin-bottom: 14px; }

/* Registo de operações (SSL) */
.log {
    margin: 0;
    max-height: 260px;
    overflow: auto;
    padding: 14px 16px;
    background: var(--navy);
    color: #d6e2ee;
    border-radius: var(--radius-sm);
    font: 12.5px/1.5 var(--font-mono);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Servidores DNS */
.servers { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; }
.servers li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.servers li:first-child { padding-top: 0; }
.servers li:last-child { border-bottom: 0; }
.server-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; font-weight: 600; }

/* ---------- Responsivo ---------- */

@media (max-width: 1180px) {
    .grid-main { grid-template-columns: minmax(0, 1fr); }
    .card-feature { min-height: 260px; }
    .top-date { display: none; }
}

@media (max-width: 900px) {
    body.login { grid-template-columns: 1fr; }
    .login-side { padding: 32px 28px; min-height: 0; }
    .login-pitch { margin: 48px 0 32px; }
    .login-foot { display: none; }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        margin: 0;
        height: 100vh;
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    body.sidebar-open .sidebar { transform: none; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(19, 41, 61, .4); display: none; }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .menu-btn { display: inline-grid; }

    .topbar { flex-wrap: wrap; padding: 18px 16px 14px; }
    .top-actions { width: 100%; justify-content: flex-start; }
    .pill-version, .top-actions > .pill:not(.pill-status):not(.user-btn) { display: none; }
    .content, .flashes { padding-left: 16px; padding-right: 16px; }
    .card-head, .card-body { padding-left: 20px; padding-right: 20px; }
    .table th:first-child, .table td:first-child { padding-left: 20px; }
    .table th:last-child, .table td:last-child { padding-right: 20px; }
    .form-add-grid { grid-template-columns: 1fr; }
    .chart { aspect-ratio: 1000 / 420; }
    .chart-xlabel, .chart-ylabel { font-size: 30px; }
    .card-feature { min-height: 220px; }
    .bars li { grid-template-columns: minmax(0, 1fr) 80px 44px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}

/* Página pública de consulta (v1.9) */
.login-pitch .en { margin-top: 10px; color: rgba(255, 255, 255, .55); font-size: 14.5px; }
.publico .login-main { align-items: flex-start; padding-top: 12vh; }
.publico-form { max-width: 560px; display: flex; flex-direction: column; gap: 18px; }
.publico-form .field { margin-bottom: 0; }
.publico-form > .muted { margin: -14px 0 4px; }
.publico-form .test-form .search { min-width: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Pedidos de remoção (v1.9) */
.pedido { padding: 22px 28px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.pedido:last-child { border-bottom: 0; }
.pedido-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pedido-ip { font-size: 17px; font-weight: 700; }
.pedido .stats { margin: 0; }
.pedido-msg { margin: 0; padding: 14px 16px; background: var(--field); border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-word; font: 14.5px/1.5 var(--font-body); }

/* Utilização (v1.9) */
.nome-fonte { display: flex; gap: 6px; align-items: center; }
.nome-fonte input { min-height: 36px; padding: 6px 10px; min-width: 120px; }
.nav-count-alerta { background: var(--danger) !important; color: #fff !important; }

/* Separadores de página (v2.4) */
.tabs-pagina { align-self: flex-start; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.tabs-pagina .tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; }
.tabs-pagina .tab svg { width: 16px; height: 16px; }
.tab-count { background: var(--line); color: var(--ink-soft, inherit); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.tab.is-active .tab-count { background: var(--navy); color: #fff; }

/* ---------- Verificação em dois passos e prova de trabalho (v2.7) ---------- */
.totp-config { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.totp-qr { width: 220px; aspect-ratio: 1; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; place-items: center; }
.totp-qr svg { width: 100%; height: auto; display: block; }
.codigo-2fa { font-size: 22px; letter-spacing: .3em; text-align: center; max-width: 220px; }
.login-alt { margin-top: 14px; text-align: center; font-size: 14px; }
.pow-estado { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.pow-estado[hidden] { display: none; }
.pow-estado .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.pow-estado.pow-ok .dot { background: var(--ok); }
.pow-estado.pow-erro { color: var(--danger); }
.pow-estado.pow-erro .dot { background: var(--danger); }

/* ---------- Origem: país e rede (v2.8) ---------- */
.grid-origem { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cc { display: inline-block; min-width: 26px; margin-right: 8px; padding: 1px 5px; border-radius: 6px; background: var(--field); color: var(--ink-2); font-size: 11.5px; font-weight: 700; text-align: center; letter-spacing: .02em; }
.origem { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; font-family: var(--font-body); }
td .origem { margin-top: 2px; }
.grid-origem .bars li { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) 56px; }
.origem-linha { margin: 4px 0 6px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 1100px) { .grid-origem { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Telemóvel e ecrãs pequenos (v2.5) ---------- */

/* Topo do menu lateral: marca + botão de fechar (só em ecrãs pequenos) */
.sidebar-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sidebar-top .brand { flex: 1; min-width: 0; }
.sidebar-close { display: none; color: rgba(255, 255, 255, .8); }
.sidebar-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* Conteúdo das células: invisível para o layout em ecrã largo (sem alterações) */
.td-v { display: contents; }

@media (max-width: 900px) {
    /* Menu lateral: altura real do ecrã (barra do browser), fechar, sem deslocar a página por baixo */
    .sidebar {
        width: min(300px, 86vw);
        height: 100vh;
        height: 100dvh;
        padding: calc(18px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom));
        overscroll-behavior: contain;
        box-shadow: 0 0 40px rgba(19, 41, 61, .25);
    }
    body.sidebar-open { overflow: hidden; }
    .sidebar-close { display: inline-grid; width: 40px; height: 40px; }
    .sidebar .brand { padding: 4px 12px 18px; }
    .nav-link { padding: 11px 14px; }

    /* Barra de topo fixa e compacta */
    .topbar {
        position: sticky;
        top: 0;
        z-index: 25;
        gap: 10px 12px;
        padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
        background: rgba(233, 238, 242, .94);
        -webkit-backdrop-filter: saturate(1.4) blur(10px);
        backdrop-filter: saturate(1.4) blur(10px);
        border-bottom: 1px solid rgba(19, 41, 61, .06);
        margin-bottom: 16px;
    }
    .crumb { font-size: 12px; }
    .page-heading h1 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .top-actions { gap: 8px; }
    .pill { height: 38px; padding: 0 12px; font-size: 13.5px; }
    .pill-status .dot { width: 8px; height: 8px; }
    .user-menu { margin-left: 0; }
    .menu-sistema { margin-left: auto; }
    .menu-sistema-txt, .menu-sistema > .pill > .icon-sm { display: none; }
    .menu-sistema > .pill { padding: 0 11px; }
    .user-btn { padding: 0 10px 0 5px; }
    .avatar { width: 28px; height: 28px; }
    .dropdown { max-width: calc(100vw - 32px); }

    .flashes { margin-bottom: 14px; }
    .content { gap: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
    .grid, .stack { gap: 16px; }

    /* Cartões */
    .card { border-radius: 18px; }
    .card-head { padding: 18px 18px 16px; flex-wrap: wrap; }
    .card-head h2 { font-size: 17.5px; }
    .card-head p { font-size: 14px; }
    .card-body { padding: 18px 18px 20px; }
    .feature-body { padding: 22px 20px 0; }
    .feature-number { font-size: 50px; }

    /* Cabeçalhos com filtros: tudo em coluna, largura total */
    .card-head-filters { flex-direction: column; align-items: stretch; gap: 12px; }
    .card-head-filters .filters { min-width: 0; width: 100%; }
    .filters select { min-width: 0; flex: 1 1 160px; width: auto; }
    .search { min-width: 0; max-width: none; flex: 1 1 100%; }
    .card-head-filters .count { align-self: flex-start; }

    /* Separadores: deslocamento horizontal em vez de quebrar a linha */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: 100%;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: none; white-space: nowrap; padding: 9px 14px; }
    .tabs-pagina { width: 100%; flex-wrap: nowrap; }
    .tabs-pagina .tab { flex: 1 1 0; min-width: 0; justify-content: center; padding: 10px 12px; white-space: normal; text-align: center; line-height: 1.25; }

    /* Campos: 16px evita o zoom automático do iPhone ao tocar num campo */
    input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"],
    input[type="date"], input[type="file"], select, textarea { font-size: 16px; }
    .field-row { gap: 14px; }
    .field-row > .field, .field-row > .field-grow { flex-basis: 100%; }
    .form-add-grid textarea { min-height: 140px; }

    /* Botões e alvos de toque */
    .icon-btn { width: 40px; height: 40px; }
    .btn { white-space: normal; text-align: center; line-height: 1.25; }
    .copy-field { flex-wrap: wrap; }
    .copy-field input { flex: 1 1 100%; }
    .upload-form .field { flex-basis: 100%; }
    .test-form .search { flex-basis: 100%; }

    .pager { justify-content: space-between; padding: 14px 18px 16px; }
    .stats > div { flex-wrap: wrap; gap: 4px 16px; }
    .server-head { flex-wrap: wrap; }
    .pedido { padding: 18px; }
    .empty.pad { padding: 20px 18px; }
    .alert code, .note code { overflow-wrap: anywhere; word-break: break-all; }
    .totp-config { grid-template-columns: 1fr; justify-items: center; }
    .totp-config > .form-stack { width: 100%; }
    .codigo-2fa { max-width: none; }
    .chart-xlabel:not(.chart-xlabel-m) { display: none; }

    /* Login e página pública */
    .login-side { padding: calc(24px + env(safe-area-inset-top)) 22px 26px; }
    .login-pitch { margin: 28px 0 0; }
    .login-pitch h1 { font-size: 28px; }
    .login-pitch p { margin-top: 12px; font-size: 15px; }
    .login-main { padding: 28px 18px calc(36px + env(safe-area-inset-bottom)); align-items: flex-start; }
    .publico .login-main { padding-top: 28px; }
}

@media (max-width: 560px) {
    .form-actions > .btn, .form-actions > button, .form-actions > a.btn { flex: 1 1 auto; }
    .card-head > .btn, .card-head > a.btn { width: 100%; }
    .pill-status { padding: 0 10px; }
}

/* Tablet (701–900 px): a tabela mantém-se, mais compacta; ações do topo na mesma linha */
@media (min-width: 701px) and (max-width: 900px) {
    .top-actions { width: auto; flex: none; }
    .user-menu { margin-left: 0; }
    .table td, .table th { padding-left: 12px; padding-right: 12px; }
    .table .cell-wrap { min-width: 150px; }
}

/* Tabelas em cartões no telemóvel (a classe table-cards e os nomes das colunas são postos pelo app.js;
   sem JavaScript as tabelas continuam com deslocamento horizontal) */
@media (max-width: 700px) {
    .table-wrap:has(> .table-cards) { overflow-x: visible; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards thead { display: none; }
    .table-cards tr { position: relative; padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
    .table-cards tbody tr:last-child { border-bottom: 0; }
    .table-cards tbody tr:hover { background: transparent; }
    .table-cards td,
    .table-cards td:first-child,
    .table-cards td:last-child {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        padding: 5px 0;
        border: 0;
        text-align: right;
        white-space: normal;
        min-width: 0;
        max-width: none;
    }
    .table-cards td::before {
        content: attr(data-label);
        flex: none;
        max-width: 45%;
        padding-top: 1px;
        color: var(--muted);
        font-size: 13px;
        font-weight: 600;
        text-align: left;
    }
    .table-cards td[data-label=""]::before { display: none; }
    .table-cards td[data-label=""] { justify-content: flex-start; text-align: left; }
    .table-cards .td-v { display: block; min-width: 0; overflow-wrap: anywhere; }
    .table-cards td.td-vazio { display: none; }
    .table-cards td.td-total { display: block; text-align: left; }
    .table-cards td.td-total::before { display: none; }

    /* Primeira coluna = título do cartão */
    .table-cards td.td-titulo {
        order: -1;
        display: block;
        padding: 0 0 6px;
        text-align: left;
        font-size: 15.5px;
        font-weight: 700;
    }
    .table-cards td.td-titulo::before { display: none; }
    .table-cards td.td-titulo .muted { font-weight: 400; }

    /* Coluna de ações: botões alinhados à direita, com espaço */
    .table-cards td .td-v form.inline { display: inline-block; }
    .table-cards td:has(.icon-btn, .btn) { align-items: center; }
    .table-cards td .nome-fonte { justify-content: flex-end; }
    .table-cards td .nome-fonte input { min-width: 0; width: 150px; }
    .table-cards .badge { white-space: normal; text-align: right; }
}
