/* TengoChat design system.
   Near-black ground, hairline borders, one warm off-white for primary actions,
   colour reserved for mood and live states. Instrument Sans for the interface,
   Instrument Serif for display lines, IBM Plex Mono for labels and numbers. */

:root {
  --bg: #0C0C0D;
  --bg-2: #101012;
  --surface: #131315;
  --raised: #18181B;
  --hover: #1E1E22;
  --line: #242428;
  --line-2: #2E2E33;
  --text: #EDECE8;
  --text-2: #A3A29D;
  --text-3: #6E6E69;
  --text-4: #49494A;
  --ink: #0C0C0D;
  --paper: #EDECE8;
  --accent: #C9B8F2;
  --danger: #E0706F;
  --ok: #8FD8C0;

  --mood-warm: #E8B27A;
  --mood-playful: #F0A0B8;
  --mood-tender: #D9B8F0;
  --mood-thoughtful: #A9B8F0;
  --mood-quiet: #9FB8B0;
  --mood-focused: #8FD8C0;
  --mood-restless: #F0C070;

  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --rail: 232px;
  --ease: 160ms cubic-bezier(.2,.7,.2,1);
}

[data-theme="light"] {
  --bg: #F6F5F1;
  --bg-2: #F1F0EB;
  --surface: #FFFFFF;
  --raised: #FBFAF7;
  --hover: #F2F1EC;
  --line: #E6E4DD;
  --line-2: #D9D7CF;
  --text: #141413;
  --text-2: #5E5E59;
  --text-3: #8E8E88;
  --text-4: #B8B7B0;
  --ink: #141413;
  --paper: #141413;
  --accent: #6B57B8;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
[data-theme="light"] .btn-primary { background: var(--ink); color: #fff; }
[data-theme="light"] .btn-primary:hover { background: #2A2A28; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 1.5px solid var(--text); outline-offset: 2px; border-radius: 3px; }

/* ------------------------------------------------------------ typography */
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
.display i, .display em { font-style: italic; }
.h1 { font-size: 40px; }
.h2 { font-size: 28px; }
.h3 { font-size: 20px; }
.lead { font-size: 17px; color: var(--text-2); line-height: 1.55; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-1);
  border: 1px solid var(--line-2); background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), color var(--ease), transform var(--ease);
  text-decoration: none;
}
.btn:hover { background: var(--hover); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--hover); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(224,112,111,.35); }
.btn-danger:hover { background: rgba(224,112,111,.08); border-color: var(--danger); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-lg { width: 46px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--r-1);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  transition: border-color var(--ease), background var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--text); }
.textarea { height: auto; min-height: 120px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A3A29D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.help { font-size: 12.5px; color: var(--text-3); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--paper); flex-shrink: 0; }
.errors { border: 1px solid rgba(224,112,111,.4); background: rgba(224,112,111,.07); color: var(--text); border-radius: var(--r-1); padding: 11px 13px; font-size: 14px; margin-bottom: 18px; }
.errors ul { margin: 0; padding-left: 18px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }

