/* Portal stylesheet. Dark, refined, no-JS, no external resources.
   Served by the front controller at /portal/style.css; CSP is
   style-src 'self', so no inline styles and no external fonts. */

:root {
    color-scheme: dark;
    --bg: #0f1013;
    --surface: #16171c;
    --surface-2: #1c1e24;
    --border: #272a33;
    --border-strong: #3a3f4b;
    --text: #e3e5ea;
    --muted: #9ba1ad;
    --accent: #8ab4f8;
    --accent-ink: #10131c;
    --ok: #81c995;
    --warn: #fdd663;
    --danger: #f28b82;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15.5px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(138, 180, 248, 0.35); }

/* --- page chrome --------------------------------------------------------- */

.site-head {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 0;
}
.site-head.narrow { max-width: 27rem; padding-left: 0; padding-right: 0; }
.site-head.wide { max-width: 62rem; }

.wordmark {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
}
.wordmark::after { content: "."; color: var(--accent); }
.wordmark:hover { text-decoration: none; color: #fff; }

main {
    max-width: 44rem;
    margin: 3rem auto 5rem;
    padding: 0 1.25rem;
}

/* Form and message pages get a centered card. */
main.narrow {
    max-width: 27rem;
    margin-top: 4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.25rem 2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* Dashboards get room for tables and stacked sections. */
main.wide { max-width: 62rem; }

/* --- typography ----------------------------------------------------------- */

h1 {
    font-size: 1.55rem;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin: 0 0 1rem;
}
main.narrow h1 { font-size: 1.3rem; }

h2 {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.005em;
    margin: 2.75rem 0 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

p { margin: 0.75rem 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.tagline { color: var(--muted); }

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.12em 0.4em;
    border-radius: 5px;
    overflow-wrap: anywhere;
}

pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
}

/* --- landing link list ----------------------------------------------------- */

ul.links {
    list-style: none;
    padding: 0;
    margin: 2.25rem 0;
    display: grid;
    gap: 0.6rem;
}
ul.links a {
    display: block;
    padding: 0.85rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s;
}
ul.links a::before { content: "→"; color: var(--accent); margin-right: 0.6rem; }
ul.links a:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    text-decoration: none;
}

/* --- forms ------------------------------------------------------------------ */

form { margin: 1.25rem 0; }
form.inline { display: inline; margin: 0; }

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
}

input, select, textarea {
    width: 100%;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    padding: 0.55em 0.7em;
    font: inherit;
    margin-top: 0.35rem;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 0.85rem; }
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.18);
}

button {
    background: var(--accent);
    color: var(--accent-ink);
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0.55em 1.15em;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
button:hover { background: #9ec1fa; }

/* Secondary actions (inline forms: approve/deny/revoke/remove/log out). */
form.inline button {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35em 0.8em;
}
form.inline button:hover { background: var(--surface-2); }

button.danger {
    background: transparent;
    border-color: #7a2e2e;
    color: var(--danger);
}
button.danger:hover { background: #2a171b; border-color: var(--danger); }

/* Accessible focus for everything interactive. */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- flash / error / note messages ------------------------------------------ */

.errors, .flash, .note {
    border: 1px solid;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin: 1.25rem 0;
    font-size: 0.92rem;
}
.errors {
    color: var(--danger);
    border-color: rgba(242, 139, 130, 0.35);
    background: rgba(242, 139, 130, 0.07);
}
ul.errors li { margin: 0.25rem 0; }
.flash {
    color: var(--ok);
    border-color: rgba(129, 201, 149, 0.35);
    background: rgba(129, 201, 149, 0.07);
    overflow-wrap: anywhere;
}
.note {
    color: var(--warn);
    border-color: rgba(253, 214, 99, 0.35);
    background: rgba(253, 214, 99, 0.07);
}

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

table {
    display: block; /* allows horizontal scroll on narrow screens */
    overflow-x: auto;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 1rem 0 1.5rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.85rem;
}
th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
th, td {
    padding: 0.55em 0.8em;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* --- quota bar -----------------------------------------------------------------
   Widths are classes, not inline styles: CSP forbids style attributes. */
.bar {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    height: 0.55rem;
    max-width: 24rem;
    overflow: hidden;
    margin: 0.6rem 0 1rem;
}
.bar > span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.hot > span { background: var(--danger); }
.bar > span.w0{width:0}.bar > span.w5{width:5%}.bar > span.w10{width:10%}
.bar > span.w15{width:15%}.bar > span.w20{width:20%}.bar > span.w25{width:25%}
.bar > span.w30{width:30%}.bar > span.w35{width:35%}.bar > span.w40{width:40%}
.bar > span.w45{width:45%}.bar > span.w50{width:50%}.bar > span.w55{width:55%}
.bar > span.w60{width:60%}.bar > span.w65{width:65%}.bar > span.w70{width:70%}
.bar > span.w75{width:75%}.bar > span.w80{width:80%}.bar > span.w85{width:85%}
.bar > span.w90{width:90%}.bar > span.w95{width:95%}.bar > span.w100{width:100%}

/* --- warrant canary ------------------------------------------------------------ */

.canary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--ok);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 2rem 0;
    font-size: 0.85rem;
    color: var(--muted);
}
.canary p { margin: 0.4rem 0; }
.canary strong { color: var(--text); }
.canary-overdue { border-left-color: var(--danger); }
.canary-overdue strong { color: var(--danger); }

/* --- small screens -------------------------------------------------------------- */

@media (max-width: 34rem) {
    .site-head { padding: 1.25rem 1rem 0; }
    main { margin: 2rem auto 4rem; }
    main.narrow { margin: 1.5rem 0.75rem 3rem; padding: 1.5rem 1.25rem; }
}
