:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #1c2430; --muted: #6b7685;
  --line: #e4e8ee; --accent: #006ad3; --accent-ink: #ffffff; --coral: #ff6948;
  --ok: #1a9d5a; --warn: #b26a00; --danger: #c23b3b;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,30,50,.06), 0 4px 16px rgba(20,30,50,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181e; --surface: #1b2129; --ink: #e8edf3; --muted: #93a0b0;
    --line: #2a323d; --accent: #4d9bff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
code { background: rgba(0,106,211,.08); color: var(--accent); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
button { font-family: inherit; cursor: pointer; }
.link { background: none; border: none; color: var(--accent); padding: 0; font-size: 13px; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.login-card { background: var(--surface); box-shadow: var(--shadow); border-radius: 14px; padding: 32px; width: min(92vw, 400px); }
.login-card .brand { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.login form { display: flex; gap: 8px; margin-top: 16px; }
.login input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.login button { padding: 10px 14px; border: none; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ms-btn { display: block; text-align: center; text-decoration: none; margin-top: 16px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; }
.ms-btn:hover { border-color: var(--accent); color: var(--accent); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0 8px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-msg { margin-top: 14px; font-size: 13px; }
.login-msg a { color: var(--accent); word-break: break-all; }

/* app shell */
.app { display: grid; grid-template-columns: 248px 1fr 300px; height: 100vh; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }

.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.channels { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.chan-item { text-align: left; background: none; border: none; color: var(--ink); padding: 7px 10px; border-radius: 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.chan-item:hover { background: var(--bg); }
.chan-item.active { background: var(--accent); color: var(--accent-ink); }
.chan-item .hash { opacity: .6; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.who { font-size: 13px; color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; }
.chan-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chan-name { font-weight: 600; }
.chan-sub { font-size: 12px; }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--accent); padding: 6px 10px; border-radius: 8px; text-decoration: none; font-size: 13px; }

.messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avatar.bot { background: var(--coral); }
.msg-body { min-width: 0; }
.msg-head { font-size: 13px; }
.msg-head .name { font-weight: 600; }
.msg-head .time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; }
.msg-text.cmd { color: var(--accent); font-family: ui-monospace, monospace; font-size: 13px; }
.msg img { max-width: min(420px, 80%); border-radius: 8px; margin-top: 4px; border: 1px solid var(--line); }
.msg.system { justify-content: center; }
.msg.system .sys { background: var(--bg); color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 20px; }

.working { padding: 6px 20px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.composer { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); align-items: center; }
.composer input[type=text] { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
.composer button[type=submit] { padding: 11px 18px; border: none; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.attach { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; font-size: 20px; color: var(--muted); background: var(--bg); }

.ideas-panel { background: var(--surface); border-left: 1px solid var(--line); padding: 16px 14px; display: flex; flex-direction: column; overflow-y: auto; }
.ideas { display: flex; flex-direction: column; gap: 10px; }
.idea-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--bg); }
.idea-card .idea-text { font-size: 13px; margin-bottom: 8px; }
.idea-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; text-transform: capitalize; }
.badge.exploring { background: rgba(178,106,0,.12); color: var(--warn); }
.badge.shipped { background: rgba(26,157,90,.14); color: var(--ok); }
.badge.bug { background: rgba(194,59,59,.12); color: var(--danger); }
.badge.rolledback { background: var(--line); color: var(--muted); }
.idea-card .ship { font-size: 12px; border: 1px solid var(--accent); color: var(--accent); background: none; padding: 3px 9px; border-radius: 7px; }
.ideas-hint { font-size: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 900px) { .app { grid-template-columns: 200px 1fr; } .ideas-panel { display: none; } }
