/* ==========================================================================
   Rio AI Office 3D - Daylight Architectural Diorama & Twilight Architect HUD
   ========================================================================== */
:root {
  --bg: #dce5ee;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --elevated: #f1f5f9;
  --border: #cbd5e1;
  --border-strong: #94a3b8;
  --text: #0f172a;
  --text-sec: #334155;
  --text-muted: #52647a;
  --accent: #254edb;
  --accent-soft: #e6ecfc;
  --accent-text: #1c3fb8;
  --cta-text: #ffffff;

  --working: #0f7a4d;
  --working-bg: #dff6eb;
  --working-text: #0b5c39;
  --review: #b45309;
  --review-bg: #fef3dc;
  --review-text: #853c06;
  --idle: #475569;
  --idle-bg: #e2e8f0;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
  --bg: #0a111d;
  --surface: rgba(15, 23, 42, 0.9);
  --surface-solid: #0f172a;
  --elevated: #1e293b;
  --border: #2c3c54;
  --border-strong: #475d7d;
  --text: #f1f5f9;
  --text-sec: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #7aa2ff;
  --accent-soft: #172544;
  --accent-text: #a8c4ff;
  --cta-text: #0b111c;

  --working: #34d399;
  --working-bg: #103226;
  --working-text: #6ee7b7;
  --review: #fbbf24;
  --review-bg: #33250f;
  --review-text: #fde68a;
  --idle: #94a3b8;
  --idle-bg: #1e293b;
  --danger: #f87171;
  --danger-bg: #3b171b;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.hidden {
  display: none !important;
}

/* Full-Screen Owner Authentication Gate */
body.auth-locked .hud-top,
body.auth-locked .agent-quickbar,
body.auth-locked .hud-dock,
body.auth-locked .drawer,
body.auth-locked .quest-modal,
body.auth-locked .label-layer {
  display: none !important;
}

body.auth-locked .scene-root {
  filter: blur(5px) saturate(0.92);
  pointer-events: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(410px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 20px 20px 16px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.auth-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  border-radius: 9px;
  background: var(--elevated);
  border: 1px solid var(--border);
}

.auth-tab-btn {
  border: 0;
  border-radius: 6px;
  padding: 7px 8px;
  background: transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.auth-tab-btn.active {
  background: var(--surface-solid);
  color: var(--accent-text);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-sec);
  margin-top: 2px;
}

.auth-otp-row {
  display: flex;
  gap: 7px;
}

.auth-otp-row .input {
  flex: 1;
}

.auth-submit {
  min-height: 42px;
  margin-top: 4px;
  font-size: 13px;
}

.auth-alert {
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.auth-info {
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--working-bg);
  color: var(--working-text);
  border: 1px solid var(--working);
  font-size: 12px;
  font-weight: 600;
}

.auth-foot {
  margin: 2px 0 0;
  text-align: center;
  font-size: 9.5px;
  color: var(--text-muted);
}

/* 3D Full-Viewport Canvas */
.scene-root {
  position: fixed;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

.label-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

/* Floating Projected 3D Robot Tags */
.robot-tag {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
}

.robot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.robot-alert {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}

.tag-working { background: var(--working); }
.tag-reviewing { background: var(--review); }
.tag-idle { background: var(--idle); }
.tag-offline { background: var(--border-strong); }

/* Top Floating HUD */
.hud-top {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sync-pill {
  font-size: 10px;
  color: var(--working);
  white-space: nowrap;
}

.cam-pills {
  display: inline-flex;
  align-items: center;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.cam-btn {
  border: 0;
  background: transparent;
  color: var(--text-sec);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  min-height: 30px;
  border-radius: 5px;
  cursor: pointer;
}

.cam-btn.active {
  background: var(--accent);
  color: var(--cta-text);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--accent);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Top-Left Quick Agent Bar */
.agent-quickbar {
  position: fixed;
  top: 66px;
  left: 10px;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100vw - 20px);
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.quick-chip:hover {
  border-color: var(--accent);
}

/* Bottom Floating Dock */
.hud-dock {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(460px, calc(100vw - 20px));
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.dock-btn.active {
  background: var(--accent);
  color: var(--cta-text);
}

/* Slide-Over Workspace Drawer */
.drawer {
  position: fixed;
  top: 66px;
  right: 10px;
  bottom: 76px;
  width: min(510px, calc(100vw - 20px));
  z-index: 30;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.18s ease;
}

.drawer[data-panel="discussions"] {
  width: min(560px, calc(100vw - 20px));
}

.drawer[data-panel="discussions"] .drawer-body {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.drawer-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.drawer-body {
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Reusable Drawer UI Elements */
.tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text-sec);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent);
  color: var(--cta-text);
  border-color: var(--accent);
}

.card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.card-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.45;
}

.pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill-working { background: var(--working-bg); color: var(--working-text); }
.pill-reviewing { background: var(--review-bg); color: var(--review-text); }
.pill-idle { background: var(--idle-bg); color: var(--idle); }
.pill-done { background: var(--accent-soft); color: var(--accent-text); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }

.form-box {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--elevated);
}

.form-box-wide {
  padding: 13px 14px;
  gap: 10px;
}

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

.input,
.select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

.input:focus,
.select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.textarea-chat {
  min-height: 96px;
  max-height: 240px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.discuss-msg {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   WhatsApp / Telegram Style Group Chat Room (Ruang Diskusi)
   ========================================================================== */
.chat-room-header {
  padding: 10px 14px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-group-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-avatar-stack {
  display: inline-flex;
  align-items: center;
}

.chat-mini-av {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--surface-solid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #ffffff;
  margin-left: -6px;
}

.chat-mini-av:first-child {
  margin-left: 0;
}

.chat-group-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #e7eef6;
  background-image: radial-gradient(rgba(37, 78, 219, 0.08) 1px, transparent 1px);
  background-size: 16px 16px;
}

[data-theme="dark"] .chat-stream {
  background-color: #0b1322;
  background-image: radial-gradient(rgba(122, 162, 255, 0.09) 1px, transparent 1px);
}

.chat-Encryption-pill {
  align-self: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  margin-bottom: 4px;
  text-align: center;
}

/* Dedicated Agent Movement Event Pill (distinct from chat bubbles) */
.chat-movement-pill {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 92%;
  padding: 4px 11px;
  margin: 2px 0;
  border-radius: 999px;
  background: var(--review-bg);
  color: var(--review-text);
  border: 1px dashed var(--review);
  font-size: 11px;
  font-weight: 700;
}

.move-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.14);
}

.move-time {
  font-size: 9.5px;
  opacity: 0.8;
}

/* Live Agent Typing Indicator */
.chat-typing-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.45; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* 1-on-1 Direct Message Contact List (Tab Pribadi) */
.dm-contacts-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--elevated);
}

