/* Stelport console. Tokens follow the stelport.com console theme (light, forest green, Geist); the sign-in pages
   use the site's dark "space" theme. Fonts are self-hosted: /fonts/fonts.css (SIL OFL 1.1). */
:root {
  --bg: #fff; --fg: #202220; --muted: #5d625d; --faint: #8b908b;
  --secondary: #f2f4f2; --accent: #eef1ef; --line: #e5e7e5; --input: #d7dad7; --tint: #fafbfa;
  --brand: #31653e; --brand-hover: #285533; --brand-fg: #fafdfa; --ring: #62946c;
  --sidebar: #f3f4f3; --sidebar-fg: #2b2f2c; --sidebar-active: #e4e6e4; --sidebar-line: rgba(32, 34, 32, .08);
  --ok: #31653e; --okbg: #ebf8ec; --warn: #8a5600; --warnbg: #fff5e0; --err: #be2323; --errbg: #fff1ef;
  --info: #2a5f9e; --infobg: #eef4fb; --mock: #5a46c4; --mockbg: #f1effc;
  --radius: 10px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(32, 34, 32, .05); --shadow-soft: 0 18px 48px -34px rgba(36, 52, 38, .28);
  --font: "Geist", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Space Grotesk", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand);
  color: var(--brand-fg); white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
button:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: var(--bg); color: var(--fg); border-color: var(--input); }
button.ghost:hover:not(:disabled) { background: var(--secondary); border-color: var(--input); }
button.danger { background: var(--err); border-color: var(--err); color: #fff; }
button.danger:hover:not(:disabled) { background: #a21c1c; border-color: #a21c1c; }
button.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
input, select, textarea { font: inherit; width: 100%; min-height: 34px; border: 1px solid var(--input); border-radius: var(--radius-sm);
  padding: 6px 10px; background: var(--bg); color: var(--fg); }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=color] { width: 52px; padding: 3px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
label { display: block; margin: 10px 0; font-weight: 500; font-size: 13px; }
label input, label select, label textarea { margin-top: 6px; font-weight: 400; font-size: 14px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(98, 148, 108, .2); }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.015em; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
code { font-family: var(--font-mono); font-size: 12px; background: var(--secondary); padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .boot { padding: 40px; color: var(--muted); }

/* shell: light sidebar + top bar, as in the official console */
.shell { display: flex; min-height: 100vh; }
.nav { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
  background: var(--sidebar); border-right: 1px solid var(--sidebar-line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--fg); }
.brand .logo { width: 24px; height: 24px; flex-shrink: 0; }
.brand .name { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.brand .sub { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--sidebar-fg); }
.nav a:hover { background: rgba(32, 34, 32, .05); text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: var(--fg); font-weight: 600; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.topbar .who { flex: 1; color: var(--muted); } .topbar .who strong { color: var(--fg); }
.menu-btn { display: none; }
.main { flex: 1; min-height: 0; padding: 24px; }
.banner { padding: 8px 24px; font-size: 13px; border-bottom: 1px solid transparent; }
.banner.mock { background: var(--mockbg); color: var(--mock); border-color: rgba(90, 70, 196, .15); }
.banner.warn { background: var(--warnbg); color: var(--warn); border-color: rgba(138, 86, 0, .15); }

/* building blocks */
.card { display: block; background: var(--bg); color: inherit; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
a.card:hover { text-decoration: none; border-color: var(--input); box-shadow: var(--shadow-soft); }
.card.error { color: var(--err); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 18px; padding: 1px 8px;
  border-radius: 6px; background: var(--secondary); color: #3f433f; white-space: nowrap; }
.badge.ok { background: var(--okbg); color: var(--ok); } .badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.err { background: var(--errbg); color: var(--err); } .badge.mock { background: var(--mockbg); color: var(--mock); }
.badge.brand { background: var(--accent); color: var(--brand); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { height: 38px; vertical-align: middle; background: #f8f9f8; color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:hover td { background: var(--tint); }
.empty { text-align: center; color: var(--muted); padding: 32px 10px; } .empty strong { color: var(--fg); display: block; margin-bottom: 4px; }
pre.code { background: #121812; color: #e3e8e3; font-family: var(--font-mono); padding: 12px 14px; border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-all; font-size: 12px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--fg); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); max-width: 420px; font-size: 13px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .4); }
.toast.ok { background: var(--brand); } .toast.error { background: var(--err); }
.form-error { color: var(--err); min-height: 1em; }

/* inbox: three columns */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; height: calc(100vh - 128px); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.col { overflow: auto; min-height: 0; } .col + .col { border-left: 1px solid var(--line); }
.col-head { padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.conv-item { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; cursor: pointer; }
.conv-item:hover { background: var(--tint); } .conv-item.active { background: var(--accent); border-left-color: var(--brand); }
.conv-item .preview { color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.chat-head select { width: auto; display: inline-block; min-height: 28px; padding: 2px 6px; margin: 0 8px 0 4px; }
.msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; background: var(--tint); }
.msg { max-width: 78%; padding: 9px 12px; border-radius: 12px; border: 1px solid transparent; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg.customer { align-self: flex-start; background: var(--bg); border-color: var(--line); border-bottom-left-radius: 4px; }
.msg.agent, .msg.ai, .msg.system { align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.agent { background: #e2ede4; } .msg.ai { background: var(--okbg); border-color: rgba(49, 101, 62, .14); }
.msg.system { background: #f5f3eb; color: #4a4d48; }
.msg.note { align-self: center; max-width: 90%; background: var(--warnbg); border: 1px dashed #e3b667; }
.msg.event { align-self: center; background: transparent; color: var(--muted); font-size: 12px; text-align: center; padding: 2px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.cites { font-size: 12px; margin-top: 6px; color: var(--muted); }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; background: var(--bg); }
.composer textarea { min-height: 72px; } .composer > .row { margin-top: 8px; }
.side { padding: 12px; min-height: 100%; background: var(--tint); } .side .card { padding: 14px; margin-bottom: 12px; }
.draft-text { white-space: pre-wrap; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin: 8px 0; line-height: 1.55; }
.alert { padding: 8px 12px; border-radius: var(--radius-sm); margin: 8px 16px; font-size: 13px; }
.alert.warn { background: var(--warnbg); color: var(--warn); } .alert.err { background: var(--errbg); color: var(--err); }
.alert.info { background: var(--infobg); color: var(--info); }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 14px; background: var(--secondary); border-radius: 9px; }
.tabs button { min-height: 28px; padding: 0 10px; font-size: 13px; background: transparent; color: var(--muted); border-color: transparent; }
.tabs button:hover:not(:disabled) { background: rgba(255, 255, 255, .7); color: var(--fg); border-color: transparent; }
.tabs button.on, .tabs button.on:hover:not(:disabled) { background: var(--bg); color: var(--fg); border-color: transparent; box-shadow: 0 1px 2px rgba(32, 34, 32, .12); }
.col-head .tabs { margin-bottom: 0; }
.chunk { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; white-space: pre-wrap; }
.chunk .loc { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.progress { height: 6px; margin-top: 6px; background: var(--secondary); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }
.mobile-only { display: none; }

/* sign-in pages: the dark "space" theme of stelport.com */
.auth-wrap { position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; color: #eeece7;
  font-family: var(--font-display); background: radial-gradient(900px 520px at 78% 12%, rgba(98, 80, 214, .16), transparent 62%),
  radial-gradient(1000px 560px at 12% 100%, rgba(143, 212, 163, .12), transparent 60%), #000; }
.auth-wrap::before, .auth-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.auth-wrap::before { opacity: .7; background-size: 320px 320px; background-image:
  radial-gradient(1px 1px at 24px 40px, #fff 50%, transparent 52%), radial-gradient(1px 1px at 150px 110px, #fff 50%, transparent 52%),
  radial-gradient(1.5px 1.5px at 270px 30px, #fff 50%, transparent 52%), radial-gradient(1px 1px at 90px 250px, #fff 50%, transparent 52%),
  radial-gradient(1px 1px at 230px 200px, #fff 50%, transparent 52%), radial-gradient(1.5px 1.5px at 300px 290px, #fff 50%, transparent 52%); }
.auth-wrap::after { opacity: .35; background-size: 211px 211px; background-image:
  radial-gradient(1px 1px at 60px 80px, #cfe0ff 50%, transparent 52%), radial-gradient(1px 1px at 170px 20px, #fff 50%, transparent 52%),
  radial-gradient(1px 1px at 120px 180px, #fff 50%, transparent 52%), radial-gradient(1px 1px at 10px 150px, #e7ffe9 50%, transparent 52%); }
.auth-top { position: relative; z-index: 1; display: flex; align-items: center; padding: 20px 28px; }
.auth-top .mark { display: flex; align-items: center; gap: 12px; }
.auth-top .logo { width: 26px; height: 26px; }
.wordmark { padding-left: 12px; border-left: 1px solid rgba(238, 236, 231, .45); font-size: 15px; font-weight: 500; letter-spacing: .32em; }
.auth-body { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; padding: 20px; }
.auth { width: 100%; max-width: 400px; padding: 28px; background: rgba(7, 11, 14, .82); border: 1px solid rgba(220, 233, 244, .15);
  border-radius: 8px; box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9); backdrop-filter: blur(6px); }
.auth h1 { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -.02em; margin: 0 0 6px; color: #eeece7; }
.auth p, .auth .muted { color: #a3abaf; }
.auth label { color: #eeece7; }
.auth input { min-height: 40px; background: #0b1014; border-color: rgba(220, 233, 244, .24); color: #eeece7; }
.auth input::placeholder { color: #737c81; }
.auth input:focus-visible { border-color: #8fd4a3; box-shadow: 0 0 0 3px rgba(143, 212, 163, .18); }
.auth button[type=submit] { width: 100%; min-height: 40px; margin-top: 6px; background: #ec6943; border-color: #ec6943; color: #170a05; }
.auth button[type=submit]:hover:not(:disabled) { background: #f07c59; border-color: #f07c59; }
.auth a { color: #eeece7; text-decoration: underline; text-decoration-color: rgba(238, 236, 231, .4); text-underline-offset: 3px; }
.auth .form-error { color: #ff8674; }
.auth-wrap :focus-visible { outline-color: #8fd4a3; }
.auth-foot { position: relative; z-index: 1; margin: 0; padding: 18px; text-align: center; color: #737c81;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

@media (max-width: 1100px) {
  .inbox { grid-template-columns: 260px minmax(0, 1fr); } .inbox .col.side-col { display: none; }
  .inbox.show-side .col.side-col { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: 340px; background: var(--bg); z-index: 20; box-shadow: -8px 0 32px rgba(0, 0, 0, .15); }
  .mobile-only { display: inline-flex; }
}
@media (max-width: 760px) {
  .nav { position: fixed; left: -230px; top: 0; bottom: 0; z-index: 30; transition: left .2s; }
  body.nav-open .nav { left: 0; box-shadow: 8px 0 32px rgba(0, 0, 0, .15); }
  .menu-btn { display: inline-flex; background: transparent; color: var(--fg); border-color: var(--line); }
  .topbar, .main { padding-left: 14px; padding-right: 14px; }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 110px); }
  .inbox .col.list-col { display: block; } .inbox .col.chat-col { display: none; }
  .inbox.has-active .col.list-col { display: none; } .inbox.has-active .col.chat-col { display: block; }
  .msg { max-width: 92%; }
}
