:root {
  --bg: #0f1218; --panel: #171b23; --panel2: #1e2330; --line: #2a3040;
  --text: #e8ebf2; --muted: #8b93a7; --accent: #4f7cff; --good: #2fbf71; --warn: #f0a83a; --bad: #ef5b5b;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); padding: 7px 12px; background: var(--panel2); color: var(--text); }
button:hover { border-color: #3d4660; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); background: transparent; }
button.sm { padding: 4px 9px; font-size: 12px; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 12px; }
label input, label select, label textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }
.err { color: var(--bad); min-height: 1em; }

main { max-width: 1400px; margin: 0 auto; padding: 0 20px 40px; }
.top { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #4f7cff, #7a5af5); display: grid; place-items: center; color: #fff; }
.live { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(47,191,113,.6); animation: pulse 2s infinite; }
.live.stale .dot { background: var(--warn); animation: none; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.banner { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #3a2c12; border: 1px solid #6b4f1a; color: #ffd89a; }

.floor-head, .section-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 12px; gap: 10px; }
.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.desk { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.desk::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.desk.working { border-color: color-mix(in srgb, var(--c) 60%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent), 0 8px 30px -12px var(--c); }
.desk.off { opacity: .55; }
.desk-top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--c); display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff; flex: none; position: relative; }
.avatar .st { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--panel); background: var(--muted); }
.st.idle { background: var(--good); } .st.working { background: var(--warn); animation: pulse 1.2s infinite; } .st.error { background: var(--bad); }
.desk-name { font-weight: 650; font-size: 15px; }
.desk-title { color: var(--muted); font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.chip.claude { color: #f2b48a; border-color: #5a3d2a; } .chip.gpt { color: #8fe0bf; border-color: #23533f; }
.desk-status { font-size: 12px; color: var(--muted); min-height: 34px; }
.desk-status.error { color: var(--bad); }
.typing span { display: inline-block; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%; background: var(--warn); animation: bounce 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
.desk-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.card { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--line)); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: #3d4660; }
.card-title { font-weight: 550; font-size: 13px; }
.card-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

.feed-wrap { min-width: 0; }
.note-form { margin-bottom: 10px; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.feed li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.feed .who { font-weight: 600; color: var(--c, var(--text)); }
.feed .when { float: right; font-size: 11px; color: var(--muted); }
.feed li.error { border-color: #5a2626; }
.feed li.handoff { border-style: dashed; }
.feed li.new { animation: flash 1.5s; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.file { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.file:hover { border-color: #3d4660; }
.file pre { margin: 8px 0 0; max-height: 90px; overflow: hidden; color: var(--muted); font-size: 11px; white-space: pre-wrap; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(760px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.modal-inner { padding: 20px; }
.modal-inner h2 { margin-bottom: 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.output { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 45vh; overflow: auto; font-size: 13px; }
.team-list { list-style: none; padding: 0; margin: 10px 0; }
.team-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team-list li span:first-child { flex: 1; }
.linkbox { word-break: break-all; background: var(--bg); padding: 10px; border-radius: 8px; border: 1px dashed var(--accent); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.auth-card h2 { margin: 18px 0 6px; }
.auth-card button { width: 100%; margin-top: 8px; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(240,168,58,.5); } 70% { box-shadow: 0 0 0 7px rgba(240,168,58,0); } 100% { box-shadow: 0 0 0 0 rgba(240,168,58,0); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-3px); opacity: 1; } }
@keyframes flash { from { background: #24304d; } to { background: var(--panel); } }

@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  main { padding: 0 16px 30px; }
  .board { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .top-actions { margin-left: 0; width: 100%; }
}
