:root {
  color-scheme: dark;
  --background: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--text);
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.brand {
  font-weight: 600;
}

#agent {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

#status {
  flex: 1;
  color: var(--muted);
}

button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
}

main {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

canvas {
  background: #000;
  outline: none;
  cursor: default;
}

canvas:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.panel {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.panel h1 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.panel p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.panel label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
}

.panel label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.panel input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

.panel input:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.panel button {
  width: 100%;
  padding: 8px 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel .error {
  min-height: 1.2em;
  margin-bottom: 12px;
  color: #f85149;
}

[hidden] {
  display: none !important;
}

body {
  grid-template-rows: auto auto 1fr;
}

#tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

#tabs .tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

#tabs .tab[aria-selected='true'] {
  background: var(--background);
  border-color: var(--border);
  color: var(--text);
}

#tabs .tab .close {
  padding: 0 4px;
  border: none;
  background: transparent;
  color: inherit;
}

#tabs .add {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--muted);
}

#terminals {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.terminal {
  width: 100%;
  height: 100%;
  padding: 8px;
  background: #0d1117;
}

#files {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  align-self: stretch;
  justify-self: stretch;
}

.files-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.files-path {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 120px;
}

.files-path .crumb {
  padding: 2px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.files-path .crumb:last-child {
  color: var(--text);
}

.files-path .crumb + .crumb::before {
  content: '/';
  margin-right: 8px;
  color: var(--border);
}

#files select,
#files input[type='text'] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

#files button:disabled {
  opacity: 0.4;
  cursor: default;
}

.files-folder {
  display: flex;
  gap: 8px;
}

.files-folder input {
  flex: 1;
  max-width: 320px;
}

.files-notice {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.files-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.files-progress .transfer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 14px;
}

.files-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.files-list th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}

.files-list td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface);
}

.files-list tr:hover td {
  background: var(--surface);
}

.files-list .number {
  color: var(--muted);
  white-space: nowrap;
}

.files-list .muted {
  color: var(--muted);
}

.files-list .entry-name {
  overflow-wrap: anywhere;
}

.files-list .directory {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  text-align: left;
}

.files-list .actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.files-empty {
  color: var(--muted);
  font-size: 14px;
}

#clipboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(720px, 100%);
  padding: 16px;
  align-self: start;
  justify-self: center;
}

.clipboard-intro,
.clipboard-notice {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.clipboard-notice {
  min-height: 1.2em;
}

.clipboard-text {
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.clipboard-text:focus-visible {
  border-color: var(--accent);
  outline: none;
}

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

#clipboard button:disabled {
  opacity: 0.4;
  cursor: default;
}

#tools {
  display: flex;
  gap: 8px;
}

#tools-notice {
  color: var(--muted);
  font-size: 13px;
}
