:root {
    color-scheme: dark;

    --bg: #10151b;
    --panel: #18212a;
    --line: #2c3945;
    --muted: #a7b7c4;
    --gold: #ffd160;
    --green: #8ae0ac;
    --amber: #ffcc70;

    font-family: Segoe UI, system-ui, sans-serif;
    color: #edf3f8;
    background: var(--bg);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

button,
input,
select {
    font: inherit;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

header,
main {
    max-width: 1580px;
    margin: auto;
    padding-left: 24px;
    padding-right: 24px;
}

header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand img {
    object-fit: contain;
}

h1 {
    font-size: 23px;
    letter-spacing: -.5px;
    margin: 0;
    font-weight: 650;
}

h1 span {
    color: var(--gold);
}

button {
    background: #202b35;
    color: #dbe6ed;
    border: 1px solid #3a4b59;
    border-radius: 8px;
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
}

button:disabled {
    opacity: .5;
}

.summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    color: var(--muted);
    font-size: 13px;
}

.summary strong {
    font-weight: 650;
    color: var(--green);
}

.summary .warn {
    color: var(--amber);
}

#updated {
    font-size: 12px;
    white-space: nowrap;
}

.controls {
    display: flex;
    gap: 12px;
    margin: 0 0 22px;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #151d25;
}

.controls label > span {
    font-size: 22px;
    color: var(--muted);
}

input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    background: none;
    border: 0;
    color: inherit;
    font-size: 14px;
}

input:focus {
    outline: none;
}

.controls label:focus-within {
    outline: 2px solid var(--gold);
}

select {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #151d25;
    color: #d9e3eb;
    padding: 0 12px;
    font-size: 13px;
    max-width: 175px;
}


/* =========================================================
   GROUP LAYOUT
   ========================================================= */

#groups {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    padding-bottom: 28px;
}

.group {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    min-width: 0;
}

.group-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 17px;
    background: #202c37;
    border-bottom: 1px solid var(--line);
}

h2 {
    font-size: 16px;
    font-weight: 650;
    margin: 0;
}

.count {
    font-size: 12px;
    color: var(--muted);
}

.entry-block + .entry-block {
    border-top: 1px solid #293541;
}


/* =========================================================
   NORMAL ENDPOINT CARDS
   ========================================================= */

.card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 68px;
}

.icon {
    width: 42px;
    height: 48px;
    object-fit: contain;
    flex: none;
}

.monogram {
    border-radius: 8px;
    background: #3a3425;
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}

.icon.monogram {
    height: 40px;
}

.name {
    font-size: 15px;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
    line-height: 1.35;
    flex: 1;
}

.name a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}


/* =========================================================
   STATUS BADGES
   ========================================================= */

.status {
    font-size: 11px;
    border-radius: 20px;
    padding: 5px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-weight: 600;
}

.status:before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.reachable {
    background: #203c31;
    color: var(--green);
}

.attention,
.unknown,
.stale {
    background: #403727;
    color: var(--amber);
}

.unmonitored {
    background: #2b3741;
    color: #b6c4cf;
}


/* =========================================================
   TRANSFORMER HOST ROW
   ========================================================= */

.host-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    min-height: 68px;
}

.host-toggle {
    width: 100%;
    min-width: 0;
    min-height: 68px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 4px 10px 13px;

    background: transparent;
    border: 0;
    border-radius: 0;

    color: inherit;
    text-align: left;
}

.host-toggle:hover {
    background: #1c2731;
}

.host-toggle:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -3px;
}

.host-toggle .icon {
    width: 39px;
    height: 44px;
}

.chevron {
    width: 12px;
    flex: none;
    color: var(--muted);
    font-size: 15px;
    text-align: center;
}

.host-copy {
    min-width: 0;
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: 3px;
}

.host-copy .name {
    font-size: 15px;
}

.host-meta {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.25;
}

.host-status {
    margin-right: 12px;
}

.host-open {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 7px;

    color: var(--muted);
    font-size: 15px;
}

.host-open:hover {
    background: #24313c;
    color: #edf3f8;
}

.aggregate-all-alive {
    background: #203c31;
    color: var(--green);
}

.aggregate-attention {
    background: #403727;
    color: var(--amber);
}

.aggregate-missing {
    background: #403727;
    color: var(--amber);
}


/* =========================================================
   CHILD SERVICES
   ========================================================= */

.children {
    background: #131a21;
    border-top: 1px solid #293541;
}

.child-card {
    display: flex;
    align-items: center;
    gap: 9px;

    min-height: 52px;

    padding:
        7px
        12px
        7px
        39px;
}

