:root {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: rgba(255, 251, 244, 0.92);
  --ink: #1d1c1a;
  --muted: #5f564a;
  --line: #d9cdbb;
  --accent: #0f766e;
  --assistant: #f3ede2;
  --user: #dff4f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #f8f3eb, var(--bg));
}

.page {
  width: min(1500px, 100%);
  max-width: 100%;
  margin: 32px auto;
  padding: 0 16px;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
}

.stack {
  display: grid;
  min-width: 0;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 14px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(62, 49, 26, 0.08);
}

.form-panel,
.chat-panel,
.output-panel {
  min-width: 0;
  align-self: start;
}

h1,
h2 {
  margin-top: 0;
  font-family: "IBM Plex Serif", "Georgia", serif;
}

h1 {
  margin-bottom: 4px;
}

.brand-header {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.brand-logo {
  width: 92px;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(15, 118, 110, 0.18));
}

.brand-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-switch {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 2px;
}

.language-switch span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
}

.route-hint,
.wrapper-status,
.package-warning {
  margin: -4px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.run-defaults-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.run-defaults-card {
  min-width: 0;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, 0.72), rgba(255, 253, 250, 0.9)),
    #fffdfa;
}

.run-defaults-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 10px;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

.run-defaults-summary::-webkit-details-marker {
  display: none;
}

.run-defaults-summary strong,
.workspace-search-head strong {
  display: block;
  color: #0f766e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.run-defaults-summary .subtle {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
}

.key-status-summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.82);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.key-status-summary[data-ready="true"] {
  border-color: rgba(15, 118, 110, 0.32);
  background: rgba(204, 251, 241, 0.52);
  color: #0f766e;
}

.key-status-list,
.project-status-grid {
  display: grid;
  gap: 8px;
}

.key-status-list {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
}

.key-status-chip,
.project-status-chip {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(95, 86, 74, 0.16);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.78);
}

.key-status-chip[data-ready="true"] {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(204, 251, 241, 0.42);
}

.key-status-chip strong,
.project-status-chip strong {
  display: block;
  color: #0f766e;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.key-status-chip span,
.project-status-chip span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.run-defaults-head {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 16px;
  background: rgba(204, 251, 241, 0.28);
}

.run-defaults-head p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.model-catalog-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, 0.82), rgba(255, 253, 250, 0.9)),
    #fffdfa;
}

