:root {
  --bg: #efe8dd;
  --panel: rgba(255, 251, 244, 0.84);
  --panel-strong: #fff8ef;
  --text: #1c1712;
  --muted: #71675d;
  --line: rgba(28, 23, 18, 0.1);
  --shadow: 0 18px 50px rgba(28, 23, 18, 0.08);
  --blue: #2456d3;
  --blue-soft: #dce6ff;
  --sand: #f5eee2;
  --story: rgba(36, 86, 211, 0.26);
  --chat: rgba(255, 146, 59, 0.24);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(36, 86, 211, 0.14), transparent 25%),
    radial-gradient(circle at bottom left, rgba(255, 190, 90, 0.12), transparent 20%),
    linear-gradient(180deg, #f7f1e6 0%, #efe8dd 100%);
  overflow: hidden;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 23, 18, 0.32);
  backdrop-filter: blur(8px);
}

.auth-panel {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.auth-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 249, 240, 0.75);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar h1,
.workspace h2,
.workspace h3,
.workspace h4 {
  margin: 0;
}

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

.settings-group {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.nav { display: grid; gap: 8px; }

.nav-item,
.primary,
.ghost {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.nav-item {
  text-align: left;
  background: transparent;
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
}

.nav-item.active {
  background: var(--blue);
  color: white;
}

.status-pill {
  margin-top: auto;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 999px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.sidebar-logout {
  width: 100%;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a0a7b3;
}

.dot.online { background: #259b57; }

.workspace {
  padding: 26px;
  height: 100vh;
  overflow-y: auto;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.metric-grid,
.two-col,
.editor-layout {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-grid-ops {
  margin-bottom: 8px;
}

.dashboard-ops-layout {
  margin-top: 8px;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.metric-list-row strong {
  font-size: 14px;
}

.metric-list-row span {
  color: var(--muted);
  font-size: 13px;
}

.model-pricing-row {
  align-items: flex-start;
}

.inline-field-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-field-group label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  font-size: 12px;
  color: var(--muted);
}

.inline-field-group input {
  min-width: 180px;
}

.trend-table-wrap {
  overflow-x: auto;
}

.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.trend-table th,
.trend-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.trend-table th {
  color: var(--muted);
  font-weight: 600;
}

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

.editor-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  align-items: start;
}

.editor-layout > .sticky-panel {
  width: min(100%, 420px);
  justify-self: end;
}

.editor-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.metric { padding: 18px; }
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.metric strong { font-size: 26px; }

.stack,
.inspector,
.preview-panel,
.settings-panel {
  padding: 18px;
}

.stack > h3 { margin-bottom: 8px; }

.inspector,
.settings-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.sticky-panel {
  position: sticky;
  top: 26px;
  align-self: start;
}

.inspector label,
.demo-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.rule-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(36, 86, 211, 0.08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

textarea {
  resize: vertical;
}

.primary,
.ghost {
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
}

.primary {
  background: var(--blue);
  color: white;
}

.ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid rgba(36, 86, 211, 0.18);
}

.ghost.active {
  background: rgba(36, 86, 211, 0.12);
}

.preview-top { margin-bottom: 14px; }

.phone-shell {
  width: min(100%, 380px);
  margin: 0 auto;
  padding: 18px;
  border-radius: 36px;
  background: #111;
}

.preview-canvas {
  position: relative;
  aspect-ratio: 9 / 19.5;
  min-height: 680px;
  border-radius: 28px;
  overflow: hidden;
  background: #f6f1e8;
  --preview-nav-anchor: 48px;
}

.preview-background-image {
  position: absolute;
  left: 0;
  width: 100%;
  height: auto;
  bottom: var(--preview-nav-anchor);
  z-index: 0;
  display: none;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1;
}

.preview-today-companion {
  position: absolute;
  z-index: 2;
  display: none;
  border-radius: 28px;
  background: transparent;
  overflow: hidden;
  border: 0;
}

.preview-today-image {
  position: absolute;
  object-fit: cover;
  border-radius: 18px;
}

.preview-today-title,
.preview-today-summary,
.preview-today-button {
  position: absolute;
  z-index: 1;
}

.preview-today-title {
  color: #6b4f42;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.preview-today-summary {
  color: #8d7462;
  font-size: 12px;
  line-height: 1.45;
}

.preview-today-button {
  object-fit: contain;
  border-radius: 999px;
}

.preview-role-story {
  position: absolute;
  z-index: 2;
  display: none;
  background: transparent;
  overflow: visible;
}

.preview-role-avatar,
.preview-role-image,
.preview-role-prompt,
.preview-role-summary {
  position: absolute;
  z-index: 1;
  transform-origin: center center;
}

.preview-role-avatar {
  object-fit: cover;
  border-radius: 999px;
}

.preview-role-image {
  object-fit: cover;
  border-radius: 8px;
}

.preview-role-prompt {
  background: transparent;
  color: #6b4f42;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-line;
}

.preview-role-summary {
  color: #6b4f42;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
  white-space: pre-line;
}

.today-edit-box {
  position: absolute;
  border-radius: 14px;
  border: 2px dashed transparent;
  pointer-events: none;
  z-index: 3;
}

.today-edit-box.image {
  border-color: rgba(67, 116, 240, 0.75);
  background: rgba(67, 116, 240, 0.12);
}

.today-edit-box.title {
  border-color: rgba(159, 103, 59, 0.8);
  background: rgba(159, 103, 59, 0.12);
}

.today-edit-box.summary {
  border-color: rgba(99, 122, 87, 0.8);
  background: rgba(99, 122, 87, 0.12);
}

.today-edit-box.button {
  border-color: rgba(208, 141, 54, 0.9);
  background: rgba(208, 141, 54, 0.14);
}

.role-edit-box {
  position: absolute;
  border-radius: 14px;
  border: 2px dashed transparent;
  pointer-events: none;
  z-index: 3;
}

.role-edit-box.module {
  border-color: rgba(109, 83, 66, 0.6);
  background: rgba(109, 83, 66, 0.06);
}

.role-edit-box.avatar {
  border-color: rgba(67, 116, 240, 0.75);
  background: rgba(67, 116, 240, 0.12);
}

.role-edit-box.prompt {
  border-color: rgba(159, 103, 59, 0.8);
  background: rgba(159, 103, 59, 0.12);
}

.role-edit-box.image {
  border-color: rgba(99, 122, 87, 0.8);
  background: rgba(99, 122, 87, 0.12);
}

.role-edit-box.summary {
  border-color: rgba(208, 141, 54, 0.9);
  background: rgba(208, 141, 54, 0.14);
}

.preview-sticky-note {
  position: absolute;
  z-index: 2;
  display: none;
  background: transparent;
  border-radius: 12px;
  box-shadow: none;
  overflow: visible;
}

.preview-sticky-note-text {
  position: absolute;
  inset: 0;
  background: transparent;
  color: #735641;
  line-height: 1.35;
  white-space: pre-line;
  padding: 14px 16px;
  box-sizing: border-box;
  transform-origin: center center;
}

.note-edit-box {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 2px dashed rgba(171, 124, 39, 0.9);
  background: rgba(226, 196, 110, 0.14);
  pointer-events: none;
  z-index: 3;
}

.preview-today-record-button {
  position: absolute;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(146, 109, 78, 0.55);
  border-radius: 999px;
  background: transparent;
  color: #5c4638;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(72, 50, 34, 0.16);
}

.preview-today-record-button.is-active {
  background: transparent;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2ebf62;
  box-shadow: 0 0 0 0 rgba(46, 191, 98, 0.55);
  animation: record-breathe 1.4s ease-out infinite;
}

@keyframes record-breathe {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 191, 98, 0.58);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(46, 191, 98, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 191, 98, 0);
  }
}

.record-edit-box {
  position: absolute;
  border: 2px dashed rgba(84, 144, 74, 0.9);
  border-radius: 999px;
  background: rgba(84, 144, 74, 0.12);
  pointer-events: none;
  z-index: 3;
}

.record-dot-edit-box {
  border-color: rgba(46, 191, 98, 0.95);
  background: rgba(46, 191, 98, 0.15);
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.preview-bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
}

.preview-bottom-nav img {
  display: block;
  width: 100%;
  height: auto;
}

.chat-preview-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(248, 248, 248, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 2;
}

.chat-preview-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.chat-preview-avatar,
.chat-preview-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  background: #d8d8d8;
}

.chat-preview-messages {
  position: absolute;
  top: 58px;
  left: 0;
  right: 0;
  bottom: 64px;
  overflow: auto;
  padding: 14px 12px;
  display: grid;
  gap: 10px;
  z-index: 2;
}

.chat-preview-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.chat-preview-row.me {
  justify-content: flex-end;
}

.chat-preview-bubble {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 13px;
  white-space: pre-wrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.chat-preview-bubble.role {
  background: white;
  color: #1c1c1c;
}

.chat-preview-bubble.me {
  background: #95ec69;
  color: #1c1c1c;
}

.chat-preview-inputbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: rgba(247, 247, 247, 0.96);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  z-index: 2;
}

.chat-preview-input {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #8a8a8a;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
}

.chat-preview-send {
  border: 0;
  border-radius: 10px;
  background: #07c160;
  color: white;
  font-weight: 700;
  padding: 10px 14px;
}

.inspector-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.today-page-cards-layer,
.today-page-card-editor-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.today-page-card-editor-overlay {
  pointer-events: auto;
  background: transparent;
}

.today-page-card-item {
  position: absolute;
  cursor: pointer;
}

.today-page-card-bg,
.today-page-card-main-image,
.today-page-card-decoration,
.today-page-card-title-bg {
  position: absolute;
  overflow: hidden;
}

.today-page-card-bg img,
.today-page-card-main-image img,
.today-page-card-decoration img,
.today-page-card-title-bg img {
  width: 100%;
  height: 100%;
  display: block;
}

.today-page-card-bg img,
.today-page-card-decoration img,
.today-page-card-title-bg img {
  object-fit: contain;
}

.today-page-card-main-image img {
  object-fit: cover;
}

.today-page-card-main-image video,
.selected-asset video,
.asset-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  background: #f7f4ed;
}

.video-placeholder,
.today-page-card-video-placeholder,
.preview-dialog-video-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(34, 34, 34, 0.9), rgba(56, 56, 56, 0.9));
  color: #fff7ef;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.video-placeholder,
