:root {
    color-scheme: dark;
    --bg: #091015;
    --surface: #111b22;
    --surface-raised: #16242d;
    --line: #263843;
    --text: #ecf4f7;
    --muted: #92a4ad;
    --accent: #52d7ba;
    --accent-dark: #123c36;
    --warn: #f5bd52;
    --warn-dark: #44351a;
    --error: #ff7a7a;
    --error-dark: #421f25;
    --shadow: 0 18px 44px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgb(44 111 104 / 20%), transparent 32rem),
        var(--bg);
    color: var(--text);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(1.85rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: .25rem; font-size: 1.12rem; }
code { color: #c6f4e9; font-size: .85rem; }

.topbar { border-bottom: 1px solid var(--line); background: rgb(9 16 21 / 86%); backdrop-filter: blur(16px); }
.topbar-inner { width: min(1180px, calc(100% - 32px)); min-height: 68px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #08251f; font-size: .78rem; letter-spacing: .04em; }
.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .86rem; }
.account form { margin: 0; }
.topbar-link { color: var(--accent); font-weight: 700; text-decoration: none; }

.page { width: min(1180px, calc(100% - 32px)); margin: 38px auto 60px; }
.footer { padding: 0 16px 32px; color: #667983; text-align: center; font-size: .8rem; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted, .card-heading p, .subline { color: var(--muted); }
.subline { display: block; margin-top: 2px; font-size: .82rem; }
.strong-link { color: var(--text); font-weight: 750; text-decoration: none; }
.strong-link:hover { color: var(--accent); }
.back-link { color: var(--muted); text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { min-height: 108px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, var(--surface-raised), var(--surface)); box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 2rem; line-height: 1; }
.stat span { display: block; margin-top: 10px; color: var(--muted); }
.stat-warn strong { color: var(--warn); }
.stat-error strong { color: var(--error); }

.card, .hero-card, .auth-card {
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(150deg, rgb(22 36 45 / 96%), rgb(15 26 33 / 96%));
    box-shadow: var(--shadow);
}
.card { padding: 22px; }
.narrow-card { max-width: 760px; }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-heading p { margin-bottom: 0; font-size: .9rem; }
.card-note { margin: 18px 0 0; color: var(--muted); font-size: .86rem; }
.hero-card { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; padding: 28px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.facts div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: rgb(7 14 18 / 25%); }
.facts dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.facts dd { margin: 3px 0 0; font-weight: 700; }
.pairing-card { text-align: center; }
.pairing-code { display: inline-block; margin: 8px 0 10px; padding: 12px 18px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-dark); color: #baf5e8; font: 800 1.2rem/1.2 ui-monospace, monospace; letter-spacing: .09em; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.action-row form { margin: 0; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .74rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgb(255 255 255 / 1.5%); }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.breakable { max-width: 350px; overflow-wrap: anywhere; color: var(--muted); font-size: .86rem; }

.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #53656f; box-shadow: 0 0 0 4px rgb(83 101 111 / 12%); }
.status-dot.is-online { background: var(--accent); box-shadow: 0 0 0 4px rgb(82 215 186 / 12%); }
.status-dot.is-error { background: var(--error); box-shadow: 0 0 0 4px rgb(255 122 122 / 12%); }
.badge { display: inline-block; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.badge-ok { border-color: #2e7568; background: var(--accent-dark); color: #98ead8; }
.badge-warn { border-color: #80642e; background: var(--warn-dark); color: #f8d68f; }
.badge-error { border-color: #83414a; background: var(--error-dark); color: #ffaaaa; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent); color: #08251f; font: inherit; font-weight: 760; text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(1.07); }
.button-secondary { background: var(--accent-dark); color: #baf5e8; }
.button-quiet { min-height: 31px; padding: 5px 10px; border-color: var(--line); background: transparent; color: var(--muted); font-size: .82rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.form-grid > div { grid-column: 1 / -1; }
.stacked-form { display: grid; gap: 15px; margin-top: 24px; }
label { display: grid; gap: 6px; color: #c9d6dc; font-size: .86rem; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="search"], input[type="url"], input[type="email"], input[type="password"], select {
    width: 100%;
    min-height: 43px;
    padding: 9px 11px;
    border: 1px solid #344a56;
    border-radius: 9px;
    outline: none;
    background: #0b151b;
    color: var(--text);
    font: inherit;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(82 215 186 / 12%); }
.check-label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 500; }
.auth-card { width: min(470px, 100%); margin: 62px auto; padding: 30px; }

.inventory-filters { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.inventory-filter-actions { display: flex; gap: 8px; }
.inventory-result { margin: 0 0 8px; color: var(--muted); font-size: .86rem; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: var(--muted); font-size: .86rem; }
.pagination > div { display: flex; gap: 8px; }
.button-disabled { cursor: default; opacity: .45; pointer-events: none; }

.notice { margin: 0 0 18px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; }
.notice ul { margin: 7px 0 0; padding-left: 20px; }
.notice-success { border-color: #2e7568; background: var(--accent-dark); color: #baf5e8; }
.notice-warning { border-color: #80642e; background: var(--warn-dark); color: #f8d68f; }
.notice-error { border-color: #83414a; background: var(--error-dark); color: #ffc0c0; }
.pairing-guidance { text-align: left; overflow-wrap: anywhere; }
.readiness-summary { display: grid; grid-template-columns: auto 1fr; align-content: center; gap: 4px 8px; min-height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgb(7 14 18 / 25%); }
.readiness-summary .status-dot { align-self: center; margin: 0; }
.readiness-summary span:last-child { grid-column: 2; color: var(--muted); overflow-wrap: anywhere; }
.requirement-grid, .check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.requirement-grid > div, .check-grid > div { display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: rgb(7 14 18 / 25%); }
.requirement-grid span, .check-grid span:not(.badge) { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.check-grid .badge { justify-self: start; }
.code-block { margin: 12px 0 18px; padding: 15px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #071015; color: #c6f4e9; font: .86rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 820px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .hero-card { grid-template-columns: 1fr; }
    .inventory-filters { grid-template-columns: 1fr 1fr; }
    .inventory-filter-actions { align-self: end; }
    .account > span, .brand small { display: none; }
}

@media (max-width: 560px) {
    .page { width: min(100% - 20px, 1180px); margin-top: 22px; }
    .topbar-inner { width: min(100% - 20px, 1180px); }
    .stats, .form-grid { grid-template-columns: 1fr; }
    .stat { min-height: 92px; }
    .card, .hero-card, .auth-card { padding: 18px; border-radius: 13px; }
    .facts { grid-template-columns: 1fr; }
    .requirement-grid, .check-grid { grid-template-columns: 1fr; }
    .inventory-filters { grid-template-columns: 1fr; }
    .inventory-filter-actions, .pagination { align-items: stretch; flex-direction: column; }
    .inventory-filter-actions .button, .pagination .button { flex: 1; }
}
