:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #ded8cc;
  --line-strong: #c8c0b2;
  --text: #20201d;
  --muted: #6c665e;
  --soft: #8c857a;
  --accent: #0c7a6b;
  --accent-strong: #075f54;
  --accent-soft: #d9f1eb;
  --ink: #1f2937;
  --code-bg: #171c20;
  --warn: #b66907;
  --warn-bg: #fff0d6;
  --danger: #b42318;
  --danger-bg: #ffe2dc;
  --ok: #118352;
  --ok-bg: #dff5e8;
  --info: #2454a6;
  --info-bg: #e5edf9;
  --shadow: 0 18px 46px rgba(34, 31, 26, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(246, 244, 239, 0.95)),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-box {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-box h1 {
  margin: 0;
  font-size: 21px;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(12px);
}

.brand-row,
.topbar-title,
.panel-header,
.dialog-header,
.device-row,
.provider-row,
.history-row,
.file-row,
.tool-row {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.brand-row h1,
.topbar h2,
.panel-header h3,
.dialog h2 {
  margin: 0;
  line-height: 1.1;
}

.brand-row h1 {
  font-size: 20px;
}

.topbar h2 {
  font-size: 24px;
}

.panel-header h3,
.dialog h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(12, 122, 107, 0.28);
  outline-offset: 2px;
}

.sidebar-actions,
.topbar-actions,
.prompt-actions,
.quick-actions,
.control-cluster,
.dialog-actions,
.tab-row,
.mini-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-actions .primary-button {
  flex: 1;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.provider-button,
.filter-pill,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.primary-button,
.secondary-button,
.text-button {
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.secondary-button,
.text-button,
.icon-button,
.filter-pill,
.tab-button,
.provider-button {
  color: var(--ink);
  background: var(--surface-strong);
  border-color: var(--line);
}

.secondary-button:hover,
.text-button:hover,
.icon-button:hover,
.filter-pill:hover,
.tab-button:hover,
.provider-button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
}

.icon-button.danger {
  color: var(--danger);
}

.icon-button.is-active,
.secondary-button.is-active,
.text-button.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(12, 122, 107, 0.42);
}

button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

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

.filter-pill {
  height: 34px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.filter-pill.is-active,
.tab-button.is-active,
.provider-button.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(12, 122, 107, 0.36);
}

.session-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.session-card {
  width: 100%;
  display: grid;
  gap: 11px;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.session-card.is-active {
  border-color: rgba(12, 122, 107, 0.5);
  box-shadow: 0 0 0 3px rgba(12, 122, 107, 0.12);
}

.session-card:hover {
  border-color: var(--line-strong);
}

.session-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
}

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

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fbfaf6;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.chip.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(17, 131, 82, 0.25);
}

.chip.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(182, 105, 7, 0.25);
}

.chip.info {
  color: var(--info);
  background: var(--info-bg);
  border-color: rgba(36, 84, 166, 0.24);
}

.chip.danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(180, 35, 24, 0.2);
}

.console {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
}

.topbar-title {
  min-width: 0;
  gap: 11px;
}

.topbar-title > div:last-child {
  min-width: 0;
}

.topbar h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--soft);
  box-shadow: 0 0 0 4px rgba(140, 133, 122, 0.15);
}

.status-dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(17, 131, 82, 0.15);
}

.provider-switch,
.tabs {
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.74);
}

.provider-button {
  height: 32px;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 16px;
}

.metric {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric span,
.metric small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  font-size: 24px;
  line-height: 1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 16px;
  align-items: start;
}

.conversation-panel,
.inspector-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto;
  min-height: calc(100vh - 185px);
}

.panel-header {
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.session-progress {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.session-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #ebe5d9;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #c37d14);
  transition: width 0.26s ease;
}

.message-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 16px;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  max-width: 820px;
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  background: var(--accent-soft);
  border-color: rgba(12, 122, 107, 0.24);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--surface-strong);
}

.avatar svg {
  width: 17px;
  height: 17px;
}

.bubble {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bubble p {
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
}

.terminal {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  color: #e8f0e9;
  background: var(--code-bg);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.terminal-line {
  overflow-wrap: anywhere;
}

.terminal-line::before {
  content: "$ ";
  color: #95d6c3;
}

.prompt-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.74);
}

.prompt-actions {
  justify-content: space-between;
  gap: 12px;
}

