:root {
  --bg: oklch(0.955 0.016 110);
  --surface: oklch(0.992 0.006 112);
  --surface-2: oklch(0.946 0.018 112);
  --surface-3: oklch(0.902 0.027 118);
  --ink: oklch(0.18 0.023 178);
  --ink-2: oklch(0.32 0.028 175);
  --muted: oklch(0.49 0.031 158);
  --line: oklch(0.79 0.028 124);
  --line-2: oklch(0.64 0.042 132);
  --accent: oklch(0.5 0.13 152);
  --accent-2: oklch(0.75 0.16 76);
  --accent-3: oklch(0.56 0.12 218);
  --coral: oklch(0.63 0.16 32);
  --dark: oklch(0.16 0.026 178);
  --shadow: 0 18px 48px color-mix(in oklch, var(--dark), transparent 88%);
  --radius: 8px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, color-mix(in oklch, var(--line), transparent 70%) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in oklch, var(--line), transparent 74%) 1px, transparent 1px),
    linear-gradient(180deg, oklch(0.972 0.014 126), var(--bg) 46%, oklch(0.93 0.021 88));
  background-size: 44px 44px, 44px 44px, auto;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.66;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .product-sidebar {
  width: 0;
  padding: 0;
  border-right: 0;
  overflow: hidden;
}

.product-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-height: 0;
  overflow: auto;
  padding: var(--space-lg);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in oklch, var(--surface), var(--accent-2) 5%), var(--surface));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block strong {
  font-size: 1.12rem;
  line-height: 1.1;
}

.brand-block span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 13px);
  grid-auto-rows: 13px;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  transform: rotate(-4deg);
}

.brand-mark span:nth-child(1) {
  background: var(--accent);
}

.brand-mark span:nth-child(2) {
  background: var(--accent-2);
}

.brand-mark span:nth-child(3) {
  background: var(--accent-3);
}

.brand-mark span:nth-child(4) {
  background: var(--ink);
}

.workspace-switcher,
.side-nav button,
.intent-button,
.preset-button,
.side-wide-button,
.ghost-button,
.primary-button,
.icon-button,
.prompt-toolbar button,
.batch-controls button,
.canvas-tools button,
.automation-builder button,
.automation-card button,
.export-menu button,
.brief-box button,
.compact-header button,
.result-actions button,
.dialog-actions button,
.plan-row button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.workspace-switcher {
  display: block;
  width: 100%;
  padding: var(--space-md);
  text-align: left;
}

.workspace-switcher span,
.workspace-switcher strong {
  display: block;
}

.workspace-switcher span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.workspace-switcher strong {
  margin-top: 4px;
  line-height: 1.2;
}

.side-nav {
  display: grid;
  gap: var(--space-xs);
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 40px;
  padding: 0 var(--space-md);
  border-color: transparent;
  color: var(--ink-2);
  background: transparent;
  text-align: left;
}

.side-nav button span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.62rem;
  font-weight: 900;
}

.side-nav button.active,
.side-nav button:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.side-nav button.active span {
  color: white;
  border-color: var(--ink);
  background: var(--ink);
}

.side-section {
  display: grid;
  gap: var(--space-sm);
}

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 28px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.side-heading button {
  min-width: 32px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 900;
}

.intent-list,
.preset-stack,
.memory-log,
.automation-list,
.signal-board,
.result-grid,
.plan-list {
  display: grid;
  gap: var(--space-sm);
}

.intent-button,
.preset-button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 56px;
  padding: var(--space-md);
  text-align: left;
}

.intent-button strong,
.preset-button strong {
  line-height: 1.1;
}

.intent-button span,
.preset-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.intent-button.active,
.preset-button.selected,
.intent-button:hover,
.preset-button:hover {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--surface), var(--accent-2) 12%);
}

.side-wide-button,
.seat-card button {
  min-height: 38px;
  width: 100%;
}

