/* Invyt M0: plain and functional, dark first. The real UI is M2. */
:root {
  --bg: #111418;
  --surface: #1a1f25;
  --line: #2a313a;
  --text: #e6e9ed;
  --muted: #98a2ad;
  --accent: #6fa8ff;
  --danger: #ff8a8a;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --line: #d9dee4;
    --text: #15191e;
    --muted: #5d6773;
    --accent: #1f5fd1;
    --danger: #b3261e;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.bar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { flex: 1; min-height: 0; display: flex; }
.panel { margin: 40px auto; padding: 0 16px; width: 100%; max-width: 420px; }
h1 { font-size: 22px; margin: 0 0 12px; }
.note { color: var(--muted); }
.error { color: var(--danger); }

.providers { display: grid; gap: 10px; margin-top: 16px; }
.button, button {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { border-color: var(--accent); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); }
input, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, .button:focus, button:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chat { flex: 1; display: flex; min-height: 0; width: 100%; }
.side { width: 220px; flex: none; padding: 14px 16px; border-right: 1px solid var(--line); }
.org { font-weight: 700; }
.group { color: var(--muted); margin-top: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.channels { list-style: none; margin: 6px 0 0; padding: 0; }
.channels li { padding: 4px 0; }
.channels li.current { color: var(--accent); font-weight: 600; }

.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.pane-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.channel-name { font-weight: 600; }
.status { color: var(--muted); }
.messages { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 12px 16px; }
.messages li { padding: 6px 0; }
.messages .meta { color: var(--muted); font-size: 12px; }
.messages .author { color: var(--text); font-weight: 600; margin-right: 8px; }
.messages .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.messages li.pending .text { color: var(--muted); }
.messages li.failed .text { color: var(--danger); }
.composer { grid-template-columns: 1fr auto; align-items: end; padding: 12px 16px; border-top: 1px solid var(--line); }
.composer textarea { resize: vertical; min-height: 44px; }

.foot { padding: 6px 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  .chat { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .channels { display: flex; gap: 12px; }
}