.route-pill {
  max-width: 100%;
  overflow: hidden;
  margin: -2px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(204, 251, 241, 0.42);
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.model-catalog-head strong {
  max-width: 70%;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-catalog {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-role-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.model-role-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.model-role-card strong,
.model-role-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-role-card strong {
  color: #0f766e;
  font-size: 0.84rem;
}

.model-role-card span {
  color: var(--muted);
  font-size: 0.76rem;
}

.model-role-editor {
  display: grid;
  gap: 10px;
  margin-top: -2px;
  padding: 12px;
  border: 1px solid rgba(29, 78, 216, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(219, 234, 254, 0.62), rgba(255, 251, 235, 0.82)),
    rgba(255, 255, 255, 0.82);
}

.model-role-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.model-role-editor-head strong {
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-editor-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  align-items: start;
}

.role-editor-grid label {
  display: grid;
  gap: 6px;
}

.role-editor-grid label > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.model-chip {
  display: grid;
  gap: 2px;
  flex: 1 1 180px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.model-chip strong,
.model-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-chip span {
  color: var(--muted);
  font-size: 0.76rem;
}

.model-chip[data-active="true"] {
  border-color: rgba(15, 118, 110, 0.72);
  background: rgba(204, 251, 241, 0.52);
}

.workspace-search-card,
.project-card,
.setup-card {
  min-width: 0;
  margin: 14px 0;
  padding: 13px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(204, 251, 241, 0.44), rgba(255, 247, 237, 0.9));
}

.setup-card {
  display: grid;
  gap: 10px;
}

.workspace-search-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.workspace-search-head {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.workspace-search-head p {
  margin: 3px 0 0;
  line-height: 1.45;
}

.workspace-search-field {
  position: relative;
  display: grid;
  gap: 6px;
}

.workspace-search-field input[type="search"] {
  min-height: 48px;
  padding: 12px 14px 12px 42px;
  border-color: rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(204, 251, 241, 0.28), rgba(255, 253, 250, 0.96)),
    #fffdfa;
  font-size: 0.94rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.workspace-search-field::before {
  position: absolute;
  bottom: 12px;
  left: 15px;
  color: #0f766e;
  font-size: 1rem;
  content: "⌕";
  pointer-events: none;
}

.project-status-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.project-status-chip[data-wide="true"] {
  grid-column: 1 / -1;
}

.project-card {
  display: block;
}

.project-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  list-style: none;
  cursor: pointer;
}

.project-card summary::-webkit-details-marker {
  display: none;
}

.project-card summary strong {
  min-width: 0;
}

.project-card summary:focus-visible {
  border-radius: 10px;
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 4px;
}

.project-card-toggle {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.78);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 900;
}

.project-card-toggle::before {
  content: "⌄";
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}

.project-card[open] .project-card-toggle::before {
  transform: rotate(0deg);
}

.project-card p,
.setup-card p {
  overflow-wrap: anywhere;
}

.project-card p {
  margin: 10px 0 0;
  line-height: 1.55;
}

.setup-card .key-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.setup-card .key-links a {
  color: #075985;
  font-weight: 750;
  text-decoration: none;
}

.setup-card .key-links a:hover {
  text-decoration: underline;
}

.setup-card[hidden] {
  display: none;
}

form,
.checks {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 140px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

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

input,
textarea,
select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

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

.switch-label {
  position: relative;
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  gap: 12px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.72);
  cursor: pointer;
  user-select: none;
}

.switch-label input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 62px;
  height: 32px;
  align-items: center;
  border: 1px solid rgba(95, 86, 74, 0.24);
  border-radius: 999px;
  background: #d8d0c3;
  box-shadow: inset 0 2px 8px rgba(62, 49, 26, 0.14);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.switch::before {
  position: absolute;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fffdfa;
  box-shadow: 0 3px 10px rgba(62, 49, 26, 0.24);
  content: "";
  transition: transform 180ms ease;
}

.switch::after {
  position: absolute;
  right: 8px;
  color: rgba(95, 86, 74, 0.8);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  content: "OFF";
}

.switch-label input[type="checkbox"]:checked + .switch {
  border-color: rgba(15, 118, 110, 0.46);
  background: linear-gradient(135deg, var(--accent), #12b8aa);
  box-shadow: inset 0 2px 10px rgba(4, 88, 81, 0.22);
}

.switch-label input[type="checkbox"]:checked + .switch::before {
  transform: translateX(30px);
}

.switch-label input[type="checkbox"]:checked + .switch::after {
  right: auto;
  left: 9px;
  color: white;
  content: "ON";
}

.switch-label input[type="checkbox"]:focus-visible + .switch {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 3px;
}

.wrapper-controls {
  grid-template-columns: minmax(0, 1fr) 180px;
}

.switch-card {
  min-height: 100%;
}

.compact-switch {
  width: max-content;
  grid-template-columns: auto auto;
  height: 50px;
  min-height: 50px;
  padding: 8px 10px;
  gap: 8px;
  white-space: nowrap;
}

.compact-switch .switch {
  width: 44px;
  min-width: 44px;
}

.compact-switch .switch::before {
  width: 18px;
}

.compact-switch input[type="checkbox"]:checked + .switch::before {
  transform: translateX(18px);
}

.settings-button {
  width: 100%;
  justify-self: stretch;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--accent), #155e75);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
}

button.danger {
  background: linear-gradient(135deg, #b42318, #dc6803);
}

.icon-button {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
  box-shadow: none;
}

.artifact-button {
  width: auto;
  min-width: 78px;
  padding: 0 14px;
  font-weight: 800;
}

.artifact-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 2px solid #fffdfa;
  border-radius: 999px;
  background: #d92d20;
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
}

.actions,
.header-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.quick-mode-bar {
  display: grid;
  grid-template-columns: max-content max-content max-content minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, 0.76), rgba(255, 253, 250, 0.9)),
    #fffdfa;
}

