:root {
  --navy: #1b2a6b;
  --navy-deep: #0e1640;
  --slate: #708090;
  --line: #e2e8f0;
  --bg: #f4f6f8;
  --danger: #9f1239;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: #1e293b;
}

button, input, textarea { font: inherit; }

.app {
  min-height: 100%;
}

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

.card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 12px 40px rgba(14, 22, 64, 0.08);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.35rem;
  margin: 0 0 8px;
}

.brand span { color: var(--slate); font-weight: 600; }

.lede {
  margin: 0 0 20px;
  color: #475569;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  background: white;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: 2px solid rgba(27, 42, 107, 0.25);
  border-color: var(--navy);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--navy);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: var(--navy);
  border: 1px solid #cbd5e1;
}

button.ghost {
  background: transparent;
  color: var(--navy);
  padding-inline: 8px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.recaptcha { margin-top: 14px; }

.notice, .error {
  margin-top: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.error { color: var(--danger); }

.shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.workspace {
  min-height: 0;
  display: grid;
}

.workspace.owner {
  grid-template-columns: 1fr;
}

.list, .conversation {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
}

.list { border-right: 1px solid var(--line); }

.thread-button {
  width: 100%;
  text-align: left;
  background: white;
  color: inherit;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 16px;
}

.thread-button.active { background: #eef2ff; }

.thread-button strong { display: block; }

.preview, .meta {
  color: var(--slate);
  font-size: 0.85rem;
  font-weight: 400;
}

.preview {
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: min(520px, 85%);
  padding: 10px 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}

.bubble.out {
  margin-left: auto;
  background: var(--navy);
  color: white;
  border-color: transparent;
}

.bubble .meta { margin-top: 6px; }
.bubble.out .meta { color: #c7d2fe; }

.composer {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: white;
}

.composer-note {
  margin: 0 0 8px;
  color: var(--slate);
  font-size: 0.85rem;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--slate);
  max-width: 280px;
  line-height: 1.5;
}

.pane-hidden { display: none !important; }

@media (min-width: 860px) {
  .workspace.owner { grid-template-columns: 320px 1fr; }
  .workspace.owner .list,
  .workspace.owner .conversation { display: flex !important; }
}
