/* The credential pages, painted from the Nest design tokens (web/ui/src/styles/tokens.css) so the
   login surface and the console read as one product. No script: the theme rides a cookie written
   onto <html data-theme>, and with no cookie the OS decides through prefers-color-scheme. */

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2");
}
@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
}

:root {
    --bg: #0b0e13;
    --surface: #121722;
    --surface-2: #1a2130;
    --surface-3: #212a3c;
    --border: #232c3d;
    --border-2: #2e3a50;
    --text: #dce3ee;
    --dim: #8a96ab;
    --faint: #5a6478;
    --accent: #3ec1d3;
    --accent-contrast: #0a2a30;
    --ok: #2ebd85;
    --warn: #e8b04b;
    --danger: #f6465d;
    --info: #7aa2f7;
    --tint-accent-bg: color-mix(in srgb, var(--accent) 12%, var(--surface));
    --tint-accent-border: color-mix(in srgb, var(--accent) 40%, var(--border));
    --tint-ok-bg: color-mix(in srgb, var(--ok) 12%, var(--surface));
    --tint-ok-border: color-mix(in srgb, var(--ok) 40%, var(--border));
    --tint-warn-bg: color-mix(in srgb, var(--warn) 12%, var(--surface));
    --tint-warn-border: color-mix(in srgb, var(--warn) 40%, var(--border));
    --tint-danger-bg: color-mix(in srgb, var(--danger) 12%, var(--surface));
    --tint-danger-border: color-mix(in srgb, var(--danger) 40%, var(--border));
    --focus: var(--accent);
    --shadow-card: 0 24px 64px rgb(0 0 0 / 0.45);
    --font-sans: "IBM Plex Sans", system-ui, "Segoe UI", Roboto, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --fs-xs: 11px;
    --lh-xs: 16px;
    --fs-sm: 12px;
    --lh-sm: 16px;
    --fs-base: 13px;
    --lh-base: 20px;
    --fs-md: 14px;
    --lh-md: 22px;
    --fs-lg: 16px;
    --lh-lg: 24px;
    --fs-2xl: 24px;
    --lh-2xl: 32px;
    --s-2: 4px;
    --s-3: 8px;
    --s-4: 12px;
    --s-5: 16px;
    --s-6: 24px;
    --s-7: 32px;
    --s-8: 48px;
    --r-sm: 4px;
    --r: 6px;
    --r-lg: 8px;
    --r-xl: 12px;
    --r-pill: 999px;
    --t-fast: 120ms ease-out;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --surface-3: #e3e8ef;
    --border: #d8dee7;
    --border-2: #bfc9d6;
    --text: #141a22;
    --dim: #55637a;
    --faint: #8391a5;
    --accent: #0e8c9c;
    --accent-contrast: #ffffff;
    --ok: #1b8a5e;
    --warn: #9a6700;
    --danger: #c81e3c;
    --info: #2b5fd9;
    --shadow-card: 0 16px 48px rgb(20 26 34 / 0.14);
    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg: #f4f6f9;
        --surface: #ffffff;
        --surface-2: #eef1f5;
        --surface-3: #e3e8ef;
        --border: #d8dee7;
        --border-2: #bfc9d6;
        --text: #141a22;
        --dim: #55637a;
        --faint: #8391a5;
        --accent: #0e8c9c;
        --accent-contrast: #ffffff;
        --ok: #1b8a5e;
        --warn: #9a6700;
        --danger: #c81e3c;
        --info: #2b5fd9;
        --shadow-card: 0 16px 48px rgb(20 26 34 / 0.14);
        color-scheme: light;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --t-fast: 0ms;
    }
}

