:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #eef1f5;
    --border: #d9dee7;
    --text: #172033;
    --muted: #637089;
    --accent: #1168d8;
    --accent-strong: #0c4ea5;
    --ok: #0c7a43;
    --warn: #9a5b00;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

.shell {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    min-height: 100vh;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 26px rgb(15 23 42 / 0.08);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
}

.login-brand p {
    margin: 4px 0 0;
    color: var(--muted);
}

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

.login-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    color: var(--text);
    background: #fff;
}

.alert {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 6px;
    font-weight: 700;
}

.alert.danger {
    background: #fde7e4;
    color: var(--danger);
}

.alert.ok {
    background: #e7f6ed;
    color: var(--ok);
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: #111827;
    color: #f9fafb;
    padding: 20px 14px;
    border-right: 1px solid #0b1220;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 8px 18px;
    border-bottom: 1px solid #283241;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    background: #2563eb;
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #aeb7c6;
    margin-top: 2px;
}

.nav {
    display: grid;
    gap: 4px;
    padding-top: 16px;
}

.nav a {
    color: #dce3ef;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
}

.nav a.active,
.nav a:hover {
    background: #223049;
    color: #fff;
}

.logout-form {
    margin-top: auto;
    padding: 16px 0 0;
}

.logout-form button {
    width: 100%;
    min-height: 38px;
    border: 1px solid #334155;
    border-radius: 6px;
    background: transparent;
    color: #dce3ef;
    font-weight: 700;
    cursor: pointer;
}

.logout-form button:hover {
    background: #223049;
    color: #fff;
}

.content {
    min-width: 0;
    padding: 28px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--muted);
}

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

.panel-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
    margin-top: 14px;
}

.metric,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.metric {
    padding: 16px;
}

.metric span,
.metric small {
    color: var(--muted);
}

.metric strong {
    display: block;
    margin: 6px 0 3px;
    font-size: 28px;
}

.panel {
    padding: 16px;
}

.panel-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-title h2 {
    margin: 0;
    font-size: 17px;
}

.panel-title span {
    color: var(--muted);
    font-size: 13px;
}

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

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

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.muted-cell {
    color: var(--muted);
    font-size: 12px;
    max-width: 260px;
}

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.badge.ok,
.status-pill.ok {
    background: #e7f6ed;
    color: var(--ok);
}

.status-pill.warn {
    background: #fff3db;
    color: var(--warn);
}

.status-pill.danger {
    background: #fde7e4;
    color: var(--danger);
}

.event-list {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.event-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.event-list time {
    color: var(--muted);
}

.primary {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.primary:hover {
    background: var(--accent-strong);
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.link-button:hover {
    color: var(--accent-strong);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #f8fafc;
}

.selected-row {
    background: #f8fbff;
}

.wide {
    width: 100%;
    margin-top: 12px;
}

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

.form-grid label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

input,
select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 7px 9px;
}

.integrations-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
    gap: 14px;
    margin-top: 14px;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list div {
    display: grid;
    gap: 4px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 0;
}

.detail-list code {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    padding: 3px 6px;
    color: #263349;
}

.documentation-panel code {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    padding: 3px 6px;
    color: #263349;
}

.endpoint-list {
    display: grid;
    gap: 14px;
}

.endpoint-list strong {
    display: block;
    margin-bottom: 6px;
}

.endpoint-list ul {
    margin: 0;
    padding-left: 18px;
}

.code-block {
    max-width: 100%;
    margin: 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8fafc;
    padding: 10px;
}

.code-block code {
    display: block;
    border: 0;
    padding: 0;
    background: transparent;
    white-space: pre;
}

.helper-text {
    color: var(--muted);
    margin: 12px 0 0;
}

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .metric-grid,
    .panel-grid,
    .integrations-layout {
        grid-template-columns: 1fr;
    }
}
