:root {
    --paper: #f6f3ee;
    --ink: #1f2933;
    --muted: #5c6b7a;
    --line: #e6e1d8;
    --card: #ffffff;
    --accent: #0e7490;
    --accent-soft: #e7f5f8;
    --good: #0f7a45;
    --good-soft: #e5f6ee;
    --warn: #8a5a00;
    --warn-soft: #fff4df;
    --bad: #9b2c2c;
    --bad-soft: #fdecec;
    --shadow: 0 10px 30px rgba(40, 32, 22, 0.06);
    font-family: "Figtree", sans-serif;
    color: var(--ink);
}

body {
    margin: 0;
    font-family: "Figtree", sans-serif;
    background: var(--paper);
    color: var(--ink);
}

body.home {
    position: relative;
    background: #fff;
    color: #141414;
    overflow-x: hidden;
}
.home-cluster {
    position: absolute;
    z-index: 0;
    top: 6.5rem;
    right: -1.5rem;
    width: min(420px, 36vw);
    height: auto;
    pointer-events: none;
    user-select: none;
    mix-blend-mode: multiply;
    opacity: 0.72;
}
.home-bar,
body.home main,
.home-foot { position: relative; z-index: 1; }
.home-bar { background: #fff; }
.home-bar, .home-hero, .home-section, .home-foot {
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.home-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.25rem;
    border-bottom: 1px solid #ececec;
}
.home-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #141414;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}
.home-logo { width: 2rem; height: 2rem; display: block; }
.home-mark { width: 5.5rem; height: 5.5rem; margin: 0 auto 0.85rem; }
.home-domain { margin: 0.4rem 0 0; color: #5c656c; font-weight: 600; letter-spacing: 0.01em; }
.home-product { margin: 1.35rem 0 0; font-size: clamp(1.7rem, 3.2vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.home-nav { display: flex; align-items: center; gap: 1.15rem; }
.home-nav a { color: #3a3a3a; text-decoration: none; font-weight: 600; }
.home-nav a:hover { color: #000; }
.home-nav-strong {
    border: 1px solid #141414;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
}
.home-hero { padding-top: 4.5rem; padding-bottom: 2.5rem; text-align: center; }
.home-hero h1 {
    margin: 0;
    font-size: clamp(2.3rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.05;
}
.home-lede {
    max-width: 38rem;
    margin: 0.45rem auto 1.4rem;
    color: #4b4b4b;
    font-size: 1.15rem;
}
.home-code {
    max-width: 34rem;
    margin: 0 auto;
    padding: 1rem 1.15rem;
    background: #1c1c1c;
    color: #f4f4f4;
    border-radius: 8px;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.home-code code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}
.home-code-command {
    margin-top: 0.8rem;
    max-width: 48rem;
    font-size: 0.86rem;
    white-space: pre;
    overflow-x: auto;
}
.home-note { margin: 1rem 0 0; color: #4b4b4b; }
.home-note a { color: #141414; }
.home-section { padding-top: 2.2rem; padding-bottom: 2.4rem; }
.home-section h2 {
    margin: 0 0 1.4rem;
    text-align: center;
    font-size: 1.85rem;
    letter-spacing: -0.03em;
}
.home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem;
}
.home-grid h3 { margin: 0 0 0.45rem; font-size: 1.08rem; }
.home-grid p, .home-steps { margin: 0; color: #3f3f3f; line-height: 1.55; }
.home-boards {
    margin: 1.6rem auto 0;
    max-width: 40rem;
    text-align: center;
    color: #4b4b4b;
    line-height: 1.55;
}
.home-robots { text-align: center; }
.home-robots-figure { margin: 0; background: #fff; }
.home-robots-figure img {
    display: block;
    width: min(760px, 100%);
    height: auto;
    margin: 0 auto;
    mix-blend-mode: multiply;
    opacity: 0.85;
}
.home-robots-figure figcaption {
    max-width: 38rem;
    margin: 0.6rem auto 0;
    color: #4b4b4b;
    line-height: 1.55;
}
.home-start { padding-bottom: 3.5rem; }
.home-steps {
    max-width: 40rem;
    margin: 0 auto;
    padding-left: 1.2rem;
}
.home-steps li + li { margin-top: 0.7rem; }
.home-cta { margin: 1.6rem 0 0; text-align: center; }
.home-button {
    display: inline-block;
    background: #141414;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.7rem 1rem;
}
.home-button:hover { background: #000; color: #fff; }
.home-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-top: 1px solid #ececec;
    padding-top: 1.2rem;
    padding-bottom: 1.6rem;
    color: #6b6b6b;
}
.home-arch { padding-top: 1rem; }
.home-arch-figure {
    margin: 0;
    background: #e4ead4;
    border-radius: 16px;
    padding: 0.85rem 0.85rem 1.1rem;
}
.home-arch-wide {
    display: block;
    width: 100%;
    height: auto;
    font-family: "Figtree", sans-serif;
}
.home-arch-wide .arch-card { fill: #fff; stroke: #e3e3e3; stroke-width: 1.25; }
.home-arch-wide .arch-card-dashed { fill: #f7f8f2; stroke: #141414; stroke-dasharray: 5 4; }
.home-arch-wide .arch-group { fill: #fff; stroke: #dedede; stroke-width: 1.25; }
.home-arch-wide .arch-mini { fill: #eef2e4; stroke: #e0e6d4; stroke-width: 1; }
.home-arch-wide .arch-fleet { fill: #fff; stroke: #e3e3e3; stroke-width: 1.25; }
.home-arch-wide .arch-line { stroke: #141414; stroke-width: 1.4; fill: none; }
.home-arch-wide .arch-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: #6a6a6a;
}
.home-arch-wide .arch-title {
    font-size: 18px;
    font-weight: 700;
    fill: #141414;
    text-anchor: middle;
}
.home-arch-wide .arch-title-sm { font-size: 15px; }
.home-arch-wide .arch-sub { font-size: 12px; fill: #5c5c5c; text-anchor: middle; }
.home-arch-wide .arch-sub-start { text-anchor: start; }
.home-arch-wide .arch-label { font-size: 12px; fill: #5c5c5c; text-anchor: middle; }
.home-arch-wide .arch-label-end { text-anchor: end; }
.home-arch-wide .arch-tunnel { fill: #141414; }
.home-arch-wide .arch-tunnel-title {
    font-size: 15px;
    font-weight: 700;
    fill: #fff;
    text-anchor: middle;
}
.home-arch-wide .arch-tunnel-sub { font-size: 12px; fill: #e4e4e4; text-anchor: middle; }
.home-arch-wide .arch-mesh-line { stroke: #0f7a45; stroke-width: 1.8; fill: none; }
.home-arch-wide .arch-mesh-dot { fill: #0f7a45; }
.home-arch-wide .arch-mesh-title {
    font-size: 14px;
    font-weight: 700;
    fill: #0f7a45;
    text-anchor: middle;
}
.home-arch-wide .arch-bar { fill: #141414; }
.home-arch-wide .arch-bar-soft { fill: #cfcfcf; }
.home-arch-stack { display: none; }
.home-arch figcaption {
    max-width: 44rem;
    margin: 0.95rem auto 0;
    color: #4b4b4b;
    text-align: center;
    line-height: 1.55;
}
@media (max-width: 800px) {
    .home-cluster { display: none; }
    .home-boards { margin-left: 0; margin-right: 0; text-align: left; }
    .home-hero { padding-top: 2.8rem; }
    .home-bar { flex-wrap: wrap; row-gap: 0.35rem; }
    .home-grid { grid-template-columns: 1fr; }
    .home-arch-wide { display: none; }
    .home-arch-stack { display: flex; flex-direction: column; gap: 0.45rem; }
    .home-node {
        background: #fff;
        border: 1px solid #e3e3e3;
        border-radius: 12px;
        padding: 0.75rem 0.9rem;
    }
    .home-node strong { display: block; }
    .home-node span { color: #5c5c5c; font-size: 0.9rem; }
    .home-node-group { background: #fff; }
    .home-builders, .home-devices {
        display: grid;
        gap: 0.45rem;
        margin-top: 0.65rem;
    }
    .home-builders { grid-template-columns: 1fr 1fr; }
    .home-devices { grid-template-columns: 1fr 1fr; }
    .home-node-dashed { border-style: dashed; border-color: #141414; }
    .home-arch-arrow {
        margin: 0;
        text-align: center;
        color: #5c5c5c;
        font-size: 0.82rem;
    }
    .home-tunnel {
        border: 1px solid #141414;
        border-radius: 14px;
        background: #141414;
        color: #fff;
        text-align: center;
        padding: 0.75rem 0.9rem;
    }
    .home-tunnel strong { display: block; }
    .home-tunnel-bits {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.15rem 0.35rem;
        margin-top: 0.25rem;
    }
    .home-tunnel-bits span { color: #e4e4e4; font-size: 0.82rem; }
    .home-tunnel-bits span:not(:last-child)::after { content: " ·"; color: #bdbdbd; }
    .home-mesh {
        border: 1px solid #0f7a45;
        border-radius: 12px;
        background: #f3faf6;
        padding: 0.75rem 0.9rem;
    }
    .home-mesh strong { display: block; color: #0f7a45; }
    .home-mesh span { color: #3f3f3f; }
}

.shell { display: flex; min-height: 100vh; }
.side {
    width: 292px;
    flex: none;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 1.1rem 0.85rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.2rem 0.45rem 1.2rem;
    color: var(--ink);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
}
.brand i { color: var(--accent); }
.side-label {
    margin: 1rem 0.7rem 0.35rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.side-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.15rem 0;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.side-link i { width: 1.1rem; color: var(--muted); text-align: center; }
.side-link:hover { background: #f3f0ea; color: var(--ink); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link.active i { color: var(--accent); }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.4rem;
    background: rgba(246, 243, 238, 0.9);
    border-bottom: 1px solid transparent;
}
.menu-button {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    width: 2.4rem;
    height: 2.4rem;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.88rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; color: #c3bdb3; }
.topbar-user { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.92rem; }
.topbar-user form { margin: 0; }
.topbar-user button {
    border: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 600;
    padding: 0;
}
.page { padding: 0.4rem 1.4rem 2rem; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 0.85rem 1.1rem; }
.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.card-title i, .section-icon { color: var(--accent); }
.card-body { padding: 1rem 1.1rem; }
.card-header.d-flex .card-title { float: none; }

.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { border-color: var(--line); padding: 0.75rem 1rem; }
.table thead th {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #fbfaf7;
}
.table a { color: var(--accent); font-weight: 650; text-decoration: none; }
.table a:hover { text-decoration: underline; }

.form-control, .form-select {
    border-color: #d9d3c8;
    border-radius: 10px;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15);
}
.text-muted, .form-text, .login-box-msg { color: var(--muted) !important; }
code {
    background: #f3f0ea;
    color: var(--ink);
    padding: 0.12em 0.35em;
    border-radius: 6px;
}
.guide .sample + .sample {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}
.guide .sample > .card:first-child .card-title { font-size: 1.2rem; }
.guide pre {
    position: relative;
    background: #1c1917;
    color: #f5f1ea;
    border-radius: 12px;
    padding: 1rem 2.8rem 1rem 1.1rem;
    overflow: auto;
    font-size: 0.86rem;
    line-height: 1.5;
    margin-bottom: 0;
}
.code-copy {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: rgba(245, 241, 234, 0.1);
    color: #f5f1ea;
}
.code-copy:hover, .code-copy:focus {
    background: rgba(245, 241, 234, 0.2);
    color: #fff;
}
.code-copy.is-copied { color: #86efac; }
.guide pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}
.install-command pre {
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-all;
}
.invite { display: inline-block; word-break: break-all; font-size: 0.95rem; }

.btn { border-radius: 10px; font-weight: 650; }
.row-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.45rem; }
.row-actions form { margin: 0; }
.builder-list { display: flex; flex-direction: column; }
.builder-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.1rem;
    border-top: 1px solid var(--line);
}
.builder-row:first-child { border-top: 0; }
.builder-main { min-width: min(100%, 18rem); flex: 1; }
.builder-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.builder-name strong { font-size: 1rem; }
.builder-meta { margin: 0.28rem 0 0; color: var(--muted); font-size: 0.88rem; }
.builder-job { margin: 0.35rem 0 0; font-size: 0.9rem; }
.builder-job i { color: var(--warn); margin-right: 0.25rem; }
.icon-btn {
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
}
a.icon-btn:hover, button.icon-btn:hover, a.icon-btn:focus-visible, button.icon-btn:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.icon-btn.is-warn { color: var(--warn); border-color: #e6d3a8; background: var(--warn-soft); }
.icon-btn.is-warn:hover, .icon-btn.is-warn:focus-visible { color: var(--warn); border-color: var(--warn); }
.icon-btn.is-danger:hover, .icon-btn.is-danger:focus-visible { color: var(--bad); border-color: var(--bad); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: #0c6578; border-color: #0c6578; }
.btn i, .side-link i, .brand i { pointer-events: none; }

.device-network-live {
    color: var(--good);
    font-size: 0.65rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.badge[class*="status-"], .build-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.28em 0.65em;
    font-weight: 700;
    font-size: 0.78rem;
}
.badge.status-online, .badge.status-succeeded, .build-status.status-succeeded { background: var(--good-soft); color: var(--good); }
.badge.status-pending,
.badge.status-queued,
.badge.status-running,
.badge.status-re-provisioning,
.build-status.status-queued,
.build-status.status-building { background: var(--warn-soft); color: var(--warn); }
.badge.status-offline, .build-status.status-cloud { background: var(--accent-soft); color: var(--accent); }
.badge.status-idle { background: var(--good-soft); color: var(--good); }
.badge.status-busy { background: var(--warn-soft); color: var(--warn); }
.badge.status-free { background: #eef1f4; color: var(--muted); }
.badge.status-basic { background: var(--accent-soft); color: var(--accent); }
.badge.status-pro { background: var(--good-soft); color: var(--good); }
.badge.status-enterprise { background: var(--warn-soft); color: var(--warn); }
.badge.branch-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.35rem;
    background: #fff4e5;
    color: #9a3412;
    border-radius: 999px;
    padding: 0.28em 0.65em;
    font-weight: 700;
    font-size: 0.75rem;
    vertical-align: middle;
}
.badge.status-disabled,
.badge.status-rejected,
.badge.status-removing,
.badge.status-failed,
.build-status.status-failed { background: var(--bad-soft); color: var(--bad); }

.summary-band, .fact, .meter {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.summary-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
}
.summary-identity, .summary-actions { display: flex; align-items: center; gap: 0.85rem; }
.summary-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.summary-kicker a { color: inherit; text-decoration: none; }
.summary-stat { margin: 0.15rem 0 0; font-size: 1.02rem; }
.fleet-phase.phase-building,
.fleet-phase.phase-deploying,
td.is-pulling { color: var(--warn); font-weight: 700; }
.fleet-phase.phase-running { color: var(--good); font-weight: 700; }
.age-month { color: #c2410c; font-weight: 700; }
.age-quarter { color: var(--bad); font-weight: 700; }
.summary-release { min-width: min(100%, 28rem); }
.live-mark { margin: 0.25rem 0 0; color: var(--good); font-size: 0.85rem; font-weight: 700; }
.live-mark::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: #14a35a;
    box-shadow: 0 0 0 0 rgba(20, 163, 90, 0.55);
    animation: live-pulse 1.8s ease-out infinite;
}
.live-mark.is-quiet { color: var(--muted); }
.live-mark.is-quiet::before { background: #b0a89c; animation: none; box-shadow: none; }
@keyframes live-pulse {
    70% { box-shadow: 0 0 0 6px rgba(20, 163, 90, 0); }
}

.fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
    margin: 0 0 1rem;
}
.fact { margin: 0; padding: 0.8rem 0.95rem; }
.fact dt {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.fact dd { margin: 0.3rem 0 0; word-break: break-word; }

.meter-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.meter { padding: 0.85rem 0.95rem; }
.meter-label {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.meter-value { color: var(--ink); letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.meter-track { height: 0.45rem; background: #efeae3; border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.meter-fill-warm { background: #d97706; }

.service-list { border-top: 1px solid var(--line); }
.service-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    padding: 0.75rem 1rem;
}
.service-row + .service-row { border-top: 1px solid var(--line); }
.service-name { font-weight: 700; }
.service-name i { color: var(--accent); margin-right: 0.35rem; }
.service-row code { font-size: 0.82rem; }
.service-log {
    min-height: 9rem;
    max-height: 22rem;
    margin: 0;
    overflow: auto;
    background: #fbfaf7;
    color: var(--ink);
    padding: 0.9rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.84rem;
    line-height: 1.45;
    border-radius: 0 0 16px 16px;
}
.service-log.log-pane {
    min-height: 12rem;
    max-height: 36rem;
}

.build-table { table-layout: fixed; width: 100%; }
.build-table th:nth-child(1),
.build-table td:nth-child(1) { width: 17rem; }
.build-table th:nth-child(2),
.build-table td:nth-child(2) { width: 8.5rem; }
.build-table th:nth-child(3),
.build-table td:nth-child(3) { width: 12rem; white-space: nowrap; }
.build-table th:nth-child(4),
.build-table td:nth-child(4) { width: 24rem; }
.build-table td:nth-child(5) { overflow-wrap: anywhere; }
.build-ref, .build-image { display: flex; align-items: center; gap: 0.45rem; min-width: 0; white-space: nowrap; }
.build-image code { white-space: nowrap; }
.build-ref .branch-label { margin-left: 0; }
.build-table tr.is-link { cursor: pointer; }
.build-table tr.is-link:hover td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.build-num { font-weight: 700; color: inherit; text-decoration: none; }
.build-ref i, .build-image i { color: var(--accent); }
.build-reason { margin: 0.35rem 0 0; overflow-wrap: anywhere; font-size: 0.86rem; }
.nav-tabs { border-bottom-color: var(--line); gap: 0.25rem; }
.nav-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    border: 0;
    border-radius: 10px 10px 0 0;
    font-weight: 700;
}
.nav-tabs .nav-link.active { color: var(--accent); background: #fff; border: 1px solid var(--line); border-bottom-color: #fff; }

.alert-success { background: var(--good-soft); color: var(--good); border-color: #b7e4c7; }
.alert-danger { background: var(--bad-soft); color: var(--bad); border-color: #f3c1c1; }
tr.firewall-locked td { color: #6b7280; background: #f3f4f6; }
tr.firewall-locked .fa-lock { margin-right: 0.35rem; }
.firewall-shield { margin-right: 0.45rem; }
.firewall-shield.is-on { color: var(--good); }
.firewall-shield.is-off { color: var(--bad); }
.firewall-shield.is-paused { color: var(--bad); }
a + .firewall-shield.is-paused { margin-left: 0.45rem; }
.alert-success, .alert-danger, .alert-warning { border-radius: 12px; }
.update-log { max-height: 32rem; overflow: auto; background: #fbfaf7; color: var(--ink); padding: 0.8rem; white-space: pre-wrap; border-radius: 12px; }
.shell-terminal { height: 32rem; background: #000; border: 1px solid #2a2a2a; border-radius: 12px; padding: 0.85rem 0.7rem 0.6rem; }
.shell-terminal .xterm { height: 100%; }
.shell-terminal .xterm-viewport { background-color: #000 !important; }

.app-login { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 1.5rem 1.4rem 1.3rem;
}
.login-brand { margin-bottom: 0.8rem; font-size: 1.4rem; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    line-height: 1;
}
.theme-toggle:hover,
.theme-toggle:focus-visible { background: rgba(20, 20, 20, 0.06); }

html[data-theme="dark"] body.home {
    background: #121417;
    color: #f3f4f5;
    color-scheme: dark;
}
html[data-theme="dark"] body.home .home-bar { background: #121417; }
html[data-theme="dark"] body.home .home-cluster,
html[data-theme="dark"] body.home .home-robots-figure img {
    mix-blend-mode: screen;
    filter: invert(1);
    opacity: 0.55;
}
html[data-theme="dark"] body.home .home-robots-figure { background: #121417; }
html[data-theme="dark"] body.home .home-robots-figure figcaption { color: #c4c8cc; }
html[data-theme="dark"] body.home .home-bar,
html[data-theme="dark"] body.home .home-foot { border-color: #2a2e33; }
html[data-theme="dark"] body.home .home-brand,
html[data-theme="dark"] body.home .home-note a,
html[data-theme="dark"] body.home .theme-toggle { color: #f3f4f5; }
html[data-theme="dark"] body.home .home-nav a { color: #d5d8dc; }
html[data-theme="dark"] body.home .home-nav a:hover { color: #fff; }
html[data-theme="dark"] body.home .home-nav-strong { border-color: #f3f4f5; }
html[data-theme="dark"] body.home .home-lede,
html[data-theme="dark"] body.home .home-note,
html[data-theme="dark"] body.home .home-boards,
html[data-theme="dark"] body.home .home-grid p,
html[data-theme="dark"] body.home .home-steps,
html[data-theme="dark"] body.home .home-arch figcaption,
html[data-theme="dark"] body.home .home-foot { color: #c4c8cc; }
html[data-theme="dark"] body.home .home-domain { color: #b7bdc2; }
html[data-theme="dark"] body.home .home-product { color: #f3f4f5; }
html[data-theme="dark"] body.home .home-code { background: #0c0d0f; }
html[data-theme="dark"] body.home .home-button { background: #f3f4f5; color: #121417; }
html[data-theme="dark"] body.home .home-button:hover { background: #fff; color: #121417; }
html[data-theme="dark"] body.home .theme-toggle:hover,
html[data-theme="dark"] body.home .theme-toggle:focus-visible { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] body.home .home-arch-figure { background: #2a3324; }
html[data-theme="dark"] body.home .home-arch-wide .arch-card,
html[data-theme="dark"] body.home .home-arch-wide .arch-group,
html[data-theme="dark"] body.home .home-arch-wide .arch-fleet { fill: #1b1e22; stroke: #3a4148; }
html[data-theme="dark"] body.home .home-arch-wide .arch-card-dashed { fill: #23281c; stroke: #d7d7d7; }
html[data-theme="dark"] body.home .home-arch-wide .arch-mini { fill: #31382a; stroke: #3d4634; }
html[data-theme="dark"] body.home .home-arch-wide .arch-line,
html[data-theme="dark"] body.home .home-arch-wide #home-arrow path { stroke: #e8e8e8; }
html[data-theme="dark"] body.home .home-arch-wide .arch-kicker { fill: #b5b5b5; }
html[data-theme="dark"] body.home .home-arch-wide .arch-title { fill: #f4f4f4; }
html[data-theme="dark"] body.home .home-arch-wide .arch-sub,
html[data-theme="dark"] body.home .home-arch-wide .arch-label { fill: #b0b0b0; }
html[data-theme="dark"] body.home .home-arch-wide .arch-tunnel { fill: #0c0d0f; }
html[data-theme="dark"] body.home .home-arch-wide .arch-mesh-line { stroke: #8fd4ae; }
html[data-theme="dark"] body.home .home-arch-wide .arch-mesh-dot,
html[data-theme="dark"] body.home .home-arch-wide .arch-mesh-title { fill: #8fd4ae; }
html[data-theme="dark"] body.home .home-mesh { background: #14241c; border-color: #8fd4ae; }
html[data-theme="dark"] body.home .home-mesh strong { color: #8fd4ae; }
html[data-theme="dark"] body.home .home-mesh span { color: #c4c8cc; }
html[data-theme="dark"] body.home .home-arch-wide .arch-bar { fill: #e8e8e8; }
html[data-theme="dark"] body.home .home-arch-wide .arch-bar-soft { fill: #6d6d6d; }
html[data-theme="dark"] body.home .home-node,
html[data-theme="dark"] body.home .home-node-group { background: #1b1e22; border-color: #3a4148; }
html[data-theme="dark"] body.home .home-node span,
html[data-theme="dark"] body.home .home-arch-arrow { color: #b0b0b0; }
html[data-theme="dark"] body.home .home-node-dashed { border-color: #d7d7d7; }
html[data-theme="dark"] body.home .home-tunnel { background: #0c0d0f; border-color: #0c0d0f; }

html[data-theme="dark"] body.app-shell {
    --paper: #14171b;
    --ink: #e8eaed;
    --muted: #a7b0ba;
    --line: #2c3238;
    --card: #1c2127;
    --accent: #5ec4dc;
    --accent-soft: #16343d;
    --good: #8fd4ae;
    --good-soft: #143226;
    --warn: #e4c07a;
    --warn-soft: #3a2e14;
    --bad: #f0b0b0;
    --bad-soft: #3a1c1c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
    background: var(--paper);
    color: var(--ink);
}
html[data-theme="dark"] body.app-shell .side,
html[data-theme="dark"] body.app-shell .menu-button,
html[data-theme="dark"] body.app-shell .fact,
html[data-theme="dark"] body.app-shell .summary-band,
html[data-theme="dark"] body.app-shell .meter { background: var(--card); color: var(--ink); }
html[data-theme="dark"] body.app-shell .side-link:hover { background: #2a3036; color: var(--ink); }
html[data-theme="dark"] body.app-shell .topbar { background: rgba(20, 23, 27, 0.94); }
html[data-theme="dark"] body.app-shell .crumbs li + li::before { color: #5c656e; }
html[data-theme="dark"] body.app-shell .theme-toggle:hover,
html[data-theme="dark"] body.app-shell .theme-toggle:focus-visible { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] body.app-shell .table {
    --bs-table-color: var(--ink);
    --bs-table-bg: transparent;
    --bs-table-striped-color: var(--ink);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
    --bs-table-hover-color: var(--ink);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.07);
    --bs-table-border-color: var(--line);
}
html[data-theme="dark"] body.app-shell .table thead th { background: #22282e; }
html[data-theme="dark"] body.app-shell .form-control,
html[data-theme="dark"] body.app-shell .form-select {
    border-color: #3a424a;
    background: #14181c;
    color: var(--ink);
}
html[data-theme="dark"] body.app-shell .form-control::placeholder { color: #8b969f; }
html[data-theme="dark"] body.app-shell code { background: #2a3036; color: var(--ink); }
html[data-theme="dark"] body.app-shell .guide pre code { background: transparent; color: inherit; }
html[data-theme="dark"] body.app-shell .badge.branch-label { background: #3a2414; color: #fdba74; }
html[data-theme="dark"] body.app-shell tr.firewall-locked td { color: #9aa3ad; background: #1a1e23; }
html[data-theme="dark"] body.app-shell .badge.status-free { background: #2a3036; color: var(--muted); }
html[data-theme="dark"] body.app-shell .nav-tabs .nav-link.active { background: var(--card); border-bottom-color: var(--card); }
html[data-theme="dark"] body.app-shell .meter-track { background: #2a3036; }
html[data-theme="dark"] body.app-shell .service-log,
html[data-theme="dark"] body.app-shell .update-log { background: #12161a; color: var(--ink); }
html[data-theme="dark"] body.app-shell .alert-success { border-color: #245c3a; }
html[data-theme="dark"] body.app-shell .alert-danger { border-color: #6e3030; }

@media (max-width: 992px) {
    .meter-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
    .menu-button { display: inline-grid; place-items: center; }
    .side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }
    .shell.nav-open .side { transform: none; }
    .topbar-user span { display: none; }
    .page, .topbar { padding-left: 1rem; padding-right: 1rem; }
}
