:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1d2430;
    --muted: #667085;
    --line: #d9dee7;
    --green: #137a4b;
    --red: #b42318;
    --amber: #9a6700;
    --blue: #175cd3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
}

button.secondary {
    background: #475467;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    background: #fff;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

code {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    min-height: 58px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
}

.topbar strong {
    margin-right: 10px;
}

.topbar span,
.section-head span,
.status-band p {
    color: var(--muted);
}

.topbar nav {
    display: flex;
    gap: 14px;
}

.layout {
    width: min(1180px, calc(100vw - 32px));
    margin: 24px auto 48px;
    display: grid;
    gap: 18px;
}

.status-band,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.status-band {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 28px;
}

.status-band h1 {
    margin: 8px 0 10px;
    font-size: clamp(34px, 7vw, 72px);
    line-height: 1;
    letter-spacing: 0;
}

.status-band p {
    margin: 0;
}

.status-band p span {
    margin-left: 14px;
}

.status-alive {
    border-left: 8px solid var(--green);
}

.status-dead {
    border-left: 8px solid var(--red);
}

.eyebrow {
    font-size: 13px;
    text-transform: uppercase;
}

.checkin-form button {
    min-width: 150px;
    min-height: 48px;
    background: var(--green);
}

.grid {
    display: grid;
    gap: 18px;
}

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

.panel {
    padding: 20px;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.inline-form,
.device-create {
    display: grid;
    gap: 12px;
    align-items: end;
}

.inline-form {
    grid-template-columns: minmax(220px, 1fr) auto;
}

.device-create {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
    margin-bottom: 16px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

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

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

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

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.pill,
.level {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.pill-online {
    background: #dcfae6;
    color: var(--green);
}

.pill-offline {
    background: #fee4e2;
    color: var(--red);
}

.pill-disabled {
    background: #eceff3;
    color: #475467;
}

.level-notice,
.level-info {
    background: #e0f2fe;
    color: var(--blue);
}

.level-warning {
    background: #fef0c7;
    color: var(--amber);
}

.level-error,
.level-danger {
    background: #fee4e2;
    color: var(--red);
}

.row-form {
    display: grid;
    gap: 8px;
    width: min(220px, 100%);
}

.row-form button,
.actions button {
    white-space: nowrap;
}

.checkline {
    display: flex;
    grid-template-columns: auto 1fr;
    gap: 6px;
    align-items: center;
    color: var(--text);
}

.checkline input {
    width: auto;
}

.action-cell {
    min-width: 120px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.log-detail {
    max-width: 360px;
    max-height: 120px;
    overflow: auto;
    font-size: 12px;
}

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

.alert-success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: var(--green);
}

.alert-danger {
    border-color: #fecdca;
    background: #fef3f2;
    color: var(--red);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 26px;
}

.login-panel h1 {
    margin: 0 0 20px;
}

.login-panel form {
    display: grid;
    gap: 14px;
}

@media (max-width: 760px) {
    .topbar,
    .status-band,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .grid.two,
    .inline-form,
    .device-create {
        grid-template-columns: 1fr;
    }

    .status-band h1 {
        font-size: 42px;
    }
}