.seat-card {
  display: grid;
  gap: var(--space-sm);
  margin-top: auto;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--accent-2), white 62%), color-mix(in oklch, var(--surface), var(--accent-3) 9%));
}

.seat-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.seat-card strong {
  font-size: 1.04rem;
}

.seat-info {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in oklch, var(--surface), white 20%);
}

.seat-info summary {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-weight: 850;
}

.seat-info ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0 var(--space-md) var(--space-md) 28px;
  color: var(--ink-2);
  font-size: 0.8rem;
  line-height: 1.25;
}

.seat-card button,
.primary-button {
  border-color: color-mix(in oklch, var(--accent), black 12%);
  color: white;
  background: var(--accent);
}

.ghost-button {
  background: var(--surface);
}

.primary-button:hover,
.seat-card button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.large {
  min-height: 48px;
  padding-inline: var(--space-xl);
  font-size: 1rem;
}

.main-shell {
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-width: 0;
  padding: 0 var(--space-xl);
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface), white 38%);
}

.topbar-title {
  min-width: 0;
}

.topbar-title span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.topbar-title strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: clamp(1rem, 1.2vw, 1.2rem);
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions,
.hero-actions,
.generate-actions,
.prompt-toolbar,
.generation-settings,
.canvas-tools,
.dialog-actions,
.automation-actions,
.result-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-actions {
  flex: 0 0 auto;
}

.topbar-actions button,
.generate-actions button,
.dialog-actions button,
.canvas-tools button,
.automation-actions button,
.result-actions button {
  min-height: 38px;
  padding: 0 var(--space-md);
}

.icon-button {
  min-width: 42px;
  min-height: 38px;
  background: var(--ink);
  color: white;
}

.menu-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: var(--space-xs);
  width: 176px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.export-menu button {
  min-height: 32px;
  padding: 0 var(--space-sm);
  font-size: 0.82rem;
  text-align: left;
}

.compact-action {
  min-width: 92px;
}

.icon-action {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-weight: 900;
}

.workspace {
  min-height: 0;
  overflow: hidden;
  padding: var(--space-xl);
}

.tab-panel {
  display: none;
  height: 100%;
  min-height: 0;
}

.tab-panel.active {
  display: block;
}

.panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(150deg, color-mix(in oklch, var(--surface), white 35%), color-mix(in oklch, var(--surface-2), white 28%));
  box-shadow: 0 1px 0 color-mix(in oklch, white, transparent 10%) inset;
}

.panel-header,
.section-header,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.panel-header span,
.section-header span,
.panel-heading span,
.prompt-box span,
.inspector-block span,
.brief-box span,
.mini-heading,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-header h2,
.section-header h2,
.panel-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(1.1rem, 1.7vw, 1.55rem);
  line-height: 1.08;
}

.compact-header h2 {
  font-size: 1.15rem;
}

.landing-panel {
  overflow: auto;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1fr);
  gap: var(--space-xl);
  min-height: min(560px, 58svh);
  align-items: center;
  padding: clamp(24px, 5vw, 68px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(115deg, color-mix(in oklch, var(--accent-2), white 68%) 0 42%, transparent 42%),
    linear-gradient(145deg, color-mix(in oklch, var(--accent-3), white 68%), var(--surface) 52%, color-mix(in oklch, var(--surface), var(--coral) 10%));
}

.hero-copy h1 {
  margin: var(--space-md) 0;
  max-width: 11ch;
  font-size: clamp(2.5rem, 7vw, 5.8rem);
  line-height: 0.92;
}

.hero-copy p {
  max-width: 60ch;
  margin: 0 0 var(--space-xl);
  color: var(--ink-2);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.48;
}

.hero-preview {
  display: grid;
  grid-template-columns: 1fr 0.84fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--space-md);
  min-height: 380px;
}

.hero-preview img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border: 1px solid color-mix(in oklch, var(--ink), transparent 35%);
  border-radius: var(--radius);
  background: var(--dark);
  box-shadow: var(--shadow);
}

.hero-preview img:first-child {
  grid-row: span 2;
}

