/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent:       #7a1414;
    --accent-dim:   #581010;
    --fg:           #252729;
    --fg-mid:       rgba(37,39,41,0.60);
    --fg-dim:       rgba(37,39,41,0.40);
    --bg:           #f6f6f5;
    --bg-tag:       #ebebea;
    --bg-pre:       #ebebea;
    --border:       rgba(37,39,41,0.10);
    --link:         #546070;
    --font:         'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    ui-monospace, 'SF Mono', Menlo, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    --max-w:        min(80%, 1080px);
    --pad-x:        24px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }

body {
    background: var(--bg);
    overflow-x: clip;
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Top Nav ───────────────────────────────────────────────────────────────── */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246,246,245,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.top-nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 8px var(--pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    overflow: hidden;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

@media (max-width: 768px) {
    .top-nav-inner {
        overflow: hidden;
        gap: 0;
        padding: 0;
    }
    .top-nav-links {
        flex: 1 1 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        min-width: 0;
        padding: 8px var(--pad-x);
    }
    .top-nav-links::-webkit-scrollbar { display: none; }
    .nav-right {
        flex-shrink: 0;
        padding: 8px var(--pad-x) 8px 0.8rem;
        border-left: 1px solid var(--border);
    }
}

.top-nav a {
    color: var(--fg-mid);
    text-decoration: none;
    transition: color 0.2s;
}

.top-nav a:hover { color: var(--accent); }
.top-nav a.nav-active { color: var(--accent); }

.nav-sep {
    color: var(--fg-dim);
    margin: 0 0.6rem;
    user-select: none;
    flex-shrink: 0;
}


/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.site-main { flex: 1 0 auto; }

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px var(--pad-x) 40px;
    width: 100%;
}

/* ─── Typography ──────────────────────────────────────────────────────────────── */
h1 {
    font-size: 2.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
    margin-top: 1rem;
}

h2 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 1.6rem;
}

a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 1px;
}

/* ─── Header ──────────────────────────────────────────────────────────────────── */
header { margin-bottom: 0.5rem; }

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text { flex: 1; }

.subtitle {
    margin-top: 0.4rem;
    font-size: 1rem;
    color: var(--fg-mid);
    letter-spacing: 0.04em;
}

.tagline {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--fg-dim);
    letter-spacing: 0.03em;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hire-badge,
.connect-badge {
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    font-weight: 600;
    text-transform: uppercase;
    background: transparent;
    white-space: nowrap;
}

.hire-badge {
    color: #2d9e4f;
    border: 1px solid #2d9e4f;
}

.connect-badge {
    color: var(--fg-mid);
    border: 1px solid var(--border);
    cursor: pointer;
}

.connect-badge:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.header-links {
    margin-top: 1.2rem;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

.header-links a {
    color: var(--fg-mid);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
}

.header-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.header-links .sep {
    color: var(--fg-dim);
    margin: 0 0.45rem;
    user-select: none;
}

.header-avatar {
    width: 140px;
    height: 140px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    filter: grayscale(20%);
    transition: filter 0.3s, transform 0.3s;
}

.header-avatar:hover {
    filter: grayscale(0%);
    transform: translateY(-2px);
}

/* ─── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.6rem 0;
}

/* ─── Section ─────────────────────────────────────────────────────────────────── */
.section { margin-bottom: 0.5rem; }

.section-sub {
    font-size: 0.85rem;
    color: var(--fg-mid);
    margin: -0.6rem 0 1.3rem;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

.featured-post { margin: 0 0 1.1rem; font-size: 0.9rem; }
.featured-post a {
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    letter-spacing: 0.02em;
}
.featured-post a:hover { border-bottom-color: var(--accent); }

/* ─── About ──────────────────────────────────────────────────────────────────── */
.about-text {
    font-size: 0.95rem;
    color: var(--fg-mid);
    margin-bottom: 1.4rem;
    line-height: 1.75;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--fg-dim);
    margin-bottom: 1.6rem;
    letter-spacing: 0.02em;
}

.highlights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
}

.highlight-item {
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-right: 1px solid var(--border);
}

.highlight-item:last-child { border-right: none; }

.highlight-num {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg);
    line-height: 1;
}

.highlight-label {
    font-size: 0.7rem;
    color: var(--fg-dim);
    letter-spacing: 0.04em;
    line-height: 1.35;
}

/* ─── Stack Tags ──────────────────────────────────────────────────────────────── */
.stack-group {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: start;
    gap: 0.6rem 1rem;
    margin-bottom: 0.85rem;
}

.stack-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-dim);
    padding-top: 4px;
    line-height: 1.3;
}

.stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font-size: 0.78rem;
    padding: 3px 9px;
    background: var(--bg-tag);
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
    color: var(--fg);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    cursor: default;
}

