/*
 * XLAB IAM and XLAB ID pages. Tokens and components come from the approved canvas
 * (design/iam-canvas/shell.py). One spacing scale, one control height (--control), two palettes.
 */

/* IBM Plex, self-hosted (SIL OFL, see fonts/LICENSE). Latin, Latin Extended and Vietnamese subsets. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-sans-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-sans-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-sans-vietnamese-400.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-sans-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-sans-latin-ext-500.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-sans-vietnamese-500.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-sans-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-sans-latin-ext-600.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-sans-vietnamese-600.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-mono-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-mono-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-mono-vietnamese-400.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-mono-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-mono-latin-ext-500.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-mono-vietnamese-500.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }

/* Palettes. data-theme="system" follows the browser. */
:root {
  --bg: #F6F8F7; --surface: #FFFFFF; --surface-2: #F9FBFA; --hover: #EFF2F1; --border: #E1E6E3; --line: #EBEFED; --field: #D4DAD7;
  --ink: #131815; --ink-2: #363F3A; --muted: #5A625E;
  --accent: #047857; --accent-ink: #065F46; --accent-soft: #E7F5EE; --on-accent: #FFFFFF;
  --risk: #9A3409; --risk-bg: #FDECE2; --risk-line: #F0D3BC; --ok: #1D6B36; --ok-bg: #E6F4EA;
  --chip: #EFF2F1; --inv: #131815; --on-inv: #FFFFFF;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235A625E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --control: 40px; --control-sm: 32px; --radius: 8px; --radius-lg: 12px;
  --pad: 40px; --side: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1210; --surface: #161B18; --surface-2: #1A201D; --hover: #212824; --border: #29302C; --line: #212824; --field: #39413D;
  --ink: #E7EBE9; --ink-2: #C3CBC7; --muted: #98A29D;
  --accent: #34D399; --accent-ink: #6EE7B7; --accent-soft: #123024; --on-accent: #0B0F0D;
  --risk: #FF9F6B; --risk-bg: #3A2216; --risk-line: #5A3522; --ok: #7BD69A; --ok-bg: #16301F;
  --chip: #212824; --inv: #E7EBE9; --on-inv: #131815;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2398A29D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0E1210; --surface: #161B18; --surface-2: #1A201D; --hover: #212824; --border: #29302C; --line: #212824; --field: #39413D;
    --ink: #E7EBE9; --ink-2: #C3CBC7; --muted: #98A29D;
    --accent: #34D399; --accent-ink: #6EE7B7; --accent-soft: #123024; --on-accent: #0B0F0D;
    --risk: #FF9F6B; --risk-bg: #3A2216; --risk-line: #5A3522; --ok: #7BD69A; --ok-bg: #16301F;
    --chip: #212824; --inv: #E7EBE9; --on-inv: #131815;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2398A29D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
@media (max-width: 640px) { :root { --pad: 16px; } }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--sans); }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
/* Links never underline by default. Only inline text links (.link) underline on hover. Links that
   wrap a block (buttons, nav rows, the account block, list rows, cards, avatars) change background. */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
a.link:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; overflow-wrap: anywhere; }
h2 { font-size: 16px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 500; }
ul { margin: 0; padding: 0; list-style: none; }
code, .mono { font-family: var(--mono); font-size: 13px; }
code { overflow-wrap: anywhere; }
svg { flex: none; }
.muted { color: var(--muted); }
.sub { font-size: 13px; color: var(--muted); }
.break { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pv { width: 18px; height: 18px; display: block; flex: none; }
.with-icon { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* Brand mark */
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--inv); color: var(--on-inv); display: grid; place-items: center; }
.brand-mark svg { width: 80%; height: 80%; display: block; }
.brand-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.brand-name b { font-weight: 600; font-size: 15px; }
.brand-name small { font-size: 12px; color: var(--muted); }