.demo-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.demo-strip article {
  display: grid;
  align-content: start;
  gap: var(--space-sm);
  min-height: 164px;
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.demo-strip span {
  color: var(--coral);
  font-weight: 900;
}

.demo-strip strong {
  font-size: 1.03rem;
}

.demo-strip p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.88rem;
  line-height: 1.36;
}

.workspace-grid {
  display: grid;
  gap: var(--space-lg);
  height: 100%;
  min-height: 0;
}

.project-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.28fr) minmax(520px, 0.72fr);
  gap: var(--space-lg);
  height: 100%;
  min-height: 0;
}

.session-dock {
  position: absolute;
  top: 88px;
  right: var(--space-xl);
  bottom: var(--space-xl);
  z-index: 24;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: var(--space-md);
  width: min(430px, calc(100vw - 48px));
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--surface), white 26%);
  box-shadow: var(--shadow);
}

.session-dock[hidden] {
  display: none;
}

.compact-project-list .project-row,
.compact-project-list .project-empty {
  min-height: 48px;
  padding: var(--space-sm) var(--space-md);
}

.compact-project-list .project-row span,
.compact-project-list .project-empty span {
  font-size: 0.72rem;
}

.project-list-panel,
.project-chat-panel {
  overflow: auto;
  padding: var(--space-lg);
}

.project-new-button {
  width: 100%;
  min-height: 42px;
  margin: var(--space-lg) 0;
}

.project-list {
  display: grid;
  gap: var(--space-sm);
}

.project-row,
.project-empty {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 62px;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.project-row.active,
.project-row:hover {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--surface), var(--accent-2) 12%);
}

.project-row span,
.project-empty span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.project-chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-lg);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
}

.chat-header > button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 900;
}

.chat-header span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chat-header h2 {
  margin: 4px 0 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.chat-actions {
  display: flex;
  gap: var(--space-sm);
}

.chat-actions button {
  min-height: 38px;
  padding: 0 var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 850;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: var(--space-md);
  overflow: auto;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--surface), var(--accent-3) 4%);
}

.session-dock .chat-messages {
  padding: var(--space-sm);
}

.session-dock .chat-message {
  width: 100%;
}

.session-dock .chat-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.chat-message {
  width: min(76%, 720px);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chat-message.user {
  justify-self: end;
  border-color: var(--accent);
}

.chat-message span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chat-message p {
  margin: 6px 0 0;
  line-height: 1.42;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: var(--space-sm);
}

.session-dock .chat-composer {
  grid-template-columns: minmax(0, 1fr) 70px;
}

.chat-composer input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 var(--space-md);
}

.generate-grid {
  grid-template-columns: minmax(560px, 1fr) minmax(360px, 0.43fr);
}

.sheets-grid,
.history-panel .fill-panel,
.billing-panel .billing-card {
  height: 100%;
}

.generator-card,
.live-panel,
.sheets-panel .panel,
.fill-panel,
.automation-grid .panel,
.memory-grid .panel,
.billing-card {
  overflow: auto;
  padding: var(--space-lg);
}

.operation-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 0.32fr);
  gap: var(--space-sm);
  margin: var(--space-lg) 0 var(--space-md);
}

.operation-toolbar input,
.operation-toolbar select,
.prompt-box textarea,
.generation-settings select,
#searchInput,
.automation-builder input,
.automation-builder select,
.inspector-controls select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

.operation-toolbar input,
.operation-toolbar select,
.generation-settings select,
#searchInput,
.automation-builder input,
.automation-builder select,
.inspector-controls select {
  min-height: 40px;
  padding: 0 var(--space-md);
}

.operation-toolbar input:focus,
.operation-toolbar select:focus,
.prompt-box textarea:focus,
#searchInput:focus,
.generation-settings select:focus,
.automation-builder input:focus,
.automation-builder select:focus,
.inspector-controls select:focus {
  border-color: var(--accent);
}