.quick-actions {
  flex-wrap: wrap;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.inspector-panel {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow: hidden;
}

.tabs {
  gap: 4px;
  margin: 12px;
  overflow-x: auto;
}

.tab-button {
  height: 34px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.inspector-content {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 0 14px 14px;
}

.tool-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.inspector-content > *,
.tool-section > *,
.tool-row,
.device-row,
.provider-row,
.history-row,
.file-row {
  min-width: 0;
}

.tool-section + .tool-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.tool-section h4 {
  margin: 0;
  font-size: 14px;
}

.tool-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tool-row {
  justify-content: space-between;
  gap: 10px;
}

.tool-row > div {
  min-width: 0;
}

.tool-row strong,
.device-row strong,
.provider-row strong,
.history-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-row span,
.device-row span,
.provider-row span,
.history-row span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 26px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e8e2d7;
  transition: background 0.18s ease;
}

.toggle span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.toggle input:checked + span {
  background: var(--accent);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.device-row,
.provider-row,
.history-row,
.project-row,
.plan-row,
.knowledge-row,
.schedule-row,
.approval-row {
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.plan-list,
.timeline,
.action-list,
.audit-list {
  display: grid;
  gap: 8px;
}

.plan-row,
.schedule-row,
.approval-row {
  display: flex;
  align-items: center;
}

.plan-index {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
}

.plan-row.done .plan-index {
  color: var(--ok);
  background: var(--ok-bg);
}

.plan-row.pending {
  opacity: 0.78;
}

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

.insight-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.insight-card span,
.insight-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-card strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-row,
.audit-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-row:last-child,
.audit-row:last-child {
  border-bottom: 0;
}

.timeline-row > span,
.audit-row > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.timeline-row strong,
.audit-row strong {
  display: block;
  font-size: 13px;
}

.timeline-row p,
.audit-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-row.warn strong {
  color: var(--warn);
}

.timeline-row.value strong {
  color: var(--ok);
}

.suggested-prompt {
  padding: 11px;
  border: 1px solid rgba(12, 122, 107, 0.24);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.55;
}

.sync-alert {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.sync-alert strong {
  font-size: 13px;
}

.sync-alert span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sync-alert.ok {
  border-color: rgba(17, 131, 82, 0.24);
  background: var(--ok-bg);
}

.sync-alert.danger {
  border-color: rgba(180, 35, 24, 0.2);
  background: var(--danger-bg);
}

.action-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.action-item svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--ok);
  margin-top: 2px;
}

.knowledge-row {
  display: flex;
  align-items: flex-start;
}

.knowledge-row.disabled {
  opacity: 0.55;
}

.knowledge-row p,
.schedule-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.knowledge-form,
.schedule-form {
  display: grid;
  gap: 10px;
}

.device-icon,
.provider-icon,
.history-icon,
.project-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.device-icon svg,
.provider-icon svg,
.history-icon svg,
.project-icon svg {
  width: 16px;
  height: 16px;
}

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

.project-row {
  display: flex;
  align-items: flex-start;
}

.project-row p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.row-main {
  min-width: 0;
  flex: 1;
}

.status-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: #f0ebe2;
  font-size: 11px;
  font-weight: 800;
}

.status-badge.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.status-badge.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.status-badge.info {
  color: var(--info);
  background: var(--info-bg);
}

.status-badge.danger {
  color: var(--danger);
  background: var(--danger-bg);
}

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

.file-row {
  width: 100%;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.file-row.is-active {
  border-color: rgba(12, 122, 107, 0.42);
  background: var(--accent-soft);
}

.file-row code {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-stat {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diff-view,
.preview-frame,
.watch-face {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.diff-view {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: #e8f0e9;
  background: var(--code-bg);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.diff-add {
  color: #9bd8ae;
}

.diff-remove {
  color: #ffaaa0;
}

.commit-form,
.preview-form,
.voice-form,
.watch-form {
  display: grid;
  gap: 10px;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.preview-frame {
  min-height: 220px;
}

.preview-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 220px;
  background: #f8faf8;
}

.preview-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  background: #f2efe7;
}

.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c55f50;
}

.preview-dot:nth-child(2) {
  background: #d9a441;
}

.preview-dot:nth-child(3) {
  background: #4e9b70;
}

.preview-body {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 18px;
}

.preview-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #cad6cd;
  border-radius: 8px;
  background: #ffffff;
}

.preview-card h5,
.preview-card p {
  margin: 0;
}

.preview-card h5 {
  font-size: 15px;
}

.preview-card p {
  color: #5c665f;
  font-size: 12px;
}

.sparkline {
  height: 50px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 12%, rgba(12, 122, 107, 0.2) 12% 22%, transparent 22% 38%, rgba(195, 125, 20, 0.22) 38% 52%, transparent 52%),
    #edf4ef;
}

.token-link {
  display: block;
  overflow: hidden;
  padding: 9px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--info);
  background: var(--info-bg);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-face {
  display: grid;
  gap: 10px;
  width: min(100%, 220px);
  margin-inline: auto;
  padding: 14px;
  color: #ecf5ee;
  background: #101512;
}

.watch-face h4,
.watch-face p {
  margin: 0;
}

.watch-face h4 {
  font-size: 14px;
}

.watch-face p {
  color: #aebbb2;
  font-size: 12px;
}

.watch-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.dialog {
  width: min(640px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(31, 29, 25, 0.34);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: grid;
}

.dialog-header {
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 16px;
}

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

.dialog-actions {
  justify-content: flex-end;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

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

.toast {
  padding: 12px;
  border: 1px solid rgba(12, 122, 107, 0.26);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.toast span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

  .conversation-panel {
    min-height: 620px;
  }

  .inspector-panel {
    position: static;
    max-height: none;
  }

  .inspector-content {
    max-height: none;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .session-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .topbar,
  .prompt-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .quick-actions {
    width: 100%;
  }

  .provider-switch {
    flex: 1;
  }

  .provider-button {
    flex: 1;
  }

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

@media (max-width: 560px) {
  .sidebar,
  .console {
    padding: 14px;
  }

  .session-list,
  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .quick-actions,
  .control-cluster,
  .dialog-actions {
    flex-wrap: wrap;
  }

  .conversation-panel {
    grid-template-rows: auto auto minmax(320px, 1fr) auto;
    min-height: 560px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .message,
  .message.user {
    max-width: 100%;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .message.user .avatar,
  .message.user .bubble {
    grid-column: auto;
    grid-row: auto;
  }

  .avatar {
    width: 30px;
    height: 30px;
  }
}