.today-page-card-video-placeholder {
  border-radius: 12px;
}

.preview-dialog-video-placeholder {
  border-radius: 18px;
}

.video-thumb-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #f7f4ed;
}

.video-thumb-shell.dialog {
  border-radius: 18px;
}

.video-thumb-shell img,
.video-thumb-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #f7f4ed;
}

.video-thumb-shell.dialog img,
.video-thumb-shell.dialog .video-thumb-fallback {
  object-fit: contain;
  background: #f7f4ed;
}

.video-thumb-fallback {
  display: grid;
  place-items: center;
  color: #665a4f;
  font-weight: 700;
}

.video-thumb-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.56);
  color: white;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.today-page-card-title,
.today-page-card-subtitle {
  position: absolute;
  color: #6b4f42;
  line-height: 1.25;
  overflow: hidden;
  white-space: pre-wrap;
}

.today-page-card-title {
  font-weight: 700;
}

.preview-dialog {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
}

.preview-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 8, 0.36);
}

.preview-dialog-card {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 22px;
  bottom: calc(var(--preview-nav-anchor) + 16px);
  border-radius: 24px;
  background: rgba(255, 250, 243, 0.98);
  border: 1px solid rgba(129, 98, 68, 0.18);
  box-shadow: 0 16px 40px rgba(43, 26, 17, 0.18);
  padding: 18px 18px 20px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  box-sizing: border-box;
}

