:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5d6673;
  --line: #d8dde5;
  --accent: #1b6f5c;
  --accent-strong: #155848;
  --code: #10151c;
  --focus: rgba(27, 111, 92, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  cursor: pointer;
}

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

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

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: calc(100vh - 280px);
}

section {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

textarea {
  flex: 1;
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 0;
  padding: 14px;
  outline: none;
  color: var(--code);
  font: 14px/1.55 Consolas, "Cascadia Mono", "SFMono-Regular", monospace;
}

.files-panel {
  margin-top: 16px;
  min-height: 92px;
}

.file-list {
  display: grid;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}

.file-row:first-child {
  border-top: 0;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.file-state {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgba(23, 32, 42, 0.22);
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.toast.error {
  background: #a43f3f;
}

@media (max-width: 820px) {
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .file-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .file-name {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .toast {
    bottom: 16px;
  }
}