.quick-mode-select {
  display: inline-flex;
  width: max-content;
  height: 50px;
  min-height: 50px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.72);
}

.quick-mode-select span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-mode-select select {
  width: 68px;
  min-width: 68px;
  padding: 5px 20px 5px 9px;
  border-radius: 10px;
}

.quick-mode-status {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-header-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

#run-meta {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.sandbox-card {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 250, 0.7);
}

.capability-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 253, 250, 0.9), rgba(236, 253, 245, 0.58));
}

.capability-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

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

.capability-chip {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  font-size: 0.82rem;
  line-height: 1.25;
}

.capability-chip strong {
  display: block;
  margin-bottom: 2px;
}

.capability-chip[data-ready="true"] {
  border-color: rgba(15, 118, 110, 0.35);
}

.capability-chip[data-ready="false"] {
  opacity: 0.72;
}

.capability-chip[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.workspace-card {
  border-color: rgba(0, 111, 238, 0.18);
  background: linear-gradient(135deg, rgba(255, 253, 250, 0.9), rgba(239, 246, 255, 0.72));
}

.workspace-explorer-card {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, 0.72), rgba(255, 253, 250, 0.92)),
    rgba(255, 255, 255, 0.8);
}

.workspace-explorer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.workspace-explorer-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.workspace-explorer-actions,
.workspace-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workspace-browser-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.workspace-status-chip {
  padding: 4px 8px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.86);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: capitalize;
}

.workspace-root-path {
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.07);
  color: #155e75;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.workspace-status-warn {
  color: #b45309;
  font-size: 0.76rem;
}

.workspace-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 7px;
}

.workspace-lane {
  min-height: 46px;
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 8px 9px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 13px;
  background: rgba(255, 253, 250, 0.78);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.workspace-lane strong {
  color: var(--accent);
  font-size: 0.78rem;
}

.workspace-lane[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.55);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.18), rgba(255, 255, 255, 0.9));
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.08);
}

.workspace-tree {
  max-height: 440px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.88), rgba(240, 253, 250, 0.58)),
    rgba(255, 255, 255, 0.72);
}

.workspace-tree-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: -8px -8px 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.1);
  background: rgba(255, 253, 250, 0.95);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.workspace-tree-toolbar strong {
  color: var(--accent);
}

.workspace-folder-root,
.workspace-folder-children {
  display: grid;
  gap: 4px;
}

.workspace-folder {
  margin-left: calc(var(--depth, 0) * 12px);
}

.workspace-folder summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.workspace-folder summary::-webkit-details-marker {
  display: none;
}

.workspace-folder summary:hover {
  border-color: rgba(15, 118, 110, 0.16);
  background: rgba(240, 253, 250, 0.72);
}

.workspace-folder-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 6px;
  color: var(--accent);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.68rem;
  transition: transform 0.16s ease;
}

.workspace-folder[open] > summary .workspace-folder-icon {
  transform: rotate(90deg);
}

.workspace-folder-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.workspace-folder summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.workspace-folder-children {
  margin-top: 4px;
}

.workspace-empty {
  margin: 0;
  padding: 12px;
  border: 1px dashed rgba(15, 118, 110, 0.24);
  border-radius: 14px;
}

.workspace-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(217, 119, 6, 0.16);
  border-radius: 12px;
  background: rgba(255, 253, 250, 0.72);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.workspace-tree-file {
  margin-left: calc(var(--depth, 0) * 12px);
}

.workspace-file-row:hover {
  border-color: rgba(15, 118, 110, 0.34);
  background: rgba(240, 253, 250, 0.72);
}

.workspace-file-row[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.58);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.22), rgba(255, 255, 255, 0.96));
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.workspace-file-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 24px;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.09);
  color: #155e75;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.workspace-file-main strong,
.workspace-file-main small,
.workspace-file-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-file-main small,
.workspace-file-meta {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.76rem;
}

.workspace-workbench {
  display: grid;
  gap: 12px;
}

