body.mmir-p0-ready {
  background: #ffffff;
  color: #111827;
  display: block !important;
  grid-template-columns: none !important;
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
}

body.mmir-p0-ready > :not(#mmir-p0-app) {
  display: none !important;
}

#mmir-p0-app {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  min-height: 100vh;
  width: 100%;
  background: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.p0-topbar {
  align-items: center;
  border-bottom: 1px solid #ececf1;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px 18px;
}

.p0-brand {
  align-items: center;
  color: #111827;
  display: inline-flex;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.p0-mark {
  align-items: center;
  background: #111827;
  border-radius: 10px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  letter-spacing: 0;
  width: 32px;
}

.p0-brand-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.p0-brand-text strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.p0-brand-text span,
.p0-status {
  color: #6b7280;
  font-size: 0.78rem;
  line-height: 1.25;
}

.p0-status {
  border: 1px solid transparent;
  border-radius: 999px;
  max-width: min(44vw, 520px);
  overflow: hidden;
  padding: 4px 8px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p0-status[data-state="ready"] {
  background: #ecfdf5;
  border-color: rgba(4, 120, 87, 0.16);
  color: #047857;
}

.p0-status[data-state="error"] {
  background: #fef2f2;
  border-color: rgba(185, 28, 28, 0.16);
  color: #b91c1c;
}

.p0-chat {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 0 18px;
}

.p0-transcript {
  box-sizing: border-box;
  display: block;
  height: 100%;
  margin: 0 auto;
  max-width: 820px;
  max-height: 100%;
  min-height: 0;
  overscroll-behavior: contain;
  overflow-y: auto;
  padding: 34px 0 24px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  width: min(820px, 100%);
}

.p0-message + .p0-message {
  margin-top: 16px;
}

.p0-empty {
  display: grid;
  gap: 10px;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  margin: 0 auto 24px;
  max-width: 620px;
  text-align: center;
}

.p0-empty h1 {
  color: #111827;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
}

.p0-empty p {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

.p0-message {
  display: grid;
  gap: 6px;
  max-width: min(760px, 100%);
}

.p0-message-user {
  justify-self: end;
  max-width: min(640px, 84%);
}

.p0-message-assistant {
  justify-self: start;
}

.p0-message-compare {
  border-left: 2px solid #d1fae5;
  padding-left: 10px;
}

.p0-message-install {
  border-left: 2px solid #e5e7eb;
  padding-left: 10px;
}

.p0-message-label {
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
}

.p0-message-receipt {
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.25;
  margin-top: -2px;
}

.p0-message-receipt summary {
  cursor: pointer;
  list-style: none;
  width: fit-content;
}

.p0-message-receipt summary::-webkit-details-marker {
  display: none;
}

.p0-message-receipt summary:hover {
  color: #047857;
}

.p0-receipt-full {
  color: #6b7280;
  margin-top: 4px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.p0-message-compare .p0-message-receipt {
  color: #047857;
}

.p0-message-user .p0-message-label {
  display: none;
}

.p0-message-body {
  color: #111827;
  font-size: 0.98rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.p0-message-body p {
  margin: 0 0 0.72rem;
}

.p0-message-body p:last-child {
  margin-bottom: 0;
}

.p0-message-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
  opacity: 0.74;
}

.p0-message-actions button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  min-height: 28px;
  padding: 0 8px;
}

.p0-message-actions button:hover,
.p0-message-actions button:focus-visible {
  background: #f7f7f8;
  border-color: #e5e7eb;
  color: #111827;
}

.p0-message-action-status {
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.2;
  min-height: 1em;
}

.p0-message-action-status[data-state="error"] {
  color: #b91c1c;
}

.p0-command-card {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-width: 100%;
  padding: 12px;
}

.p0-command-card code {
  color: #111827;
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
}

.p0-command-actions,
.p0-os-choice-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.p0-command-actions button,
.p0-os-choice-row button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9dbe3;
  border-radius: 999px;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  min-height: 34px;
  padding: 0 12px;
  text-decoration: none;
}

.p0-command-actions button:hover,
.p0-os-choice-row button:hover {
  background: #f4f4f5;
}

.p0-os-choice-row {
  margin-top: 12px;
}

.p0-message-user .p0-message-body {
  background: #f4f4f5;
  border-radius: 18px;
  padding: 10px 14px;
}

.p0-composer-wrap {
  background: linear-gradient(180deg, rgba(255,255,255,0), #ffffff 22%);
  box-sizing: border-box;
  padding: 10px 18px 18px;
}

.p0-composer {
  background: #ffffff;
  border: 1px solid #d9dbe3;
  border-radius: 24px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.08);
  box-sizing: border-box;
  display: grid;
  gap: 8px;
  margin: 0 auto;
  max-width: 820px;
  padding: 12px;
  width: min(820px, 100%);
}

.p0-input {
  background: transparent;
  border: 0;
  box-sizing: border-box;
  color: #111827;
  font: inherit;
  line-height: 1.45;
  max-height: 180px;
  min-height: 58px;
  outline: none;
  overflow-y: auto;
  resize: none;
  width: 100%;
}

.p0-input::placeholder {
  color: #9ca3af;
}

.p0-route {
  align-items: center;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 5px;
  line-height: 1.25;
  overflow: hidden;
  padding: 0 2px;
  max-height: 48px;
}

.p0-route[data-state="hosted"] {
  color: #047857;
}

.p0-route[data-state="local"] {
  color: #1d4ed8;
}

.p0-route[data-state="error"] {
  color: #b91c1c;
  white-space: normal;
}

.p0-micro-chip {
  align-items: center;
  background: #f7f7f8;
  border: 1px solid #ececf1;
  border-radius: 999px;
  color: #4b5563;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 680;
  line-height: 1;
  min-height: 22px;
  max-width: min(100%, 260px);
  overflow: hidden;
  padding: 0 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p0-micro-chip[data-primary="true"] {
  background: transparent;
  border-color: transparent;
  color: #047857;
  font-weight: 760;
  padding-left: 0;
}

.p0-micro-chip[data-kind="good"] {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.p0-micro-chip[data-kind="local"],
.p0-micro-chip[data-kind="time"],
.p0-micro-chip[data-kind="route"] {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.p0-micro-chip[data-kind="warn"] {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.p0-micro-chip[data-kind="error"] {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.p0-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.p0-left,
.p0-right {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.p0-left {
  flex: 0 0 auto;
}

.p0-right {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.p0-btn,
.p0-model-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9dbe3;
  border-radius: 999px;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-width: 38px;
  padding: 0 12px;
}

.p0-btn:hover,
.p0-model-button:hover {
  background: #f7f7f8;
}

.p0-btn:focus-visible,
.p0-model-button:focus-visible,
.p0-input:focus-visible {
  outline: 3px solid rgba(16, 163, 127, 0.25);
  outline-offset: 2px;
}

.p0-btn-icon {
  padding: 0;
  width: 38px;
}

.p0-icon {
  display: block;
  fill: none;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 19px;
}

.p0-shield {
  border-color: rgba(17, 24, 39, 0.15);
  color: #111827;
}

.p0-mic {
  color: #111827;
}

.p0-model-button {
  flex: 0 1 auto;
  max-width: min(230px, 46vw);
  min-width: 0;
}

.p0-model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p0-chevron {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex: 0 0 auto;
  margin-left: 8px;
  opacity: 0.55;
}

.p0-send {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
  font-size: 1.4rem;
  padding-bottom: 2px;
}

.p0-send.is-stopping {
  background: #991b1b;
  border-color: #991b1b;
  color: #ffffff;
  font-size: 1rem;
  padding-bottom: 0;
}

.p0-send:disabled {
  cursor: wait;
  opacity: 0.65;
}

.p0-menu {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  bottom: 84px;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.14);
  box-sizing: border-box;
  display: grid;
  gap: 6px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 8px;
  position: fixed;
  width: 320px;
  z-index: 1000;
}

.p0-menu[hidden] {
  display: none;
}

.p0-menu button,
.p0-menu a {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-sizing: border-box;
  color: #111827;
  cursor: pointer;
  display: grid;
  gap: 3px;
  justify-items: start;
  padding: 10px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.p0-menu button:hover,
.p0-menu a:hover {
  background: #f7f7f8;
}

.p0-menu .p0-featured-action {
  background: #f8fafc;
  border: 1px solid #d9dbe3;
}

.p0-menu .p0-featured-action:hover {
  background: #eef6f3;
}

.p0-menu strong {
  font-size: 0.9rem;
}

.p0-menu-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.p0-badge {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #374151;
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 720;
  line-height: 1;
  padding: 4px 7px;
}

.p0-badge-strong {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.p0-badge-selected,
.p0-badge-default,
.p0-badge-private,
.p0-badge-best-local {
  background: #f7f7f8;
  border-color: #d9dbe3;
  color: #111827;
}

.p0-badge-slow {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.p0-badge-demoted {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.p0-menu button[data-route-rank-state="demoted"] {
  opacity: 0.82;
}

.p0-menu small {
  color: #6b7280;
  font-size: 0.76rem;
  line-height: 1.35;
}

.p0-menu-title {
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  padding: 6px 10px 2px;
  text-transform: uppercase;
}

.p0-menu-section {
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 720;
  padding: 6px 10px 0;
}

.p0-menu-note {
  color: #6b7280;
  font-size: 0.76rem;
  line-height: 1.35;
  padding: 6px 10px 8px;
}

.p0-route-detail {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  display: grid;
  gap: 3px;
  margin: 6px 4px;
  padding: 8px 10px;
}

.p0-route-detail strong {
  color: #111827;
  font-size: 0.75rem;
}

.p0-route-detail span {
  color: #6b7280;
}

.p0-menu-separator {
  background: #ececf1;
  height: 1px;
  margin: 4px 4px;
}

@media (max-width: 640px) {
  #mmir-p0-app {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .p0-topbar {
    min-height: 50px;
    padding: 8px 12px;
  }

  .p0-status {
    display: none;
  }

  .p0-chat {
    padding: 0 12px;
  }

  .p0-transcript {
    padding: 22px 0 18px;
  }

  .p0-composer-wrap {
    padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  }

  .p0-composer {
    border-radius: 22px;
    padding: 10px;
  }

  .p0-input {
    min-height: 50px;
  }

  .p0-route {
    max-height: 27px;
  }

  .p0-micro-chip:nth-child(n+4) {
    display: none;
  }

  .p0-toolbar {
    gap: 6px;
  }

  .p0-left,
  .p0-right {
    gap: 6px;
  }

  .p0-model-button {
    max-width: 42vw;
  }

  .p0-menu {
    bottom: 76px;
    left: 10px !important;
    right: 10px;
    width: auto;
  }
}

@media (max-width: 380px) {
  .p0-btn,
  .p0-model-button {
    height: 36px;
    min-width: 36px;
  }

  .p0-btn-icon {
    width: 36px;
  }

  .p0-model-button {
    max-width: 34vw;
    padding: 0 10px;
  }

  .p0-chevron {
    margin-left: 6px;
  }
}
