/*
Design system
- Tokens map directly to the requested palette and typography for the infra dashboard.
- Components reuse shared surfaces/borders to keep the console flat and information dense.
- Status styles (OK/DEGRADED/FAIL/PAUSED) drive the only strong color usage.
*/
:root {
    --bg: #0b0f14;
    --surface: #121826;
    --border: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --ok: #22c55e;
    --degraded: #f59e0b;
    --fail: #ef4444;
    --paused: #64748b;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: #fff;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.app-body {
    background: var(--bg);
}

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.14);
    color: #dbeafe;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
}

.brand-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    border: 1px solid transparent;
    transition: background 120ms ease, border-color 120ms ease;
}

.nav-link:hover {
    background: #0f1622;
    border-color: var(--border);
}

.nav-link.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: var(--border);
}

.nav-footer {
    margin-top: auto;
    color: var(--muted);
    font-size: 13px;
}

.nav-footer .small {
    font-size: 12px;
}

.app-main {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(11, 15, 20, 0.9);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.topbar-title {
    margin: 4px 0 0;
    font-size: 18px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page {
    padding: 24px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 28px;
    margin: 0;
    line-height: 1.3;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

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

.muted.small {
    font-size: 12px;
}

.muted.large {
    font-size: 17px;
}

.label {
    font-size: 13px;
    color: var(--text);
}

.help-text {
    font-size: 12px;
    color: var(--muted);
    margin: 4px 0 0;
}

.mono {
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.link {
    color: #93c5fd;
    text-decoration: none;
}

.link.button,
button.link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

.link-danger {
    color: #fca5a5;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.2;
}

.pill-muted {
    background: #0f141d;
    color: var(--muted);
}

.pill-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--ok);
    border-color: rgba(34, 197, 94, 0.35);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0f1622;
    color: var(--text);
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    text-decoration: none;
}

.btn:hover {
    background: #111a29;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary-strong);
    color: #eef2ff;
}

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

.btn-secondary {
    background: #0f141d;
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecdd3;
}

.btn.small {
    padding: 8px 10px;
    font-size: 13px;
}

.btn.full {
    width: 100%;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: none;
}

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

.panel-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.panel-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 0 0 4px;
}

.sectioned .row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.sectioned .row:last-child {
    border-bottom: none;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.row.danger {
    background: rgba(239, 68, 68, 0.06);
    border-radius: 8px;
    padding: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input,
textarea,
select {
    width: 100%;
    background: #0f141d;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.callout {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #0f141d;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grid-2 {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.monitors-grid {
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

.metric-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-value {
    font-weight: 600;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 720px;
}

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

.table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}

.table tbody tr:hover {
    background: #0f141d;
}

.table-title {
    font-weight: 600;
}

.table-meta {
    font-weight: 600;
}

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

.table .is-child .table-title {
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    background: #0f141d;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-ok {
    color: var(--ok);
}

.status-ok .status-dot,
.status-dot.status-ok {
    background: var(--ok);
}

.status-degraded {
    color: var(--degraded);
}

.status-degraded .status-dot,
.status-dot.status-degraded {
    background: var(--degraded);
}

.status-fail {
    color: var(--fail);
}

.status-fail .status-dot,
.status-dot.status-fail {
    background: var(--fail);
}

.status-paused {
    color: var(--paused);
}

.status-paused .status-dot,
.status-dot.status-paused {
    background: var(--paused);
}

.inline-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bullet-list li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.list-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.list-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0f141d;
}

.empty-state {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: #0f141d;
    color: var(--text);
}

.alert-success {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.08);
    color: var(--ok);
}

.alert-error {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
    color: #fecdd3;
}

.alert-info {
    border-color: rgba(148, 163, 184, 0.5);
    color: var(--text);
}

.flash-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

.fade-out {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 250ms ease, transform 250ms ease;
}

.table .muted.small,
.table .mono {
    word-break: break-all;
}

.inline-form {
    display: inline;
}

.auth-card {
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
}

.narrow {
    max-width: 540px;
    margin: 0 auto;
}

.list-card .metric-label {
    margin: 0 0 4px;
}

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

    .sidebar {
        min-height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-link {
        padding: 8px 10px;
    }

    .topbar {
        position: static;
    }

    .monitors-grid {
        grid-template-columns: 1fr;
    }

    .table {
        min-width: 100%;
    }
}
