:root {
  color-scheme: light;
  --client: #f5f5f7;
  --client-deep: #edf2f6;
  --client-raised: #ffffff;
  --client-line: rgba(60, 60, 67, 0.13);
  --client-text: #1d1d1f;
  --client-muted: #727278;
  --client-accent: #0a84ff;
  --mac-window: #ffffff;
  --mac-toolbar: rgba(247, 247, 249, 0.94);
  --mac-sidebar: rgba(242, 242, 244, 0.96);
  --mac-content: #edf2f6;
  --mac-inspector: #f7f7f8;
  --mac-control: rgba(118, 118, 128, 0.12);
  --mac-control-hover: rgba(118, 118, 128, 0.18);
  --mac-separator: rgba(60, 60, 67, 0.13);
  --mac-blue: #0a84ff;
  --mac-green-message: #dff4dc;
  --mac-shadow: rgba(18, 23, 31, 0.22);
}

.mimicry-app {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--client-text);
  background: var(--mac-window);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.72) inset,
    0 0 0 1px rgba(60, 60, 67, 0.11),
    0 16px 38px rgba(18, 23, 31, 0.16),
    0 42px 96px var(--mac-shadow);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.world-product-host {
  min-width: 0;
  max-width: none;
  overflow: visible;
  box-shadow: none;
}

.world-product-host .mimicry-app {
  width: 1456px;
  height: 834px;
  max-width: none;
  aspect-ratio: auto;
  transform: scale(var(--product-window-scale, 0.82));
  transform-origin: 0 0;
  will-change: transform;
}

.app-titlebar {
  position: relative;
  z-index: 20;
  height: 52px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
  color: #55555b;
  background: var(--mac-toolbar);
  border-bottom: 1px solid var(--mac-separator);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  font-size: 13px;
  line-height: 1;
}

.window-controls {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-controls i {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18) inset;
}

