:root {
  color-scheme: light;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ea;
  --soft: #f8fafc;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f5;
  color: var(--ink);
  font-family: Arial, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

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

.tab-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
}

.tab-btn {
  background: #d8e8e5;
  color: #134e4a;
}

.tab-btn.active {
  background: var(--brand);
  color: #fff;
}

.secondary-btn {
  background: #475569;
}

.danger-btn {
  background: #dc2626;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.panel-body {
  padding: 16px;
}

.editor {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  resize: vertical;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat b {
  display: block;
  color: var(--brand);
  font-size: 24px;
  margin-bottom: 4px;
}

.log-list {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.log-item textarea {
  width: 100%;
  min-height: 82px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  resize: vertical;
}

.learn-output {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.suggestion {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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