@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --bg: #1a1a1a;
    --bg-2: #181818;
    --sidebar: #161616;
    --surface: #212121;
    --surface-2: #242424;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --text: #d4d4d4;
    --muted: #9a9a9a;
    --blue: #b8b8b8;
    --blue-2: #a3a3a3;
    --blue-soft: rgba(255, 255, 255, .07);
    --cyan: #c8c8c8;
    --green: #7cb87c;
    --warn: #c4a86a;
    --red: #c97a7a;
    --radius: 8px;
    --shadow: none;
    --font: "IBM Plex Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: var(--bg);
}
body.app {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}
a { color: #c8c8c8; text-decoration: none; }
a:hover { color: #e8e8e8; }
.muted { color: var(--muted); font-size: .9rem; }

/* —— Sidebar (estilo ICP) —— */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
}
.sidebar-brand {
    padding: 1.35rem 1.25rem 1.1rem;
    border-bottom: 1px solid var(--line);
}
.sidebar-brand-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.sidebar-brand .logo {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    line-height: 1.2;
    color: #fff;
    text-transform: uppercase;
}
.sidebar-brand .logo span { color: #fff; }
.sidebar-brand .tag {
    display: none;
}
.brand {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fff;
    text-transform: uppercase;
    font-size: 1.35rem;
    margin-bottom: .6rem;
}
.brand span { color: #fff; }
.nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: .5rem 0;
    flex: 1;
    overflow-y: auto;
}
.nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
    padding: .72rem 1.2rem;
    border-radius: 0;
    border-left: 3px solid transparent;
    font-size: .9375rem;
    font-weight: 500;
    letter-spacing: 0;
    transition: background .15s, color .15s, border-color .15s;
}
.nav a .nav-ico {
    width: 1.2rem;
    height: 1.2rem;
    display: grid;
    place-items: center;
    border-radius: 0;
    background: none;
    color: #6e6e6e;
    flex-shrink: 0;
}
.nav a .nav-svg {
    width: 1.15rem;
    height: 1.15rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav a.on, .nav a:hover {
    background: rgba(255, 255, 255, .06);
    color: #ececec;
    border-left-color: #888;
}
.nav a.on .nav-ico, .nav a:hover .nav-ico {
    background: none;
    color: #c8c8c8;
}
.sidebar-foot {
    padding: 1rem 1.1rem 1.25rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.sidebar-foot .who {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
}
.sidebar-foot a.logout {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}
.sidebar-foot a.logout:hover { color: var(--red); }

/* —— Main —— */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar .page-crumb {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0;
}
.top-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
    font-size: .88rem;
}
.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.mode-pill.ensaio { background: rgba(196, 168, 106, .12); color: var(--warn); }
.mode-pill.live { background: rgba(124, 184, 124, .12); color: var(--green); }

.mode-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    padding: .65rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    font-size: .88rem;
    line-height: 1.4;
}
.mode-banner.ensaio {
    background: rgba(196, 168, 106, .12);
    border: 1px solid rgba(196, 168, 106, .22);
    color: #d4c090;
}
.mode-banner.ensaio a {
    margin-left: auto;
    color: #e8e8e8;
    font-weight: 600;
    font-size: .85rem;
}
.mode-banner strong { color: #ececec; }

.logs-auto-label {
    font-size: .85rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.logs-auto-label input { margin-right: .35rem; vertical-align: middle; }

.audit-filters .btn { margin-top: .5rem; margin-right: .35rem; }
.audit-pager {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: .88rem;
}
.audit-pager a { font-weight: 600; }

.dash-mid .quick-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.nav-toggle {
    display: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
    padding: .55rem .85rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    align-items: center;
    gap: .4rem;
    min-height: 42px;
    min-width: 42px;
    -webkit-tap-highlight-color: transparent;
}
.nav-toggle-ico {
    display: inline-block;
    width: 1.1rem;
    height: 1px;
    background: currentColor;
    box-shadow: 0 -.35rem 0 currentColor, 0 .35rem 0 currentColor;
}
.shell {
    padding: 1.15rem 1.75rem 2.5rem;
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Tabelas: scroll horizontal no mobile (wrapper via JS ou manual) */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}
.table-wrap > table {
    min-width: 520px;
    margin: 0;
}
.table-wrap.card {
    background: var(--surface);
    border: none;
    box-shadow: none;
    padding: 0;
}
.table-wrap.card > table {
    background: transparent;
}
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}

.page-head {
    margin: .15rem 0 1.35rem;
}
.page-head h2 {
    margin: 0 0 .4rem;
    font-size: 1.55rem;
    letter-spacing: -0.015em;
    font-weight: 600;
}
.page-head p { margin: 0; max-width: 68ch; font-size: .95rem; }

.page-head-bar {
    margin: 0 0 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.page-head-bar .page-head-main { flex: 1; min-width: 220px; }
.page-head-bar h2 {
    margin: 0 0 .35rem;
    font-size: 1.45rem;
}
.page-head-bar p { margin: 0; max-width: none; font-size: .92rem; }
.page-head-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .35rem;
    flex-shrink: 0;
}
.page-head-actions .sync-meta {
    font-size: .82rem;
    color: var(--muted);
    text-align: right;
    max-width: 42ch;
}

/* —— Dashboard full-width grid —— */
.dash {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.dash-top {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
    gap: 1rem;
    align-items: stretch;
}
.dash-top .res-card,
.dash-top .dash-alerts {
    margin: 0;
    height: 100%;
    border: none;
}
.dash-alerts .alert-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.dash-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
}
.dash-metrics-8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dash-metrics .metric {
    border: none;
    margin: 0;
}
.dash-mid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.dash-mid .hero-card,
.dash-mid .health-summary {
    margin: 0;
    border: none;
}
.dash-mid .quick-links a {
    border: none;
    background: rgba(255, 255, 255, .03);
}
.dash-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.dash-bottom > * {
    border: none;
    border-radius: var(--radius);
}
.dash-stages-wrap,
.dash-bottom .audit-mini {
    padding: 1.15rem 1.25rem;
    background: var(--surface);
    border: none;
}
.dash-stages-wrap .stages { margin: 0; }
.dash-stages-wrap .section-title { margin-bottom: .65rem; }
.dash-bottom .stages {
    border: none;
    border-radius: 0;
}

.hero {
    display: grid;
    grid-template-columns: 1.35fr .95fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.hero-card, .card, .metric {
    background: var(--surface);
    border: none;
    border-radius: var(--radius);
    box-shadow: none;
}
.hero-card { padding: 1.35rem 1.4rem; }
.hero-card h3 { margin: 0 0 .45rem; font-size: 1.05rem; font-weight: 600; }
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.02);
    color: var(--muted);
    font-size: .8125rem;
    font-weight: 500;
}
.chip strong { color: var(--text); font-weight: 600; }

.grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
    margin: 0;
}
.metric {
    padding: 1.1rem 1.05rem;
    transition: border-color .15s, transform .15s;
}
a.metric { color: inherit; display: block; }
a.metric:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    transform: none;
    color: inherit;
}
.metric b {
    display: block;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.metric span {
    color: var(--muted);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: 0;
}
.metric-live {
    display: block;
    margin-top: .35rem;
    font-size: .72rem;
    color: var(--muted);
    font-weight: 500;
}
.metric-live.warn { color: var(--warn); }
.metric-drift { background: rgba(196, 168, 106, .06); }

.nav a.locked {
    opacity: .45;
    pointer-events: auto;
}
.nav a.locked:hover {
    background: transparent;
    color: var(--muted);
    border-left-color: transparent;
}
.nav-lock {
    margin-left: auto;
    font-size: .68rem;
    font-weight: 600;
    color: var(--muted);
    opacity: .85;
}

.copy-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    flex-wrap: wrap;
}
.copy-row .token { flex: 1; min-width: 200px; margin: 0; }
.api-test-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.api-test-out { font-size: .78rem; }

