:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-soft: #f4f5f7;
  --line: #d7dbe1;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #3f4752;
  --accent-ghost: #eceff3;
  --radius: 12px;
  --backlog: #4b5563;
  --in-progress: #9a6b2f;
  --blocked: #b04a4a;
  --done: #4f7c65;
}

:root[data-theme="dark"] {
  --bg: #1d2126;
  --surface: #282d33;
  --surface-soft: #23282d;
  --line: #3a424a;
  --text: #e7ebef;
  --muted: #9ba5b1;
  --accent: #d1d5db;
  --accent-ghost: #313740;
  --backlog: #b7bec8;
  --in-progress: #d3ab72;
  --blocked: #e28a8a;
  --done: #8ec7aa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 0%, var(--surface) 0%, var(--bg) 70%);
}

.app-shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 12px;
  padding-bottom: 74px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mascot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-color: var(--surface-soft);
  background-image: url('/assets/pixel-agents/characters/char_0.png');
  background-repeat: no-repeat;
  background-size: auto 28px;
  background-position: left top;
  image-rendering: pixelated;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.top-controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 6px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 7px 8px;
  font-size: 10px;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--text);
}

.tabs {
  margin: 10px 0;
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.card h3 {
  margin: 0;
  font-size: 13px;
}

.create-card {
  margin-bottom: 10px;
}

.tracker-card {
  margin-bottom: 10px;
}

.create-sections {
  display: grid;
  gap: 12px;
}

.create-section {
  display: grid;
  gap: 8px;
}

.task-form {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr auto;
  gap: 8px;
}

.project-form {
  grid-template-columns: 2fr 1fr 2fr auto;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

input,
select,
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.6fr) minmax(280px, 1fr);
  gap: 10px;
}

.agent-list {
  display: grid;
  gap: 8px;
}

.projects-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.project-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.integration-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.project-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.project-item.empty {
  color: var(--muted);
  font-size: 12px;
}

.project-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.project-item strong {
  font-size: 14px;
}

.project-item a {
  color: var(--text);
}

