/* kordi.ai log in, sign up and account pages.
 * Loaded after research-preview/public/styles.css and assets/public/theme.css,
 * and only by these pages. The warm neutral system of the public pages: an
 * off-white ground, white surfaces, soft hairlines, black actions and a warm
 * grey text scale. Red is kept for errors only. */

@font-face { font-family: Geist; src: url("../../research-preview/public/assets/fonts/geist-400.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Geist; src: url("../../research-preview/public/assets/fonts/geist-500.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Geist; src: url("../../research-preview/public/assets/fonts/geist-600.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --paper: #f7f6f2;
  --paper-alt: #eeede9;
  --surface: #fff;
  --ink: #1c1d1b;
  --muted: #6d6963;
  --faint: #8a867f;
  --rule: #e3e2de;
  --rule-strong: #d3d1cb;
  --cardinal: #111210;
  --deep-red: #000;
  --botanical: #8a867f;
  --button-ink: #f7f6f2;
  --selected: #eeede9;
  --error: #d93036;
  --error-bg: #fff5f5;
  --error-rule: #f7d4d6;
  --display: Geist, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: Geist, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

[hidden] { display: none !important; }
body { background: var(--paper); color: var(--ink); }
a { color: var(--ink); text-decoration: none; }
a:hover { color: #000; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Buttons: black primary, white secondary with a grey hairline. */
.btn { gap: 8px; border-radius: 6px; font-weight: 500; letter-spacing: 0; transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
.btn:hover, .btn:active, .btn:hover > span { transform: none; }
.btn:not(.secondary) { background: var(--ink); border-color: var(--ink); color: var(--button-ink); }
.btn:not(.secondary):hover { background: #2e2d2a; border-color: #2e2d2a; color: var(--button-ink); }
.btn.secondary { background: var(--surface); border-color: var(--rule); color: var(--ink); }
.btn.secondary:hover { background: var(--paper); border-color: var(--rule-strong); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .mark, .btn .x-ic { width: 16px; height: 16px; flex: none; }

/* Text buttons that read as links. */
.x-linkbtn { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; }
.x-linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.registration-back { display: block; width: fit-content; color: var(--muted); font-size: .8125rem; }
.registration-back:hover { color: var(--ink); }

/* "or" divider on the hairline. */
.x-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .75rem; }
.x-or::before, .x-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Fields. */
.registration-form { display: grid; gap: 16px; }
.registration-field { display: grid; gap: 6px; }
.registration-field label { color: var(--ink); font-size: .8125rem; font-weight: 500; }
.registration-field input, .registration-field textarea { width: 100%; min-width: 0; border: 1px solid var(--rule); border-radius: 6px; padding: 0 12px; background: var(--surface); color: var(--ink); font: 400 .9375rem/1.5 var(--body); transition: border-color 120ms ease, box-shadow 120ms ease; }
.registration-field input { height: 40px; }
.registration-field textarea { min-height: 112px; padding: 10px 12px; resize: vertical; }
.registration-field input:hover, .registration-field textarea:hover { border-color: var(--rule-strong); }
.registration-field input:focus, .registration-field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px #0000000f; }
.registration-field input:user-invalid, .registration-field textarea:user-invalid { border-color: var(--error); }
.registration-field input[readonly] { background: var(--paper); color: var(--muted); }
.registration-field input[readonly]:hover { border-color: var(--rule); }
.registration-field .field-help { margin: 0; color: var(--faint); font-size: .75rem; line-height: 1.5; }
.registration-field .field-help a { color: var(--ink); font-weight: 500; }
.registration-status[role="alert"] { margin: 0; padding: 10px 12px; border: 1px solid var(--error-rule); border-radius: 6px; background: var(--error-bg); color: var(--error); font-size: .8125rem; line-height: 1.5; }

/* Cards and rows. */
.x-card { padding: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
.x-card h2, .x-card h3 { margin: 0; color: var(--ink); font-size: .875rem; font-weight: 500; line-height: 1.45; letter-spacing: -.005em; }
.x-card p { margin: 2px 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
.x-card .x-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.x-card .registration-form { margin-top: 12px; }
.x-card-row { display: flex; align-items: center; gap: 12px; }
.x-grow { flex: 1; min-width: 0; }
.x-card-row .btn { margin: 0; min-height: 32px; padding: 4px 12px; font-size: .8125rem; white-space: nowrap; }
.x-meta { flex: none; color: var(--faint); font-size: .8125rem; white-space: nowrap; }
.x-list { padding: 0; }
.x-list > .x-card-row { padding: 14px 20px; }
.x-list > .x-card-row:not([hidden]) ~ .x-card-row { border-top: 1px solid var(--rule); }
.x-sep:not(:empty)::before { content: " · "; }
.is-due { color: var(--ink); font-weight: 500; }

/* Leading marks: grey initials chips, the bird, or a device icon. */
.x-av, .x-tile { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--paper-alt); color: var(--ink); font-size: .75rem; font-weight: 500; }
.x-tile, .x-av.is-plain { border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); }
.x-tile[data-account] { border: 0; background: var(--paper-alt); }
.x-av svg { width: 18px; height: 18px; color: var(--ink); }
.x-tile img { width: 20px; height: 20px; }

/* Role and status labels. */
.x-tag { flex: none; display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--muted); font-size: .75rem; font-weight: 500; white-space: nowrap; }

/* Notices beside account rows. */
.x-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .8125rem; }
.x-status span { flex: 1 1 260px; }
.x-status .btn { margin: 0; min-height: 32px; padding: 4px 12px; font-size: .8125rem; }

/* Signed-in header: a grey initials chip in place of Log in / Sign up. */
.mast .x-nav-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 32px; border-radius: 50%; background: var(--paper-alt); color: var(--ink); font-size: .75rem; font-weight: 500; text-decoration: none; }
.mast .x-nav-avatar:hover { background: var(--rule); color: var(--ink); text-decoration: none; }
.mast nav a[aria-current="page"] { color: var(--ink); }

/* One-time code. */
.x-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 6px 0 14px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); font: 500 1.125rem var(--body); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.x-code > span { min-width: 0; overflow-wrap: anywhere; }
.x-code.is-long { padding-block: 8px; font-size: .8125rem; letter-spacing: 0; }
.x-code .btn { margin: 0; min-height: 32px; padding: 4px 12px; font-size: .8125rem; letter-spacing: 0; }
.x-code-card .x-code-for { margin: 0 0 12px; color: var(--ink); font-size: .8125rem; font-weight: 500; }
.x-code-card p.x-expiry { margin-top: 4px; color: var(--faint); font-size: .75rem; }

/* Log in, sign up and the app hand-off: a small wordmark, one centred white
 * card with a soft shadow, black and outline pill buttons, and one quiet
 * legal line at the very bottom. */
body.x-auth-page { min-height: 100vh; display: flex; flex-direction: column; }
.x-auth-mast { min-height: 64px; justify-content: flex-start; }
.interior-page .x-auth-mast .brand img { width: 32px; height: 32px; }
.interior-page .x-auth-mast .brand span { font-size: 1.5rem; font-weight: 600; letter-spacing: -.03em; }
.x-auth { flex: 1; display: flex; flex-direction: column; align-items: center; padding-block: clamp(24px, 8vh, 88px) 32px; }
.x-auth-card { width: min(100%, 400px); padding: 40px 32px 32px; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 2px 6px #0000000a, 0 12px 40px #0000000d; }
.interior-page .x-auth-card h1 { margin: 0 0 28px; color: var(--ink); font-size: 1.625rem; font-weight: 600; line-height: 1.25; letter-spacing: -.035em; text-align: center; }
.interior-page .x-auth-card h1:has(+ .x-lede:not([hidden])) { margin-bottom: 8px; }
.x-auth .x-lede { margin: 0 0 24px; color: var(--muted); font-size: .875rem; text-align: center; }
.x-auth .btn { border-radius: 999px; }
.x-auth .x-social { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.x-auth .x-social .btn, .x-auth .registration-form .btn { width: 100%; min-height: 44px; margin: 0; padding: 10px 20px; justify-content: center; font-size: .875rem; }
.x-auth .registration-form > .btn[type="submit"] { margin-top: 4px; }
.x-auth .registration-field input { height: 44px; padding: 0 18px; border-radius: 999px; }
.x-auth .registration-field label { padding-left: 2px; }
.x-auth .registration-status[role="alert"] { border-radius: 12px; }
.x-auth .x-or { margin: 4px 0; }
.x-auth .x-sent { margin: -12px 0 4px; color: var(--muted); font-size: .8125rem; line-height: 1.6; text-align: center; }
.x-auth .x-sent span { color: var(--ink); font-weight: 500; }
.x-auth .account-switch { margin: 24px 0 0; color: var(--muted); font-size: .8125rem; text-align: center; }
.x-auth .account-switch a { color: var(--ink); font-weight: 500; }

/* The account chooser: the signed-in account as one bordered row. */
.x-chooser { gap: 10px; }
.x-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease; }
.x-choice:hover { background: var(--paper); border-color: var(--rule-strong); }
.x-choice:disabled { opacity: .6; cursor: progress; }
.x-choice .x-grow { display: grid; }
.x-choice-name { overflow: hidden; color: var(--ink); font-size: .875rem; font-weight: 500; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.x-choice-email { overflow: hidden; color: var(--muted); font-size: .8125rem; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.x-chev { flex: none; width: 16px; height: 16px; color: var(--faint); }
.x-chooser .x-or { margin: 6px 0; }

.x-auth-foot { display: block; padding: 20px 16px 28px; border: 0; text-align: center; }
.x-auth-foot p { margin: 0; color: var(--faint); font-size: .75rem; line-height: 1.5; }
.x-auth-foot a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 2px; }
.x-auth-foot a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* The hand-off: a spinner while Kordi opens, then a quiet fallback. */
.x-opening { display: grid; justify-items: center; gap: 20px; padding-block: 4px; }
.interior-page .x-opening h1 { margin: 0; }
.x-spinner { width: 24px; height: 24px; border: 2px solid var(--rule); border-top-color: var(--ink); border-radius: 50%; animation: x-spin 700ms linear infinite; }
@keyframes x-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .x-spinner { animation-duration: 2.4s; } }
.x-done .x-quiet { margin: -16px 0 0; color: var(--muted); font-size: .8125rem; text-align: center; }
.x-done > .registration-status[role="alert"] { margin-top: 16px; }
.x-done .registration-back { margin: 12px auto 0; }
.x-done .x-confirm, .x-done .x-code-card { padding: 16px; background: var(--paper); }
.x-done .x-confirm h2 { font-size: .875rem; text-align: center; }
.x-done .x-confirm .x-actions { justify-content: center; }
.x-done .x-confirm .x-actions .btn { min-height: 36px; padding: 6px 16px; font-size: .8125rem; }

/* Account settings: a side column (the signed-in person and the section
 * links) beside a compact title and grouped cards of rows. */
.x-settings { max-width: 1080px; min-height: calc(100vh - 80px); display: grid; grid-template-columns: 216px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "side head" "side body"; column-gap: 56px; padding-block: 40px 96px; }
.x-side { grid-area: side; align-self: start; position: sticky; top: 24px; display: grid; gap: 12px; min-width: 0; }
.x-me { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 10px 16px; border-bottom: 1px solid var(--rule); }
.x-me p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-me-name { color: var(--ink); font-size: .875rem; font-weight: 500; line-height: 1.4; }
.x-me-email { color: var(--faint); font-size: .75rem; line-height: 1.4; }
.x-side nav { display: grid; align-items: stretch; gap: 2px; }
.x-side nav a { display: flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 6px; color: var(--muted); font-size: .875rem; line-height: 1.3; text-decoration: none; transition: background-color 120ms ease, color 120ms ease; }
.x-side nav a:hover { color: var(--ink); background: var(--selected); text-decoration: none; }
.x-side nav a[aria-current] { color: var(--ink); background: var(--selected); font-weight: 500; }

.x-head { grid-area: head; display: grid; align-content: start; gap: 4px; margin-bottom: 24px; }
.interior-page .x-head h1 { max-width: none; color: var(--ink); font-size: 1.5rem; font-weight: 600; line-height: 1.3; letter-spacing: -.035em; }
.x-head .registration-intro { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.6; }

.x-settings .x-account-body { grid-area: body; display: grid; align-content: start; gap: 12px; min-width: 0; max-width: 720px; }
.x-settings .x-section-label { margin: 20px 0 -2px; color: var(--ink); font-size: .8125rem; font-weight: 500; line-height: 1.4; letter-spacing: 0; }
.x-settings .x-section-label:first-child { margin-top: 0; }
.x-settings .x-card.x-card-row, .x-settings .x-list > .x-card-row { min-height: 64px; padding: 14px 20px; }
.x-settings .x-profile { padding: 20px; gap: 14px; }
.x-settings .x-profile .x-av { width: 48px; height: 48px; font-size: .875rem; }
.x-settings .x-profile h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.02em; }

/* Join flow inside the settings column. */
.x-join .x-account-body { max-width: 560px; }
.x-join .x-card .x-actions .btn { min-height: 36px; padding: 6px 14px; font-size: .8125rem; }
.x-join .x-card > p { margin-top: 12px; }
.x-join .registration-form .btn { justify-self: start; min-height: 36px; margin: 4px 0 0; padding: 6px 16px; font-size: .8125rem; }
.x-join .x-or.x-gap { margin: 4px 0; }
.x-join .x-account-body > .registration-intro { margin: 0; color: var(--muted); font-size: .875rem; }
.x-join .registration-back { margin: 12px 0 0; }

@media (max-width: 900px) {
 .x-settings { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "side" "head" "body"; padding-block: 16px 64px; }
 .x-side { position: static; margin-bottom: 24px; }
 .x-me { display: none; }
 .x-side nav { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding-bottom: 12px; border-bottom: 1px solid var(--rule); scrollbar-width: none; }
 .x-side nav a { flex: none; min-height: 32px; padding: 0 12px; }
 .x-settings .x-account-body { max-width: none; }
 .x-head { margin-bottom: 20px; }
 .interior-page .x-head h1 { font-size: 1.375rem; }
}

@media (max-width: 520px) {
 .x-settings { padding-inline: 16px; }
 .x-settings .x-card { padding: 16px; }
 .x-settings .x-list { padding: 0; }
 .x-settings .x-card.x-card-row, .x-settings .x-list > .x-card-row { min-height: 60px; padding: 12px 16px; }
 .x-settings .x-profile { padding: 16px; }
 .x-join .x-card .x-actions .btn { flex: 1 1 100%; justify-content: center; }
 .x-auth { padding: 16px 16px 32px; }
 .x-auth-card { padding: 24px 0 0; background: none; border: 0; box-shadow: none; }
}

/* Show or hide password. */
.x-password { position: relative; }
.registration-field .x-password input, .x-auth .registration-field .x-password input { padding-right: 46px; }
.x-password input::-ms-reveal { display: none; }
.x-password-toggle { position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: #888; cursor: pointer; transform: translateY(-50%); }
.x-password-toggle:hover { color: #111; background: #f2f2f2; }
.x-password-toggle:focus-visible { outline: 2px solid #111; outline-offset: 1px; }
/* Screen reader only text, such as the live region that announces Copied. */
.x-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Security: inline change panels, device actions */
.x-list > .x-panel { display: block; padding-block: 16px 20px; }
.x-panel .registration-form { max-width: 400px; }
.x-panel .x-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.x-panel .x-actions .btn { margin: 0; min-height: 36px; padding: 6px 14px; font-size: .8125rem; }
.x-code-field { display: flex; gap: 8px; }
.x-code-field input { flex: 1; }
.x-code-field .btn { margin: 0; min-height: 40px; padding: 6px 14px; font-size: .8125rem; white-space: nowrap; }
.x-sent-line { margin: 0; color: var(--muted); font-size: .8125rem; }
.x-sent-line span { color: var(--ink); font-weight: 500; }
.x-note { margin: 0; color: var(--muted); font-size: .8125rem; }
.x-row-actions { display: flex; justify-content: flex-end; }
.x-row-actions .btn { margin: 0; min-height: 32px; padding: 4px 12px; font-size: .8125rem; }

/* The server is down or in maintenance: one plain line replaces the page. */
body[data-unavailable] [data-unavailable-box] > :not(.x-unavailable),
body[data-unavailable] .x-auth-foot { display: none !important; }
.x-unavailable { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.6; text-align: center; }
.x-settings > .x-unavailable { grid-area: 1 / 1 / -1 / -1; align-self: center; justify-self: center; }
