:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #080d12;
  color: #e7f2f0;
  --keyboard-offset: 0px;
  --keyboard-offset-y: 0px;
  --bg: #080d12;
  --panel: #0d151b;
  --panel-2: #111d24;
  --line: #21343d;
  --line-strong: #3b5964;
  --muted: #90a5ad;
  --ink: #e7f2f0;
  --soft: #15242c;
  --accent: #33d6c4;
  --accent-2: #8ee66a;
  --warn: #f5c15a;
  --danger: #ff6b6b;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

body {
  background:
    linear-gradient(90deg, rgba(51, 214, 196, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(142, 230, 106, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

.auth-locked {
  filter: blur(2px);
  pointer-events: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #000;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(100%, 380px);
  border: 1px solid rgba(51, 214, 196, 0.35);
  border-radius: 8px;
  background: rgba(9, 17, 23, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.login-card h1 {
  margin: 4px 0 6px;
  font-size: 22px;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-kicker {
  color: var(--accent) !important;
  font-weight: 800;
  letter-spacing: 0;
}

.login-error {
  min-height: 18px;
  color: var(--danger) !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101b22;
  color: var(--ink);
  cursor: pointer;
  min-height: 34px;
}

button:hover {
  border-color: var(--accent);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #091117;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 214, 196, 0.12);
}

textarea {
  resize: vertical;
}

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.sidebar {
  height: 100dvh;
  background: rgba(9, 16, 22, 0.96);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-top {
  height: 60px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(51, 214, 196, 0.14);
}

.sidebar-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.sidebar-top strong,
.inspector-head strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
  font-weight: 700;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

#newThread {
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--accent);
  color: #031011;
  border-color: var(--accent);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 0 18px rgba(51, 214, 196, 0.28);
}

.mobile-only {
  display: none;
}

.sidebar-tools {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  flex: 0 0 auto;
}

.thread-list {
  overflow: auto;
  padding: 2px 8px 14px;
  min-height: 0;
}

.folder-group {
  margin: 6px 0 10px;
}

.running-group {
  margin: 4px 0 12px;
  padding: 8px;
  border: 1px solid rgba(245, 193, 90, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(245, 193, 90, 0.12), rgba(51, 214, 196, 0.05));
}

.running-heading {
  min-height: 28px;
  color: #fff3cf;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.running-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 14px rgba(245, 193, 90, 0.75);
}

.running-tasks {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.running-empty {
  border: 1px dashed rgba(154, 179, 184, 0.28);
  border-radius: 8px;
  color: #9ab3b8;
  background: rgba(8, 17, 23, 0.52);
  padding: 9px;
  font-size: 12px;
  text-align: center;
}

.running-task {
  width: 100%;
  border: 1px solid rgba(245, 193, 90, 0.22);
  border-radius: 8px;
  background: rgba(8, 17, 23, 0.76);
  color: #ecfffc;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  text-align: left;
}

.running-task:hover,
.running-task.active {
  border-color: rgba(51, 214, 196, 0.45);
  background: rgba(51, 214, 196, 0.1);
}

.running-task.waiting {
  border-color: rgba(142, 230, 106, 0.32);
}

.running-task-main {
  min-height: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 1px 2px;
  color: inherit;
  display: grid;
  gap: 4px;
  text-align: left;
}

.running-task-main:hover {
  border-color: transparent;
}

.running-task-stop {
  min-height: 30px;
  padding: 0 9px;
  border-color: rgba(245, 193, 90, 0.42);
  color: #fff3cf;
}

.running-task-folder,
.running-task-meta {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #9ab3b8;
  font-size: 11px;
}

.running-task-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #f7fffe;
  font-size: 13px;
  font-weight: 700;
}

.folder-heading {
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.folder-heading:hover {
  background: rgba(51, 214, 196, 0.08);
}

.folder-icon {
  width: 15px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 2px;
  position: relative;
  color: var(--muted);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -5px;
  width: 7px;
  height: 5px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #091016;
}

.folder-heading.collapsed .folder-icon {
  color: var(--warn);
}

.folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.folder-count {
  min-width: 24px;
  border: 1px solid rgba(51, 214, 196, 0.22);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  text-align: center;
  padding: 1px 6px;
}

.folder-threads {
  display: grid;
  gap: 2px;
  padding-left: 22px;
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: stretch;
  position: relative;
}

.thread {
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  position: relative;
}

.thread-row::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 17px;
  width: 7px;
  height: 1px;
  background: #2f4852;
}

.thread:hover,
.thread.active {
  background: rgba(51, 214, 196, 0.09);
  border-color: rgba(51, 214, 196, 0.18);
}

.thread.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.thread-archive {
  border: 1px solid rgba(142, 171, 180, 0.18);
  background: rgba(10, 20, 27, 0.56);
  color: #9fb9bf;
  border-radius: 8px;
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  opacity: 0.72;
}

.thread-archive svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-archive:hover,
.thread-archive:focus-visible {
  color: #fff6c9;
  border-color: rgba(245, 184, 62, 0.56);
  background: rgba(245, 184, 62, 0.14);
  opacity: 1;
}

.thread-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #dceeed;
  font-size: 13px;
}

.thread-folder,
.thread-project,
.thread-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  background: rgba(8, 13, 18, 0.8);
  position: relative;
}

.chat-header {
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 21, 27, 0.94);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
}

#toggleSidebar {
  display: none;
}

.header-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}

.title-block {
  min-width: 0;
  display: grid;
  gap: 2px;
  grid-column: 2;
  grid-row: 1;
  cursor: pointer;
  border-radius: 8px;
}

.title-block:focus-visible {
  outline: 1px solid rgba(51, 214, 196, 0.55);
  outline-offset: 4px;
}

.chat-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#threadFolder,
#status,
#quotaLine {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

#status {
  flex: 0 0 auto;
}

