:root {
  color-scheme: dark;
  --bg: #1e1e1e;
  --bg-soft: #252526;
  --bg-panel: #181818;
  --bg-editor: #1f1f1f;
  --bg-active: #37373d;
  --border: #2d2d30;
  --border-strong: #3c3c3c;
  --text: #d4d4d4;
  --text-muted: #969696;
  --text-subtle: #6f6f6f;
  --accent: #007acc;
  --accent-soft: #094771;
  --green: #89d185;
  --yellow: #dcdcaa;
  --red: #f48771;
  --shadow: 0 12px 38px rgba(0, 0, 0, 0.28);
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  width: 100%;
  height: 100%;
  min-width: 1120px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

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

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(780px, 1fr);
  grid-template-rows: 54px 1fr;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

.app-shell.entry-locked {
  display: none;
}

.global-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 16px;
  background: #202020;
  border-bottom: 1px solid var(--border);
}

.viewport-guard {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  background: #181818;
  color: var(--text);
  text-align: center;
}

.viewport-guard strong {
  font-size: 22px;
  font-weight: 600;
}

.viewport-guard span {
  max-width: 360px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.entry-screen {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #181818;
}

.entry-screen.hidden {
  display: none;
}

.entry-card {
  width: min(560px, 100%);
  border: 1px solid var(--border-strong);
  background: #252526;
  box-shadow: var(--shadow);
}

.entry-card header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.entry-card h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
}

.entry-notes {
  padding: 22px 28px 6px;
}

.entry-notes strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.entry-notes ul {
  margin: 0;
  padding-left: 18px;
}

.entry-notes ul ul {
  margin-top: 8px;
  padding-left: 20px;
}

.entry-notes li {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.entry-notes li li {
  color: var(--text-subtle);
}

.entry-field {
  display: grid;
  gap: 8px;
  padding: 12px 28px 18px;
}

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

.entry-field input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  outline: 0;
  background: #1b1b1b;
  color: var(--text);
}

.entry-field input:focus {
  border-color: var(--accent);
}

.entry-start-button {
  width: calc(100% - 56px);
  margin: 0 28px 26px;
}

.entry-error {
  min-height: 18px;
  margin: -14px 28px 24px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.completion-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  background: #181818;
  color: var(--text);
  text-align: center;
}

.completion-screen.hidden {
  display: none;
}

.completion-screen strong {
  font-size: 22px;
  font-weight: 600;
}

.completion-screen span {
  max-width: 360px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
}

.modal-backdrop.hidden {
  display: none;
}

.confirm-modal {
  width: min(420px, 100%);
  border: 1px solid var(--border-strong);
  background: #252526;
  box-shadow: var(--shadow);
}

.confirm-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.confirm-modal h2 {
  font-size: 15px;
  font-weight: 600;
}

.confirm-modal header span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.confirm-modal p {
  padding: 16px 18px 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.modal-warning {
  margin: 0 18px 16px;
  padding: 10px 12px;
  border-left: 2px solid var(--yellow);
  background: #1f1f1f;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}

.confirm-modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}

.side-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-column: 1;
  grid-row: 2;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow: hidden;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  font-weight: 600;
}

.step-panel {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #202020;
}

.step-panel span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.step-panel strong {
  font-size: 14px;
  font-weight: 600;
}

.step-panel small {
  color: var(--text-muted);
  font-size: 12px;
}

.side-file-panel {
  display: grid;
  grid-template-rows: 36px 1fr;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

.workspace {
  display: grid;
  grid-template-rows: 1fr;
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  background: var(--bg);
  overflow: hidden;
}

.workspace.no-terminal {
  grid-template-rows: 1fr;
}

.workspace.no-terminal .terminal-panel {
  display: none;
}

.title-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.topbar-timer {
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.ghost-button,
.primary-button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: #2d2d2d;
  color: var(--text);
  font-size: 12px;
}

.ghost-button:hover {
  background: #383838;
}

.primary-button {
  border-color: #0e639c;
  background: #0e639c;
}

.primary-button:hover {
  background: #1177bb;
}

.ghost-button:disabled,
.primary-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.small {
  height: 26px;
  padding: 0 10px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 60%) minmax(360px, 40%);
  min-height: 0;
  overflow: hidden;
}

