:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #1b2430;
  --muted: #667085;
  --line: #d8dee7;
  --accent: #126a5a;
  --accent-strong: #0d5347;
  --danger: #9f2d2d;
}

* {
  box-sizing: border-box;
}

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

.login {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(243, 245, 247, 0.96);
}

.login[hidden] {
  display: none;
}

.login-card {
  width: min(380px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.login-logo {
  display: block;
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin: 0 auto 14px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-row button {
  min-height: 38px;
  padding: 8px 10px;
}

.busy {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: rgba(243, 245, 247, 0.72);
  color: var(--text);
  font-weight: 700;
}

.busy[hidden] {
  display: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #cbd5e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(420px, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: 100vh;
}

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

header {
  margin-bottom: 16px;
}

.topline,
.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  opacity: 0.82;
  flex: 0 0 auto;
}

h2 {
  margin: 0;
  font-size: 16px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.recorder,
.actions,
.tabs,
.export-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.actions,
.export-actions {
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 38px;
}

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

button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #e5e9ef;
  color: #8a94a3;
}

.tab {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.check input {
  width: 18px;
  height: 18px;
}

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

.history {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.workspace-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  margin: 10px 0 14px;
}

.jobs {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin-top: 10px;
}

.job {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.job-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.job-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.job-actions button {
  min-height: 30px;
  padding: 4px 8px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 12px;
}

.badge.ok {
  color: var(--accent-strong);
  border-color: #8bc9bd;
  background: #eefaf7;
}

.status {
  white-space: pre-wrap;
  min-height: 44px;
  padding: 10px;
  border-radius: 6px;
  background: #f7f9fb;
  color: var(--muted);
  border: 1px solid var(--line);
}

.question {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.question.ignored {
  opacity: 0.55;
}

.question-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-weight: 700;
}

.ignore-btn {
  min-height: 30px;
  padding: 4px 8px;
  border-color: var(--line);
  background: #fff;
  color: var(--danger);
}

.ignore-btn:hover {
  background: #fff5f5;
}

.option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0;
  font-size: 14px;
  font-weight: 500;
}

.option input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.custom-option {
  margin-top: 10px;
}

.custom-answer {
  min-height: 64px;
  margin-top: 4px;
}

.output {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: calc(100vh - 32px);
}

.output textarea {
  min-height: 0;
  height: 100%;
  resize: none;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

@media (max-width: 960px) {
  .shell,
  .two {
    grid-template-columns: 1fr;
  }

  .output {
    min-height: 70vh;
  }
}
