:root {
    --bg: #0f1412;
    --panel: #18201c;
    --ink: #e8efe9;
    --muted: #9aada0;
    --line: #2a3830;
    --accent: #3dba7a;
    --accent-ink: #062113;
    --warn: #f3c16b;
    --danger: #f07167;
    --radius: 18px;
    font-family: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at 10% -10%, #1d3a2c 0%, transparent 55%),
        var(--bg);
    color: var(--ink);
}

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.shell.wide { width: min(1180px, calc(100% - 32px)); }
.share-shell { width: min(520px, calc(100% - 32px)); }

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 4px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 11px;
    color: var(--accent);
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.03em; }
h1 { font-size: 32px; }
h2 { font-size: 20px; margin-bottom: 8px; }

.muted, .hint { color: var(--muted); line-height: 1.5; }
.hint { font-size: 13px; margin-top: 10px; }

.card {
    background: color-mix(in srgb, var(--panel) 92%, black);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.narrow { max-width: 520px; }

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stat {
    background: #141c18;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
}

.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 28px; letter-spacing: -0.04em; }

label {
    display: block;
    margin: 14px 0 6px;
    font-size: 13px;
    color: var(--muted);
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #101613;
    color: var(--ink);
    border-radius: 12px;
    padding: 12px 13px;
    font: inherit;
}

textarea { resize: vertical; }

button, .secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--accent-ink);
    background: var(--accent);
}

.secondary, .ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.ghost { padding: 8px 12px; font-size: 14px; }
.ghost.active { border-color: var(--accent); color: var(--accent); }

.danger {
    width: 100%;
    margin-top: 12px;
    background: #3a1614;
    color: #ffd4d0;
    border: 1px solid #6a2d28;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row.tight { margin-top: 0; }
.pair { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.check { color: var(--ink); display: flex; align-items: center; gap: 8px; margin: 0; }
.check input { width: auto; }

.error { color: var(--danger); font-size: 14px; }
.success-line { color: var(--accent); font-weight: 600; }

.fresh {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.qr {
    margin: 12px 0;
    padding: 10px;
    width: fit-content;
    background: #fff;
    border-radius: 10px;
}

.list { display: grid; gap: 10px; }

/* List rows must NOT inherit green primary button styling */
.list button.invite,
#links-list button.invite,
#track-links button.invite {
    display: block;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    align-items: stretch;
    background: #101613;
    color: var(--ink);
    border: 1px solid var(--line);
    font-weight: 500;
    padding: 12px 14px;
}

.list button.invite:hover,
#links-list button.invite:hover,
#track-links button.invite:hover {
    border-color: var(--accent);
    background: #141c18;
}

.list button.invite strong {
    display: block;
    color: var(--ink);
    font-weight: 650;
    margin-bottom: 4px;
}

.list button.invite small {
    display: block;
    color: var(--muted);
    line-height: 1.5;
}

.list button.invite .hint {
    margin: 8px 0 0;
    color: #b8c9bd;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-all;
}

.list button.invite .badge {
    color: #c8d6cc;
    border-color: #3a4840;
    background: #0c100e;
}

.invite {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}
.invite strong { display: block; }
.invite small { color: var(--muted); }
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    margin-right: 4px;
}
.badge.live { color: #7dffb0; border-color: #2a6a44; }
.badge.revoked { color: var(--danger); }

.split-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.map-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    min-height: 420px;
}

.map {
    height: 420px;
    border-radius: 14px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.mini-map { height: 220px; margin: 12px 0; }

.people {
    overflow: auto;
    max-height: 420px;
    display: grid;
    align-content: start;
    gap: 8px;
}

.person {
    text-align: left;
    width: 100%;
    background: #101613;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
}
.person.active { border-color: var(--accent); }
.person b { display: block; }
.person span { color: var(--muted); font-size: 12px; font-weight: 400; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th { color: var(--muted); font-weight: 600; }

.map-link { color: var(--accent); }

.from { margin-top: 0; }
blockquote {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    background: #122018;
    border-radius: 0 10px 10px 0;
}

.notice {
    background: #122018;
    border: 1px solid #2a4a38;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.notice ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.notice li { margin: 4px 0; }

.dest-flag { color: var(--warn); }
.dest-results { margin-top: 8px; display: grid; gap: 6px; }
.dest-results button {
    background: #101613;
    color: var(--ink);
    border: 1px solid var(--line);
    justify-content: flex-start;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
}

.success h2 { color: var(--accent); }
.empty-box { color: var(--muted); }

.live-dot {
    margin: 0 0 6px;
    color: #7dffb0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.live-dot::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #3dba7a;
    box-shadow: 0 0 0 0 rgba(61, 186, 122, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 8px rgba(61, 186, 122, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 186, 122, 0); }
}

.leaflet-container { background: #101613; font: inherit; }
.pin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(61, 186, 122, 0.25);
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.tab.active {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: transparent;
}

.notice-card {
    background: #122018;
    border-color: #2a4a38;
}

.progress-bar {
    height: 6px;
    border-radius: 999px;
    background: #101613;
    border: 1px solid var(--line);
    overflow: hidden;
    margin: 14px 0 4px;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
}

.invite.selected { border-color: var(--accent); }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.mini-stats {
    grid-template-columns: repeat(2, 1fr);
    margin: 12px 0 16px;
}

.mini-stats.five { grid-template-columns: repeat(5, 1fr); }

.stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.grow { flex: 1; min-width: 140px; }
.pair .grow label { margin-top: 14px; }

.advanced {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}
.advanced summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
}
.filters { align-items: center; margin: 8px 0 16px; }
.filters input[type="search"] { flex: 1; min-width: 160px; }

.charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.charts h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.bar-chart { display: grid; gap: 6px; }
.bar-row {
    display: grid;
    grid-template-columns: 90px 1fr 36px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}
.bar-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
    height: 8px;
    background: #101613;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2f8f5b, #3dba7a);
}
.bar-row b { text-align: right; font-size: 12px; }

.feed-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    width: 100%;
    text-align: left;
    background: #101613;
    color: var(--ink);
    font: inherit;
    font-weight: 400;
    cursor: pointer;
}
.feed-item:hover { border-color: var(--accent); }
.feed-item strong { font-size: 14px; color: var(--ink); }
.feed-item small { color: var(--muted); font-weight: 400; }
.feed-item.suspect { border-color: var(--warn); }
.badge.risk { color: var(--warn); border-color: #6a5230; }

code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 12px;
}

@media (max-width: 900px) {
    .grid, .map-layout, .stats, .charts, .mini-stats.five { grid-template-columns: 1fr; }
    .map, .people { height: auto; }
    .map { height: 320px; }
    .people { max-height: 220px; }
    h1 { font-size: 26px; }
}