.preview-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  cursor: pointer;
  font-size: 20px;
}

.preview-dialog-media {
  margin-top: 10px;
  border-radius: 18px;
  overflow: hidden;
  background: #f7f4ed;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

.preview-dialog-media img,
.preview-dialog-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #f7f4ed;
}

.preview-dialog-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  padding-right: 4px;
}

.preview-dialog-body h4 {
  margin: 0;
  color: #6b4f42;
  font-size: 26px;
}

.preview-dialog-subtitle {
  margin: 0;
  color: #8d7462;
  font-size: 15px;
}

.preview-dialog-story {
  color: #5f493c;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.role-story-page-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

#roleStoryPageEditorOverlay {
  z-index: 8;
}

.role-story-page-card {
  position: absolute;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid rgba(132, 100, 72, 0.18);
  box-shadow: 0 10px 24px rgba(56, 38, 26, 0.16);
  overflow: hidden;
}

.role-story-page-image-wrap {
  position: absolute;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(248, 244, 236, 0.88);
}

.role-story-page-image-wrap img,
.role-story-page-image-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.role-story-page-title {
  position: absolute;
  color: #6b4f42;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.role-story-page-text-wrap {
  position: absolute;
  color: #5f493c;
  line-height: 1.52;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
  box-sizing: border-box;
  padding-right: 2px;
}

