:root {
    --bg: #f5f7fa;
    --ink: #182a38;
    --muted: #71808e;
    --line: #e5eaf0;
    --accent: #13b99b;
    --nav: #102733;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font:
        14px/1.55 -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}
a {
    color: #087c72;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #d8e0e6;
    border-radius: 8px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    font-weight: 600;
    line-height: 1.4;
}
button:hover,
.button:hover {
    border-color: #8cafad;
    text-decoration: none;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #062b2a;
}
.danger {
    color: #a92c40;
    border-color: #f0c5cc;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    background: var(--nav);
    color: #c0d0d8;
    padding: 34px 22px;
    display: flex;
    flex-direction: column;
}
.brand {
    font-size: 25px;
    font-weight: 750;
    letter-spacing: -1px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand:hover {
    text-decoration: none;
}
.accent {
    color: var(--accent);
}
.workspace {
    font-size: 9px;
    letter-spacing: 1.8px;
    color: #76919f;
    margin: 18px 0 42px;
}
nav a {
    display: block;
    color: #b6c8d2;
    padding: 12px 14px;
    border-radius: 8px;
    margin: 5px 0;
}
nav a:hover,
nav a.selected {
    background: #203c47;
    color: #69dfc5;
    text-decoration: none;
}
.sidebar-bottom {
    margin-top: auto;
    font-size: 12px;
}
.sidebar-bottom strong,
.sidebar-bottom small {
    display: block;
}
.sidebar-bottom small {
    color: #809aa7;
}
.link {
    border: 0;
    background: none;
    color: #9cb4bf;
    padding: 15px 0;
    font-size: 12px;
}
main {
    margin-left: 232px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: 72px;
    padding: 0 42px;
    border-bottom: 1px solid var(--line);
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.content {
    padding: 40px 42px;
    max-width: 1600px;
    width: 100%;
    margin: auto;
    flex: 1;
}
h1 {
    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -1px;
    margin: 10px 0 12px;
    font-weight: 700;
}
h2 {
    font-size: 17px;
    margin: 0 0 14px;
}
.muted,
.hint {
    color: var(--muted);
}
.hint {
    font-size: 12px;
}
.eyebrow {
    font-size: 10px;
    letter-spacing: 1.6px;
    font-weight: 700;
    color: #258b80;
}
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}
.page-heading p {
    margin: 0;
}
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    padding: 22px;
}
.stat > span {
    display: block;
    font-size: 12px;
    color: #5f707e;
}
.stat strong {
    display: block;
    font-size: 34px;
    line-height: 1.4;
    margin: 8px 0 10px;
    font-weight: 650;
}
.stat .version {
    font-size: 22px;
    margin: 16px 0;
}
.stat small {
    font-size: 11px;
    color: var(--muted);
}
em {
    font-size: 14px;
    font-style: normal;
    margin-left: 4px;
}
.green {
    color: #138c75;
}
.amber {
    color: #c48727;
}
.panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 26px;
    margin-bottom: 24px;
}
.no-pad {
    padding: 0;
    overflow: hidden;
}
.toolbar {
    display: flex;
    gap: 12px;
    padding: 20px;
}
.toolbar input {
    max-width: 440px;
    margin: 0;
}
.toolbar select {
    width: auto;
    min-width: 170px;
    margin: 0;
}
.table-scroll {
    overflow-x: auto;
}
table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}
th {
    padding: 14px 20px;
    background: #fafbfd;
    border-block: 1px solid var(--line);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #72808c;
    font-weight: 600;
}
td {
    padding: 20px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}
