:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #dfe3e8;
    --text: #1c2430;
    --muted: #6b7684;
    --accent: #2f6fdb;
    --ok: #1f9254;
    --down: #cc3333;
    --warn: #b7791f;
    --radius: 8px;
}

* { box-sizing: border-box; }

/* The panel toggles screens with el.hidden, which relies on the UA rule [hidden]{display:none}.
   Any author `display` rule (.login is display:flex) outranks that and the element stays
   visible, so state it explicitly and win. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ── Login ─────────────────────────────────────────── */

.login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login__card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.login__title { margin: 0; font-size: 20px; }
.login__subtitle { margin: 4px 0 20px; color: var(--muted); }
.login__error {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fdecec;
    color: var(--down);
}

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.field__input, .field select, select.field__input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.field__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Chrome ────────────────────────────────────────── */

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__brand { font-weight: 600; }
.topbar__nav { display: flex; gap: 4px; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__email { color: var(--muted); font-size: 13px; }

.tab {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
}
.tab:hover { background: var(--bg); color: var(--text); }
.tab--active { background: var(--accent); color: #fff; }
.tab--active:hover { background: var(--accent); color: #fff; }

.view { padding: 20px; max-width: 1200px; margin: 0 auto; }

/* ── Blocks ────────────────────────────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.panel__title { margin: 0; font-size: 15px; font-weight: 600; }
.panel__body { padding: 16px; }

.btn {
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn--danger { color: var(--down); }
.btn--ghost { border-color: transparent; color: var(--muted); }
.btn--wide { width: 100%; }
.btn--sm { padding: 4px 9px; font-size: 13px; }

/* ── Tables ────────────────────────────────────────── */

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

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td.actions { text-align: right; white-space: nowrap; }

.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ── Status ────────────────────────────────────────── */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--bg);
    color: var(--muted);
}
.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status--Up { background: #e7f5ec; color: var(--ok); }
.status--Down { background: #fdecec; color: var(--down); }
.status--Suspended { background: #fdf3e2; color: var(--warn); }

/* Compact uptime strip: one cell per recent check, newest on the right. */
.sparkline { display: flex; gap: 2px; align-items: flex-end; }
.sparkline__cell { width: 4px; height: 16px; border-radius: 1px; background: var(--ok); }
.sparkline__cell--bad { background: var(--down); }

/* ── Forms / dialogs ───────────────────────────────── */

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

dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    width: min(640px, calc(100vw - 32px));
    color: var(--text);
}
dialog::backdrop { background: rgba(15, 20, 28, .45); }
.dialog__head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.dialog__body { padding: 16px; }
.dialog__foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #1c2430;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.toast--error { background: var(--down); }
