:root {
  --bg: #090a0d;
  --text: #f4f1ea;
  --muted: #9b958a;
  --line: rgba(255, 255, 255, 0.08);
  --card: #14161c;
  --gold: #e4b15a;
  --gold-ink: #1a1408;
  --ok: #3dcf8e;
  --info: #7eb6ff;
  --closed: #8d887f;
  --danger: #e07a7a;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}

button, input, textarea { font: inherit; color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.gate, .desk {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
}

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
}

.gate h1 { margin: 12px 0 8px; font-size: 1.6rem; }
.gate p { color: var(--muted); max-width: 280px; }

.mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(145deg, #f0d48a, #a67c2d);
}

.desk { display: flex; flex-direction: column; padding: 14px 14px 24px; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.bar-copy { flex: 1; min-width: 0; }
.brand { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.brand span { color: var(--text); }
.bar h1 { margin: 2px 0 0; font-size: 1.25rem; }

.icon-btn, .seg button, .chips button, .ghost, .primary, .fab {
  border: 0;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: #101218;
  border: 1px solid var(--line);
}

.seg button {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 0.82rem;
}

.seg button.on { background: var(--gold); color: var(--gold-ink); }

.search input, label input, label textarea, .composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #101218;
  border-radius: 14px;
  padding: 12px 14px;
}

.search { display: block; margin-bottom: 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.chips button {
  background: #101218;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  white-space: nowrap;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.8rem;
}
.chips button.on { color: var(--gold-ink); background: var(--gold); border-color: transparent; }

.list { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 12px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 12px 0;
  overflow: hidden;
}
.row i { border-radius: 4px; }
.row.open i { background: var(--ok); }
.row.answered i { background: var(--info); }
.row.closed i { background: var(--closed); }
.row strong { display: block; font-size: 0.98rem; }
.row span { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

.fab {
  position: sticky;
  bottom: 8px;
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 800;
}

.panel label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 700; font-size: 0.86rem; }
.lead { color: var(--muted); margin: 0 0 14px; }
.primary {
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 800;
  border-radius: 14px;
  padding: 12px 16px;
}
.ghost {
  background: transparent;
  color: var(--danger);
  font-weight: 700;
  padding: 12px 8px;
}

.banner {
  background: rgba(224, 122, 122, 0.12);
  color: #ffc7c7;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.thread-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 10px; }
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 40vh; padding-bottom: 8px; }
.bubble { max-width: 86%; padding: 10px 12px; border-radius: 16px; background: #171a21; border: 1px solid var(--line); }
.bubble.mine { align-self: flex-end; background: rgba(228, 177, 90, 0.18); border-color: rgba(228, 177, 90, 0.28); }
.bubble .who { font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.bubble .text { white-space: pre-wrap; word-break: break-word; }

.composer { position: sticky; bottom: 0; padding-top: 8px; background: linear-gradient(transparent, var(--bg) 18%); }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }

.empty { color: var(--muted); text-align: center; padding: 36px 12px; border: 1px dashed var(--line); border-radius: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #22262f;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  max-width: min(90vw, 420px);
}

[hidden] { display: none !important; }
