:root {
    --accent: #005a9e;
    --accent-dark: #003e6e;
    --success: #168048;
    --danger: #be3c3c;
    --warn: #b45f00;
    --page: #f3f5f8;
    --card: #ffffff;
    --border: #dde2e9;
    --field-border: #c6cdd7;
    --text: #20262e;
    --muted: #707a88;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only `display:none` in the UA stylesheet, so ANY author rule
   that sets display — .login-wrap uses flex — silently beats it and the element stays on
   screen. Everything here relies on `hidden`, so make it win. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--page);
}

/* ---------- shell ---------- */
header.topbar {
    background: var(--accent);
    color: #fff;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
}

header.topbar .brand { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
header.topbar .tag { font-size: 12px; color: #bad6ee; }
header.topbar .spacer { flex: 1; }
header.topbar .who { font-size: 12px; color: #c8def2; }
header.topbar button {
    background: rgba(255,255,255,.15); color:#fff; border:0; padding:7px 14px;
    border-radius:3px; cursor:pointer; font-size:13px;
}
header.topbar button:hover { background: rgba(255,255,255,.28); }

nav.tabs {
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 2px;
    padding: 0 16px;
}

nav.tabs a {
    padding: 12px 18px;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

nav.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
nav.tabs a:hover { color: var(--accent); }

main { padding: 22px; max-width: 1500px; margin: 0 auto; }

/* ---------- cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.card > h2 {
    margin: 0;
    padding: 14px 18px 4px;
    font-size: 13px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--accent);
}

.card > .sub { padding: 0 18px 12px; color: var(--muted); font-size: 12px; }
.card > .body { padding: 6px 18px 18px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #eef1f5; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: #f7f9fc; }
tbody tr.selected { background: #e8f1f9; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: Consolas, monospace; font-size: 12.5px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--field-border);
    background: #fff;
    color: var(--text);
    font: inherit;
    border-radius: 2px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe2f3; border-color: var(--accent); }
input[readonly] { background: #f6f8fa; color: var(--muted); }
textarea { min-height: 64px; resize: vertical; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- buttons ---------- */
button {
    font: inherit;
    font-weight: 600;
    border: 0;
    padding: 9px 18px;
    border-radius: 2px;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
}
button:hover { background: var(--accent-dark); }
button.quiet { background: #fff; color: var(--text); border: 1px solid var(--field-border); }
button.quiet:hover { background: #eef2f7; }
button.danger { background: var(--danger); }
button.small { padding: 5px 11px; font-size: 12.5px; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.actions.right { justify-content: flex-end; }

/* ---------- misc ---------- */
.pill { display:inline-block; padding:2px 9px; border-radius:11px; font-size:11.5px; font-weight:600; }
.pill.admin     { background:#e7f0fa; color:#005a9e; }
.pill.publisher { background:#e6f5ea; color:#168048; }
.pill.viewer    { background:#f0f0f3; color:#666; }
.pill.ok        { background:#e6f5ea; color:#168048; }
.pill.warn      { background:#fff4d6; color:#b45f00; }
.pill.bad       { background:#fde2e2; color:#be3c3c; }
.pill.off       { background:#f0f0f3; color:#888; }

.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.empty { color: var(--muted); padding: 26px; text-align: center; }
.error { color: var(--danger); }

.checks { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:6px; max-height:260px; overflow:auto;
          border:1px solid var(--border); padding:10px; }
.checks label { display:flex; gap:8px; align-items:center; font-size:13px; }
.checks input { width:auto; }

/* ---------- login ---------- */
.login-wrap { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.login {
    width: 380px; background:#fff; border:1px solid var(--border);
}
.login .banner { background: var(--accent); color:#fff; padding: 22px 26px; }
.login .banner .brand { font-size: 26px; font-weight: 700; }
.login .banner .tag { font-size: 12px; color:#bad6ee; }
.login .body { padding: 22px 26px 26px; }

/* Customers have no account here — the download has to be reachable from the sign-in page. */
.login .downloadbar {
    border-top: 1px solid var(--border); background: #f7f9fc;
    padding: 14px 26px 16px; display: flex; flex-direction: column; gap: 10px;
}
.login .downloadbar b { display:block; font-size: 12.5px; color: var(--text); }
.login .downloadbar span { display:block; font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.login .downloadbar a {
    align-self: flex-start; background: var(--success); color:#fff; text-decoration:none;
    padding: 7px 14px; font-size: 12.5px; font-weight: 600;
}
.login .downloadbar a:hover { background: #11663a; }
.login .downloadbar a[hidden] { display:none; }

.topbar a.small {
    background: rgba(255,255,255,.14); color:#fff; text-decoration:none;
    padding: 5px 11px; font-size: 12.5px; font-weight: 600;
}
.topbar a.small:hover { background: rgba(255,255,255,.26); }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(16,22,30,.45);
    display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50;
}
.modal { background:#fff; width: 720px; max-width: 100%; border:1px solid var(--border); }
.modal h3 { margin:0; padding:16px 20px; border-bottom:1px solid var(--border); font-size:15px; }
.modal .body { padding: 18px 20px; }
.modal .foot { padding: 14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }

.toast {
    position: fixed; right: 18px; bottom: 18px; background:#20262e; color:#fff;
    padding: 12px 18px; border-radius: 3px; z-index: 100; max-width: 460px;
}
.toast.bad { background: var(--danger); }