.project-meta,
.project-path,
.project-log {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.project-log {
  white-space: pre-wrap;
}

.integration-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.integration-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.integration-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.integration-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.integration-action-btn {
  padding: 7px 10px;
  font-size: 11px;
}

.openclaw-chat-card {
  margin-top: 10px;
}

.openclaw-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.openclaw-chat-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.openclaw-chat-messages {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.mobile-openclaw-chat-messages {
  max-height: 280px;
}

.openclaw-chat-empty {
  font-size: 12px;
  color: var(--muted);
}

.openclaw-chat-message {
  display: grid;
  gap: 4px;
}

.openclaw-chat-message header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.openclaw-chat-bubble {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 9px 10px;
  white-space: pre-wrap;
  font-size: 13px;
}

.openclaw-chat-message.assistant .openclaw-chat-bubble {
  border-color: #c8d4e6;
  background: #eef4fb;
}

:root[data-theme="dark"] .openclaw-chat-message.assistant .openclaw-chat-bubble {
  border-color: #4b5e79;
  background: #2c3b51;
}

.openclaw-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.openclaw-chat-pending {
  color: var(--muted);
  font-style: italic;
}

.agent-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.agent-item header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.status {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status.idle {
  background: var(--surface);
  color: var(--muted);
}

.status.running {
  background: #d9c3a0;
  color: #5b4121;
}

:root[data-theme="dark"] .status.running {
  background: #5c4d3b;
  color: #f0ddc5;
}

.status.blocked {
  background: #e5b7b7;
  color: #6f2f2f;
}

:root[data-theme="dark"] .status.blocked {
  background: #694444;
  color: #f5d1d1;
}

.board-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}

.board {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: max-content;
}

.column {
  width: min(88vw, 320px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 8px;
  scroll-snap-align: start;
}

.column header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.column[data-status="backlog"] header strong { color: var(--backlog); }
.column[data-status="in_progress"] header strong { color: var(--in-progress); }
.column[data-status="blocked"] header strong { color: var(--blocked); }
.column[data-status="done"] header strong { color: var(--done); }

.task {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 8px;
  padding: 8px;
}

.task header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.title {
  font-size: 14px;
}

.task p {
  margin: 6px 0;
  font-size: 12px;
  color: var(--muted);
}

.priority {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
}

.meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.cost {
  margin-top: 4px;
  font-size: 11px;
  color: var(--done);
}

.agent-result {
  display: none;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.agent-result.visible {
  display: block;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.actions button {
  background: var(--accent-ghost);
  border-color: var(--line);
  color: var(--text);
  font-size: 11px;
  padding: 6px 8px;
}

.actions button.danger,
.mobile-detail-actions button.danger {
  background: rgba(232, 88, 88, 0.14);
  border-color: rgba(232, 88, 88, 0.38);
  color: #ffb0b0;
}

.actions select {
  font-size: 11px;
  padding: 6px 8px;
}

details summary {
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.task ul {
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11px;
}

.arena-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.arena-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.arena-add-btn {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
}

.arena {
  position: relative;
  min-height: 430px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%),
    repeating-linear-gradient(0deg, rgba(120, 130, 140, 0.08), rgba(120, 130, 140, 0.08) 1px, transparent 1px, transparent 22px),
    repeating-linear-gradient(90deg, rgba(120, 130, 140, 0.08), rgba(120, 130, 140, 0.08) 1px, transparent 1px, transparent 22px);
  overflow: hidden;
}

.pixel-office {
  padding: 10px;
}

.pixel-office-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.pixel-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px;
}

.pixel-stat span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pixel-stat strong {
  font-size: 16px;
}

.pixel-office-sync,
.pixel-office-error {
  margin: 0 0 8px;
  font-size: 11px;
}

.pixel-office-sync {
  color: var(--muted);
}

.pixel-office-error {
  color: var(--blocked);
}

.office-scene-wrap {
  overflow-x: hidden;
  overflow-y: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.office-scene {
  position: relative;
  min-height: 360px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0.04)),
    url('/assets/pixel-agents/floors/floor_1.png');
  background-size: 100% 100%, 32px 32px;
  image-rendering: pixelated;
  margin: 0 auto;
  box-shadow:
    inset 0 10px 0 rgba(255, 255, 255, 0.07),
    inset 0 -10px 0 rgba(0, 0, 0, 0.08);
}

.office-scene-quad .quad-wall-h,
.office-scene-quad .quad-wall-v,
.office-scene-quad .quad-floor,
.office-scene-quad .quad-shelf,
.office-scene-quad .quad-bar,
.office-scene-quad .quad-cooler,
.office-scene-quad .quad-fridge,
.office-scene-quad .quad-meeting-table,
.office-scene-quad .quad-meeting-chair,
.office-scene-quad .quad-monitor {
  position: absolute;
  image-rendering: pixelated;
}

.office-scene-quad .quad-floor {
  border: 1px solid rgba(16, 22, 30, 0.24);
}

.office-scene-quad .quad-floor.room-a {
  left: 10px;
  top: 72px;
  width: 150px;
  height: 150px;
  background: url('/assets/pixel-agents/floors/floor_1.png');
  background-size: 32px 32px;
}

.office-scene-quad .quad-floor.room-b {
  right: 10px;
  top: 72px;
  width: 150px;
  height: 150px;
  background: #e7e7e2;
  background-image: repeating-linear-gradient(0deg, rgba(110, 116, 122, 0.2), rgba(110, 116, 122, 0.2) 1px, transparent 1px, transparent 25px), repeating-linear-gradient(90deg, rgba(110, 116, 122, 0.2), rgba(110, 116, 122, 0.2) 1px, transparent 1px, transparent 25px);
}

.office-scene-quad .quad-floor.room-c {
  left: 10px;
  bottom: 10px;
  width: 150px;
  height: 150px;
  background: #8a6037;
  background-image: repeating-linear-gradient(90deg, rgba(63, 38, 19, 0.3), rgba(63, 38, 19, 0.3) 2px, transparent 2px, transparent 20px);
}

.office-scene-quad .quad-floor.room-d {
  right: 10px;
  bottom: 10px;
  width: 150px;
  height: 150px;
  background: #3f6d96;
}

.office-scene-quad .quad-wall-h {
  left: 8px;
  right: 8px;
  top: 222px;
  height: 7px;
  background: #17273b;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.office-scene-quad .quad-wall-v {
  top: 70px;
  bottom: 8px;
  left: 50%;
  width: 7px;
  transform: translateX(-50%);
  background: #17273b;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.2);
}

.office-scene-quad .quad-shelf {
  width: 64px;
  height: 32px;
  background: url('/assets/pixel-agents/furniture/LARGE_PAINTING.png') no-repeat;
  background-size: 64px 64px;
  box-shadow: inset 0 0 0 2px #69462b;
}

.office-scene-quad .quad-shelf.shelf-a1 {
  left: 16px;
  top: 82px;
}

.office-scene-quad .quad-shelf.shelf-a2 {
  left: 86px;
  top: 82px;
}

.office-scene-quad .quad-bar {
  right: 26px;
  top: 84px;
  width: 64px;
  height: 64px;
  background: url('/assets/pixel-agents/furniture/SMALL_TABLE_FRONT.png') no-repeat;
  background-size: 64px 64px;
}

.office-scene-quad .quad-cooler {
  right: 96px;
  top: 84px;
  width: 32px;
  height: 64px;
  background: url('/assets/pixel-agents/furniture/CLOCK.png') no-repeat;
  background-size: 32px 64px;
}

.office-scene-quad .quad-fridge {
  right: 10px;
  top: 84px;
  width: 32px;
  height: 64px;
  background: url('/assets/pixel-agents/furniture/PC_FRONT_ON_1.png') no-repeat;
  background-size: 32px 64px;
}

.office-scene-quad .quad-meeting-table {
  right: 56px;
  bottom: 44px;
  width: 64px;
  height: 64px;
  background: url('/assets/pixel-agents/furniture/COFFEE_TABLE.png') no-repeat;
  background-size: 64px 64px;
}

.office-scene-quad .quad-meeting-chair {
  width: 32px;
  height: 64px;
  bottom: 34px;
  background: url('/assets/pixel-agents/furniture/WOODEN_CHAIR_FRONT.png') no-repeat;
  background-size: 32px 64px;
}

.office-scene-quad .quad-meeting-chair.left {
  right: 108px;
}

.office-scene-quad .quad-meeting-chair.right {
  right: 40px;
}

.office-scene-quad .quad-monitor {
  right: 76px;
  bottom: 70px;
  width: 32px;
  height: 64px;
  background: url('/assets/pixel-agents/furniture/PC_FRONT_ON_1.png') no-repeat;
  background-size: 32px 64px;
}

.office-rug {
  position: absolute;
  border-radius: 10px;
  border: 2px solid rgba(37, 52, 68, 0.45);
  background:
    repeating-linear-gradient(90deg, rgba(249, 236, 202, 0.75), rgba(249, 236, 202, 0.75) 8px, rgba(196, 150, 108, 0.75) 8px, rgba(196, 150, 108, 0.75) 16px),
    linear-gradient(180deg, rgba(245, 220, 180, 0.55), rgba(203, 164, 126, 0.55));
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.office-rug.rug-main {
  left: 22px;
  top: 78px;
  width: 220px;
  height: 84px;
}

.office-rug.rug-lounge {
  right: 20px;
  bottom: 16px;
  width: 130px;
  height: 76px;
}

.office-rug.rug-kitchen {
  left: 8px;
  bottom: 14px;
  width: 120px;
  height: 74px;
}

.office-wall {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-image: url('/assets/pixel-agents/walls/wall_0.png');
  background-size: 128px 256px;
  background-repeat: repeat-x;
  image-rendering: pixelated;
  opacity: 0.95;
}

.office-windows {
  position: absolute;
  left: 84px;
  right: 84px;
  top: 10px;
  height: 42px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.office-window {
  width: 110px;
  height: 42px;
  border: 2px solid rgba(219, 229, 240, 0.65);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(103, 173, 255, 0.9), rgba(169, 218, 255, 0.7) 60%, rgba(182, 230, 255, 0.9)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.35) 2px, transparent 2px, transparent 9px);
  box-shadow:
    inset 0 0 0 2px rgba(11, 38, 66, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
}

.office-window::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  background: rgba(14, 50, 82, 0.38);
}

.office-window::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
  background: rgba(14, 50, 82, 0.38);
}

.office-plant {
  position: absolute;
  width: 32px;
  height: 64px;
  top: 12px;
  background-image: url('/assets/pixel-agents/furniture/PLANT.png');
  background-size: 32px 64px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.office-plant.left {
  left: 10px;
}

.office-plant.right {
  right: 10px;
}

.office-tv-zone,
.office-lounge,
.office-kitchen {
  position: absolute;
}

.office-tv-zone {
  right: 18px;
  top: 12px;
  width: 84px;
  height: 72px;
}

.office-tv,
.office-clock,
.office-sofa,
.office-coffee-table,
.office-coffee-cup,
.office-kitchen-table,
.office-kitchen-coffee,
.office-kitchen-pot {
  position: absolute;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.office-tv {
  right: 0;
  top: 8px;
  width: 64px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/LARGE_PAINTING.png');
  background-size: 64px 64px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.office-tv::after {
  content: 'TV';
  position: absolute;
  left: 18px;
  top: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ccd6df;
  text-shadow: 0 0 5px rgba(97, 180, 255, 0.55);
}

.office-clock {
  left: 0;
  top: 0;
  width: 32px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/CLOCK.png');
  background-size: 32px 64px;
}

.office-lounge {
  right: 22px;
  bottom: 24px;
  width: 120px;
  height: 90px;
}

.office-sofa {
  right: 0;
  top: 24px;
  width: 64px;
  height: 32px;
  background-image: url('/assets/pixel-agents/furniture/SOFA_FRONT.png');
  background-size: 64px 32px;
}

.office-coffee-table {
  right: 54px;
  top: 18px;
  width: 64px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/COFFEE_TABLE.png');
  background-size: 64px 64px;
}

.office-coffee-cup {
  right: 72px;
  top: 30px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/pixel-agents/furniture/COFFEE.png');
  background-size: 20px 20px;
}

.office-kitchen {
  left: 14px;
  bottom: 20px;
  width: 110px;
  height: 94px;
}

.office-kitchen-table {
  left: 0;
  top: 24px;
  width: 64px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/SMALL_TABLE_FRONT.png');
  background-size: 64px 64px;
}

.office-kitchen-coffee {
  left: 21px;
  top: 38px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/pixel-agents/furniture/COFFEE.png');
  background-size: 20px 20px;
}

.office-kitchen-pot {
  left: 64px;
  top: 38px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/pixel-agents/furniture/POT.png');
  background-size: 20px 20px;
}

.office-seat {
  position: absolute;
  width: 120px;
  height: 110px;
  cursor: pointer;
  transition:
    left 420ms cubic-bezier(0.2, 0.9, 0.2, 1),
    top 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.office-seat.is-frozen {
  transition: none;
  filter: saturate(0.94);
}

.office-seat.status-idle {
  opacity: 0.85;
}

.office-seat.place-static .office-desk,
.office-seat.place-static .office-chair,
.office-seat.place-static .office-pc {
  display: none;
}

.office-seat.place-static .office-agent {
  left: 0;
  top: 8px;
}

.office-seat.place-static .office-seat-label {
  top: 42px;
}

.office-desk,
.office-chair,
.office-pc {
  position: absolute;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.office-desk {
  left: 20px;
  top: 34px;
  width: 96px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/DESK_FRONT.png');
  background-size: 96px 64px;
}

.office-chair {
  left: 0;
  top: 45px;
  width: 32px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/WOODEN_CHAIR_FRONT.png');
  background-size: 32px 64px;
}

.office-pc {
  left: 68px;
  top: 30px;
  width: 32px;
  height: 64px;
  background-image: url('/assets/pixel-agents/furniture/PC_FRONT_ON_1.png');
  background-size: 32px 64px;
}

.office-agent {
  position: absolute;
  left: 10px;
  top: 24px;
}

.office-seat-label {
  position: absolute;
  left: 0;
  top: -2px;
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.office-seat-label strong {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.office-seat-label span {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.office-token-bar {
  position: absolute;
  left: 0;
  top: -12px;
  width: 108px;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(31, 41, 55, 0.15);
}

.office-token-fill {
  height: 100%;
  width: 100%;
}

.office-token-bar.ok .office-token-fill {
  background: linear-gradient(90deg, #1f9d55, #3ecf8e);
}

.office-token-bar.warn .office-token-fill {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.office-token-bar.danger .office-token-fill {
  background: linear-gradient(90deg, #dc2626, #fb7185);
}

.office-badge {
  position: absolute;
  left: 0;
  top: -16px;
  border: 1px solid var(--in-progress);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
}

.office-zone-label {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  opacity: 0.9;
}

.office-place-label {
  position: absolute;
  border: 1px dashed rgba(230, 235, 240, 0.7);
  border-radius: 999px;
  background: rgba(24, 31, 39, 0.6);
  color: #f0f4f8;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  backdrop-filter: blur(1px);
}

.office-place-label.window {
  border-style: solid;
  color: #d6f1ff;
}

.office-place-label.idle {
  border-style: solid;
  color: #d3f2d8;
}

.office-place-map {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px;
}

.office-place-map h4 {
  margin: 0 0 6px;
  font-size: 12px;
}

.office-place-binding {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.office-place-binding:last-child {
  margin-bottom: 0;
}

.office-place-binding code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.arena-agent-modal.hidden {
  display: none;
}

.arena-agent-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
}

.arena-agent-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 12, 16, 0.55);
  backdrop-filter: blur(2px);
}

.arena-agent-modal-panel {
  position: relative;
  width: min(92vw, 520px);
  margin: 8vh auto 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  padding: 14px;
}

.arena-agent-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.arena-agent-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.arena-agent-modal-header button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
}

.arena-agent-form {
  display: grid;
  gap: 10px;
}

.arena-agent-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.arena-agent-form textarea {
  resize: vertical;
  min-height: 92px;
}

.pixel-desks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.pixel-desk {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px;
}

.pixel-desk.status-in_progress {
  border-color: var(--in-progress);
}

.pixel-desk.status-blocked {
  border-color: var(--blocked);
}

.pixel-desk.status-done {
  border-color: var(--done);
}

.pixel-desk-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pixel-desk-header strong {
  font-size: 12px;
}

.pixel-desk-header span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.pixel-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pixel-sprite {
  width: 16px;
  height: 32px;
  background-image: var(--sprite-url);
  background-repeat: no-repeat;
  background-size: 112px 96px;
  background-position: 0 0;
  image-rendering: pixelated;
  transform: scale(2);
  transform-origin: left center;
  margin-right: 8px;
}

.pixel-sprite.sprite-in_progress {
  animation: sprite-typing 700ms steps(1) infinite;
}

.pixel-sprite.sprite-blocked {
  animation: sprite-reading 1100ms steps(1) infinite;
}

.pixel-sprite.sprite-done {
  background-position: -16px 0;
}

.pixel-label {
  font-size: 12px;
  font-weight: 700;
}

.pixel-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.pixel-office-empty {
  padding: 16px;
}

.pixel-office-empty h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.pixel-office-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.pixel-debug {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
}

@keyframes sprite-typing {
  0% { background-position: -48px 0; }
  50% { background-position: -64px 0; }
  100% { background-position: -48px 0; }
}

@keyframes sprite-reading {
  0% { background-position: -80px 0; }
  50% { background-position: -96px 0; }
  100% { background-position: -80px 0; }
}

.mobile-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.log-modal.hidden {
  display: none;
}

.log-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.log-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 22, 0.55);
}

.log-modal-panel {
  position: relative;
  margin: 4vh auto;
  width: min(980px, calc(100% - 24px));
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.log-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.log-modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.log-modal-header button {
  background: var(--accent-ghost);
  border-color: var(--line);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
}

.log-modal-meta {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.log-modal-content {
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "JetBrains Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface-soft);
}

.report-modal-content {
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  white-space: normal;
}

.report-modal-content h1,
.report-modal-content h2,
.report-modal-content h3 {
  margin: 0 0 8px;
  line-height: 1.3;
}

.report-modal-content p {
  margin: 0 0 10px;
}

.report-modal-content ul {
  margin: 0 0 10px 18px;
  padding: 0;
}

.report-modal-content li {
  margin: 0 0 6px;
}

.report-modal-content code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent-ghost);
  font-family: "JetBrains Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
}

.mobile-nav-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  min-height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.mobile-nav-btn.active {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

.mobile-nav-btn .icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mobile-nav-btn .icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.mobile-app {
  display: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px;
}

.mobile-screen {
  display: none;
  opacity: 0;
  transform: translateX(12px);
}

.mobile-screen.active {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.mobile-screen.animate-in {
  animation: mobile-screen-in 180ms ease-out;
}

@keyframes mobile-screen-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mobile-screen-header h3 {
  margin: 0;
  font-size: 18px;
}

.mobile-screen-header p {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-screen-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  padding-bottom: 6px;
}

.mobile-screen-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-arena-toolbar {
  display: flex;
  margin-bottom: 8px;
}

.mobile-arena-toolbar .arena-add-btn {
  width: 100%;
}

.mobile-arena {
  min-height: 520px;
}

.mobile-back-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
}

.mobile-filters {
  margin-bottom: 10px;
}

.mobile-project-focus {
  margin-bottom: 10px;
}

.mobile-project-focus-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
}

.mobile-project-focus-card.selected {
  border-color: var(--accent);
  background: var(--surface);
}

.mobile-project-focus-card strong {
  font-size: 14px;
  color: var(--text);
}

.mobile-project-focus-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.mobile-project-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-project-focus-actions button {
  padding: 7px 10px;
  font-size: 11px;
}

.mobile-list {
  display: grid;
  gap: 8px;
}

.mobile-list .empty,
.empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mobile-project-item {
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
}

.mobile-project-item.selected {
  border-color: var(--accent);
  background: var(--surface);
}

.mobile-project-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mobile-project-item-head strong {
  font-size: 14px;
  color: var(--text);
}

.mobile-project-item-head span,
.mobile-project-item-meta,
.mobile-project-item-log,
.mobile-project-item-action {
  font-size: 11px;
}

.mobile-project-item-head span,
.mobile-project-item-meta {
  color: var(--muted);
}

.mobile-project-item-log {
  color: var(--text);
  opacity: 0.82;
}

.mobile-project-item-action {
  color: var(--accent);
  font-weight: 700;
}

.mobile-issue-item {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.mobile-issue-item.selected {
  border-color: var(--accent);
}

.mobile-issue-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.mobile-issue-meta {
  font-size: 11px;
  color: var(--muted);
}

.mobile-create-form {
  display: grid;
  gap: 8px;
}

.mobile-create-stack {
  display: grid;
  gap: 12px;
}

.mobile-create-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}

.mobile-create-section.disabled {
  opacity: 0.7;
}

.mobile-create-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.mobile-create-context {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-create-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.mobile-details .empty {
  color: var(--muted);
  font-size: 13px;
}

.mobile-detail-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.mobile-detail-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.mobile-detail-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mobile-detail-row strong {
  color: var(--text);
}

.mobile-agent-result {
  margin: 8px 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mobile-agent-result span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.mobile-agent-result p {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
}

.mobile-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.mobile-detail-actions button {
  padding: 6px 9px;
  font-size: 11px;
}

.mobile-app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand-mascot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background-color: var(--surface-soft);
  background-image: url('/assets/pixel-agents/characters/char_0.png');
  background-repeat: no-repeat;
  background-size: auto 22px;
  background-position: left top;
  image-rendering: pixelated;
}

.arena-context-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.arena-context-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.arena-context-panel {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
  max-width: 280px;
  padding: 8px;
}

.arena-context-header {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--line);
}

.arena-context-header strong {
  font-size: 13px;
}

.arena-context-header span {
  font-size: 11px;
  color: var(--muted);
}

.arena-context-actions {
  display: grid;
  gap: 6px;
}

.arena-context-actions button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  padding: 9px 10px;
}

.arena-context-actions button.danger {
  border-color: #b04a4a;
  background: #b04a4a;
}

@media (max-width: 1060px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .task-form {
    grid-template-columns: 1fr 1fr;
  }

  .project-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .arena-context-panel {
    max-width: min(320px, calc(100vw - 16px));
  }

  .arena-context-actions button {
    min-height: 40px;
  }

  .app-shell {
    padding: 10px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .brand-mascot {
    width: 24px;
    height: 24px;
    background-size: auto 24px;
  }

  .brand-title {
    font-size: 16px;
  }

  .top-controls {
    width: 100%;
    justify-items: stretch;
  }

  .theme-toggle {
    width: 100%;
  }

  .metrics {
    display: none;
  }

  body[data-active-tab='control'] .app-shell {
    display: none;
  }

  body[data-active-tab='arena'] .app-shell {
    display: block;
  }

  .tabs {
    width: 100%;
    display: flex;
  }

  .tab {
    flex: 1;
    text-align: center;
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .project-form {
    grid-template-columns: 1fr;
  }

  .arena-toolbar {
    justify-content: stretch;
  }

  .arena-add-btn {
    width: 100%;
  }

  .office-scene.compact .office-tv-zone {
    right: 8px;
    top: 6px;
    transform: scale(0.85);
    transform-origin: top right;
  }

  .office-scene.compact .office-windows {
    left: 56px;
    right: 56px;
    top: 8px;
    height: 34px;
  }

  .office-scene.compact .office-window {
    width: 86px;
    height: 34px;
  }

  .office-scene.compact .office-lounge {
    right: 8px;
    bottom: 10px;
    transform: scale(0.9);
    transform-origin: bottom right;
  }

  .office-scene.compact .office-kitchen {
    left: 6px;
    bottom: 10px;
    transform: scale(0.9);
    transform-origin: bottom left;
  }

  .office-scene.compact .office-place-label {
    font-size: 8px;
    padding: 1px 6px;
  }

  .office-scene.compact .office-rug.rug-main {
    left: 14px;
    top: 84px;
    width: 172px;
    height: 66px;
  }

  .mobile-arena .pixel-office-head,
  .mobile-arena .office-place-map,
  .mobile-arena .pixel-desks {
    display: none;
  }

  .mobile-arena .pixel-office {
    padding: 8px;
  }

  .mobile-arena .office-scene-wrap {
    margin-bottom: 0;
  }

  .mobile-arena .office-rug,
  .mobile-arena .office-tv-zone,
  .mobile-arena .office-lounge,
  .mobile-arena .office-kitchen,
  .mobile-arena .office-zone-label,
  .mobile-arena .office-place-label {
    display: none;
  }

  .column {
    width: min(86vw, 320px);
    min-height: 390px;
  }

  .mobile-nav {
    display: grid;
  }

  .tabs {
    display: none;
  }

  .create-card,
  .tracker-card,
  .layout-grid {
    display: none;
  }

  .mobile-app {
    display: block;
    min-height: calc(100dvh - 76px - env(safe-area-inset-bottom));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-active-tab='arena'] .mobile-app {
    display: none;
  }

  body[data-active-tab='arena'] .layout-grid {
    display: block;
  }

  body[data-active-tab='arena'] #tab-control {
    display: none;
  }

  body[data-active-tab='arena'] #tab-arena {
    display: block;
  }
}

@media (max-width: 390px) {
  .mobile-nav {
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
  }

  .mobile-nav-btn {
    min-height: 34px;
    font-size: 11px;
    gap: 0;
  }

  .mobile-nav-btn .icon,
  .mobile-nav-btn .icon svg {
    width: 13px;
    height: 13px;
  }

  .app-shell {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .mobile-app {
    min-height: calc(100dvh - 144px - env(safe-area-inset-bottom));
  }
}

.task-form button.is-loading,
.mobile-create-form button.is-loading {
  position: relative;
  padding-left: 36px;
}

.task-form button.is-loading::before,
.mobile-create-form button.is-loading::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: form-button-spin 0.7s linear infinite;
}

@keyframes form-button-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
