:root {
  --bg: #f7f7fb; --panel: #ffffff; --text: #18181b; --muted: #6b6b80; --line: rgba(24, 24, 27, 0.1);
  --accent: #7c3aed; --accent-soft: rgba(124, 58, 237, 0.12); --bad: #b91c1c; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1020; --panel: #171830; --text: #ececf4; --muted: #9a9ab3; --line: rgba(236, 236, 244, 0.12);
          --accent: #a78bfa; --accent-soft: rgba(167, 139, 250, 0.16); --bad: #f87171; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 "Segoe UI", "Noto Sans Arabic", system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.brand { font-weight: 800; letter-spacing: 0.01em; }
.h { font-weight: 700; margin-bottom: 6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.problem { color: var(--bad); font-size: 13px; min-height: 1em; }
button { font: inherit; cursor: pointer; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.primary:disabled { opacity: 0.55; cursor: default; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; }
.wide { width: 100%; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-width: 0; }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
label.small { flex-direction: row; align-items: center; gap: 6px; }

.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 10px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--panel); }
.top .brand, .top .ghost { white-space: nowrap; flex-shrink: 0; }
#who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stopped { margin: 10px 16px 0; padding: 10px 12px; border: 1px solid var(--bad); color: var(--bad); border-radius: 10px; }
.tabs { display: flex; gap: 4px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
.tab { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; color: var(--text); white-space: nowrap; }
.tab.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
main { flex: 1; padding: 0 16px 16px; min-height: 0; }
.view { display: flex; flex-direction: column; gap: 12px; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rows li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.chat-view { flex-direction: row; gap: 14px; height: calc(100vh - 120px); }
.chat-list { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.chat-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-list li button { width: 100%; text-align: start; background: transparent; border: 0; border-radius: 8px; padding: 7px 9px; color: var(--text); }
.chat-list li button.on { background: var(--accent-soft); font-weight: 600; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 10px; }
.msg { max-width: 760px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); white-space: normal; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-soft); }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin-bottom: 0; }
.msg code { background: rgba(127, 127, 127, 0.15); padding: 0 4px; border-radius: 4px; }
.cite { font-size: 11px; font-weight: 700; color: var(--accent); }
.sources { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.source { font-size: 12px; color: var(--muted); border-inline-start: 2px solid var(--accent); padding-inline-start: 8px; }
.ask { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.ask-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ask .primary { align-self: flex-end; }

@media (max-width: 720px) {
  .chat-view { flex-direction: column; height: auto; }
  .chat-list { width: auto; max-height: 160px; }
  .messages { min-height: 50vh; }
}

/* The public trial's countdown (src/orgserver/trial.py). */
.trial-bar { position: sticky; top: 0; z-index: 5; padding: 8px 14px; font-size: 13px; font-weight: 600; text-align: center;
  background: var(--accent, #7c3aed); color: #fff; }
