/* The shared look of both Complexa hosts (docs/15 §3, docs/10 §5.5): tokens in both themes, base elements, buttons, the mark.
   The chat site prepends it to site.css, site-auth to auth.css. System fonts only, no external assets. */

:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --nav: #efefeb;
  --soft: #ebebe6;
  --active: #e3e3dd;
  --text: #1d1d1f;
  --muted: #6c6c70;
  --line: #e2e2dc;
  --accent: #2f6bd8;
  --accent-text: #ffffff;
  --accent-soft: #e6eefc;
  --user: #e8edf6;
  --code: #f0f0eb;
  --good: #1f8a4c;
  --warn: #a8640a;
  --danger: #c23b31;
  --trusted: #6b57c9;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 6px 20px rgb(0 0 0 / 5%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
  font: 15.5px/1.55 var(--font);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --panel: #1f1f22;
    --nav: #1a1a1d;
    --soft: #26262a;
    --active: #2e2e33;
    --text: #ececef;
    --muted: #9b9ba3;
    --line: #2e2e33;
    --accent: #6c9dff;
    --accent-text: #0d1424;
    --accent-soft: #233150;
    --user: #2a2e38;
    --code: #26262b;
    --good: #4cc27f;
    --warn: #e0a24a;
    --danger: #ff7b6e;
    --trusted: #a493ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
a {
  color: var(--accent);
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.cx-muted {
  color: var(--muted);
  font-size: 13.5px;
  margin: 2px 0;
}
.cx-boot,
.cx-empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 16px;
  margin: auto;
}
.cx-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */
.cx-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.cx-button:hover {
  background: var(--soft);
}
.cx-primary,
.cx-button.cx-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.cx-button.cx-primary:hover {
  filter: brightness(1.06);
  background: var(--accent);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.cx-round {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.cx-round:hover:not(.cx-primary) {
  background: var(--soft);
}
.cx-logo {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--trusted));
  color: #fff;
  font-weight: 700;
  font-size: 24px;
}
/* site-auth pages (login, invite, password, passkeys, trusted actions): a calm centred card, phone first. */

.cx-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.cx-auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
@media (min-width: 480px) {
  .cx-auth-card {
    padding: 32px 28px;
  }
}
.cx-auth-card > .cx-logo {
  display: grid;
  margin: 0 auto 10px;
}
.cx-auth-center {
  text-align: center;
}
.cx-auth h1 {
  margin: 4px 0 6px;
  font-size: 23px;
  line-height: 1.25;
  text-align: center;
}
.cx-auth h2 {
  margin: 0 0 10px;
  font-size: 16px;
}
.cx-auth h3 {
  margin: 18px 0 6px;
  font-size: 15px;
}
/* Low specificity, so the classed paragraphs below keep their own margins */
:where(.cx-auth) p {
  margin: 8px 0;
}

/* The status line: what happened last, announced to screen readers */
.cx-auth-status {
  margin: 0 0 18px;
  color: var(--muted);
  text-align: center;
}
.cx-auth-status[data-tone="error"] {
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.cx-auth-status[data-tone="ok"] {
  color: var(--good);
}

.cx-auth-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.cx-auth-section:first-of-type,
.cx-auth-or + .cx-auth-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.cx-auth form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cx-auth-section > form + .cx-auth-actions,
.cx-auth-section > p + form {
  margin-top: 12px;
}

/* Fields */
.cx-auth label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13.5px;
}
.cx-auth input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.cx-auth input:focus-visible {
  border-color: var(--accent);
  outline-offset: 0;
}
.cx-auth input[readonly] {
  font-family: var(--mono);
  font-size: 13px;
}

/* Buttons: secondary by default, `.cx-primary` for the one main step */
.cx-auth button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.cx-auth button:hover:not(:disabled) {
  background: var(--soft);
}
.cx-auth button.cx-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.cx-auth button.cx-primary:hover:not(:disabled) {
  background: var(--accent);
  filter: brightness(1.06);
}
.cx-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cx-auth-wide {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  font-size: 15px;
}
.cx-auth .cx-auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}
.cx-auth-or::before,
.cx-auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.cx-auth-note,
.cx-auth-footer {
  color: var(--muted);
  font-size: 13.5px;
}
.cx-auth-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.cx-auth-footer a {
  font-weight: 600;
}

/* Own passkeys and the trusted card */
.cx-auth-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.cx-auth-keys li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 13.5px;
}
.cx-auth-trusted {
  border-top: 3px solid var(--trusted);
}
.cx-auth-card-body:empty {
  display: none;
}
.cx-auth-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--soft);
}
.cx-auth-card-body p {
  margin: 0;
  overflow-wrap: anywhere;
}
.cx-auth pre {
  max-height: 260px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-radius: 10px;
  background: var(--code);
  font: 12.5px/1.45 var(--mono);
}
.cx-auth-back {
  display: block;
  margin-top: 18px;
  text-align: center;
}

.cx-auth-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}
.cx-auth-hint .cx-icon {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--good);
}