.role-story-page-nav {
  position: absolute;
  border: 1px solid rgba(132, 100, 72, 0.3);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.96);
  color: #6b4f42;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(70, 48, 32, 0.12);
}

.role-story-page-nav img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.editable-box {
  position: absolute;
  border: 2px dashed rgba(36, 86, 211, 0.72);
  border-radius: 12px;
  background: rgba(36, 86, 211, 0.06);
  pointer-events: auto;
  touch-action: none;
  cursor: move;
}

.editable-box-module {
  border-color: rgba(18, 156, 90, 0.72);
  background: rgba(18, 156, 90, 0.06);
}

.editable-box.active {
  box-shadow: 0 0 0 2px rgba(36, 86, 211, 0.14);
}

.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #2456d3;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(36, 86, 211, 0.2);
}

.resize-handle.br {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.preset-card-table {
  display: grid;
  gap: 12px;
}

.preset-card-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  display: grid;
  gap: 10px;
}

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

.preset-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.asset-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.asset-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.asset-card img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f4ed;
  border: 1px solid var(--line);
}

.asset-card video {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f4ed;
  border: 1px solid var(--line);
}

.asset-card .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-link {
  display: grid;
  gap: 6px;
}

.asset-link input {
  font-size: 12px;
  color: var(--muted);
}

.selected-asset {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.selected-asset img {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f4ed;
  border: 1px solid var(--line);
}

.selected-asset video {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f4ed;
  border: 1px solid var(--line);
}

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

.feed { display: grid; gap: 10px; }

.entry {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px;
}

.entry .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-weight: 800;
}

.entry .meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.entry.check-ok { border-color: rgba(37, 155, 87, 0.18); }
.entry.check-missing {
  border-color: rgba(208, 114, 32, 0.22);
  background: rgba(255, 247, 234, 0.92);
}
.entry.check-optional { border-color: rgba(36, 86, 211, 0.14); }

.action-list { display: grid; gap: 8px; }
.toolbar-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.action-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.json-block {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

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

.streetview-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.streetview-card h4 {
  margin: 0;
  font-size: 14px;
}

.streetview-card img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.fold-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

.demo-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.inline-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

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

.calendar-pill {
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  user-select: none;
}

.calendar-pill-arrow {
  font-size: 12px !important;
}

.calendar-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.upload-status {
  margin-top: 4px;
  font-size: 13px;
}

.upload-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(36, 86, 211, 0.1);
  overflow: hidden;
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2456d3 0%, #5f8bff 100%);
  transition: width 120ms ease;
}

