:root {
  --ink: #121418;
  --mute: #5c6570;
  --line: #e6e8eb;
  --paper: #f4f5f7;
  --white: #ffffff;
  --accent: #ff7a45;
  --accent2: #ff4f8b;
  --teal: #2a9d8f;
  --danger: #d64545;
  --card: #ffffff;
  --sidebar: #0f1114;
  --sidebar-text: rgba(255,255,255,.72);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(255,122,69,.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(42,157,143,.12), transparent 50%),
    var(--paper);
  line-height: 1.5;
  font-size: 15px;
}
button, input, textarea, select { font: inherit; }
a { color: inherit; }
.brand {
  font-family: Syne, sans-serif; font-weight: 800;
  letter-spacing: -0.04em;
}
h1, h2, h3 { font-family: Syne, sans-serif; letter-spacing: -0.03em; font-weight: 700; }
.muted { color: var(--mute); }
.err { color: var(--danger); font-size: .9rem; }
.ok { color: var(--teal); font-size: .9rem; }

/* Auth */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 18px 50px rgba(18,20,24,.08);
}
.auth-card h1 { font-size: 1.85rem; margin-bottom: 4px; }
.auth-card .lede { color: var(--mute); margin-bottom: 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--mute); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fafbfc;
}
.field input:focus, .field textarea:focus { outline: 2px solid rgba(255,122,69,.35); border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 12px 16px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ink { background: var(--ink); }
.btn.teal { background: var(--teal); }
.btn.danger { background: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: .85rem; font-weight: 600; }
.linkish { background: none; border: none; color: var(--mute); cursor: pointer; text-decoration: underline; font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.side {
  background: var(--sidebar); color: #fff; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { font-size: 1.25rem; padding: 4px 10px 18px; }
.side nav button {
  text-align: left; background: transparent; border: none; color: var(--sidebar-text);
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.side nav button:hover, .side nav button.active { background: rgba(255,255,255,.08); color: #fff; }
.side nav button.active { box-shadow: inset 3px 0 0 var(--accent); }
.side .foot { margin-top: auto; padding: 12px; font-size: .78rem; color: rgba(255,255,255,.45); }
.main { padding: 28px 28px 64px; max-width: 980px; }
.main h1 { font-size: 1.7rem; margin-bottom: 4px; }
.main .sub { color: var(--mute); margin-bottom: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
}
.card .k { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.card .v { font-family: Syne, sans-serif; font-size: 1.45rem; font-weight: 700; margin-top: 4px; }
.card .hint { font-size: .82rem; color: var(--mute); margin-top: 4px; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
}
.panel h3 { font-size: 1.05rem; margin-bottom: 8px; }
.list-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.list-item:first-of-type { border-top: none; }
.bubble {
  max-width: 78%; padding: 10px 12px; border-radius: 12px; margin: 6px 0; font-size: .92rem;
}
.bubble.me { background: var(--accent); color: #fff; margin-left: auto; }
.bubble.them { background: #eef0f3; }
.chat-log { max-height: 420px; overflow: auto; display: flex; flex-direction: column; padding: 8px 0; }
.pill {
  display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: rgba(255,122,69,.15); color: #b84a1f;
}
.pill.ok { background: rgba(42,157,143,.15); color: #1b6b61; }
.banner {
  background: linear-gradient(120deg, rgba(255,122,69,.12), rgba(42,157,143,.1));
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
  font-size: .92rem;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: .85rem;
}
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; height: auto; z-index: 5;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px;
    padding: 12px;
  }
  .side .brand { padding: 4px 8px; width: 100%; }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
  .side nav button { padding: 8px 10px; font-size: .82rem; }
  .side .foot { display: none; }
  .main { padding: 18px 14px 48px; }
}
