:root {
  --background: #f4f4f2;
  --foreground: #171717;
  --card: #ffffff;
  --card-foreground: #171717;
  --popover: #ffffff;
  --popover-foreground: #171717;
  --primary: #111111;
  --primary-foreground: #ffffff;
  --secondary: #ffffff;
  --secondary-foreground: #171717;
  --muted-surface: #fafafa;
  --muted-foreground: #707070;
  --border: #d8d8d4;
  --input: #d8d8d4;
  --ring: #2563eb;
  --destructive: #b42318;
  --radius: 0.5rem;
  --bg: var(--background);
  --surface: var(--card);
  --surface-soft: var(--muted-surface);
  --ink: var(--foreground);
  --muted: var(--muted-foreground);
  --line: var(--border);
  --line-strong: #b8b8b2;
  --accent: var(--primary);
  --focus: var(--ring);
  --danger: var(--destructive);
  --shadow: 0 18px 50px rgb(0 0 0 / 8%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.topbar__actions,
.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.plan-chip,
.plan-note {
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8e6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.plan-chip {
  padding: 6px 10px;
}

.plan-note {
  margin: 0;
  padding: 5px 9px;
}

main {
  min-height: calc(100vh - 56px);
}

.login-view,
.upload-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.upload-card {
  width: min(100%, 520px);
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1,
.upload-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button {
  min-height: 36px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.text-button:hover,
.text-link:hover {
  color: var(--ink);
}

.danger-button {
  border: 1px solid #f0c8c4;
  background: #fff7f6;
  color: var(--danger);
}

.step-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-card__copy p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

.dropzone {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface-soft);
  transition: border-color 160ms ease, background 160ms ease;
}

.dropzone.has-preview {
  place-items: stretch;
  align-content: start;
  padding: 18px;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #f0f0ed;
}

.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone.has-preview input {
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.dropzone label {
  display: grid;
  gap: 6px;
  text-align: center;
  pointer-events: none;
}

.dropzone.has-preview > label {
  display: none;
}

.dropzone strong {
  font-size: 22px;
}

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

.upload-preview {
  position: relative;
  z-index: 1;
  display: none;
  pointer-events: auto;
}

.dropzone.has-preview .upload-preview {
  display: grid;
  gap: 12px;
}

.upload-preview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.upload-preview__head strong {
  font-size: 18px;
}

.upload-preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
}

.upload-preview__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.upload-preview__thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.upload-preview__more {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.upload-preview__remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(0 0 0 / 18%);
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  box-shadow: 0 4px 10px rgb(0 0 0 / 14%);
}

.upload-preview__remove:hover {
  background: #111;
  color: white;
}

.upload-preview__add {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.dropzone.has-preview .upload-preview__add {
  display: inline-flex;
  pointer-events: auto;
}

.editor-view {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.asset-tray {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

.tray-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tray-head__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.asset-file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.asset-add-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.agent-panel {
  display: grid;
  gap: 10px;
}

.agent-panel--dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 25;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 18px 50px rgb(0 0 0 / 14%);
  padding: 14px;
  backdrop-filter: blur(16px);
}

.agent-panel--dock .tray-head {
  margin-bottom: 0;
}

.toolbar-rail {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.toolbar-group,
.cn-button-group {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 74%);
  padding: 4px;
}

.toolbar-field {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 8px;
}

.toolbar-field input {
  width: 46px;
  min-height: 0;
  height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  font-weight: 800;
}

.toolbar-field--template {
  padding-right: 4px;
}

.toolbar-field--template span {
  white-space: nowrap;
}

.cn-select-trigger {
  width: 138px;
  min-height: 36px;
  height: 36px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  font-weight: 700;
  padding: 0 10px;
}

.toolbar-field .cn-select-trigger {
  border: 0;
  background: transparent;
}

.cn-select-trigger--template {
  width: 220px;
}

.cn-select-trigger--compact {
  width: 124px;
}

.cn-select-trigger--mood {
  width: 112px;
}

.cn-button {
  min-height: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.cn-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.cn-button-variant-default {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.cn-button-variant-default:hover {
  background: #2a2a2a;
}

.cn-button-variant-secondary {
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.cn-button-variant-secondary:hover {
  background: var(--muted-surface);
}

.cn-button-variant-outline {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
}

.cn-button-variant-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-foreground);
}

.cn-button-size-default {
  height: 36px;
  padding: 0 12px;
}

.cn-button-size-sm {
  height: 32px;
  padding: 0 10px;
}

.cn-button-size-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.background-swatches {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 7px;
}

.background-swatches button {
  width: 20px;
  height: 20px;
  border: 1px solid rgb(0 0 0 / 14%);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 58%);
  padding: 0;
}

.background-swatches button:hover,
.background-swatches button:focus-visible {
  transform: scale(1.08);
}

.agent-prompt {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agent-prompt textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.agent-prompt textarea::placeholder {
  color: rgb(112 112 112 / 58%);
  font-weight: 400;
}

.agent-run {
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
}

.agent-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.asset-card {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.asset-card.is-selected .asset-thumb {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 18%);
}

.asset-thumb {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  object-fit: cover;
  cursor: grab;
}

.asset-thumb:active {
  cursor: grabbing;
}

.asset-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(0 0 0 / 16%);
  border-radius: 50%;
  background: rgb(255 255 255 / 94%);
  color: #9f1d1d;
  box-shadow: 0 5px 14px rgb(0 0 0 / 15%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, color 140ms ease;
}

.asset-card:hover .asset-remove,
.asset-card:focus-within .asset-remove,
.asset-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.asset-remove:hover,
.asset-remove:focus-visible {
  background: #111;
  color: white;
}

.asset-tags {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.asset-tags input {
  width: 100%;
  min-height: 30px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 11px;
}

.editor-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.editor-toolbar {
  position: sticky;
  top: 56px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(244 244 242 / 92%);
  backdrop-filter: blur(16px);
}

.toolbar-title {
  min-width: 132px;
}

.editor-toolbar strong {
  display: block;
  margin-bottom: 2px;
}

.page-count-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.page-count-control input {
  width: 72px;
  min-height: 36px;
  border-radius: 8px;
  padding: 0 8px;
}

.object-toolbar {
  position: sticky;
  top: 120px;
  z-index: 9;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 54px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(16px);
}

.object-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.object-toolbar input[type="range"] {
  width: 108px;
  min-height: 0;
  padding: 0;
}

.object-toolbar input[type="color"] {
  width: 36px;
  min-height: 32px;
  padding: 3px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 420px));
  align-content: start;
  justify-content: center;
  gap: 28px;
  padding: 32px 32px 180px;
}

.page {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: white;
  box-shadow: 0 12px 30px rgb(0 0 0 / 7%);
}

.page.is-selected {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.page.is-over {
  background: #f8fbff;
}

.page-number {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 1;
  color: #b0b0aa;
  font-size: 11px;
  pointer-events: none;
}

.page-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(0 0 0 / 12%);
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  color: #9f1d1d;
  box-shadow: 0 6px 16px rgb(0 0 0 / 12%);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
  transform: translateY(-2px);
}

.page:hover .page-remove,
.page:focus-within .page-remove,
.page-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.page-remove:hover,
.page-remove:focus-visible {
  background: white;
  outline: 2px solid rgb(159 29 29 / 26%);
  outline-offset: 2px;
}

.page-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b0b0aa;
  font-size: 13px;
  pointer-events: none;
}

.placed-item {
  position: absolute;
  min-width: 36px;
  min-height: 28px;
  border: 1px solid transparent;
  transform-origin: center center;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.placed-item.is-selected {
  border-color: var(--focus);
}

.placed-item.is-replace-target {
  outline: 3px solid rgb(37 99 235 / 45%);
  outline-offset: 3px;
}

.placed-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.text-item {
  width: 100%;
  min-height: 100%;
  padding: 6px;
  outline: 0;
  white-space: pre-wrap;
  cursor: move;
}

.placed-item.is-editing,
.placed-item.is-editing .text-item {
  cursor: text;
  user-select: text;
}

.move-handle {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--focus);
  cursor: grab;
  opacity: 0;
}

.move-handle:active {
  cursor: grabbing;
}

.placed-item.is-selected .move-handle,
.placed-item.is-selected .resize-handle,
.placed-item.is-selected .rotate-handle {
  opacity: 1;
}

.resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--focus);
  cursor: nwse-resize;
  opacity: 0;
}

.rotate-handle {
  position: absolute;
  right: -12px;
  top: -28px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
  color: var(--focus);
  cursor: grab;
  opacity: 0;
}

.rotate-handle::before {
  content: "↻";
  font-size: 15px;
  line-height: 1;
}

.rotate-handle:active {
  cursor: grabbing;
}

.ds-page {
  background: var(--background);
}

.ds-shell {
  width: min(1120px, calc(100% - 32px));
  display: grid;
  gap: 18px;
  margin: 0 auto;
  padding: 32px 0 56px;
}

.ds-hero,
.ds-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 24px;
}

.ds-hero {
  display: grid;
  gap: 24px;
}

.ds-hero h1,
.ds-section h2 {
  margin: 0;
  color: var(--foreground);
  line-height: 1.05;
  letter-spacing: 0;
}

.ds-hero h1 {
  max-width: 760px;
  font-size: 38px;
}

.ds-hero p:last-child {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted-foreground);
}

.ds-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.ds-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.ds-token {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  padding: 10px;
}

.ds-token span {
  height: 54px;
  border: 1px solid rgb(0 0 0 / 10%);
  border-radius: 8px;
  background: var(--token);
}

.ds-token strong,
.ds-token small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-token small {
  color: var(--muted-foreground);
}

.ds-toolbar-demo {
  justify-content: flex-start;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 14px;
  }

  .editor-view {
    grid-template-columns: 1fr;
  }

  .asset-tray {
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .tray-head {
    align-items: center;
  }

  .agent-panel--dock {
    position: static;
    width: auto;
    margin: 12px 14px 0;
    border-radius: 8px;
    box-shadow: none;
  }

.agent-prompt textarea {
  min-height: 86px;
}

  .asset-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .asset-card {
    width: 104px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .asset-thumb {
    width: 104px;
  }

  .editor-toolbar {
    top: 56px;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    padding: 10px 14px;
  }

  .toolbar-title {
    width: 100%;
  }

  .toolbar-rail {
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .object-toolbar {
    position: static;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
  }

  .object-toolbar label {
    flex: 1 1 130px;
  }

  .object-toolbar input[type="range"] {
    width: 100%;
  }

  .page-grid {
    grid-template-columns: minmax(0, min(100%, 420px));
    gap: 22px;
    padding: 18px 14px 72px;
  }

  .ds-section {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 520px) {
  .topbar {
    min-height: 56px;
    height: auto;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-block: 8px;
  }

  .brand span {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar__actions {
    gap: 6px;
  }

  .topbar__actions .muted,
  .topbar__actions .plan-chip {
    display: none;
  }

  main {
    min-height: calc(100vh - 72px);
  }

  .login-view,
  .upload-view {
    min-height: calc(100vh - 72px);
    padding: 14px;
  }

  .login-card,
  .upload-card {
    gap: 14px;
    border-radius: 14px;
    padding: 18px;
  }

  .login-card h1,
  .upload-card h1 {
    font-size: 24px;
  }

  .dropzone {
    min-height: 220px;
  }

  .upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  select,
  .primary-button,
  .secondary-button,
  .text-button,
  .danger-button {
    min-height: 44px;
  }

  .asset-tray {
    padding: 10px;
  }

  .tray-head {
    margin-bottom: 10px;
  }

  .tray-head__actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
  }

  .template-panel,
  .agent-panel {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .editor-toolbar {
    position: static;
  }

  .page-grid {
    padding: 14px 10px 56px;
  }

  .page-remove {
    width: 34px;
    height: 34px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .asset-remove {
    width: 32px;
    height: 32px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .page-remove {
    width: 34px;
    height: 34px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .move-handle {
    left: -11px;
    top: -11px;
    width: 22px;
    height: 22px;
  }

  .resize-handle {
    right: -11px;
    bottom: -11px;
    width: 22px;
    height: 22px;
  }

  .rotate-handle {
    right: -14px;
    top: -38px;
    width: 34px;
    height: 34px;
  }
}
