:root {
  --bg: #f4efe6;
  --panel: #fffdf8;
  --ink: #1f2430;
  --accent: #0f766e;
  --accent-2: #115e59;
  --danger: #b42318;
  --muted: #6b7280;
  --border: #d6d3d1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f3eb, #eef2f7);
  min-height: 100vh;
}

.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.topbar-actions,
.action-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

.sidebar,
.card {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(214, 211, 209, 0.85);
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.sidebar {
  padding: 14px;
  min-height: 70vh;
}

.workspace {
  display: grid;
  gap: 18px;
}

.card {
  padding: 16px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.asset-form-row {
  grid-template-columns: 0.8fr 1.2fr;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.script-list,
.version-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.script-item,
.version-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.script-item.is-active,
.version-item.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.script-item-header,
.version-item-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.script-name,
.version-name {
  font-weight: 700;
}

.script-meta,
.version-meta,
.version-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  font-size: 0.82rem;
  color: var(--muted);
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

textarea {
  min-height: 420px;
  resize: vertical;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.editor-label {
  margin-bottom: 12px;
}

.output-panel {
  min-height: 280px;
  max-height: 600px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #dbeafe;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
}

.asset-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

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

.asset-preview {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(214, 211, 209, 0.9);
  background: #f8fafc;
  overflow: hidden;
}

.asset-preview-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: repeating-linear-gradient(45deg, #edf2f7, #edf2f7 10px, #e2e8f0 10px, #e2e8f0 20px);
}

.asset-preview-audio {
  width: 100%;
  display: block;
}

.asset-preview-fallback {
  padding: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.asset-item-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.asset-path {
  font-weight: 700;
  word-break: break-word;
}

.asset-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.status-bar {
  margin-top: 12px;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.82rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  color: var(--accent-2);
  background: rgba(15, 118, 110, 0.08);
}

.btn,
.link-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font: inherit;
}

.btn:hover,
.link-btn:hover {
  background: var(--accent-2);
}

.btn-secondary {
  background: #fff;
  color: var(--accent-2);
}

.btn-secondary:hover {
  background: rgba(15, 118, 110, 0.08);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #8a1c13;
}

.link-btn {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
}

.link-btn:hover {
  background: transparent;
  color: var(--accent);
}

.item-actions,
.version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.small {
  font-size: 0.8rem;
}

@media (max-width: 1080px) {
  .layout,
  .grid-two,
  .form-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }
}