.editor-column {
  display: grid;
  grid-template-rows: 36px minmax(0, 7fr) minmax(0, 3fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.workspace.no-terminal .editor-column {
  grid-template-rows: 36px minmax(0, 1fr);
}

.editor-tabs-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  min-width: 0;
  background: #252526;
  border-bottom: 1px solid var(--border);
}

.tab-strip {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-strip::-webkit-scrollbar {
  display: none;
}

.save-tab-button {
  align-self: center;
  margin: 0 8px;
}

.save-status {
  color: var(--text-subtle);
  font-size: 12px;
  white-space: nowrap;
}

.save-status {
  margin-left: 12px;
}

.editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 148px;
  max-width: 220px;
  height: 36px;
  padding: 0 12px;
  border-right: 1px solid var(--border);
  background: #2d2d2d;
  color: var(--text-muted);
  text-align: left;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-tab.active {
  background: var(--bg-editor);
  color: var(--text);
}

.tab-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-dirty {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}

.tab-close {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  background: transparent;
  border: 0;
  font-size: 15px;
  line-height: 1;
}

.tab-close:hover {
  background: #3d3d3d;
  color: var(--text);
}

.editor-surface {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  min-height: 0;
  background: var(--bg-editor);
  overflow: hidden;
}

.line-numbers {
  padding: 14px 12px 14px 0;
  color: #858585;
  text-align: right;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
  user-select: none;
  border-right: 1px solid #262626;
  overflow: hidden;
}

.editor-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--bg-editor);
  overflow: hidden;
}

#editor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 14px 18px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  overflow: auto;
  tab-size: 2;
  -webkit-text-fill-color: transparent;
}

#editor::selection {
  background: #264f78;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

#editor::-moz-selection {
  background: #264f78;
  color: #ffffff;
}

.editor-highlight {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 14px 18px;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  pointer-events: none;
  overflow: hidden;
}

.token-keyword {
  color: #569cd6;
}

.token-type,
.token-literal {
  color: #4ec9b0;
}

.token-string {
  color: #ce9178;
}

.token-number {
  color: #b5cea8;
}

.token-comment {
  color: #6a9955;
}

.token-function {
  color: #dcdcaa;
}

.token-emphasis {
  color: #dcdcaa;
}

.token-property {
  color: #9cdcfe;
}

.token-markup {
  color: #569cd6;
}

.wrap-toggle {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  background: rgba(45, 45, 45, 0.92);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.wrap-toggle:hover {
  background: #383838;
  color: var(--text);
}

.wrap-toggle:has(input:checked) {
  border-color: #0e639c;
  color: var(--text);
}

.wrap-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #0e639c;
  pointer-events: auto;
}

.assistant-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  background: var(--bg-soft);
  overflow: hidden;
}

