:root {
  --bg: #0b0d12;
  --panel: #11141b;
  --panel-2: #0f1218;
  --line: #222733;
  --text: #e7eaf0;
  --muted: #8c93a3;
  --accent: #6e56cf;
  --accent-2: #20c997;
  --danger: #ff6b6b;
  --card: #131823;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(circle at 20% 0%, #101525 0%, var(--bg) 35%);
  color: var(--text);
}
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr 280px;
}
.sidebar, .activity {
  border-right: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(8px);
}
.activity { border-right: 0; border-left: 1px solid var(--line); padding: 16px; }
.brand { padding: 18px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
#nav { padding: 10px; display: grid; gap: 4px; }
.nav-item {
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.nav-item.active, .nav-item:hover { background: #171c27; color: var(--text); }
.sidebar-footer { color: var(--muted); padding: 14px; position: absolute; bottom: 0; }
.content { padding: 16px 20px; overflow: auto; }
.topbar { display: flex; justify-content: space-between; gap: 10px; }
.topbar-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.menu-toggle { display: none; min-width: 40px; padding: 8px 10px; }
input, select, textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
}
#search { max-width: 440px; }
.topbar-left #search { max-width: 100%; }
.topbar-actions { display: flex; gap: 8px; }
button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: transparent; }
button.ghost:hover { background: #181e2b; }
.stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}
.stat-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.stat-card b { display: block; font-size: 24px; margin-bottom: 2px; }
.stat-card span { color: var(--muted); }
.toolbar { display: flex; gap: 8px; margin: 14px 0; }
.hidden { display: none !important; }
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 10px;
}
.office-screen,
.team-screen {
  min-height: 560px;
}
.office-controls { display: flex; gap: 8px; margin-bottom: 10px; }
.office-map {
  position: relative;
  min-height: 560px;
  border: 1px solid #2a3347;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #1a1c23 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(-45deg, #1a1c23 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(45deg, transparent 75%, #1a1c23 75%) -12px 0/24px 24px,
    linear-gradient(-45deg, transparent 75%, #1a1c23 75%) -12px 0/24px 24px,
    #14161d;
}
.zone-label{position:absolute;color:#8e97ad;font-size:10px;text-transform:uppercase;letter-spacing:.08em}
.desk {
  position: absolute;
  width: 84px;
  height: 20px;
  background: #6a6d78;
  border: 2px solid #555a67;
}
.monitor {
  position: absolute;
  width: 20px;
  height: 14px;
  background: #3887ff;
  border: 2px solid #255fc0;
}
.coffee-machine,.lunch-table,.plant {
  position:absolute;border:2px solid #3a4154;border-radius:6px;
}
.coffee-machine{width:52px;height:62px;background:#606674}
.lunch-table{width:96px;height:52px;background:#6b5c48}
.plant{width:24px;height:24px;border-radius:999px;background:#2f9e66;border-color:#1f6f46}
.agent {
  position:absolute;
  transition:left .9s ease, top .9s ease;
}
.agent-sprite {
  width:20px;
  height:20px;
  border-radius:4px;
  border:2px solid #111;
  position:relative;
  box-shadow: inset 0 -4px rgba(0,0,0,.18);
}
.agent-sprite::before,.agent-sprite::after{content:'';position:absolute;background:#111;border-radius:999px}
.agent-sprite::before{width:3px;height:3px;left:5px;top:6px}
.agent-sprite::after{width:3px;height:3px;right:5px;top:6px}
.agent-hat{position:absolute;left:1px;top:-7px;font-size:11px;filter:drop-shadow(0 1px 0 #000)}
.agent-label {
  position: absolute;
  left:24px;top:2px;
  color: #dce4ff;
  font-size: 11px;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
}
.work-bubble {
  position: absolute;
  left:24px;top:-26px;
  max-width: 220px;
  background: rgba(0,0,0,.82);
  border: 1px solid #2a3347;
  border-radius: 8px;
  color: #dfe6ff;
  padding: 4px 7px;
  font-size: 11px;
  display:none;
}
.agent:hover .work-bubble{display:block}
.office-roster{display:grid;grid-template-columns:repeat(6,minmax(150px,1fr));gap:8px;margin-top:10px}
.roster-card{background:#111722;border:1px solid #283147;border-radius:10px;padding:8px}
.roster-name{font-size:12px;font-weight:700}
.roster-desc{font-size:11px;color:#9ba6bf;margin-top:4px;min-height:28px}
.roster-status{font-size:11px;color:#c8d4f2;margin-top:4px}
.team-mission {
  margin: 8px auto 18px;
  max-width: 860px;
  text-align: center;
  background: #111a2e;
  border: 1px solid #2a3654;
  border-radius: 10px;
  padding: 12px 16px;
  color: #c7d2f3;
}
.team-title { text-align: center; margin: 0; font-size: 40px; }
.team-sub { text-align: center; color: var(--muted); margin: 8px 0 18px; }
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.team-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}
.team-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.team-divider::before,
.team-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: #2b3242;
}
.team-card {
  background: #131a27;
  border: 1px solid #2a3347;
  border-radius: 12px;
  padding: 12px;
}
.team-card .name { font-weight: 700; font-size: 16px; }
.team-card .role { color: #c1cae0; margin: 2px 0 6px; }
.team-meta { color: var(--muted); font-size: 12px; }
.team-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.team-tag {
  border: 1px solid #2f3648;
  background: #151b28;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: #b8c0d1;
}
.memory-screen,
.docs-screen {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
  min-height: 560px;
}
.memory-list-pane,
.docs-list-pane,
.memory-doc-pane {
  background: rgba(9, 12, 18, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.memory-list-header,
.memory-doc-header {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.memory-file-item {
  padding: 9px;
  border: 1px solid #283049;
  border-radius: 8px;
  background: #151b28;
  margin-bottom: 8px;
  cursor: pointer;
}
.memory-file-item.active { border-color: #6e56cf; background: #1b2234; }
.memory-file-item .name { font-weight: 600; font-size: 12px; }
.memory-file-item .meta { color: var(--muted); font-size: 11px; }
.docs-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.docs-chip {
  border: 1px solid #2f3648;
  background: #151b28;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: #b8c0d1;
  cursor: pointer;
}
.docs-chip.active { border-color: #6e56cf; background: #1b2234; }
.memory-doc-content {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #dbe2ef;
  max-height: 510px;
  overflow: auto;
}
.cal-day {
  background: rgba(9, 12, 18, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 430px;
  padding: 10px;
}
.cal-day h5 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.event {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #2f3648;
  background: #161d2b;
}
.event .time { color: #9aa6c5; font-size: 11px; }
.event .name { font-weight: 600; font-size: 12px; display:flex; justify-content:space-between; gap:8px; align-items:center; }
.event.disabled { opacity: .45; }
.event-delete {
  border:1px solid #4a2a35;
  background:#2a141c;
  color:#ff9eb4;
  border-radius:6px;
  padding:1px 6px;
  font-size:10px;
  cursor:pointer;
}
.column {
  background: rgba(9, 12, 18, 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  min-height: 420px;
}
.column h4 { margin: 2px 0 10px; color: var(--muted); font-weight: 600; }
.card {
  background: var(--card);
  border: 1px solid #262d3d;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
#board [data-task-id] { cursor: pointer; }
.card .title { font-weight: 600; margin-bottom: 5px; }
.card .meta { color: var(--muted); font-size: 12px; }
.assignee {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1b2231;
  border: 1px solid #2a3448;
  color: #b8c0d1;
  font-size: 11px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.red { background: var(--danger); }
.green { background: var(--accent-2); }
.purple { background: var(--accent); }
#activityList { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#activityList li {
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f131c;
  color: var(--text);
  width: min(520px, 92vw);
}
#toolForm { display: grid; gap: 10px; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; }
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 29;
}

@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 200px 1fr; }
  .activity { display: none; }
  .board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .calendar { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .team-grid { grid-template-columns: 1fr; }
  .team-row { grid-template-columns: 1fr; }
  .office-roster { grid-template-columns: repeat(2, minmax(150px,1fr)); }
  .memory-screen, .docs-screen { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; height: 100dvh; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 320px);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s ease;
    border-right: 1px solid var(--line);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .mobile-backdrop { display: block; }

  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 12px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions { justify-content: flex-end; }

  .stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .toolbar {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .toolbar button { flex: 0 0 auto; }

  .board,
  .calendar { grid-template-columns: 1fr; }
  .office-map { min-height: 420px; }
  .office-roster { grid-template-columns: 1fr; }

  .memory-doc-content { max-height: 44dvh; }

  dialog {
    width: calc(100vw - 16px);
    max-width: none;
    margin: 8px;
  }
}