.ops-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 178px;
  gap: var(--space-md);
  max-width: 100%;
  min-height: 158px;
  overflow-x: auto;
  padding: 0 0 var(--space-sm);
  scrollbar-width: thin;
}

.op-card {
  position: relative;
  display: grid;
  grid-template-rows: 58px 24px auto auto;
  gap: var(--space-xs);
  min-height: 148px;
  padding: var(--space-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.op-card img {
  width: 100%;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--dark);
}

.op-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: white;
  background: var(--ink);
  font-size: 0.66rem;
  font-weight: 900;
}

.op-card strong {
  font-size: 0.92rem;
  line-height: 1.08;
}

.op-card small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.op-card.active,
.op-card:hover {
  border-color: var(--ink);
  background: color-mix(in oklch, var(--surface), var(--accent-2) 12%);
  transform: translateY(-2px);
}

.prompt-toolbar {
  max-width: 100%;
  margin-top: var(--space-md);
  overflow-x: auto;
  padding-bottom: 2px;
}

.prompt-toolbar button,
.batch-controls button,
.canvas-tools button,
.compact-header button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 var(--space-md);
  background: var(--surface-2);
}

.prompt-box {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.prompt-box textarea {
  min-height: 150px;
  resize: vertical;
  padding: var(--space-lg);
  font-size: 1rem;
  line-height: 1.45;
}

.generation-settings {
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

.generation-settings > div,
.generation-settings label {
  display: grid;
  gap: var(--space-xs);
  min-width: 126px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.batch-controls {
  display: flex;
  gap: var(--space-xs);
}

.batch-controls button.active {
  color: white;
  background: var(--ink);
}

.switch-row {
  display: flex !important;
  align-items: center;
  min-height: 58px;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.generate-actions {
  justify-content: flex-end;
  margin-top: var(--space-md);
}

.generation-progress {
  height: 5px;
  margin-top: var(--space-md);
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.generation-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: width 240ms ease;
}

.api-note {
  min-height: 20px;
  margin: var(--space-sm) 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.run-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 34px;
  padding: 0 var(--space-md);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 850;
}

.run-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.run-status.running span {
  background: var(--coral);
  animation: pulse 1s infinite;
}

.run-status.live span {
  background: var(--accent);
}

@keyframes pulse {
  50% {
    transform: scale(1.6);
    opacity: 0.45;
  }
}

.result-grid {
  margin-top: var(--space-lg);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.history-actions {
  display: flex;
  gap: var(--space-sm);
}

.history-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 850;
}

.history-timeline {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.timeline-day {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
}

.timeline-day > strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.timeline-day div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.timeline-day button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 var(--space-md);
  font-weight: 800;
}

.timeline-day button span {
  margin-right: 6px;
  color: var(--muted);
}

.result-grid.tight {
  grid-template-columns: 1fr;
}

.history-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.result-preview {
  display: block;
  width: 100%;
  height: 210px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(45deg, oklch(0.2 0.012 260) 25%, transparent 25%),
    linear-gradient(-45deg, oklch(0.2 0.012 260) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, oklch(0.2 0.012 260) 75%),
    linear-gradient(-45deg, transparent 75%, oklch(0.2 0.012 260) 75%),
    oklch(0.16 0.013 260);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.result-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-body {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
}

.result-body header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.result-body strong {
  line-height: 1.1;
}

.result-body header span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-body p {
  min-height: 40px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.86rem;
  line-height: 1.35;
}

.result-actions {
  flex-wrap: wrap;
}

.result-actions button {
  min-height: 34px;
  flex: 1 1 72px;
  padding-inline: var(--space-sm);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tag-row span {
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.68rem;
  font-weight: 850;
}

.asset-placeholder {
  display: grid;
  place-content: center;
  gap: var(--space-xs);
  width: 100%;
  height: 100%;
  color: white;
  text-align: center;
}

.asset-placeholder span {
  color: color-mix(in oklch, white, transparent 30%);
  font-size: 0.82rem;
}

.sheet-tabs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-lg) 0 var(--space-sm);
  scrollbar-width: thin;
}

.sheet-tab {
  flex: 0 0 140px;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  text-align: left;
}

.sheet-tab img {
  width: 100%;
  aspect-ratio: 1.3 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-3);
}

.sheet-tab strong,
.sheet-tab span {
  display: block;
}

.sheet-tab strong {
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  line-height: 1.12;
}

.sheet-tab span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sheet-tab.active,
.sheet-tab:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.focus-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(190px, 0.36fr) minmax(190px, 0.36fr);
  gap: var(--space-md);
  align-items: center;
  margin-top: var(--space-md);
}

.segmented {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow-x: auto;
}

.segmented button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink-2);
  background: transparent;
  padding: 0 var(--space-md);
  font-weight: 850;
}

