/*
 * The whole console's styling.
 *
 * One plain stylesheet, served as a file. There is no build step and no
 * JavaScript, which is what lets the Content-Security-Policy in
 * docker/nginx/default.conf forbid inline script and inline style outright --
 * the strictest useful policy, and one this console never has to relax.
 */

:root {
    --ink: #1b1c1e;
    --ink-quiet: #5c6066;
    --page: #f4f5f7;
    --surface: #ffffff;
    --line: #d9dce1;
    --accent: #3f5c8c;
    --accent-ink: #ffffff;
    --error: #a4262c;
    --error-bg: #fdf3f3;
    --notice-bg: #eef3fa;

    --radius: 6px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e6e8eb;
        --ink-quiet: #a0a6ae;
        --page: #16181c;
        --surface: #1e2126;
        --line: #333941;
        --accent: #7ea2dd;
        --accent-ink: #12141a;
        --error: #f08a90;
        --error-bg: #2a1e20;
        --notice-bg: #1b2430;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1.5rem;
    background: var(--page);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.shell {
    max-width: 26rem;
    margin: 0 auto;
}

.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bar__title {
    font-weight: 600;
}

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

.card__title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.card__subtitle {
    margin: 0 0 1.5rem;
    color: var(--ink-quiet);
}

.field {
    margin-bottom: 1rem;
}

.field__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.field__input {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

/*
 * Never remove the focus ring without replacing it. Keyboard sign-in becomes
 * guesswork without a visible indication of where the caret is.
 */
.field__input:focus-visible,
.button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.field__error {
    display: block;
    margin-top: 0.35rem;
    color: var(--error);
    font-size: 0.875rem;
}

.notice {
    margin: 0 0 1.25rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius);
    background: var(--notice-bg);
    font-size: 0.925rem;
}

.notice--error {
    background: var(--error-bg);
    color: var(--error);
}

.button {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button--quiet {
    width: auto;
    padding: 0.35rem 0.75rem;
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
    font-weight: 500;
}

.meta {
    margin: 0.75rem 0 0;
    color: var(--ink-quiet);
    font-size: 0.9rem;
}

a {
    color: var(--accent);
}

/* --- wider pages ------------------------------------------------------- */

/*
 * The sign-in card wants to be narrow; a table of accounts does not. Pages opt
 * in with @section('shell-modifier', 'shell--wide') rather than the shell
 * guessing from its contents.
 */
.shell--wide {
    max-width: 56rem;
}

/* --- navigation -------------------------------------------------------- */

.bar__nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.bar__link {
    padding: 0.25rem 0;
    color: var(--ink-quiet);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.bar__link:hover {
    color: var(--ink);
}

.bar__link.is-current {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

/* --- cards with an action in the header -------------------------------- */

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card__header .card__subtitle {
    margin-bottom: 0;
}

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

/*
 * The wrapper scrolls, not the page. A table too wide for a phone should slide
 * sideways inside its own box rather than making the whole document scroll.
 */
.table-scroll {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-quiet);
}

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

.table__actions {
    text-align: right;
}

/* --- small pieces ------------------------------------------------------ */

.tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--ink-quiet);
}

.tag--strong {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.muted {
    color: var(--ink-quiet);
}

.field__hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.825rem;
    color: var(--ink-quiet);
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/*
 * Buttons are full width in the sign-in form and inline everywhere else, so
 * the width is the modifier rather than the default.
 */
.button--inline {
    width: auto;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.button--danger {
    background: var(--error);
    color: var(--surface);
    border-color: transparent;
}

a.button--quiet {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

/*
 * Present for screen readers, invisible on screen. Used for table headers that
 * label a column of controls, which need a name but not a caption.
 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- paging ------------------------------------------------------------ */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.pager__links {
    display: flex;
    gap: 0.5rem;
}
