:root {
  --sq-green: #38cb89;
  --sq-green-dark: #2cb879;
  --sq-navy: #0a1f44;
  --sq-navy-deep: #071e57;
  --sq-purple: #7540ee;
  --sq-purple-deep: #5d3eff;
  --sq-bg: #f5f7fd;
  --sq-surface: #ffffff;
  --sq-ink: #0a1f44;
  --sq-ink-soft: #4e5d78;
  --sq-ink-muted: #8a94a6;
  --sq-line: #e2e4e9;
  --sq-tint: #e9f9f0;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-sm: 0 1px 2px rgba(10, 31, 68, 0.05), 0 4px 12px rgba(10, 31, 68, 0.05);
  --shadow-md: 0 6px 24px rgba(10, 31, 68, 0.08);
  --shadow-lg: 0 18px 50px rgba(10, 31, 68, 0.14);
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Ubuntu, Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", "Roboto Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--sq-ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(117, 64, 238, 0.07), transparent 60%),
    radial-gradient(1000px 520px at -10% 110%, rgba(56, 203, 137, 0.10), transparent 55%),
    var(--sq-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.app { height: 100dvh; background: var(--sq-surface); }
.layout { display: flex; height: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.welcome, .messages { max-width: 800px; margin-left: auto; margin-right: auto; width: 100%; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--sq-line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sq-green), var(--sq-purple));
  color: #fff;
  box-shadow: 0 6px 16px rgba(56, 203, 137, 0.35);
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; fill: currentColor; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.brand-name span {
  background: linear-gradient(120deg, var(--sq-green-dark), var(--sq-purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 12px; color: var(--sq-ink-muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--sq-ink-soft); font-weight: 500; }
.status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sq-green);
  box-shadow: 0 0 0 3px rgba(56, 203, 137, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(56,203,137,0.18); } 50% { box-shadow: 0 0 0 6px rgba(56,203,137,0.06); } }
.ghost {
  border: 1px solid var(--sq-line); background: #fff; color: var(--sq-ink-soft);
  padding: 7px 13px; border-radius: 10px; font: 600 12.5px var(--font); cursor: pointer;
  transition: all .16s ease;
}
.ghost:hover { border-color: var(--sq-green); color: var(--sq-navy); box-shadow: var(--shadow-sm); }

/* ---------- Chat area ---------- */
.chat { flex: 1; overflow-y: auto; padding: 26px 22px 12px; scroll-behavior: smooth; }
.chat::-webkit-scrollbar { width: 10px; }
.chat::-webkit-scrollbar-thumb { background: var(--sq-line); border-radius: 8px; border: 2px solid #fff; }
.chat::-webkit-scrollbar-thumb:hover { background: #c1c7d0; }

.welcome { text-align: center; padding: 48px 20px 30px; animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.welcome-mark {
  width: 66px; height: 66px; margin: 0 auto 20px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sq-green), var(--sq-purple));
  color: #fff; box-shadow: 0 14px 34px rgba(56, 203, 137, 0.35);
}
.welcome-mark svg { width: 36px; height: 36px; fill: currentColor; }
.welcome h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.6px; margin: 0 0 8px; }
.welcome h1 span { background: linear-gradient(120deg, var(--sq-green-dark), var(--sq-purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome p { color: var(--sq-ink-soft); font-size: 15px; max-width: 460px; margin: 0 auto 26px; line-height: 1.55; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.chip {
  text-align: left; border: 1px solid var(--sq-line); background: #fff; color: var(--sq-ink-soft);
  padding: 13px 15px; border-radius: var(--radius-md); font: 500 13.5px var(--font); cursor: pointer;
  transition: all .16s ease; line-height: 1.35;
}
.chip:hover { border-color: var(--sq-green); color: var(--sq-navy); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---------- Messages ---------- */
.messages { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 100%; animation: rise .3s ease both; }
.msg .avatar {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.msg.agent .avatar { background: linear-gradient(135deg, var(--sq-green), var(--sq-purple)); box-shadow: 0 4px 10px rgba(117,64,238,0.25); }
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { background: var(--sq-navy); box-shadow: 0 4px 10px rgba(10,31,68,0.2); }
.bubble { padding: 13px 16px; border-radius: var(--radius-md); font-size: 15px; line-height: 1.6; }
.msg.agent .bubble {
  background: #fff; border: 1px solid var(--sq-line);
  border-top-left-radius: 6px; box-shadow: var(--shadow-sm);
  color: var(--sq-ink); word-wrap: break-word; overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--sq-green), var(--sq-green-dark));
  color: #fff; border-top-right-radius: 6px; box-shadow: 0 6px 16px rgba(56,203,137,0.30);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.msg .bubble > :first-child { margin-top: 0; }
.msg .bubble > :last-child { margin-bottom: 0; }
.msg.agent .bubble p { margin: 0 0 10px; }
.msg.agent .bubble h1, .msg.agent .bubble h2, .msg.agent .bubble h3 { font-weight: 700; letter-spacing: -0.2px; margin: 16px 0 8px; line-height: 1.3; }
.msg.agent .bubble h1 { font-size: 19px; } .msg.agent .bubble h2 { font-size: 17px; } .msg.agent .bubble h3 { font-size: 15px; }
.msg.agent .bubble ul, .msg.agent .bubble ol { margin: 4px 0 12px; padding-left: 22px; }
.msg.agent .bubble li { margin: 4px 0; }
.msg.agent .bubble a { color: var(--sq-purple-deep); text-decoration: none; border-bottom: 1px solid rgba(93,63,255,0.3); }
.msg.agent .bubble a:hover { border-bottom-color: var(--sq-purple-deep); }
.msg.agent .bubble code {
  font-family: var(--mono); font-size: 13px;
  background: var(--sq-bg); color: var(--sq-navy-deep);
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--sq-line);
}
.msg.agent .bubble pre {
  background: var(--sq-navy); color: #e9f9f0;
  padding: 14px 16px; border-radius: 12px; overflow-x: auto; margin: 8px 0 14px;
}
.msg.agent .bubble pre code { background: none; color: inherit; border: 0; padding: 0; font-size: 13px; }
.msg.agent .bubble blockquote {
  margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--sq-green);
  color: var(--sq-ink-soft); background: var(--sq-tint); border-radius: 0 8px 8px 0;
}
.msg.agent .bubble hr { border: 0; border-top: 1px solid var(--sq-line); margin: 14px 0; }

/* Typing indicator */
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sq-ink-muted); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.typing-row { display: flex; align-items: center; gap: 10px; }
.status-text { font-size: 13.5px; color: var(--sq-ink-muted); }

/* ---------- Composer ---------- */
.composer { padding: 12px 22px 10px; border-top: 1px solid var(--sq-line); background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); }
.composer-inner {
  display: flex; align-items: flex-end; gap: 10px;
  background: #fff; border: 1.5px solid var(--sq-line); border-radius: 16px;
  padding: 8px 8px 8px 16px; transition: border-color .16s ease, box-shadow .16s ease;
}
.composer-inner:focus-within { border-color: var(--sq-green); box-shadow: 0 0 0 4px rgba(56,203,137,0.12); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent;
  font: 400 15px/1.5 var(--font); color: var(--sq-ink); max-height: 160px; padding: 8px 0;
}
.composer textarea::placeholder { color: var(--sq-ink-muted); }
.composer button#send {
  width: 42px; height: 42px; border: 0; border-radius: 12px; flex: none; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--sq-green), var(--sq-green-dark));
  box-shadow: 0 6px 14px rgba(56,203,137,0.35);
  transition: transform .12s ease, box-shadow .16s ease;
}
.composer button#send:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(56,203,137,0.4); }
.composer button#send:disabled { opacity: .55; cursor: default; transform: none; }
.composer button#send svg { width: 20px; height: 20px; fill: currentColor; }
.composer-hint { text-align: center; font-size: 11.5px; color: var(--sq-ink-muted); margin-top: 8px; }