.segmented button.active,
.segmented button:hover {
  color: white;
  background: var(--ink);
}

.range-row {
  display: grid;
  grid-template-columns: 50px 1fr 30px;
  align-items: center;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

input[type="range"] {
  accent-color: var(--accent);
}

.sheet-stage {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(300px, 0.55fr);
  gap: var(--space-lg);
  min-height: 0;
  margin-top: var(--space-lg);
}

.sheet-preview-wrap,
.cell-browser,
.drop-canvas {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.sheet-preview-wrap {
  position: relative;
  min-height: 430px;
  background: oklch(0.18 0.012 260);
}

.sheet-preview-wrap img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: contain;
}

.sheet-overlay {
  position: absolute;
  inset: var(--space-lg);
  pointer-events: none;
  border: 1px solid color-mix(in oklch, var(--accent-2), transparent 15%);
}

.sheet-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, color-mix(in oklch, var(--accent-2), transparent 54%) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklch, var(--accent-2), transparent 54%) 1px, transparent 1px);
  background-size: var(--grid-x, 16.666%) var(--grid-y, 16.666%);
}

.sheet-overlay::after {
  content: "";
  position: absolute;
  inset: var(--focus-top, 0) var(--focus-right, 0) var(--focus-bottom, 0) var(--focus-left, 0);
  border: 2px solid var(--accent-2);
  background: color-mix(in oklch, var(--accent-2), transparent 86%);
  box-shadow: 0 0 0 999px color-mix(in oklch, black, transparent 68%);
}

.cell-browser {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 430px;
  background: var(--surface);
}

.browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
}

.browser-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.cell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: var(--space-sm);
  align-content: start;
  overflow: auto;
  padding: var(--space-md);
}

.sprite-cell {
  aspect-ratio: 1 / 1;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: oklch(0.17 0.012 260);
  background-repeat: no-repeat;
}

.sprite-cell.active,
.sprite-cell:hover {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent-2), transparent 72%);
}

.canvas-shell {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(320px, 0.32fr);
  gap: var(--space-lg);
  height: 100%;
  min-height: 0;
}

.canvas-board-panel,
.inspector {
  padding: var(--space-lg);
  overflow: hidden;
}

.canvas-board-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-lg);
}

.drop-canvas {
  position: relative;
  min-height: 0;
  background:
    linear-gradient(90deg, color-mix(in oklch, var(--line), transparent 72%) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in oklch, var(--line), transparent 76%) 1px, transparent 1px),
    color-mix(in oklch, var(--surface), var(--accent-3) 5%);
  background-size: 36px 36px, 36px 36px, auto;
}

.drop-canvas.drag-over {
  outline: 3px solid color-mix(in oklch, var(--accent-2), transparent 20%);
  outline-offset: -6px;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--space-sm);
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.canvas-empty strong {
  color: var(--ink);
  font-size: 1.6rem;
}

.canvas-item {
  position: absolute;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 2px solid color-mix(in oklch, var(--ink), transparent 62%);
  border-radius: var(--radius);
  background-color: oklch(0.17 0.012 260);
  background-repeat: no-repeat;
  box-shadow: var(--shadow);
  touch-action: none;
}