.onboarding-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .45rem;
}
.onboarding-list li a {
    display: flex;
    flex-direction: column;
    gap: .12rem;
    padding: .65rem .85rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, .03);
    color: inherit;
}
.onboarding-list li.check-ok a { border-left: 3px solid var(--green); }
.onboarding-list li.check-err a { border-left: 3px solid var(--warn); }
.onboarding-list li a span { color: var(--muted); font-size: .85rem; }

.health-item .hi-action { margin-top: .55rem; }

.card { padding: 1.15rem 1.25rem; }

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 .85rem;
}
.section-title h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0;
}

.stages {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .65rem;
    margin: 0;
}
.stage {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 124px;
    padding: .95rem .8rem;
    border-radius: var(--radius);
    border: none;
    background: rgba(255, 255, 255, .03);
    color: inherit;
    transition: background .15s;
}
.stage:last-child { border-right: none; }
a.stage:hover {
    border-color: var(--line);
    background: var(--surface-2);
    transform: none;
    color: inherit;
}
.stage .num {
    width: 1.85rem;
    height: 1.85rem;
    display: grid;
    place-items: center;
    border-radius: 4px;
    font-size: .8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,.06);
    color: var(--text);
}
.stage b {
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0;
}
.stage .st {
    margin-top: auto;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 0;
}
.stage.open .st { color: var(--green); }
.stage.current {
    border-color: var(--line);
    background: var(--surface-2);
    box-shadow: none;
}
.stage.locked { opacity: .4; pointer-events: none; }
.stage.locked .num { background: rgba(255,255,255,.04); color: var(--muted); }
.stage.locked .st { color: var(--muted); }

