:root {
    --bg: #0b1c2c;
    --header: #0e6377;
    --card-ok: #4caf6d;
    --card-ok-dark: #3f9459;
    --card-fail: #c0392b;
    --card-fail-dark: #a5301f;
    --card-idle: #35495e;
    --text: #eef3f7;
    --muted: #9fb3c4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

header.topbar {
    background: linear-gradient(135deg, var(--header), #114a63);
    padding: 18px 28px;
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
    position: sticky;
    top: 0;
    z-index: 10;
}

header.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

header.topbar .baseurl {
    font-size: .8rem;
    color: #cfe8ef;
    opacity: .85;
    margin-top: 2px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px 28px 0;
}

.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: #16324a;
    border: 1px solid #234a63;
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s ease;
}

.tab-btn.active {
    background: var(--header);
    color: #fff;
    border-color: var(--header);
}

.spacer { flex: 1; }

.control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--muted);
}

.control input[type=number] {
    width: 60px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #234a63;
    background: #0f2438;
    color: #fff;
}

button.action {
    background: #178a9c;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s ease;
}
button.action.stop { background: #c0392b; }
button.action:hover { filter: brightness(1.1); }
button.action.ghost { background: #16324a; border: 1px solid #234a63; }

.summary {
    display: flex;
    gap: 14px;
    padding: 16px 28px 0;
    flex-wrap: wrap;
}
.summary .pill {
    background: #10263b;
    border: 1px solid #1e3a53;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: .82rem;
    color: var(--muted);
    min-width: 130px;
}
.summary .pill b { display: block; font-size: 1.3rem; color: #fff; margin-top: 2px; }
.summary .pill.up b { color: #6fe39a; }
.summary .pill.down b { color: #ff8f80; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 18px 28px 40px;
}

.card {
    background: var(--card-idle);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: background .3s ease, transform .15s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.card:hover { transform: translateY(-2px); }
.card.ok { background: linear-gradient(160deg, var(--card-ok), var(--card-ok-dark)); }
.card.fail { background: linear-gradient(160deg, var(--card-fail), var(--card-fail-dark)); }
.card.checking { animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.6;} }

.card .row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.card .time { font-size: .78rem; opacity: .85; }
.card .name { font-size: 1.05rem; font-weight: 700; margin-top: 8px; line-height: 1.25; }
.card .path { font-size: .72rem; opacity: .75; margin-top: 3px; word-break: break-all; }
.card .icon {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.card .msg { font-size: .8rem; margin-top: 10px; opacity: .9; min-height: 1.2em; }
.card .updated { font-size: .7rem; opacity: .65; margin-top: 10px; }
.card .status-label {
    display: inline-block;
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: 2px;
}

/* modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: #0f2438; border: 1px solid #1e3a53;
    border-radius: 14px; padding: 20px; width: min(520px, 92vw);
    max-height: 80vh; overflow: auto;
}
.modal h3 { margin: 0 0 4px; }
.modal .uptime { color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.modal table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.modal th, .modal td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #1e3a53; }
.modal .close { float: right; cursor: pointer; color: var(--muted); font-size: 1.1rem; }

footer.foot {
    text-align: center; color: var(--muted); font-size: .75rem; padding: 10px 0 28px;
}