.workspace-active-title {
  padding: 9px 11px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 13px;
  background: rgba(255, 253, 250, 0.76);
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.workspace-preview {
  min-height: 140px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.workspace-code-preview {
  margin: 0;
  padding: 13px;
  color: #1f2937;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.workspace-editor {
  min-height: 320px;
  width: 100%;
  resize: vertical;
  border-color: rgba(15, 118, 110, 0.24);
  background: #fffefb;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
}

.workspace-media-preview {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  padding: 10px;
  background: rgba(255, 253, 250, 0.8);
}

.workspace-pdf-preview {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
}

.workspace-editor-status[data-kind="error"] {
  color: #b91c1c;
}

.mcp-card {
  border-color: rgba(15, 118, 110, 0.18);
  background: linear-gradient(135deg, rgba(255, 253, 250, 0.92), rgba(204, 251, 241, 0.32));
}

.mcp-warnings[hidden] {
  display: none;
}

.workspace-changes {
  display: grid;
  gap: 8px;
}

.change-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 250, 0.82);
}

.change-item.blocked {
  border-color: rgba(217, 119, 6, 0.28);
}

.change-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.change-path {
  display: block;
  margin: 4px 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
}

.change-diff {
  max-height: 150px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: #111827;
  color: #dbeafe;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.72rem;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.change-diff .diff-add,
.change-diff .diff-file-add {
  color: #86efac;
}

.change-diff .diff-del,
.change-diff .diff-file-del {
  color: #fca5a5;
}

.change-diff .diff-hunk {
  color: #67e8f9;
}

.sandbox-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.sandbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sandbox-logs {
  min-height: 96px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #dbeafe;
  border: 1px solid #1e293b;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.session-select {
  max-width: 340px;
}

.session-tools {
  display: flex;
  flex: 1 1 420px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.session-tools .session-select {
  flex: 1 1 220px;
  min-width: 0;
  max-width: none;
}

.run-state {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 253, 250, 0.9), rgba(240, 253, 250, 0.76));
}

.run-state[data-status="running"] {
  border-color: rgba(15, 118, 110, 0.34);
  background: linear-gradient(135deg, rgba(204, 251, 241, 0.9), rgba(254, 243, 199, 0.62));
}

.run-state[data-status="failed"],
.run-state[data-status="stopped"] {
  border-color: rgba(185, 28, 28, 0.22);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.92), rgba(255, 251, 235, 0.7));
}

.run-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
}

.run-state[data-status="running"] .run-state-dot {
  background: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}

.run-state[data-status="finished"] .run-state-dot {
  background: #15803d;
  box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.15);
}

.run-state[data-status="failed"] .run-state-dot,
.run-state[data-status="stopped"] .run-state-dot {
  background: #b91c1c;
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.13);
}

.run-state strong {
  color: var(--ink);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 16px;
  background: rgba(255, 253, 250, 0.96);
  box-shadow: 0 18px 48px rgba(36, 28, 15, 0.16);
  color: var(--ink);
  font-size: 0.9rem;
  pointer-events: auto;
}

.toast[data-kind="error"] {
  border-color: rgba(185, 28, 28, 0.25);
  background: rgba(254, 242, 242, 0.96);
}

.logs {
  width: 100%;
  min-width: 0;
  min-height: 300px;
  max-height: 42vh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #151515;
  color: #dfdfd8;
  border: 1px solid #2d2d2d;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output-panel {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.log-line {
  margin: 0 0 10px;
}

.log-line.error {
  color: #fecaca;
}

.log-json,
.log-command pre {
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.18);
  white-space: pre-wrap;
  overflow: auto;
}

.log-command {
  margin: 0 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.log-command summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  cursor: pointer;
  padding: 10px 12px;
  color: #dbeafe;
  white-space: normal;
}

.log-command summary code {
  color: #fef3c7;
  overflow-wrap: anywhere;
}

.log-command summary small,
.log-stream-title,
.log-fold-note {
  color: #94a3b8;
  font-size: 0.78rem;
}

.log-command[open] {
  background: rgba(255, 255, 255, 0.06);
}

.permission-approval {
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid rgba(251, 146, 60, 0.42);
  border-radius: 14px;
  background: rgba(124, 45, 18, 0.22);
  color: #ffedd5;
}

