:root {
  color-scheme: dark;
  --bg: #121416;
  --surface: #1c1f22;
  --ink: #e7e4dc;
  --muted: #a39e93;
  --line: #2e3338;
  --accent: #d6a25e;
  --ok: #7dba6a;
  --warn: #d6a25e;
  --danger: #e0a0a0;
  --user: #243041;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, sans-serif;
}

a { color: var(--accent); }

button, input {
  font: inherit;
  color: inherit;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.dot.ok { background: var(--ok); }

.sep::before {
  content: "·";
  margin-right: 8px;
}

nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

nav form { margin: 0; }

nav button, .composer button, .login-card button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

nav button:hover, .composer button:hover, .login-card button:hover {
  border-color: var(--accent);
}

.chat {
  height: calc(100% - 57px);
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 16px;
}

.conv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}

.conv-bar .note { margin: 0; }

.conv-bar button, .memory-form button, .memories button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.thread {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 20px 0;
  overflow: auto;
}

.thread li {
  max-width: 38rem;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
}

.thread .user {
  margin-left: auto;
  background: var(--user);
}

.thread .jarvis {
  background: var(--surface);
  border: 1px solid var(--line);
}

.hint, .note {
  color: var(--muted);
}

#voice-hint {
  flex: 1 0 100%;
  margin: 4px 0 0;
  color: var(--text);
  font-size: 1rem;
}

.hint {
  background: transparent !important;
  padding-left: 0 !important;
}

.composer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.composer .wait {
  flex: 1 0 100%;
  margin: 0;
}

.thread .pending {
  color: var(--muted);
}

.composer input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}

.composer button {
  background: var(--accent);
  color: #1a140c;
  border-color: var(--accent);
  font-weight: 600;
}

.login-body {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 380px);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h1, .panel h1 {
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  margin: 4px 0 20px;
}

.login-card form, .panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

label { font-size: 14px; color: var(--muted); }

.login-card input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.login-card button {
  margin-top: 8px;
  background: var(--accent);
  color: #1a140c;
  border-color: var(--accent);
  font-weight: 600;
  padding: 10px 14px;
}

.alert {
  margin: 0 0 8px;
  color: var(--danger);
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 20px;
}

.facts div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.facts dt {
  color: var(--muted);
  font-size: 13px;
}

.facts dd {
  margin: 4px 0 0;
}

.memory-form, .memories { margin: 0 0 16px; }

.memory-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-form select, .memory-form input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.memories { list-style: none; padding: 0; }

.memories li { margin: 0 0 8px; }

.memories form {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

@media (max-width: 700px) {
  .top { flex-wrap: wrap; }
  .status { order: 3; width: 100%; }
  .facts { grid-template-columns: 1fr; }
  .chat { height: auto; min-height: calc(100% - 96px); }
}