.canvas-item.generated-item {
  width: 150px;
  height: 150px;
  background: oklch(0.16 0.012 260);
}

.canvas-item.loading-item {
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.canvas-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.canvas-item.selected {
  border-color: var(--accent-2);
  box-shadow:
    0 0 0 4px color-mix(in oklch, var(--accent-2), transparent 66%),
    var(--shadow);
}

.selection-box {
  position: absolute;
  z-index: 8;
  border: 1px solid var(--accent-3);
  border-radius: 4px;
  background: color-mix(in oklch, var(--accent-3), transparent 82%);
  pointer-events: none;
}

.inspector {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: var(--space-lg);
  overflow: auto;
}

.inspector-block strong {
  display: block;
  margin-top: 5px;
  font-size: 1.25rem;
  line-height: 1.1;
}

.inspector-block p,
.brief-box p {
  margin: var(--space-sm) 0 0;
  color: var(--ink-2);
  line-height: 1.42;
}

.inspector-controls {
  display: grid;
  gap: var(--space-md);
}

.inspector-controls label {
  display: grid;
  gap: var(--space-xs);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.brief-box {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.brief-box button {
  min-height: 36px;
}

.animation-box {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.animation-shell {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(320px, 0.32fr);
  gap: var(--space-lg);
  height: 100%;
  min-height: 0;
}

.animation-stage-panel,
.animation-context {
  overflow: auto;
  padding: var(--space-lg);
}

.animation-stage-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-lg);
}

.animation-preview-stage {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, oklch(0.19 0.012 260) 25%, transparent 25%),
    linear-gradient(-45deg, oklch(0.19 0.012 260) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, oklch(0.19 0.012 260) 75%),
    linear-gradient(-45deg, transparent 75%, oklch(0.19 0.012 260) 75%),
    oklch(0.145 0.013 260);
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}

.large-timeline {
  align-content: center;
  justify-content: center;
  min-height: 100%;
  padding: var(--space-xl);
}

.large-timeline button {
  flex-basis: 132px;
  width: 132px;
  height: 132px;
}

.animation-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.animation-controls button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 850;
}

.animation-box span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.animation-box p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.36;
}

.animation-timeline {
  display: flex;
  gap: var(--space-sm);
  min-height: 58px;
  overflow-x: auto;
}

.animation-timeline button {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(0.16 0.012 260);
}

.animation-timeline img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.animation-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.animation-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-weight: 850;
}

.canvas-library {
  display: grid;
  gap: var(--space-sm);
}

.library-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-sm);
  min-height: 54px;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.library-row img,
.library-row span {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--dark);
  object-fit: cover;
}

.library-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-grid {
  grid-template-columns: minmax(520px, 0.72fr) minmax(320px, 0.28fr);
}

.automation-builder {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 180px 120px;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}

.automation-card {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.automation-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.automation-card header span,
.automation-card p {
  color: var(--muted);
  font-weight: 720;
}

.automation-card p {
  margin: 0;
  line-height: 1.35;
}

.automation-status {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.automation-status.paused {
  color: var(--ink);
  background: var(--surface-3);
}

.automation-actions button {
  flex: 1;
}

.automation-summary,
.report-empty {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.automation-summary p,
.report-empty span {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.42;
}

.memory-grid {
  grid-template-columns: minmax(320px, 0.35fr) minmax(520px, 0.65fr);
}

.signal-board {
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  margin-top: var(--space-lg);
}

.signal-chip {
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 54px;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.signal-chip span {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-weight: 900;
}

.signal-chip:hover {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--surface), var(--accent-2) 12%);
}

.memory-tree {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.memory-branch {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.memory-branch summary {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  cursor: pointer;
  font-weight: 850;
  text-transform: capitalize;
}

.memory-branch summary span {
  color: var(--muted);
}

.memory-branch div {
  display: grid;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-md);
}

.memory-branch button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  text-align: left;
  font-weight: 760;
}

.memory-entry {
  display: grid;
  gap: 5px;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.memory-entry span {
  color: var(--ink-2);
  line-height: 1.36;
}

.memory-entry small {
  color: var(--muted);
  font-weight: 800;
}

.billing-card {
  max-width: 920px;
}

.plan-list {
  margin-top: var(--space-lg);
}

.plan-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(220px, 1fr) 130px;
  align-items: center;
  gap: var(--space-lg);
  min-height: 82px;
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-row.featured {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--surface), var(--accent-2) 13%);
}

.plan-row strong,
.plan-row span {
  display: block;
}

.plan-row span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.plan-row button {
  min-width: 120px;
  min-height: 40px;
}

.plan-row ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 0.84rem;
  line-height: 1.25;
}