.dm-contact-card {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.12s ease;
}

.dm-contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.dm-contact-av {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.dm-contact-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dm-contact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dm-contact-name {
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dm-contact-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dm-contact-preview {
  margin: 0;
  font-size: 12px;
  color: var(--text-sec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-contact-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}

.dm-peer-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
}

.dm-peer-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.dm-peer-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
}

.dm-peer-status {
  font-size: 10.5px;
  color: var(--text-muted);
}

.notif-body {
  white-space: pre-line;
}

.chat-empty-bubble {
  align-self: center;
  max-width: 340px;
  margin: auto 0;
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  text-align: center;
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.5;
}

.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.chat-row.is-grouped {
  margin-top: -4px;
}

.chat-row.is-other {
  justify-content: flex-start;
}

.chat-row.is-me {
  justify-content: flex-end;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.chat-avatar-spacer {
  width: 32px;
  flex-shrink: 0;
}

.chat-avatar-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1.5px solid var(--surface-solid);
}

.av-dexter { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.av-redjohn { background: linear-gradient(135deg, #ea580c, #c2410c); }
.av-patrick { background: linear-gradient(135deg, #059669, #047857); }
.av-crew { background: linear-gradient(135deg, #0891b2, #0e7490); }
.av-rio { background: linear-gradient(135deg, #4f46e5, #3730a3); }

.name-dexter { color: #2563eb; }
.name-redjohn { color: #ea580c; }
.name-patrick { color: #059669; }
.name-crew { color: #0891b2; }
[data-theme="dark"] .name-dexter { color: #60a5fa; }
[data-theme="dark"] .name-redjohn { color: #fb923c; }
[data-theme="dark"] .name-patrick { color: #34d399; }
[data-theme="dark"] .name-crew { color: #22d3ee; }

.chat-bubble {
  position: relative;
  max-width: 80%;
  min-width: 110px;
  padding: 8px 11px 6px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-bubble.bubble-other {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble.bubble-other.has-tail::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 10px;
  height: 12px;
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-bottom-right-radius: 10px;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.chat-bubble.bubble-me {
  background: #dcf8c6;
  color: #0f172a;
  border: 1px solid #b7e49c;
  border-bottom-right-radius: 4px;
}

[data-theme="dark"] .chat-bubble.bubble-me {
  background: #174e3b;
  color: #f1f5f9;
  border-color: #216b52;
}

.chat-bubble.bubble-me.has-tail::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 10px;
  height: 12px;
  background: #dcf8c6;
  border-right: 1px solid #b7e49c;
  border-bottom: 1px solid #b7e49c;
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

[data-theme="dark"] .chat-bubble.bubble-me.has-tail::after {
  background: #174e3b;
  border-right-color: #216b52;
  border-bottom-color: #216b52;
}

.chat-sender-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
}

.chat-sender-role {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--elevated);
  color: var(--text-muted);
}

.chat-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.46;
  color: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-mention-inline {
  font-weight: 700;
  color: var(--accent);
  background: rgba(37, 78, 219, 0.1);
  padding: 0 4px;
  border-radius: 4px;
}

[data-theme="dark"] .chat-mention-inline {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.15);
}

.chat-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  align-self: flex-end;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.chat-bubble.bubble-me .chat-meta {
  color: #3f6230;
}

[data-theme="dark"] .chat-bubble.bubble-me .chat-meta {
  color: #a7f3d0;
}

.chat-ticks {
  display: inline-flex;
  color: #0284c7;
}

[data-theme="dark"] .chat-ticks {
  color: #38bdf8;
}

/* Bottom Sticky Chat Composer (Telegram / WhatsApp bar) */
.chat-composer {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  background: var(--surface-solid);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-chip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.textarea-composer {
  min-height: 44px;
  max-height: 132px;
  padding: 10px 13px;
  border-radius: 18px;
  line-height: 1.42;
  resize: none;
  font-size: 13px;
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--cta-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 78, 219, 0.28);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.chat-send-btn:hover {
  transform: scale(1.04);
}

.chat-send-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* @Mention Autocomplete Dropdown (opens UPWARD above bottom chat bar) */
.mention-field-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.mention-popup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  top: auto;
  z-index: 60;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  box-shadow: var(--shadow);
  padding: 5px;
  max-height: 265px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mention-head {
  padding: 4px 8px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.mention-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 9px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.mention-item:hover,
.mention-item.active {
  background: var(--accent-soft);
}

.mention-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mention-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.mention-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--elevated);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.mention-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-primary {
  background: var(--accent);
  color: var(--cta-text);
  border-color: var(--accent);
}

.btn-sm {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--working);
  transition: width 0.35s ease;
}

.progress-fill.is-active {
  background: linear-gradient(90deg, var(--accent) 0%, var(--working) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: progressShimmer 1.6s linear infinite;
}

@keyframes progressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: 0 0; }
}

.quest-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--working-text);
  background: var(--working-bg);
  padding: 4px 9px;
  border-radius: 6px;
}

.quest-step-row.is-review {
  color: var(--review-text);
  background: var(--review-bg);
}

/* Clickable Quest Card & Centered Full Deliverable Pop-Up Modal */
.quest-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.quest-card-clickable:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 78, 219, 0.12);
}

.quest-open-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-text);
}

.quest-summary-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quest-modal {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(6px);
}

.quest-modal-card {
  width: min(840px, 96vw);
  max-height: min(90vh, 880px);
  background: var(--surface-solid);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.34);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quest-modal-head {
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.quest-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
}

.quest-modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.deliverable-full-view {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.quest-modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 680px) {
  .quest-modal {
    padding: 10px;
  }
  .quest-modal-card {
    max-height: 92vh;
  }
  .quest-modal-actions-grid {
    grid-template-columns: 1fr;
  }
}

.code-block {
  font-size: 11px;
  line-height: 1.5;
  padding: 9px;
  border-radius: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-sec);
  word-break: break-all;
}

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .brand-title {
    font-size: 12px;
  }
  .cam-btn {
    padding: 4px 6px;
    font-size: 10px;
  }
  .agent-quickbar {
    display: none;
  }
  .hud-dock {
    gap: 3px;
    padding: 5px;
    max-width: 98vw;
  }
  .dock-btn {
    padding: 6px 8px;
    font-size: 10.5px;
    gap: 4px;
  }
}

.agent-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--cta-text);
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