.child-card + .child-card {
    border-top: 1px solid #25313b;
}

.child-icon {
    width: 28px;
    height: 32px;
    object-fit: contain;
    flex: none;
}

.child-icon.monogram {
    height: 28px;
    font-size: 10px;
    border-radius: 6px;
}

.child-name {
    font-size: 13px;
    font-weight: 550;
}

.child-card .status {
    font-size: 9px;
    padding: 4px 6px;
}

.status.derived {
    box-shadow:
        inset 0 0 0 1px
        rgba(255, 255, 255, .07);
}


/* =========================================================
   EMPTY MESSAGE
   ========================================================= */

#empty {
    color: var(--muted);
    text-align: center;
    padding: 32px;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 1600px) {

    .card,
    .host-card,
    .host-toggle {
        min-height: 78px;
    }

    .group-heading {
        padding: 16px 18px;
    }
}

@media (max-width: 1300px) {

    #groups {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {

    header,
    main {
        padding-left: 12px;
        padding-right: 12px;
    }

    header {
        height: 62px;
    }

    .brand {
        gap: 8px;
    }

    .brand img {
        width: 26px;
        height: 26px;
    }

    h1 {
        font-size: 20px;
    }

    #refresh {
        padding: 0 12px;
    }

    #refresh span {
        display: none;
    }

    .summary {
        display: block;
        padding: 13px 0 11px;
        min-height: 0;
        font-size: 12px;
        line-height: 1.6;
    }

    #updated {
        display: block;
        font-size: 11px;
        margin-top: 3px;
    }

    .controls {
        gap: 8px;
        margin-bottom: 16px;
    }

    .controls label {
        padding: 0 9px;
    }

    .controls select {
        font-size: 12px;
        padding: 0 8px;
        width: 134px;
    }

    .controls input {
        font-size: 14px;
    }

    #groups {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .group-heading {
        padding: 13px 14px;
    }

    h2 {
        font-size: 15px;
    }

    .card {
        padding: 10px 13px;
        gap: 11px;
        min-height: 68px;
    }

    .icon {
        width: 38px;
        height: 44px;
    }

    .name {
        font-size: 15px;
    }

    .status {
        font-size: 10px;
        padding: 5px 7px;
    }

    .host-card,
    .host-toggle {
        min-height: 68px;
    }

    .host-toggle {
        padding: 9px 3px 9px 9px;
        gap: 8px;
    }

    .host-toggle .icon {
        width: 36px;
        height: 42px;
    }

    .host-status {
        margin-right: 9px;
    }



    .host-meta {
        font-size: 10px;
    }

    .child-card {
        min-height: 49px;
        padding:
            6px
            9px
            6px
            36px;
    }

    .child-icon {
        width: 25px;
        height: 29px;
    }

    .child-name {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: no-preference) {

    a,
    button {
        transition:
            color .15s,
            background .15s;
    }
}

/* Compact toolbar and shared link/status columns across endpoint rows. */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
}
.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
}
.summary { min-height: 44px; }
.controls { margin: 0; flex: 0 1 560px; }
.card, .child-card, .host-card {
    display: grid;
    align-items: center;
    column-gap: 8px;
    padding-right: 12px;
}
.card { grid-template-columns: 42px minmax(0, 1fr) 44px 88px; }
.child-card { grid-template-columns: 28px minmax(0, 1fr) 44px 88px; }
.host-card { grid-template-columns: minmax(0, 1fr) 44px 88px; }
.status { justify-self: end; }
.host-status { margin-right: 0; }
.endpoint-open, .link-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
}
.endpoint-open { color: var(--muted); }
.endpoint-open:hover { background: #24313c; color: #edf3f8; }
@media (max-width: 900px) {
    .dashboard-toolbar { flex-wrap: wrap; gap: 4px; }
    .controls { flex: 1 1 100%; }
    .controls label { max-width: none; }
}
@media (max-width: 650px) {
    .header-actions { gap: 8px; }
    .header-actions #updated { margin: 0; font-size: 10px; }
    .dashboard-toolbar { padding: 8px 0 12px; }
    .summary { padding: 0; min-height: 28px; }
    .card { grid-template-columns: 38px minmax(0, 1fr) 44px 78px; }
    .child-card { grid-template-columns: 25px minmax(0, 1fr) 44px 78px; }
    .host-card { grid-template-columns: minmax(0, 1fr) 44px 78px; }
    .card, .child-card, .host-card { padding-right: 9px; column-gap: 6px; }
    .host-status { margin-right: 0; }
    .controls select { width: auto; }
}