.tag:hover {
    background: var(--bg-tag);
    color: var(--accent);
    border-color: var(--accent);
}

.tag.tag-sm {
    font-size: 0.7rem;
    padding: 2px 7px;
    color: var(--fg-mid);
    background: transparent;
}

.tag.tag-sm:hover {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

/* Core stack row — emphasised */
.stack-core .stack-label { color: var(--accent); }
.stack-core .tag {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

/* ─── Timeline / Experience ───────────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.job {
    position: relative;
    margin-bottom: 1.8rem;
    padding-left: 1.4rem;
}

.job::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 6px;
    width: 7px;
    height: 7px;
    border: 1px solid var(--accent);
    background: var(--bg);
    transform: rotate(45deg);
}

.job:last-child { margin-bottom: 0; }

.job-meta {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}

.job-company {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.job-date {
    font-size: 0.78rem;
    color: var(--fg-dim);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.job-role {
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.55rem;
}

.job-desc {
    font-size: 0.88rem;
    color: var(--fg-mid);
    line-height: 1.7;
    margin-bottom: 0.7rem;
}

.job-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.job-tag {
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: lowercase;
    margin-left: 0.5rem;
    font-weight: normal;
}

.job-part {
    margin: 0 0 0.9rem;
    padding-left: 0.85rem;
    border-left: 2px solid var(--border);
}

.job-part:last-of-type { margin-bottom: 0.9rem; }

.job-part-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.job-part-name {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.job-part-note {
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.job-part-date {
    font-size: 0.74rem;
    color: var(--fg-dim);
    white-space: nowrap;
    margin-left: auto;
}

.job-part-desc {
    font-size: 0.85rem;
    color: var(--fg-mid);
    line-height: 1.65;
    margin: 0;
}

.job-part-lead {
    font-size: 0.85rem;
    color: var(--fg-mid);
    line-height: 1.6;
    font-style: italic;
    margin: 0 0 0.45rem;
}

.job-points {
    list-style: none;
    margin: 0;
    padding: 0;
}

.job-points li {
    position: relative;
    padding-left: 1rem;
    font-size: 0.85rem;
    color: var(--fg-mid);
    line-height: 1.6;
    margin-bottom: 0.32rem;
}

.job-points li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.job-points li:last-child { margin-bottom: 0; }

/* ─── Reading progress bar ────────────────────────────────────────────────────── */
#read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--accent);
    z-index: 9999;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ─── Scroll-to-top ───────────────────────────────────────────────────────────── */
#scroll-top {
    position: fixed;
    bottom: 1.6rem;
    right: 1.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg-mid);
    font: 0.78rem/1 var(--font);
    padding: 6px 10px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, color 0.2s, border-color 0.2s;
    letter-spacing: 0.04em;
    z-index: 500;
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Latest posts (main page) ─────────────────────────────────────────────────── */
.latest-posts-list { list-style: none; padding: 0; }
.latest-posts-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.latest-posts-list li:last-child { border-bottom: none; }
.latest-posts-list .lp-title {
    font-size: 0.9rem;
    color: var(--fg);
    border-bottom: none;
    flex: 1;
}
.latest-posts-list .lp-title:hover { color: var(--accent); }
.latest-posts-list .lp-date {
    font-size: 0.74rem;
    color: var(--fg-dim);
    white-space: nowrap;
    flex-shrink: 0;
}
.latest-more {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.78rem;
    color: var(--fg-dim);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.04em;
}
.latest-more:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Footer ──────────────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    color: var(--fg-dim);
    font-size: 0.78rem;
    padding: 2rem 0 1.6rem;
    flex-shrink: 0;
    letter-spacing: 0.03em;
    line-height: 2;
}

.footer-nav { margin-top: 0.6rem; }

.footer-nav a {
    color: var(--fg-dim);
    transition: color 0.2s;
    border-bottom: none;
}

.footer-nav a:hover { color: var(--accent); }

.footer-nav .separator {
    margin: 0 0.5rem;
    opacity: 0.4;
}