.alert {
    padding: .9rem 1.05rem;
    border-radius: 12px;
    margin: 1rem 0;
    border: 1px solid transparent;
    font-size: .92rem;
}
.alert.ok { background: rgba(124, 184, 124, .1); color: var(--green); border-color: rgba(124, 184, 124, .2); }
.alert.err { background: rgba(201, 122, 122, .1); color: #d4a0a0; border-color: rgba(201, 122, 122, .2); }
.alert.warn { background: rgba(196, 168, 106, .1); color: #d4c090; border-color: rgba(196, 168, 106, .2); }

label { display: block; font-size: .8125rem; color: var(--muted); margin: .8rem 0 .35rem; font-weight: 500; }
input, select, textarea {
    width: 100%;
    background: #161616;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 6px;
    padding: .7rem .85rem;
    font: inherit;
    font-size: .95rem;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--line-strong);
    box-shadow: none;
}
textarea {
    font: .85rem/1.45 var(--mono);
    resize: vertical;
    min-height: 110px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row2.row-hostport { grid-template-columns: minmax(0, 1.6fr) minmax(7rem, .7fr); }

.settings-form { margin: 0; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}
.settings-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    min-width: 0;
}
.settings-card.span-2 { grid-column: 1 / -1; }
.settings-card h3 {
    margin: 0 0 .35rem;
    font-size: 1.02rem;
    font-weight: 600;
    color: #ececec;
}
.settings-card h3 + .muted {
    margin: 0 0 .85rem;
    line-height: 1.45;
}
.settings-card > label:first-of-type { margin-top: .15rem; }
.settings-status {
    margin: .85rem 0 0;
    font-size: .85rem;
}
.settings-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.settings-save-bar .muted { margin: 0; }
.settings-save-bar .btn { margin-top: 0; }
.cron-pulse-ok { color: var(--green); font-weight: 600; }
.cron-pulse-late { color: var(--warn); font-weight: 600; }
.cron-pulse-err { color: var(--red); font-weight: 600; }
.totp-secret { font-family: var(--mono); letter-spacing: .08em; word-break: break-all; }
.qr-totp {
    display: inline-block;
    background: #fff;
    padding: .5rem;
    border-radius: 6px;
    margin: .35rem 0 .75rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #2e2e2e;
    color: #e8e8e8;
    font-weight: 600;
    padding: .68rem 1.15rem;
    cursor: pointer;
    margin-top: 1rem;
    font: inherit;
    font-size: .95rem;
}
.btn:hover { background: #383838; filter: none; }
.btn.ghost {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text);
}
.btn.danger { background: #3a2828; border-color: rgba(201, 122, 122, .35); color: #d4a0a0; }
.btn.danger:hover { background: #452f2f; }
.btn.sm { font-size: .82rem; padding: .4rem .75rem; margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .75rem .5rem; border-bottom: 1px solid var(--line); }
th {
    color: var(--muted);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: .18rem .6rem;
    font-size: .75rem;
    font-weight: 600;
}
.badge.staged { background: rgba(196, 168, 106, .14); color: var(--warn); }
.badge.live { background: rgba(124, 184, 124, .14); color: var(--green); }
.badge.err { background: rgba(201, 122, 122, .14); color: var(--red); }

.health-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.h-pill {
    display: inline-flex;
    align-items: center;
    padding: .32rem .75rem;
    border-radius: 999px;
    font-size: .8125rem;
    font-weight: 600;
    border: 1px solid var(--line);
}
.h-pill.ok { background: rgba(124, 184, 124, .1); color: var(--green); }
.h-pill.warn { background: rgba(196, 168, 106, .1); color: var(--warn); }
.h-pill.err { background: rgba(201, 122, 122, .1); color: var(--red); }

.health-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}
.health-item {
    padding: 1rem 1.05rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
}
.health-item.ok { border-color: rgba(124, 184, 124, .25); }
.health-item.warn { border-color: rgba(196, 168, 106, .25); }
.health-item.err { border-color: rgba(201, 122, 122, .28); }
.hi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .35rem;
}
.hi-detail {
    font-family: var(--mono);
    font-size: .75rem;
    word-break: break-all;
}

.staging-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 1rem;
}
.staging-filters a {
    padding: .4rem .8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}
