:root {
  --bg: #f3eee6;
  --bg-2: #ece4d8;
  --paper: #fffdf9;
  --ink: #2a2118;
  --muted: #6d5f52;
  --line: #e6ddd1;
  --accent: #e25a48;
  --accent-soft: #fde8e4;
  --green: #2f6f5e;
  --green-soft: #e5f3ee;
  --shadow: 0 12px 32px rgba(42, 33, 24, .08);
  --radius: 18px;
  --font: "Nunito", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ffe7c8 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #ffd9d2 0%, transparent 45%),
    var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(255, 253, 249, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.logo {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); font-size: 22px;
}
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.tag { color: var(--muted); font-size: 12px; }
.views { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.views button, .role-tabs button, .chip, .btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 13px;
  transition: .15s ease;
}
.views button:hover, .role-tabs button:hover, .btn:hover { transform: translateY(-1px); }
.views button.is-on, .role-tabs button.is-on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.who select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  font-weight: 700;
  color: var(--ink);
}
main { flex: 1; min-height: 0; display: flex; }
.view { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px 16px 16px; }
.view.is-on { display: flex; }
.board-tools, .role-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.btn { background: var(--accent); color: #fff; border-color: #c94a3b; box-shadow: 0 6px 16px rgba(226, 90, 72, .25); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.ok { background: var(--green); border-color: #245c4d; box-shadow: 0 6px 16px rgba(47, 111, 94, .2); }
.btn.tiny, .cmd { padding: 5px 10px; font-size: 12px; }
.board-split, .list-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 380px; gap: 14px; }
.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(190px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-bottom: 8px;
}
.col {
  background: rgba(255,255,249,.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 100%;
}
.col h3 { margin: 0 8px 10px; font-size: 14px; display: flex; justify-content: space-between; }
.col h3 b { background: var(--bg-2); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 11px;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(42,33,24,.04);
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
}
.card:hover { border-color: #d3c3b0; }
.card.is-on { outline: 2px solid var(--accent); border-color: transparent; }
.card .key { font-size: 11px; font-weight: 800; color: var(--muted); }
.card .title { font-weight: 800; margin: 2px 0 8px; line-height: 1.3; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wait {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff4d6; color: #7a4e00; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 800;
}
.wait.done { background: var(--green-soft); color: var(--green); }
.side-chat, .chat-main {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0 0 6px; font-size: 16px; }
.stage-bar { display: flex; gap: 2px; margin: 8px 0; }
.stage-bar span {
  flex: 1; text-align: center; font-size: 11px; font-weight: 800;
  padding: 5px 2px; border-radius: 8px; color: var(--muted); background: var(--bg);
  opacity: .55;
}
.stage-bar span.on { opacity: 1; background: var(--accent-soft); color: var(--accent); }
.stage-bar span.done { opacity: 1; background: var(--green-soft); color: var(--green); }
.head-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg .body { background: var(--bg); border-radius: 14px; padding: 8px 11px; }
.msg .name { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.msg .when { font-weight: 600; color: var(--muted); font-size: 11px; margin-left: 6px; }
.msg p { margin: 4px 0 0; white-space: pre-wrap; line-height: 1.4; }
.msg.me .body { background: #ffe8c4; }
.msg.sys { justify-content: center; }
.msg.sys .body { background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.avatar.bot {
  border-radius: 8px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6d5cff;
}
.badge-ai {
  font-size: 9px; letter-spacing: .04em; background: #6d5cff; color: #fff;
  border-radius: 4px; padding: 1px 4px; font-weight: 800;
}
.suggest {
  border: 1px dashed #6d5cff; background: #f3f0ff; border-radius: 14px; padding: 10px 12px;
}
.suggest p { margin: 0 0 8px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.composer form { display: flex; gap: 8px; }
.composer input[type="text"] {
  flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; background: #fff;
}
.shortcuts, .cmds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.channels {
  width: 280px; flex-shrink: 0; margin-right: 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; padding: 10px;
}
#view-chat { flex-direction: row; }
.ch {
  width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 12px; padding: 8px 9px; margin-bottom: 4px;
}
.ch:hover { background: var(--bg); }
.ch.is-on { background: #ffe8c4; }
.ch .t { font-weight: 800; display: block; }
.ch .s { font-size: 12px; color: var(--muted); }
#view-role { overflow: auto; }
.role-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.role-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; flex: 1; min-height: 0; }
.queue { display: flex; flex-direction: column; gap: 8px; }
.table-wrap { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); }
tr { cursor: pointer; }
tr:hover td { background: var(--bg); }
tr.is-on td { background: #ffe8c4; }
.empty { color: var(--muted); padding: 30px 16px; text-align: center; }
.modal {
  position: fixed; inset: 0; background: rgba(42,33,24,.35);
  display: grid; place-items: center; z-index: 40; padding: 16px;
}
.modal[hidden] { display: none; }
.sheet {
  background: var(--paper); border-radius: 20px; padding: 22px; width: min(460px, 100%);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.sheet h2 { margin: 0; }
.sheet p { margin: 0; color: var(--muted); }
.sheet label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; }
.sheet input, .sheet textarea {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; font-weight: 600;
}
.opt { font-weight: 600; color: var(--muted); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-weight: 800; z-index: 50; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
.reset { margin-left: 8px; }
@media (max-width: 980px) {
  .top { flex-wrap: wrap; }
  .who { margin-left: 0; }
  .board-split, .list-split, .role-grid { grid-template-columns: 1fr; }
  .side-chat { min-height: 420px; }
  .channels { width: 210px; }
  .board { grid-template-columns: repeat(6, 200px); }
}
