/* bird-relay-control — single hand-written stylesheet, no build step. */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #1c2733;
    --muted: #5b6b7b;
    --line: #dde3ea;
    --accent: #146c94;
    --accent-ink: #ffffff;
    --ok: #1a7f4b;
    --warn: #b35c00;
    --bad: #b3261e;
    --radius: 8px;
}

* { box-sizing: border-box; }

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

/* ---- top bar ------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: #16222e;
    color: #e8eef4;
    padding: 0.6rem 1.25rem;
    flex-wrap: wrap;
}

.brand { font-weight: 700; letter-spacing: 0.02em; }

.topbar nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.topbar a {
    color: #c8d6e2;
    text-decoration: none;
    padding: 0.15rem 0;
    border-bottom: 2px solid transparent;
}

.topbar a:hover { color: #ffffff; border-bottom-color: var(--accent); }

.logout-form {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.whoami { color: #9fb2c2; font-size: 0.9em; }

/* ---- layout -------------------------------------------------------- */

main {
    max-width: 68rem;
    margin: 1.5rem auto 3rem;
    padding: 0 1.25rem;
}

h1 { font-size: 1.45rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 0 0 1.25rem;
}

.card.narrow { max-width: 30rem; }

/* login: box centered on the page, pushed down from the top bar */
.login-wrap {
    max-width: 30rem;
    margin: 12vh auto 0;
    text-align: center;
}
.login-wrap .card { text-align: left; }

.meta { color: var(--muted); font-size: 0.9em; }

.note {
    color: var(--muted);
    font-size: 0.9em;
    margin: 0.35rem 0 0.75rem;
}

/* ---- messages / banners -------------------------------------------- */

.messages { list-style: none; margin: 0 0 1rem; padding: 0; }

.msg {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;      /* rotate-key message carries multi-line OBS info */
    word-break: break-all;      /* keys/URLs must never overflow the page */
}

.msg.success { border-color: var(--ok); background: #edf7f1; }
.msg.error   { border-color: var(--bad); background: #fbeeed; }
.msg.warning { border-color: var(--warn); background: #fdf3e7; }

.banner {
    border-radius: var(--radius);
    padding: 0.6rem 0.9rem;
    margin: 0 0 1rem;
    border: 1px solid var(--line);
}

.banner.warn { background: #fdf3e7; border-color: var(--warn); color: #6b3d00; }

.error { color: var(--bad); }

/* ---- tables --------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

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

th {
    background: #eef1f5;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

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

/* ---- badges & statuses ---------------------------------------------- */

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.8em;
    font-weight: 600;
}

.badge.live { background: #e2f4e9; color: var(--ok); }
.badge.off  { background: #e9edf1; color: var(--muted); }

.status { font-weight: 600; font-size: 0.9em; }
.status.applied         { color: var(--ok); }
.status.dry_run         { color: var(--accent); }
.status.pending         { color: var(--muted); }
.status.rejected        { color: var(--warn); }
.status.rolled_back     { color: var(--warn); }
.status.failed_critical { color: var(--bad); }

/* ---- forms & buttons ------------------------------------------------ */

label { display: block; font-weight: 600; margin: 0.75rem 0 0.2rem; }

input[type="text"], input[type="password"], input[type="number"],
input[type="url"], select, textarea {
    width: 100%;
    max-width: 28rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}

textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

input:focus, select:focus, textarea:focus, button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

button, .button {
    display: inline-block;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: var(--radius);
    padding: 0.45rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .button:hover { filter: brightness(1.1); }

button.danger, .danger > button {
    background: var(--bad);
    border-color: var(--bad);
}

.linklike {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.linklike.danger { color: var(--bad); }

form.inline { display: inline; }

.actions, .actions-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.filter { margin: 0 0 1rem; }
.filter input, .filter select { max-width: 16rem; display: inline-block; }

/* helper text under form fields (Django renders .helptext) */
.helptext { display: block; color: var(--muted); font-size: 0.85em; }

ul.errorlist { color: var(--bad); margin: 0.2rem 0; padding-left: 1.1rem; }

/* ---- config / diff blocks ------------------------------------------- */

pre, code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

pre {
    background: #16222e;
    color: #dce7f0;
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    overflow-x: auto;
}

.diff { background: #16222e; }
.diff .add { color: #7fd39a; }
.diff .del { color: #f1948a; }

@media (max-width: 640px) {
    .topbar { gap: 0.6rem; }
    .logout-form { margin-left: 0; }
    th, td { padding: 0.4rem 0.5rem; }
}
