:root {
  --bg: #081018;
  --panel: #111a27;
  --panel2: #0d1520;
  --line: #253249;
  --text: #e7edf7;
  --muted: #99a8bd;
  --accent: #b63a3a;
  --accent2: #8f2d2d;
  --good: #48c78e;
  --warn: #e7b24b;
  --bad: #ea6767;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #132238 0%, var(--bg) 45%);
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
input, select, textarea {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8,16,24,.8);
  color: var(--text);
  padding: .65rem .8rem;
  min-width: 0;
}
textarea { min-height: 92px; width: 100%; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6f7e92; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled, select:disabled { opacity: .65; cursor: not-allowed; }
code {
  background: rgba(255,255,255,.06);
  padding: .1rem .35rem;
  border-radius: .4rem;
}
small, .small { font-size: .88rem; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .88rem; }
.srOnly {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; backdrop-filter: blur(10px);
  background: rgba(8, 16, 24, 0.78);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.brand { display: flex; flex-direction: column; gap: .2rem; }
.brand h1 { margin: 0; font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase; }
.brand small { color: var(--muted); }
.userbox { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 1.4rem 1.25rem 2rem; }
.grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.15rem; }
.stack { display: grid; gap: 1.15rem; }
.card {
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(17,26,39,.92), rgba(10,16,24,.92));
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.cardTop { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.cardTop h3 { margin: 0; line-height: 1.25; }
.card.subtle { background: linear-gradient(180deg, rgba(13,21,32,.96), rgba(9,14,21,.96)); }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.1rem; }
.hero h2 { margin: 0; font-size: 2rem; }
.hero p { margin: .35rem 0 0; color: var(--muted); line-height: 1.55; max-width: 68ch; }
.stats, .profiles, .tasks, .users { display: grid; gap: .85rem; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.statsWide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.statsThree { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  padding: .8rem; border-radius: 14px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.stat .label { color: var(--muted); font-size: .8rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: .2rem; }
.sectionHead {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin: 0 0 .75rem;
}
.sectionHead h3 {
  margin: 0; font-size: 1rem; letter-spacing: .02em; text-transform: uppercase; color: #f2f6fb;
}
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  border-radius: 999px; padding: .35rem .65rem; font-size: .82rem; color: var(--muted);
}
.tabBar { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.tabBtn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem .9rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04); color: var(--muted); text-decoration: none;
  font-weight: 700; letter-spacing: .02em;
}
.tabBtn.active { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: white; }
.tabPanel { display: block; margin-top: 1rem; }
body.tabsReady .tabPanel { display: none; }
body.tabsReady .tabPanel.active { display: block; }
.kanbanBoard {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}
.kanbanColumn { min-width: 260px; display: grid; gap: .65rem; align-self: start; }
.kanbanHeader { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.kanbanHeader h4 { margin: 0; font-size: .98rem; }
.kanbanHeader p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; max-width: 24ch; }
.kanbanLane { display: grid; gap: .65rem; }
.emptyLane {
  padding: .75rem; border-radius: 14px; border: 1px dashed rgba(255,255,255,.12);
  color: var(--muted); background: rgba(255,255,255,.02); text-align: center;
}
.heroCard { padding-bottom: 1.1rem; }
.taskCard { padding: .9rem; display: grid; gap: .65rem; }
.taskCard h3 { margin: .1rem 0 .15rem; font-size: .98rem; line-height: 1.25; }
.taskHeader { display: flex; justify-content: space-between; gap: .9rem; align-items: flex-start; }
.taskTimes { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); font-size: .75rem; text-align: right; }
.taskMeta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; color: var(--muted); font-size: .75rem; }
.taskId { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .76rem; }
.taskBody { color: #d5deea; line-height: 1.5; margin: 0; white-space: pre-wrap; font-size: .92rem; }
.taskFooter { display: grid; gap: .5rem; }
.taskMenu { border-top: 1px solid rgba(255,255,255,.06); padding-top: .4rem; }
.taskMenu summary { list-style: none; }
.taskMenu summary::-webkit-details-marker { display: none; }
.taskMenuBody { display: grid; gap: .5rem; margin-top: .6rem; }
.taskMetaLine { color: var(--muted); }
.taskActions, .inlineForm, .stackForm { gap: .45rem; }
.taskActions { display: flex; flex-wrap: wrap; align-items: center; }
.inlineForm { display: flex; align-items: center; flex-wrap: wrap; }
.stackForm { display: grid; gap: .7rem; }
.stackForm + .stackForm { margin-top: .9rem; }
.legendGrid { display: grid; gap: .5rem; }
.legendGrid > div {
  display: grid; gap: .15rem; padding: .55rem .65rem; border-radius: 14px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05);
}
.legendGrid p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.formGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1.05rem; }
.formGrid .full { grid-column: 1 / -1; }
.formGrid label { display: grid; gap: .35rem; color: var(--muted); }
.formGrid input, .formGrid select, .formGrid textarea { width: 100%; }
.formActions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-top: 1rem; }
.chatShell { display: grid; gap: 1rem; }
.chatTopRow { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; flex-wrap: wrap; }
.chatPills { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.threadChip {
  display: inline-flex; align-items: center; padding: .22rem .5rem; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  color: var(--muted); font-size: .74rem; letter-spacing: .01em;
}
.chatBehaviorCard { padding: .85rem; }
.chatBehaviorHead { margin-bottom: .45rem; }
.chatBehaviorKv { gap: .35rem; }
.chatBehaviorKv div { padding-bottom: .25rem; }
.chatBehaviorNote { margin: .45rem 0 0; line-height: 1.4; }
.chatSideRail { max-width: 360px; }
.chatGridInner { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(280px, .72fr); gap: 1rem; align-items: start; }
.chatFeedCard, .chatComposerCard { padding: .9rem; }
.chatFeedHead, .chatComposerHead { margin-bottom: .5rem; }
.chatFeed { display: grid; gap: .7rem; max-height: 720px; overflow: auto; margin: 0; padding-right: .25rem; }
.chatMsg {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .6rem;
  align-items: start;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: .8rem .85rem;
  background: rgba(255,255,255,.03);
}
.chat-user { justify-self: end; max-width: min(90%, 700px); border-color: rgba(182,58,58,.25); background: rgba(182,58,58,.08); }
.chat-assistant { justify-self: start; max-width: min(90%, 700px); border-color: rgba(72,199,142,.25); background: rgba(72,199,142,.06); }
.chatAvatar {
  width: 1.8rem; height: 1.8rem; border-radius: 999px; display: grid; place-items: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  font-weight: 800; color: var(--text); flex: 0 0 auto; font-size: .8rem;
}
.chatBubble { min-width: 0; }
.chatMeta { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; margin-bottom: .35rem; }
.chatMeta .small { margin-left: auto; }
.chatBody { white-space: pre-wrap; line-height: 1.48; color: #e5edf6; font-size: .94rem; }
.chatAttachments { display: grid; gap: .45rem; margin-top: .55rem; }

.attachmentHead { display: flex; gap: .45rem; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.chatImage { max-width: 100%; border-radius: 12px; display: block; }
.chatPreview { margin: .35rem 0 0; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.chatComposer { gap: .65rem; }
.chatComposerField { display: grid; gap: .32rem; }
.chatComposerField textarea { min-height: 106px; }
.chatFileInput { display: none; }
.chatUploadRow {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .45rem .55rem; border-radius: 14px; border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.chatUploadRow.is-dragover { border-color: rgba(124,227,180,.45); background: rgba(124,227,180,.08); box-shadow: 0 0 0 1px rgba(124,227,180,.15) inset; }
.uploadChip { white-space: nowrap; }
.chatFileSummary { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chatDropHint { margin-left: auto; white-space: nowrap; }
.chatActions { margin-top: 0; align-items: center; justify-content: space-between; gap: .6rem; }
.chatActions .note { max-width: 36ch; }
.flash { margin-bottom: 1rem; padding: .85rem 1rem; border-radius: 14px; background: rgba(72,199,142,.11); border: 1px solid rgba(72,199,142,.25); color: #b7f3d6; }
.flash.warning { background: rgba(231,178,75,.12); border-color: rgba(231,178,75,.25); color: #ffd995; }
.loginShell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.loginCard { max-width: 520px; width: 100%; padding: 1.1rem; }
.loginCard h1 { margin: .2rem 0 .4rem; font-size: 2rem; line-height: 1.1; }
.loginCard p { color: var(--muted); line-height: 1.55; }
.loginCard label { display: block; margin: .85rem 0; color: var(--text); }
.loginCard input { width: 100%; margin-top: .35rem; }
.loginCard .meta { display: grid; gap: .45rem; margin-top: 1rem; font-size: .92rem; color: var(--muted); line-height: 1.45; }
.btn, button {
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  color: white; border-radius: 12px; padding: .7rem .9rem;
  cursor: pointer; font-weight: 600;
}
.btn:hover, button:hover { filter: brightness(1.08); }
.btnGhost { background: rgba(255,255,255,.04); color: var(--text); }
.btnSmall { padding: .5rem .72rem; font-size: .9rem; }
.kv { display: grid; gap: .45rem; margin: .75rem 0 0; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid rgba(255,255,255,.05); padding-bottom: .3rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; padding: .28rem .55rem;
  border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-ready, .badge-todo, .badge-triage { background: rgba(230,178,75,.16); color: #f0cb79; }
.badge-running { background: rgba(72,199,142,.16); color: #7ce3b4; }
.badge-blocked { background: rgba(234,103,103,.16); color: #ff9696; }
.badge-done { background: rgba(72,199,142,.14); color: #8cf0bf; }
.badge-review, .badge-scheduled { background: rgba(143,45,45,.16); color: #ffb0b0; }
.badge-archived { background: rgba(153,168,189,.12); color: #c8d1df; }
.badge-unknown { background: rgba(255,255,255,.08); color: var(--muted); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .45rem; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.small { font-size: .88rem; }
@media (max-width: 1100px) {
  .grid, .profiles, .stats, .statsWide, .statsThree, .chatGridInner { grid-template-columns: 1fr; }
  .taskHeader, .hero, .chatTopRow { flex-direction: column; }
  .taskTimes { text-align: left; }
  .kanbanBoard { grid-template-columns: 1fr; }
  .chatActions { justify-content: flex-start; }
}