/* Admin console: sidebar and main column. */
.console { display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; align-self: flex-start; width: var(--side); flex: none; min-height: 100vh; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 28px; }
.side .brand { padding: 0 8px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.navh { padding: 0 10px 6px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nav { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 40px; border-radius: var(--radius); color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.nav:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav[aria-current] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.console > main { flex: 1 1 auto; min-width: 0; padding: 32px var(--pad) 56px; }
.console > main > .page { max-width: 1240px; }

/* App picker: a menu of the clients this admin manages. */
.picker { position: relative; }
/* Space between the picker and the app's pages under it in the sidebar. */
.nav-group > .picker { margin-bottom: 12px; }
.picker > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--field); border-radius: var(--radius); font-size: 14px; font-weight: 500; color: var(--ink); background: var(--surface); cursor: pointer; list-style: none; }
.picker > summary::-webkit-details-marker { display: none; }
.picker > summary::after { content: ""; width: 14px; height: 14px; flex: none; background: var(--chevron) no-repeat center; }
.picker > summary:hover { background: var(--hover); }
.picker-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / .14); }
.picker-list a { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 6px; color: var(--ink); }
.picker-list a:hover { background: var(--hover); text-decoration: none; }
.picker-list a[aria-current] { background: var(--accent-soft); color: var(--accent-ink); }
.picker-list small { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Personal pages: top bar and one wide column. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand-mark { width: 28px; height: 28px; }
.topbar-act { display: flex; align-items: center; gap: 4px; }
.solo { max-width: 960px; margin: 0 auto; padding: 32px 20px 56px; }
@media (max-width: 640px) { .topbar { padding: 0 12px 0 16px; } .solo { padding: 24px 16px 40px; } }

/* User block and menus. */
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
.avatar.sq { border-radius: var(--radius); }
.user { display: flex; align-items: center; gap: 10px; padding: 6px; min-width: 0; }
.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.user-text b { font-size: 13px; font-weight: 500; }
.user-text span { font-size: 12px; color: var(--muted); }
.side-user { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
.user-link { flex: 1 1 auto; min-width: 0; border-radius: 8px; color: var(--ink); text-decoration: none; }
.user-link:hover { background: var(--hover); color: var(--ink); }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); width: max-content; min-width: 260px; max-width: calc(100vw - 24px); padding: 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 16px 40px rgb(0 0 0 / .16); }
.menu-up .menu-panel { right: auto; left: 0; top: auto; bottom: calc(100% + 6px); }
.menu-head { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.menu-head + .srow, .srow:first-child { border-top: 0; }

/* Segmented control. Links, because the server stores the choice. */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--hover); flex: none; }
.seg a { display: inline-flex; align-items: center; justify-content: center; height: 30px; min-width: 40px; padding: 0 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .14); }