#quotaLine {
  color: #d8f6b8;
  flex: 1 1 auto;
}

#status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(142, 230, 106, 0.7);
}

#status[data-tone="error"] {
  color: var(--danger);
}

#status[data-tone="error"]::before {
  background: var(--danger);
  box-shadow: none;
}

#status[data-tone="warn"] {
  color: var(--warn);
}

#status[data-tone="warn"]::before {
  background: var(--warn);
  box-shadow: 0 0 10px rgba(245, 193, 90, 0.55);
}

.folder-card {
  border-bottom: 1px solid rgba(51, 214, 196, 0.12);
  background: rgba(10, 18, 24, 0.86);
  padding: 7px 14px;
  display: none;
  gap: 0;
  cursor: pointer;
}

.folder-card.visible {
  display: grid;
}

.folder-card:hover,
.folder-card:focus-visible {
  background: rgba(18, 36, 44, 0.94);
  outline: none;
}

.folder-card span {
  display: none;
}

.folder-card b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #c7f3eb;
}

.folder-card.expanded b {
  color: #ffffff;
}

.folder-card.expanded #threadFolder {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.reading-mode .folder-card {
  display: none;
}

.reading-mode .runtime-bar,
.reading-mode .attachments {
  display: none;
}

.reading-mode .composer {
  grid-template-columns: 44px minmax(0, 1fr) 76px;
}

.reading-mode .messages {
  padding-top: 14px;
  padding-bottom: 14px;
}

.input-mode .folder-card {
  display: none;
}

.input-mode .runtime-bar {
  display: none;
}

.input-mode .composer {
  grid-template-columns: 44px minmax(0, 1fr) 76px;
  grid-template-rows: auto auto;
  align-items: end;
  gap: 0 0;
  padding-top: 10px;
  transition: transform 0.18s ease;
}

.input-mode .composer::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 132px;
  height: 48px;
  border-top: 1px solid rgba(51, 214, 196, 0.42);
  border-left: 1px solid rgba(51, 214, 196, 0.42);
  border-right: 0;
  border-bottom: 0;
  border-radius: 14px 0 8px 0;
  background: rgba(7, 17, 23, 0.94);
  box-shadow: -10px -10px 24px rgba(5, 11, 16, 0.82);
  pointer-events: none;
  z-index: 5;
}

.input-mode.keyboard-open .composer {
  transform: translateY(var(--keyboard-offset-y));
  box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.42);
}

.input-mode .composer textarea {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: min(43dvh, 390px);
  max-height: min(48dvh, 440px);
  overflow-y: auto;
  line-height: 1.55;
  padding: 12px 12px 68px;
  border-color: rgba(51, 214, 196, 0.42);
  background: rgba(5, 11, 16, 0.96);
}

.input-mode .composer-actions {
  position: static;
  grid-column: 1 / -1;
  grid-row: 2;
  z-index: 7;
  margin-top: 8px;
  padding: 8px;
  border-color: rgba(51, 214, 196, 0.34);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(5, 14, 20, 0.96), rgba(7, 17, 23, 0.98));
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(51, 214, 196, 0.08) inset;
  animation: input-actions-rise 0.16s ease-out;
}

.input-mode #moreActions {
  position: absolute;
  right: 100px;
  bottom: 17px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  margin: 0;
  z-index: 7;
}

.input-mode #send {
  position: absolute;
  right: 18px;
  bottom: 17px;
  width: 72px;
  min-width: 72px;
  height: 38px;
  min-height: 38px;
  margin: 0;
  z-index: 7;
}

.input-mode .composer.actions-open::after {
  bottom: 72px;
}

.input-mode .composer.actions-open #moreActions,
.input-mode .composer.actions-open #send {
  bottom: 77px;
}

@keyframes input-actions-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-mode #moreActions,
.input-mode #send {
  box-shadow: none;
}

.input-mode .messages {
  padding-bottom: 10px;
}