.panel-card {
  display: grid;
  grid-template-rows: 36px 1fr auto;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

.agent-card {
  border-bottom: 0;
}

.agent-card .panel-header h2 {
  text-transform: none;
}

.prompt-test-card {
  border-bottom: 0;
}

.test-chat-log {
  min-height: 0;
  padding: 8px 22px 18px;
  overflow: auto;
}

.test-hint {
  margin: 8px auto 18px;
  width: 100%;
  max-width: 520px;
  color: var(--text-subtle);
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
}

.test-message,
.agent-message {
  display: flex;
  margin-bottom: 12px;
}

.agent-event {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid #383838;
  background: #202020;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.55;
}

.agent-event.thinking {
  border-color: #3f3f3f;
  background: #1e1e1e;
  color: #8f8f8f;
}

.agent-event.tool {
  border-color: #29435a;
  background: #18222a;
}

.agent-event.approval {
  border-color: #6b4a1f;
  background: #2a2118;
}

.agent-event.files {
  border-color: #28523a;
  background: #18251d;
}

.agent-event.file_edit {
  border-color: #28523a;
  background: #18251d;
}

.agent-event.command {
  border-color: #3f3f3f;
  background: #1b1b1b;
}

.agent-event.collapsible {
  cursor: pointer;
}

.agent-event.collapsible.collapsed {
  padding: 7px 9px;
}

.agent-event.compact.collapsed {
  margin: 0 0 4px;
  padding: 2px 4px;
  border-color: transparent;
  background: transparent;
  color: #8d8d8d;
  font-size: 10px;
  line-height: 1.4;
}

.agent-event.compact.collapsed:hover {
  background: #242424;
}

.agent-event-header {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.agent-event-toggle {
  width: 5px;
  height: 5px;
  border-right: 1px solid #8d8d8d;
  border-bottom: 1px solid #8d8d8d;
  transform: rotate(-45deg);
  flex: 0 0 auto;
  margin-left: 1px;
}

.agent-event.expanded .agent-event-toggle {
  transform: rotate(45deg);
  margin-top: -3px;
}

.agent-event-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.agent-event-title {
  color: var(--text);
  font-weight: 600;
  flex: 0 0 auto;
  white-space: nowrap;
}

.agent-event.compact.collapsed .agent-event-title {
  color: #8d8d8d;
  font-weight: 500;
}

.agent-event-preview {
  color: #9d9d9d;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-plus {
  color: #72c484;
}

.diff-minus {
  color: #e06c75;
}

.diff-neutral {
  color: #8d8d8d;
}

.agent-event-file {
  margin-top: 3px;
  color: #7fb6f1;
  font-size: 10px;
  word-break: break-all;
}

.agent-event-content {
  margin-top: 4px;
}

.agent-event-summary {
  margin: 6px 0 0;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #bdbdbd;
  font: inherit;
}

.agent-event-summary.diff-view {
  padding: 6px 0;
  background: #161616;
  border: 1px solid #303030;
}

.diff-line {
  display: block;
  padding: 0 8px;
  min-height: 1.45em;
  white-space: pre-wrap;
}

.diff-line.added {
  color: #b9f6c4;
  background: rgba(46, 160, 67, 0.18);
}

.diff-line.removed {
  color: #ffb8bf;
  background: rgba(248, 81, 73, 0.18);
}

.diff-line.header {
  color: #7fb6f1;
  background: rgba(31, 111, 235, 0.14);
}

.diff-line.file {
  color: #9d9d9d;
}

.agent-event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.agent-event-state {
  min-width: 54px;
  color: #c9c9c9;
  font-size: 10px;
}

.agent-event-action {
  height: 26px;
  padding: 0 12px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a2a;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.agent-event-action.primary {
  border-color: #1177bb;
  background: #0e639c;
  color: #fff;
}

.agent-event-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.test-bubble,
.agent-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #202020;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.test-message.user,
.agent-message.user {
  justify-content: flex-end;
}

.test-message.user .test-bubble,
.agent-message.user .agent-bubble {
  border-color: #315f7d;
  background: #1d2a33;
  color: var(--text);
}

.test-message.assistant,
.agent-message.assistant {
  justify-content: flex-start;
}

.test-message.assistant .test-bubble,
.agent-message.assistant .agent-bubble {
  border-color: #3c3c3c;
}

.test-chat-input {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  margin: 10px 12px 12px;
  padding: 10px 52px 8px 14px;
  border-top: 1px solid var(--border);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #242424;
}

.composer-status {
  display: none;
  margin: 8px 16px 0;
  color: #d89532;
  font-size: 12px;
  font-weight: 600;
}

.composer-status.visible {
  display: block;
}

.test-chat-input textarea {
  grid-column: 1;
  grid-row: 1;
  height: 48px;
  min-width: 0;
  padding: 3px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.composer-hint {
  grid-column: 1 / -1;
  color: var(--text-subtle);
  font-size: 11px;
}

.icon-send-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f1f1;
  color: #111;
}

.icon-send-button:hover {
  background: #ffffff;
}

.icon-send-button::before {
  content: "↑";
  color: #111;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-1px);
}

.icon-send-button.is-running::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #111;
  border-radius: 2px;
  transform: none;
}

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

.panel-header h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.panel-header span {
  color: var(--text-subtle);
  font-size: 11px;
}

.reset-chat-button {
  height: 24px;
  padding: 0 9px;
  border: 1px solid #8a5a1f;
  background: #3a2a16;
  color: #f0a64a;
  font-size: 12px;
}

.reset-chat-button:hover {
  background: #4a3419;
  color: #ffc06a;
}

.file-tree {
  padding: 8px 0;
  overflow: auto;
}

.file-item {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  height: 28px;
  padding: 0 12px 0 16px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font-size: 12px;
}

.file-item:hover,
.file-item.active {
  background: var(--bg-active);
  color: var(--text);
}

.file-icon {
  width: 34px;
  flex: 0 0 34px;
  color: var(--yellow);
  font-size: 11px;
  letter-spacing: 0;
}

select,
.agent-input textarea,
.terminal-input input {
  min-width: 0;
  border: 1px solid var(--border-strong);
  outline: 0;
  background: #1b1b1b;
  color: var(--text);
}

select {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.agent-log {
  min-height: 0;
  padding: 8px 22px 18px;
  overflow: auto;
}

.agent-input {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  margin: 10px 12px 12px;
  padding: 12px 52px 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #242424;
}

.agent-card {
  position: relative;
}

.agent-approval-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 82px;
  z-index: 8;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #8c6328;
  background: #251d13;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.agent-approval-overlay.hidden {
  display: none;
}

.agent-approval-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.agent-approval-reason {
  display: none;
  color: #c9a56a;
  font-size: 11px;
  line-height: 1.5;
}

.agent-approval-reason.visible {
  display: block;
}

.agent-approval-summary {
  max-height: 140px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid #47341b;
  background: #1a1712;
  color: #c9c9c9;
  font: 11px/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-approval-buttons {
  display: grid;
  gap: 8px;
  justify-self: center;
  width: 60%;
}

.agent-approval-button {
  height: 34px;
  border: 1px solid #555;
  background: #2e2e2e;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.agent-approval-button.primary {
  border-color: #0e639c;
  background: #0e639c;
  color: #fff;
}

.agent-input textarea {
  height: 54px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.agent-input-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 8px;
}

.agent-input-hint {
  min-width: 0;
  color: var(--text-subtle);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.permission-picker {
  position: relative;
  width: fit-content;
  flex: 0 0 auto;
}

.permission-trigger {
  display: grid;
  grid-template-columns: 1fr 10px;
  align-items: center;
  gap: 6px;
  width: 118px;
  height: 30px;
  padding: 0 10px 0 12px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: #303030;
  color: #58a6ff;
  font-size: 12px;
}

.permission-trigger:hover,
.permission-trigger[aria-expanded="true"] {
  background: #383838;
}

.permission-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #58a6ff;
  border-bottom: 2px solid #58a6ff;
  transform: translateY(-2px) rotate(45deg);
}

.permission-menu {
  position: absolute;
  left: 0;
  bottom: 36px;
  z-index: 10;
  width: 260px;
  padding: 7px;
  border: 1px solid #444;
  border-radius: 12px;
  background: #262626;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.permission-menu.hidden {
  display: none;
}

.permission-option {
  display: grid;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.permission-option:hover {
  background: #303030;
}

.permission-option.active {
  border-color: #2f81f7;
  background: rgba(47, 129, 247, 0.18);
}

.permission-option.active strong {
  color: #79b8ff;
}

.permission-option.active small {
  color: #b8d7ff;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option strong {
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
}

.permission-option small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.terminal-panel {
  display: grid;
  grid-template-rows: 34px 1fr 34px;
  min-height: 0;
  background: #111;
  border-top: 1px solid var(--border);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #1b1b1b;
  border-bottom: 1px solid var(--border);
}

.terminal-tab {
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
}

.terminal-tab.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

#terminalOutput {
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  color: #cccccc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.terminal-input {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-top: 1px solid #242424;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.terminal-input input {
  height: 26px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
}

.terminal-stop-button {
  display: none;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #5a3030;
  background: #2a1b1b;
  color: #e6a3a3;
  font-size: 11px;
  cursor: pointer;
}

.terminal-input.running .terminal-stop-button {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 1180px) {
  body {
    min-width: 980px;
  }

  .app-shell {
    grid-template-columns: 250px minmax(680px, 1fr);
  }

  .content-grid {
    grid-template-columns: minmax(0, 60%) minmax(320px, 40%);
  }
}

@media (max-aspect-ratio: 1/1) {
  body {
    min-width: 0;
  }

  .app-shell {
    visibility: hidden;
  }

  .viewport-guard {
    display: grid;
  }
}
