:root {
  --bg: #16161a;
  --panel: #1d1d22;
  --panel2: #24242a;
  --line: #2f2f37;
  --text: #ececf0;
  --dim: #9a9aa6;
  --faint: #6c6c78;
  --gold: #e8b84a;
  --green: #5fc48a;
  --blue: #7c9fe8;
  --teal: #5fb3c4;
  --red: #e07a6b;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

.btn { border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; background: var(--panel2); font-weight: 600; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.primary:hover { background: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.btn.ghost:hover { color: var(--text); border-color: var(--faint); }
.btn.wide { width: 100%; }
.icon-btn { background: none; border: 0; font-size: 20px; padding: 6px 10px; cursor: pointer; color: var(--dim); }

.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 16px; }
.logo.big { width: 56px; height: 56px; border-radius: 14px; font-size: 30px; margin: 0 auto 14px; }

/* JOIN */
.join { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.join-card { width: 100%; max-width: 380px; text-align: center; }
.join-card h1 { margin: 0; font-size: 34px; letter-spacing: -0.5px; }
.sub { color: var(--dim); margin: 8px 0 26px; }
.join form { display: grid; gap: 10px; text-align: left; }
.join label { color: var(--dim); font-size: 13px; }
.join input { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 17px; }
.join .btn { padding: 12px; font-size: 16px; }
.err { color: var(--red); margin: 4px 0 0; font-size: 14px; }

/* APP SHELL */
.app { display: flex; height: 100%; height: 100dvh; }
.side { width: 270px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
#invite { margin-bottom: 14px; }
.nav-label { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 14px 8px 6px; }
.as-btn { background: none; border: 0; cursor: pointer; width: 100%; text-align: left; display: flex; gap: 6px; }
.as-btn:hover { color: var(--dim); }
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; text-align: left; padding: 7px 8px; border-radius: 7px; cursor: pointer; color: var(--dim); }
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.nav-item.unread { color: var(--text); font-weight: 700; }
.nav-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .hash { color: var(--faint); width: 14px; text-align: center; }
.nav-item .count { font-size: 12px; background: var(--panel2); color: var(--dim); border-radius: 10px; padding: 0 7px; }
.nav-item.on .count { background: var(--line); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.filter { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; margin: 2px 0 6px; }
.stage-label { color: var(--faint); font-size: 11px; padding: 10px 8px 2px; text-transform: uppercase; letter-spacing: .5px; }
.side-foot { margin-top: auto; padding: 14px 6px 0; display: grid; gap: 4px; color: var(--dim); font-size: 14px; }
.me-box { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #16161a; flex: none; font-size: 14px; }
.avatar.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.room-title h2 { margin: 0; font-size: 18px; }
.room-meta { color: var(--dim); font-size: 13px; }
.product-card { padding: 12px 20px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; background: var(--panel); font-size: 14px; }
.product-card .row { display: flex; gap: 10px; align-items: baseline; }
.product-card .k { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; width: 44px; flex: none; }
.stage { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; border-radius: 5px; padding: 1px 7px; }
.stage.idea { background: #2f2f37; color: var(--dim); }
.stage.built { background: #26304a; color: var(--blue); }
.stage.live { background: #1f3a2c; color: var(--green); }
.stage.users { background: #1d3640; color: var(--teal); }
.stage.revenue { background: #3e3320; color: var(--gold); }

.room-body { flex: 1; min-height: 0; display: flex; }
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 20px 8px; }
.empty { color: var(--faint); text-align: center; padding: 40px 16px; }
.empty b { color: var(--dim); display: block; margin-bottom: 4px; font-size: 16px; }
.msg { display: flex; gap: 10px; padding: 3px 6px; margin: 0 -6px; border-radius: 7px; position: relative; }
.msg:hover, .msg.picked { background: var(--panel); }
.msg.first { margin-top: 12px; }
.msg .gut { width: 30px; flex: none; }
.msg .who { font-weight: 700; margin-right: 6px; }
.msg .when { color: var(--faint); font-size: 12px; }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .mk { position: absolute; right: 8px; top: -10px; display: none; font-size: 12px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; color: var(--text); }
.msg:hover .mk, .msg.picked .mk { display: block; }
.composer { display: flex; gap: 8px; padding: 10px 20px 16px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; max-height: 160px; min-height: 42px; }
.composer textarea:focus, .task-form input:focus, .filter:focus, .join input:focus { outline: none; border-color: var(--faint); }

.tasks { width: 330px; flex: none; border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; padding: 14px 16px; }
.tasks-head { margin-bottom: 10px; }
.task-form { display: grid; gap: 8px; margin-bottom: 14px; }
.task-form input { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.task-form-row { display: flex; gap: 8px; }
.task-form-row select { flex: 1; min-width: 0; }
select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; color: var(--dim); }
.task-list { display: grid; gap: 6px; }
.task { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.task .chk { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--faint); flex: none; margin-top: 1px; cursor: pointer; background: none; padding: 0; display: grid; place-items: center; font-size: 13px; color: var(--bg); }
.task .chk:hover { border-color: var(--green); }
.task.is-done .chk { background: var(--green); border-color: var(--green); }
.task.is-done .ttxt { color: var(--faint); text-decoration: line-through; }
.task .tbody { flex: 1; min-width: 0; }
.task .ttxt { overflow-wrap: anywhere; }
.task .tmeta { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--faint); font-size: 12px; flex-wrap: wrap; }
.task .tmeta select { font-size: 12px; padding: 3px 5px; }
.task .room-link { color: var(--dim); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; }
.done-toggle { background: none; border: 0; color: var(--faint); cursor: pointer; text-align: left; padding: 14px 0 8px; font-size: 13px; }
.done-toggle:hover { color: var(--dim); }

.mine { flex: 1; overflow-y: auto; padding: 18px 20px; max-width: 720px; }

.banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: #3e3320; color: var(--gold); padding: 7px 14px; border-radius: 8px; font-size: 14px; z-index: 50; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 9px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.bad { background: var(--red); color: #fff; }

.only-phone { display: none; }
.scrim { display: none; }

@media (max-width: 760px) {
  .only-phone { display: block; }
  .tabs.only-phone { display: flex; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 84%; max-width: 320px; transform: translateX(-100%); transition: transform .2s; }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .room-head { padding: 10px 12px; }
  .product-card { padding: 10px 16px; }
  .tabs { border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; background: none; border: 0; padding: 10px; color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; }
  .tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
  .room-body .tasks { display: none; width: 100%; border-left: 0; }
  .room-body.show-tasks .chat { display: none; }
  .room-body.show-tasks .tasks { display: flex; }
  .msgs { padding: 12px 16px 8px; }
  .composer { padding: 8px 12px 12px; }
  .mine { padding: 14px 16px; }
  .composer textarea { font-size: 16px; }
  .task-form input { font-size: 16px; }
}

/* alerts + install */
.setup { display: grid; gap: 6px; margin: -4px 0 10px; }
.setup-btn { background: #3e3320; color: var(--gold); border: 0; border-radius: 8px; padding: 8px 10px; text-align: left; cursor: pointer; font-weight: 600; font-size: 14px; }
.setup-btn:hover { filter: brightness(1.15); }
.setup-note { color: var(--dim); font-size: 13px; margin: 2px 4px; line-height: 1.4; }

/* mentions */
.chat { position: relative; }
.mention { color: var(--gold); font-weight: 600; }
.mention.me { background: #3e3320; border-radius: 4px; padding: 0 3px; }
.msg.for-me { box-shadow: inset 3px 0 0 var(--gold); }
.picker { position: absolute; left: 20px; bottom: 66px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 4px; min-width: 200px; max-width: calc(100% - 40px); z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pick { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.pick.on, .pick:hover { background: var(--line); }
.mine-h { font-size: 13px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; margin: 6px 0 10px; font-weight: 600; }
.mine-h:not(:first-child) { margin-top: 28px; }
.ment { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin-bottom: 6px; cursor: pointer; }
.ment:hover { border-color: var(--faint); }
.ment .top { font-size: 12px; color: var(--faint); margin-bottom: 3px; }
.ment .top b { color: var(--dim); }
.ment .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) { .picker { left: 12px; bottom: 60px; } }

/* crews + board */
.crew-label { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; text-align: left;
  color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 16px 8px 6px; }
.crew-label:hover, .crew-label.on { color: var(--text); }
.crew-label .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--gold); color: #16161a; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.nav-item.add { color: var(--faint); font-size: 13px; padding: 5px 8px; }
.nav-item.add:hover { color: var(--text); }
#newCrewBtn { margin-top: 10px; }
.link-btn { background: none; border: 0; color: var(--faint); text-align: left; padding: 4px 0; cursor: pointer; font-size: 13px; }
.link-btn:hover { color: var(--text); }
.crumb { color: var(--faint); font-size: 12px; }
.crumb button { background: none; border: 0; padding: 0; color: var(--faint); cursor: pointer; font-size: 12px; }
.crumb button:hover { color: var(--text); text-decoration: underline; }
.room-title { flex: 1; min-width: 0; }
.head-btn { flex: none; }
.page { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.card-form { display: grid; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; max-width: 640px; margin-bottom: 18px; }
.card-form input, .card-form textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical; }
.card-form input:focus, .card-form textarea:focus { outline: none; border-color: var(--faint); }
.hint { color: var(--dim); font-size: 13px; margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.idea { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.idea.yours { border-color: #4a4030; }
.idea h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.idea .about { color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.idea .need { font-size: 13px; color: var(--text); background: var(--panel2); border-radius: 7px; padding: 6px 9px; overflow-wrap: anywhere; }
.idea .need b { color: var(--gold); font-weight: 600; }
.idea .by { color: var(--faint); font-size: 12px; }
.idea .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.people { display: flex; align-items: center; }
.people .avatar { margin-right: -6px; border: 2px solid var(--panel); }
.people .more { margin-left: 12px; color: var(--faint); font-size: 12px; }
.idea .state { font-size: 13px; color: var(--dim); }
.ask-box { display: grid; gap: 8px; }
.ask-box textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.empty-board { max-width: 520px; margin: 30px auto; text-align: center; color: var(--dim); }
.empty-board b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.crew-page { max-width: 720px; display: grid; gap: 18px; }
.crew-page .about { color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.box h4 { margin: 0; font-size: 13px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.req { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.req:first-of-type { border-top: 0; padding-top: 0; }
.req .who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.req .pitch { color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.btn.yes { background: var(--green); color: #10251a; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.person { display: flex; align-items: center; gap: 8px; }
.person .tag { color: var(--faint); font-size: 12px; }
.room-row { display: flex; gap: 8px; }
.room-row input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
@media (max-width: 760px) {
  .page { padding: 14px 16px 40px; }
  .head-btn { padding: 8px 12px; font-size: 14px; }
}