.pending-requests {
  grid-column: 1 / -1;
  border: 1px solid rgba(245, 193, 90, 0.24);
  border-radius: 8px;
  background: rgba(17, 22, 28, 0.94);
  padding: 8px;
  display: grid;
  gap: 10px;
  max-height: 32dvh;
  overflow: auto;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.pending-requests[hidden] {
  display: none;
}

.pending-card {
  border: 1px solid rgba(245, 193, 90, 0.32);
  border-radius: 8px;
  background: #0b1318;
  padding: 10px;
  display: grid;
  gap: 9px;
}

.pending-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pending-head strong {
  color: #fff3cf;
  font-size: 13px;
}

.pending-head span,
.question-text {
  color: var(--muted);
  font-size: 12px;
}

.pending-card pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #dceeed;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
}

.pending-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.approval-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.single-action {
  grid-template-columns: 1fr;
}

.pending-actions .approve {
  background: var(--accent);
  color: #031011;
  border-color: var(--accent);
  font-weight: 700;
}

.pending-actions .danger {
  border-color: rgba(255, 107, 107, 0.5);
  color: #ffd7d7;
  background: rgba(255, 107, 107, 0.1);
}

.pending-session {
  margin: 0;
}

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

.question-text {
  margin: 0;
}

.choice-list {
  display: grid;
  gap: 6px;
}

.choice {
  min-width: 0;
  border: 1px solid rgba(51, 214, 196, 0.22);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.06);
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
}

.choice input {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 2px 0 0;
}

.choice span {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.header-actions {
  display: flex;
  gap: 8px;
  grid-column: 3;
  grid-row: 1 / span 2;
}

.service-health {
  min-width: 0;
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.sidebar-health {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.health-chip {
  flex: 0 1 auto;
  min-width: 0;
  border: 1px solid rgba(144, 165, 173, 0.28);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-chip.online {
  border-color: rgba(142, 230, 106, 0.35);
  color: #d8f6b8;
  background: rgba(142, 230, 106, 0.08);
}

.health-chip.offline {
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffd7d7;
  background: rgba(255, 107, 107, 0.08);
}

.health-chip.unknown {
  border-color: rgba(245, 193, 90, 0.32);
  color: #f7dfa4;
  background: rgba(245, 193, 90, 0.07);
}

.panel-head button,
#refreshThreads {
  padding: 0 10px;
  font-size: 13px;
}

.messages {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

.scroll-bottom {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(var(--composer-height, 172px) + 10px);
  transform: translateX(-50%);
  z-index: 6;
  width: auto;
  height: 34px;
  min-width: 112px;
  min-height: 34px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(7, 20, 25, 0.9);
  color: #dffef8;
  border-color: rgba(51, 214, 196, 0.5);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(51, 214, 196, 0.08) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0;
  font-weight: 800;
}

.scroll-bottom::before {
  content: "\2193";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, #45ead8, #8ee66a);
  color: #031011;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 0 16px rgba(51, 214, 196, 0.34);
}

.scroll-bottom::after {
  content: "回到底部";
  color: #c9f7f1;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.scroll-bottom:hover {
  transform: translateX(-50%) translateY(-1px);
  border-color: rgba(51, 214, 196, 0.78);
  background: rgba(9, 31, 36, 0.94);
}

.scroll-bottom:active {
  transform: translateX(-50%) translateY(0);
}

.scroll-bottom[hidden] {
  display: none;
}

.quote-selection {
  position: absolute;
  right: 18px;
  bottom: 222px;
  z-index: 7;
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(51, 214, 196, 0.65);
  background: rgba(51, 214, 196, 0.94);
  color: #041011;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
}

.quote-selection[hidden] {
  display: none;
}

.empty {
  color: var(--muted);
  margin: auto;
  text-align: center;
  max-width: 420px;
}

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

.compact-note,
.load-more {
  align-self: center;
  max-width: 760px;
  border: 1px solid rgba(51, 214, 196, 0.28);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.08);
  color: #bcfff5;
  padding: 9px 12px;
  font-size: 13px;
}

.load-more {
  max-width: 360px;
}

.msg {
  min-width: 0;
  box-sizing: border-box;
  max-width: 880px;
  border-radius: 8px;
  padding: 11px 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: grid;
  gap: 6px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.msg-label {
  color: inherit;
  opacity: 0.72;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.msg-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.9;
}

.msg-body {
  display: block;
}

.msg-collapse {
  display: grid;
  gap: 8px;
}

.msg-collapse summary {
  cursor: pointer;
  color: #bcfff5;
  font-size: 13px;
  font-weight: 700;
}

.msg-collapse pre {
  margin: 0;
  max-height: min(48dvh, 460px);
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid rgba(51, 214, 196, 0.14);
  border-radius: 8px;
  background: rgba(5, 11, 16, 0.38);
  padding: 10px;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  touch-action: pan-y;
}

.file-change-card {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.06);
  padding: 8px;
  white-space: normal;
}

.file-change-card > summary,
.file-diff > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.file-change-title {
  color: #fff3c4;
  font-weight: 800;
  font-size: 13px;
}

.file-change-status {
  flex: 0 0 auto;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  color: #f8d37a;
  padding: 2px 7px;
  font-size: 11px;
}

.file-diff {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(5, 11, 16, 0.55);
  padding: 7px;
}

.file-diff-kind {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #071015;
  background: #94a3b8;
}

.file-diff-kind.kind-add {
  background: #34d399;
}

.file-diff-kind.kind-delete {
  background: #fb7185;
}

.file-diff-kind.kind-update {
  background: #60a5fa;
}

.file-diff-path {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.file-diff pre {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  max-height: min(48dvh, 460px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 7px;
  background: #050b10;
  color: #d9f7ef;
  padding: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 12px;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  touch-action: pan-y;
}

.msg-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 220px));
  gap: 8px;
}

.msg-images button {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(51, 214, 196, 0.18);
  background: #081117;
  padding: 0;
  cursor: zoom-in;
}

.msg-images img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.msg.user {
  background: #12352f;
  color: #ecfffb;
  border: 1px solid rgba(142, 230, 106, 0.22);
  align-self: flex-end;
}

.msg.agent {
  background: #101b22;
  border: 1px solid rgba(51, 214, 196, 0.2);
}

.msg.tool,
.msg.reasoning {
  background: #11161c;
  border: 1px solid rgba(245, 193, 90, 0.18);
  color: #b8c9cf;
  font-size: 13px;
}

.composer {
  border-top: 1px solid var(--line);
  background: rgba(13, 21, 27, 0.96);
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 76px;
  gap: 5px 8px;
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
}

.composer-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  border: 1px solid rgba(51, 214, 196, 0.24);
  border-radius: 12px;
  background: rgba(5, 14, 20, 0.96);
  padding: 8px;
  box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.34);
}

.composer-actions[hidden] {
  display: none;
}

.action-tile {
  min-width: 0;
  min-height: 38px;
  padding: 0 7px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #dffef8;
  background: rgba(51, 214, 196, 0.07);
  border-color: rgba(51, 214, 196, 0.24);
}

.action-tile:active {
  transform: translateY(1px);
}

.action-tile.saving {
  border-color: rgba(245, 193, 90, 0.62);
  background: rgba(245, 193, 90, 0.1);
}

.action-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #67ffb0;
  line-height: 1;
}

.action-icon svg,
.composer-plus svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-text {
  min-width: 0;
  color: #effffb;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-plus {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #dffef8;
}

.composer-plus svg {
  width: 20px;
  height: 20px;
  color: currentColor;
}

.composer-plus.open {
  border-color: rgba(51, 214, 196, 0.6);
  background: rgba(51, 214, 196, 0.13);
}

.quote-bar {
  grid-column: 1 / -1;
  border: 1px solid rgba(245, 193, 90, 0.34);
  border-radius: 8px;
  background: rgba(245, 193, 90, 0.1);
  color: #fff3cf;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.quote-bar[hidden] {
  display: none;
}

.quote-list {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quote-list::-webkit-scrollbar {
  display: none;
}

.quote-chip {
  min-width: 0;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(245, 193, 90, 0.28);
  border-radius: 999px;
  background: rgba(245, 193, 90, 0.1);
  padding: 3px 4px 3px 8px;
  flex: 0 0 auto;
}

.quote-chip span,
.quote-preview {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.quote-bar button,
.quote-chip button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.quote-chip button {
  min-height: 22px;
  padding: 0 7px;
}

.quote-preview {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: #fff3cf;
  padding: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.quote-preview:hover {
  color: #ffffff;
  border-color: transparent;
}

.runtime-bar {
  grid-column: 1 / -1;
  border: 1px solid rgba(51, 214, 196, 0.28);
  background: linear-gradient(135deg, rgba(5, 22, 27, 0.98), rgba(7, 16, 22, 0.98));
  padding: 5px;
  display: block;
  color: #c9f7f1;
  font-size: 12px;
  line-height: 1.35;
  min-height: 34px;
  overflow-x: hidden;
  overflow-y: hidden;
  position: relative;
  z-index: 3;
  border-radius: 8px;
  scrollbar-width: none;
}

.runtime-bar .runtime-grid {
  display: none;
}

.runtime-bar.syncing {
  border-color: rgba(245, 193, 90, 0.62);
  box-shadow: 0 0 0 1px rgba(245, 193, 90, 0.12) inset;
}

.runtime-row,
.runtime-card {
  min-width: 0;
}

.runtime-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.runtime-bar.compact-only .runtime-card {
  gap: 6px;
}

.runtime-overview {
  min-width: 0;
  display: grid;
  border: 1px solid rgba(51, 214, 196, 0.32);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.06);
  padding: 10px 12px;
}

.runtime-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.runtime-main-status {
  min-width: 0;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.runtime-task-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.runtime-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.runtime-task-copy strong {
  color: #effffb;
  font-size: 17px;
  line-height: 1.28;
  font-weight: 850;
  overflow: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-sync-badge {
  min-width: 0;
  max-width: 132px;
  border: 1px solid rgba(245, 193, 90, 0.46);
  border-radius: 999px;
  padding: 2px 7px;
  color: #ffe7a6;
  background: rgba(245, 193, 90, 0.11);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-sync-badge.ok {
  color: #d8f6b8;
  border-color: rgba(142, 230, 106, 0.36);
  background: rgba(142, 230, 106, 0.1);
}

.runtime-sync-badge.error {
  color: #ffd7d7;
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.1);
}

.runtime-task-copy span {
  color: #9fc7c1;
  font-size: 12px;
  line-height: 1.32;
  overflow: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-action-slot {
  display: grid;
  place-items: center;
}

.runtime-task-action {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 8px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: rgba(51, 214, 196, 0.42);
  background: rgba(51, 214, 196, 0.12);
  color: #dffef8;
  font-weight: 900;
}

.runtime-task-action:disabled {
  opacity: 0.58;
}

.runtime-mainline,
.runtime-left {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.runtime-left {
  align-content: center;
  column-gap: 6px;
  row-gap: 0;
  border: 1px solid rgba(245, 193, 90, 0.24);
  border-radius: 7px;
  background: rgba(245, 193, 90, 0.07);
  padding: 4px 6px;
  min-height: 58px;
}

.runtime-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.task-bar {
  display: none;
}

.task-bar[hidden] {
  display: none;
}

.task-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.task-copy strong {
  color: #fff1bd;
  font-size: 12px;
  flex: 0 0 auto;
}

.task-copy span {
  color: #d8c99b;
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#interruptTask {
  grid-column: 1 / -1;
  min-height: 20px;
  padding: 0 6px;
  margin-top: 2px;
  border-color: rgba(245, 193, 90, 0.5);
  color: #fff3cf;
  background: rgba(245, 193, 90, 0.1);
  font-weight: 700;
  font-size: 12px;
}

#interruptTask:disabled {
  opacity: 0.7;
}

.runtime-bar::-webkit-scrollbar {
  display: none;
}

.runtime-bar span,
.runtime-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-state {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(51, 214, 196, 0.24);
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #c8f7ef;
  background: rgba(51, 214, 196, 0.08);
  font-size: 14px;
  line-height: 1;
}

.status-mark {
  width: 8px;
  height: 8px;
  display: block;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
}

.status-mark.running {
  border-color: var(--warn);
  background: var(--warn);
  animation: status-pulse 1s ease-in-out infinite;
}

.status-mark.completed {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.status-mark.interrupting,
.status-mark.interrupted {
  border-color: var(--warn);
  background: rgba(245, 193, 90, 0.45);
}

.status-mark.error {
  border-color: var(--danger);
  background: var(--danger);
}

@keyframes status-pulse {
  50% {
    transform: scale(0.72);
    opacity: 0.62;
  }
}

.runtime-state.running {
  color: var(--warn);
  border-color: rgba(245, 193, 90, 0.55);
  background: rgba(245, 193, 90, 0.12);
  box-shadow: 0 0 14px rgba(245, 193, 90, 0.22);
}

.runtime-caption {
  color: var(--accent);
  font-weight: 800;
  flex: 0 0 auto;
}

.runtime-chip,
.runtime-quota {
  border: 1px solid rgba(51, 214, 196, 0.28);
  border-radius: 999px;
  background: rgba(51, 214, 196, 0.1);
  color: #effffb;
  padding: 3px 7px;
  max-width: 100%;
  text-align: center;
}

.runtime-quota {
  color: #d8f6b8;
  border-color: rgba(142, 230, 106, 0.26);
  background: rgba(142, 230, 106, 0.08);
}

#runtimeClock {
  color: #fff3cf;
  font-size: 17px;
  line-height: 1.05;
  font-weight: 800;
}

.runtime-elapsed {
  color: #d8c99b;
  font-size: 11px;
  line-height: 1.1;
}

.runtime-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: #9fbbb7;
  font-size: 11px;
  line-height: 1.15;
}

.runtime-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.runtime-control {
  min-width: 0;
  min-height: 31px;
  height: 31px;
  border-radius: 6px;
  padding: 2px 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  text-align: center;
  border-color: rgba(51, 214, 196, 0.26);
  background: rgba(51, 214, 196, 0.08);
  color: #effffb;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, background 0.12s ease;
}

.runtime-control strong,
.runtime-control span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-control strong {
  width: auto;
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 850;
}

.runtime-control span {
  color: #86aaa5;
  width: auto;
  flex: 0 0 auto;
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 650;
  text-align: center;
}

.runtime-control.primary {
  border-color: rgba(51, 214, 196, 0.55);
  background: rgba(51, 214, 196, 0.15);
}

.runtime-control.readonly {
  cursor: default;
  color: #d8f6b8;
  border-color: rgba(142, 230, 106, 0.22);
  background: rgba(142, 230, 106, 0.07);
}

.runtime-control:not(.readonly):hover {
  border-color: var(--accent);
  background: rgba(51, 214, 196, 0.15);
}

.runtime-control:not(.readonly):active {
  transform: scale(0.985);
  border-color: var(--warn);
  background: rgba(245, 193, 90, 0.14);
}

.runtime-control.saving {
  border-color: rgba(245, 193, 90, 0.75);
  background: rgba(245, 193, 90, 0.16);
  box-shadow: 0 0 0 1px rgba(245, 193, 90, 0.1) inset;
}

.runtime-mode-button,
.runtime-detail {
  min-width: 0;
  min-height: 24px;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-mode-button {
  flex: 0 0 auto;
  min-width: 50px;
  display: grid;
  gap: 0;
  place-items: center;
  border-color: rgba(51, 214, 196, 0.48);
  color: #eafffb;
  background: rgba(51, 214, 196, 0.12);
  font-weight: 800;
}

.runtime-mode-button small {
  color: #86aaa5;
  font-size: 9.5px;
  font-weight: 650;
}

.runtime-mode-button:hover {
  border-color: var(--accent);
  color: #ffffff;
}

.runtime-detail {
  width: auto;
  max-width: 180px;
  justify-self: start;
  min-height: 20px;
  padding: 1px 8px;
  color: #d8f6b8;
  border-color: rgba(142, 230, 106, 0.22);
  background: rgba(142, 230, 106, 0.07);
  text-align: left;
}

.runtime-detail:hover {
  border-color: rgba(142, 230, 106, 0.48);
}

.attachments {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.attachment {
  min-height: 28px;
  padding: 0 4px 0 8px;
  background: rgba(51, 214, 196, 0.08);
  color: #bffff7;
  border-color: rgba(51, 214, 196, 0.24);
  font-size: 12px;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(51, 214, 196, 0.24);
  border-radius: 8px;
  overflow: hidden;
}

.attachment-name,
.attachment-remove {
  min-height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
}

.attachment-name,
.attachment-file-name {
  min-width: 0;
  color: #bffff7;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name {
  flex: 1 1 auto;
  text-align: left;
}

.attachment-remove {
  flex: 0 0 auto;
  width: 24px;
  color: #d9fff9;
  font-size: 16px;
  line-height: 1;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
}

.image-preview[hidden] {
  display: none;
}

.image-preview-stage {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: auto;
  touch-action: none;
}

.image-preview img {
  max-width: 100%;
  max-height: 78dvh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #020506;
  transform-origin: center;
  transition: transform 0.12s ease;
  cursor: zoom-in;
}

.image-preview-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 61;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  background: rgba(10, 18, 24, 0.9);
}

.image-preview-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(51, 214, 196, 0.28);
  border-radius: 999px;
  background: rgba(8, 18, 24, 0.9);
  padding: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
}

.image-preview-controls button {
  min-height: 32px;
  min-width: 36px;
  padding: 0 12px;
  border-radius: 999px;
}

#imageZoomValue {
  min-width: 48px;
  text-align: center;
  color: #dffef8;
  font-size: 12px;
  font-weight: 800;
}

.text-preview {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: grid;
  place-items: stretch;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.text-preview[hidden] {
  display: none;
}

.text-preview-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  border: 1px solid rgba(51, 214, 196, 0.32);
  border-radius: 10px;
  background: rgba(9, 17, 23, 0.98);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.text-preview-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(51, 214, 196, 0.18);
}

.text-preview-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #effffb;
}

.text-preview-head button {
  flex: 0 0 auto;
}

.text-preview pre {
  margin: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #e7f2f0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 64;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 46%, rgba(51, 214, 196, 0.16), transparent 34%),
    rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px) saturate(0.82);
  -webkit-backdrop-filter: blur(10px) saturate(0.82);
}

.confirm-dialog[hidden] {
  display: none;
}

.confirm-panel {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(51, 214, 196, 0.38);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(8, 23, 28, 0.98), rgba(5, 13, 18, 0.98));
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(135, 255, 232, 0.04);
}

.confirm-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 197, 71, 0.36);
  border-radius: 12px;
  color: #ffd166;
  background: rgba(255, 197, 71, 0.09);
}

.confirm-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirm-copy {
  min-width: 0;
}

.confirm-copy strong {
  display: block;
  color: #f8ffe9;
  font-size: 16px;
  line-height: 1.2;
}

.confirm-copy p {
  margin: 7px 0 0;
  color: #a9c6c5;
  font-size: 13px;
  line-height: 1.55;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 4px;
}

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

.confirm-cancel {
  color: #cfe7e3;
}

.confirm-ok {
  border-color: rgba(51, 214, 196, 0.9);
  color: #041112;
  background: linear-gradient(180deg, #41e4d2, #28cdbd);
  box-shadow: 0 10px 24px rgba(51, 214, 196, 0.18);
}

.composer textarea {
  resize: none;
  max-height: 160px;
}

.composer #send,
.button-row button:first-child,
.dialog-body #confirmNewThread {
  background: var(--accent);
  color: #031011;
  border-color: var(--accent);
  font-weight: 700;
}

.composer .secondary {
  background: #0b141a;
  color: var(--ink);
  border-color: var(--line);
}

.inspector {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 12;
  width: min(410px, 92vw);
  background: #0c141a;
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 34px var(--shadow);
  transform: translateX(105%);
  transition: transform 0.18s ease;
  display: grid;
  grid-template-rows: 60px auto minmax(0, 1fr);
  overflow: hidden;
}

.inspector.open {
  transform: translateX(0);
}

.inspector-head {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.tabs {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  padding: 0 6px;
  min-width: 0;
  background: #091117;
}

.tabs button.active,
.segmented button.active {
  background: rgba(51, 214, 196, 0.16);
  border-color: var(--accent);
  color: #ffffff;
}

.panel {
  display: none;
  overflow: auto;
  padding: 14px;
  background: #0c141a;
}

.panel.active {
  display: block;
}

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

.panel h2 {
  margin: 0;
  font-size: 15px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.settings-save-status {
  min-width: 72px;
  text-align: right;
  white-space: nowrap;
}

.settings-save-status[data-tone="pending"] {
  color: #fff3cf;
}

.settings-save-status[data-tone="ok"] {
  color: #d8f6b8;
}

.settings-save-status[data-tone="error"] {
  color: #ffd7d7;
}

.file-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.file-toolbar button {
  min-width: 0;
  padding: 0 8px;
  font-size: 13px;
}

.file-path {
  min-width: 0;
  margin-bottom: 10px;
  border: 1px solid rgba(51, 214, 196, 0.18);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.06);
  color: #bffff7;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-list {
  display: grid;
  gap: 7px;
}

.file-row {
  width: 100%;
  height: auto;
  min-height: 54px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  text-align: left;
  border-radius: 8px;
  background: #091117;
}

.file-row.directory {
  background: rgba(51, 214, 196, 0.07);
}

.file-icon {
  width: 44px;
  height: 30px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(51, 214, 196, 0.32);
  color: #c8fff6;
  font-size: 11px;
  font-weight: 800;
}

.file-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.file-main b,
.file-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-main b {
  color: #ffffff;
  font-size: 13px;
}

.file-main small {
  color: var(--muted);
  font-size: 11px;
}

.file-preview {
  margin-top: 12px;
  border: 1px solid rgba(51, 214, 196, 0.28);
  border-radius: 8px;
  background: rgba(5, 11, 16, 0.58);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.file-preview[hidden] {
  display: none;
}

.file-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.file-preview-actions a,
.file-preview-actions button {
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(51, 214, 196, 0.34);
  background: rgba(51, 214, 196, 0.08);
  color: #dffef8;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.file-preview img {
  max-width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  border-radius: 8px;
  background: #020709;
}

.file-preview iframe {
  width: 100%;
  height: min(62dvh, 620px);
  border: 1px solid rgba(51, 214, 196, 0.2);
  border-radius: 8px;
  background: #ffffff;
}

.file-preview pre {
  max-height: 58dvh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid rgba(51, 214, 196, 0.18);
  border-radius: 8px;
  background: #03080b;
  color: #dffef8;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.effort-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented button {
  min-width: 0;
  padding: 0 8px;
  background: #091117;
}

.setting-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.setting-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.model-note-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin: -2px 0 4px;
}

.model-note {
  border: 1px solid rgba(51, 214, 196, 0.16);
  border-radius: 8px;
  background: #091117;
  padding: 8px 10px;
  max-height: 52px;
  overflow: auto;
}

.runtime-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.runtime-settings div {
  border: 1px solid rgba(51, 214, 196, 0.18);
  border-radius: 8px;
  background: #091117;
  padding: 8px;
  min-width: 0;
}

.runtime-settings span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.runtime-settings b {
  display: block;
  color: #ffffff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.default-settings {
  display: grid;
  gap: 8px;
  padding: 10px;
  margin: 10px 0 12px;
  border: 1px solid rgba(52, 211, 190, 0.22);
  border-radius: 10px;
  background: rgba(52, 211, 190, 0.06);
}

.default-settings .fine {
  margin: 0;
}

.default-settings button {
  width: 100%;
}

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

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
  background: #091117;
}

.metrics b {
  display: block;
  font-size: 16px;
  overflow-wrap: anywhere;
  color: #ffffff;
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
}

.metrics .fine {
  grid-column: 1 / -1;
}

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

.quota-row {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091117;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.quota-name {
  color: #ffffff;
  font-size: 13px;
  font-weight: 650;
}

.quota-remaining {
  color: #dffef8;
  font-size: 14px;
}

.quota-reset {
  color: var(--muted);
  font-size: 12px;
}

.fine {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 8px 0 0;
}

.field {
  position: relative;
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.project-picker-button {
  height: 42px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  text-align: left;
  border-color: rgba(51, 214, 196, 0.42);
  background: #091117;
}

.project-picker-button span {
  color: #effffb;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-button b {
  grid-column: 1 / -1;
  color: #9edbd2;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-button::after {
  content: "⌄";
  grid-column: 2;
  grid-row: 1;
  color: #bcfff5;
  font-size: 18px;
  line-height: 1;
}

.project-picker-button[aria-expanded="true"]::after {
  content: "⌃";
}

.project-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 45;
  display: grid;
  gap: 2px;
  max-height: min(34vh, 238px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 13px;
  background: rgba(13, 20, 25, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

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

.project-picker-menu button {
  min-height: 38px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 1px;
  align-items: center;
  text-align: left;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.project-picker-menu button::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / 3;
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.project-picker-menu button.active {
  background: rgba(51, 214, 196, 0.13);
}

.project-picker-menu button.active::before {
  content: "✓";
  display: grid;
  place-items: center;
  color: #59ffd7;
  font-size: 13px;
  font-weight: 900;
}

.project-picker-menu span {
  color: #f2fffb;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-menu b {
  color: #9db7be;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 13px;
}

.check-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.switch-row {
  min-height: 38px;
  margin-bottom: 6px;
  padding: 8px 9px;
  border: 1px solid rgba(51, 214, 196, 0.18);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.05);
  justify-content: flex-start;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 128px;
  z-index: 30;
  transform: translateX(-50%) translateY(8px);
  max-width: min(80vw, 320px);
  border: 1px solid rgba(51, 214, 196, 0.45);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(7, 20, 25, 0.94);
  color: #e9fffb;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dialog {
  position: fixed;
  z-index: 14;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100vw - 28px));
  background: #0c141a;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 18px 48px var(--shadow);
  transform: translate(-50%, -46%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.dialog-head {
  height: 60px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  padding: 14px;
}

.dialog-body #confirmNewThread {
  width: 100%;
}

.selected-folder-summary {
  display: grid;
  gap: 4px;
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid rgba(51, 214, 196, 0.28);
  border-radius: 8px;
  background: rgba(51, 214, 196, 0.08);
}

.selected-folder-summary span,
.selected-folder-summary em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.selected-folder-summary b {
  min-width: 0;
  color: #d8f6b8;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-picker {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

.folder-picker-head,
.folder-create {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.folder-create {
  grid-template-columns: 1fr 1fr;
}

.folder-browser-path {
  color: #b8e7df;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(51, 214, 196, 0.22);
  background: rgba(51, 214, 196, 0.06);
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-browser {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091117;
}

.folder-browser button {
  min-height: 30px;
  text-align: left;
  padding: 5px 8px;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.48);
  min-height: 0;
}

.backdrop.show {
  display: block;
}

.backdrop.modal {
  z-index: 13;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px) saturate(0.75);
  -webkit-backdrop-filter: blur(10px) saturate(0.75);
}

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

  .mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 350px);
    z-index: 12;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 12px 0 34px var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  #toggleSidebar {
    display: block;
  }

  .chat-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
  }

  .header-actions {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    width: auto;
    flex: 0 0 auto;
  }

  #toggleSidebar {
    grid-row: 1;
    align-self: start;
  }

  .service-health {
    display: none;
  }

  .health-chip {
    padding: 2px 5px;
    font-size: 10.5px;
  }

  .header-actions button {
    flex: 0 0 auto;
    min-width: 34px;
  }

  .messages {
    padding: 12px;
  }

  .runtime-bar {
    gap: 5px;
    padding: 4px 6px;
  }

  .runtime-mainline {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 6px;
  }

  .runtime-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .runtime-overview {
    padding: 11px 10px 9px;
    gap: 8px;
  }

  .runtime-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .runtime-control {
    min-height: 31px;
    height: 31px;
    padding-left: 5px;
    padding-right: 5px;
    gap: 6px;
  }

  .runtime-control strong {
    font-size: 13.5px;
  }

  .runtime-control span {
    font-size: 10.5px;
  }

  .runtime-task-copy strong {
    font-size: 17px;
  }

  .runtime-context-meter strong {
    font-size: 20px;
  }

  .runtime-mode-button,
  .runtime-detail {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 11.5px;
  }

  .runtime-summary {
    font-size: 10.5px;
  }

  .runtime-detail {
    max-width: 170px;
  }

  .composer {
    grid-template-columns: 40px minmax(0, 1fr) 62px;
    gap: 5px 8px;
  }

  .composer-plus {
    width: 40px;
    min-width: 40px;
  }

  .composer-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
  }

  .action-tile {
    min-height: 36px;
    padding-left: 5px;
    padding-right: 5px;
    gap: 4px;
  }

  .action-icon {
    width: 16px;
    height: 16px;
  }

  .action-text {
    font-size: 11.5px;
  }

  .pending-actions {
    grid-template-columns: 1fr 1fr;
  }

  .approval-actions {
    grid-template-columns: 1fr 1fr;
  }

  .pending-session {
    grid-column: 1 / -1;
  }

  .msg {
    max-width: 100%;
  }
}