.row {
  display: grid;
  grid-auto-flow: column;
  justify-content: space-between;
  align-items: center;
}

.toggle-line {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.toggle-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

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

.nav-edit-stage {
  position: relative;
  width: 100%;
  min-height: 120px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px dashed rgba(36, 86, 211, 0.24);
  overflow: hidden;
}

.nav-edit-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.hotspot-box {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 12px;
  pointer-events: none;
}

.hotspot-box.story {
  border-color: rgba(36, 86, 211, 0.85);
  background: var(--story);
}

.hotspot-box.chat {
  border-color: rgba(255, 146, 59, 0.85);
  background: var(--chat);
}

.calendar-pill {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 249, 241, 0.94);
  color: #6b4f42;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(90, 65, 50, 0.14);
  cursor: pointer;
  box-sizing: border-box;
}

.calendar-pill-arrow {
  font-size: 14px;
}

.calendar-popup {
  position: absolute;
  z-index: 7;
  left: 18px;
  right: 18px;
  top: 74px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.97);
  box-shadow: 0 10px 24px rgba(90, 65, 50, 0.16);
  display: grid;
  gap: 8px;
}

.calendar-pill[hidden],
.calendar-popup[hidden] {
  display: none !important;
}

.calendar-popup-entry {
  border: 1px solid #d7c5b1;
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  color: #6b4f42;
  cursor: pointer;
}

.calendar-popup-entry.active {
  border-color: #bf8d52;
  background: #fff1dc;
}

@media (max-width: 1100px) {
  .app-shell,
  .metric-grid,
  .two-col,
  .editor-layout,
  .demo-form {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sticky-panel {
    position: static;
  }
}

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

  .editor-layout > .sticky-panel {
    width: 100%;
    justify-self: stretch;
  }

  .sticky-panel {
    position: static;
  }
}
.theater-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.theater-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theater-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
  color: #565447;
}

.theater-output {
  min-height: 220px;
  border-radius: 14px;
  border: 1px dashed rgba(22, 22, 22, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.5);
}

.theater-output img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.theater-config .theater-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.theater-config textarea,
.theater-config input {
  width: 100%;
}

.theater-config label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

@media (max-width: 1300px) {
  .theater-grid {
    grid-template-columns: 1fr;
  }
  .theater-config .theater-fields {
    grid-template-columns: 1fr;
  }
}
/* Theater Mode UI (v2 parity) */
.theater-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.theater-card {
  border-radius: 16px;
}

.theater-card h2,
.theater-card h3 {
  margin-bottom: 8px;
}

.theater-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
  color: #514d3d;
}

.theater-output {
  min-height: 220px;
  border-radius: 12px;
  border: 1px dashed rgba(24, 24, 24, 0.24);
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.theater-output img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.theater-config-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theater-config-block {
  border-top: 1px solid rgba(28, 28, 28, 0.12);
  padding-top: 12px;
}

.theater-config-block:first-of-type {
  border-top: none;
  padding-top: 0;
}

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

.theater-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.theater-fields .span-2 {
  grid-column: span 2;
}

.theater-card .asset-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.theater-card .asset-item {
  display: grid;
  grid-template-rows: 84px auto auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.theater-card .asset-item img,
.theater-card .asset-item video {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7f4ed;
}

.theater-card .asset-item .asset-meta {
  min-height: 40px;
}

.theater-card .asset-item .asset-meta div {
  font-size: 12px;
  line-height: 1.25;
  color: #47392f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theater-card .asset-item .asset-meta small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #7f7368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theater-card .asset-item .asset-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.theater-card .asset-item .asset-actions button {
  padding: 4px 8px;
  font-size: 12px;
}

/* Force thumbnail behavior for Step0 lists: input / input2 / preset */
#theaterInputAssetList,
#theaterInput2AssetList,
#theaterPresetAssetList {
  align-items: start;
}

#theaterInputAssetList .asset-item,
#theaterInput2AssetList .asset-item,
#theaterPresetAssetList .asset-item {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

#theaterInputAssetList .asset-item > img,
#theaterInput2AssetList .asset-item > img,
#theaterPresetAssetList .asset-item > img,
#theaterInputAssetList .asset-item > video,
#theaterInput2AssetList .asset-item > video,
#theaterPresetAssetList .asset-item > video {
  width: 100% !important;
  height: 84px !important;
  min-height: 84px !important;
  max-height: 84px !important;
  object-fit: cover !important;
  display: block;
}

