/* Qamooscheh admin. Plain CSS, light and dark from the OS setting. */

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #1d1d1f;
    --muted: #6b6b70;
    --border: #dcdce0;
    --accent: #2f5fd0;
    --error-bg: #fde8e8;
    --error-text: #9b1c1c;
    --notice-bg: #e6f4ea;
    --notice-text: #1e5e33;
    --open: #b45309;
    --reviewed: #2f5fd0;
    --resolved: #2e7d32;
    --failed: #b91c1c;
    --untrusted-bg: #fff8e1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161618;
        --surface: #1f1f22;
        --text: #ececf0;
        --muted: #9a9aa2;
        --border: #34343a;
        --accent: #7aa2ff;
        --error-bg: #3b1717;
        --error-text: #fca5a5;
        --notice-bg: #14301e;
        --notice-text: #86efac;
        --open: #fbbf24;
        --reviewed: #7aa2ff;
        --resolved: #6ee7a0;
        --failed: #f87171;
        --untrusted-bg: #2e2810;
    }
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1:focus { outline: none; }
h1 { font-size: 1.5rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
code { font-size: .85em; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }

.shell { display: grid; grid-template-columns: 12rem 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem; display: flex; flex-direction: column; gap: .2rem; }
.sidebar .brand { font-weight: 700; margin-bottom: .8rem; }
.sidebar a { text-decoration: none; color: var(--text); padding: .35rem .5rem; border-radius: 6px; }
.sidebar a.active { background: var(--bg); color: var(--accent); font-weight: 600; }
.sidebar .whoami { margin-top: auto; font-size: .85rem; color: var(--muted); display: flex; flex-direction: column; gap: .3rem; overflow-wrap: anywhere; }
main { padding: 1.2rem 1.5rem; min-width: 0; }

@media (max-width: 720px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar .whoami { margin-top: 0; margin-left: auto; }
    main { padding: 1rem; overflow-x: auto; }
    .columns { grid-template-columns: 1fr !important; }
}

.muted { color: var(--muted); }
.error-banner { background: var(--error-bg); color: var(--error-text); padding: .6rem .8rem; border-radius: 6px; margin: .5rem 0; }
.notice { background: var(--notice-bg); color: var(--notice-text); padding: .6rem .8rem; border-radius: 6px; margin: .5rem 0; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .3rem .45rem; }
textarea { min-height: 4rem; width: 100%; }
button, .button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .4rem .8rem; cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }

.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: .8rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin: .4rem 0; }
.stack label { display: flex; flex-direction: column; gap: .2rem; width: 100%; }
.stack label.inline, label.inline { flex-direction: row; display: inline-flex; gap: .3rem; margin-right: .8rem; width: auto; }
.narrow { max-width: 32rem; }
fieldset { border: 1px solid var(--border); border-radius: 6px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; margin: .8rem 0; }
.panel.highlight { border-color: var(--accent); }
.panel summary { cursor: pointer; font-weight: 600; }

.grid { border-collapse: collapse; width: 100%; background: var(--surface); }
.grid th, .grid td { border-bottom: 1px solid var(--border); padding: .4rem .5rem; text-align: left; vertical-align: top; }
.grid th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.grid td.text { max-width: 28rem; overflow-wrap: anywhere; }
.grid td.center { text-align: center; }
.grid tr.dead td { color: var(--muted); text-decoration: line-through; }
.grid code.payload { white-space: pre-wrap; word-break: break-all; }
.permissions th.rotate { height: 8rem; white-space: nowrap; vertical-align: bottom; }
.permissions th.rotate span { display: inline-block; transform: rotate(-60deg); transform-origin: left bottom; width: 1.5rem; }

.columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 1.5rem; }
.facts { display: grid; grid-template-columns: 7rem 1fr; gap: .4rem .8rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.untrusted { background: var(--untrusted-bg); padding: .3rem .5rem; border-radius: 4px; }
.body { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .6rem .8rem; }
.body.error { color: var(--error-text); }
.token { background: var(--surface); border: 1px dashed var(--accent); padding: .6rem; border-radius: 6px; user-select: all; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; border: 1px solid currentColor; }
.badge-open, .badge-draft, .badge-running { color: var(--open); }
.badge-reviewed, .badge-merged { color: var(--reviewed); }
.badge-resolved, .badge-closed, .badge-published, .badge-succeeded { color: var(--resolved); }
.badge-failed { color: var(--failed); }
.verdict { font-size: .85rem; }
.verdict-accept_alternate { color: var(--resolved); }
.verdict-overrule { color: var(--muted); }
.verdict-defer { color: var(--open); }

#blazor-error-ui { background: var(--error-bg); color: var(--error-text); bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