/* ---------- Attachments ---------- */
.attach-btn {
  width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; flex: none;
  color: var(--sq-ink-muted); cursor: pointer; display: grid; place-items: center;
  transition: color .15s ease, background .15s ease;
}
.attach-btn:hover { color: var(--sq-green-dark); background: var(--sq-tint); }
.attach-btn svg { width: 20px; height: 20px; fill: currentColor; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 6px 8px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px;
  background: var(--sq-tint); border: 1px solid rgba(56,203,137,0.3); border-radius: 10px;
  font-size: 13px; color: var(--sq-navy);
}
.att-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-x { border: 0; background: none; cursor: pointer; color: var(--sq-ink-muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.att-x:hover { color: #ea384c; }
.att-note { font-size: 12px; color: rgba(255,255,255,0.85); margin-top: 6px; }
.file-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--sq-line); }
.file-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  background: var(--sq-tint); border: 1px solid rgba(56,203,137,0.35); border-radius: 10px;
  color: var(--sq-navy); text-decoration: none; font-size: 13px; font-weight: 600;
  transition: all .15s ease;
}
.file-link:hover { background: #d8f5e7; border-color: var(--sq-green); transform: translateY(-1px); }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; display: grid; place-items: center; background: var(--sq-bg); z-index: 20; }
.lock-card {
  width: min(400px, 90vw); background: #fff; border: 1px solid var(--sq-line);
  border-radius: 22px; box-shadow: var(--shadow-lg); padding: 40px 32px; text-align: center;
}
.lock-badge { width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sq-green), var(--sq-purple)); color: #fff; }
.lock-badge svg { width: 26px; height: 26px; fill: currentColor; }
.lock-card h1 { font-size: 21px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.4px; }
.lock-card p { color: var(--sq-ink-soft); font-size: 14px; margin: 0 0 22px; line-height: 1.5; }
.lock-card input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--sq-line); border-radius: 12px;
  font: 500 15px var(--font); text-align: center; letter-spacing: 1px; outline: none;
}
.lock-card input:focus { border-color: var(--sq-green); box-shadow: 0 0 0 4px rgba(56,203,137,0.12); }
.lock-card button {
  width: 100%; margin-top: 12px; padding: 13px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--sq-green), var(--sq-green-dark)); color: #fff;
  font: 700 15px var(--font); box-shadow: 0 8px 18px rgba(56,203,137,0.32);
}
.lock-error { color: #ea384c; font-size: 13px; margin-top: 12px; min-height: 18px; }

@media (max-width: 620px) {
  .suggestions { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .welcome h1 { font-size: 23px; }
  .topbar { padding: 14px 16px; }
  .chat { padding: 20px 16px 8px; }
  .composer { padding: 10px 16px 8px; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px; flex: none; color: #fff; display: flex; flex-direction: column; padding: 16px 12px;
  background: linear-gradient(180deg, var(--sq-navy-deep), var(--sq-navy));
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sb-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.sb-brand-text { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sb-brand-sub { font-size: 11px; opacity: .6; font-weight: 500; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.sb-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  border: 0; background: none; color: rgba(255,255,255,.78); font: 600 14px var(--font); cursor: pointer;
  text-align: left; width: 100%; transition: background .14s ease, color .14s ease;
}
.sb-item svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.sb-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-item.active { background: rgba(56,203,137,.18); color: var(--sq-green); }
.sb-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.12); }
.sb-user-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--sq-green), var(--sq-purple)); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.sb-user-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout { border: 0; background: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; line-height: 1; }
.sb-logout:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ---------- Auth screen ---------- */
.auth {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(117,64,238,0.10), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(56,203,137,0.14), transparent 55%),
    var(--sq-bg);
}
.auth-card { width: min(380px, 90vw); background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); padding: 40px 34px; text-align: center; border: 1px solid var(--sq-line); }
.auth-mark { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sq-green), var(--sq-purple)); color: #fff; box-shadow: 0 12px 28px rgba(56,203,137,.35); }
.auth-mark svg { width: 30px; height: 30px; fill: currentColor; }
.auth-card h1 { font-size: 22px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.4px; }
.auth-card h1 span { background: linear-gradient(120deg, var(--sq-green-dark), var(--sq-purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { color: var(--sq-ink-soft); font-size: 14px; margin: 0 0 22px; }
.auth-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.auth-fields input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--sq-line); border-radius: 12px; font: 500 14px var(--font); outline: none; }
.auth-fields input:focus { border-color: var(--sq-green); box-shadow: 0 0 0 4px rgba(56,203,137,.12); }
.auth-submit { width: 100%; padding: 13px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--sq-green), var(--sq-green-dark)); color: #fff; font: 700 15px var(--font); cursor: pointer; box-shadow: 0 8px 18px rgba(56,203,137,.32); }
.auth-error { color: #ea384c; font-size: 13px; min-height: 18px; margin-top: 12px; }
.auth-toggle { margin-top: 14px; font-size: 13px; color: var(--sq-ink-muted); }
.auth-toggle a { color: var(--sq-purple-deep); text-decoration: none; font-weight: 600; }

/* ---------- Panel views (library / board) ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--sq-line); }
.panel-head h2 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.3px; }
.panel-head input[type=search] { padding: 9px 13px; border: 1.5px solid var(--sq-line); border-radius: 10px; font: 500 13.5px var(--font); outline: none; width: 260px; }
.panel-head input[type=search]:focus { border-color: var(--sq-green); box-shadow: 0 0 0 3px rgba(56,203,137,.12); }
.panel-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.lib-group-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--sq-ink-muted); margin: 16px 0 8px; }
.lib-group-head:first-child { margin-top: 0; }
.lib-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--sq-line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; transition: all .14s ease; background: #fff; }
.lib-row:hover { border-color: var(--sq-green); box-shadow: var(--shadow-sm); }
.lib-icon { font-size: 18px; }
.lib-info { flex: 1; min-width: 0; }
.lib-name { font-size: 13.5px; font-weight: 600; color: var(--sq-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { font-size: 11.5px; color: var(--sq-ink-muted); margin-top: 2px; }
.lib-dl { border: 0; background: var(--sq-tint); color: var(--sq-navy); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.lib-dl:hover { background: #d8f5e7; }

.board-card { padding: 13px 15px; border: 1px solid var(--sq-line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.board-title { font-size: 14px; font-weight: 600; color: var(--sq-ink); }
.board-meta { font-size: 12px; color: var(--sq-ink-muted); margin-top: 5px; }
.board-status { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.board-status.running { background: #fff3e0; color: #e67e00; }
.board-status.ready { background: var(--sq-tint); color: var(--sq-green-dark); }
.board-status.blocked { background: #ffdede; color: #ea384c; }
.board-status.done { background: #e9f0ff; color: #3898ec; }
.board-status.todo, .board-status.triage, .board-status.scheduled { background: var(--sq-bg); color: var(--sq-ink-muted); }

/* ---------- Quick actions ---------- */
.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.qa-card { text-align: left; border: 1px solid var(--sq-line); background: #fff; border-radius: var(--radius-md); padding: 14px 15px; cursor: pointer; transition: all .16s ease; display: flex; flex-direction: column; gap: 4px; }
.qa-card:hover { border-color: var(--sq-green); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.qa-ico { font-size: 20px; }
.qa-title { font-weight: 700; font-size: 14px; color: var(--sq-ink); }
.qa-desc { font-size: 12px; color: var(--sq-ink-muted); }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10,31,68,.4); z-index: 60; }
.modal-card { width: min(420px, 92vw); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); padding: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; font-weight: 700; margin: 0; }
.modal-body { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.qa-field { display: flex; flex-direction: column; gap: 5px; }
.qa-field label { font-size: 12.5px; font-weight: 600; color: var(--sq-ink-soft); }
.qa-field input, .qa-field textarea { padding: 10px 12px; border: 1.5px solid var(--sq-line); border-radius: 10px; font: 500 14px var(--font); outline: none; resize: none; }
.qa-field input:focus, .qa-field textarea:focus { border-color: var(--sq-green); box-shadow: 0 0 0 4px rgba(56,203,137,.12); }

/* ---------- Admin ---------- */
.admin-section { margin-bottom: 24px; }
.invite-banner { background: var(--sq-tint); border: 1px solid rgba(56,203,137,.4); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.invite-code { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--sq-navy); letter-spacing: 1px; }
.admin-msgs { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 16px; padding: 12px; background: var(--sq-bg); border-radius: 12px; }

/* ---------- Task cards & modal ---------- */
.task-card { background: var(--sq-tint); border: 1px solid rgba(56,203,137,.35); border-radius: 12px; padding: 11px 13px; margin-top: 10px; }
.task-card-head { font-size: 13px; font-weight: 700; color: var(--sq-navy); }
.task-card-head .task-id { font-family: var(--mono); }
.task-card-sub { font-size: 13px; color: var(--sq-ink-soft); margin: 3px 0 9px; }
.task-card-btn { border: 0; background: var(--sq-green); color: #fff; border-radius: 8px; padding: 7px 12px; font: 600 12.5px var(--font); cursor: pointer; }
.task-card-btn:hover { background: var(--sq-green-dark); }

#task-modal .modal-card { width: min(680px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
#task-modal .modal-body { overflow-y: auto; flex: 1 1 auto; gap: 16px; }

.task-meta { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid #e6e9f2; }
.task-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sq-bg); border-radius: 20px; padding: 4px 8px 4px 11px; font-size: 12px; }
.task-chip-label { color: var(--sq-ink-muted); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: .4px; }
.task-chip-val { color: var(--sq-ink); font-weight: 600; }
.task-chip-val.st-done { color: #3898ec; }
.task-chip-val.st-ready, .task-chip-val.st-todo, .task-chip-val.st-triage, .task-chip-val.st-scheduled { color: var(--sq-green-dark); }
.task-chip-val.st-running { color: #e67e00; }
.task-chip-val.st-blocked { color: #ea384c; }

.task-section { display: flex; flex-direction: column; gap: 8px; }
.task-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--sq-ink-muted); }
.task-body { font-size: 14px; line-height: 1.65; color: var(--sq-ink); }
.task-body p { margin: 0 0 10px; }
.task-body ul, .task-body ol { margin: 0 0 10px; padding-left: 22px; }
.task-body li { margin: 3px 0; }
.task-body h3 { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--sq-navy); margin: 16px 0 6px; }
.task-body h3:first-child { margin-top: 0; }
.task-body a { color: var(--sq-green-dark); text-decoration: underline; }
.task-body code { font-family: var(--mono); background: var(--sq-bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.task-body pre { background: #0A1F44; color: #e8eefc; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; }
.task-body pre code { background: none; padding: 0; color: inherit; }

.task-outcome { background: #f0fbf5; border: 1px solid rgba(56,203,137,.3); border-radius: 12px; padding: 12px 14px; }
.task-outcome .task-section-label { color: var(--sq-green-dark); }

.task-comment { padding: 8px 10px; background: var(--sq-bg); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }

@media (max-width: 760px) {
  .sidebar { width: 62px; padding: 16px 8px; }
  .sb-brand-text, .sb-item { font-size: 0; gap: 0; justify-content: center; }
  .sb-item svg { width: 20px; height: 20px; }
  .sb-user-name, .sb-brand-sub { display: none; }
  .sb-user { justify-content: center; }
  .sb-logout { display: none; }
  .qa-grid { grid-template-columns: 1fr; }
}

/* ---------- History drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10,31,68,0.35); z-index: 30; opacity: 0; transition: opacity .2s ease; }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 320px; max-width: 85vw;
  background: #fff; z-index: 40; box-shadow: var(--shadow-lg);
  transform: translateX(-100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; border-bottom: 1px solid var(--sq-line); }
.drawer-head h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.2px; }
.drawer-close { border: 0; background: none; font-size: 18px; color: var(--sq-ink-muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; line-height: 1; }
.drawer-close:hover { background: var(--sq-bg); color: var(--sq-ink); }
.history-list { flex: 1; overflow-y: auto; padding: 8px; }
.history-item { padding: 12px; border-radius: 12px; cursor: pointer; margin-bottom: 2px; transition: background .14s ease; }
.history-item:hover { background: var(--sq-bg); }
.history-item.active { background: var(--sq-tint); }
.history-item .h-title { font-size: 13.5px; font-weight: 600; color: var(--sq-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-meta { font-size: 11.5px; color: var(--sq-ink-muted); margin-top: 3px; }
.history-empty { padding: 24px 16px; text-align: center; color: var(--sq-ink-muted); font-size: 13px; }