/* range sliders */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 3px; background: var(--line-2); border-radius: 999px; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: var(--paper); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--text-3); }
.range::-moz-range-track { height: 3px; background: var(--line-2); border-radius: 999px; }
.range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--text-3); }
.slider { display: grid; gap: 6px; margin-bottom: 14px; }
.slider-head { display: flex; justify-content: space-between; font-size: 13px; }
.slider-head b { font-weight: 500; }
.slider-head span { color: var(--text-2); font-family: var(--mono); font-size: 12px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13.5px; cursor: pointer;
  transition: all var(--ease);
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.on, .chip:has(input:checked) { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip.locked { opacity: .5; cursor: not-allowed; }

/* pills and status */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-mood { color: var(--mood-color, var(--text-2)); border-color: color-mix(in srgb, var(--mood-color, var(--line-2)) 45%, transparent); }
.mood-warm { --mood-color: var(--mood-warm); }
.mood-playful { --mood-color: var(--mood-playful); }
.mood-tender { --mood-color: var(--mood-tender); }
.mood-thoughtful { --mood-color: var(--mood-thoughtful); }
.mood-quiet { --mood-color: var(--mood-quiet); }
.mood-focused { --mood-color: var(--mood-focused); }
.mood-restless { --mood-color: var(--mood-restless); }
.pill-live { color: #fff; background: var(--danger); border-color: var(--danger); font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; background: var(--raised); border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--text-2); }

/* -------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14px; font-weight: 500; }
.divider { height: 1px; background: var(--line); border: 0; margin: 22px 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.cluster { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-1); border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; margin-bottom: 18px; }
.flash-ok { border-color: rgba(143,216,192,.4); }
.flash-err { border-color: rgba(224,112,111,.45); }
.flash button { margin-left: auto; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .num { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------- marketing */
.mk-nav { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.mk-nav-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 28px; }
.mk-nav-links { display: flex; gap: 22px; margin-left: 12px; font-size: 14px; color: var(--text-2); }
.mk-nav-links a:hover { color: var(--text); }
.mk-nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mk-mobile-login { display: none; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 21px; letter-spacing: .01em; color: var(--text); }
.wordmark svg { width: 20px; height: 20px; color: var(--text); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hero { padding-block: 96px 56px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(42px, 5.6vw, 72px); line-height: 1.02; }
.hero .lead { max-width: 460px; margin: 22px 0 30px; }
.hero-actions { display: flex; gap: 10px; align-items: center; }
.hero-note { margin-top: 16px; font-size: 13px; color: var(--text-3); }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 36px; padding-block: 48px 40px; } }

/* On a phone the marketing nav keeps the wordmark and one action. The rest of the
   navigation is in the page and in the footer, so a hamburger would be ceremony. */
@media (max-width: 760px) {
  .mk-nav-in { height: 56px; padding: 0 16px; gap: 10px; }
  .mk-nav-links { display: none; }
  .mk-nav-right .lang { display: none; }
  .mk-nav-right .btn-ghost { display: none; }
  .mk-nav-right .mk-mobile-login { display: inline-flex; order: -1; padding: 0 10px; }
  .wrap { padding: 0 16px; }
  .section { padding-block: 44px; }
  .section-head h2 { font-size: 26px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .mk-footer-in { gap: 12px 20px; }
  .mk-footer .spacer { display: none; }
}

.section { padding-block: 64px; border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; margin-bottom: 36px; }
.section-head h2 { font-size: 34px; }
@media (max-width: 900px) { .section-head { grid-template-columns: 1fr; gap: 12px; } }

.numbered { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.numbered li { display: grid; grid-template-columns: 72px 1fr 1.4fr; gap: 24px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.numbered .n { font-family: var(--mono); font-size: 12px; color: var(--text-3); padding-top: 4px; }
.numbered h3 { font-size: 20px; font-weight: 500; }
.numbered p { color: var(--text-2); margin: 0; }
@media (max-width: 760px) { .numbered li { grid-template-columns: 48px 1fr; } .numbered li p { grid-column: 2; } }

.pricing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.price-card { position: relative; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); display: flex; flex-direction: column; gap: 18px; }
.price-card.featured { border-color: var(--text-3); }
.price-card .amount { font-size: 40px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.price-card .amount small { font-size: 14px; color: var(--text-2); font-weight: 400; letter-spacing: 0; }
.price-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 14px; color: var(--text-2); }
.price-card li::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); margin: 0 10px 2px 0; }
@media (max-width: 900px) { .pricing { grid-template-columns: 1fr; } }

.mk-footer { border-top: 1px solid var(--line); padding: 40px 0; font-size: 13px; color: var(--text-3); }
.mk-footer-in { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: center; }
.mk-footer a:hover { color: var(--text); }
.mk-footer .spacer { flex: 1; }

/* the product visual on the landing page: a real composition, not a screenshot */
.stage-demo { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-3); overflow: hidden; border: 1px solid var(--line-2); background: #1B1721; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.stage-demo .window { position: absolute; right: 12%; top: 9%; width: 34%; height: 52%; border-radius: 4px; background: #2A2340; border: 1px solid #3A3350; box-shadow: inset 0 0 0 6px #201B2E; }
.stage-demo .window::after { content: ""; position: absolute; inset: 6px; background: radial-gradient(circle at 60% 30%, #4C4270 0, #2A2340 70%); }
.stage-demo .figure { position: absolute; left: 46%; bottom: 0; width: 46%; height: 78%; transform: translateX(-50%); }
.stage-demo .figure svg { width: 100%; height: 100%; display: block; }
.stage-demo .top { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; }
.stage-demo .caption { position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); max-width: 78%; padding: 10px 14px; border-radius: 10px; background: rgba(12,12,13,.78); border: 1px solid rgba(255,255,255,.08); font-size: 14px; text-align: center; backdrop-filter: blur(8px); }
.stage-demo .controls { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; }
.stage-demo .controls span { width: 36px; height: 36px; border-radius: 50%; background: rgba(12,12,13,.78); border: 1px solid rgba(255,255,255,.1); }
.stage-demo .controls span.end { width: 52px; border-radius: 999px; background: var(--danger); border-color: var(--danger); }
.stage-demo .pip { position: absolute; right: 14px; bottom: 66px; width: 22%; aspect-ratio: 4/3; border-radius: 8px; background: #141416; border: 1px solid rgba(255,255,255,.1); }

/* --------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { padding: 40px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg-2); }
.auth-side .quote { margin-top: auto; max-width: 440px; }
.auth-side .quote p { font-family: var(--serif); font-size: 30px; line-height: 1.2; color: var(--text); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 28px; }
.auth-foot { margin-top: 22px; font-size: 14px; color: var(--text-2); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------------------------------------------------------------- app */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; padding: 18px 14px; gap: 22px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 11px; border-radius: var(--r-1); color: var(--text-2); font-size: 14px; }
.rail-nav a:hover { background: var(--hover); color: var(--text); }
.rail-nav a.on { background: var(--raised); color: var(--text); }
.rail-nav svg { width: 17px; height: 17px; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; }
.plan-box { padding: 12px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.plan-box .between { margin-bottom: 8px; }
.meter { height: 3px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--paper); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; color: var(--text-2); flex-shrink: 0; }
.main { min-width: 0; }
.page { max-width: 1080px; padding: 34px 40px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { font-size: 30px; }
.page-head .sub { color: var(--text-2); margin-top: 6px; }
.topbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 20; }
  .topbar .wordmark { flex-shrink: 0; }
  .topbar nav { display: flex; gap: 16px; min-width: 0; margin-left: 16px; font-size: 13px; color: var(--text-2); overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex-shrink: 0; }
  .topbar nav a.on { color: var(--text); }
  .page { padding: 22px 16px 60px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* character cards */
.char-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .char-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .char-grid { grid-template-columns: 1fr; } }
.char-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden; transition: border-color var(--ease), transform var(--ease); }
.char-card:hover { border-color: var(--text-3); transform: translateY(-1px); }
.char-card .img { aspect-ratio: 4 / 5; background: var(--raised); position: relative; overflow: hidden; }
.char-card .img img { width: 100%; height: 100%; object-fit: cover; }
.char-card .img .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-4); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.char-card .body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.char-card .name { font-size: 17px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.char-card .name span { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.char-card .body .pill { justify-self: start; }
.char-card .last { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.new-card { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 100%; border: 1px dashed var(--line-2); border-radius: var(--r-2); color: var(--text-2); padding: 30px; }
.new-card:hover { border-color: var(--text-3); color: var(--text); }
.portrait-ph { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(180deg, var(--raised), var(--surface)); }
.portrait-ph svg { width: 60%; height: auto; opacity: .55; }

/* wizard */
.steps { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 28px; }
.steps .on { color: var(--text); }
.steps i { width: 22px; height: 1px; background: var(--line-2); }
.wizard { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 900px) { .wizard { grid-template-columns: 1fr; } }
.segment { display: flex; padding: 4px; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); gap: 4px; }
.segment button { flex: 1; height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); font-size: 13.5px; cursor: pointer; }
.segment button.on { background: var(--paper); color: var(--ink); }
.candidates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.candidate { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-2); overflow: hidden; border: 2px solid transparent; background: var(--raised); cursor: pointer; padding: 0; }
.candidate img { width: 100%; height: 100%; object-fit: cover; }
.candidate.on { border-color: var(--paper); }
.candidate .check { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); color: var(--ink); display: none; align-items: center; justify-content: center; }
.candidate.on .check { display: flex; }
.candidate .check svg { width: 14px; height: 14px; }
.skeleton { background: linear-gradient(90deg, var(--raised) 25%, var(--hover) 50%, var(--raised) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.preview-card { position: sticky; top: 24px; }
.preview-card .img { aspect-ratio: 4 / 5; border-radius: var(--r-2); overflow: hidden; background: var(--raised); }
.preview-card .img img { width: 100%; height: 100%; object-fit: cover; }
.preview-line { font-family: var(--serif); font-size: 21px; line-height: 1.35; margin-top: 14px; }
.notice { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2); line-height: 1.5; }
.notice svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--mood-warm); margin-top: 2px; }