/* Sign-in and message pages: a centered card. */
.gate { min-height: 100vh; display: flex; flex-direction: column; padding: 24px var(--pad); }
.seg-icons a { min-width: 34px; padding: 0 8px; }
.seg-icons svg { width: 16px; height: 16px; }
.flag { width: 20px; height: 14px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px; background: var(--hover); font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lang-btn::after { content: ""; width: 6px; height: 6px; margin: -3px 2px 0 2px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .15s; }
.lang-menu[open] > .lang-btn::after { transform: rotate(-135deg); margin-top: 3px; }
.lang-btn:hover { background: var(--border); }
.lang-btn:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
.lang-list { min-width: 180px; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.lang-list a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.lang-list a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.lang-list a[aria-current] { color: var(--ink); font-weight: 500; }
.lang-list a[aria-current]::after { content: ""; margin-left: auto; width: 5px; height: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.gate-prefs { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: 960px; width: 100%; margin: 0 auto; }
.gate-main { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 48px 0; }
.gate-card { width: 100%; max-width: 400px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 20px; }
.gate-card .brand-mark { width: 32px; height: 32px; }
.gate-card h1 { font-size: 22px; }
.gate-card .lead { margin-top: -12px; color: var(--ink-2); }
.gate-card > p { color: var(--ink-2); }
.gate-foot { text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 480px) { .gate { padding: 16px; } .gate-main { align-items: flex-start; padding: 32px 0; } .gate-card { padding: 24px 20px; } }

/* Page structure */
.page { display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; }
.page-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-title .hrow { gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); align-self: flex-start; }
.back:hover { color: var(--ink); }
.person { display: flex; align-items: center; gap: 16px; min-width: 0; }
.person h1 { font-size: 24px; }
.section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; min-height: 32px; }
.hrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0; }
.card.pad { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* List rows inside a card. */
.list > li { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 14px 20px; min-height: 64px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.row-main { display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.row-text > b { font-weight: 500; }
.row-act { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.list > li.top { align-items: flex-start; }
.meta { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
@media (max-width: 640px) { .list > li { padding: 14px 16px; } }

/* Label and value pairs */
.kv { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); margin: 0; font-size: 14px; }
.kv > dt, .kv > dd { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.kv > dt:first-of-type, .kv > dt:first-of-type + dd { border-top: 0; }
.kv > dt { color: var(--muted); display: flex; align-items: center; gap: 4px; padding-right: 16px; }
.kv > dd { overflow-wrap: anywhere; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.card > .kv { padding: 4px 20px; }
@media (max-width: 640px) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > dt { padding-bottom: 0; }
  .kv > dd { padding-top: 2px; border-top: 0; }
  .card > .kv { padding: 4px 16px; }
}
.uris { display: flex; flex-direction: column; gap: 4px; }
.copy-row { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.copy-row code { overflow-wrap: anywhere; }

/* Chips and badges */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; max-width: 100%; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--chip); color: var(--ink-2); vertical-align: middle; }
.chip > .label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip:has(.tip) { padding-right: 2px; }
.chip.mono { font-family: var(--mono); font-weight: 400; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.risk { background: var(--risk-bg); color: var(--risk); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip .tip-btn { width: 20px; height: 20px; margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none; height: var(--control); padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn.danger { color: var(--risk); border-color: var(--risk-line); }
.btn.danger:hover { background: var(--risk-bg); color: var(--risk); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.ghost.danger:hover { background: var(--risk-bg); }
.btn.sm { height: var(--control-sm); padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); }
.btn.ghost:disabled:hover { background: transparent; }
.btn.provider { height: 44px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; list-style: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 6px; }
.icon-btn.done { color: var(--ok); }
details[open] > summary.icon-btn { background: var(--hover); color: var(--ink); }

/* Forms */
form { margin: 0; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.form-actions { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.form-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.form-row > label { flex: 1 1 220px; }
.form-row > label.grow { flex: 3 1 280px; }
label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label > .lbl { display: inline-flex; align-items: center; gap: 4px; }
input[type=text], input[type=email], input[type=number], input[type=search], select, textarea { width: 100%; height: var(--control); min-width: 0; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 400 14px var(--sans); transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input::placeholder { color: var(--muted); }
input[readonly] { background: var(--surface-2); }
input.mono { font-family: var(--mono); font-size: 13px; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background: var(--surface) var(--chevron) no-repeat right 10px center; cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks-col { display: flex; flex-direction: column; gap: 8px; }
.check { flex-direction: row; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check:hover { background: var(--hover); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check .chip { margin-left: auto; }
.checks-col .check { min-height: 44px; }
.checks-col .check > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }

/* A destructive or rare action that opens a small form with its reason field. */
.reveal > summary { list-style: none; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal[open] > summary { background: var(--hover); }
.reveal.danger[open] > summary { background: var(--risk-bg); }
.reveal-body { margin-top: 12px; }
td .reveal[open] { min-width: min(320px, 70vw); }
td .reveal-body .form-row { justify-content: flex-end; }
.add > summary { list-style: none; display: inline-flex; }
.add > summary::-webkit-details-marker { display: none; }


/* Notices */
.note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; color: var(--ink-2); }
.note > svg { margin-top: 2px; }
.note.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.note.error { background: var(--risk-bg); border-color: var(--risk-line); color: var(--risk); }

/* Tables inside a card. They stack into rows when the card is narrow. */
.tbl { container-type: inline-size; overflow: hidden; }
.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.t th { height: 44px; padding: 0 16px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 1px solid var(--line); }
.t td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; min-width: 0; overflow-wrap: anywhere; }
.t tr:first-child td { border-top: 0; }
.t th:first-child, .t td:first-child { padding-left: 20px; }
.t th:last-child, .t td:last-child { padding-right: 20px; }
.t tbody tr:hover { background: var(--surface-2); }
.t td.act { text-align: right; white-space: nowrap; width: 1%; }
.t td.act .reveal { display: inline-block; text-align: left; }
.t td.time { white-space: nowrap; color: var(--ink-2); font-family: var(--mono); font-size: 13px; }
.cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell .row-text a { font-weight: 500; }
@container (max-width: 640px) {
  .t.stack thead { display: none; }
  .t.stack, .t.stack tbody, .t.stack tr, .t.stack td { display: block; width: auto; }
  .t.stack tr { padding: 14px 16px; border-top: 1px solid var(--line); }
  .t.stack tr:first-child { border-top: 0; }
  .t.stack td, .t.stack td:first-child, .t.stack td:last-child { padding: 3px 0; border: 0; text-align: left; }
  .t.stack td[data-label] { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 12px; align-items: baseline; }
  .t.stack td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .t.stack td.act { width: auto; padding-top: 10px; }
  .t.stack td.act .reveal { display: block; }
  .t.stack td.act .reveal-body .form-row { justify-content: flex-start; }
}
@container (max-width: 900px) {
  .t.stack-lg thead { display: none; }
  .t.stack-lg, .t.stack-lg tbody, .t.stack-lg tr, .t.stack-lg td { display: block; width: auto; }
  .t.stack-lg tr { padding: 14px 16px; border-top: 1px solid var(--line); }
  .t.stack-lg tr:first-child { border-top: 0; }
  .t.stack-lg td, .t.stack-lg td:first-child, .t.stack-lg td:last-child { padding: 3px 0; border: 0; }
  .t.stack-lg td[data-label] { display: grid; grid-template-columns: minmax(96px, 26%) minmax(0, 1fr); gap: 12px; align-items: baseline; }
  .t.stack-lg td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .t.stack-lg td:empty { display: none; }
}
.t .json { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* Tooltips (static/ui.js). Without JS the text shows on focus below the icon. */
.tip { display: inline-flex; position: relative; vertical-align: middle; flex: none; }
.tip-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -4px 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: help; }
.tip-btn:hover, .tip-btn:focus-visible, .tip-btn[aria-expanded="true"] { color: var(--ink); background: var(--hover); }
.tip-body { position: absolute; top: calc(100% + 6px); left: -4px; z-index: 60; width: max-content; max-width: min(280px, calc(100vw - 32px)); padding: 8px 10px; border-radius: var(--radius); background: var(--inv); color: var(--on-inv); font: 400 13px/1.45 var(--sans); letter-spacing: 0; text-transform: none; text-align: left; white-space: normal; visibility: hidden; pointer-events: none; box-shadow: 0 8px 24px rgb(0 0 0 / .18); }
html:not(.js) .tip-btn:focus + .tip-body { visibility: visible; }
html.js .tip-body { position: fixed; top: 0; left: 0; }
html.js .tip-body.show { visibility: visible; }
@media (max-width: 640px) {
  html.js .tip-body { top: auto; left: 16px; right: 16px; bottom: 16px; width: auto; max-width: none; padding: 12px 14px; font-size: 14px; }
}

/* Phones and small tablets: the sidebar becomes a top bar with the nav in one row. */
@media (max-width: 760px) {
  .console { flex-direction: column; }
  .side { position: static; align-self: stretch; width: auto; height: auto; min-height: 0; overflow: visible; padding: 12px var(--pad) 0; gap: 8px; border-right: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .side .brand { padding: 0; }
  .side .brand-name small { display: none; }
  .side-foot { grid-column: 2; grid-row: 1; margin: 0; flex-direction: row; }
  .side-foot .user { padding: 0; }
  .side-foot .user-text { display: none; }
  .side-nav { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)); padding: 4px var(--pad) 10px; }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-group { flex-direction: row; gap: 4px; flex: none; }
  .nav-group + .nav-group { padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--line); }
  .navh { display: none; }
  .nav { min-height: 36px; }
  .picker { min-width: 180px; }
  .nav-group > .picker { margin-bottom: 0; }
  .console > main { padding-top: 24px; }
}
@media (min-width: 761px) {
  .side-nav { display: flex; flex-direction: column; gap: 28px; }
}
@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .page { gap: 24px; }
  .card.pad { padding: 16px; }
}

/* Sign out in the sidebar: a full-width row on desktop, an icon in the phone top bar. */
.side-foot .signout { width: 100%; height: 36px; justify-content: flex-start; gap: 10px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.side-foot .signout:hover { background: var(--risk-bg); color: var(--risk); }
.side-foot form { margin: 0; padding-top: 6px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .side-foot .signout { width: 36px; padding: 0; justify-content: center; }
  .side-foot .signout span { display: none; }
  .side-foot form { padding-top: 0; border-top: 0; }
}
@media (max-width: 480px) { .hide-xs { display: none; } }

/* Navigation: a thin bar shows at once after a click, and pages cross-fade instead of flashing. */
html.nav-pending::before { content: ""; position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); animation: nav-bar 1.6s cubic-bezier(.2, .7, .3, 1) 60ms forwards; pointer-events: none; }
html.nav-pending, html.nav-pending * { cursor: progress; }
@keyframes nav-bar { to { transform: scaleX(.9); } }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
.side { view-transition-name: side; }
.topbar { view-transition-name: topbar; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html.nav-pending::before { animation: none; transform: scaleX(.6); }
}

/* Facts on sign-in cards: label above value inside a quiet box. */
.gate-card .kv { grid-template-columns: minmax(0, 1fr); padding: 2px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.gate-card .kv > dt { padding: 10px 0 0; font-size: 12px; }
.gate-card .kv > dt:not(:first-of-type) { border-top: 1px solid var(--line); }
.gate-card .kv > dd { padding: 2px 0 10px; border-top: 0; }
.copy-row.grow { display: flex; width: 100%; }
.copy-row.grow input { flex: 1 1 auto; }

/* Desktop sidebar background runs the full page height. */
@media (min-width: 761px) {
  .console { background: linear-gradient(to right, var(--surface) calc(var(--side) - 1px), var(--border) calc(var(--side) - 1px), var(--border) var(--side), var(--bg) var(--side)); }
}
.list > li.top .row-main { align-items: flex-start; }

/* Audit log: fixed columns. Long details are clamped to three lines and open on hover or focus. */
.t.audit { table-layout: fixed; }
.t.audit col.c-time { width: 116px; } .t.audit col.c-who { width: 16%; } .t.audit col.c-act { width: 168px; }
.t.audit col.c-client { width: 104px; } .t.audit col.c-reason { width: 15%; }
.t.audit td { vertical-align: top; }
.t.audit td.time { white-space: normal; }
.t.audit .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.t .json { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; border-radius: 4px; cursor: text; }
.t .json:hover, .t .json:focus { -webkit-line-clamp: unset; }
@container (max-width: 900px) { .t.audit colgroup { display: none; } .t.audit td.time { white-space: nowrap; } }
.t td[data-label] { justify-items: start; }
.list.methods > li, .list.sessions > li { flex-wrap: nowrap; }
.list.methods .row-main { flex-basis: auto; }
/* Phones: the nav row scrolls sideways, so the picker list hangs from the header instead of the row. */
@media (max-width: 760px) {
  .side { position: relative; z-index: 20; }
  .picker { position: static; }
  .picker-list { left: var(--pad); right: var(--pad); top: calc(100% + 4px); max-width: 420px; }
}
.form-row.search { flex-wrap: nowrap; }
.form-row.search > label { flex: 1 1 auto; }

/* Browser surfaces */
html { scrollbar-color: var(--field) transparent; }
input, textarea { caret-color: var(--accent); }
/* Copy buttons show a check for a moment after copying. */
[data-copy] svg + svg { display: none; }
[data-copy].done svg:first-child { display: none; }
[data-copy].done svg + svg { display: block; }
/* Tooltip buttons keep a 40px touch target. */
.tip-btn { position: relative; }
.tip-btn::after { content: ""; position: absolute; inset: -8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.meta > span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Smooth preference changes (ui.js). Theme colors fade. A language change dims the page while the new text loads. */
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after { transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease !important; }
html.swapping main, html.swapping .page { opacity: .55; transition: opacity .12s ease; }
html.swapping { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after { transition: none !important; }
  html.swapping main, html.swapping .page { transition: none; }
}

/* API tokens: a new token is shown once in a highlighted block. */
.token-new { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent-ink); }
.token-new > .hrow b { font-weight: 600; }
.token-new > p { font-size: 13px; color: var(--ink-2); }
.token-value { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.token-value code { flex: 1 1 auto; min-width: 0; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
/* Rows align to the top. The revoke button (32px) sits on the first text line. */
.t.tokens td { vertical-align: top; }
.t.tokens td.act { padding-top: 9px; }
.t.tokens td:first-child { min-width: 168px; }
@container (max-width: 640px) {
  .t.tokens td.act { padding-top: 8px; }
  .t.tokens td.act .btn.ghost { margin-left: -12px; }
}
.t.tokens .row-text b { font-weight: 500; }
@media (max-width: 640px) { .token-new { padding: 14px 16px; } }

/* Consent page (sign-in): the app, what it receives, the account, Cancel and Allow. */
.consent .app-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.consent .app-head .avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.consent .app-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.consent .app-head h1 { font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.consent > p { margin: 0; color: var(--ink-2); }
.consent > p.sub { color: var(--muted); }
.consent-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--border); }
.consent-list > li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.consent-list > li > span:last-child { padding-top: 4px; min-width: 0; }
.consent-ic { flex: none; width: 28px; height: 28px; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.consent-list > li.risk .consent-ic { background: var(--risk-bg); color: var(--risk); }
.consent .who { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.consent .who .row-text b { font-size: 13px; }
.consent .who .row-text .sub { font-size: 12px; }
.consent .who .btn { flex: none; }
.btn-pair { display: flex; gap: 8px; }
.btn-pair > .btn { flex: 1 1 0; height: 44px; }
.consent-foot { margin: 0; font-size: 12px; color: var(--muted); }

/* Account page: what an app receives. */
.shared { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.shared .tip-btn { margin: 0; }

/* Styled select (static/ui.js). Looks like the language menu. The native select stays in the form
   for the value and for browsers without JavaScript. */
.sel { position: relative; display: flex; width: 100%; min-width: 0; }
.sel > .sel-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.sel-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: var(--control); padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 400 14px var(--sans); text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.sel-btn::after { content: ""; flex: none; width: 6px; height: 6px; margin: -3px 2px 0 auto; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .15s; }
.sel-btn[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 3px; }
.sel-btn:hover { border-color: var(--muted); }
.sel-btn:focus-visible, .sel-btn[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.sel-btn:disabled { cursor: default; opacity: .6; }
.sel-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-panel { position: fixed; z-index: 60; display: flex; flex-direction: column; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 16px 40px rgb(0 0 0 / .16); animation: sel-in .12s ease-out; }
.sel-panel.up { animation-name: sel-in-up; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sel-in-up { from { opacity: 0; transform: translateY(4px); } }
.sel-panel input.sel-search { flex: none; height: 34px; margin: 0 0 4px; padding: 0 10px 0 32px; border-color: var(--border); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='%2398A29D' stroke-width='1.5'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%2398A29D' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 11px center; font-size: 14px; }
.sel-panel input.sel-search:focus-visible { box-shadow: none; }
.sel-search::-webkit-search-cancel-button { display: none; }
.sel-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; outline: none; }
.sel-opt { flex: none; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; cursor: pointer; white-space: nowrap; user-select: none; }
.sel-opt.active { background: var(--hover); color: var(--ink); }
.sel-opt[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.sel-opt[aria-disabled="true"] { opacity: .5; cursor: default; }
.sel-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sel-opt::after { content: ""; flex: none; width: 5px; height: 10px; margin-left: auto; border: solid transparent; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.sel-opt[aria-selected="true"]::after { border-color: currentColor; }
.sel-empty { padding: 9px 10px; color: var(--muted); font-size: 14px; }

/* Invite expiry: the days field shows only while "Custom" is picked. Works without JavaScript. */
.inv-days { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; min-width: 0; }
.inv-days > label { flex: 1 1 auto; }
.inv-days > .inv-custom { display: none; flex: 0 0 112px; }
.inv-days:has(select option[value="custom"]:checked) > .inv-custom { display: flex; }

/* Avatars with a picture: the image covers the initials. Fixed size, so nothing moves while it loads. */
.avatar.pic { position: relative; overflow: hidden; }
.avatar.pic > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* A hairline over the picture, so white or pale pictures keep their edge on light and dark surfaces. */
.avatar.pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); pointer-events: none; }

/* Account chooser on the sign-in cards. Each row is a full-width button. Remove sits on its right edge. */
.chooser { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chooser-h { font-size: 13px; line-height: 1.4; font-weight: 500; color: var(--muted); }
.chooser-h.other { margin-bottom: -10px; }
.chooser-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chooser-row { position: relative; display: flex; align-items: center; min-width: 0; border-top: 1px solid var(--line); }
.chooser-row:first-child { border-top: 0; }
.chooser-pick { display: flex; flex: 1 1 auto; min-width: 0; }
.chooser-btn { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; min-height: 60px; padding: 10px 48px 10px 12px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color .12s; }
.chooser-row:first-child .chooser-btn { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.chooser-row:last-child .chooser-btn { border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.chooser-row:only-child .chooser-btn { border-radius: calc(var(--radius) - 1px); }
.chooser-btn:hover { background: var(--hover); }
.chooser-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chooser-btn .row-text b { font-weight: 500; }
.chooser-btn .chip.sm { height: 20px; padding: 0 6px; font-size: 11px; flex: none; }
.chooser-btn .row-text .sub { line-height: 1.35; }
.chooser-row[data-live="0"] .avatar { opacity: .6; }
.chooser-list:not(.manage) .chooser-btn { padding-right: 12px; }
.chooser-extra .chooser-btn { color: var(--ink); text-decoration: none; }
.chooser-ic { background: var(--surface-2); color: var(--ink-2); }
.chooser-remove { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.chooser-remove .icon-btn:focus-visible { outline-offset: 0; }

/* Footer of the "On this browser" card. */
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.foot-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.foot-act form { margin: 0; }

/* Apps on /account: one row per app. The name link covers the row, so the whole row opens the app
   page. Open sits above the link. */
.list.apps > li { position: relative; flex-wrap: nowrap; transition: background-color .12s; }
.list.apps > li:hover { background: var(--hover); }
.list.apps > li:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); border-top-right-radius: calc(var(--radius-lg) - 1px); }
.list.apps > li:last-child { border-bottom-left-radius: calc(var(--radius-lg) - 1px); border-bottom-right-radius: calc(var(--radius-lg) - 1px); }
.list.apps .row-main { flex: 1 1 auto; }
.list.apps .row-act { position: relative; z-index: 1; flex-wrap: nowrap; gap: 12px; }
.row-link { color: var(--ink); font-weight: 500; }
.row-link:hover { color: var(--ink); text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:focus-visible { outline: none; }
.list.apps > li:has(.row-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-chev { display: inline-flex; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--field); }
.status.on { color: var(--ink-2); }
.status.on::before { background: var(--ok); }

/* App page */
.app-detail { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.app-head { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.app-head .person > .page-title { flex: 1 1 auto; }
.app-head .person > .btn { flex: none; }
.list.kv-list > li { justify-content: space-between; flex-wrap: nowrap; min-height: 52px; padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
.list.kv-list .hrow { flex-wrap: wrap; }
.key { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }

/* Sign-in methods: a provider that is not linked yet. */
.list.methods > li.unlinked .row-text > b { font-weight: 500; }
.list.methods > li.unlinked .meta { color: var(--muted); }
.provider-blank { width: 18px; height: 18px; flex: none; }
@media (max-width: 480px) {
  .list.kv-list > li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .list.apps .row-chev { display: none; }
}

/* Profile form */
.avatar.xl { width: 72px; height: 72px; font-size: 22px; }
.profile-form { display: flex; flex-direction: column; gap: 12px; }
.avatar-edit { display: flex; align-items: center; gap: 20px; min-width: 0; }
.avatar-preview { display: inline-flex; flex: none; }
.avatar-preview img.preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-pick { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; min-width: 0; }
.pic-opts { display: flex; align-items: center; gap: 8px; }
.pic-opt { position: relative; display: inline-flex; flex-direction: row; cursor: pointer; border-radius: 50%; }
.pic-opt .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); transition: box-shadow .12s; }
.pic-opt:hover .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--muted); }
.pic-opt input:checked + .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.pic-opt input:focus-visible + .avatar { outline: 2px solid var(--accent); outline-offset: 5px; }
.file-btn { position: relative; flex-direction: row; color: var(--ink); }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-error { display: block; min-height: 18px; margin-top: 2px; font-size: 12.5px; font-weight: 400; line-height: 18px; color: var(--risk); }
.field-error.muted { color: var(--muted); }
.avatar-field .field-error { margin-top: 8px; }
input[aria-invalid="true"] { border-color: var(--risk); }
.input-prefix { position: relative; display: flex; }
.input-prefix > span { position: absolute; left: 12px; top: 0; bottom: 0; display: flex; align-items: center; color: var(--muted); font-weight: 400; font-size: 14px; pointer-events: none; }
.input-prefix > input { padding-left: 28px; }
input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
@media (max-width: 480px) { .avatar-edit { align-items: flex-start; gap: 16px; } }

/* Invite notes: the inviter's text, kept as written. Long notes wrap. In the invite list they clamp to
   three lines and open on hover. */
.note-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--ink-2); }
.t td.note-cell { min-width: 140px; max-width: 280px; }
.t td.note-cell .note-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.t td.note-cell:hover .note-text { -webkit-line-clamp: unset; }
@container (max-width: 640px) { .t td.note-cell { max-width: none; } }

/* Admin view button next to the account block (super admins). Its name shows on hover and focus. */
.side-user .admin-view { position: relative; width: 40px; height: 40px; color: var(--ink-2); }
.side-user .admin-view:hover { background: var(--hover); color: var(--ink); }
.admin-view::after { content: attr(data-label); position: absolute; z-index: 50; right: 0; bottom: calc(100% + 6px); padding: 6px 10px; border-radius: var(--radius); background: var(--inv); color: var(--on-inv); font: 500 12px/1.3 var(--sans); white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s; }
.admin-view:hover::after, .admin-view:focus-visible::after { opacity: 1; visibility: visible; }
@media (max-width: 760px) {
  .side-user .admin-view { width: 36px; height: 36px; }
  .admin-view::after { top: calc(100% + 6px); bottom: auto; }
}
/* Admin view: the link back to the apps sits above its group. */
.nav.nav-back { color: var(--muted); }
.nav.nav-back:hover { color: var(--ink); }
.admin-mode .side .brand-name small { color: var(--accent-ink); font-weight: 500; }

/* Super admins: a blocked action keeps its place with the reason in a tooltip. A search with no match explains what to do. */
.t td.act .act-blocked { display: inline-flex; justify-content: flex-end; }
.empty.empty-left { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.empty.empty-left b { color: var(--ink); font-weight: 500; }
@container (max-width: 640px) { .t.stack td.act .act-blocked { justify-content: flex-start; } }