.permission-approval p {
  margin: 6px 0;
}

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

.log-stream-title,
.log-fold-note {
  padding: 0 12px 8px;
}

.event-card {
  width: auto;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 184, 166, 0.14), transparent 28%),
    rgba(255, 255, 255, 0.46);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

#logs .event-card {
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 184, 166, 0.1), transparent 26%),
    rgba(15, 23, 42, 0.52);
  color: #e5e7eb;
}

.event-plan {
  border-color: rgba(20, 184, 166, 0.34);
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 184, 166, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(240, 253, 250, 0.9), rgba(255, 251, 235, 0.74));
}

.event-focused {
  border-color: rgba(14, 165, 233, 0.34);
  background:
    radial-gradient(circle at 0% 0%, rgba(14, 165, 233, 0.15), transparent 28%),
    linear-gradient(180deg, rgba(240, 249, 255, 0.9), rgba(240, 253, 250, 0.74));
}

#logs .event-plan {
  background: rgba(15, 23, 42, 0.58);
}

#logs .event-focused {
  background: rgba(15, 23, 42, 0.58);
}

.event-patch {
  border-color: rgba(192, 132, 252, 0.38);
}

.event-write {
  border-color: rgba(59, 130, 246, 0.28);
}

.event-finish {
  border-color: rgba(16, 185, 129, 0.36);
  background:
    radial-gradient(circle at 0% 0%, rgba(16, 185, 129, 0.14), transparent 30%),
    rgba(236, 253, 245, 0.46);
}

#logs .event-finish {
  background:
    radial-gradient(circle at 0% 0%, rgba(16, 185, 129, 0.16), transparent 30%),
    rgba(6, 78, 59, 0.28);
}

.event-failed {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.12);
}

#logs .event-failed {
  background: rgba(127, 29, 29, 0.3);
}

.event-muted {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(148, 163, 184, 0.1);
}

.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#logs .event-card-meta {
  color: #99f6e4;
}

.event-path {
  display: block;
  margin: 4px 0 8px;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.event-inline-code {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  color: #78350f;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#logs .event-inline-code {
  background: rgba(255, 255, 255, 0.08);
  color: #fef3c7;
}

.event-output {
  margin: 4px 0 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.84);
  color: #e5e7eb;
  white-space: pre-wrap;
  overflow: auto;
}

.event-fold-note {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.event-result-summary {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
}

#logs .event-result-summary {
  background: rgba(255, 255, 255, 0.08);
}

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

.embedded-change-list > .event-card {
  margin: 0;
  box-shadow: none;
}

.assistant-result-card {
  margin: 0;
}

#logs .event-fold-note {
  color: #94a3b8;
}

.event-diff {
  max-height: 360px;
}

.chat-panel {
  display: grid;
  gap: 12px;
  border-color: rgba(15, 118, 110, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 253, 250, 0.95), rgba(236, 253, 245, 0.66)),
    var(--panel);
}

