:root {
    --bg-top: #08141e;
    --bg-bottom: #143247;
    --panel: rgba(8, 18, 28, 0.72);
    --panel-strong: rgba(8, 18, 28, 0.86);
    --panel-soft: rgba(255, 255, 255, 0.08);
    --border: rgba(173, 216, 255, 0.18);
    --border-strong: rgba(126, 240, 202, 0.32);
    --text: #eff8ff;
    --muted: #b8d6ea;
    --accent: #7ef0ca;
    --accent-strong: #49c5a0;
    --accent-soft: rgba(126, 240, 202, 0.14);
    --blue: #8fc8ff;
    --blue-soft: rgba(143, 200, 255, 0.16);
    --danger: #ff9a9a;
    --danger-soft: rgba(255, 122, 122, 0.16);
    --warning: #ffd487;
    --warning-soft: rgba(255, 212, 135, 0.16);
    --success: #aaf5c8;
    --info-text: #f5fbff;
    --info-border: rgba(143, 200, 255, 0.28);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.22);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html[data-theme="light"] {
    --bg-top: #f8f3eb;
    --bg-bottom: #ede4d7;
    --panel: rgba(255, 251, 246, 0.82);
    --panel-strong: rgba(255, 251, 246, 0.94);
    --panel-soft: rgba(116, 92, 62, 0.05);
    --border: rgba(121, 98, 72, 0.12);
    --border-strong: rgba(45, 138, 105, 0.24);
    --text: #2d251d;
    --muted: #756758;
    --accent: #2d8a69;
    --accent-strong: #216b52;
    --accent-soft: rgba(45, 138, 105, 0.12);
    --blue: #8c6b43;
    --blue-soft: rgba(140, 107, 67, 0.12);
    --danger: #b85159;
    --danger-soft: rgba(184, 81, 89, 0.12);
    --warning: #ab7a24;
    --warning-soft: rgba(171, 122, 36, 0.12);
    --success: #216b52;
    --info-text: #6f5738;
    --info-border: rgba(140, 107, 67, 0.2);
    --shadow-lg: 0 22px 48px rgba(67, 54, 39, 0.12);
    --shadow-md: 0 14px 28px rgba(67, 54, 39, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(126, 240, 202, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(143, 200, 255, 0.18), transparent 28%),
        linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

html[data-theme="light"] {
    background: #f6f1e8;
}

body.app-shell {
    margin: 0;
    min-height: 100dvh;
    color: var(--text);
    font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at 15% 15%, rgba(126, 240, 202, 0.12), transparent 26%),
        radial-gradient(circle at 82% 10%, rgba(143, 200, 255, 0.12), transparent 30%),
        linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
    position: relative;
    overflow-x: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

html[data-theme="light"] body.app-shell {
    background: #f6f1e8;
}

body.app-shell::before,
body.app-shell::after {
    content: "";
    position: fixed;
    inset: auto;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(70px);
    z-index: 0;
    pointer-events: none;
}

body.app-shell::before {
    top: -100px;
    left: -120px;
    background: rgba(126, 240, 202, 0.12);
}

html[data-theme="light"] body.app-shell::before {
    opacity: 0;
}

body.app-shell::after {
    right: -120px;
    bottom: -140px;
    background: rgba(143, 200, 255, 0.14);
}

html[data-theme="light"] body.app-shell::after {
    opacity: 0;
}

.app-page {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px 40px;
}

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

.app-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.app-brand img {
    height: 54px;
    width: auto;
    display: block;
    filter: contrast(1.1) brightness(1.04) drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.app-brand-copy {
    display: grid;
    gap: 4px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-brand-copy h1,
.page-hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.app-brand-copy p,
.page-hero p,
.section-lead,
.help-text {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.app-userbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.site-pref-controls {
    position: fixed;
    top: 16px;
    right: clamp(12px, 2.6vw, 24px);
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.site-pref-controls .site-pref-link {
    display: inline;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    color: rgba(237, 230, 220, 0.74) !important;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    opacity: 0.72;
    cursor: pointer;
}

.site-pref-controls .site-pref-link:hover,
.site-pref-controls .site-pref-link:focus-visible {
    outline: none;
    opacity: 1;
    color: #f6efe6 !important;
}

.site-pref-controls .site-pref-link.is-active {
    color: #f6efe6 !important;
    opacity: 1;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.22em;
}

html[data-theme="light"] .site-pref-controls .site-pref-link {
    color: #756758;
}

html[data-theme="light"] .site-pref-controls .site-pref-link:hover,
html[data-theme="light"] .site-pref-controls .site-pref-link:focus-visible,
html[data-theme="light"] .site-pref-controls .site-pref-link.is-active {
    color: #2d251d;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.pill.is-accent {
    background: var(--accent-soft);
    border-color: rgba(126, 240, 202, 0.3);
}

.pill.is-warning {
    background: var(--warning-soft);
    border-color: rgba(255, 212, 135, 0.28);
}

.pill.is-danger {
    background: var(--danger-soft);
    border-color: rgba(255, 154, 154, 0.28);
}

.page-hero,
.surface-card,
.glass-card {
    background: linear-gradient(180deg, rgba(10, 22, 33, 0.88), rgba(8, 18, 28, 0.72));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

html[data-theme="light"] .page-hero,
html[data-theme="light"] .surface-card,
html[data-theme="light"] .glass-card {
    background: linear-gradient(180deg, rgba(255, 251, 246, 0.96), rgba(249, 243, 236, 0.94));
}

.page-hero {
    padding: 28px;
    display: grid;
    gap: 16px;
    margin-bottom: 22px;
}

.hero-row,
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

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

.summary-card {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    display: grid;
    gap: 8px;
}

html[data-theme="light"] .summary-card,
html[data-theme="light"] .monitor-card,
html[data-theme="light"] .pill,
html[data-theme="light"] .btn-secondary,
html[data-theme="light"] .btn-soft,
html[data-theme="light"] .table-shell,
html[data-theme="light"] .empty-state {
    background: rgba(255, 251, 246, 0.88);
    border-color: rgba(121, 98, 72, 0.12);
}

.summary-card .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.summary-card .value {
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.summary-card .meta {
    color: var(--muted);
    font-size: 13px;
}

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

.field,
.search-input,
.filter-input,
input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html[data-theme="light"] .field,
html[data-theme="light"] .search-input,
html[data-theme="light"] .filter-input,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    background: rgba(255, 255, 255, 0.84);
    border-color: rgba(121, 98, 72, 0.16);
}

input::placeholder,
textarea::placeholder {
    color: rgba(232, 244, 255, 0.66);
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: rgba(93, 119, 134, 0.82);
}

input:focus,
select:focus,
textarea:focus,
.search-input:focus,
.filter-input:focus {
    outline: none;
    border-color: rgba(126, 240, 202, 0.45);
    box-shadow: 0 0 0 4px rgba(126, 240, 202, 0.12);
    background: rgba(255, 255, 255, 0.12);
}

.btn,
button,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #09202a;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 10px 22px rgba(73, 197, 160, 0.22);
}

.btn:hover,
button:hover,
a.btn:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.btn-secondary,
.btn-soft {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.btn-danger {
    background: rgba(255, 122, 122, 0.18);
    border-color: rgba(255, 154, 154, 0.34);
    color: #ffd3d3;
    box-shadow: none;
}

.btn-link {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--blue);
    box-shadow: none;
}

.link-inline,
a {
    color: var(--blue);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.monitor-card {
    display: grid;
    gap: 12px;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.monitor-card:hover {
    transform: translateY(-4px);
    border-color: rgba(126, 240, 202, 0.34);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] .monitor-card:hover {
    border-color: rgba(14, 165, 129, 0.3);
    box-shadow: 0 20px 36px rgba(33, 72, 91, 0.16);
}

.monitor-card.is-disabled {
    opacity: 0.72;
    cursor: default;
}

.monitor-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.monitor-card h3,
.monitor-card strong {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.monitor-card p,
.monitor-card small,
.card-meta {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.is-active {
    background: var(--accent);
    box-shadow: 0 0 0 6px rgba(126, 240, 202, 0.12);
}

.status-dot.is-inactive {
    background: #ff8a8a;
    box-shadow: 0 0 0 6px rgba(255, 138, 138, 0.12);
}

.status-dot.is-neutral {
    background: #d5e6f2;
}

.message,
.msg {
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.message.error,
.msg.error {
    background: var(--danger-soft);
    border-color: rgba(255, 154, 154, 0.26);
    color: #ffd0d0;
}

.message.success,
.msg.success {
    background: rgba(170, 245, 200, 0.12);
    border-color: rgba(170, 245, 200, 0.24);
    color: var(--success);
}

.message.info,
.msg.info {
    background: var(--blue-soft);
    border-color: var(--info-border);
    color: var(--info-text);
    font-weight: 600;
}

.empty-state {
    padding: 28px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    color: var(--muted);
    text-align: center;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 18px;
}

.section-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
}

.table-shell {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.table-shell table {
    width: 100%;
    border-collapse: collapse;
}

.table-shell th,
.table-shell td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-shell th {
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.04);
}

.table-shell tr:last-child td {
    border-bottom: none;
}

.stack {
    display: grid;
    gap: 16px;
}

.muted {
    color: var(--muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .app-page {
        padding: 22px 14px 28px;
    }

    .split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-topbar {
        align-items: flex-start;
    }

    .app-brand {
        align-items: flex-start;
    }

    .app-brand img {
        height: 44px;
    }

    .page-hero,
    .surface-card,
    .glass-card {
        border-radius: 22px;
    }

    .page-hero {
        padding: 22px 18px;
    }

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

    .toolbar {
        width: 100%;
    }

    .toolbar > * {
        width: 100%;
    }

    .btn,
    button,
    a.btn {
        width: 100%;
    }

    .site-pref-controls {
        top: 12px;
        right: 14px;
        gap: 8px;
    }
}