.result-dialog {
  width: min(1120px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.result-dialog::backdrop {
  background: color-mix(in oklch, var(--dark), transparent 28%);
}

.dialog-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 0.62fr) minmax(300px, 0.38fr);
  gap: 0;
  max-height: min(760px, calc(100svh - 60px));
}

.dialog-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 900;
}

.dialog-image-wrap {
  display: grid;
  place-items: center;
  min-height: 560px;
  padding: var(--space-lg);
  background:
    linear-gradient(45deg, oklch(0.19 0.012 260) 25%, transparent 25%),
    linear-gradient(-45deg, oklch(0.19 0.012 260) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, oklch(0.19 0.012 260) 75%),
    linear-gradient(-45deg, transparent 75%, oklch(0.19 0.012 260) 75%),
    oklch(0.145 0.013 260);
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}

.dialog-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: 680px;
  object-fit: contain;
}

.dialog-body {
  display: grid;
  align-content: start;
  gap: var(--space-md);
  overflow: auto;
  padding: var(--space-xl);
}

.dialog-body h2 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.05;
}

.dialog-body label {
  display: grid;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.dialog-body textarea {
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  padding: var(--space-md);
  line-height: 1.42;
}

.dialog-actions {
  flex-wrap: wrap;
}

.dialog-actions button {
  flex: 1 1 140px;
}

.danger-button {
  border-color: color-mix(in oklch, var(--coral), black 10%) !important;
  color: white !important;
  background: var(--coral) !important;
}

.toast-stack {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 80;
  display: grid;
  gap: var(--space-sm);
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: grid;
  gap: 4px;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.32;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .generate-grid,
  .canvas-shell,
  .project-shell,
  .animation-shell,
  .automation-grid,
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .live-panel,
  .inspector {
    min-height: 360px;
  }

  .demo-strip {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100svh;
  }

  .product-sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-nav button {
    justify-content: center;
    padding: var(--space-sm);
    font-size: 0.78rem;
  }

  .side-nav button span {
    display: none;
  }

  .main-shell {
    display: block;
  }

  .workspace-topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding: var(--space-lg);
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions button {
    flex: 1;
  }

  .workspace {
    overflow: visible;
    height: auto;
    padding: var(--space-lg);
  }

  .tab-panel {
    height: auto;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    padding: var(--space-xl);
  }

  .hero-copy h1 {
    max-width: 10ch;
    font-size: clamp(2.4rem, 15vw, 4rem);
  }

  .hero-preview {
    min-height: 320px;
  }

  .demo-strip,
  .sheet-stage,
  .focus-bar,
  .operation-toolbar,
  .project-shell,
  .automation-builder {
    grid-template-columns: 1fr;
  }

  .chat-message {
    width: 100%;
  }

  .animation-actions {
    grid-template-columns: 1fr;
  }

  .animation-controls,
  .plan-row {
    grid-template-columns: 1fr;
  }

  .session-dock {
    position: fixed;
    inset: auto var(--space-lg) var(--space-lg) var(--space-lg);
    width: auto;
    height: min(70svh, 620px);
  }

  .dialog-shell {
    grid-template-columns: 1fr;
  }

  .dialog-image-wrap {
    min-height: 340px;
  }
}
