/* GRR Black Box. Colours, fonts and light/dark follow the customer portal (my.goredrobot.com). Compact, full width. */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
    color-scheme: dark;
    --red: #e5483f; --btn: #c4352d; --btn-hover: #ad2d26; --btn-text: #ffffff;
    --bg: #110d0e; --side: #161112; --panel: #1c1617; --panel-2: #241c1d;
    --line: rgba(255, 255, 255, 0.09); --line-2: rgba(255, 255, 255, 0.15);
    --text: #f3f4f6; --muted: #a1a6b0; --faint: #9297a2; --accent: #ff9d96;
    --ok: #5fd896; --ok-bg: rgba(95, 216, 150, 0.12);
    --error: #ff8a80; --error-bg: #2e1b1b; --input: #130f10; --qr-bg: #ffffff;
    --radius: 14px; --radius-sm: 9px; --gap: 14px; --pad: 18px; --side-w: 236px;
    --font: "Inter", "Helvetica Neue", Arial, sans-serif;
    --display: "Space Grotesk", "Inter", Arial, sans-serif;
    --mono: ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
    :root[data-theme="auto"] {
        color-scheme: light;
        --btn-hover: #a82b24;
        --bg: #f4f5f7; --side: #ffffff; --panel: #ffffff; --panel-2: #f6f7f9;
        --line: #e6e8ec; --line-2: #d9dce2;
        --text: #14161a; --muted: #555b66; --faint: #646a75; --accent: #b3261e;
        --ok: #18794a; --ok-bg: #e3f5ea; --error: #b3261e; --error-bg: #fbe9e8; --input: #ffffff;
    }
    .logo-dark { display: none; }
    .logo-light { display: inline; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--font); }
a { color: var(--accent); }
h1 { font: 600 22px/1.25 var(--display); margin: 0 0 8px; }
h2 { font: 600 14px/1.3 var(--display); margin: 0 0 6px; }
.muted { color: var(--muted); margin: 0 0 12px; }
.fine { color: var(--faint); font-size: 12px; margin: 12px 0 0; }
code, .key { font-family: var(--mono); }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand span { font: 600 15px var(--display); }
.logo { height: 22px; width: auto; }
.logo-light { display: none; }

/* sign-in pages: one small card in the middle */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); }
.card.wide { max-width: 1000px; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input[type=email], input[type=password], input[name=code] {
    width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
    background: var(--input); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { margin-top: 14px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); background: var(--btn); color: var(--btn-text); font: 600 13px var(--font); cursor: pointer; }
button:hover { background: var(--btn-hover); }
button.link { width: auto; background: none; color: var(--accent); padding: 0; margin-top: 12px; font-weight: 500; }
.alert { background: var(--error-bg); color: var(--error); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 8px; }
.setup { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.qr { background: var(--qr-bg); border-radius: var(--radius-sm); padding: 8px; width: 220px; }
.qr svg { display: block; width: 100%; height: auto; }
.steps { margin: 0 0 4px; padding-left: 18px; }
.steps li { margin-bottom: 6px; }
.key { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* signed-in pages: menu on the left, content fills the rest of the window */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: var(--pad); }
.side nav a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.side nav a.on { background: var(--panel-2); }
.main { padding: var(--pad); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); margin-right: 6px; }
.chip.ok { color: var(--ok); background: var(--ok-bg); }
.strip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--muted); margin: 0 0 var(--gap); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.side .who { color: var(--faint); font-size: 12px; margin: 16px 0 0; word-break: break-all; }

/* search */
.searchbar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px var(--pad); margin-bottom: 10px; }
.searchbar .row1 { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 10px; }
.searchbar .row1 button { margin-top: 0; }
.searchbar .row2 { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; align-items: end; }
.searchbar .row2 label { font-weight: 500; color: var(--muted); margin: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.searchbar .row2 label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 7px; }
.searchbar input:not([type=checkbox]), .searchbar select {
    padding: 7px 9px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
    background: var(--input); color: var(--text); font: inherit;
}
.searchbar input.q { width: 100%; font-size: 14px; padding: 9px 10px; }
.scope { font-size: 12px; }
.panel.flush { padding: 0; overflow-x: auto; }
.results td, .results th { white-space: nowrap; }
.results td:nth-child(4) { white-space: normal; min-width: 280px; }
.results .c-date { width: 130px; }
.results .c-who { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.results .c-size { width: 70px; text-align: right; }
.results .c-att { width: 28px; text-align: center; }
.results tbody tr:hover { background: var(--panel-2); }
.pager { display: flex; gap: 14px; align-items: center; margin: 10px 0; }

/* admin screens */
.side .navhead { margin: 14px 0 4px; padding: 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.gap-top { margin-top: var(--gap); }
.strip.okstrip { color: var(--ok); background: var(--ok-bg); }
.rowform { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rowform input:not([type=hidden]), .rowform select { padding: 5px 7px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--input); color: var(--text); font: inherit; }
.rowform label.inline-code { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; color: var(--muted); }
.rowform label.inline-code input { width: 80px; }
a.small-link { font-size: 12px; padding-bottom: 7px; }
.results td.detail { white-space: normal; max-width: 360px; font-family: var(--mono); font-size: 11px; word-break: break-all; }

/* selection + actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 9px; border-bottom: 1px solid var(--line); }
button.small { width: auto; margin-top: 0; padding: 6px 10px; font-size: 12px; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line-2); }
button.ghost:hover { background: var(--panel-2); }
.results .c-pick { width: 30px; text-align: center; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
form.inline { display: inline; }
.msgacts { margin: 4px 0 6px; }
.facts { margin: 0 0 10px; padding-left: 18px; }
.progress { margin: 8px 0; padding-left: 18px; color: var(--muted); }

/* list + message side by side on wide screens */
.split.has-open { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap); align-items: start; }
.split.has-open .results .c-size, .split.has-open .results th.c-size { display: none; }
.msg { padding: var(--pad); }
.msg .msgbar { margin: 0 0 8px; font-size: 12px; }
.msg .subject { font-size: 16px; margin: 0 0 8px; }
.hdr { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 2px 10px; margin: 0 0 8px; }
.hdr dt { color: var(--muted); }
.hdr dd { margin: 0; word-break: break-word; }
.atts { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.warnchip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; color: #8f5600; background: #fdf1dc; }
.strip.warn { color: var(--error); background: var(--error-bg); }
.msg iframe.body { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #ffffff; }
pre.plain { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 var(--mono); background: var(--panel-2); padding: 10px; border-radius: var(--radius-sm); max-height: 70vh; overflow: auto; margin: 0; }
@media (max-width: 1100px) { .split.has-open { grid-template-columns: minmax(0, 1fr); } .split.has-open .list { display: none; } }

@media (max-width: 768px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { border-right: 0; border-bottom: 1px solid var(--line); }
    .setup { grid-template-columns: minmax(0, 1fr); }
    .qr { margin: 0 auto; }
}