.staging-filters a.on,
.staging-filters a:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    border-color: var(--line-strong);
}
.res-card { margin-bottom: 1.25rem; }
.res-gauges {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: .45rem;
}
.res-gauge { text-align: center; }
.ring {
    --p: 0;
    width: 140px;
    height: 140px;
    margin: 0 auto .55rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--ring-color, #888) calc(var(--p) * 1%), rgba(255,255,255,.05) 0);
}
.ring.ok { --ring-color: #7cb87c; }
.ring.warn { --ring-color: #c4a86a; }
.ring.err { --ring-color: #c97a7a; }
.ring.na { --ring-color: #666; }
.ring-inner {
    width: 106px;
    height: 106px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    box-shadow: inset 0 0 0 1px var(--line);
}
.ring-val {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.ring-inner span {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: 0;
}
.ring-detail { margin: 0; font-size: .8125rem; min-height: 2.2em; }
.res-php { margin: .85rem 0 0; font-size: .85rem; }
.res-hint { margin: .45rem 0 0; font-size: .78rem; }

.dry-cols label { margin-top: 0; }
.dry-list {
    margin: .35rem 0 0;
    padding-left: 1.1rem;
    color: var(--text);
    font-size: .9rem;
}
.dry-list.live-side li { color: #c8c8c8; }
.dry-list li { margin: .25rem 0; }

code, .token {
    display: block;
    background: #161616;
    padding: .8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    word-break: break-all;
    font-size: .82rem;
    font-family: var(--mono);
}
.inline-code {
    display: inline;
    padding: .12rem .4rem;
    border-radius: 5px;
    background: rgba(255,255,255,.06);
    font-family: var(--mono);
    font-size: .82rem;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0 0;
}
.quick-links a {
    display: block;
    padding: 1rem 1.05rem;
    border-radius: var(--radius);
    border: none;
    background: rgba(255, 255, 255, .03);
    color: inherit;
    transition: background .15s;
}
.quick-links a:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    transform: none;
}
.quick-links strong { display: block; margin-bottom: .25rem; font-size: .98rem; }
.quick-links span { color: var(--muted); font-size: .85rem; }

.audit-mini { margin-top: 1.4rem; }
.audit-mini td { font-size: .86rem; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: var(--bg);
}
.login-card {
    width: min(440px, 94vw);
    padding: 1.6rem 1.5rem 1.65rem !important;
}
.login-card h2 { margin: 0 0 .3rem; letter-spacing: -0.01em; font-size: 1.35rem; font-weight: 600; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 45;
}

.alert-list { display: flex; flex-direction: column; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.alert-item a {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .7rem .85rem;
    border-radius: 6px;
    border: none;
    color: inherit !important;
    background: rgba(255, 255, 255, .03);
}
.alert-item:last-child a { border-bottom: none; }
.alert-item.err a { background: rgba(201, 122, 122, .06); }
.alert-item.warn a { background: rgba(196, 168, 106, .06); }
.alert-item a strong { font-weight: 600; }
.alert-item a span { color: var(--muted); font-size: .88rem; }

.checklist { margin: .4rem 0 0; padding-left: 1.2rem; }
.checklist li { margin: .45rem 0; }
.checklist li strong { display: block; }
.checklist li span { color: var(--muted); font-size: .88rem; }
.check-ok strong { color: var(--green); }
.check-err strong { color: var(--red); }
.check-skip strong { color: var(--muted); }

.log-view, .code-view {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: .78rem;
    line-height: 1.45;
    background: #161616;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .85rem 1rem;
}

@media (max-width: 1400px) {
    .dash-top { grid-template-columns: 1fr; }
    .dash-mid { grid-template-columns: 1fr 1fr; }
    .dash-mid .health-summary { grid-column: 1 / -1; }
    .dash-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
    .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid, .dash-metrics, .dash-metrics-8 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-mid { grid-template-columns: 1fr; }
    .dash-mid .quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    body.app { display: block; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        max-height: 100dvh;
        z-index: 50;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .45);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .sidebar-overlay { display: block; }
    body.nav-open { overflow: hidden; }
    .nav-toggle { display: inline-flex; }
    .topbar {
        padding: .7rem .85rem;
        gap: .55rem;
        position: sticky;
        top: 0;
    }
    .topbar .page-crumb {
        flex: 1;
        min-width: 0;
        font-size: .98rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .top-user {
        flex-shrink: 0;
    }
    .top-user .mode-pill {
        font-size: .68rem;
        padding: .22rem .5rem;
        max-width: 7.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .hero { grid-template-columns: 1fr; }
    .health-list { grid-template-columns: 1fr; }
    .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-links { grid-template-columns: 1fr; }
    .res-gauges { grid-template-columns: 1fr; }
    .shell { padding: 1rem .85rem 2.5rem; }
    .btn, .btn.sm {
        min-height: 40px;
        padding: .5rem .85rem;
    }
    input, select, textarea {
        font-size: 16px; /* evita zoom iOS */
        min-height: 42px;
    }
    textarea { min-height: 96px; }
    .card { padding: 1rem .9rem; }
    .page-head h2 { font-size: 1.25rem; }
    td form, td .btn { margin: .15rem 0; }
}
@media (max-width: 960px) {
    .settings-grid { grid-template-columns: 1fr; }
    .settings-card.span-2 { grid-column: auto; }
}
@media (max-width: 720px) {
    .row2 { grid-template-columns: 1fr; }
    .row2.row-hostport { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-card.span-2 { grid-column: auto; }
    .grid, .dash-metrics, .dash-metrics-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .shell { padding: .85rem .75rem 2.25rem; }
    .page-head-bar { flex-direction: column; }
    .page-head-actions { align-items: flex-start; width: 100%; }
    .page-head-actions .sync-meta { text-align: left; }
    .top-user .mode-pill .mode-extra { display: none; }
    .login-card { width: min(440px, 100%); padding: 1.25rem 1rem 1.35rem !important; }
    .table-wrap > table { min-width: 480px; }
    .res-gauges { gap: .75rem; }
    .metric { padding: .85rem .75rem; }
}
@media (max-width: 420px) {
    .grid, .dash-metrics, .dash-metrics-8, .stages { grid-template-columns: 1fr; }
    .top-user { display: none; }
}