.chat-thread {
  min-height: 200px;
  max-height: 32vh;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 14% 8%, rgba(20, 184, 166, 0.18), transparent 24%),
    radial-gradient(circle at 86% 0%, rgba(245, 158, 11, 0.16), transparent 22%),
    linear-gradient(180deg, rgba(255, 253, 250, 0.86), rgba(241, 245, 249, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.chat-item {
  width: fit-content;
  max-width: min(780px, 88%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(62, 49, 26, 0.08);
}

.chat-item.user {
  justify-self: end;
  background: var(--user);
  border-bottom-right-radius: 6px;
}

.chat-item.assistant {
  justify-self: start;
  background: var(--assistant);
  border-bottom-left-radius: 6px;
}

.chat-item.event {
  justify-self: stretch;
  width: auto;
  max-width: 100%;
  border-color: rgba(20, 184, 166, 0.28);
  border-style: dashed;
  background:
    linear-gradient(90deg, rgba(20, 184, 166, 0.12), rgba(245, 158, 11, 0.08)),
    rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.chat-item.event[data-event-type="plan.created"] {
  border-style: solid;
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 184, 166, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(240, 253, 250, 0.88), rgba(255, 251, 235, 0.7));
}

.chat-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.chat-content {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.markdown-body {
  line-height: 1.58;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0.92em 0 0.42em;
  color: var(--ink);
  line-height: 1.15;
}

.markdown-body h1 {
  font-size: 1.38rem;
}

.markdown-body h2 {
  font-size: 1.22rem;
}

.markdown-body h3 {
  font-size: 1.08rem;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-table-wrap {
  margin: 0 0 0.82em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.35rem;
}

.markdown-body li + li {
  margin-top: 0.28em;
}

.markdown-body a {
  color: #0f766e;
  font-weight: 800;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.markdown-body code {
  padding: 0.12em 0.36em;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 0.92em;
}

.markdown-body pre {
  max-width: 100%;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 14px;
  background: #111827;
  color: #f8fafc;
  overflow: auto;
  white-space: pre;
}

.markdown-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.markdown-body .math-rendered,
.markdown-body .math-fallback {
  color: inherit;
}

.markdown-body .math-inline {
  display: inline-block;
  max-width: 100%;
  padding-inline: 0.08em;
  vertical-align: -0.08em;
}

.markdown-body .math-display {
  display: block;
  max-width: 100%;
  margin: 0.3rem 0 0.9rem;
  padding: 0.45rem 0.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.markdown-body .math-display:focus-visible {
  border-radius: 8px;
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.markdown-body .math-display .katex-display {
  min-width: max-content;
  margin: 0;
}

.markdown-body .math-fallback {
  border-color: rgba(180, 83, 9, 0.28);
  background: rgba(254, 243, 199, 0.62);
  color: #92400e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (forced-colors: active) {
  .markdown-body .math-fallback {
    border: 1px solid CanvasText;
  }
}

.markdown-body blockquote {
  padding: 0.2rem 0 0.2rem 0.9rem;
  border-left: 4px solid rgba(15, 118, 110, 0.32);
  color: var(--muted);
}

.markdown-body hr {
  height: 1px;
  margin: 1rem 0;
  border: 0;
  background: var(--line);
}

.markdown-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.markdown-body table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(15, 118, 110, 0.08);
}

.artifact-markdown {
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  overflow: auto;
}

.chat-form {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 250, 0.82);
}

#chat-input {
  min-height: 92px;
  border-color: rgba(15, 118, 110, 0.24);
  background: white;
}

.chat-shortcuts {
  margin: -2px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.chat-pending {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 251, 235, 0.72)),
    rgba(255, 255, 255, 0.78);
}

.pending-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}

.pending-header strong,
.pending-label {
  color: var(--ink);
}

.pending-section {
  display: grid;
  gap: 7px;
}

.pending-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pending-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.pending-copy {
  min-width: 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.35;
}

.pending-kind {
  flex: 0 0 auto;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.pending-kind.asap {
  color: #075985;
  background: rgba(14, 165, 233, 0.14);
}

.pending-kind.after {
  color: #92400e;
  background: rgba(245, 158, 11, 0.16);
}

.pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.mini-button {
  min-height: auto;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 0.76rem;
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  box-shadow: none;
}

.mini-button.danger {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

.modal {
  width: min(720px, calc(100% - 28px));
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(29, 28, 26, 0.42);
  backdrop-filter: blur(5px);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.98);
  box-shadow: 0 30px 90px rgba(29, 28, 26, 0.24);
}

.modal-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0 0 4px;
}

.session-manager-list {
  display: grid;
  max-height: 300px;
  gap: 8px;
  overflow: auto;
}

.session-row {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  color: var(--ink);
  text-align: left;
}

.session-row[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.session-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.modal-status {
  min-height: 20px;
  margin: 0;
}

.settings-modal {
  width: min(980px, calc(100% - 28px));
}

.settings-modal-card {
  max-height: min(860px, calc(100vh - 28px));
  overflow: auto;
  display: grid;
  gap: 14px;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.72);
}

.settings-section.model-role-editor {
  margin-top: 0;
}

.settings-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  justify-content: space-between;
}

.settings-section-head strong {
  color: #0f766e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.settings-wide {
  grid-column: 1 / -1;
}

.settings-checks {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.artifact-modal {
  width: min(1120px, calc(100% - 28px));
  max-width: 100%;
}

.artifact-modal-card {
  max-height: min(840px, calc(100vh - 36px));
  overflow: hidden;
}

.artifact-tabs {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.72);
}

.artifact-tab {
  flex: 1;
  min-width: min(130px, 100%);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.artifact-tab[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.26);
  background: linear-gradient(135deg, var(--accent), #155e75);
  color: white;
}

.artifact-layout {
  display: grid;
  min-height: 520px;
  max-width: 100%;
  gap: 14px;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  overflow: hidden;
}

.artifact-list-panel,
.artifact-viewer {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.82);
}

.artifact-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

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

.compact-button {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.artifact-list {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 8px;
  overflow: auto;
  padding: 10px;
}

.artifact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  color: var(--ink);
  text-align: left;
}

.artifact-row-main {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
}

.artifact-menu-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  align-self: start;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.9);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: none;
}