td small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}
.device-name {
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
}
.mono,
code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}
.badge {
    display: inline-block;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 10px;
    white-space: nowrap;
}
.badge.online {
    background: #e4f7f0;
    color: #18785e;
}
.badge.attention {
    background: #fff4df;
    color: #936616;
}
.badge.paused {
    background: #edf1f5;
    color: #627080;
}
.pagination {
    padding: 12px 20px;
    color: var(--muted);
    font-size: 12px;
}
.pagination nav {
    display: flex;
    gap: 15px;
}
.pagination nav a {
    color: #087c72;
    margin: 0;
    padding: 0;
}
.empty {
    text-align: center;
    padding: 58px 20px 68px;
}
.empty-icon {
    font-size: 42px;
    color: #47b7a6;
    margin-bottom: 15px;
}
.empty p {
    margin-bottom: 24px;
}
.empty h2 {
    font-size: 20px;
}
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 24px;
    gap: 15px;
}
.panel-heading h2 {
    margin: 0;
}
.panel-heading span,
.panel-heading a {
    font-size: 11px;
}
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #465965;
    margin-bottom: 20px;
}
input,
select,
textarea {
    display: block;
    width: 100%;
    border: 1px solid #dce3e9;
    border-radius: 7px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    margin-top: 7px;
    outline: none;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #13b99b18;
}
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin: 0 8px 0 0;
    vertical-align: middle;
    accent-color: var(--accent);
}
.password-field {
    display: block;
    position: relative;
    margin-top: 7px;
}
.password-field input {
    margin-top: 0;
    padding-right: 52px;
}
.password-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 44px;
    padding: 0;
    border: 0;
    border-radius: 0 6px 6px 0;
    background: transparent;
    color: #465965;
}
.password-toggle:hover {
    background: #eef5f4;
    color: #126e61;
}
.password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}
.password-toggle svg {
    width: 20px;
    height: 20px;
}
.refresh-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 1px solid #dce3e9;
    border-radius: 10px;
    background: #fff;
}
.refresh-toolbar > .hint { margin: 0; }
.refresh-button { flex-shrink: 0; margin-left: auto; white-space: nowrap; }
.refresh-button svg { width: 18px; height: 18px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
}
.form-grid + h2 {
    margin-top: 20px;
}
.checks,
.actions {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.checks {
    margin: 16px 0;
}
.check {
    margin: 20px 0;
}
.auth-card {
    max-width: 470px;
    margin: 55px auto;
    background: white;
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.auth-card h1 {
    font-size: 28px;
}
.auth-card form {
    margin-top: 30px;
}
.auth-card .hint {
    margin-top: 24px;
}
.wide {
    width: 100%;
}
.notice {
    border: 1px solid #b8e9d9;
    background: #edf9f3;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 22px;
}
.notice.error {
    background: #fff2f0;
    border-color: #f6d2cc;
    color: #9b3f36;
}
.narrow {
    max-width: 700px;
}
.qr {
    padding: 20px;
    background: white;
    display: inline-block;
}
.code-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 24px 0;
}
.secret {
    display: block;
    padding: 20px;
    background: var(--bg);
    overflow-wrap: anywhere;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.detail-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 8px;
}
details summary {
    cursor: pointer;
    font-weight: 600;
    margin: 15px 0;
}
details form {
    margin-top: 20px;
}
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form select {
    margin: 0;
    padding: 8px;
}
.inline-form textarea {
    width: min(220px, 100%);
    min-height: 52px;
    margin: 0;
    padding: 6px 8px;
}
.inline-form button {
    padding: 8px 14px;
}
footer {
    display: flex;
    justify-content: space-between;
    padding: 18px 42px;
    color: #81909b;
    font-size: 10px;
    border-top: 1px solid var(--line);
}
.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 5px;
}
ul {
    padding-left: 20px;
}
:focus-visible {
    outline: 3px solid #13b99b80;
    outline-offset: 3px;
}
@media (max-width: 1100px) {
    .sidebar {
        width: 190px;
        padding: 28px 16px;
    }
    main {
        margin-left: 190px;
    }
    .content {
        padding: 28px;
    }
    .topbar {
        padding: 0 28px;
    }
    .stats {
        gap: 12px;
    }
    .stat {
        padding: 18px;
    }
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 18px 20px;
        display: block;
    }
    .workspace,
    .sidebar-bottom {
        display: none;
    }
    .sidebar nav {
        display: flex;
        overflow-x: auto;
        margin-top: 12px;
    }
    .sidebar nav a {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
    }
    .brand {
        font-size: 23px;
    }
    main {
        margin: 0;
    }
    .topbar {
        height: 50px;
        padding: 0 20px;
    }
    .content {
        padding: 25px 18px;
    }
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .stats {
        grid-template-columns: 1fr 1fr;
    }
    .stat strong {
        font-size: 28px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .toolbar {
        flex-wrap: wrap;
    }
    .toolbar input {
        max-width: none;
    }
    .toolbar select {
        flex: 1;
    }
    .auth-card {
        margin: 15px auto;
        padding: 26px;
    }
    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    footer {
        padding: 18px;
    }
    footer span {
        display: none;
    }
    .code-grid {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 27px;
    }
}

.topbar .logout { padding: 7px 10px; font-size: 11px; }
.page-heading .mono { overflow-wrap: anywhere; }
@media (max-width: 760px) { .topbar > .muted { display: none; } }

.overview-sites { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr)); gap:20px; }
.site-card .page-heading { gap:12px; flex-wrap:wrap; }
.site-metrics { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.site-metrics dt { color:var(--muted,#64748b); font-size:13px; }
.site-metrics dd { margin:4px 0 0; font-size:26px; font-weight:700; }
.overview-row { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; padding:14px 0; border-bottom:1px solid #e5e9ed; }
.overview-row small { display:block; }
.overview-row:last-child { border-bottom:0; }

.health-ok { --health-color: #187447; }
.health-warning { --health-color: #966200; }
.health-danger { --health-color: #bb3440; }
.health-unknown { --health-color: #64748b; }
.site-card { border-top: 4px solid var(--health-color); }
.health-label { color: var(--health-color); font-weight: 700; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); gap: 16px; }
.health-item { border-left: 3px solid var(--health-color); padding: 4px 12px; display: grid; gap: 8px; }
.health-item small { color: var(--muted,#64748b); }
.metric-zero { color: var(--muted,#64748b); }
.site-metrics .metric-zero dd { font-size: 18px; font-weight: 400; }
.site-metrics .metric-zero a { color: inherit; }
.site-card h2 { overflow-wrap: anywhere; }

.site-card .site-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px 12px; }
@media (max-width: 480px) { .site-card .site-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }
