:root {
  --bg: #f6f3ed;
  --surface: #fffdfa;
  --surface-2: #f0faf7;
  --ink: #1f2827;
  --muted: #697572;
  --line: #ddd6ca;
  --accent: #0f766e;
  --accent-2: #c2415a;
  --accent-3: #a56b2a;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(50, 43, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic UI",
    "Meiryo",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  background: #25312f;
  color: #fffdfa;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  color: #bcd6d0;
  font-size: 12px;
  line-height: 1.3;
}

.topbar-actions,
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar-actions {
  justify-content: flex-end;
  max-width: 62%;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
  white-space: nowrap;
}

.button:hover {
  border-color: #b9aa98;
  background: #fff7eb;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: #0b625b;
}

.button.ghost {
  background: transparent;
  color: inherit;
}

.button.ghost.dark {
  color: var(--ink);
}

.button.danger {
  border-color: #e1b7b2;
  color: var(--danger);
}

.workflow-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 12px 16px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.workflow-tab {
  min-width: 116px;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

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

.workflow-view {
  display: none;
}

.workflow-view.active {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(860px, 1fr);
  min-height: calc(100vh - 128px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #ede6da;
}

.panel,
.table-panel,
.editor-panel,
.preview-panel,
.wide-panel,
.research-card,
.caption-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 40, 39, 0.04);
}

.panel {
  padding: 14px;
}

h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field span,
.mix-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d3c8bb;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.mix-row {
  display: grid;
  grid-template-columns: 70px 1fr 28px;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.mix-row strong {
  color: var(--accent);
  font-size: 13px;
}

.stacked-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.asset-library {
  padding: 12px;
}

.asset-palette-panel {
  margin-bottom: 12px;
  border-color: #2a3044;
  background: #0e121a;
  color: #edf4ff;
}

.asset-palette-panel .table-head {
  border-color: #252b3a;
}

.asset-palette-panel h2 {
  color: #fff;
}

.asset-palette-panel .status-pill {
  background: #1f2a3d;
  color: #c8d9ff;
}

.asset-library-head,
.asset-library-message {
  margin: 0 0 8px;
  color: #aebbd6;
  font-size: 12px;
  line-height: 1.4;
}

.asset-empty {
  padding: 18px;
  border: 1px dashed #394157;
  border-radius: 8px;
  background: #111722;
  color: #cbd6ef;
}

.asset-kind-tabs + .asset-empty {
  margin-top: 12px;
}

.asset-empty strong {
  display: block;
  margin-bottom: 6px;
  color: #fff;
}

.asset-empty p {
  margin: 0;
  color: #9faecc;
  line-height: 1.6;
}

.asset-kind-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #252b3a;
  border-radius: 8px;
  background: #151a27;
}

.asset-kind-tab {
  min-height: 44px;
  border: 0;
  border-right: 1px solid #252b3a;
  background: transparent;
  color: #aebbd6;
  font-weight: 700;
}

.asset-kind-tab:last-child {
  border-right: 0;
}

.asset-kind-tab small {
  margin-left: 5px;
  color: #7f8aa5;
  font-size: 10px;
}

.asset-kind-tab.active {
  background: #6f45ea;
  color: #fff;
}

.asset-kind-tab.active small {
  color: rgba(255, 255, 255, 0.72);
}

.asset-place-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #252b3a;
}

.asset-place-status span {
  display: block;
  color: #8794b3;
  font-size: 12px;
  line-height: 1.4;
}

.asset-place-status strong {
  display: block;
  color: #fff;
  font-size: 14px;
}

.asset-place-status p {
  margin: 0;
  color: #aebbd6;
  font-size: 12px;
  line-height: 1.5;
}

.asset-slot-tabs,
.asset-tabs,
.asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.asset-slot-tab,
.asset-tab,
.asset-tag {
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid #30364a;
  border-radius: 6px;
  background: #222239;
  color: #d9e2f7;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
}

.asset-slot-tab.active,
.asset-tab.active,
.asset-tag.active {
  background: #18a9d1;
  border-color: #18a9d1;
  color: #fff;
}

.asset-filter-input {
  width: 100%;
  margin: 12px 0 8px;
  padding: 8px 12px;
  border: 1px solid #30364a;
  border-radius: 8px;
  font-size: 12px;
  background: #171b29;
  color: #eef4ff;
}

.asset-filter-input::placeholder {
  color: #77839f;
}

.asset-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}

.asset-thumb {
  aspect-ratio: 1;
  padding: 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #111722;
}

.asset-thumb:hover {
  border-color: #4d5a78;
  background: #171e2b;
}

.asset-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-thumb.selected {
  border: 2px solid #18a9d1;
  box-shadow: 0 0 0 2px rgba(24, 169, 209, 0.24);
}

.content {
  min-width: 0;
  padding: 16px;
}

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

.section-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.flow-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.flow-card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.flow-card span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eadfcf;
  color: #4f3c25;
  font-weight: 700;
}

.flow-card strong {
  align-self: end;
  font-size: 14px;
  line-height: 1.3;
}

.flow-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.flow-card.active {
  border-color: rgba(15, 118, 110, 0.36);
  background: #f0faf7;
}

.flow-card.active span {
  background: var(--accent);
  color: #fff;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-width: 92px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

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

.status-pill,
.ng-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e4f4f0;
  color: #0b625b;
  font-size: 12px;
  font-weight: 700;
}

.ng-badge {
  background: #fff0ed;
  color: var(--danger);
}

.hidden {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(360px, 40%) minmax(520px, 1fr);
  gap: 12px;
  align-items: stretch;
  height: calc(100vh - 275px);
  min-height: 560px;
}

.reel-build-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(280px, 0.8fr) minmax(280px, 0.9fr);
  gap: 12px;
  align-items: stretch;
  min-height: 660px;
}

.table-panel,
.editor-panel,
.preview-panel {
  min-height: 0;
  overflow: hidden;
}

.table-head,
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.reel-list {
  height: calc(100% - 63px);
  overflow: auto;
  padding: 8px;
}

.reel-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fbf8f1;
  color: inherit;
  text-align: left;
}

.reel-row:hover {
  border-color: #d0c2b0;
}

.reel-row.active {
  border-color: var(--accent);
  background: var(--surface-2);
}

.row-day {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: 8px;
  background: #eadfcf;
  color: #4f3c25;
  font-size: 12px;
  font-weight: 700;
}

.row-main strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-tag {
  min-width: 64px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #e9edf4;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.type-tag.three {
  background: #e4f4f0;
  color: #0b625b;
}

.type-tag.stop {
  background: #f5e8ee;
  color: #9a3152;
}

.type-tag.ranking {
  background: #f4ead8;
  color: #8a551d;
}

.editor-scroll {
  height: calc(100% - 57px);
  overflow: auto;
  padding: 12px;
}

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

.form-grid .field:nth-child(3) {
  grid-column: 1 / -1;
}

.asset-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.asset-editor h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

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

input[type="file"] {
  min-height: 38px;
  padding: 7px 10px;
}

.preview-panel {
  display: grid;
  grid-template-rows: minmax(410px, 1fr) minmax(220px, 0.65fr);
  gap: 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.phone-preview {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 0;
  padding: 22px;
  border: 1px solid #20302e;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.78), rgba(194, 65, 90, 0.66)),
    url("data:image/svg+xml,%3Csvg width='390' height='690' viewBox='0 0 390 690' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='390' height='690' fill='%2325312f'/%3E%3Cpath d='M0 122C70 90 130 88 210 130C286 170 326 146 390 108V690H0Z' fill='%233a463e'/%3E%3Ccircle cx='72' cy='96' r='38' fill='%23e7d8b6' fill-opacity='.2'/%3E%3Ccircle cx='316' cy='212' r='70' fill='%230f766e' fill-opacity='.18'/%3E%3C/svg%3E");
  background-size: cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.preview-topline {
  align-self: start;
  justify-self: stretch;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.preview-card {
  display: grid;
  gap: 16px;
  width: min(100%, 320px);
  padding: 24px 18px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: rgba(21, 27, 25, 0.42);
  backdrop-filter: blur(12px);
  text-align: center;
}

.preview-kicker {
  margin: 0;
  color: #bfe5dd;
  font-size: 13px;
  font-weight: 700;
}

.preview-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.35;
}

.preview-card p {
  margin: 0;
  line-height: 1.65;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice-row span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  background-position: center;
  background-size: cover;
  font-size: 26px;
  font-weight: 700;
}

.choice-row span.has-image {
  min-height: 86px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.78);
}

.preview-cta {
  color: #ffe8b8;
  font-size: 13px;
}

.caption-box {
  min-height: 0;
  overflow: hidden;
}

.caption-box h2 {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

pre {
  height: calc(100% - 48px);
  margin: 0;
  overflow: auto;
  padding: 12px;
  color: #33413f;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.reel-editor-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 132px);
  background: #080a0f;
  color: #edf4ff;
}

.reel-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #1d2534;
  background: #111b1a;
}

.reel-editor-topbar h2,
.stage-toolbar h2,
.dock-head h2 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.25;
}

.reel-editor-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.compact-field {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.compact-field-wide {
  min-width: 280px;
}

.compact-field span {
  color: #9fb0ca;
  font-size: 11px;
  font-weight: 700;
}

.compact-field select {
  min-height: 36px;
  border: 1px solid #354056;
  border-radius: 6px;
  background: #0c121b;
  color: #eef4ff;
}

.reel-editor-main {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) 430px;
  flex: 1;
  min-height: 0;
}

.canva-stage-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #1d2534;
  background: #08090d;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-file-button {
  position: relative;
  overflow: hidden;
}

.preview-file-button input {
  display: none;
}

.preview-source-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 210px;
  gap: 10px;
  padding: 0 16px 12px;
}

.preview-source-row .field {
  margin: 0;
}

.preview-source-row input,
.preview-source-row select,
.stage-bottom input,
.stage-bottom select,
.stage-bottom textarea,
.reel-right-dock input,
.reel-right-dock select,
.reel-right-dock textarea {
  border-color: #344055;
  background: #0d121b;
  color: #edf4ff;
}

.preview-source-row .field span,
.stage-bottom .field span,
.reel-right-dock .field span {
  color: #9fb0ca;
}

.canva-stage-body {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 220px;
  gap: 14px;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  padding: 0 16px 14px;
}

.canva-preview-canvas {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(100%, 430px);
  max-height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid #30384a;
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(315deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 / 24px 24px,
    #f7f3ea;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.48);
}

.canva-preview-base,
.canva-fallback-preview,
.canva-preview-overlay {
  position: absolute;
  inset: 0;
}

.canva-preview-base {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.canva-fallback-preview {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 34px 28px 28px;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.82), rgba(194, 65, 90, 0.7)),
    #25312f;
  background-position: center;
  background-size: cover;
  color: #fff;
}

.fallback-preview-top {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.fallback-preview-copy {
  align-self: center;
  display: grid;
  gap: 14px;
  padding: 22px 16px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(10, 16, 22, 0.4);
  text-align: center;
}

.fallback-preview-copy p,
.fallback-preview-copy h3,
.fallback-preview-copy span {
  margin: 0;
}

.fallback-preview-copy h3 {
  font-size: 28px;
  line-height: 1.35;
}

.fallback-preview-copy span {
  line-height: 1.6;
}

.fallback-choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.fallback-choice-row div {
  display: grid;
  place-items: center;
  min-height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  background-position: center;
  background-size: cover;
}

.fallback-choice-row .has-image {
  min-height: 92px;
}

.canva-preview-overlay {
  pointer-events: none;
}

.preview-slot-zone {
  position: absolute;
  left: var(--slot-x);
  top: var(--slot-y);
  z-index: 3;
  display: grid;
  place-items: center;
  width: var(--slot-w);
  height: var(--slot-h);
  padding: 0;
  overflow: hidden;
  border: 2px dashed rgba(24, 169, 209, 0.72);
  border-radius: 8px;
  background: rgba(8, 13, 20, 0.26);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.preview-slot-zone.background-zone {
  z-index: 1;
  border-color: rgba(255, 255, 255, 0.32);
}

.preview-slot-zone.active {
  border-color: #18a9d1;
  box-shadow: 0 0 0 3px rgba(24, 169, 209, 0.26);
}

.preview-slot-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-slot-zone.background-zone img {
  opacity: 0.18;
}

.preview-slot-zone.over-canva:not(.active) img {
  opacity: 0.78;
}

.preview-slot-zone em {
  padding: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
  text-align: center;
}

.preview-slot-zone span {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(8, 13, 20, 0.76);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.slot-inspector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch;
  min-height: 0;
  padding: 12px;
  border: 1px solid #273246;
  border-radius: 8px;
  background: #101620;
}

.slot-inspector h3,
.slot-inspector p {
  margin: 0;
}

.preview-slot-buttons {
  display: grid;
  gap: 8px;
}

.preview-slot-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px;
  border: 1px solid #2d374b;
  border-radius: 8px;
  background: #151b28;
  color: #dce7fa;
  cursor: pointer;
  text-align: left;
}

.preview-slot-button span {
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: 8px;
  background: #252b3e;
  color: #fff;
  font-weight: 800;
}

.preview-slot-button strong {
  font-size: 13px;
}

.preview-slot-button small,
#previewSlotHint {
  color: #9fb0ca;
  font-size: 11px;
  line-height: 1.5;
}

.preview-slot-button.active {
  border-color: #18a9d1;
  background: rgba(24, 169, 209, 0.14);
}

.preview-slot-button.active span {
  background: #18a9d1;
}

.stage-bottom {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.95fr);
  gap: 12px;
  min-height: 260px;
  max-height: 300px;
  padding: 0 16px 16px;
}

.compact-editor-panel,
.compact-preview-panel {
  min-height: 0;
  border: 1px solid #273246;
  border-radius: 8px;
  background: #101620;
}

.compact-editor-panel .editor-head {
  min-height: 48px;
  padding: 10px 12px;
  border-color: #273246;
}

.compact-editor-panel .editor-scroll {
  height: calc(100% - 49px);
  padding: 10px;
}

.compact-editor-panel .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-editor-panel .form-grid .field:nth-child(3),
.compact-editor-panel .form-grid .field:nth-child(4) {
  grid-column: span 2;
}

.compact-editor-panel textarea {
  min-height: 66px;
}

.compact-preview-panel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

.compact-preview-panel .phone-preview {
  min-height: 0;
  padding: 12px;
  border-radius: 18px;
  box-shadow: none;
}

.compact-preview-panel .preview-topline {
  margin-bottom: 8px;
}

.compact-preview-panel .preview-card {
  gap: 8px;
  padding: 12px 10px;
}

.compact-preview-panel .preview-card h2 {
  font-size: 16px;
}

.compact-preview-panel .preview-card p {
  font-size: 11px;
  line-height: 1.45;
}

.compact-preview-panel .choice-row {
  gap: 5px;
}

.compact-preview-panel .choice-row span {
  min-height: 34px;
  font-size: 15px;
}

.compact-preview-panel .choice-row span.has-image {
  min-height: 44px;
}

.compact-preview-panel .caption-box {
  min-height: 0;
  border: 1px solid #273246;
  border-radius: 8px;
  background: #0d121b;
}

.compact-preview-panel .caption-box h2 {
  padding: 9px 10px;
  border-color: #273246;
  color: #edf4ff;
  font-size: 13px;
}

.compact-preview-panel pre {
  color: #dce7fa;
}

.reel-right-dock {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  background: #0c1018;
}

.dock-panel {
  border: 1px solid #252b3a;
  border-radius: 8px;
  background: #111722;
  color: #edf4ff;
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #252b3a;
}

.dock-head .status-pill {
  background: #1f2a3d;
  color: #c8d9ff;
}

.dock-details {
  padding: 10px;
}

.dock-details summary {
  margin: -10px -10px 10px;
  padding: 11px 12px;
  border-radius: 8px 8px 0 0;
  color: #edf4ff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.dock-details:not([open]) summary {
  margin-bottom: -10px;
  border-radius: 8px;
}

.dock-details summary:hover {
  background: #171e2b;
}

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

.reel-right-dock .asset-library {
  padding: 10px;
}

.reel-right-dock .asset-thumbs {
  max-height: min(44vh, 420px);
}

.reel-right-dock .field-map {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

.wide-panel {
  padding: 0;
  overflow: hidden;
}

.canva-run-panel {
  min-height: 0;
}

.canva-run-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.canva-run-body textarea[readonly] {
  min-height: 240px;
  background: #fff;
  color: #263331;
  font-family: Consolas, "Yu Gothic UI", Meiryo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.field-map-panel {
  margin-top: 12px;
}

.field-map {
  display: grid;
  grid-template-columns: 210px 180px 1fr;
}

.map-row {
  display: contents;
}

.map-row > div {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

.map-row.header > div {
  background: #25312f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.map-row code {
  color: var(--accent);
  font-family: Consolas, monospace;
  font-size: 13px;
}

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

.research-workspace {
  display: grid;
  gap: 12px;
}

.research-input-panel {
  min-height: 0;
}

.research-form {
  padding: 12px;
}

.research-list-panel,
.research-insight-panel {
  min-height: 520px;
  overflow: hidden;
}

.research-list,
.research-insights {
  height: calc(100% - 57px);
  max-height: calc(100vh - 345px);
  overflow: auto;
  padding: 12px;
}

.research-card {
  padding: 18px;
}

.research-card p {
  margin: 10px 0 0;
  color: #475350;
  line-height: 1.75;
}

.research-result-card {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.research-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.research-card-head h3,
.insight-section h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.research-card-head p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-badge {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.research-meta,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.research-meta span,
.chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e9edf4;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.chip-row span {
  background: #e4f4f0;
  color: #0b625b;
}

.research-note {
  margin: 0;
  color: #33413f;
  font-size: 13px;
  line-height: 1.7;
}

.research-card-actions {
  display: flex;
  justify-content: flex-end;
}

.insight-section {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.idea-list {
  margin: 0;
  padding-left: 22px;
  color: #33413f;
  line-height: 1.8;
}

@media (max-width: 980px) {
  body {
    min-width: 0;
  }

  .topbar,
  .workspace,
  .planner-grid,
  .reel-build-grid,
  .research-grid {
    display: block;
  }

  .topbar-actions,
  .reel-editor-topbar,
  .reel-editor-actions,
  .workflow-tabs,
  .toolbar {
    flex-wrap: wrap;
    margin-top: 12px;
  }

  .topbar-actions {
    max-width: none;
    justify-content: flex-start;
  }

  .flow-guide,
  .asset-kind-tabs {
    grid-template-columns: 1fr;
  }

  .asset-kind-tab {
    border-right: 0;
    border-bottom: 1px solid #252b3a;
  }

  .asset-kind-tab:last-child {
    border-bottom: 0;
  }

  .asset-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
  }

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

  .planner-grid {
    height: auto;
    min-height: auto;
  }

  .table-panel,
  .editor-panel,
  .preview-panel {
    margin-bottom: 12px;
  }

  .reel-list,
  .editor-scroll,
  .research-list,
  .research-insights {
    height: auto;
    max-height: 520px;
  }

  .preview-panel {
    display: block;
  }

  .phone-preview {
    min-height: 560px;
    margin-bottom: 12px;
  }

  .reel-editor-shell {
    min-height: auto;
  }

  .reel-editor-main,
  .canva-stage-body,
  .stage-bottom,
  .preview-source-row,
  .compact-preview-panel {
    display: block;
  }

  .reel-editor-topbar {
    align-items: flex-start;
  }

  .reel-editor-actions,
  .compact-field,
  .compact-field-wide {
    width: 100%;
    min-width: 0;
  }

  .canva-stage-panel {
    border-right: 0;
  }

  .preview-source-row,
  .canva-stage-body,
  .stage-bottom {
    padding: 0 12px 12px;
  }

  .canva-preview-canvas {
    width: min(100%, 420px);
    margin: 0 auto 12px;
  }

  .slot-inspector,
  .compact-editor-panel,
  .compact-preview-panel,
  .reel-right-dock {
    margin-bottom: 12px;
  }

  .stage-bottom {
    max-height: none;
  }

  .compact-editor-panel .editor-scroll,
  .reel-right-dock {
    height: auto;
    max-height: none;
  }

  .compact-editor-panel .form-grid,
  .image-slot-grid {
    grid-template-columns: 1fr;
  }

  .compact-editor-panel .form-grid .field:nth-child(3),
  .compact-editor-panel .form-grid .field:nth-child(4) {
    grid-column: auto;
  }

  .compact-preview-panel .phone-preview {
    min-height: 480px;
    margin-bottom: 12px;
  }
}