.artifact-menu-button:hover,
.artifact-menu-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.34);
  color: var(--accent);
}

.artifact-row[data-selected="true"] {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.artifact-row[data-read="false"] {
  border-color: rgba(217, 45, 32, 0.28);
  background: linear-gradient(135deg, #fffdfa, rgba(254, 242, 242, 0.96));
}

.artifact-row[data-read="false"] .artifact-row-top strong::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #d92d20;
  content: "";
  vertical-align: 1px;
}

.artifact-row-top,
.artifact-viewer-header {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.artifact-row-top strong,
.artifact-viewer-header h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-row-top strong {
  white-space: nowrap;
}

.artifact-row-top span,
.artifact-kind-pill {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.artifact-row-meta,
.artifact-row-preview {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.artifact-row-preview {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.artifact-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.artifact-viewer-header {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.artifact-viewer-header h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.artifact-viewer-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.artifact-image-frame {
  display: grid;
  min-height: 100%;
  place-items: center;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(15, 118, 110, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 118, 110, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 118, 110, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 118, 110, 0.08) 75%);
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.artifact-preview-image {
  max-width: 100%;
  max-height: 58vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 48px rgba(29, 28, 26, 0.18);
}

.artifact-pdf-frame {
  width: 100%;
  max-width: 100%;
  min-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.artifact-large-file {
  display: grid;
  gap: 10px;
  align-content: start;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.artifact-large-file p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.artifact-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.artifact-editor {
  min-height: 100%;
  height: 100%;
  border-radius: 14px;
  background: #0f172a;
  color: #dbeafe;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

@media (max-width: 960px) {
  .page {
    margin: 16px auto;
    padding: 0 12px;
    grid-template-columns: 1fr;
  }

  .brand-header {
    grid-template-columns: 76px 1fr;
  }

  .brand-logo {
    width: 76px;
  }

  .language-switch {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .logs {
    min-height: 260px;
    max-height: 40vh;
  }

  .chat-thread {
    max-height: 36vh;
  }

  .header-row {
    align-items: stretch;
    flex-direction: column;
  }

  .session-tools {
    width: 100%;
  }

  .wrapper-controls {
    grid-template-columns: 1fr;
  }

  .artifact-layout {
    min-height: 620px;
    grid-template-columns: 1fr;
    grid-template-rows: 230px minmax(0, 1fr);
  }

  .artifact-modal-card {
    overflow: auto;
  }

  .settings-grid,
  .settings-checks,
  .role-editor-grid,
  .quick-mode-bar {
    grid-template-columns: 1fr;
  }

  .run-defaults-summary {
    grid-template-columns: 1fr max-content;
  }

  .run-defaults-summary .key-status-summary {
    justify-self: start;
  }

  .quick-mode-status {
    white-space: normal;
  }
}

@media (max-width: 720px) {
  .grid,
  .checks,
  .wrapper-controls {
    grid-template-columns: 1fr;
  }

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

  .pending-actions {
    justify-content: flex-start;
  }

  .panel {
    padding: 15px;
  }

  .artifact-tabs {
    border-radius: 18px;
  }

  .artifact-tab {
    min-width: 120px;
  }
}
