:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --panel: #ffffff;
  --line: #d7d3c8;
  --text: #191a17;
  --muted: #6d6b63;
  --accent: #276b52;
  --accent-strong: #19533e;
  --warn: #a05322;
  --fail: #9e2f2f;
  --shadow: 0 16px 48px rgba(31, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 42vw) minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.left-panel,
.right-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.left-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.right-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
}

.brand-row,
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-row {
  justify-content: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.2rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.brand-row p,
.history-header p,
.meta-line,
.params-line,
.form-message {
  color: var(--muted);
  font-size: 0.88rem;
}

.control-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field span,
.switch-row span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefb;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 270px;
  padding: 12px;
  line-height: 1.45;
}

input[type="text"],
input[type="number"] {
  height: 42px;
  padding: 0 11px;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 107, 82, 0.14);
}

.tuning-grid,
.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefb;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-button {
  height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-message {
  min-height: 20px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.status-pill.running {
  border-color: rgba(39, 107, 82, 0.35);
  color: var(--accent-strong);
  background: rgba(39, 107, 82, 0.08);
}

.status-pill.failed {
  border-color: rgba(158, 47, 47, 0.28);
  color: var(--fail);
  background: rgba(158, 47, 47, 0.08);
}

.active-job {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(39, 107, 82, 0.24);
  border-radius: 8px;
  background: rgba(39, 107, 82, 0.07);
  color: var(--accent-strong);
  font-size: 0.92rem;
}

.hidden {
  display: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  overflow: auto;
  padding-right: 2px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  padding: 13px;
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.history-title {
  min-width: 0;
  font-weight: 800;
}

.tag-line {
  color: var(--accent-strong);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.meta-line,
.params-line {
  margin-top: 4px;
}

audio {
  width: 100%;
  height: 38px;
  margin-top: 10px;
}

.lyrics-preview {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 72px;
  overflow: hidden;
}

.error-text {
  margin-top: 10px;
  color: var(--fail);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .left-panel,
  .right-panel {
    box-shadow: none;
  }
}

@media (max-width: 540px) {
  .tuning-grid,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .history-header,
  .history-top {
    align-items: flex-start;
    flex-direction: column;
  }
}
