:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #697586;
    --line: #d9e1e8;
    --panel: #ffffff;
    --page: #f4f7f8;
    --blue: #2457d6;
    --blue-ink: #15347f;
    --green: #167a55;
    --amber: #9b5b00;
    --red: #ba2d2d;
    --shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--blue);
    text-decoration: none;
}

code {
    background: #edf1f5;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #27313c;
    padding: 0.12rem 0.34rem;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 64px;
    padding: 0.7rem clamp(1rem, 3vw, 2rem);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    color: var(--ink);
    font-weight: 800;
    white-space: nowrap;
}

.navlinks {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.navlinks a {
    border-radius: 6px;
    color: #394756;
    font-size: 0.92rem;
    padding: 0.42rem 0.58rem;
}

.navlinks a:hover {
    background: #edf2f7;
}

.shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: clamp(1rem, 3vw, 2rem);
}

.auth-shell {
    align-items: center;
    display: grid;
    min-height: 100vh;
    max-width: 760px;
}

.auth-card,
.panel,
.hero-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card {
    padding: clamp(1.4rem, 4vw, 2.6rem);
}

.auth-card.installer {
    max-width: 860px;
    width: 100%;
}

.panel,
.hero-panel {
    margin-bottom: 1rem;
    padding: clamp(1rem, 2.4vw, 1.6rem);
}

.hero-panel {
    display: grid;
    min-height: 220px;
    place-items: center start;
}

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

h1 {
    font-size: clamp(2rem, 3vw, 3.2rem);
    line-height: 1.05;
    margin-bottom: 0.8rem;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 0.7rem;
}

.eyebrow {
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
}

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

.stack {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide,
.button.wide,
.wide {
    grid-column: 1 / -1;
}

label {
    color: #364454;
    display: grid;
    font-size: 0.88rem;
    font-weight: 700;
    gap: 0.4rem;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5df;
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 42px;
    padding: 0.62rem 0.72rem;
    width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.14);
    outline: none;
}

.check {
    align-items: center;
    display: flex;
    gap: 0.55rem;
}

.check input {
    min-height: auto;
    width: auto;
}

.button,
button {
    align-items: center;
    background: #fff;
    border: 1px solid #bdc8d3;
    border-radius: 6px;
    color: #213040;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 0.58rem 0.85rem;
}

.button:hover,
button:hover {
    background: #f0f4f7;
}

.button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.button.primary:hover {
    background: var(--blue-ink);
}

.button.danger,
button.danger {
    border-color: #e4a4a4;
    color: var(--red);
}

.button.mini {
    font-size: 0.8rem;
    min-height: 32px;
    padding: 0.3rem 0.5rem;
}

.icon-text {
    white-space: nowrap;
}

.auth-links,
.button-row,
.side-actions,
.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.side-actions {
    justify-content: flex-end;
}

.split {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.compact {
    max-width: 760px;
}

.metric-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: 0.85rem;
}

.metric strong {
    display: block;
    font-size: 2rem;
    margin-top: 0.35rem;
}

.section-head {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.search {
    display: flex;
    gap: 0.5rem;
    min-width: min(420px, 100%);
}

.create-box {
    background: #f8fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
}

.create-box summary {
    cursor: pointer;
    font-weight: 800;
}

.create-box form {
    margin-top: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 0.78rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: #526172;
    font-size: 0.78rem;
    text-transform: uppercase;
}

td span {
    color: var(--muted);
    display: block;
    font-size: 0.86rem;
}

.actions form {
    display: inline;
}

.badge {
    background: #edf1f5;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #384858;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.18rem 0.52rem;
}

.badge.strong {
    background: #e8f5ee;
    border-color: #b6dec9;
    color: var(--green);
}

.badge.danger {
    background: #fff0f0;
    border-color: #efb4b4;
    color: var(--red);
}

.flash,
.inline-status {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
}

.flash.success,
.inline-status.success {
    background: #eaf7f0;
    border-color: #b8dfc8;
    color: #115f42;
}

.flash.danger,
.inline-status.danger {
    background: #fff0f0;
    border-color: #efb4b4;
    color: var(--red);
}

.inline-status:empty {
    display: none;
}

.important {
    border-color: #e5c372;
}

.code-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.code-grid code,
.secret {
    display: block;
    font-size: 1rem;
    padding: 0.7rem;
}

.list {
    display: grid;
    gap: 0.5rem;
}

.list-row {
    align-items: center;
    background: #f8fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.8rem;
}

.details {
    display: grid;
    gap: 0.45rem 1rem;
    grid-template-columns: max-content 1fr;
}

.details dt {
    color: var(--muted);
    font-weight: 800;
}

.details dd {
    margin: 0;
}

.inline-form {
    align-items: end;
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.doc-note {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (max-width: 850px) {
    .topbar,
    .section-head,
    .split,
    .list-row {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .topbar {
        position: static;
    }

    .navlinks {
        justify-content: flex-start;
    }

    .form-grid,
    .metric-grid,
    .code-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .side-actions {
        justify-content: flex-start;
    }
}