/* ─── Contact Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--fg-dim);
    font-family: var(--font);
}

.modal-close:hover { color: var(--accent); }

.modal-title {
    margin: 0 0 1.2rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.modal-label {
    display: block;
    margin-bottom: 1rem;
}

.modal-field-label {
    font-size: 0.8rem;
    color: var(--fg-dim);
    display: block;
    margin-bottom: 0.25rem;
}

.modal-field {
    width: 100%;
    padding: 0.45rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    font: inherit;
}

textarea.modal-field { resize: vertical; }

.modal-status {
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
    min-height: 1.2em;
}

.modal-submit {
    padding: 0.5rem 1.2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

.modal-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    h1 { font-size: 1.7rem; }

    :root { --max-w: 100%; }

    .header-avatar { width: 72px; height: 72px; }

    .highlights { grid-template-columns: repeat(2, 1fr); }
    .highlight-item { border-right: none; border-bottom: 1px solid var(--border); }
    .highlight-item:nth-child(odd) { border-right: 1px solid var(--border); }
    .highlight-item:nth-last-child(-n+2) { border-bottom: none; }

    .stack-label { font-size: 0.68rem; }

    .top-nav { font-size: 0.73rem; }
}

@media (max-width: 480px) {
    :root { --pad-x: 18px; }

    h1 { font-size: 1.35rem; letter-spacing: 0.07em; }

    .header-content { flex-direction: column-reverse; align-items: center; gap: 0.8rem; text-align: center; }
    .header-text { width: 100%; }
    .header-avatar { width: 90px; height: 90px; }
    .header-links { text-align: center; }
    .badge-row { justify-content: center; }

    .stack-group { grid-template-columns: 1fr; gap: 0.3rem; }
    .stack-label { min-width: unset; }

    .timeline { padding-left: 14px; }
    .job { padding-left: 1rem; }
    .job::before { left: -19px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Skip link ───────────────────────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.82rem;
    border-bottom: none;
    z-index: 9999;
    letter-spacing: 0.04em;
}

.skip-link:focus {
    top: 0;
}

/* ─── Dark mode ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] .top-nav {
    background: rgba(21,23,28,0.85);
}

[data-theme="dark"] {
    --accent:     #e06363;
    --accent-dim: #b83030;
    --fg:         #d7dade;
    --fg-mid:     rgba(215,218,222,0.68);
    --fg-dim:     rgba(215,218,222,0.45);
    --bg:         #15171c;
    --bg-tag:     #1d2026;
    --bg-pre:     #1d2026;
    --border:     rgba(255,255,255,0.09);
    --link:       #7a9aae;
}

[data-theme="dark"] .hire-badge {
    color: #46c06e;
    border-color: #46c06e;
}

[data-theme="dark"] .header-avatar { filter: grayscale(20%) brightness(0.9); }
[data-theme="dark"] .header-avatar:hover { filter: grayscale(0%) brightness(1); }

/* ─── Nav right ──────────────────────────────────────────────────────────────── */
.nav-right { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }

.lang-switcher {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    font-family: var(--font);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: none;
}
.lang-switcher > * + * { border-left: 1px solid var(--border); }
.lang-switcher .ls-active,
.lang-switcher .ls-inactive {
    padding: 0.2rem 0.6rem;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    line-height: inherit;
}
.lang-switcher .ls-active   { background: var(--accent); color: #fff; cursor: default; }
.lang-switcher .ls-inactive { background: var(--bg-tag); color: var(--fg-mid); text-decoration: none; transition: color 0.15s; }
.lang-switcher .ls-inactive:hover { color: var(--accent); }

/* ─── Theme toggle button ─────────────────────────────────────────────────────── */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0 0 0.4rem;
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1;
    color: var(--fg-mid);
    transition: color 0.2s;
    vertical-align: middle;
    user-select: none;
    flex-shrink: 0;
}