.window-controls i:nth-child(1) { background: #ff5f57; }
.window-controls i:nth-child(2) { background: #febc2e; }
.window-controls i:nth-child(3) { background: #28c840; }

.app-window-title {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #37373b;
  letter-spacing: -0.012em;
}

.app-window-title img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.74;
}

.app-window-title strong {
  font-size: 13px;
  font-weight: 600;
}

.titlebar-spacer {
  justify-self: end;
  width: 52px;
}

.app-body {
  height: calc(100% - 52px);
  display: grid;
  grid-template-columns: 22% minmax(0, 1fr) 28%;
  background: var(--mac-content);
}

.world-product-host .app-body {
  grid-template-columns: 22% minmax(0, 1fr) 28%;
}

.chat-list,
.chat-content,
.ai-sidebar {
  min-width: 0;
  color: var(--client-text);
}

.chat-list {
  background: var(--mac-sidebar);
  border-right: 1px solid var(--mac-separator);
}

.chat-toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.hamburger {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 8px 7px;
  display: grid;
  align-content: center;
  gap: 3px;
}

.hamburger:hover { background: var(--mac-control); }
.hamburger i { height: 1px; border-radius: 1px; background: #626269; }

.search-pill {
  height: 32px;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: 9px;
  background: var(--mac-control);
  color: #737379;
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.55) inset;
  font-size: 13px;
}

.search-icon {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.search-icon::after { width: 5px; height: 1.5px; right: -4px; bottom: -2px; border-radius: 1px; background: currentColor; }

.chat-rows { padding: 6px 7px 10px; }
.chat-row {
  position: relative;
  height: 68px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 1px 0;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--client-text);
}
.chat-row:hover { background: rgba(118, 118, 128, 0.08); }
.chat-row.active-feed { background: rgba(10, 132, 255, 0.16); }
.world-product-host .mimicry-app .chat-row:first-child {
  background: rgb(10 132 255 / calc((1 - var(--resolved-alpha, 0)) * 0.16));
}
.world-product-host .mimicry-app .chat-row:nth-child(2) {
  background: rgb(10 132 255 / calc(var(--resolved-alpha, 0) * 0.16));
}
.avatar {
  width: 40px;
  height: 40px;
  border: 0;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08) inset;
  font-size: 13px;
  font-weight: 650;
}
.chat-row .avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  line-height: 1;
}
.chat-row div { min-width: 0; }
.chat-row strong,
.chat-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row strong { color: #202024; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.chat-row strong .verified { color: var(--mac-blue); font-size: 9px; }
.chat-row div span { margin-top: 4px; color: #66666d; font-size: 12px; }
.chat-row time { align-self: start; padding-top: 4px; color: #74747a; font-size: 10.5px; }
.unread-count,
.muted-mark,
.pin-mark {
  right: 9px;
  bottom: 8px;
  width: 16px;
  height: 16px;
  background: var(--mac-blue);
  color: #fff !important;
  font-size: 9px !important;
}
.muted-mark,
.pin-mark { background: transparent; color: #8b8b91 !important; font-size: 8px !important; }

.chat-content {
  display: flex;
  flex-direction: column;
  background: var(--mac-content);
  border-right: 1px solid var(--mac-separator);
}

.chat-header,
.ai-header {
  height: 56px;
  min-height: 56px;
  padding: 0 15px;
  background: rgba(250, 250, 251, 0.92);
  border-bottom: 1px solid var(--mac-separator);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}
.chat-header strong,
.ai-header strong { color: #202024; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.chat-header span,
.ai-header span { margin-top: 3px; color: #696970; font-size: 11.5px; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.header-actions i {
  position: relative;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.09);
}
.header-actions i:first-child::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 8px;
  height: 8px;
  border: 1.5px solid #696970;
  border-radius: 50%;
}
.header-actions i:first-child::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 16px;
  width: 5px;
  height: 1.5px;
  border-radius: 1px;
  background: #696970;
  transform: rotate(45deg);
}
.header-actions i:nth-child(2)::before {
  content: "";
  position: absolute;
  inset: 7px 6px;
  border: 1.5px solid #696970;
  border-radius: 2px;
  box-shadow: inset 5px 0 0 rgba(105, 105, 112, 0.22);
}
.header-actions i:last-child { width: 28px; border: 0; border-radius: 9px; }
.header-actions i:last-child::before { content: "•••"; position: absolute; inset: 5px 0 0; color: #696970; text-align: center; font-size: 11px; letter-spacing: 1px; }

.telegram-thread {
  position: absolute;
  inset: 56px 0;
  overflow: hidden;
  padding: 22px 26px 24px;
  background:
    linear-gradient(rgba(237, 242, 246, 0.92), rgba(237, 242, 246, 0.92)),
    radial-gradient(circle at 20% 10%, rgba(10, 132, 255, 0.08), transparent 34%);
}
.date-chip {
  margin: 0 auto 14px;
  padding: 5px 10px;
  border: 1px solid rgba(60, 60, 67, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  color: #77777d;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 10px;
  font-weight: 500;
}
.telegram-message {
  width: 72%;
  margin: 0 0 10px;
  padding: 10px 12px 18px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: 7px 14px 14px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #242428;
  box-shadow: 0 2px 7px rgba(22, 31, 43, 0.06);
  font-size: 13px;
  line-height: 1.4;
}
.telegram-message p { margin: 4px 0 0; }
.telegram-message time { right: 8px; bottom: 5px; color: #85858b; font-size: 9px; }
.telegram-message.outgoing {
  margin-left: auto;
  border-color: rgba(45, 135, 63, 0.09);
  border-radius: 14px 7px 14px 14px;
  background: var(--mac-green-message);
}
.mimicry-app .message-author { font-size: 12px; font-weight: 650; }
.message-author.maya { color: #a9479f; }
.message-author.nina { color: #147aa8; }
.message-author.leo { color: #a75d11; }
.message-author.ari { color: #30834b; }
.voice-note { grid-template-columns: 24px 1fr auto; gap: 8px; margin-top: 7px; }
.voice-note button { width: 24px; height: 24px; background: var(--mac-blue); color: #fff; font-size: 9px; }
.voice-note span { height: 3px; border-radius: 2px; background: rgba(10, 132, 255, 0.36); }
.voice-note small { color: #737379; font-size: 9px; }

.composer {
  height: 56px;
  min-height: 56px;
  margin-top: auto;
  padding: 0 14px;
  background: rgba(250, 250, 251, 0.94);
  border-top: 1px solid var(--mac-separator);
  color: #6c6c72;
  font-size: 12px;
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}
.composer button {
  min-width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.09);
  color: #66666d;
}
.composer div { gap: 7px; }

.ai-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--mac-inspector);
}
.ai-header button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--mac-control);
  color: #56565d;
  font-size: 18px;
  line-height: 1;
}
.ai-thread {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: 18px;
  background: var(--mac-inspector);
}
.mimicry-app .agent-state-panel { inset: 18px; }
.ai-prompt {
  padding: 12px 13px;
  border: 0;
  border-radius: 11px;
  background: #e9e9ec;
  color: #29292d;
  box-shadow: 0 0 0 1px rgba(60, 60, 67, 0.06) inset;
  font-size: 12.5px;
  line-height: 1.42;
}
.ai-prompt.compact { font-size: 11.5px; }
.ai-prompt.approval { background: var(--mac-blue); color: #fff; }
.assistant-turn {
  margin: 18px 3px 0;
  padding-left: 38px;
  color: #29292d;
  font-size: 12.5px;
  line-height: 1.46;
}
.assistant-turn .agent-orb { width: 28px; height: 28px; }
.assistant-turn small { margin-top: 6px; color: #66666d; font-size: 11px; }
.assistant-turn.compact { margin: 14px 2px; padding-left: 0; }
.agent-orb {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(10, 132, 255, 0.38);
  background: #fff;
  box-shadow: inset 0 0 0 7px #e6f2ff, 0 1px 3px rgba(0, 0, 0, 0.08);
}
.thought-row {
  gap: 8px;
  padding: 10px 4px;
  border-color: var(--mac-separator);
  color: #5f5f66;
  font-size: 11px;
}
.runtime-row {
  grid-template-columns: 19px 1fr;
  gap: 8px;
  padding: 9px 4px;
  color: #64646b;
  font-size: 11.5px;
  line-height: 1.38;
}
.runtime-icon { color: var(--mac-blue); }
.assistant-summary {
  margin-bottom: 11px;
  color: #2c2c30;
  font-size: 12.5px;
  line-height: 1.45;
}
.proposal-card {
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 11px;
  background: #fff;
  color: #29292d;
  box-shadow: 0 2px 8px rgba(22, 31, 43, 0.05);
  font-size: 11.5px;
}
.proposal-card header { color: #77777d; }
.proposal-card header strong { color: #2a2a2e; font-size: 11.5px; }
.proposal-card p { margin: 9px 0; line-height: 1.42; }
.proposal-controls { gap: 8px; padding-top: 9px; border-color: var(--mac-separator); }
.proposal-controls label { color: #77777d; }
.proposal-controls select {
  height: 25px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  border-radius: 7px;
  background: #f3f3f5;
  color: #333338;
  font-size: 10px;
}
.proposal-controls button {
  min-width: 52px;
  min-height: 25px;
  padding: 4px 9px;
  border: 0;
  border-radius: 7px;
  background: #e7e7ea;
  color: #303034;
  font-size: 10px;
}
.proposal-controls button:first-child { background: var(--mac-blue); color: #fff; }
.proposal-card.resolved footer { border-color: var(--mac-separator); color: #77777d; }
.status-sent { color: #248a3d; }

.ai-composer {
  height: 96px;
  min-height: 96px;
  margin: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  border-radius: 12px;
  background: #fff;
  color: #707076;
  box-shadow: 0 2px 8px rgba(22, 31, 43, 0.05);
  font-size: 12px;
}
.model-row { margin-top: 25px; }
.model-row small { color: #66666d; font-size: 10px; }
.model-row button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--mac-blue);
  color: #fff;
  font-size: 13px;
}

.app-scrim { inset: 52px 0 0; background: rgba(32, 32, 36, 0.2); }
.account-drawer {
  top: 52px;
  width: 22%;
  background: rgba(245, 245, 247, 0.98);
  color: var(--client-text);
  box-shadow: 15px 0 50px rgba(0, 0, 0, 0.16);
}

@media (prefers-reduced-transparency: reduce) {
  .app-titlebar,
  .chat-header,
  .ai-header,
  .composer {
    background: #f7f7f8;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
