:root {
    color-scheme: light;
    --page: #f6f8f5;
    --surface: #ffffff;
    --surface-soft: #f0f5f0;
    --line: #cfd9d2;
    --line-soft: #e4ebe5;
    --text: #1d2522;
    --muted: #65736d;
    --muted-strong: #3f4f49;
    --accent: #139a7e;
    --accent-soft: #d8f3ec;
    --accent-line: #9fd9cb;
    --online: #12986f;
    --offline: #d65d5d;
    --unknown: #d99322;
    --shadow: 0 18px 45px rgb(47 67 58 / 0.10);
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgb(19 154 126 / 0.12), transparent 34rem),
        linear-gradient(180deg, #fbfcfa, var(--page));
    color: var(--text);
    font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    gap: 28px;
    border-right: 1px solid var(--line-soft);
    padding: 30px 22px;
    background: rgb(255 255 255 / 0.74);
    backdrop-filter: blur(20px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    background: #19231f;
    color: #ffffff;
    font-size: 1.2rem;
    box-shadow: 0 10px 25px rgb(25 35 31 / 0.18);
}

.brand-title,
.brand-subtitle {
    display: block;
}

.brand-title {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.84rem;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    border-radius: 999px;
    padding: 8px 13px;
    color: var(--muted-strong);
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.side-link:hover {
    background: var(--accent-soft);
    color: var(--text);
    transform: translateX(2px);
}

.side-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted-strong);
}

.sidebar-footer {
    margin-top: auto;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    padding: 12px;
    background: var(--surface);
}

.topology {
    display: block;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
}

.workspace {
    min-width: 0;
    padding: 34px clamp(22px, 4vw, 48px) 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.eyebrow,
.hero-kicker {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

h2 {
    margin-bottom: 8px;
    font-size: clamp(1.35rem, 2.5vw, 2rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

h3 {
    margin-bottom: 6px;
    letter-spacing: -0.025em;
}

.header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.auth-chip,
.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 13px;
    background: var(--surface);
    color: var(--muted-strong);
    text-decoration: none;
}

.nav-link.active {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: #0c6d5a;
}

.button-link,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    padding: 9px 16px;
    background: var(--accent-soft);
    color: #0c6d5a;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button-link:hover,
button:hover {
    background: #c7eee4;
    box-shadow: 0 10px 20px rgb(19 154 126 / 0.14);
    transform: translateY(-1px);
}

button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--muted-strong);
    box-shadow: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    transform: none;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: clamp(22px, 4vw, 34px);
    background:
        radial-gradient(circle at top right, rgb(19 154 126 / 0.16), transparent 18rem),
        var(--surface);
    box-shadow: var(--shadow);
}

.hero-panel p {
    max-width: 58rem;
    margin-bottom: 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    justify-content: flex-end;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgb(255 255 255 / 0.82);
    box-shadow: var(--shadow);
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--muted-strong);
}

.metric-icon.online {
    background: #d8f3ec;
    color: var(--online);
}

.metric-icon.offline {
    background: #ffe2e2;
    color: var(--offline);
}

.metric-icon.unknown {
    background: #fff0cf;
    color: var(--unknown);
}

.metric-label {
    color: var(--muted);
    font-size: 0.86rem;
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.05em;
}

.panel {
    padding: clamp(18px, 3vw, 28px);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.section-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-heading p,
.subtle,
.last-checked {
    color: var(--muted);
}

.host-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 14px;
}

.host-card {
    display: grid;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    background: var(--surface);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.host-card:hover {
    border-color: var(--accent-line);
    box-shadow: 0 16px 32px rgb(47 67 58 / 0.12);
    transform: translateY(-2px);
}

.host-card-main,
.host-title-row,
.host-card-foot {
    display: flex;
    align-items: center;
    gap: 14px;
}

.host-title-row,
.host-card-foot {
    justify-content: space-between;
}

.host-card-foot {
    align-items: end;
}

.host-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 15px;
    background: var(--surface-soft);
    color: var(--accent);
    font-size: 1.25rem;
}

.host-card h3 {
    margin: 0;
    font-size: 1.12rem;
}

.host-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.88rem;
}

.host-meta span,
.host-meta code {
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--surface-soft);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--surface-soft);
    color: var(--muted-strong);
    font-size: 0.82rem;
    font-weight: 800;
}

.status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: currentColor;
}

.status.online {
    background: #d8f3ec;
    color: var(--online);
}

.status.offline {
    background: #ffe2e2;
    color: var(--offline);
}

.status.unknown {
    background: #fff0cf;
    color: var(--unknown);
}

.status-error {
    color: var(--unknown);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 14px 13px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td .subtle {
    display: block;
    margin-top: 3px;
    font-size: 0.84rem;
}

.notice {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--surface);
}

.notice.success {
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.notice.error {
    border-color: #f0b0b0;
    background: #fff0f0;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 34px 16px;
    color: var(--muted);
    text-align: center;
}

code {
    color: var(--muted-strong);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.token-notice {
    display: grid;
    gap: 8px;
}

.token-value {
    display: block;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface-soft);
}

.last-checked {
    margin: 16px 0 0;
    font-size: 0.88rem;
    text-align: right;
}

.narrow-panel {
    max-width: 540px;
}

.stacked-form,
.config-grid {
    display: grid;
    gap: 15px;
}

.config-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    align-items: end;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted-strong);
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    background: var(--surface);
    color: var(--text);
    outline: 0;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(19 154 126 / 0.12);
}

textarea {
    min-height: 78px;
    resize: vertical;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.checkbox-label input {
    width: auto;
}

.wide-field {
    grid-column: 1 / -1;
}

.config-section,
.history-section {
    margin-top: 34px;
}

.config-card {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 15px;
    background: var(--surface);
}

.config-card summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    cursor: pointer;
    font-weight: 850;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    background: var(--surface-soft);
    color: var(--muted-strong);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: lowercase;
}

.badge.enabled,
.badge.accepted,
.badge.success,
.badge.requested {
    background: #d8f3ec;
    color: var(--online);
}

.badge.disabled,
.badge.failed {
    background: #ffe2e2;
    color: var(--offline);
}

.inline-action {
    display: inline-flex;
    margin-top: 12px;
    margin-right: 8px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .side-nav {
        display: flex;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar,
    .hero-panel {
        grid-template-columns: 1fr;
        display: grid;
    }

    .header-meta,
    .hero-actions {
        justify-content: start;
    }

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

@media (max-width: 560px) {
    .workspace {
        padding: 22px 16px 34px;
    }

    .summary-grid,
    .host-grid {
        grid-template-columns: 1fr;
    }

    .host-card-main,
    .host-card-foot,
    .host-title-row {
        align-items: start;
        flex-direction: column;
    }
}