/* ---------- reset + base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    background: var(--bg);
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 var(--fs-md) / var(--lh-md) var(--font-sans);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1,
h2,
p,
ul,
dl {
    margin: 0;
}
h1,
h2 {
    font-weight: 600;
    letter-spacing: 0.005em;
    text-wrap: balance;
}
h1 {
    font-size: var(--fs-2xl);
    line-height: var(--lh-2xl);
    margin-bottom: var(--s-3);
}
h2 {
    font-size: var(--fs-lg);
    line-height: var(--lh-lg);
    margin-bottom: var(--s-3);
}
p {
    margin-bottom: var(--s-4);
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
button,
input {
    font: inherit;
    color: inherit;
}
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
::selection {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
}
.dim {
    color: var(--dim);
}

/* ---------- page chrome ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--s-5);
    padding: var(--s-3) var(--s-6);
    min-height: 52px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    color: var(--text);
    font-weight: 600;
    font-size: var(--fs-md);
    text-decoration: none;
}
.brand:hover {
    text-decoration: none;
}
.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2ea3b8, #57e0c8);
    overflow: hidden;
}
.brand-mark img {
    width: 22px;
    height: 22px;
    display: block;
}
.brand-sub {
    color: var(--dim);
    font-weight: 500;
    font-size: var(--fs-sm);
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.topbar-right a,
.topbar-right button {
    color: var(--dim);
    font-size: var(--fs-base);
    line-height: 18px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: none;
    cursor: pointer;
    text-decoration: none;
}
.topbar-right a:hover,
.topbar-right button:hover {
    color: var(--text);
    background: var(--surface-2);
    text-decoration: none;
}
.topbar-right form {
    display: inline;
}
.seg {
    display: inline-flex;
    border: 1px solid var(--border-2);
    border-radius: var(--r-pill);
    padding: 2px;
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    line-height: var(--lh-xs);
}
.seg a {
    padding: 2px 8px;
    border-radius: var(--r-pill);
    color: var(--dim);
    border: 0;
    line-height: var(--lh-xs);
    font-size: var(--fs-xs);
}
.seg a[aria-current="true"] {
    background: var(--surface-3);
    color: var(--text);
}
.page {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--s-8) var(--s-5);
}
.card {
    width: min(440px, 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--surface);
    padding: var(--s-7) var(--s-7) var(--s-6);
    box-shadow: var(--shadow-card);
}
.footer {
    border-top: 1px solid var(--border);
    color: var(--dim);
    font-size: var(--fs-sm);
    line-height: var(--lh-sm);
    padding: var(--s-5) var(--s-6);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3) var(--s-6);
    justify-content: space-between;
}
.footer a {
    color: var(--dim);
}
.footer a:hover {
    color: var(--text);
}

/* ---------- forms ---------- */
label {
    display: block;
    font-size: var(--fs-sm);
    line-height: var(--lh-sm);
    font-weight: 500;
    color: var(--dim);
    margin: var(--s-5) 0 var(--s-2);
}
.input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text);
    font-size: var(--fs-md);
    line-height: 20px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--tint-accent-bg);
}
.check {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    color: var(--text);
    font-weight: 400;
    font-size: var(--fs-base);
    line-height: var(--lh-base);
}
.check input {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: var(--s-5);
    padding: 9px 14px;
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--text);
    font-weight: 500;
    font-size: var(--fs-md);
    line-height: 20px;
    cursor: pointer;
    transition: background var(--t-fast);
}
.btn:hover {
    background: var(--surface-3);
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}
.btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, var(--text));
}
.error,
.notice {
    margin: var(--s-4) 0 0;
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
}
.error {
    color: var(--danger);
    background: var(--tint-danger-bg);
    border: 1px solid var(--tint-danger-border);
}
.notice {
    color: var(--ok);
    background: var(--tint-ok-bg);
    border: 1px solid var(--tint-ok-border);
}
.links {
    margin-top: var(--s-5);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3) var(--s-5);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
}
hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--s-6) 0;
}

/* ---------- account + MFA ---------- */
.kv {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--s-3) var(--s-4);
    margin: var(--s-5) 0;
    font-size: var(--fs-base);
    line-height: var(--lh-base);
}
.kv dt {
    color: var(--dim);
}
.kv dd {
    margin: 0;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 8px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text);
    font-size: var(--fs-xs);
    line-height: var(--lh-xs);
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
    margin-right: var(--s-2);
}
.chip-ok {
    color: var(--ok);
    background: var(--tint-ok-bg);
    border-color: var(--tint-ok-border);
}
.chip-warn {
    color: var(--warn);
    background: var(--tint-warn-bg);
    border-color: var(--tint-warn-border);
}
.qr {
    display: block;
    width: 196px;
    height: 196px;
    margin: var(--s-5) auto;
    padding: 6px;
    background: #fff;
    border-radius: var(--r-lg);
}
.key,
.codes {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    overflow-wrap: anywhere;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--s-3) var(--s-4);
    margin: 0 0 var(--s-4);
}
.codes {
    columns: 2;
    list-style: none;
    padding: var(--s-4);
}
.codes li {
    padding: 2px 0;
    break-inside: avoid;
}

/* ── The operators page: a table, a filter strip, inline controls ────────────────────────── */
.card-wide {
    width: min(1120px, 100%);
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3) var(--s-4);
    align-items: center;
    margin: var(--s-5) 0;
}
.seg-wide a {
    padding: 4px 10px;
}
.input-inline {
    width: auto;
    min-width: 220px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-base);
    line-height: var(--lh-base);
}
.table th,
.table td {
    text-align: left;
    vertical-align: top;
    padding: var(--s-3) var(--s-3);
    border-top: 1px solid var(--border);
}
.table th {
    color: var(--dim);
    font-weight: 500;
    border-top: 0;
}
.table tr.muted td {
    color: var(--dim);
}
.table .actions {
    white-space: nowrap;
}
.table .actions form {
    display: inline;
}
.roles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-4);
    align-items: center;
}
.check-inline {
    display: inline-flex;
    margin: 0;
}
.btn-inline {
    width: auto;
    margin-top: 0;
    padding: 4px 10px;
    font-size: var(--fs-base);
}
.btn-danger {
    color: var(--danger);
    border-color: var(--tint-danger-border);
    background: var(--tint-danger-bg);
}
.btn-danger:hover {
    background: color-mix(in srgb, var(--danger) 22%, var(--surface));
}
.chip-danger {
    color: var(--danger);
    background: var(--tint-danger-bg);
    border-color: var(--tint-danger-border);
}
.small {
    font-size: 12px;
}
.mono {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.surfaces {
    margin: var(--s-4) 0 0;
    padding-left: 1.2em;
    line-height: 1.8;
}
.invite .roles {
    margin: var(--s-4) 0;
}
