:root {
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #132033;
  --muted: #627087;
  --line: rgba(48, 72, 102, 0.12);
  --accent: #1769e0;
  --accent-2: #0f766e;
  --ok: #1f7a44;
  --warn: #9f5a10;
  --error: #a12626;
  --shadow: 0 18px 48px rgba(26, 43, 67, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(23, 105, 224, 0.08), transparent 28%),
    radial-gradient(circle at right 20%, rgba(15, 118, 110, 0.08), transparent 24%),
    linear-gradient(180deg, #f5f8fb, #edf2f8 42%, #e6edf6);
  min-height: 100vh;
}

.page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.02;
}

.hero-text {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.hero-main {
  min-width: 0;
}

.header-settings {
  min-width: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.header-settings summary {
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.header-settings summary::-webkit-details-marker {
  display: none;
}

.header-settings-body {
  padding: 0 16px 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 12px;
  z-index: 5;
}

.tab-button {
  width: auto;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(119, 101, 88, 0.08);
  color: var(--muted);
}

.tab-button.active {
  background: linear-gradient(135deg, #1b5fd1, #0f7ae5 58%, #3297ff);
  color: #f8fbff;
  box-shadow: 0 8px 20px rgba(23, 105, 224, 0.18);
}

.tab-pane {
  display: none;
  gap: 18px;
}

.tab-pane.active {
  display: grid;
}

.workspace-pane.active {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

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

.chips,
.inline-actions,
.asset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mapping-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mapping-toggle {
  margin-top: 30px;
}

.dashboard-card {
  padding: 18px;
}

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

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.88));
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
}

.metric-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.compact-card {
  padding: 16px;
}

.workspace-card-wide {
  grid-column: 1 / -1;
}

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

.compact-head {
  margin-bottom: 12px;
}

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

.field,
.checkbox {
  display: block;
  margin-bottom: 14px;
}

.compact-field {
  margin-bottom: 12px;
}

.field span,
.checkbox span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

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

.select-option {
  margin-bottom: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.select-option.is-selected {
  border-color: rgba(23, 105, 224, 0.38);
  background: rgba(232, 242, 255, 0.95);
  box-shadow: 0 10px 24px rgba(23, 105, 224, 0.12);
}

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

input[type="text"],
input[type="password"],
select,
input[type="file"],
textarea,
button {
  width: 100%;
  font: inherit;
}

input[type="text"],
input[type="password"],
select,
input[type="file"],
textarea {
  padding: 12px 14px;
  border: 1px solid rgba(77, 49, 26, 0.18);
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--ink);
}

.server-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(160px, 0.8fr) auto auto;
  gap: 10px;
  align-items: center;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1b5fd1, #0f7ae5 58%, #3297ff);
  color: #f8fbff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(23, 105, 224, 0.18);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(23, 105, 224, 0.24);
}

button.secondary {
  width: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 244, 251, 0.96));
  color: #1d4f91;
  border: 1px solid rgba(33, 91, 82, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

button.is-selected,
button.secondary.is-selected {
  background: linear-gradient(135deg, #1b5fd1, #0f7ae5 58%, #3297ff);
  color: #f8fbff;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(23, 105, 224, 0.2);
}

.mini-button {
  width: auto;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: none;
}

.chip {
  width: auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(33, 91, 82, 0.1);
  color: var(--accent-2);
}

.status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.status.muted {
  background: rgba(119, 101, 88, 0.08);
  color: var(--muted);
}

.status.running {
  background: rgba(159, 90, 16, 0.1);
  color: var(--warn);
}

.status.success {
  background: rgba(31, 122, 68, 0.11);
  color: var(--ok);
}

.status.error {
  background: rgba(161, 38, 38, 0.1);
  color: var(--error);
}

.compact-workspace-status {
  margin-top: 12px;
}

.compact-status {
  margin-top: 0;
  padding: 7px 10px;
  border-radius: 999px;
  width: auto;
  line-height: 1.4;
  font-size: 13px;
}

.result {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.media-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.9);
}

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

.media-head a {
  color: var(--accent-2);
  text-decoration: none;
}

audio,
video {
  width: 100%;
  display: block;
}

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.script-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.script-table th,
.script-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.script-table th {
  position: sticky;
  top: 0;
  background: #f3f7fc;
  z-index: 1;
}

.dialogue-cell {
  min-width: 360px;
  line-height: 1.6;
}

.asset-item {
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.9);
}

.asset-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.single-picker-actions {
  margin-bottom: 12px;
}

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 42, 0.42);
  backdrop-filter: blur(6px);
}

.picker-panel {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: min(78vh, 820px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 64px rgba(10, 24, 48, 0.24);
}

.picker-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.picker-option {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.96);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.picker-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(23, 105, 224, 0.12);
}

.picker-option strong,
.picker-option span {
  display: block;
}

.picker-option span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.batch-log {
  margin-top: 16px;
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.9);
  line-height: 1.7;
  white-space: pre-wrap;
}

.path-link {
  color: var(--accent-2);
  text-decoration: none;
  word-break: break-all;
}

.path-link:hover {
  text-decoration: underline;
}

.mapping-cell {
  min-width: 240px;
}

.mapping-title {
  font-weight: 700;
}

.mapping-subtitle {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.mapping-select {
  min-width: 260px;
}

.status-stack {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.status-chip.ok {
  background: rgba(31, 122, 68, 0.11);
  color: var(--ok);
}

.status-chip.warn {
  background: rgba(159, 90, 16, 0.1);
  color: var(--warn);
}

.status-chip.miss {
  background: rgba(161, 38, 38, 0.1);
  color: var(--error);
}

.hidden {
  display: none;
}

.muted {
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero,
  .workspace-pane.active,
  .grid,
  .row,
  .dashboard-grid,
  .mapping-list {
    grid-template-columns: 1fr;
  }

  .server-toolbar {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .header-settings {
    min-width: 0;
    width: 100%;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