/* --------------------------------------------------------------- chat */
.chat { display: grid; grid-template-columns: 1fr 300px; height: 100vh; }
.chat-main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.chat-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { font-weight: 500; font-size: 15px; display: block; }
.chat-head .who span { font-size: 12.5px; color: var(--text-2); }
.chat-head .portrait { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--raised); flex-shrink: 0; }
.chat-head .portrait img { width: 100%; height: 100%; object-fit: cover; }
.chat-log { flex: 1; overflow-y: auto; padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: min(620px, 82%); display: flex; flex-direction: column; gap: 5px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 11px 14px; border-radius: 14px; line-height: 1.55; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.msg.char .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.user .bubble { background: var(--paper); color: var(--ink); border-bottom-right-radius: 4px; }
.msg .meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); letter-spacing: .04em; display: flex; gap: 10px; align-items: center; }
.msg .meta button { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; font: inherit; }
.msg .meta button:hover { color: var(--text); }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.daysep { align-self: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.composer { padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-shrink: 0; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.composer-box:focus-within { border-color: var(--text-3); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; min-height: 24px; max-height: 160px; padding: 6px 0; line-height: 1.5; outline: none; }
.composer .hint { margin-top: 8px; font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }
.side { border-left: 1px solid var(--line); background: var(--bg-2); padding: 20px; overflow-y: auto; display: grid; gap: 18px; align-content: start; }
.side .portrait { aspect-ratio: 4 / 5; border-radius: var(--r-2); overflow: hidden; background: var(--raised); }
.side .portrait img { width: 100%; height: 100%; object-fit: cover; }
.side h4 { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 500; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; color: var(--text); text-align: right; }
.memchip { display: block; padding: 9px 11px; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); font-size: 13px; line-height: 1.45; color: var(--text-2); }
@media (max-width: 960px) { .chat { grid-template-columns: 1fr; } .side { display: none; } }
@media (max-width: 860px) {
  .chat, .chat-main { height: 100vh; height: 100dvh; }
  .chat-head { padding: 0 12px; gap: 10px; }
  .chat-head .btn span, .chat-head .btn { font-size: 13px; }
  .chat-log { padding: 18px 14px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------------- call */
body.call-body { overflow: hidden; }
.call { position: relative; height: 100vh; background: #0A0A0B; overflow: hidden; }
.call .stage { position: absolute; inset: 0; }
.call .plate { position: absolute; inset: -2%; width: 104%; height: 104%; object-fit: cover; animation: drift 48s ease-in-out infinite alternate; filter: brightness(.9); }
.call .plate-fallback { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #241F30 0%, #0F0D14 70%); }
.call canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.call video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.call video.remote.raw { display: block; }
.call video.local { display: none; }
@keyframes drift { from { transform: scale(1) translate3d(0,0,0); } to { transform: scale(1.04) translate3d(-1.2%, .8%, 0); } }
@media (prefers-reduced-motion: reduce) { .call .plate { animation: none; } }
.call .vignette { position: absolute; inset: 0; box-shadow: inset 0 0 200px rgba(0,0,0,.7); pointer-events: none; }
.call-top { position: absolute; top: 0; left: 0; right: 0; padding: 20px 24px; display: flex; align-items: flex-start; gap: 12px; }
.glass { display: inline-flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 999px; background: rgba(12,12,13,.72); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px); font-size: 13.5px; }
.glass .sep { width: 1px; height: 14px; background: rgba(255,255,255,.14); }
.call-caption { position: absolute; left: 0; right: 0; bottom: 118px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 24px; pointer-events: none; }
.call-caption .line { max-width: 680px; padding: 13px 18px; border-radius: 14px; background: rgba(12,12,13,.8); border: 1px solid rgba(255,255,255,.1); font-size: 17px; line-height: 1.5; text-align: center; backdrop-filter: blur(10px); }
.call-caption .line.you { font-size: 14px; color: var(--text-2); }
.call-pip { position: absolute; right: 24px; bottom: 118px; width: 200px; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: #141416; border: 1px solid rgba(255,255,255,.12); }
.call-pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.call-pip .lvl { position: absolute; right: 10px; bottom: 9px; display: flex; align-items: flex-end; gap: 2.5px; height: 14px; }
.call-pip .lvl i { width: 3px; border-radius: 2px; background: var(--ok); height: 4px; transition: height 90ms; }
.call-controls { position: absolute; left: 0; right: 0; bottom: 28px; display: flex; justify-content: center; align-items: center; gap: 12px; }
.cbtn { width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); background: rgba(12,12,13,.78); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(10px); transition: background var(--ease); }
.cbtn:hover { background: rgba(30,30,34,.9); }
.cbtn.off { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cbtn.end { width: 78px; border-radius: 999px; background: var(--danger); border-color: var(--danger); }
.cbtn svg { width: 22px; height: 22px; }
.call-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(8,8,9,.93); backdrop-filter: blur(22px); text-align: center; padding: 24px; }
/* Before the call connects the room is empty, so the controls, the self view and
   the status bar have nothing to act on. Hide them rather than show dead chrome. */
.call.idle .call-controls, .call.idle .call-pip, .call.idle .call-top, .call.idle .call-caption { display: none; }
.call.idle .plate { filter: brightness(.45) saturate(.7); }
.call-overlay h2 { font-family: var(--serif); font-size: 34px; }
.call-overlay p { color: var(--text-2); max-width: 420px; }
.call-overlay.hidden { display: none; }
.call-portrait { width: 132px; height: 164px; border-radius: 14px; overflow: hidden; background: var(--raised); }
.call-portrait img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 700px) {
  .call-pip { width: 96px; right: 14px; bottom: auto; top: 76px; }
  .call-caption { bottom: 108px; } .call-caption .line { font-size: 15px; }
  .call-top { padding: 14px; }
}

/* ------------------------------------------------------------- billing */
.balance { display: flex; align-items: baseline; gap: 10px; }
.balance b { font-size: 44px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.balance span { color: var(--text-2); }
.ledger td:first-child { font-family: var(--mono); font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* -------------------------------------------------------------- admin */
.admin .rail-nav a { height: 34px; font-size: 13.5px; }
.stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.stat .k { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.stat .v { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.stat .d { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 72px; }
.bars i { flex: 1; background: var(--text-3); border-radius: 2px 2px 0 0; min-height: 2px; transition: background var(--ease); }
.bars i:hover { background: var(--text); }
.bars i:last-child { background: var(--text); }
.axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }
.sec { margin-bottom: 34px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sec-head h2 { font-size: 17px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); margin-right: 6px; }
.status-active, .status-done, .status-ready, .status-ended { background: var(--ok); }
.status-queued, .status-running, .status-generating, .status-candidates, .status-open, .status-trialing, .status-past_due { background: var(--mood-warm); }
.status-failed, .status-banned, .status-canceled, .status-unpaid { background: var(--danger); }
.pagination { display: flex; gap: 6px; margin-top: 18px; }
.qr { background: #fff; padding: 12px; border-radius: 8px; display: inline-block; }
.code-box { font-family: var(--mono); font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--raised); word-break: break-all; }
details.adv summary { cursor: pointer; color: var(--text-2); font-size: 13.5px; }

/* ------------------------------------------------------------- language */
.lang { position: relative; }
.lang select { height: 32px; padding: 0 28px 0 10px; font-size: 13px; border-radius: var(--r-1); }

/* -------------------------------------------------------------- misc */
.center { text-align: center; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px } .mt-4 { margin-top: 36px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px } .mb-4 { margin-bottom: 36px }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.err-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; }
.err-page h1 { font-family: var(--serif); font-size: 48px; }

/* ------------------------------------------------------------- installer */
.install { max-width: 720px; margin: 0 auto; padding: 0 20px 80px; }
.install-head { display: flex; align-items: center; justify-content: space-between; height: 72px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.install-body { }
.install .sec { margin-bottom: 30px; }
.install .field { margin-bottom: 16px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 13.5px; line-height: 1.45; }
.tick { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.tick.ok { background: rgba(143,216,192,.15); color: var(--ok); }
.tick.bad { background: rgba(224,112,111,.15); color: var(--danger); }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 12px; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.steps-list strong { color: var(--text); font-weight: 500; }
.steps-list .mono, .install .mono { font-family: var(--mono); font-size: .92em; }
@media (max-width: 600px) { .install { padding: 0 16px 60px; } .install-head { height: 60px; margin-bottom: 22px; } }