.theme-toggle:hover { color: var(--accent); }
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Print ───────────────────────────────────────────────────────────────────── */
@media print {
    .top-nav, .skip-link { display: none; }

    body {
        font-size: 11pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    :root {
        --accent: #6b0000;
        --fg: #000;
        --fg-mid: #333;
        --fg-dim: #666;
        --border: #ccc;
        --bg: #fff;
        --bg-tag: #f0f0f0;
        --pad-x: 0px;
    }

    .container { padding: 0; }

    h1 { font-size: 18pt; }
    h2 { font-size: 8pt; margin-bottom: 0.8rem; }

    .header-avatar { width: 72px; height: 72px; }

    .highlights { border: 1px solid #ccc; }

    a { color: inherit; border-bottom: none; }
    a[href^="http"]::after,
    a[href^="mailto"]::after { content: " (" attr(href) ")"; font-size: 0.7em; color: #666; }

    .tag, .tag.tag-sm {
        background: transparent;
        border: 1px solid #ccc;
        color: #333;
    }

    footer { padding: 1rem 0 0; }

    .divider { border-top: 1px solid #ccc; }

    @page {
        margin: 1.5cm 2cm;
    }
}

/* ─── Dashboard pages (proxy, vpn) ───────────────────────────────────────────── */
.dashboard-content {
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
    padding: 32px var(--pad-x) 40px;
    flex: 1;
}

.dashboard-content h2 {
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent);
    margin: 14px 0 2px;
}

.dashboard-content pre {
    margin: 0;
    white-space: pre;
    overflow-x: auto;
    background: var(--bg-pre);
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--sc-accent, var(--border));
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.dashboard-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3px 0 8px;
}

.dashboard-content a {
    color: var(--link);
    text-decoration: none;
    border-bottom: none;
}

.dashboard-content a:hover {
    text-decoration: underline;
    color: var(--link);
    border-bottom: none;
}

.dashboard-content details {
    margin: 6px 0;
    border: 1px solid var(--border);
    background: var(--bg-pre);
    padding: 6px 8px;
}

.dashboard-content details > summary {
    cursor: pointer;
    color: var(--fg-dim);
    list-style: none;
    outline: none;
    user-select: none;
}

.dashboard-content details > summary::-webkit-details-marker { display: none; }
.dashboard-content details > summary::before { content: '\25B6 '; font-size: .75em; }
.dashboard-content details[open] > summary::before { content: '\25BC '; }
.dashboard-content details > div { margin-top: 8px; }

/* Dashboard utility classes */
.lbl  { color: var(--fg-dim); user-select: none; }
.hint { color: var(--fg-dim); font-size: 0.88em; margin-left: 0.5em; }

.val { cursor: pointer; transition: color .1s; }
.val:hover { color: var(--fg-dim); }
.val.flash { color: #2a2 !important; }

.tog { cursor: pointer; color: var(--fg-dim); font-size: .9em; margin-left: 4px; user-select: none; }
.tog:hover { color: var(--fg); }

.secret { letter-spacing: 2px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; flex-shrink: 0; }
.dot-on  { background: #2a2; }
.dot-off { background: #666; }
.dot-ok    { background: #22c55e; box-shadow: 0 0 4px #22c55e80; animation: pulse 2.5s ease-in-out infinite; }
.dot-error { background: #ef4444; box-shadow: 0 0 4px #ef444480; animation: pulse 1.8s ease-in-out infinite; }
.dot-na    { background: var(--fg-dim); }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:0.4 } }
.up   { background: #2a2; }
.down { background: #c33; }

.status-ts { color: var(--fg-dim); font-size: .82em; margin-top: 4px; }

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font: 12.5px/1.6 var(--font-mono);
    background: var(--bg-pre);
    border: 1px solid var(--border);
}
.stats-table th { color: var(--fg-dim); font-weight: normal; text-align: left;
                  padding: 4px 8px; border-bottom: 1px solid var(--border); }
.stats-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table td:not(:first-child) { text-align: right; color: var(--fg); }
.stats-table td:first-child { color: var(--fg-dim); }

.wg-table {
    width: 100%;
    border-collapse: collapse;
    font: 12.5px/1.6 var(--font-mono);
    background: var(--bg-pre);
    border: 1px solid var(--border);
}
.wg-table th { color: var(--fg-dim); font-weight: normal; text-align: left;
               padding: 4px 8px; border-bottom: 1px solid var(--border); }
.wg-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
.wg-table tr:last-child td { border-bottom: none; }

.ip-row   { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.ip-badge { padding: 1px 6px; border-radius: 2px; font-size: .82em; font-weight: bold; }
.ip-vpn   { background: rgba(40,160,40,.15); color: #2a2; border: 1px solid #2a2; }
.ip-open  { background: rgba(180,50,50,.12); color: var(--accent); border: 1px solid var(--accent); }

img.qr { display: block; margin: 8px 0; border: 1px solid var(--border);
         image-rendering: pixelated; width: 160px; height: 160px; }

/* ─── Stat cards (global) ────────────────────────────────────────────────── */
.stat-card {
    padding: 0.65rem 0.85rem;
    background: var(--bg-pre);
    border: 1px solid var(--border);
    border-left: 3px solid var(--sc-accent, var(--border));
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stat-label {
    font-size: 0.64em;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
    line-height: 1.3;
}
.stat-value {
    font-size: 1.45em;
    font-weight: 600;
    color: var(--fg);
    font-family: var(--font-mono);
    word-break: break-all;
    line-height: 1.2;
}
.health-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}
@media (max-width: 600px) { .health-strip { grid-template-columns: repeat(2, 1fr); } }
.health-card {
    padding: 0.48rem 0.85rem;
    background: var(--bg-pre);
    border: 1px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.health-lbl {
    font-size: 0.64em;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: var(--font-mono);
}
.health-val {
    font-size: 0.69em;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 2px 7px;
    border-radius: 2px;
    letter-spacing: 0.04em;
    transition: color .2s, background .2s;
}
.health-ok      { color: #22c55e; background: rgba(34,197,94,0.12); }
.health-fail    { color: #ef4444; background: rgba(239,68,68,0.12); }
.health-neutral { color: var(--fg-dim); background: transparent; }