/* Hard fallback: whatever markup is injected, keep Step0 previews as thumbnails */
#theaterInputSelectedAsset img,
#theaterInput2SelectedAsset img,
#theaterPresetSelectedAsset img,
#theaterInputAssetList img,
#theaterInput2AssetList img,
#theaterPresetAssetList img,
#theaterInputSelectedAsset video,
#theaterInput2SelectedAsset video,
#theaterPresetSelectedAsset video,
#theaterInputAssetList video,
#theaterInput2AssetList video,
#theaterPresetAssetList video {
  width: 100% !important;
  max-width: 180px !important;
  height: 96px !important;
  max-height: 96px !important;
  min-height: 96px !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 8px !important;
}

#theaterInputSelectedAsset,
#theaterInput2SelectedAsset,
#theaterPresetSelectedAsset,
#theaterInputAssetList,
#theaterInput2AssetList,
#theaterPresetAssetList {
  overflow: hidden;
}

@media (max-width: 1400px) {
  .theater-grid {
    grid-template-columns: 1fr;
  }
  .theater-grid.theater-grid-halves {
    grid-template-columns: 1fr;
  }
  .theater-fields {
    grid-template-columns: 1fr;
  }
  .theater-fields .span-2 {
    grid-column: auto;
  }
}

.full-span {
  grid-column: 1 / -1;
}

.scene-record-card,
.route-image-card,
.route-output-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.route-output-preview {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 156px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(111, 98, 80, 0.18);
  cursor: zoom-in;
}

.scene-record-card img,
.route-image-card img,
.route-output-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.route-output-card img {
  height: auto;
  max-height: 156px;
  object-fit: contain;
  border-radius: 0;
}

.scene-record-meta,
.route-image-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #6f6250;
}

.route-theater-summary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.route-theater-review {
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #4f4339;
}

.route-theater-log-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.route-theater-log {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(247, 244, 237, 0.9);
  color: #5f4c40;
  font-size: 12px;
}

.route-theater-log.error {
  background: rgba(255, 235, 232, 0.95);
  color: #7a2f28;
}

.route-theater-log.warn {
  background: rgba(255, 244, 227, 0.95);
  color: #7a5a18;
}

.route-lightbox.hidden {
  display: none;
}

.route-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.route-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 10, 0.72);
}

.route-lightbox-card {
  position: absolute;
  inset: 32px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(29, 24, 21, 0.96);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.role-center-active-summary {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.role-center-list {
  display: grid;
  gap: 12px;
}

.role-center-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.role-center-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(47, 102, 232, 0.1);
}

.role-center-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.role-center-card-title {
  display: grid;
  gap: 4px;
}

.role-center-card-title strong {
  font-size: 18px;
}

.role-center-card-meta {
  color: var(--muted);
  font-size: 13px;
}

.role-center-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-center-badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

.role-center-badge.active {
  border-color: var(--blue);
  color: var(--blue);
}

.role-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-center-modal.hidden {
  display: none;
}

.role-center-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.role-center-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
}

.role-center-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

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

.role-center-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 12px;
}

.role-center-form .span-2 {
  grid-column: span 2;
}

.role-center-form label {
  display: grid;
  gap: 6px;
}

.field-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.role-center-form .field-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: -2px;
}

.test-theater-step-list {
  display: grid;
  gap: 12px;
}

.test-theater-step-card {
  border: 1px solid rgba(150, 120, 70, 0.18);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.test-theater-step-card h4 {
  margin: 0 0 8px;
}

.test-theater-step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.test-theater-step-card pre {
  margin: 0;
}

.test-theater-floating-card {
  position: fixed;
  top: 150px;
  right: 32px;
  z-index: 40;
  width: min(360px, calc(100vw - 360px));
  max-width: 360px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(36, 86, 211, 0.16);
  background: rgba(255, 251, 244, 0.94);
  box-shadow: 0 12px 28px rgba(28, 23, 18, 0.08);
  backdrop-filter: blur(10px);
}

.test-theater-floating-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.test-theater-floating-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  max-height: min(72vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.test-theater-floating-card.is-collapsed .test-theater-floating-body {
  display: none;
}

[data-view-panel="test-theater-mode"]:not(.active) .test-theater-floating-card {
  display: none;
}

.test-theater-floating-group {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(111, 98, 80, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.test-theater-floating-group h4 {
  margin: 0;
  font-size: 14px;
}

.test-theater-var-list {
  display: grid;
  gap: 8px;
}

.test-theater-var-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(247, 244, 237, 0.9);
}

.test-theater-var-token {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 12px;
  color: var(--blue);
  word-break: break-all;
}

.field-def-block {
  display: grid;
  gap: 10px;
}

.field-def-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-def-list {
  display: grid;
  gap: 10px;
}

.field-def-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(150, 120, 70, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
}

.field-def-row label {
  display: grid;
  gap: 6px;
}

.theater-mode-switchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.theater-mode-switchbar .ghost.is-active {
  border-color: rgba(36, 86, 211, 0.36);
  background: rgba(36, 86, 211, 0.08);
  color: var(--blue);
}

.theater-mode2-banner {
  border: 1px solid rgba(36, 86, 211, 0.18);
  background: linear-gradient(180deg, rgba(36, 86, 211, 0.08), rgba(36, 86, 211, 0.03));
}

.theater-mode2-runtime-grid {
  margin-bottom: 18px;
}

.theater-shared-input-host {
  margin: 18px 0;
}

.theater-shared-input-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.route-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  color: #fff9f0;
  font-size: 22px;
  cursor: pointer;
}

.route-lightbox-media {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
}

.route-lightbox-media img {
  width: 100%;
  height: 100%;
  max-width: min(1200px, calc(100vw - 120px));
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 16px;
  background: #f5efe6;
}

.route-lightbox-meta {
  color: #f4eadf;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.route-run-item {
  cursor: pointer;
}

.route-run-item.active {
  border-color: rgba(38, 89, 231, 0.45);
  box-shadow: 0 0 0 1px rgba(38, 89, 231, 0.12);
}

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

.account-debug-summary-grid .entry {
  min-height: 100%;
}

.account-debug-kv {
  display: grid;
  gap: 4px;
}

.account-debug-kv div {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

.account-debug-kv strong {
  color: var(--text);
}

#accountDebugErrorRunsPanel {
  display: grid;
  gap: 12px;
}

#accountDebugErrorRunsPanel summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
  user-select: none;
}

@media (max-width: 1100px) {
  .account-debug-summary-grid {
    grid-template-columns: 1fr;
  }

  .test-theater-floating-card {
    position: static;
    width: 100%;
    max-width: none;
    margin-bottom: 16px;
  }
}

.route-log-entry,
.route-point-item {
  border-left: 3px solid rgba(111, 98, 80, 0.25);
}

.route-log-entry.warn,
.route-point-item.warn {
  border-left-color: #d98a2b;
}

.route-log-entry.error,
.route-point-item.error {
  border-left-color: #c85353;
}

.route-log-entry.info,
.route-point-item.ok {
  border-left-color: #4f7a4f;
}
