:root {
  --app-font-family: "Segoe UI", "Noto Sans JP", "Noto Sans KR", "Hiragino Sans", "Yu Gothic", "Malgun Gothic", sans-serif;
  --bg-start: #f6f2eb;
  --bg-mid: #eadfd4;
  --bg-end: #efe8df;
  --glow-1: rgba(255, 255, 255, 0.75);
  --glow-2: rgba(207, 180, 172, 0.35);
  --grid-line: rgba(255, 255, 255, 0.15);
  --panel: rgba(255, 250, 244, 0.72);
  --panel-strong: rgba(255, 248, 239, 0.92);
  --panel-alt: rgba(255, 249, 241, 0.52);
  --panel-solid: rgb(255, 248, 239);
  --composer-surface: rgba(250, 244, 236, 0.94);
  --composer-border: rgba(60, 45, 31, 0.16);
  --generate-tile: #151515;
  --create-brand-neutral: #4a4a4a;
  --border: rgba(60, 45, 31, 0.12);
  --text: #201815;
  --muted: #6d5b51;
  --ink: #1e1c1a;
  --headline: #201815;
  --surface-text: #58473f;
  --inverse-text: #f3ece3;
  --button-text: #f7f1ea;
  --soft-surface: rgba(255, 252, 248, 0.8);
  --chip-surface: rgba(255, 252, 247, 0.72);
  --chip-active: rgba(31, 25, 23, 0.92);
  --chip-active-text: #f4ece4;
  --header-surface: rgba(255, 250, 244, 0.66);
  --nav-surface: rgba(255, 255, 255, 0.38);
  --nav-active: rgba(34, 28, 25, 0.9);
  --nav-active-text: #f8f3ed;
  --caption-surface: rgba(249, 241, 232, 0.7);
  --status-surface: rgba(255, 252, 247, 0.75);
  --accent-card: rgba(38, 30, 27, 0.93);
  --accent-card-muted: rgba(243, 236, 227, 0.75);
  --shadow: 0 30px 80px rgba(34, 26, 22, 0.12);

  /* Semantic color contract. Existing tokens remain the compatibility source. */
  --surface-primary: var(--panel);
  --surface-secondary: var(--panel-alt);
  --surface-elevated: var(--panel-strong);
  --surface-opaque: var(--panel-solid);
  --surface-input: var(--composer-surface);
  --surface-soft: var(--soft-surface);
  --surface-navigation: var(--nav-surface);
  --surface-header: var(--header-surface);
  --surface-caption: var(--caption-surface);
  --surface-status: var(--status-surface);
  --surface-workspace: var(--panel-alt);
  --surface-overlay: rgba(8, 10, 16, 0.64);
  --surface-interactive: var(--composer-surface);
  --surface-content-elevated: var(--panel-alt);

  --text-primary: var(--text);
  --text-secondary: var(--surface-text);
  --text-muted: var(--muted);
  --text-placeholder: var(--muted);
  --text-placeholder-strong: var(--muted);
  --text-disabled: var(--text);
  --text-headline: var(--headline);
  --text-inverse: var(--inverse-text);
  --text-on-action: var(--button-text);
  --text-section-label: var(--muted);
  --text-metadata: var(--muted);

  --border-subtle: var(--border);
  --border-standard: var(--border);
  --border-functional: var(--border);
  --border-input: var(--border);
  --border-selected: var(--accent, var(--text));
  --focus-ring: var(--accent);

  --accent-identity: var(--accent, var(--ink));
  --accent-focus: var(--accent);
  --active-fill: var(--nav-active);
  --active-text: var(--nav-active-text);
  --selected-fill: var(--chip-active);
  --selected-text: var(--chip-active-text);
  --selected-line: var(--accent, var(--text));

  --destructive: #a23d3d;
  --destructive-hover: #a23d3d;
  --favorite: #c06f97;
  --success: rgba(76, 175, 80, 0.9);
  --warning: rgba(255, 193, 7, 0.95);
  --information: rgba(33, 150, 243, 0.9);

  --catalog-edge: rgba(66, 57, 52, 0.72);
  --catalog-edge-active: var(--accent, #574b45);
  --scrollbar: rgba(117, 111, 104, 0.24);
  --scrollbar-hover: rgba(117, 111, 104, 0.36);
  --skeleton-low: rgba(255, 255, 255, 0.08);
  --skeleton-high: rgba(255, 255, 255, 0.16);
  --chat-user-surface: var(--chip-active);
  --chat-assistant-surface: var(--panel-alt);
  --chat-muted-surface: var(--panel-alt);
}

/* C7 Canvas workspace: functional desktop layout only; existing theme tokens remain authoritative. */
.canvas-c7-main { min-height: 100vh; }
.canvas-list-view { min-height: 100vh; padding: 48px clamp(28px, 5vw, 72px); background: var(--background); }
.canvas-list-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); gap: 36px; align-items: end; }
.canvas-list-header h1 { margin: 0; font-size: clamp(3rem, 7vw, 6.8rem); font-weight: 500; }
.canvas-list-header p:not(.eyebrow) { max-width: 660px; color: var(--text-metadata); }
.canvas-create-form { display: flex; align-items: end; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 22px; background: var(--panel-surface); }
.canvas-create-form label, .canvas-generation-fields label { display: grid; gap: 7px; flex: 1; color: var(--text-section-label); font-size: .82rem; }
.canvas-create-form input, .canvas-generation-fields input, .canvas-generation-fields select, .canvas-generation-fields textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-surface); color: var(--text); padding: 10px 12px;
}
.canvas-inline-status { min-height: 22px; color: var(--text-metadata); }
.canvas-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 34px; }
.canvas-list-card { position: relative; aspect-ratio: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 24px; border: 1px solid var(--border); border-radius: 24px; background: var(--panel-surface); box-shadow: var(--shadow); cursor: pointer; }
.canvas-list-card:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.canvas-list-card-information { width: 100%; margin-top: auto; text-align: left; }
.canvas-list-card-information[hidden] { display: none; }
.canvas-list-card h2 { margin: 0 0 8px; font-size: 2rem; }
.canvas-list-card p { margin: 0; color: var(--text-metadata); font-size: .82rem; }
.canvas-list-rename-form { display: flex; width: 100%; align-items: center; gap: 8px; margin-top: auto; cursor: default; }
.canvas-list-rename-form[hidden] { display: none; }
.canvas-list-rename-form .button { margin-top: 0; }
.canvas-list-card .canvas-list-secondary-action { position: relative; z-index: 2; font-size: 12px !important; }
.canvas-list-card .canvas-list-secondary-action::after { content: none !important; }
.canvas-list-rename-form input { min-width: 0; flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-surface); color: var(--text); }
.canvas-list-actions-trigger { position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.canvas-list-actions-trigger svg { width: 18px; height: 18px; fill: currentColor; pointer-events: none; }
.canvas-list-actions-trigger:hover, .canvas-list-actions-trigger:focus-visible, .canvas-list-actions-trigger[aria-expanded="true"] { border-color: var(--border); background: var(--panel-alt); }
.canvas-list-actions-trigger:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.canvas-list-actions-menu { position: fixed; z-index: 1200; display: grid; width: min(164px, calc(100vw - 24px)); gap: 2px; padding: 6px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); box-shadow: 0 12px 28px rgb(0 0 0 / 18%); }
.canvas-list-actions-menu-item { display: flex; width: 100%; min-height: 36px; align-items: center; gap: 9px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: .75rem; font-weight: 600; text-align: left; cursor: pointer; }
.canvas-list-actions-menu-item svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.canvas-list-actions-menu-item:hover, .canvas-list-actions-menu-item:focus-visible { background: var(--panel-alt); }
.canvas-list-actions-menu-item:focus-visible { outline: 2px solid var(--text); outline-offset: -1px; }
.canvas-list-actions-menu-item.is-destructive { color: var(--destructive); }
.canvas-list-actions-menu-item.is-destructive:hover, .canvas-list-actions-menu-item.is-destructive:focus-visible { background: color-mix(in srgb, var(--destructive-hover) 9%, transparent); outline-color: var(--destructive-hover); }
.canvas-list-delete-confirmation { position: fixed; z-index: 1200; display: grid; width: min(220px, calc(100vw - 24px)); gap: 7px; padding: 12px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); box-shadow: 0 12px 28px rgb(0 0 0 / 18%); }
.canvas-list-delete-title { margin: 0; color: var(--text); font-size: .78rem; font-weight: 650; line-height: 1.3; }
.canvas-list-delete-copy { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.canvas-list-delete-confirmation-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.canvas-list-delete-confirmation-actions button { min-height: 30px; padding: 5px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: .7rem; font-weight: 600; line-height: 1.25; cursor: pointer; }
.canvas-list-delete-confirmation-actions button:hover, .canvas-list-delete-confirmation-actions button:focus-visible { background: var(--panel-alt); }
.canvas-list-delete-confirmation-actions button:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.canvas-list-delete-confirmation-actions .canvas-list-delete-confirm { border-color: color-mix(in srgb, var(--destructive) 38%, transparent); color: var(--destructive); }
.canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:hover, .canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:focus-visible { border-color: var(--destructive-hover); background: var(--destructive-hover); color: #fff; outline-color: var(--destructive-hover); }
.canvas-list-delete-confirmation-actions button:disabled { opacity: .55; cursor: wait; }
.canvas-empty { color: var(--text-metadata); }

.canvas-workspace { height: 100vh; overflow: hidden; background: var(--background); }
html:has(body[data-page="canvas"] #canvas-workspace:not([hidden])) { height: 100%; overflow: hidden; }
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) .page-shell.canvas-c7-shell,
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) .canvas-c7-main {
  box-sizing: border-box;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) .canvas-c7-main { padding-top: 0; }
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) .canvas-workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.canvas-floating-controls { position: absolute; z-index: 9; top: 12px; left: 50%; width: max-content; max-width: calc(100% - 36px); pointer-events: none; transform: translateX(-50%); }
.canvas-floating-controls > * { pointer-events: auto; }
.canvas-save-error { position: absolute; top: 50%; left: calc(100% + 12px); padding: 7px 10px; border: 1px solid color-mix(in srgb, var(--destructive) 30%, var(--border)); border-radius: 9px; background: var(--panel-solid); color: var(--destructive); font-size: .78rem; font-weight: 600; line-height: 1; white-space: nowrap; transform: translateY(-50%); }
.canvas-save-error[hidden] { display: none; }
.canvas-board-shell { position: relative; box-sizing: border-box; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; background: var(--panel-alt); }
body[data-page="canvas"]:has(#canvas-workspace:not([hidden])) .canvas-board-shell { align-self: stretch; justify-self: stretch; width: 100%; height: 100%; }
.canvas-c7-viewport { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: auto; cursor: grab; overscroll-behavior: contain; background: transparent; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent; }
.canvas-c7-viewport:hover, .canvas-c7-viewport:focus-visible, .canvas-c7-viewport.is-panning, .canvas-c7-viewport.is-scrolling { scrollbar-color: color-mix(in srgb, var(--muted) 68%, transparent) transparent; }
.canvas-c7-viewport::-webkit-scrollbar-track, .canvas-c7-viewport::-webkit-scrollbar-corner { background: transparent; box-shadow: none; }
.canvas-c7-viewport::-webkit-scrollbar-thumb { border-radius: 999px; background: color-mix(in srgb, var(--muted) 38%, transparent); }
.canvas-c7-viewport:hover::-webkit-scrollbar-thumb, .canvas-c7-viewport:focus-visible::-webkit-scrollbar-thumb, .canvas-c7-viewport.is-panning::-webkit-scrollbar-thumb, .canvas-c7-viewport.is-scrolling::-webkit-scrollbar-thumb, .canvas-c7-viewport::-webkit-scrollbar-thumb:hover, .canvas-c7-viewport::-webkit-scrollbar-thumb:active { background: color-mix(in srgb, var(--muted) 68%, transparent); }
.canvas-c7-viewport.is-panning { cursor: grabbing; }
.canvas-c7-stage { position: relative; min-width: 100%; min-height: 100%; }
.canvas-c7-world { position: absolute; inset: 0 auto auto 0; transform-origin: top left; background-color: transparent; background-image: radial-gradient(circle, rgba(70, 64, 60, .26) 1px, transparent 1.2px); background-size: 28px 28px; }
.canvas-zoom-toolbar { position: static; z-index: 7; display: flex; align-items: center; flex: 0 0 auto; gap: 7px; padding: 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--composer-surface); box-shadow: var(--shadow); }
.canvas-tool-button { min-width: 36px; height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-surface); color: var(--text); cursor: pointer; }
.canvas-tool-button:disabled { opacity: .55; cursor: wait; }
.canvas-back-control { position: absolute; top: 50%; right: auto; left: var(--canvas-back-offset-x, -64px); display: grid; place-items: center; width: 52px; min-width: 52px; height: 52px; padding: 0; border-radius: 999px; background: var(--composer-surface); box-shadow: var(--shadow); transform: translateY(-50%); }
.canvas-back-control svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.canvas-back-control::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 8px); left: 50%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); font-size: 11px; font-weight: 600; line-height: 1.25; white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; transform: translateX(-50%); }
.canvas-back-control:hover::after, .canvas-back-control:focus-visible::after { opacity: 1; visibility: visible; }
.canvas-upload-control { position: relative; display: flex; align-items: center; }
.canvas-upload-menu { position: absolute; z-index: 10; top: calc(100% + 15px); right: 0; display: grid; min-width: 168px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); box-shadow: var(--shadow); opacity: 1; }
.canvas-upload-menu[hidden] { display: none; }
.canvas-upload-menu button { padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.canvas-upload-menu button:hover, .canvas-upload-menu button:focus-visible { background: var(--panel-alt); }
.canvas-upload-menu button:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

.canvas-collage-item { position: absolute; touch-action: none; user-select: none; cursor: grab; transform-origin: center; will-change: left, top, width, height, transform; }
.canvas-collage-item.is-selected { outline: 1px solid var(--text); outline-offset: 3px; }
.canvas-collage-item.is-reference::after { content: "Reference"; position: absolute; top: 8px; left: 8px; z-index: 3; padding: 5px 8px; border-radius: 999px; background: rgba(20, 18, 17, .82); color: #fff; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.canvas-crop-frame { position: absolute; inset: 0; overflow: hidden; background: transparent; }
.canvas-crop-frame img { position: absolute; display: block; max-width: none; transform-origin: center; pointer-events: none; }
.canvas-collage-item .canvas-resize-handle { display: none; position: absolute; z-index: 6; width: calc(12px * var(--canvas-control-scale, 1)); height: calc(12px * var(--canvas-control-scale, 1)); padding: 0; border: calc(2px * var(--canvas-control-scale, 1)) solid var(--panel-solid); border-radius: 50%; background: var(--text); opacity: 1; pointer-events: auto; }
.canvas-collage-item.is-selected .canvas-resize-handle { display: block; }
.canvas-resize-handle[data-resize-corner="nw"] { top: calc(-6px * var(--canvas-control-scale, 1)); left: calc(-6px * var(--canvas-control-scale, 1)); cursor: nwse-resize; }
.canvas-resize-handle[data-resize-corner="ne"] { top: calc(-6px * var(--canvas-control-scale, 1)); right: calc(-6px * var(--canvas-control-scale, 1)); cursor: nesw-resize; }
.canvas-resize-handle[data-resize-corner="se"] { right: calc(-6px * var(--canvas-control-scale, 1)); bottom: calc(-6px * var(--canvas-control-scale, 1)); cursor: nwse-resize; }
.canvas-resize-handle[data-resize-corner="sw"] { bottom: calc(-6px * var(--canvas-control-scale, 1)); left: calc(-6px * var(--canvas-control-scale, 1)); cursor: nesw-resize; }
.canvas-rotation-handle { display: none; position: absolute; z-index: 7; bottom: calc(-48px * var(--canvas-control-scale, 1)); left: 50%; width: calc(30px * var(--canvas-control-scale, 1)); height: calc(30px * var(--canvas-control-scale, 1)); margin-left: calc(-15px * var(--canvas-control-scale, 1)); padding: 0; border: 0; background: transparent; color: var(--text); cursor: grab; }
.canvas-collage-item.is-selected .canvas-rotation-handle { display: block; }
.canvas-rotation-handle::before { content: ""; position: absolute; top: calc(-18px * var(--canvas-control-scale, 1)); left: 50%; width: calc(1px * var(--canvas-control-scale, 1)); height: calc(18px * var(--canvas-control-scale, 1)); background: currentColor; pointer-events: none; transform: translateX(-50%); }
.canvas-rotation-handle::after { content: ""; position: absolute; right: calc(1px * var(--canvas-control-scale, 1)); bottom: calc(1px * var(--canvas-control-scale, 1)); left: calc(1px * var(--canvas-control-scale, 1)); aspect-ratio: 1; border: calc(1px * var(--canvas-control-scale, 1)) solid var(--border); border-radius: 50%; background: var(--panel-solid); box-shadow: 0 calc(3px * var(--canvas-control-scale, 1)) calc(10px * var(--canvas-control-scale, 1)) rgba(20, 18, 17, .12); pointer-events: none; }
.canvas-rotation-handle svg { position: absolute; z-index: 1; right: calc(7px * var(--canvas-control-scale, 1)); bottom: calc(7px * var(--canvas-control-scale, 1)); width: calc(16px * var(--canvas-control-scale, 1)); height: calc(16px * var(--canvas-control-scale, 1)); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.canvas-rotation-handle.is-rotating { cursor: grabbing; }
.canvas-crop-edge-handle { display: none; position: absolute; z-index: 6; padding: 0; border: 0; background: transparent; color: var(--text); }
.canvas-collage-item.is-selected .canvas-crop-edge-handle { display: block; }
.canvas-crop-edge-handle::after { content: ""; position: absolute; border-radius: 999px; background: currentColor; opacity: .38; transition: opacity 120ms ease, transform 120ms ease; }
.canvas-crop-edge-handle:hover::after, .canvas-crop-edge-handle:focus-visible::after, .canvas-crop-edge-handle.is-active::after { opacity: 1; }
.canvas-crop-edge-handle:focus-visible { outline: 0; }
.canvas-crop-edge-handle[data-crop-edge="top"], .canvas-crop-edge-handle[data-crop-edge="bottom"] { left: 50%; width: calc(44px * var(--canvas-control-scale, 1)); height: calc(14px * var(--canvas-control-scale, 1)); margin-left: calc(-22px * var(--canvas-control-scale, 1)); cursor: ns-resize; }
.canvas-crop-edge-handle[data-crop-edge="top"] { top: calc(-7px * var(--canvas-control-scale, 1)); }
.canvas-crop-edge-handle[data-crop-edge="bottom"] { bottom: calc(-7px * var(--canvas-control-scale, 1)); }
.canvas-crop-edge-handle[data-crop-edge="top"]::after, .canvas-crop-edge-handle[data-crop-edge="bottom"]::after { top: 50%; left: 50%; width: calc(24px * var(--canvas-control-scale, 1)); height: calc(2px * var(--canvas-control-scale, 1)); transform: translate(-50%, -50%); }
.canvas-crop-edge-handle[data-crop-edge="left"], .canvas-crop-edge-handle[data-crop-edge="right"] { top: 50%; width: calc(14px * var(--canvas-control-scale, 1)); height: calc(44px * var(--canvas-control-scale, 1)); margin-top: calc(-22px * var(--canvas-control-scale, 1)); cursor: ew-resize; }
.canvas-crop-edge-handle[data-crop-edge="left"] { left: calc(-7px * var(--canvas-control-scale, 1)); }
.canvas-crop-edge-handle[data-crop-edge="right"] { right: calc(-7px * var(--canvas-control-scale, 1)); }
.canvas-crop-edge-handle[data-crop-edge="left"]::after, .canvas-crop-edge-handle[data-crop-edge="right"]::after { top: 50%; left: 50%; width: calc(2px * var(--canvas-control-scale, 1)); height: calc(24px * var(--canvas-control-scale, 1)); transform: translate(-50%, -50%); }

.canvas-item-context-toolbar { position: absolute; z-index: 1000002; display: grid; justify-items: center; gap: 6px; }
.canvas-item-context-toolbar[hidden], .canvas-item-context-row[hidden], .canvas-arrange-menu[hidden], .canvas-rotation-feedback[hidden] { display: none; }
.canvas-item-context-row { display: flex; align-items: center; gap: 3px; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); box-shadow: var(--shadow); }
.canvas-item-context-row button { position: relative; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.canvas-item-context-row button:hover, .canvas-item-context-row button:focus-visible, .canvas-item-context-row button[aria-expanded="true"], .canvas-item-context-row button[aria-pressed="true"] { background: var(--panel-alt); }
.canvas-item-context-row button:focus-visible, .canvas-arrange-menu button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.canvas-item-context-row svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.canvas-item-context-row button[data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 9px); z-index: 3; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); font-size: 11px; font-weight: 600; line-height: 1.25; white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; transform: translateX(-50%); }
.canvas-item-context-row button[data-tooltip]:hover::after, .canvas-item-context-row button[data-tooltip]:focus-visible::after { opacity: 1; visibility: visible; }
.canvas-item-context-toolbar[data-placement="below"] .canvas-item-context-row button[data-tooltip]::after { top: calc(100% + 9px); bottom: auto; }
.canvas-item-context-row .canvas-item-remove-button:hover, .canvas-item-context-row .canvas-item-remove-button:focus-visible { background: color-mix(in srgb, var(--destructive-hover) 10%, transparent); color: var(--destructive-hover); }
.canvas-rotation-feedback { min-width: 42px; padding: 0 6px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.canvas-arrange-menu { position: absolute; z-index: 4; display: grid; min-width: 164px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); box-shadow: var(--shadow); }
.canvas-item-context-toolbar[data-placement="above"] .canvas-arrange-menu { right: 0; top: calc(100% + 6px); }
.canvas-item-context-toolbar[data-placement="below"] .canvas-arrange-menu { right: 0; bottom: calc(100% + 6px); }
.canvas-arrange-menu button { padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.canvas-arrange-menu button:hover, .canvas-arrange-menu button:focus-visible { background: var(--panel-alt); }

.canvas-generation-panel { position: absolute; z-index: 7; right: 18px; bottom: 18px; width: min(410px, calc(100% - 36px)); border: 1px solid var(--border); border-radius: 18px; background: var(--composer-surface); box-shadow: var(--shadow); }
.canvas-generation-panel summary { cursor: pointer; padding: 13px 16px; font-weight: 600; }
.canvas-generation-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 16px; max-height: min(520px, calc(100vh - 160px)); overflow: auto; }
.canvas-generation-fields .canvas-generation-prompt, .canvas-generation-fields #canvas-reference-count, .canvas-generation-fields #canvas-generate { grid-column: 1 / -1; }
.canvas-generation-fields .canvas-inline-check { display: flex; align-items: center; gap: 8px; }
.canvas-generation-fields .canvas-inline-check input { width: auto; }
.canvas-generation-fields p { margin: 0; color: var(--muted); font-size: .78rem; }

.canvas-dialog { width: min(980px, calc(100% - 48px)); max-height: calc(100vh - 56px); padding: 0; border: 0; border-radius: 24px; background: transparent; }
.canvas-dialog::backdrop { background: rgba(15, 13, 12, .55); backdrop-filter: blur(5px); }
.canvas-dialog-card { position: relative; display: grid; gap: 16px; max-height: calc(100vh - 56px); padding: 24px; border: 1px solid var(--border); border-radius: 24px; background: var(--panel-strong); color: var(--text); overflow: auto; }
.canvas-dialog-card > header, .canvas-dialog-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.canvas-dialog-card h2 { margin: 0; font-size: 2.3rem; }
.canvas-dialog-card header button { border: 0; background: transparent; color: var(--text); font-size: 2rem; cursor: pointer; }
.canvas-remove-dialog { width: min(440px, calc(100% - 40px)); }
.canvas-remove-dialog-card { grid-template-columns: auto 1fr; gap: 16px; padding: 24px; overflow: visible; }
.canvas-remove-dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid color-mix(in srgb, var(--destructive) 35%, transparent); border-radius: 12px; color: var(--destructive); }
.canvas-remove-dialog-icon svg { width: 21px; height: 21px; }
.canvas-remove-dialog-copy { min-width: 0; }
.canvas-remove-dialog-card .canvas-remove-dialog-copy h2 { margin: 1px 0 8px; font-size: 1.25rem; line-height: 1.25; }
.canvas-remove-dialog-copy p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.canvas-remove-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.canvas-remove-confirm { border-color: color-mix(in srgb, var(--destructive) 42%, var(--border)); background: transparent; color: var(--destructive); }
.canvas-remove-confirm:hover, .canvas-remove-confirm:focus-visible { border-color: var(--destructive-hover); background: var(--destructive-hover); color: #fff; }
.canvas-remove-confirm:disabled { opacity: .55; cursor: wait; }
.canvas-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; overflow: auto; }
.canvas-library-option { position: relative; display: grid; gap: 7px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.canvas-library-option input { position: absolute; top: 12px; right: 12px; z-index: 2; }
.canvas-library-option img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; }
.canvas-library-option span { color: var(--muted); font-size: .72rem; }
.canvas-toast { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); min-height: 0; max-width: min(600px, calc(100% - 40px)); padding: 0; border-radius: 999px; background: var(--text); color: var(--panel-surface); font-size: .84rem; box-shadow: var(--shadow); }
.canvas-toast:not(:empty) { padding: 10px 16px; }
.canvas-toast.is-error { background: #7c2f2d; color: #fff; }

@media (min-width: 1101px) {
  body[data-page="canvas"] .canvas-c7-shell { width: calc(100% - 268px); margin-left: 268px; }
  body[data-page="canvas"].collapsed-sidebar .canvas-c7-shell { width: 100%; margin-left: 0; }
}
html[data-theme="light"] {
  --bg-start: #f3f4f5;
  --bg-mid: #e8ebed;
  --bg-end: #f1f2f3;
  --glow-1: rgba(255, 255, 255, 0.84);
  --glow-2: rgba(122, 136, 148, 0.1);
  --grid-line: rgba(67, 78, 88, 0.06);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #56616a;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 28px 70px rgba(39, 48, 56, 0.12);

  --surface-workspace: #f3f4f5;
  --surface-navigation: #eaeced;
  --surface-header: #f6f7f7;
  --surface-primary: #f9fafa;
  --surface-secondary: #eef0f1;
  --surface-soft: #e8ebed;
  --surface-input: #e1e5e8;
  --surface-opaque: #ffffff;
  --surface-content-elevated: #e4e8eb;
  --surface-interactive: #dde2e6;
  --surface-elevated: #ffffff;
  --surface-caption: #eceff0;
  --surface-status: #f0f2f3;
  --surface-overlay: rgba(20, 24, 28, 0.5);
  --text-headline: #171a1d;
  --text-primary: #202428;
  --text-secondary: #3e464d;
  --text-section-label: #4f5962;
  --text-metadata: #5c6670;
  --text-muted: #56616a;
  --text-placeholder: #00070d;
  --text-placeholder-strong: #3a434b;
  --text-disabled: #69727a;
  --text-inverse: #fafbfc;
  --text-on-action: #fafbfc;
  --border-subtle: #d5d9dc;
  --border-standard: #b8bfc4;
  --border-functional: #68737c;
  --border-input: #68737c;
  --border-selected: #46545f;
  --focus-ring: #3f4c58;
  --accent-identity: #4b5965;
  --accent-focus: #3f4c58;
  --active-fill: #20252a;
  --active-text: #fafbfc;
  --selected-fill: #d4dade;
  --selected-text: #1d252c;
  --selected-line: #46545f;
  --destructive: #b4232c;
  --destructive-hover: #941c24;
  --favorite: #a83f72;
  --success: #247847;
  --warning: #8a5b00;
  --information: #1f64a4;
  --catalog-edge: #5e6972;
  --catalog-edge-active: #202930;
  --scrollbar: #8b949b;
  --scrollbar-hover: #66717a;
  --skeleton-low: #e2e5e7;
  --skeleton-high: #cbd1d5;
  --chat-user-surface: #dde2e6;
  --chat-assistant-surface: #e4e8eb;
  --chat-muted-surface: #eef0f1;
  --panel-surface: var(--surface-primary);
  --background: #f3f4f5;
}

html[data-theme="titanium"] {
  --bg-start: #d9d6d1;
  --bg-mid: #c2bcb4;
  --bg-end: #cdc8c0;
  --glow-1: rgba(255, 255, 255, 0.44);
  --glow-2: rgba(142, 137, 130, 0.14);
  --grid-line: rgba(255, 255, 255, 0.12);
  --panel: rgba(218, 214, 208, 0.74);
  --panel-strong: rgba(214, 210, 204, 0.9);
  --panel-alt: rgba(210, 205, 199, 0.56);
  --panel-solid: rgb(214, 210, 204);
  --composer-surface: rgba(223, 219, 213, 0.94);
  --composer-border: rgba(76, 72, 68, 0.16);
  --generate-tile: #151515;
  --create-brand-neutral: #4a4744;
  --border: rgba(76, 72, 68, 0.14);
  --text: #262220;
  --muted: #6d6863;
  --ink: #221f1d;
  --headline: #262220;
  --surface-text: #5e5a56;
  --header-surface: rgba(215, 211, 205, 0.68);
  --nav-surface: rgba(236, 234, 230, 0.2);
  --caption-surface: rgba(217, 213, 207, 0.72);
  --status-surface: rgba(218, 214, 208, 0.76);
  --accent-card: rgba(40, 37, 35, 0.94);
  --accent-card-muted: rgba(230, 225, 219, 0.74);
  --shadow: 0 30px 78px rgba(34, 31, 28, 0.17);
}

html[data-theme="light-sand"] {
  --bg-start: #F1E9DF;
  --bg-mid: #E8DDCF;
  --bg-end: #E0D2C1;
  --glow-1: rgba(180, 145, 103, 0.045);
  --glow-2: rgba(134, 100, 67, 0.035);
  --grid-line: rgba(92, 72, 52, 0.055);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #6d5a49;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: #927A66;
  --shadow: 0 30px 76px rgba(74, 52, 31, 0.18);

  --surface-workspace: #E8DDCF;
  --surface-navigation: #f8f4ee;
  --surface-header: #f7f2eb;
  --surface-primary: #fbf8f3;
  --surface-secondary: #f2ebe1;
  --surface-soft: #f4eee7;
  --surface-input: #f7f3ed;
  --surface-opaque: #fffdf9;
  --surface-content-elevated: #f8f5f0;
  --surface-interactive: #f0ece6;
  --surface-elevated: #fffdfc;
  --surface-caption: #f5eee5;
  --surface-status: #f3ece3;
  --surface-overlay: rgba(52, 39, 26, 0.2);
  --text-headline: #2c241d;
  --text-primary: #352b23;
  --text-secondary: #5d5045;
  --text-section-label: #6d5a49;
  --text-metadata: #7b6a5a;
  --text-muted: #77695c;
  --text-placeholder: #1c1006;
  --text-placeholder-strong: #554a40;
  --text-disabled: #8c8176;
  --text-inverse: #fff9f2;
  --text-on-action: #fff9f2;
  --border-subtle: #ded2c4;
  --border-standard: #c1b09d;
  --border-functional: #947c65;
  --border-input: #947c65;
  --border-selected: #A89686;
  --focus-ring: #7B6655;
  --accent-identity: #927A66;
  --accent-focus: #7B6655;
  --active-fill: #7B6655;
  --active-text: #FFF9F2;
  --selected-fill: #E5DBD1;
  --selected-text: #443A33;
  --selected-line: #7B6655;
  --destructive: #a43f3b;
  --destructive-hover: #8d302d;
  --favorite: #a34667;
  --success: #4f755b;
  --warning: #8a5a1d;
  --information: #4b6d80;
  --catalog-edge: var(--border-selected);
  --catalog-edge-active: var(--selected-line);
  --scrollbar: #b8a48e;
  --scrollbar-hover: #967c63;
  --skeleton-low: #eee6dc;
  --skeleton-high: #e2d6c8;
  --chat-user-surface: #f0ece6;
  --chat-assistant-surface: #f8f5f0;
  --chat-muted-surface: #f2ebe1;
  --panel-surface: var(--surface-primary);
  --background: #E8DDCF;
}

html[data-theme="baby-pink"] {
  --bg-start: #faedf2;
  --bg-mid: #efd4de;
  --bg-end: #f6e5eb;
  --glow-1: rgba(255, 252, 253, 0.88);
  --glow-2: rgba(181, 95, 130, 0.12);
  --grid-line: rgba(95, 51, 70, 0.055);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #765568;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 30px 78px rgba(91, 48, 68, 0.16);

  --surface-workspace: #f8e9ef;
  --surface-navigation: #fff7fa;
  --surface-header: #fbeff3;
  --surface-primary: #fff7fa;
  --surface-secondary: #f4dde6;
  --surface-soft: #eccfd9;
  --surface-input: #e8c5d2;
  --surface-opaque: #fff9fb;
  --surface-content-elevated: #ebcad6;
  --surface-interactive: #e1b8c8;
  --surface-elevated: #fff8fb;
  --surface-caption: #f3dbe4;
  --surface-status: #f6e3ea;
  --surface-overlay: rgba(54, 29, 41, 0.46);
  --text-headline: #321d28;
  --text-primary: #3a2230;
  --text-secondary: #5b3b4c;
  --text-section-label: #70485b;
  --text-metadata: #765568;
  --text-muted: #6d4c5e;
  --text-placeholder: #080307;
  --text-placeholder-strong: #432937;
  --text-disabled: #8a6577;
  --text-inverse: #fff7fa;
  --text-on-action: #fff7fa;
  --border-subtle: #e4cbd5;
  --border-standard: #bb8da1;
  --border-functional: #8b5a70;
  --border-input: #8b5a70;
  --border-selected: #82425f;
  --focus-ring: #7b3f5c;
  --accent-identity: #b05b80;
  --accent-focus: #7b3f5c;
  --active-fill: #71364f;
  --active-text: #fff7fa;
  --selected-fill: #ddafc1;
  --selected-text: #321724;
  --selected-line: #82425f;
  --destructive: #b3263e;
  --destructive-hover: #922035;
  --favorite: #a83a74;
  --success: #2d7448;
  --warning: #895900;
  --information: #366b9b;
  --catalog-edge: #815065;
  --catalog-edge-active: #4f2438;
  --scrollbar: #a8788d;
  --scrollbar-hover: #80566a;
  --skeleton-low: #edd5df;
  --skeleton-high: #daafc0;
  --chat-user-surface: #e1b8c8;
  --chat-assistant-surface: #ebcad6;
  --chat-muted-surface: #f4dde6;
  --panel-surface: var(--surface-primary);
  --background: #f8e9ef;
}

html[data-theme="tiffany-blue"] {
  --bg-start: #e4f7f5;
  --bg-mid: #c9eeea;
  --bg-end: #dcf5f2;
  --glow-1: rgba(255, 255, 255, 0.86);
  --glow-2: rgba(35, 143, 139, 0.11);
  --grid-line: rgba(27, 91, 93, 0.055);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #456b6e;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 30px 78px rgba(18, 62, 64, 0.16);

  --surface-workspace: #ddf5f2;
  --surface-navigation: #f0fbfa;
  --surface-header: #e9f8f6;
  --surface-primary: #f1fbfa;
  --surface-secondary: #d1eeeb;
  --surface-soft: #c4e7e3;
  --surface-input: #b7ded9;
  --surface-opaque: #f8fefd;
  --surface-content-elevated: #bfe4e0;
  --surface-interactive: #a9d8d3;
  --surface-elevated: #f4fcfb;
  --surface-caption: #d0ece9;
  --surface-status: #dcf2f0;
  --surface-overlay: rgba(12, 55, 57, 0.44);
  --text-headline: #123236;
  --text-primary: #17363a;
  --text-secondary: #31575b;
  --text-section-label: #3d6265;
  --text-metadata: #456b6e;
  --text-muted: #41676a;
  --text-placeholder: #001012;
  --text-placeholder-strong: #173e40;
  --text-disabled: #5c7f81;
  --text-inverse: #f2fffe;
  --text-on-action: #f2fffe;
  --border-subtle: #c3e0dd;
  --border-standard: #79aaa7;
  --border-functional: #477c7b;
  --border-input: #477c7b;
  --border-selected: #1e7272;
  --focus-ring: #176d70;
  --accent-identity: #288f8c;
  --accent-focus: #176d70;
  --active-fill: #155e61;
  --active-text: #f2fffe;
  --selected-fill: #97cfcb;
  --selected-text: #123b3e;
  --selected-line: #1e7272;
  --destructive: #a82c38;
  --destructive-hover: #891f2a;
  --favorite: #9c3b70;
  --success: #1f7048;
  --warning: #7d5a00;
  --information: #17699b;
  --catalog-edge: #347675;
  --catalog-edge-active: #124a4d;
  --scrollbar: #6fa6a3;
  --scrollbar-hover: #477f7d;
  --skeleton-low: #c6e7e3;
  --skeleton-high: #a8d4cf;
  --chat-user-surface: #a9d8d3;
  --chat-assistant-surface: #bfe4e0;
  --chat-muted-surface: #d1eeeb;
  --panel-surface: var(--surface-primary);
  --background: #ddf5f2;
}

html[data-theme="baby-green"] {
  --bg-start: #edf6ed;
  --bg-mid: #d5e8d6;
  --bg-end: #e6f2e7;
  --glow-1: rgba(255, 255, 255, 0.86);
  --glow-2: rgba(73, 132, 82, 0.11);
  --grid-line: rgba(46, 94, 54, 0.055);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #566f59;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 30px 78px rgba(38, 77, 45, 0.15);

  --surface-workspace: #e8f3e9;
  --surface-navigation: #f5faf4;
  --surface-header: #eef7ee;
  --surface-primary: #f4faf4;
  --surface-secondary: #d7e9d8;
  --surface-soft: #cde2cf;
  --surface-input: #c3dac5;
  --surface-opaque: #fafdfa;
  --surface-content-elevated: #cbe1cd;
  --surface-interactive: #b7d3ba;
  --surface-elevated: #f7fcf7;
  --surface-caption: #d5e8d6;
  --surface-status: #e0eee1;
  --surface-overlay: rgba(20, 54, 28, 0.44);
  --text-headline: #1b3523;
  --text-primary: #203a28;
  --text-secondary: #3e5c45;
  --text-section-label: #4c684f;
  --text-metadata: #566f59;
  --text-muted: #4e694f;
  --text-placeholder: #000d03;
  --text-placeholder-strong: #24432b;
  --text-disabled: #6b826d;
  --text-inverse: #f5fff6;
  --text-on-action: #f5fff6;
  --border-subtle: #cadfcb;
  --border-standard: #83aa87;
  --border-functional: #557a59;
  --border-input: #557a59;
  --border-selected: #3f774a;
  --focus-ring: #2f6c3c;
  --accent-identity: #5f9067;
  --accent-focus: #2f6c3c;
  --active-fill: #32633c;
  --active-text: #f5fff6;
  --selected-fill: #a9ccae;
  --selected-text: #173d22;
  --selected-line: #3f774a;
  --destructive: #a82c38;
  --destructive-hover: #891f2a;
  --favorite: #9c3b70;
  --success: #236f43;
  --warning: #7d5a00;
  --information: #2b6695;
  --catalog-edge: #4d7454;
  --catalog-edge-active: #234d2e;
  --scrollbar: #7da180;
  --scrollbar-hover: #557b59;
  --skeleton-low: #d0e4d2;
  --skeleton-high: #b1d0b5;
  --chat-user-surface: #b7d3ba;
  --chat-assistant-surface: #cbe1cd;
  --chat-muted-surface: #d7e9d8;
  --panel-surface: var(--surface-primary);
  --background: #e8f3e9;
}

html[data-theme="midnight"] {
  --bg-start: #020611;
  --bg-mid: #030a18;
  --bg-end: #01030a;
  --glow-1: rgba(28, 66, 140, 0.055);
  --glow-2: rgba(7, 32, 84, 0.11);
  --grid-line: rgba(180, 210, 255, 0.045);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #717a90;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: #7faef0;
  --shadow: 0 34px 92px rgba(0, 2, 12, 0.7);

  --surface-workspace: #020611;
  --surface-navigation: #040b18;
  --surface-header: #061020;
  --surface-primary: #07111f;
  --surface-secondary: #0a1728;
  --surface-soft: #0d1b2e;
  --surface-input: #0f2036;
  --surface-opaque: #0c182a;
  --surface-content-elevated: #122741;
  --surface-interactive: #162d4b;
  --surface-elevated: #193352;
  --surface-caption: #0a1728;
  --surface-status: #0c1a2c;
  --surface-overlay: rgba(0, 2, 10, 0.78);

  --text-headline: #f8fbff;
  --text-primary: #edf4ff;
  --text-secondary: #cad7ea;
  --text-section-label: #afc0d7;
  --text-metadata: #8fa3bf;
  --text-muted: #91a4be;
  --text-placeholder: #c6defe;
  --text-placeholder-strong: #96acc9;
  --text-disabled: #687b96;
  --text-inverse: #061225;
  --text-on-action: #061225;

  --border-subtle: #14243a;
  --border-standard: #29415f;
  --border-functional: #5477a3;
  --border-input: #5477a3;
  --border-selected: #a9c9f2;
  --focus-ring: #9fc8ff;

  --accent-identity: #7faef0;
  --accent-focus: #9fc8ff;
  --active-fill: #e9f2ff;
  --active-text: #061429;
  --selected-fill: #dceaff;
  --selected-text: #07162b;
  --selected-line: #bed8ff;

  --destructive: #ff817c;
  --destructive-hover: #ff9a96;
  --favorite: #f18ab8;
  --success: #78d29a;
  --warning: #e9b967;
  --information: #82b8ff;

  --catalog-edge: #6788b2;
  --catalog-edge-active: #c3dbff;
  --scrollbar: #3c5473;
  --scrollbar-hover: #5c769b;
  --skeleton-low: #0b1828;
  --skeleton-high: #142841;
  --chat-user-surface: #162d4b;
  --chat-assistant-surface: #122741;
  --chat-muted-surface: #0a1728;
  --panel-surface: var(--surface-primary);
  --background: #020611;
}

html[data-theme="matte"],
html[data-theme="black"] {
  --bg-start: #10100f;
  --bg-mid: #171716;
  --bg-end: #0c0c0b;
  --glow-1: rgba(246, 242, 233, 0.035);
  --glow-2: rgba(126, 121, 112, 0.09);
  --grid-line: rgba(238, 234, 226, 0.035);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #aaa59d;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 34px 96px rgba(0, 0, 0, 0.52);

  --surface-workspace: #10100f;
  --surface-navigation: #141413;
  --surface-header: #171716;
  --surface-primary: #1a1a18;
  --surface-secondary: #22221f;
  --surface-soft: #272724;
  --surface-input: #2d2d29;
  --surface-opaque: #252523;
  --surface-content-elevated: #30302c;
  --surface-interactive: #373732;
  --surface-elevated: #3e3e38;
  --surface-caption: #22221f;
  --surface-status: #262623;
  --surface-overlay: rgba(0, 0, 0, 0.74);
  --text-headline: #faf8f3;
  --text-primary: #f1efea;
  --text-secondary: #d7d3cb;
  --text-section-label: #bdb8af;
  --text-metadata: #a6a098;
  --text-muted: #aaa59d;
  --text-placeholder: #f6f1e8;
  --text-placeholder-strong: #c8c2b8;
  --text-disabled: #817d76;
  --text-inverse: #151514;
  --text-on-action: #151514;
  --border-subtle: #33332f;
  --border-standard: #55534e;
  --border-functional: #7e7b74;
  --border-input: #7e7b74;
  --border-selected: #c9c4bb;
  --focus-ring: #d0cbc2;
  --accent-identity: #c7c1b7;
  --accent-focus: #d0cbc2;
  --active-fill: #eeeae2;
  --active-text: #151514;
  --selected-fill: #ddd8cf;
  --selected-text: #181816;
  --selected-line: #e3ded5;
  --destructive: #ff817c;
  --destructive-hover: #ff9a96;
  --favorite: #e98dba;
  --success: #7fc99b;
  --warning: #e5b96b;
  --information: #8db9e8;
  --catalog-edge: #8a8780;
  --catalog-edge-active: #e1dcd3;
  --scrollbar: #5f5d58;
  --scrollbar-hover: #7c7972;
  --skeleton-low: #232321;
  --skeleton-high: #343430;
  --chat-user-surface: #373732;
  --chat-assistant-surface: #30302c;
  --chat-muted-surface: #22221f;
  --panel-surface: var(--surface-primary);
  --background: #10100f;
}

html[data-theme="graphite"] {
  --bg-start: #202226;
  --bg-mid: #222428;
  --bg-end: #1d1f22;
  --glow-1: rgba(255, 255, 255, 0.028);
  --glow-2: rgba(151, 164, 179, 0.045);
  --grid-line: rgba(255, 255, 255, 0.045);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #9ba0a8;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.34);

  --surface-primary: #2b2e33;
  --surface-secondary: #34383e;
  --surface-elevated: #484d55;
  --surface-opaque: #3b3f45;
  --surface-input: #3a3e44;
  --surface-soft: #383c42;
  --surface-navigation: #24272b;
  --surface-header: #292c31;
  --surface-caption: #34383e;
  --surface-status: #35393f;
  --surface-workspace: #202226;
  --surface-overlay: rgba(0, 0, 0, 0.68);
  --surface-interactive: #454a52;
  --surface-content-elevated: #40444b;
  --text-primary: #f1f3f5;
  --text-secondary: #d0d4d9;
  --text-section-label: #bbc0c7;
  --text-metadata: #9ea4ac;
  --text-muted: #a7adb4;
  --text-placeholder: #ffffff;
  --text-placeholder-strong: #cdd2d8;
  --text-disabled: #7d838b;
  --text-headline: #ffffff;
  --text-inverse: #17191c;
  --text-on-action: #17191c;
  --border-subtle: #484d54;
  --border-standard: #5c626b;
  --border-functional: #858b94;
  --border-input: #858b94;
  --border-selected: #bec6d0;
  --focus-ring: #c7ced6;
  --accent-identity: #b9c2cc;
  --accent-focus: #c7ced6;
  --active-fill: #e6e8eb;
  --active-text: #151719;
  --selected-fill: #dce0e5;
  --selected-text: #17191c;
  --selected-line: #e0e5eb;
  --destructive: #ff817c;
  --destructive-hover: #ff9a96;
  --favorite: #e98dba;
  --success: #7fc99b;
  --warning: #e5b96b;
  --information: #8db9e8;
  --catalog-edge: #8b9099;
  --catalog-edge-active: #dde3ea;
  --scrollbar: #686c74;
  --scrollbar-hover: #848891;
  --skeleton-low: #414349;
  --skeleton-high: #52555b;
  --chat-user-surface: #454a52;
  --chat-assistant-surface: #40444b;
  --chat-muted-surface: #34383e;
  --panel-surface: var(--surface-primary);
  --background: #202226;
}

html[data-theme="pure-black"] {
  --bg-start: #000000;
  --bg-mid: #000000;
  --bg-end: #000000;
  --glow-1: rgba(255, 255, 255, 0);
  --glow-2: rgba(255, 255, 255, 0);
  --grid-line: rgba(255, 255, 255, 0);
  --panel: var(--surface-primary);
  --panel-strong: var(--surface-elevated);
  --panel-alt: var(--surface-secondary);
  --panel-solid: var(--surface-opaque);
  --composer-surface: var(--surface-interactive);
  --composer-border: var(--border-input);
  --generate-tile: var(--active-fill);
  --create-brand-neutral: #8a8a86;
  --border: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --ink: var(--text-primary);
  --headline: var(--text-headline);
  --surface-text: var(--text-secondary);
  --inverse-text: var(--text-inverse);
  --button-text: var(--text-on-action);
  --soft-surface: var(--surface-soft);
  --chip-surface: var(--surface-soft);
  --chip-active: var(--selected-fill);
  --chip-active-text: var(--selected-text);
  --header-surface: var(--surface-header);
  --nav-surface: var(--surface-navigation);
  --nav-active: var(--active-fill);
  --nav-active-text: var(--active-text);
  --caption-surface: var(--surface-caption);
  --status-surface: var(--surface-status);
  --accent-card: var(--surface-workspace);
  --accent-card-muted: var(--text-section-label);
  --accent: var(--accent-identity);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.72);

  --surface-primary: #0a0a0a;
  --surface-secondary: #151515;
  --surface-elevated: #282828;
  --surface-opaque: #1c1c1c;
  --surface-input: #1a1a1a;
  --surface-soft: #181818;
  --surface-navigation: #050505;
  --surface-header: #080808;
  --surface-caption: #121212;
  --surface-status: #151515;
  --surface-workspace: #000000;
  --surface-overlay: rgba(0, 0, 0, 0.82);
  --surface-interactive: #242424;
  --surface-content-elevated: #222222;
  --text-primary: #f4f4f2;
  --text-secondary: #d2d2ce;
  --text-section-label: #b8b8b4;
  --text-metadata: #969692;
  --text-muted: #969692;
  --text-placeholder: #d4d4ce;
  --text-placeholder-strong: #a5a5a0;
  --text-disabled: #737370;
  --text-headline: #ffffff;
  --text-inverse: #060606;
  --text-on-action: #060606;
  --border-subtle: #262626;
  --border-standard: #444444;
  --border-functional: #707070;
  --border-input: #707070;
  --border-selected: #c4c4c0;
  --focus-ring: #e2e2de;
  --accent-identity: #dadad6;
  --accent-focus: #e2e2de;
  --active-fill: #f3f3f0;
  --active-text: #060606;
  --selected-fill: #e8e8e4;
  --selected-text: #070707;
  --selected-line: #e2e2de;
  --destructive: #ff7a76;
  --destructive-hover: #ff9692;
  --favorite: #f08ab8;
  --success: #78d29a;
  --warning: #e9b967;
  --information: #8ab9ee;
  --catalog-edge: #737373;
  --catalog-edge-active: #e0e0de;
  --scrollbar: #4a4a4a;
  --scrollbar-hover: #686868;
  --skeleton-low: #111111;
  --skeleton-high: #202020;
  --chat-user-surface: #242424;
  --chat-assistant-surface: #222222;
  --chat-muted-surface: #151515;
  --panel-surface: var(--surface-primary);
  --background: #000000;
}

html[data-theme="graphite"] .canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:hover,
html[data-theme="graphite"] .canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:focus-visible,
html[data-theme="graphite"] .canvas-remove-confirm:hover,
html[data-theme="graphite"] .canvas-remove-confirm:focus-visible,
html[data-theme="graphite"] .image-delete-confirm.is-destructive:hover:not(:disabled),
html[data-theme="graphite"] .image-delete-confirm.is-destructive:focus-visible,
html[data-theme="graphite"] .chat-conversation-delete-confirmation button.is-danger:hover,
html[data-theme="graphite"] .chat-conversation-delete-confirmation button.is-danger:focus-visible,
html[data-theme="pure-black"] .canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:hover,
html[data-theme="pure-black"] .canvas-list-delete-confirmation-actions .canvas-list-delete-confirm:focus-visible,
html[data-theme="pure-black"] .canvas-remove-confirm:hover,
html[data-theme="pure-black"] .canvas-remove-confirm:focus-visible,
html[data-theme="pure-black"] .image-delete-confirm.is-destructive:hover:not(:disabled),
html[data-theme="pure-black"] .image-delete-confirm.is-destructive:focus-visible,
html[data-theme="pure-black"] .chat-conversation-delete-confirmation button.is-danger:hover,
html[data-theme="pure-black"] .chat-conversation-delete-confirmation button.is-danger:focus-visible {
  color: var(--text-on-action);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--app-font-family);
  background:
    radial-gradient(circle at top left, var(--glow-1), transparent 30%),
    radial-gradient(circle at 80% 20%, var(--glow-2), transparent 25%),
    linear-gradient(145deg, var(--bg-start) 0%, var(--bg-mid) 48%, var(--bg-end) 100%);
  transition: background 220ms ease, color 220ms ease;
}

body *,
body *::before,
body *::after,
body *::placeholder,
body *::file-selector-button {
  font-family: var(--app-font-family) !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 80%);
  opacity: 0.2;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

select,
option,
optgroup,
dialog {
  font-family: inherit;
}

.page-shell {
  width: min(1380px, calc(100% - 268px - 40px));
  margin: 0 auto;
  padding: 28px 0 56px;
  transition: width 260ms ease, margin-left 260ms ease;
}

body[data-page="home"] .page-shell {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1380px, calc(100% - 40px));
  margin: 0;
}

body[data-page="canvas"] .page-shell {
  width: 100%;
  margin: 0;
  padding: 0;
}

body[data-page="library"] .page-shell,
body[data-page="brands"] .page-shell,
body[data-page="collections"] .page-shell,
body[data-page="items"] .page-shell,
body[data-page="models"] .page-shell {
  width: min(1380px, calc(100% - 268px - 60px));
}

.brand-card {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 999px;
  background: var(--panel-surface);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 180ms ease;
  text-decoration: none;
  padding: 0;
  overflow: hidden;
}

.brand-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  border-color: rgba(255,255,255,0.16);
}

.brand-card:active {
  transform: translateY(0);
}

.brand-card-create {
  color: var(--muted);
  font-size: 28px;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 22px;
  padding: 24px 20px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: rgba(255, 250, 244, 0.66);
  background: var(--header-surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

@media (min-width: 1101px) {
  .app-sidebar {
    position: fixed;
    left: 20px;
    top: 28px;
    width: 240px;
    height: calc(100vh - 56px);
    z-index: 10;
  }

  .page-shell {
    margin-left: 268px;
  }

  body[data-page="home"] .page-shell {
    margin-left: 0;
  }

  body[data-page="library"] .page-shell,
  body[data-page="brands"] .page-shell,
  body[data-page="collections"] .page-shell,
  body[data-page="items"] .page-shell,
  body[data-page="models"] .page-shell {
    margin-left: 288px;
  }

  .page-shell > main {
    margin-left: 0;
  }
}

.sidebar-collapse-panel {
  margin-top: auto;
  display: flex;
  justify-content: flex-start;
}

.sidebar-collapse-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.sidebar-collapse-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.10);
  color: var(--text);
}

.sidebar-collapse-toggle:focus-visible {
  outline: 2px solid rgba(255,255,255,0.42);
  outline-offset: 2px;
}

.sidebar-restore-tab {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 18px 18px 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.sidebar-restore-tab:hover {
  transform: translateX(1px);
  background: var(--panel-strong);
  color: var(--text);
}

.sidebar-restore-tab:focus-visible {
  outline: 2px solid rgba(255,255,255,0.42);
  outline-offset: 2px;
}

body.collapsed-sidebar .app-sidebar {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  overflow: hidden;
}

body.collapsed-sidebar .app-sidebar > * {
  opacity: 0;
  pointer-events: none;
}

body.collapsed-sidebar:not([data-page="canvas"]) .page-shell {
  width: min(1380px, calc(100% - 40px));
  margin-left: 20px;
}

body.collapsed-sidebar .canvas-ui-overlay {
  padding-left: 60px !important;
}

.brand-mark {
  display: flex;
  box-sizing: border-box;
  width: 52px;
  height: 48px;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 4px 6px;
}

.maison-edna-logo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  object-position: center;
}

.home-top-brand {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 20;
}

.home-top-user {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
}

.site-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 4px;
  border-radius: 24px;
  background: var(--nav-surface);
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
}

.nav-expand {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}

.nav-submenu {
  display: none;
  gap: 6px;
  padding-left: 14px;
}

.nav-group.is-open .nav-submenu {
  display: grid;
}

.nav-sublink {
  padding: 8px 12px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-sublink.active {
  background: var(--chip-surface);
  color: var(--headline);
}

.nav-sublink-transversal {
  margin-top: 5px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 14px 14px;
}

.nav-link,
.nav-cta,
.button,
.tag-chip {
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease,
    border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.nav-link {
  padding: 12px 16px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: left;
}

.nav-link:hover,
.tag-chip:hover,
.button:hover,
.nav-cta:hover {
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--nav-active);
  color: var(--nav-active-text);
}

.site-nav .nav-link.nav-anchor {
  background: color-mix(in srgb, var(--nav-active) 10%, transparent);
}

.site-nav .nav-link.nav-anchor:hover,
.site-nav .nav-link.nav-anchor:focus-visible {
  background: color-mix(in srgb, var(--nav-active) 18%, transparent);
}

.nav-cta,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-cta,
.button-dark {
  padding: 12px 20px;
  background: var(--ink);
  color: var(--button-text);
  box-shadow: 0 18px 36px rgba(24, 18, 16, 0.18);
}

.nav-cta {
  margin-top: auto;
  width: 100%;
}

.button-light {
  padding: 12px 20px;
  background: var(--soft-surface);
  color: var(--text);
  border-color: var(--border);
}

main {
  min-width: 0;
  padding-top: 6px;
}

.home-minimal {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 12px 0;
}

.home-focus-card {
  width: min(840px, 100%);
  min-height: 620px;
  padding: 48px 52px;
  border: 1px solid var(--border);
  border-radius: 36px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
}

.home-focus-card h1 {
  max-width: none;
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(2rem, 3vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--headline);
  white-space: nowrap;
}

body[data-page="login"] .page-shell,
body[data-page="signup"] .page-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
}

body[data-page="login"] .home-minimal,
body[data-page="signup"] .home-minimal {
  min-height: calc(100vh - 20px);
  padding: 10px 0;
}

.auth-composition {
  position: relative;
  width: min(560px, 100%);
}

body[data-page="login"] .home-top-brand .maison-edna-logo,
body[data-page="signup"] .home-top-brand .maison-edna-logo {
  transform: scale(1.2);
}

.auth-eyebrow-spacer::before {
  content: "\00a0";
}

body[data-page="login"] .home-focus-card,
body[data-page="signup"] .home-focus-card {
  width: min(560px, 100%);
  max-width: 560px;
  min-height: auto;
  padding: 20px 24px;
  gap: 12px;
}

body[data-page="login"] .home-focus-card h1,
body[data-page="signup"] .home-focus-card h1 {
  white-space: normal;
  max-width: 100%;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  line-height: 1.1;
}

.home-color-orbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 2px;
}

.home-color-orb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  transform: scale(1);
  transform-origin: center;
  transition: transform 280ms cubic-bezier(0.22, 0.01, 0.36, 1);
  will-change: transform;
}

.home-color-orb:hover {
  transform: scale(1.22);
}

.home-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 560px;
}

.home-note a {
  color: var(--accent);
  text-decoration: underline;
}

.home-footer-section {
  position: relative;
  width: 100%;
  padding: 54px 0;
  background: rgba(250, 246, 241, 0.98);
  border-top: 1px solid rgba(60, 45, 31, 0.08);
}

html[data-theme="midnight"] .home-footer-section,
html[data-theme="matte"] .home-footer-section,
html[data-theme="black"] .home-footer-section {
  background: rgba(14, 14, 18, 0.94);
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="graphite"] .home-footer-section,
html[data-theme="pure-black"] .home-footer-section {
  background: var(--surface-opaque);
  border-top-color: var(--border-subtle);
}

.home-footer-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
}

.home-footer {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--muted);
}

html[data-theme="midnight"] .home-footer {
  color: rgba(230, 230, 230, 0.88);
}

.home-footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.footer-branding {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: min(320px, 100%);
}

.footer-brand-mark span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #184dff;
}

.footer-branding p {
  margin: 0;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease;
}

.footer-links a:hover {
  color: var(--headline);
  opacity: 0.9;
}

.footer-links a[aria-expanded="true"] {
  color: var(--headline);
}

.footer-links a:focus-visible,
.footer-section-action:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.footer-expansion {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 260ms ease, opacity 220ms ease, visibility 0s linear 280ms;
}

.footer-expansion-inner {
  min-height: 0;
  overflow: hidden;
}

.footer-expansion-panel {
  padding: 0;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  transform: translateY(-8px);
  transition: padding 280ms ease, border-color 220ms ease, transform 280ms ease;
}

.home-footer-section.is-expanded .footer-expansion {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows 320ms ease, opacity 240ms ease, visibility 0s;
}

.home-footer-section.is-expanded .footer-expansion-panel {
  height: var(--footer-expanded-panel-height, auto);
  padding: 32px 0;
  border-color: rgba(60, 45, 31, 0.12);
  transform: translateY(0);
}

.footer-expansion-measure {
  position: fixed;
  top: 0;
  left: -200vw;
  height: auto !important;
  min-height: 0 !important;
  padding: 32px 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  transition: none;
}

html[data-theme="midnight"] .home-footer-section.is-expanded .footer-expansion-panel,
html[data-theme="matte"] .home-footer-section.is-expanded .footer-expansion-panel,
html[data-theme="black"] .home-footer-section.is-expanded .footer-expansion-panel,
html[data-theme="graphite"] .home-footer-section.is-expanded .footer-expansion-panel,
html[data-theme="pure-black"] .home-footer-section.is-expanded .footer-expansion-panel {
  border-color: rgba(255, 255, 255, 0.1);
}

.footer-section-title {
  margin: 0;
  color: var(--headline);
  font-family: "Manrope", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.footer-section-copy {
  display: grid;
  gap: 12px;
  width: min(780px, 100%);
  margin-top: 20px;
}

.footer-section-copy p,
.footer-pricing-status,
.footer-pricing-policy {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
}

.footer-section-link {
  width: fit-content;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 180ms ease, opacity 180ms ease;
}

.footer-section-link:hover {
  color: var(--headline);
  opacity: 0.9;
}

.footer-section-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.footer-contact-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  width: min(780px, 100%);
  margin-top: 22px;
}

.footer-contact-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.footer-contact-field--full {
  grid-column: 1 / -1;
}

.footer-contact-field > span {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.footer-contact-form .footer-contact-field .footer-contact-control {
  width: 100%;
  min-width: 0;
  padding: 1px 0 7px;
  border: 0 !important;
  border-bottom: 1px solid rgba(60, 45, 31, 0.22) !important;
  border-radius: 0;
  outline: 0;
  background: transparent !important;
  color: var(--headline);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

textarea.footer-contact-control {
  min-height: 54px;
  resize: none;
}

.footer-contact-form .footer-contact-field .footer-contact-control:focus {
  border-bottom-color: var(--headline) !important;
  box-shadow: 0 1px 0 var(--headline);
}

html[data-theme="midnight"] .footer-contact-control,
html[data-theme="matte"] .footer-contact-control,
html[data-theme="black"] .footer-contact-control,
html[data-theme="graphite"] .footer-contact-control,
html[data-theme="pure-black"] .footer-contact-control {
  border-bottom-color: rgba(255, 255, 255, 0.24) !important;
}

html[data-theme="midnight"] .footer-contact-control:focus,
html[data-theme="matte"] .footer-contact-control:focus,
html[data-theme="black"] .footer-contact-control:focus,
html[data-theme="graphite"] .footer-contact-control:focus,
html[data-theme="pure-black"] .footer-contact-control:focus {
  border-bottom-color: var(--headline) !important;
}

.footer-contact-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.footer-contact-actions {
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.footer-contact-status {
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-contact-submit {
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--headline);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.footer-contact-submit:disabled {
  cursor: wait;
  opacity: 0.55;
}

.footer-contact-submit:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.footer-policy-reference {
  display: inline-block;
  margin-top: 20px;
  color: var(--headline);
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-pricing-status {
  margin-top: 20px;
}

.footer-pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.footer-pricing-plan {
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid rgba(60, 45, 31, 0.12);
}

html[data-theme="midnight"] .footer-pricing-plan,
html[data-theme="matte"] .footer-pricing-plan,
html[data-theme="black"] .footer-pricing-plan,
html[data-theme="graphite"] .footer-pricing-plan,
html[data-theme="pure-black"] .footer-pricing-plan {
  border-left-color: rgba(255, 255, 255, 0.1);
}

.footer-pricing-plan h3,
.footer-pricing-plan p {
  margin: 0;
}

.footer-pricing-plan h3 {
  color: var(--headline);
  font-family: "Manrope", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-pricing-price {
  margin-top: 12px !important;
  color: var(--headline);
  font-size: 1rem;
  font-weight: 600;
}

.footer-pricing-credits {
  margin-top: 6px !important;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.footer-pricing-policy {
  margin-top: 24px;
}

.footer-section-action {
  margin-top: 20px;
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--headline);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.footer-meta {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
}

@media (max-width: 900px) {
  .home-footer {
    padding: 28px 28px;
  }

  .home-footer-copy {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-links {
    justify-content: flex-start;
    gap: 14px;
  }

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

@media (max-width: 640px) {
  .home-footer {
    padding: 24px 20px;
    border-radius: 22px;
  }

  .footer-links {
    gap: 12px;
  }

  .home-footer-section.is-expanded .footer-expansion-panel {
    padding: 26px 0;
  }

  .footer-expansion-measure {
    padding: 26px 0;
  }

  .footer-pricing-grid {
    grid-template-columns: 1fr;
  }

  .footer-contact-form {
    grid-template-columns: 1fr;
  }

  .footer-contact-field--full {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-expansion,
  .footer-expansion-panel {
    transition: none;
  }
}

@media (min-width: 1101px) {
  body[data-page="canvas"] .page-shell.canvas-c7-shell {
    width: calc(100% - 268px);
    margin-left: 268px;
  }

  body[data-page="canvas"].collapsed-sidebar .page-shell.canvas-c7-shell {
    width: 100%;
    margin-left: 0;
  }
}

.orb-red {
  background: #ec0000;
}

.orb-orange {
  background: #ff3700;
}

.orb-pink {
  background: #ff1170;
}

.orb-blue {
  background: #184dff;
}

.home-create-button {
  min-width: 152px;
}

/* Unauthenticated editorial landing narrative: homepage-only presentation. */
body[data-page="home"] .home-editorial-narrative {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 72px 0 128px;
}

body[data-page="home"] .home-editorial-section {
  position: relative;
  padding: 112px 0;
  border-top: 1px solid var(--border);
}

body[data-page="home"] .home-section-index {
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

body[data-page="home"] .home-editorial-section h2 {
  max-width: 900px;
  margin: 0;
  color: var(--headline);
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

body[data-page="home"] .home-positioning-layout,
body[data-page="home"] .home-chapter-layout,
body[data-page="home"] .home-models-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.92fr);
  gap: clamp(56px, 8vw, 112px);
  align-items: start;
}

body[data-page="home"] .home-section-lede {
  max-width: 720px;
  margin: 34px 0 0;
  color: var(--text);
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.38;
}

body[data-page="home"] .home-secondary-statement {
  max-width: 620px;
  margin: 54px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

body[data-page="home"] .home-system-composition {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  min-height: 520px;
  padding: 54px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at 50% 45%, var(--panel-alt), transparent 66%);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
}

body[data-page="home"] .home-system-composition span:nth-child(even) {
  text-align: right;
}

body[data-page="home"] .home-system-composition strong {
  grid-column: 1 / -1;
  margin: 62px 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-align: center;
}

body[data-page="home"] .home-output-proof > h2 {
  margin-bottom: 64px;
}

body[data-page="home"] .home-proof-composition {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: 340px 160px 280px;
  gap: 18px;
}

body[data-page="home"] .home-proof-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-alt), var(--panel));
}

body[data-page="home"] .home-proof-editorial {
  grid-column: 1 / 8;
  grid-row: 1 / 3;
}

body[data-page="home"] .home-proof-runway {
  grid-column: 8 / 13;
  grid-row: 1;
}

body[data-page="home"] .home-proof-model {
  grid-column: 8 / 13;
  grid-row: 2 / 4;
}

body[data-page="home"] .home-proof-product {
  grid-column: 1 / 5;
  grid-row: 3;
}

body[data-page="home"] .home-proof-pattern {
  grid-column: 5 / 8;
  grid-row: 3;
}

body[data-page="home"] .home-proof-visual {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--surface-text);
  background:
    linear-gradient(115deg, transparent 20%, var(--glow-1) 50%, transparent 72%),
    radial-gradient(circle at 25% 25%, var(--glow-1), transparent 46%);
  transform: scale(1);
  transform-origin: center;
}

body[data-page="home"] .home-proof-visual svg {
  width: clamp(86px, 12vw, 178px);
  height: auto;
  opacity: 0.68;
}

body[data-page="home"] .home-proof-label {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(34, 31, 28, 0.1);
  backdrop-filter: blur(12px);
}

body[data-page="home"] .home-proof-label strong {
  color: var(--text);
  font-size: 10px;
  letter-spacing: 0.16em;
}

body[data-page="home"] .home-proof-label span {
  color: var(--muted);
  font-size: 12px;
}

body[data-page="home"] .home-zones > h2 {
  margin-bottom: 64px;
}

body[data-page="home"] .home-zone-groups {
  width: min(780px, 100%);
  margin-left: auto;
}

body[data-page="home"] .home-zone-group + .home-zone-group {
  margin-top: 32px;
}

body[data-page="home"] .home-zone-group h3,
body[data-page="home"] .home-audience-groups h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

body[data-page="home"] .home-zone-list {
  display: grid;
  gap: 3px;
}

body[data-page="home"] .home-zone-row {
  display: grid;
  grid-template-columns: 26px 20px minmax(0, 1fr) 18px;
  gap: 14px;
  align-items: center;
  min-height: 62px;
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 180ms ease;
}

body[data-page="home"] .home-zone-row:hover,
body[data-page="home"] .home-zone-row:focus-visible {
  background: var(--panel-alt);
}

body[data-page="home"] .home-zone-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

body[data-page="home"] .home-zone-row > span:first-child {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

body[data-page="home"] .home-zone-row svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
}

body[data-page="home"] .home-zone-row > span:nth-child(3) {
  display: grid;
  gap: 2px;
}

body[data-page="home"] .home-zone-row strong {
  font-size: 14px;
  font-weight: 600;
}

body[data-page="home"] .home-zone-row small {
  color: var(--muted);
  font-size: 12px;
}

body[data-page="home"] .home-zone-row b {
  color: var(--muted);
  font-weight: 400;
  transition: transform 180ms ease, color 180ms ease;
}

body[data-page="home"] .home-zone-row:hover b,
body[data-page="home"] .home-zone-row:focus-visible b {
  color: var(--text);
  transform: translateX(3px);
}

body[data-page="home"] .home-brand-dna-panel {
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  color: var(--text);
}

body[data-page="home"] .home-brand-dna-panel span {
  font-size: 16px;
  line-height: 1.35;
}

body[data-page="home"] .home-brand-dna-panel b {
  color: var(--muted);
  font-weight: 400;
}

body[data-page="home"] .home-editorial-list {
  display: grid;
  gap: 14px;
  margin: 46px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

body[data-page="home"] .home-editorial-list li {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

body[data-page="home"] .home-models > h2,
body[data-page="home"] .home-workflow > h2,
body[data-page="home"] .home-audience > h2 {
  margin-bottom: 64px;
}

body[data-page="home"] .home-models-definitions {
  margin: 0;
}

body[data-page="home"] .home-models-definitions div {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

body[data-page="home"] .home-models-definitions dt {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

body[data-page="home"] .home-models-definitions dd {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

body[data-page="home"] .home-linear-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  color: var(--text);
  line-height: 1.45;
}

body[data-page="home"] .home-linear-flow b {
  color: var(--muted);
  font-weight: 400;
}

body[data-page="home"] .home-emphasis-line {
  margin: 46px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

body[data-page="home"] .home-archive-flow {
  margin-top: 52px;
}

body[data-page="home"] .home-workflow-sequence {
  width: min(900px, 100%);
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

body[data-page="home"] .home-workflow-sequence li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 68px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
}

body[data-page="home"] .home-workflow-sequence li:last-child {
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-workflow-sequence span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

body[data-page="home"] .home-audience-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(60px, 10vw, 140px);
  width: min(900px, 100%);
  margin-left: auto;
}

body[data-page="home"] .home-audience-groups ul {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text);
}

body[data-page="home"] .home-audience-groups li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-access-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 42px 64px;
  align-items: end;
}

body[data-page="home"] .home-access-layout > div:first-child p {
  max-width: 660px;
  margin: 34px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

body[data-page="home"] .home-plan-family {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  grid-column: 1 / -1;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
}

body[data-page="home"] .home-closing {
  min-height: 620px;
  display: grid;
  align-items: center;
  border-top: 0;
  background:
    radial-gradient(circle at 20% 20%, var(--glow-1), transparent 42%),
    linear-gradient(145deg, var(--panel-alt), transparent 68%);
}

body[data-page="home"] .home-closing-panel {
  width: min(760px, calc(100% - 96px));
  margin: 0 auto;
  padding: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  text-align: center;
}

body[data-page="home"] .home-closing-panel h2 {
  margin: 0 auto 38px;
}

body[data-page="home"] .home-closing-panel .home-section-index {
  margin-bottom: 26px;
}

body[data-page="home"].home-motion-ready [data-home-reveal] {
  opacity: 0;
  transform: translateY(18px);
}

body[data-page="home"].home-motion-ready [data-home-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-page="home"].home-motion-ready [data-home-reveal] .home-proof-visual {
  transform: scale(0.985);
}

body[data-page="home"].home-motion-ready [data-home-reveal].is-visible .home-proof-visual {
  transform: scale(1);
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Authenticated homepage editorial guidance reuses the guest narrative system. */
body[data-page="home"] .home-member-narrative {
  width: min(1240px, 100%);
}

body[data-page="home"] .home-member-narrative > .home-editorial-section {
  padding: clamp(120px, 10vw, 168px) 0;
}

body[data-page="home"] .home-member-narrative h2 {
  max-width: 16ch;
  font-size: clamp(34px, 4.2vw, 66px);
  line-height: 1.02;
}

body[data-page="home"] .home-member-narrative h3 {
  margin: 0;
  color: var(--headline);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

body[data-page="home"] .home-member-narrative p {
  max-width: 66ch;
}

body[data-page="home"] .home-member-studio-visual {
  display: grid;
  gap: 28px;
  min-width: 0;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

body[data-page="home"] .home-member-stage-sequence {
  display: grid;
  gap: 16px;
}

body[data-page="home"] .home-member-stage-sequence > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-member-stage-sequence strong,
body[data-page="home"] .home-member-collage span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
}

body[data-page="home"] .home-member-stage-sequence span {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

body[data-page="home"] .home-member-stage-sequence > b {
  display: none;
}

body[data-page="home"] .home-member-collage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: space-between;
  min-height: 280px;
  padding: 28px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 24% 28%, var(--glow-1), transparent 38%),
    radial-gradient(circle at 76% 72%, var(--glow-2), transparent 42%),
    var(--panel-alt);
}

body[data-page="home"] .home-member-collage span:nth-child(even) {
  text-align: right;
}

body[data-page="home"] .home-member-collage strong {
  position: absolute;
  inset: 50% auto auto 50%;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.18em;
  transform: translate(-50%, -50%);
}

body[data-page="home"] .home-member-sticky-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(58px, 8vw, 112px);
  align-items: start;
}

body[data-page="home"] .home-member-sticky-copy {
  position: sticky;
  top: 42px;
}

body[data-page="home"] .home-member-zone-index {
  width: 100%;
}

body[data-page="home"] .home-member-zone-index .home-zone-row {
  min-height: 78px;
}

body[data-page="home"] .home-member-zone-index .home-zone-row > span:nth-child(3) {
  gap: 5px;
}

body[data-page="home"] .home-member-zone-index .home-zone-row small {
  order: 0;
  font-size: 12px;
  line-height: 1.45;
}

body[data-page="home"] .home-member-zone-index .home-zone-row strong {
  order: 1;
  font-size: 16px;
}

body[data-page="home"] .home-member-direction > .home-section-lede {
  margin-top: 46px;
}

body[data-page="home"] .home-member-numbered-spread {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 72px);
  margin: 82px 0 0;
  padding: 0;
  list-style: none;
}

body[data-page="home"] .home-member-numbered-spread li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 18px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

body[data-page="home"] .home-member-numbered-spread > li > span,
body[data-page="home"] .home-member-workflow-number {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

body[data-page="home"] .home-member-numbered-spread p,
body[data-page="home"] .home-member-workflow-chapters p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

body[data-page="home"] .home-member-emphasis {
  max-width: 28ch;
  margin: 72px 0 0 auto;
  color: var(--headline);
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.35;
}

body[data-page="home"] .home-member-flow {
  margin-top: 58px;
}

body[data-page="home"] .home-member-action {
  margin-top: 48px;
}

body[data-page="home"] .home-member-guidance-panel {
  gap: 34px;
}

body[data-page="home"] .home-member-guidance-panel h3 {
  margin-bottom: 16px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body[data-page="home"] .home-member-guidance-panel ul {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

body[data-page="home"] .home-member-models-layout {
  margin-top: 72px;
}

body[data-page="home"] .home-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 42px;
}

body[data-page="home"] .home-member-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-top: 76px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

body[data-page="home"] .home-member-progress b {
  color: var(--muted);
  font-weight: 400;
}

body[data-page="home"] .home-member-taxonomy-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: clamp(64px, 9vw, 128px);
  align-items: start;
}

body[data-page="home"] .home-member-taxonomy {
  margin: 0;
}

body[data-page="home"] .home-member-taxonomy > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.72fr) minmax(0, 1.28fr);
  gap: 26px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

body[data-page="home"] .home-member-taxonomy > div:last-child {
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-member-taxonomy dt {
  color: var(--headline);
  font-size: 15px;
  font-weight: 600;
}

body[data-page="home"] .home-member-taxonomy dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

body[data-page="home"] .home-member-archive-taxonomy > div {
  grid-template-columns: minmax(110px, 0.62fr) minmax(0, 1.38fr);
}

body[data-page="home"] .home-member-workflows > h2 {
  margin-bottom: 76px;
}

body[data-page="home"] .home-member-workflow-chapters {
  display: grid;
}

body[data-page="home"] .home-member-workflow-chapters article {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: clamp(26px, 5vw, 70px);
  padding: 54px 0;
  border-top: 1px solid var(--border);
}

body[data-page="home"] .home-member-workflow-chapters article:last-child {
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-member-workflow-chapters h3 {
  margin-bottom: 24px;
  font-size: 22px;
}

body[data-page="home"] .home-member-practice .home-editorial-list {
  columns: 2;
  column-gap: 46px;
  margin-top: 48px;
}

body[data-page="home"] .home-member-practice .home-editorial-list li {
  break-inside: avoid;
}

body[data-page="home"] .home-member-access-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(420px, 1.14fr);
  gap: clamp(64px, 9vw, 128px);
  align-items: start;
}

body[data-page="home"] .home-member-route-list {
  display: grid;
}

body[data-page="home"] .home-member-route-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 22px;
  gap: 18px;
  align-items: center;
  min-height: 72px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  color: var(--text);
  transition: background-color 180ms ease;
}

body[data-page="home"] .home-member-route-row:last-child {
  border-bottom: 1px solid var(--border);
}

body[data-page="home"] .home-member-route-row:hover,
body[data-page="home"] .home-member-route-row:focus-visible {
  background: var(--panel-alt);
}

body[data-page="home"] .home-member-route-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

body[data-page="home"] .home-member-route-row > span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
}

body[data-page="home"] .home-member-route-row strong {
  font-size: 15px;
  font-weight: 600;
}

body[data-page="home"] .home-member-route-row b {
  color: var(--muted);
  font-weight: 400;
  transition: transform 180ms ease, color 180ms ease;
}

body[data-page="home"] .home-member-route-row:hover b,
body[data-page="home"] .home-member-route-row:focus-visible b {
  color: var(--text);
  transform: translateX(3px);
}

body[data-page="home"] .home-member-closing {
  background:
    radial-gradient(circle at 24% 22%, var(--glow-1), transparent 42%),
    radial-gradient(circle at 78% 74%, var(--glow-2), transparent 38%),
    linear-gradient(145deg, var(--panel-alt), transparent 68%);
}

body[data-page="home"].chat-expanded .page-shell {
  left: 20px;
  transform: none;
  width: min(1240px, calc(100% - 340px));
}

body[data-page="home"].chat-expanded .home-member-sticky-layout,
body[data-page="home"].chat-expanded .home-member-taxonomy-layout,
body[data-page="home"].chat-expanded .home-member-access-layout,
body[data-page="home"].chat-expanded .home-positioning-layout,
body[data-page="home"].chat-expanded .home-chapter-layout,
body[data-page="home"].chat-expanded .home-models-layout {
  grid-template-columns: 1fr;
}

body[data-page="home"].chat-expanded .home-member-sticky-copy {
  position: static;
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="home"] [data-home-reveal],
  body[data-page="home"] [data-home-reveal] .home-proof-visual {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  body[data-page="home"] .home-zone-row,
  body[data-page="home"] .home-zone-row b,
  body[data-page="home"] .home-member-route-row,
  body[data-page="home"] .home-member-route-row b {
    transition: none !important;
  }
}

@media (max-width: 1000px) {
  body[data-page="home"] .home-positioning-layout,
  body[data-page="home"] .home-chapter-layout,
  body[data-page="home"] .home-models-layout,
  body[data-page="home"] .home-member-sticky-layout,
  body[data-page="home"] .home-member-taxonomy-layout,
  body[data-page="home"] .home-member-access-layout {
    grid-template-columns: 1fr;
  }

  body[data-page="home"] .home-member-sticky-copy {
    position: static;
  }

  body[data-page="home"] .home-member-numbered-spread {
    grid-template-columns: 1fr;
  }

  body[data-page="home"] .home-system-composition {
    min-height: 380px;
  }

  body[data-page="home"] .home-access-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body[data-page="home"] .home-editorial-narrative {
    padding: 44px 0 80px;
  }

  body[data-page="home"] .home-editorial-section {
    padding: 76px 0;
  }

  body[data-page="home"] .home-proof-composition {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  body[data-page="home"] .home-proof-item {
    grid-column: auto;
    grid-row: auto;
    min-height: 300px;
  }

  body[data-page="home"] .home-audience-groups {
    grid-template-columns: 1fr;
  }

  body[data-page="home"] .home-closing-panel {
    width: min(100% - 32px, 760px);
    padding: 36px 22px;
  }
}

.hero-grid,
.split-section,
.studio-layout,
.profile-layout,
.page-layout {
  display: grid;
  gap: 28px;
}

.hero-grid {
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  min-height: calc(100vh - 56px);
}

.hero-copy h1,
.page-intro h1,
.studio-form h1,
.profile-copy h1 {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(3.5rem, 7vw, 6.3rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  max-width: 10ch;
  font-weight: 500;
}

.hero-text,
.page-intro p,
.profile-copy p,
.studio-form .section-heading + .field-block,
.feature-card p,
.lesson-card p,
.curriculum-card p,
.saved-card p,
.output-card p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-copy h1,
.page-intro h1,
.studio-form h1,
.profile-copy h1,
.split-section h2,
.section-heading h2,
.output-header h2,
.lesson-card h2,
.saved-card h2,
blockquote,
.look-card h3,
.feature-card h3,
.curriculum-card h3,
.output-card h3,
.profile-card h2,
.saved-card h3 {
  color: var(--headline);
}

.eyebrow,
.curriculum-label,
.status-pill,
.feature-index {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
}

.eyebrow,
.curriculum-label {
  color: #8d7467;
}

html[data-theme="light"] .eyebrow,
html[data-theme="light"] .curriculum-label,
html[data-theme="light-sand"] .eyebrow,
html[data-theme="light-sand"] .curriculum-label,
html[data-theme="baby-pink"] .eyebrow,
html[data-theme="baby-pink"] .curriculum-label,
html[data-theme="tiffany-blue"] .eyebrow,
html[data-theme="tiffany-blue"] .curriculum-label,
html[data-theme="baby-green"] .eyebrow,
html[data-theme="baby-green"] .curriculum-label,
html[data-theme="matte"] .eyebrow,
html[data-theme="matte"] .curriculum-label,
html[data-theme="midnight"] .eyebrow,
html[data-theme="midnight"] .curriculum-label,
html[data-theme="graphite"] .eyebrow,
html[data-theme="graphite"] .curriculum-label,
html[data-theme="pure-black"] .eyebrow,
html[data-theme="pure-black"] .curriculum-label {
  color: var(--text-section-label);
}

html[data-theme="light"] .user-meta-card span,
html[data-theme="light-sand"] .user-meta-card span,
html[data-theme="baby-pink"] .user-meta-card span,
html[data-theme="tiffany-blue"] .user-meta-card span,
html[data-theme="baby-green"] .user-meta-card span,
html[data-theme="matte"] .user-meta-card span,
html[data-theme="midnight"] .user-meta-card span {
  color: var(--text-metadata);
}

.back-arrow {
  font-size: 1.4rem;
  display: inline-block;
  padding: 4px 8px;
  line-height: 1;
  transition: opacity 200ms ease;
}

.back-arrow:hover {
  opacity: 0.7;
}

body[data-page="brands"] [style*="border-radius: 999px"] {
  width: 88px !important;
  height: 88px !important;
  min-width: 88px !important;
}

.hero-actions,
.control-row,
.saved-tags,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-metrics,
.mini-stat-grid {
  display: grid;
  gap: 16px;
}

.hero-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  padding: 0;
  margin: 38px 0 0;
}

.hero-metrics li,
.feature-card,
.lesson-card,
.curriculum-card,
.look-card,
.profile-card,
.saved-card,
.studio-panel,
.editorial-card,
.quote-panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: background 220ms ease, border-color 220ms ease, color 220ms ease,
    box-shadow 220ms ease;
}

.hero-metrics li {
  padding: 22px;
}

.hero-metrics strong,
.mini-stat-grid strong {
  display: block;
  margin-bottom: 8px;
  font-family: "Segoe UI", sans-serif;
  font-size: 2rem;
  font-weight: 500;
}

.hero-stage {
  position: relative;
  min-height: 720px;
}

.editorial-card {
  padding: 18px;
}

.large-card {
  position: absolute;
  inset: 0 36px 70px 0;
}

.card-chrome,
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.user-tab-bar {
  justify-content: flex-start;
}

.user-tab-bar .nav-link {
  padding: 10px 16px;
  border-radius: 18px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.user-tab-bar .nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.user-tab-bar .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.image-panel {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 246, 239, 0.92), rgba(198, 174, 161, 0.68));
  background-size: cover;
  background-position: center;
}

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

.image-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--skeleton-low), var(--skeleton-high), var(--skeleton-low));
  background-size: 200% 200%;
  animation: image-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

.gallery-image-error {
  opacity: 1 !important;
  filter: saturate(0.35) blur(0.5px);
}

@keyframes image-pulse {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Image card action menu */
.image-card-menu-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
  padding: 0;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
}

.library-card:hover .image-card-menu-btn {
  opacity: 1;
}

.image-card-menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 1);
}

/* Image card dropdown menu */
.image-card-menu {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 11;
  background: var(--panel-strong);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 200px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body[data-page="library"] .image-card-menu,
body[data-page="user"] .image-card-menu {
  background: var(--panel-solid);
  opacity: 1;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.image-card-menu.is-open {
  display: flex;
}

.image-card-menu-item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 200ms ease;
  font-family: "Segoe UI", sans-serif;
  text-align: left;
  width: 100%;
}

.image-card-menu-item:hover:not(:disabled) {
  background: var(--panel);
}

.image-card-menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.image-card-menu-item .menu-icon {
  display: inline-block;
  font-size: 1.1rem;
  min-width: 20px;
  text-align: center;
}

.image-card-menu-item .menu-label {
  flex: 1;
}

.image-card-menu-item.is-favorited {
  color: var(--favorite);
}

.image-card-menu-item.is-favorited .menu-icon {
  font-weight: bold;
}

.image-card-menu-item.is-destructive:hover:not(:disabled),
.image-card-menu-item.is-destructive:focus-visible {
  background: color-mix(in srgb, var(--destructive-hover) 9%, transparent);
  color: var(--destructive-hover);
  outline-color: var(--destructive-hover);
}

.chat-modal-overlay.image-delete-modal-overlay {
  z-index: 2147483647;
}

.chat-modal.image-delete-modal {
  background: var(--panel-solid);
}

.image-delete-modal-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.image-delete-confirm.is-destructive {
  border-color: color-mix(in srgb, var(--destructive) 42%, var(--border));
  background: transparent;
  color: var(--destructive);
}

.image-delete-confirm.is-destructive:hover:not(:disabled),
.image-delete-confirm.is-destructive:focus-visible {
  border-color: var(--destructive-hover);
  background: var(--destructive-hover);
  color: #fff;
  outline-color: var(--destructive-hover);
}

.studio-feed-item .image-panel {
  border-radius: 0;
}

.portrait-panel {
  min-height: 580px;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.orb-sand {
  width: 220px;
  height: 420px;
  left: 16%;
  top: 10%;
  background: radial-gradient(circle at 30% 30%, #f8efe3, #b7967b 78%);
}

.orb-ink {
  width: 160px;
  height: 320px;
  right: 14%;
  bottom: 8%;
  background: radial-gradient(circle at 30% 30%, #645449, #201a17 70%);
}

.image-caption {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(249, 241, 232, 0.7);
  color: var(--surface-text);
  font-size: 0.92rem;
}

.floating-note {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(320px, 70%);
  background: var(--accent-card);
  color: var(--inverse-text);
}

.floating-note p {
  margin: 0;
  line-height: 1.7;
}

.split-section {
  grid-template-columns: 0.9fr 1.1fr;
  align-items: start;
  margin: 42px 0;
}

.split-section h2,
.section-heading h2,
.output-header h2,
.lesson-card h2,
.saved-card h2 {
  margin: 10px 0 0;
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1;
  font-weight: 500;
}

body[data-page="collections"] .collection-gallery-title {
  margin: 0 0 16px;
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  line-height: 1.2;
  font-weight: 600;
  color: var(--headline);
}

body[data-page="collections"] .gallery-empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 18px 0;
  text-align: center;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

body[data-page="collections"] .gallery-empty-state p {
  margin: 0;
}

body[data-page="collections"] .collection-title-input {
  display: inline-block;
  width: min(100%, 48vw);
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.2;
  outline: none;
  transition: background 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

body[data-page="collections"] .collection-title-input:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

body[data-page="collections"] .collection-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

body[data-page="collections"] .collection-action-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body[data-page="collections"] .collection-action-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  transition: background 180ms ease, transform 180ms ease, opacity 180ms ease;
  cursor: pointer;
  opacity: 0.92;
}

body[data-page="collections"] .collection-action-btn svg {
  width: 18px;
  height: 18px;
}

body[data-page="collections"] .collection-action-btn:hover {
  background: rgba(255,255,255,0.08);
  opacity: 1;
  transform: translateY(-1px);
}

body[data-page="collections"] .collection-action-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.22);
  outline-offset: 3px;
}

.feature-stack,
.collection-grid,
.editorial-columns,
.curriculum-grid,
.output-grid,
.saved-layout {
  display: grid;
  gap: 18px;
}

.feature-stack {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.lesson-card,
.curriculum-card,
.look-card,
.saved-card,
.output-card {
  padding: 24px;
}

.collection-panel {
  padding: 26px;
  border-radius: 32px;
  background: var(--panel-alt);
  border: 1px solid rgba(74, 56, 45, 0.08);
}

.collection-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.look-swatch {
  height: 220px;
  border-radius: 20px;
  margin-bottom: 18px;
}

.swatch-cream {
  background: linear-gradient(135deg, #f7f1e8, #cdb39b);
}

.swatch-ink {
  background: linear-gradient(135deg, #827367, #1d1a19);
}

.swatch-rose {
  background: linear-gradient(135deg, #f2e5de, #c79a92);
}

.page-layout,
.profile-layout {
  gap: 22px;
}

.user-area-main-content {
  min-width: 0;
  margin-left: var(--user-area-content-offset, 39.5625px);
}

body[data-page='collections'] .user-area-main-content,
body[data-page='items'] .user-area-main-content {
  display: grid;
  gap: 22px;
}

body[data-page='library'] .user-area-main-content {
  display: grid;
  gap: 8px;
}

body[data-page='models'] .user-area-main-content {
  --user-area-content-offset: 21.5625px;
}

@media (max-width: 1100px) {
  body[data-page='product-shelf'] .user-area-main-content {
    --user-area-content-offset: 49.5625px;
  }

  body[data-page='library'] .user-area-main-content {
    --user-area-content-offset: -32.4375px;
  }
}

.page-intro,
.profile-hero,
.studio-panel,
.quote-panel {
  padding: 30px;
}

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

.accent-card {
  background: var(--accent-card);
  color: var(--inverse-text);
}

.accent-card p,
.accent-card .feature-index {
  color: var(--accent-card-muted);
}

.curriculum-grid,
.output-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quote-panel {
  text-align: center;
}

.quote-mark {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-size: 5rem;
  line-height: 0.8;
  color: #8d7467;
  font-weight: 500;
}

blockquote {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.1;
  font-weight: 500;
}

.studio-layout {
  grid-template-columns: 0.9fr 1.1fr;
}

.studio-form,
.studio-output {
  min-height: 780px;
}

body[data-page="create"] .page-shell {
  padding-top: 0;
  padding-bottom: 28px;
}

body[data-page="create"] .create-shell {
  display: block;
}

body[data-page="create"] .create-index {
  width: min(680px, 100%);
  margin: 10vh auto 0;
}

body[data-page="create"] .create-index-header {
  display: grid;
  gap: 6px;
}

body[data-page="create"] .create-index-eyebrow,
body[data-page="create"] .create-index-header h1,
body[data-page="create"] .create-group-label {
  margin: 0;
}

body[data-page="create"] .create-index-eyebrow,
body[data-page="create"] .create-group-label {
  color: var(--text-section-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body[data-page="create"] .create-index-header h1 {
  color: var(--headline);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.05;
}

body[data-page="create"] .create-groups {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

body[data-page="create"] .create-group-label {
  margin-bottom: 8px;
}

body[data-page="create"] .create-destination-list {
  display: grid;
  gap: 2px;
}

body[data-page="create"] .create-destination-row {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  height: 56px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--text);
  opacity: 1;
  text-decoration: none;
  transform: scale(1);
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 220ms ease,
    opacity 220ms ease;
}

body[data-page="create"] .create-destination-row:hover {
  background: var(--panel-alt);
}

body[data-page="create"] .create-destination-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  background: var(--panel-alt);
}

body[data-page="create"] .create-destination-row:is(:hover, :focus-visible) {
  opacity: 1;
  transform: scale(1.01);
}

body[data-page="create"] .create-groups:has(.create-destination-row:is(:hover, :focus-visible))
  .create-destination-row:not(:hover):not(:focus-visible) {
  opacity: 0.72;
  transform: scale(1);
}

body[data-page="create"] .create-destination-icon {
  color: var(--muted);
}

body[data-page="create"] .create-destination-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

body[data-page="create"] .create-destination-name,
body[data-page="create"] .create-destination-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="create"] .create-destination-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

body[data-page="create"] .create-destination-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

body[data-page="create"] .create-destination-arrow {
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  text-align: right;
  transition: transform 160ms ease, color 160ms ease;
}

body[data-page="create"] .create-destination-row:hover .create-destination-arrow,
body[data-page="create"] .create-destination-row:focus-visible .create-destination-arrow {
  color: var(--text);
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="create"] .create-destination-row {
    transition:
      background-color 160ms ease,
      color 160ms ease,
      opacity 220ms ease;
  }
}

.blank-canvas-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 0;
}

.canvas-ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  padding-left: var(--canvas-ui-overlay-left, 28px);
  gap: 28px;
}

.canvas-ui-overlay > * {
  pointer-events: auto;
}

.canvas-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 10px;
  border: 1px solid var(--composer-border);
  border-radius: 999px;
  background: var(--composer-surface);
}

.canvas-tool-button {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.canvas-zoom-readout {
  min-width: 54px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.canvas-viewport {
  position: relative;
  overflow: hidden;
  flex: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 0;
}

.canvas-viewport.is-dragging {
  cursor: grabbing;
}

.canvas-grid-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(31, 25, 23, 1) 1px, transparent 1px),
    radial-gradient(circle, rgba(31, 25, 23, 1) 1px, transparent 1px);
  background-size: 40px 40px;
  background-repeat: repeat;
  background-attachment: local;
}

.canvas-surface {
  width: 1320px;
  min-height: 920px;
  padding: 36px;
  transform-origin: top left;
  will-change: transform;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.canvas-image-container {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.canvas-image-container.canvas-item-selected {
  outline: 2px solid rgba(31, 25, 23, 0.16);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.canvas-image-container .canvas-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.canvas-object-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.canvas-image-container.canvas-item-selected .canvas-object-controls {
  opacity: 1;
  pointer-events: auto;
}

.canvas-object-controls button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.canvas-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(31, 25, 23, 0.14);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: auto;
}

.canvas-image-container:hover .canvas-handle,
.canvas-image-container.canvas-item-selected .canvas-handle {
  opacity: 1;
}

.canvas-handle.resize {
  right: -10px;
  bottom: -10px;
  cursor: nwse-resize;
}

.canvas-handle.rotate {
  left: 50%;
  top: -16px;
  transform: translateX(-50%);
  cursor: grab;
}

.canvas-prompt-box {
  width: min(680px, 100%);
  z-index: 10;
}

body.chat-expanded .canvas-prompt-box {
  width: 476px;
  max-width: 476px;
}

body.chat-expanded[data-page="canvas"] .page-shell {
  width: 100%;
}

.canvas-flow-shell {
  position: relative;
  min-height: 820px;
  width: 100%;
}

.canvas-reference-card {
  display: grid;
  gap: 10px;
  width: 220px;
}

.canvas-reference-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.canvas-reference-label span {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.canvas-reference-label p {
  margin: 0;
}

.canvas-reference-drop {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--composer-border);
  border-radius: 22px;
  background: var(--composer-surface);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.canvas-node {
  position: relative;
  z-index: 2;
  cursor: grab;
}

.canvas-node.is-dragging {
  cursor: grabbing;
}

.face-node {
  position: absolute;
  left: 40px;
  top: 20px;
}

.pose-node {
  position: absolute;
  left: 40px;
  top: 250px;
}

.clothing-node {
  position: absolute;
  left: 40px;
  top: 480px;
}

.background-node {
  position: absolute;
  left: 40px;
  top: 710px;
}

.output-node {
  position: absolute;
  left: 560px;
  top: 150px;
}

.canvas-connection-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.canvas-connection-layer line {
  stroke: var(--border);
  stroke-width: 1.25;
  opacity: 0.9;
}

.canvas-final-output {
  width: min(100%, 560px);
  display: grid;
  gap: 12px;
}

.canvas-final-header {
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.canvas-final-image {
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  background:
    radial-gradient(circle at 34% 18%, rgba(255, 250, 244, 0.72), transparent 24%),
    linear-gradient(145deg, #ece1d5, #b69d89 52%, #6e5a50 100%);
  box-shadow: var(--shadow);
}

.canvas-uploaded-image {
  position: absolute;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.2s ease;
}

.canvas-uploaded-image:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.canvas-uploaded-image:active {
  cursor: grabbing;
}

.canvas-image {
  border-radius: 0;
}

.canvas-image-container {
  position: absolute;
  cursor: grab;
  user-select: none;
}

.canvas-image-container:hover .canvas-resize-handle {
  opacity: 1;
}

.canvas-resize-handle {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.create-panel {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.canvas-stage {
  min-height: 760px;
  display: grid;
  place-items: center;
}

.canvas-board {
  width: min(100%, 980px);
  min-height: 640px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--panel-strong);
}

.canvas-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.canvas-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: 240px 320px;
  gap: 18px;
  min-height: 560px;
}

.canvas-fragment {
  border-radius: 24px;
  background: var(--panel-alt);
  overflow: hidden;
}

.canvas-fragment-a {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 249, 241, 0.88), transparent 28%),
    linear-gradient(145deg, #efe4d8, #baa18d 52%, #7e675d 100%);
}

.canvas-fragment-b {
  background:
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.25), transparent 26%),
    linear-gradient(145deg, #45506a, #161d2d 46%, #090b10 100%);
}

.canvas-fragment-c {
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 245, 247, 0.84), transparent 28%),
    linear-gradient(145deg, #f1dfe0, #cf9f9e 52%, #886565 100%);
}

.canvas-fragment-d {
  background:
    radial-gradient(circle at 34% 18%, rgba(233, 240, 255, 0.4), transparent 24%),
    linear-gradient(145deg, #cfdaf2, #63739a 50%, #1b2234 100%);
}

.studio-feed {
  display: grid;
  gap: 34px;
  margin-bottom: 22px;
}

.studio-feed-item {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  max-width: min(760px, 100%);
  margin: 0 auto;
}

.studio-page-shell {
  max-width: 980px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.studio-feed-simple {
  gap: 16px;
}

.studio-feed-image {
  min-height: 280px;
  border-radius: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.studio-feed-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.studio-feed-item:hover .studio-feed-image {
  transform: scale(1.008);
  transition: transform 190ms ease;
}

.studio-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10030;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(18px);
}

.studio-modal-overlay.is-open {
  display: flex;
}

.studio-modal-shell {
  position: relative;
  width: min(92vw, 860px);
  max-height: min(92vh, 860px);
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 28px;
  overflow: hidden;
}

.studio-modal-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 8, 0.12);
  border-radius: 24px;
}

.studio-modal-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.studio-modal-close,
.studio-modal-download {
  position: absolute;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 20, 20, 0.8);
  color: #fff;
  display: grid;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
}

.studio-modal-close {
  right: 18px;
}

.studio-modal-download {
  right: 72px;
}

@media (max-width: 900px) {
  .studio-feed {
    gap: 26px;
  }

  .studio-feed-image {
    min-height: 240px;
  }

  .studio-modal-shell {
    width: min(96vw, 700px);
    max-height: min(90vh, 700px);
    padding: 18px;
  }

  .studio-modal-close,
  .studio-modal-download {
    top: 14px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
}

.studio-feed-meta {
  padding: 12px 2px 0;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.studio-feed-meta-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.studio-feed-meta h3 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--headline);
  text-transform: lowercase;
}

.studio-feed-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.studio-feed-meta span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  overflow: hidden;
  max-height: calc(0.88rem * 1.6 * 2);
  margin-top: 6px;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.studio-feed-a {
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 247, 239, 0.96), transparent 30%),
    linear-gradient(145deg, #efe3d8, #b79c88 55%, #6d5950 100%);
}

.studio-feed-b {
  background:
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.34), transparent 28%),
    linear-gradient(145deg, #d5c3b7, #6f6159 45%, #1d1b1a 100%);
}

.studio-feed-c {
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 248, 246, 0.74), transparent 28%),
    linear-gradient(145deg, #f3e3dd, #c39f95 52%, #8e6c63 100%);
}

.studio-feed-d {
  background:
    radial-gradient(circle at 58% 18%, rgba(255, 255, 255, 0.18), transparent 26%),
    linear-gradient(145deg, #7f807f, #353636 48%, #121212 100%);
}

.studio-feed-e {
  background:
    radial-gradient(circle at 32% 20%, rgba(255, 252, 248, 0.7), transparent 28%),
    linear-gradient(145deg, #ece5dd, #b7a69a 52%, #76665f 100%);
}

/* Refined feed layout for editorial, product-design, and collections pages */
body[data-page="editorial"] .studio-feed-item,
body[data-page="product-design"] .studio-feed-item,
body[data-page="collections"] .studio-feed-item {
  max-width: 100%;
  margin: 0;
}

body[data-page="editorial"] .studio-feed-image,
body[data-page="product-design"] .studio-feed-image,
body[data-page="collections"] .studio-feed-image {
  min-height: 180px;
  aspect-ratio: 16 / 10;
}

body[data-page="editorial"] .studio-feed,
body[data-page="product-design"] .studio-feed,
body[data-page="collections"] .studio-feed {
  gap: 20px;
  display: grid;
  grid-template-columns: 1fr;
  max-width: 620px;
  margin-left: 0;
  margin-right: auto;
}

body[data-page="editorial"] .studio-feed,
body[data-page="product-design"] .studio-feed {
  padding-left: var(--canvas-ui-overlay-left, 28px);
}

body[data-page="editorial"] .section-heading,
body[data-page="product-design"] .section-heading {
  padding-left: var(--canvas-ui-overlay-left, 28px);
}

.studio-prompt-dock {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.studio-prompt-simple {
  position: sticky;
  bottom: 28px;
  display: block;
  padding: 0;
  box-shadow: none;
}

.studio-prompt-simple .field-block {
  margin: 0;
  display: none;
}

.studio-prompt-simple .field-block span {
  margin-bottom: 8px;
  display: none;
}

.prompt-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 16px 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--composer-border);
  background: var(--surface-interactive);
  transition: all 0.2s ease;
  position: relative;
}

.prompt-input-wrapper:focus-within {
  border-color: var(--generate-tile);
  box-shadow: 0 0 0 2px rgba(21, 21, 21, 0.08);
}

.studio-prompt-dock {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-dna {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  min-width: 76px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)), var(--composer-surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 35px rgba(0, 0, 0, 0.08);
  position: relative;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.brand-dna:hover,
.brand-dna:focus-visible {
  transform: translateY(-1px);
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 22px 40px rgba(0, 0, 0, 0.12);
}

.brand-dna:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-dna-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(240px, 100vw - 32px);
  padding: 10px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.24);
  opacity: 0;
  visibility: hidden;
  transform-origin: bottom right;
  transform: translateY(10px) scaleY(0.96);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}

.brand-dna.is-open .brand-dna-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scaleY(1);
}

.brand-dna-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background 150ms ease;
}

.brand-dna-menu-item:hover {
  background: var(--panel-alt);
}

.brand-menu-chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.brand-menu-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-menu-chip.tile-blue { background: #184dff; }
.brand-menu-chip.tile-pink { background: #ff2fb2; }
.brand-menu-chip.tile-red { background: #ff2b2b; }
.brand-menu-chip.tile-orange { background: #ff6a00; }

.studio-prompt-simple textarea {
  flex: 1;
  min-height: 48px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
}

/* Ensure Brand DNA indicator sits above the textarea and is non-interactive */
/* indicator removed: placeholder string is used instead */

.studio-prompt-actions {
  display: none;
}

.generate-tile-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.generate-tile-button:hover {
  transform: scale(1.05);
}

.generate-tile {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--generate-tile);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.studio-prompt-simple textarea::placeholder {
  color: var(--text-placeholder);
  opacity: 0.6;
  font-weight: 400;
}

.studio-prompt-simple textarea {
  outline: none;
}

.field-block {
  display: block;
  margin: 26px 0 18px;
}

.field-block span,
.range-field span {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

textarea {
  width: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  resize: vertical;
  min-height: 180px;
  color: var(--text);
  background: var(--panel-strong);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: var(--panel-strong);
  outline: none;
  font-size: 0.94rem;
}

.auth-form input:is([type="email"], [type="password"]):-webkit-autofill,
.auth-form input:is([type="email"], [type="password"]):autofill {
  background-color: var(--panel-strong);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-solid) inset;
  box-shadow: 0 0 0 1000px var(--panel-solid) inset;
}

.auth-form input:is([type="email"], [type="password"]):-webkit-autofill:focus,
.auth-form input:is([type="email"], [type="password"]):autofill:focus {
  border-color: var(--accent, var(--text));
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
}

.auth-form {
  max-width: 400px;
  margin: 10px 0;
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.76rem;
  color: var(--text-section-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-link {
  text-align: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.91rem;
}

body[data-page="login"] .button-dark,
body[data-page="signup"] .button-dark {
  padding: 8px 16px;
  font-size: 0.91rem;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(24, 18, 16, 0.16);
}

.auth-link a {
  color: var(--accent);
  text-decoration: underline;
}

/* Verification Page Styling */
body[data-page="verify"] .home-focus-card {
  width: min(560px, 100%);
  max-width: 560px;
  min-height: auto;
  padding: 20px 24px;
  gap: 12px;
}

body[data-page="verify"] .home-focus-card h1 {
  white-space: normal;
  max-width: 100%;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  line-height: 1.1;
}

.verification-subtitle {
  font-size: 0.91rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  text-align: center;
}

.verification-code-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
  flex-wrap: wrap;
}

.verification-code-input {
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 600;
  padding: 0;
  outline: none;
  transition: all 180ms ease;
}

.verification-code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(173, 137, 92, 0.1);
}

.verification-code-input::placeholder {
  color: var(--border);
  opacity: 0.5;
}

body[data-page="verify"] .button-dark {
  padding: 8px 16px;
  font-size: 0.91rem;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(24, 18, 16, 0.16);
  margin-top: 6px;
}

body[data-page="verify"] .button-dark:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body[data-page="verify"] .page-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
}

body[data-page="verify"] .home-minimal {
  min-height: calc(100vh - 20px);
  padding: 10px 0;
}

/* Username Page Styling */
body[data-page="username"] .home-focus-card {
  width: min(560px, 100%);
  max-width: 560px;
  min-height: auto;
  padding: 20px 24px;
  gap: 12px;
}

body[data-page="username"] .home-focus-card h1 {
  white-space: normal;
  max-width: 100%;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  line-height: 1.1;
}

.username-subtitle {
  font-size: 0.91rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  text-align: center;
}

.username-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0;
}

.username-input-container {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 0 12px;
  transition: all 180ms ease;
}

.username-input-container.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(173, 137, 92, 0.1);
}

.username-prefix {
  font-size: 0.94rem;
  color: var(--muted);
  font-weight: 500;
  margin-right: 2px;
  user-select: none;
  pointer-events: none;
}

.username-input {
  flex: 1;
  padding: 11px 0;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 0.94rem;
  font-family: inherit;
}

.username-input::placeholder {
  color: var(--text-placeholder);
  opacity: 0.5;
}

.username-validation-state {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.validation-message {
  font-size: 0.84rem;
  line-height: 1.2;
  font-weight: 500;
  transition: all 200ms ease;
  display: inline-block;
}

.validation-message.available {
  color: #4a9d6f;
}

.validation-message.unavailable {
  color: #c85a54;
}

.validation-message.checking {
  color: var(--muted);
  opacity: 0.7;
}

.validation-message.neutral {
  color: var(--muted);
}

body[data-page="username"] .button-dark {
  padding: 8px 16px;
  font-size: 0.91rem;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(24, 18, 16, 0.16);
  margin-top: 6px;
}

body[data-page="username"] .button-dark:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body[data-page="username"] .page-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
}

body[data-page="username"] .home-minimal {
  min-height: calc(100vh - 20px);
  padding: 10px 0;
}

@media (max-width: 640px) {
  .username-input {
    font-size: 0.92rem;
  }

  .username-prefix {
    font-size: 0.92rem;
  }
}

@media (max-width: 640px) {
  .verification-code-input {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .verification-code-container {
    gap: 6px;
  }
}

.tag-chip {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip-surface);
  color: var(--muted);
  cursor: pointer;
}

.tag-chip.is-selected {
  background: var(--chip-active);
  color: var(--chip-active-text);
}

.slider-group {
  margin: 24px 0;
}

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

input[type="range"] {
  width: 100%;
  accent-color: #2e2521;
}

.status-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--status-surface);
  color: var(--text);
}

.output-image {
  min-height: 240px;
  margin-bottom: 16px;
}

.output-a {
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 247, 239, 0.96), transparent 30%),
    linear-gradient(145deg, #efe3d8, #b79c88 55%, #6d5950 100%);
}

.output-b {
  background:
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.65), transparent 28%),
    linear-gradient(145deg, #d5c3b7, #6f6159 45%, #1d1b1a 100%);
}

.output-c {
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 248, 246, 0.82), transparent 28%),
    linear-gradient(145deg, #f3e3dd, #c39f95 52%, #8e6c63 100%);
}

.user-overview-card,
.library-panel,
.brands-panel {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.library-panel {
  position: relative;
  padding-bottom: 74px;
}

.user-overview-card,
.brands-panel {
  display: grid;
  gap: 28px;
}

.view-all-button {
  position: absolute;
  right: 30px;
  bottom: 30px;
  padding: 8px 16px;
  font-size: 0.84rem;
  border-radius: 999px;
  border-color: var(--border);
  background: var(--soft-surface);
  color: var(--muted);
  box-shadow: 0 10px 18px rgba(12, 10, 8, 0.06);
  min-width: 96px;
  line-height: 1.1;
  opacity: 0.94;
}

@media (max-width: 640px) {
  .view-all-button {
    right: 20px;
    bottom: 20px;
    padding: 7px 14px;
    font-size: 0.82rem;
    min-width: 88px;
  }
}

.user-overview-top {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.user-photo-shell {
  display: grid;
  place-items: center;
}

.user-overview-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 0.95;
  max-width: none;
}

.user-overview-copy h1 .username-metadata {
  display: inline-block;
  margin-left: 14px;
  font-size: 0.9rem;
  line-height: 1.2;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.08em;
  opacity: 0.78;
}

.user-overview-copy p:last-child {
  margin: 12px 0 0;
  max-width: 56ch;
}

.user-overview-meta {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 18px;
}

.user-meta-card,
.library-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-strong);
}

.user-meta-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--headline);
}

.user-meta-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.avatar-shell {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #d7c2ad, #8e715c);
  color: #fffaf4;
  font-family: "Segoe UI", sans-serif;
  font-size: 2rem;
  font-weight: 500;
}

.avatar-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: none;
}

.avatar-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #d7c2ad, #8e715c);
  color: #fffaf4;
  font-family: "Segoe UI", sans-serif;
  font-size: 2rem;
  font-weight: 500;
  pointer-events: none;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 2;
}

.avatar-button:hover .avatar-overlay {
  opacity: 1;
}

.avatar-pencil-icon {
  color: #fffaf4;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.theme-dot {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.theme-dot.is-active {
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 0 0 0 1px var(--text);
}

.theme-light {
  background: linear-gradient(135deg, #f9fafa, #dde2e6);
}

.theme-titanium {
  background: linear-gradient(135deg, #f4ede5, #bda590);
}

.theme-midnight {
  background: linear-gradient(135deg, #162d4b, #020611);
}

.theme-matte,
.theme-black {
  background: linear-gradient(135deg, #373732, #10100f);
}

.theme-graphite {
  background: linear-gradient(135deg, #292b2f, #414349);
}

.theme-pure-black {
  background: linear-gradient(135deg, #000000, #121212);
}

.theme-light-sand {
  background: linear-gradient(135deg, #E8DDCF, #927A66);
}

.theme-baby-pink {
  background: linear-gradient(135deg, #f8e9ef, #e1b8c8);
}

.theme-tiffany-blue {
  background: linear-gradient(135deg, #ddf5f2, #a9d8d3);
}

.theme-baby-green {
  background: linear-gradient(135deg, #e8f3e9, #b7d3ba);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

body[data-page="collections"] .library-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  justify-content: flex-start;
}

body[data-page="collections"] .library-grid article.library-card {
  display: block;
  flex: 0 0 220px;
  max-width: 220px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  transition: none;
}

body[data-page="collections"] .library-grid article.library-card:hover {
  transform: none;
}

body[data-page="collections"] .library-grid article.library-card .image-panel {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  aspect-ratio: auto;
  min-height: 160px;
  max-width: 220px;
}

body[data-page="collections"] .library-grid article.library-card .image-panel img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

@media (max-width: 1440px) {
  body[data-page="collections"] .library-grid article.library-card {
    flex: 0 0 200px;
    max-width: 200px;
  }
  body[data-page="collections"] .library-grid article.library-card .image-panel {
    max-width: 200px;
    min-height: 150px;
  }
}

@media (max-width: 1200px) {
  body[data-page="collections"] .library-grid article.library-card {
    flex: 0 0 180px;
    max-width: 180px;
  }
  body[data-page="collections"] .library-grid article.library-card .image-panel {
    max-width: 180px;
    min-height: 140px;
  }
}

@media (max-width: 900px) {
  body[data-page="collections"] .library-grid article.library-card {
    flex: 0 0 160px;
    max-width: 160px;
  }
  body[data-page="collections"] .library-grid article.library-card .image-panel {
    max-width: 160px;
    min-height: 130px;
  }
}

@media (max-width: 650px) {
  body[data-page="collections"] .library-grid article.library-card {
    flex: 0 0 calc(50% - 5px);
    max-width: calc(50% - 5px);
  }
  body[data-page="collections"] .library-grid article.library-card .image-panel {
    max-width: calc(50% - 5px);
    min-height: 120px;
  }
}

@media (max-width: 480px) {
  body[data-page="collections"] .library-grid article.library-card {
    flex: 0 0 100%;
    max-width: 100%;
  }
  body[data-page="collections"] .library-grid article.library-card .image-panel {
    max-width: 100%;
    min-height: 120px;
  }
}

body[data-page="collections"] .library-grid article.library-card .gallery-metadata,
body[data-page="collections"] .library-grid article.library-card .preview-label,
body[data-page="collections"] .library-grid article.library-card .preview-prompt {
  display: none;
}

body[data-page="collections"] .library-grid article.library-card .image-card-menu-btn {
  top: 10px;
  right: 10px;
}

body[data-page="collections"] .library-grid article.library-card .favorite-badge {
  top: 10px;
  left: 10px;
}

/* Remove card appearance from the Library page - pure image display */
body[data-page="library"] .library-grid article.library-card {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
  margin: 0;
}

body[data-page="library"] .library-grid article.library-card:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

body[data-page="library"] .library-grid article.library-card .image-panel {
  margin-bottom: 0;
  border-radius: 0;
}

body[data-page="library"] .library-grid article.library-card .gallery-metadata {
  display: none;
}

body[data-page="user"] .library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

body[data-page="user"] .library-grid article.library-card {
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
  transition: transform 180ms ease, border-color 180ms ease;
}

body[data-page="user"] .library-grid article.library-card:hover {
  transform: translateY(-1px);
}

body[data-page="user"] .library-grid article.library-card .image-panel,
body[data-page="user"] .library-grid article.library-card .library-image,
body[data-page="user"] .library-grid article.library-card .library-image img {
  border-radius: 0;
}

body[data-page="user"] .library-grid article.library-card .image-panel {
  overflow: hidden;
  margin-bottom: 0;
  aspect-ratio: 1 / 1;
  position: relative;
}

body[data-page="user"] .library-grid article.library-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

body[data-page="user"] .library-grid article.library-card .gallery-metadata {
  display: none;
}

body[data-page="user"] .library-grid article.library-card .image-card-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

body[data-page="user"] .library-grid article.library-card .favorite-badge {
  top: 8px;
  left: 8px;
}

body[data-page="user"] .library-grid article.library-card h3,
body[data-page="user"] .library-grid article.library-card p,
body[data-page="user"] .library-grid article.library-card .preview-label,
body[data-page="user"] .library-grid article.library-card .preview-prompt {
  display: none;
}

.library-image {
  min-height: 250px;
  margin-bottom: 16px;
}

.library-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  pointer-events: none;
}

.library-preview-overlay.is-open {
  pointer-events: auto;
}

.library-preview-card {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 40px 90px rgba(15, 13, 11, 0.16);
  border-radius: 28px;
  padding: 22px;
  min-width: 320px;
  max-width: 420px;
  display: grid;
  gap: 18px;
  backdrop-filter: blur(16px);
  transition: opacity 180ms ease, transform 180ms ease;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.library-preview-overlay.is-open .library-preview-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.library-preview-image-shell {
  border-radius: 22px;
  overflow: hidden;
  min-height: 220px;
  background: var(--panel-alt);
}

.library-preview-image-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-preview-meta {
  display: grid;
  gap: 12px;
}

.preview-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.library-preview-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preview-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(60, 45, 31, 0.14);
  background: rgba(255, 255, 255, 0.86);
  color: var(--headline);
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.preview-action:hover {
  transform: translateY(-1px);
  border-color: rgba(60, 45, 31, 0.24);
  background: rgba(255, 255, 255, 0.98);
}

@media (max-width: 980px) {
  body[data-page="user"] .library-grid {
    column-count: 2;
  }

  .library-preview-card {
    width: calc(100vw - 32px);
    left: 16px !important;
    top: 16px !important;
    max-height: calc(100vh - 32px);
  }
}

@media (max-width: 640px) {
  body[data-page="user"] .library-grid {
    column-count: 1;
  }

  .library-preview-card {
    width: calc(100vw - 28px);
    left: 14px !important;
    top: 14px !important;
    padding: 18px;
  }
}

.library-a {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 249, 241, 0.9), transparent 28%),
    linear-gradient(145deg, #efe4d8, #baa18d 52%, #7e675d 100%);
}

/* =====================================================
   AI CHAT ASSISTANT STYLES
   ===================================================== */

.chat-assistant-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: inherit;
}

/* Floating Action Button (FAB) */
.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 220ms ease;
  position: relative;
}

.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.16);
}

.chat-fab:active {
  transform: scale(0.96);
}

.chat-fab.hidden {
  display: none;
  visibility: hidden;
}

.chat-fab-icon {
  width: 24px;
  height: 24px;
  color: var(--text);
}

.chat-fab-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(225, 83, 78, 0.95);
  box-shadow: 0 0 0 2px var(--panel);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.chat-fab.has-unread .chat-fab-badge {
  opacity: 1;
  transform: scale(1);
}

/* Chat Panel */

body.chat-expanded .page-shell {
  width: min(1380px, calc(100% - 268px - 300px - 40px));
}

.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  height: 500px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: right center;
  animation: chatOpen 220ms ease forwards;
  transition: all 260ms ease;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  z-index: 1000;
}

.chat-panel.is-expanded {
  position: fixed;
  right: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  background: var(--panel-solid);
  transform: none;
  opacity: 1;
  animation: none;
  border-radius: 0;
}

.chat-context-panel {
  position: fixed;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: inherit;
  opacity: 1;
}

.chat-context-panel[hidden] {
  display: none;
}

.chat-context-panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-solid);
}

.chat-context-panel-header h3 {
  margin: 0;
  color: var(--headline);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.chat-context-panel-close {
  display: inline-grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  opacity: 1;
}

.chat-context-panel-close:hover {
  border-color: var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.chat-context-panel-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-context-panel-scroll {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.chat-context-panel-scroll::-webkit-scrollbar {
  width: 5px;
}

.chat-context-panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.chat-context-panel-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar);
}

.chat-context-panel-controls {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  border-bottom: 0;
  opacity: 1;
}

.chat-context-helper,
.chat-context-panel-status {
  margin: 0;
  color: var(--text-metadata);
  font-size: 0.68rem;
  line-height: 1.45;
}

.chat-context-type-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.chat-context-type-menu[hidden],
.chat-context-picker[hidden] {
  display: none;
}

.chat-context-type-menu button,
.chat-context-picker > button {
  min-width: 0;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--composer-border);
  border-radius: 9px;
  background: var(--composer-surface);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.chat-context-type-menu button:hover,
.chat-context-picker > button:hover {
  border-color: var(--border);
  background: var(--panel-strong);
}

.chat-context-type-menu button:focus-visible,
.chat-context-picker > button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-context-picker {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.chat-context-picker-back {
  display: grid;
  place-items: center;
  width: 30px;
  padding: 0 !important;
  font-size: 1.1rem !important;
  text-align: center !important;
}

.chat-context-picker-title {
  min-width: 0;
  color: var(--headline);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-context-picker .chat-select,
.chat-context-picker .chat-context-library-open {
  grid-column: 1 / -1;
}

.chat-context-panel-status:empty {
  display: none;
}

.chat-context-panel.is-constrained .chat-context-row {
  grid-template-columns: minmax(64px, 0.85fr) minmax(0, 1.15fr);
}

body.chat-expanded .chat-panel.is-expanded {
  box-shadow: rgba(0, 0, 0, 0.08) 0px 20px 60px;
}

@media (max-width: 1100px) {
  /* Removed chat-workspace-layout styles */
}

@media (max-width: 720px) {
  .chat-panel {
    right: 16px;
    bottom: 16px;
    width: calc(100vw - 32px);
  }

  .chat-panel.is-expanded {
    width: 100vw;
    height: 100vh;
    right: 0;
    top: 0;
  }

  body.chat-expanded .page-shell {
    width: 100%;
  }
}

/* Minimized state */
.chat-panel.is-minimized {
  animation: chatClose 220ms ease forwards;
}

@keyframes chatClose {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
}

@keyframes chatOpen {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-header-content {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.chat-conversation-back {
  display: inline-grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 8px 0 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.chat-conversation-back:hover {
  border-color: var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.chat-conversation-back:active {
  transform: scale(0.94);
}

.chat-conversation-back:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-conversation-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-conversation-list-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-solid);
}

.chat-panel .chat-conversation-list-view[hidden],
.chat-panel .chat-messages[hidden],
.chat-panel .chat-input-area[hidden],
.chat-panel .chat-conversation-back[hidden] {
  display: none !important;
}

.chat-conversation-list-toolbar {
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.chat-conversation-list-new {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.chat-conversation-list-new svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: currentColor;
  color: var(--text-metadata);
}

.chat-conversation-list-new:hover {
  border-color: var(--border);
  background: var(--panel-strong);
}

.chat-conversation-list-new:focus-visible,
.chat-conversation-list-row button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-conversation-list-new:disabled,
.chat-conversation-list-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-conversation-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-conversation-list-row {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: start;
  min-width: 0;
  min-height: 44px;
  gap: 4px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.chat-conversation-list-row:hover {
  border-color: var(--border);
  background: var(--panel-alt);
}

.chat-conversation-list-open {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 4px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.chat-conversation-list-actions {
  position: relative;
  display: flex;
  width: 54px;
  min-width: 54px;
  gap: 2px;
}

.chat-conversation-list-action {
  display: inline-grid;
  flex: 0 0 26px;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text-metadata);
  opacity: 0;
  cursor: pointer;
  transition: opacity 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.chat-conversation-list-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.chat-conversation-list-row:hover .chat-conversation-list-action,
.chat-conversation-list-row:focus-within .chat-conversation-list-action {
  opacity: 1;
}

.chat-conversation-list-action:hover,
.chat-conversation-list-action:focus-visible,
.chat-conversation-list-action:active {
  border-color: var(--composer-border);
  background: var(--panel-strong);
}

.chat-conversation-list-delete:hover,
.chat-conversation-list-delete:focus-visible,
.chat-conversation-list-delete:active {
  border-color: color-mix(in srgb, var(--destructive-hover) 34%, transparent);
  color: var(--destructive-hover);
}

.chat-conversation-delete-confirmation {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 176px;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border-input);
  border-radius: 10px;
  background: var(--panel-solid);
  box-shadow: 0 12px 28px rgb(0 0 0 / 18%);
}

.chat-conversation-delete-confirmation button,
.chat-conversation-inline-form button {
  min-height: 26px;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.chat-conversation-delete-confirmation button:hover,
.chat-conversation-inline-form button:hover {
  background: var(--panel-alt);
}

.chat-conversation-delete-confirmation button.is-danger {
  color: var(--destructive);
}

.chat-conversation-delete-confirmation button.is-danger:hover,
.chat-conversation-delete-confirmation button.is-danger:focus-visible {
  background: var(--destructive-hover);
  color: #fff;
}

.chat-conversation-delete-title {
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}

.chat-conversation-action-tooltip.is-danger {
  border-color: color-mix(in srgb, var(--destructive) 34%, var(--border));
  color: var(--destructive);
}

.chat-conversation-delete-copy {
  margin: 0;
  color: var(--text-metadata);
  font-size: 0.66rem;
  line-height: 1.3;
}

.chat-conversation-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.chat-conversation-delete-actions button {
  text-align: center;
}

.chat-conversation-list-row.is-editing {
  grid-template-columns: minmax(0, 1fr);
}

.chat-conversation-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 4px;
  min-width: 0;
}

.chat-conversation-inline-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  outline: none;
  background: var(--composer-surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.25;
}

.chat-conversation-inline-input:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.chat-conversation-inline-input[aria-invalid=true] {
  border-color: var(--destructive);
}

.chat-conversation-inline-form button {
  border: 1px solid var(--composer-border);
  background: var(--composer-surface);
}

.chat-conversation-inline-error {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 0 7px;
  color: var(--destructive);
  font-size: 0.64rem;
  line-height: 1.3;
}

.chat-conversation-list-empty {
  margin: 0;
  padding: 28px 14px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: center;
}

.chat-panel > *,
.chat-intelligence-controls,
.chat-intelligence-controls > *,
.chat-conversation-row > *,
.chat-conversation-actions > *,
.chat-context-row > *,
.chat-context-chips,
.chat-used-context {
  min-width: 0;
  max-width: 100%;
}

.chat-intelligence-controls {
  --chat-control-font-size: 12px;
  --chat-control-meta-font-size: 10px;
  --chat-control-line-height: 1.25;
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
  overflow: hidden;
}

.chat-conversation-row {
  display: grid;
  gap: 7px;
}

.chat-conversation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chat-context-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 6px;
}

.chat-intelligence-controls select,
.chat-intelligence-controls button {
  border: 1px solid var(--composer-border);
  border-radius: 10px;
  background: var(--composer-surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.74rem;
  line-height: 1.2;
}

.chat-intelligence-controls select {
  width: 100%;
  padding: 8px 10px;
  text-overflow: ellipsis;
}

.chat-intelligence-controls button {
  padding: 7px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chat-intelligence-controls button:hover {
  border-color: var(--border);
  background: var(--panel-strong);
}

.chat-intelligence-controls select:focus-visible,
.chat-intelligence-controls button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.chat-conversation-actions > button {
  box-sizing: border-box;
  min-height: 28px;
  height: 28px;
  padding: 3px 7px;
  border-radius: 7px;
  font-family: inherit;
  font-size: var(--chat-control-font-size);
  line-height: var(--chat-control-line-height);
}

#chat-conversation-new {
  min-width: 28px;
  padding-inline: 7px;
}

.chat-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.chat-context-chips:empty,
.chat-used-context:empty {
  display: none;
}

.chat-context-chips button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-color: transparent;
  border-radius: 12px;
  background: var(--chip-active);
  color: var(--chip-active-text);
  font-family: inherit;
  font-size: var(--chat-control-font-size);
  font-weight: 600;
  line-height: var(--chat-control-line-height);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.chat-context-chips button img {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  object-fit: cover;
}

.chat-context-chip-remove {
  flex: 0 0 auto;
  font-size: 0.9em;
  opacity: 0.72;
}

.chat-context-chips button:hover {
  border-color: transparent;
  background: var(--chip-active);
  color: var(--chip-active-text);
  opacity: 0.84;
}

.chat-used-context {
  width: 100%;
  color: var(--text-metadata);
  font-size: var(--chat-control-meta-font-size);
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chat-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.chat-select {
  width: 100%;
  min-width: 0;
}

.chat-select-trigger,
.chat-context-library-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 28px;
  height: 28px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: var(--chat-control-font-size);
  line-height: var(--chat-control-line-height);
  text-align: left;
}

.chat-select-trigger:hover,
.chat-context-library-open:hover {
  border-color: var(--accent);
  background: var(--panel-alt);
}

.chat-select-trigger:focus-visible,
.chat-context-library-open:focus-visible,
.chat-modal-close:focus-visible,
.chat-modal-button:focus-visible,
.chat-library-card:focus-visible,
.chat-modal-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-select-trigger:disabled,
.chat-context-library-open:disabled,
.chat-modal-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.chat-context-panel .chat-select-trigger,
.chat-context-panel .chat-context-library-open,
#chat-context-type-menu,
#chat-context-type-menu .chat-select-option,
#chat-context-entity-menu,
#chat-context-entity-menu .chat-select-option,
.chat-library-modal,
.chat-library-modal .chat-modal-close,
.chat-library-modal .chat-library-card,
.chat-library-modal .chat-library-copy,
.chat-library-modal .chat-library-preview img,
.chat-context-panel .chat-context-chips button,
.chat-context-panel .chat-context-chips button:hover {
  opacity: 1;
}

#chat-context-type-menu,
#chat-context-entity-menu {
  border-color: var(--border);
  background: var(--panel-solid);
  color: var(--text);
}

.chat-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-select-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 140ms ease;
}

.chat-select-chevron::before {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.chat-select-trigger[aria-expanded="true"] .chat-select-chevron {
  transform: rotate(180deg);
}

.chat-select-menu {
  --chat-control-font-size: 12px;
  --chat-control-meta-font-size: 10px;
  --chat-control-line-height: 1.25;
  position: fixed;
  z-index: 12050;
  min-width: 0;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(220px, calc(100vh - 24px)) !important;
  padding: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgb(0 0 0 / 18%);
  color: var(--text);
  font-family: inherit;
  font-size: var(--chat-control-font-size);
  line-height: var(--chat-control-line-height);
}

.chat-select-option {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 28px;
  height: 28px;
  gap: 5px;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: var(--chat-control-font-size);
  line-height: var(--chat-control-line-height);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-select-option small {
  font-size: var(--chat-control-meta-font-size);
  line-height: var(--chat-control-line-height);
}

.chat-select-option[aria-selected='true'] {
  padding-right: 22px;
}

.chat-select-option:hover,
.chat-select-option[data-active="true"] {
  background: var(--panel-alt);
}

.chat-select-option[aria-selected="true"] {
  background: var(--chip-active);
  color: var(--chip-active-text);
}

.chat-select-option[aria-selected="true"]::after {
  content: "\2713";
  position: absolute;
  right: 10px;
}

.chat-select-option[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}

.chat-modal-host {
  position: static;
  z-index: auto;
}

.chat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 46%);
  backdrop-filter: blur(3px);
  isolation: isolate;
  overscroll-behavior: contain;
}

body.chat-modal-is-open {
  overflow: hidden;
}

.chat-modal-overlay[hidden] {
  display: none;
}

.chat-modal {
  display: flex;
  flex-direction: column;
  width: min(980px, calc(100vw - 48px));
  max-width: 100%;
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(0 0 0 / 26%);
  color: var(--text);
  font-family: inherit;
}

.chat-rename-modal {
  width: min(380px, calc(100vw - 48px));
}

.chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.chat-modal-title {
  margin: 0;
  color: var(--headline);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.chat-modal-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
}

.chat-modal-close:hover {
  border-color: var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.chat-modal-body {
  min-width: 0;
  padding: 20px;
}

.chat-modal-field {
  display: grid;
  gap: 8px;
}

.chat-modal-label {
  color: var(--text-section-label);
  font-size: 0.76rem;
}

.chat-modal-input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.chat-modal-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--danger, #b44747);
  font-size: 0.74rem;
}

.chat-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}

.chat-modal-button {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--text);
  font: inherit;
}

.chat-modal-button:hover {
  border-color: var(--accent);
}

.chat-modal-button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast, var(--bg));
}

.chat-library-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
}

.chat-library-status {
  margin: 0;
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
}

.chat-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  min-width: 0;
}

.chat-library-card {
  display: grid;
  min-width: 0;
  padding: 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.chat-library-card:hover {
  border-color: var(--border);
  background: var(--panel-alt);
}

.chat-library-card[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--chip-active);
  color: var(--chip-active-text);
}

.chat-library-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 9px;
  background: var(--chat-muted-surface);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-align: center;
}

.chat-library-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 140ms ease;
}

.chat-library-preview.is-loaded img {
  opacity: 1;
}

.chat-library-preview.is-loading {
  animation: chat-library-pulse 1.2s ease-in-out infinite alternate;
}

.chat-library-preview.is-placeholder {
  padding: 12px;
  animation: none;
}

.chat-library-copy {
  min-width: 0;
  padding: 8px 3px 3px;
  overflow: hidden;
  color: inherit;
  font-size: 0.74rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-library-card.is-loading {
  pointer-events: none;
}

.chat-library-card.is-loading .chat-library-skeleton-image,
.chat-library-card.is-loading .chat-library-skeleton-line {
  display: block;
  background: var(--panel-alt);
  animation: chat-library-pulse 1.2s ease-in-out infinite alternate;
}

.chat-library-card.is-loading .chat-library-skeleton-image {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 9px;
}

.chat-library-card.is-loading .chat-library-skeleton-line {
  height: 0.75rem;
  margin: 10px 3px 5px;
  border-radius: 999px;
}

.chat-library-copy strong,
.chat-library-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-library-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
}

@keyframes chat-library-pulse {
  to { opacity: 0.45; }
}

@media (max-width: 1280px) and (min-width: 721px) {
  .chat-modal-overlay {
    padding: 18px;
  }

  .chat-modal {
    width: min(880px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
  }

  .chat-rename-modal {
    width: min(380px, calc(100vw - 36px));
  }

  .chat-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

.chat-title {
  /* Shared Chat title uses the global interface typeface. */
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--headline);
}

.chat-status {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin: 0 4px 0 auto;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.chat-status::before {
  content: "";
  display: block;
  align-self: center;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fa66a;
}

.chat-expand-btn,
.chat-close-btn,
.chat-minimize-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.72;
  transition: all 220ms ease;
  border-radius: 8px;
  font-size: 1rem;
  min-width: 34px;
  min-height: 34px;
  flex-shrink: 0;
}

.chat-expand-btn:hover,
.chat-close-btn:hover,
.chat-minimize-btn:hover {
  opacity: 1;
  background: var(--panel-alt);
}

.chat-expand-btn {
  font-weight: 700;
}

.chat-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.6;
  transition: opacity 220ms ease;
  border-radius: 4px;
  font-size: 1.2rem;
  line-height: 1;
  min-width: 34px;
  min-height: 34px;
  flex-shrink: 0;
}

.chat-close-btn:hover {
  opacity: 1;
}

/* Minimize Button */
.chat-minimize-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.6;
  transition: all 220ms ease;
  border-radius: 4px;
  flex-shrink: 0;
}

.chat-minimize-btn:hover {
  opacity: 1;
  background: var(--panel-alt);
}

.chat-minimize-btn:active {
  transform: scale(0.9);
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.chat-subscription-gate {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100%;
  text-align: center;
}

.chat-subscription-gate p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-subscription-action {
  min-width: auto;
  min-height: 32px;
  padding: 0 14px;
  border-color: var(--success);
  border-radius: 9px;
  background: var(--success);
  color: var(--text-inverse);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  box-shadow: none;
}

.chat-subscription-action:hover {
  border-color: color-mix(in srgb, var(--success) 86%, var(--text-primary));
  background: color-mix(in srgb, var(--success) 86%, var(--text-primary));
}

.chat-message {
  display: flex;
  gap: 12px;
  margin: 0;
  animation: fadeInUp 220ms ease;
  min-width: 0;
  max-width: 100%;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
  font-size: 0.9rem;
}

.chat-message.user .chat-message-bubble {
  background: var(--chat-user-surface);
  color: var(--chip-active-text);
  border-radius: 12px 4px 12px 12px;
}

.chat-message.assistant {
  align-items: flex-end;
}

.chat-message.assistant .assistant-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
}

.chat-message.assistant .assistant-avatar svg {
  width: 16px;
  height: 16px;
}

.chat-message.assistant .assistant-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
}

.chat-message.assistant .assistant-avatar svg {
  width: 16px;
  height: 16px;
}

.chat-message.assistant .chat-message-bubble {
  background: var(--surface-content-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
  max-width: calc(100% - 50px);
}

.chat-message.assistant.assistant-response {
  flex-direction: column;
  align-items: flex-start;
}

.chat-message.assistant.assistant-response .chat-message-bubble {
  width: 100%;
  max-width: 100%;
}

/* ===== PREMIUM RICH MESSAGE FORMATTING ===== */

/* Reset defaults for structured elements */
.chat-message-bubble p,
.chat-message-bubble h1,
.chat-message-bubble h2,
.chat-message-bubble h3,
.chat-message-bubble h4,
.chat-message-bubble h5,
.chat-message-bubble h6,
.chat-message-bubble ul,
.chat-message-bubble ol,
.chat-message-bubble li,
.chat-message-bubble pre,
.chat-message-bubble code,
.chat-message-bubble blockquote,
.chat-message-bubble hr {
  margin: 0;
  padding: 0;
}

/* ===== TYPOGRAPHY HIERARCHY ===== */

.chat-message-bubble h1,
.chat-h1 {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--headline);
  margin: 22px 0 14px 0;
  padding: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.chat-message-bubble h1:first-child,
.chat-h1:first-child {
  margin-top: 0;
}

.chat-message-bubble h2,
.chat-h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--headline);
  margin: 20px 0 12px 0;
  padding: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.chat-message-bubble h2:first-child,
.chat-h2:first-child {
  margin-top: 0;
}

.chat-message-bubble h3,
.chat-h3 {
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--headline);
  margin: 18px 0 10px 0;
  padding: 0;
  line-height: 1.4;
  letter-spacing: 0em;
}

.chat-message-bubble h3:first-child,
.chat-h3:first-child {
  margin-top: 0;
}

/* ===== PARAGRAPHS & TEXT ===== */

.chat-paragraph {
  margin: 0 0 16px 0;
  padding: 0;
  line-height: 1.72;
  color: var(--text);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-message-bubble .chat-paragraph {
  margin: 0 0 16px 0;
  padding: 0;
  display: block;
}

.chat-paragraph:last-child,
.chat-message-bubble .chat-paragraph:last-child {
  margin-bottom: 0;
}

.chat-message-bubble .chat-paragraph:first-child {
  margin-top: 0;
}

.chat-message-bubble .chat-paragraph + .chat-paragraph {
  margin-top: 0;
  margin-bottom: 16px;
}

.chat-message-bubble .chat-paragraph + h1,
.chat-message-bubble .chat-paragraph + h2,
.chat-message-bubble .chat-paragraph + h3 {
  margin-top: 18px;
}

.chat-message-bubble h1 + .chat-paragraph,
.chat-message-bubble h2 + .chat-paragraph,
.chat-message-bubble h3 + .chat-paragraph {
  margin-top: 12px;
}

/* ===== STRONG & EMPHASIS ===== */

.chat-strong {
  font-weight: 700;
  color: var(--headline);
  letter-spacing: -0.005em;
}

.chat-em {
  font-style: italic;
  color: var(--muted);
  font-weight: 500;
}

/* ===== INLINE CODE ===== */

.chat-inline-code {
  display: inline;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.07);
  color: var(--ink);
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}

html[data-theme="light"] .chat-inline-code {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="titanium"] .chat-inline-code {
  background: rgba(0, 0, 0, 0.12);
}

/* ===== CODE/PROMPT BLOCKS ===== */

.chat-prompt-block {
  margin: 16px 0 16px 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-prompt-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: hidden;
  font-size: 0.86rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-prompt-block code {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-weight: 400;
  letter-spacing: -0.01em;
}

html[data-theme="titanium"] .chat-prompt-block {
  background: rgba(34, 31, 28, 0.04);
}

/* ===== LISTS ===== */

.chat-list {
  margin: 14px 0 16px 0;
  padding-left: 26px;
  list-style-position: outside;
}

.chat-list:last-child {
  margin-bottom: 0;
}

.chat-ordered-list {
  list-style-type: decimal;
  list-style: decimal outside;
}

.chat-bullet-list {
  list-style-type: disc;
  list-style: disc outside;
}

.chat-list li {
  margin: 9px 0;
  padding: 0;
  line-height: 1.72;
  color: var(--text);
  font-size: 0.92rem;
  letter-spacing: 0.005em;
  display: list-item;
}

.chat-list li:first-child {
  margin-top: 0;
}

.chat-list li:last-child {
  margin-bottom: 0;
}

/* Nested list support - maintains sequential numbering */
.chat-list li ul,
.chat-list li ol {
  margin: 10px 0 0 0;
  padding-left: 26px;
  list-style-position: outside;
}

/* Nested unordered lists use different markers */
.chat-list li ul {
  list-style-type: circle;
}

/* ===== CHECKLISTS ===== */

.chat-checklist {
  list-style: none;
  padding-left: 0;
  margin: 14px 0 16px 0;
}

.chat-checklist:last-child {
  margin-bottom: 0;
}

.chat-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 9px 0;
  padding: 0;
  line-height: 1.72;
  font-size: 0.92rem;
  color: var(--text);
}

.chat-checkbox-item:first-child {
  margin-top: 0;
}

.chat-checkbox-item:last-child {
  margin-bottom: 0;
}

.chat-checkbox-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 120ms ease;
}

.chat-checkbox-item.checked .chat-checkbox-box {
  background: var(--headline);
  border-color: var(--headline);
  color: white;
}

/* ===== BLOCKQUOTES ===== */

.chat-blockquote {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--border);
  background: rgba(0, 0, 0, 0.02);
  color: var(--muted);
  font-style: italic;
  line-height: 1.72;
  font-size: 0.92rem;
  border-radius: 0 4px 4px 0;
}

.chat-blockquote:first-child {
  margin-top: 0;
}

.chat-blockquote:last-child {
  margin-bottom: 0;
}

/* ===== DIVIDERS ===== */

.chat-divider {
  margin: 20px 0;
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.chat-divider:first-child {
  margin-top: 12px;
}

.chat-divider:last-child {
  margin-bottom: 0;
}

.chat-message-loading {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 12px;
}

.chat-message-loading::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.4s infinite;
}

.chat-message-loading::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.4s infinite 0.2s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

.chat-message-bubble.loading {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.chat-message-bubble.loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: typing 1.4s infinite;
}

.chat-message-bubble.loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-message-bubble.loading span:nth-child(3) {
  animation-delay: 0.4s;
}

.typing-text {
  font-size: 14px;
  color: var(--muted);
  margin-right: 8px;
}

/* Input Area */
.chat-input-area {
  display: flex;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.chat-input-composer {
  --chat-control-font-size: 12px;
  --chat-control-line-height: 1.25;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 6px;
  background: var(--surface-interactive);
  border: 1px solid var(--composer-border);
  border-radius: 12px;
  transition: border-color 200ms ease;
}

.chat-awareness {
  order: -3;
  display: flex;
  flex: 0 0 100%;
  gap: 4px;
  min-width: 0;
  padding: 1px 4px 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--composer-border) 72%, transparent);
  color: var(--text-metadata);
  font-size: 0.66rem;
  line-height: 1.35;
}

.chat-awareness-label {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--muted);
}

.chat-awareness-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-composer-context-row {
  display: none;
  order: -2;
  flex: 0 0 100%;
  min-width: 0;
  padding: 6px 0 0;
}

.chat-input-composer.has-context .chat-composer-context-row {
  display: block;
}

.chat-input-composer:focus-within {
  border-color: var(--muted);
}

.chat-input-composer.is-multiline {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas:
    "awareness awareness awareness"
    "input input input"
    "context . send";
  column-gap: 10px;
  row-gap: 0.375rem;
  align-items: center;
}

.chat-input-composer.is-multiline.has-context {
  grid-template-areas:
    "awareness awareness awareness"
    "chips chips chips"
    "input input input"
    "context . send";
}

.chat-input-composer.is-multiline .chat-awareness {
  grid-area: awareness;
}

.chat-input-composer.is-multiline.has-context .chat-composer-context-row {
  grid-area: chips;
}

.chat-input-composer.is-multiline .chat-input {
  grid-area: input;
  width: 100%;
}

.chat-input-composer.is-multiline .chat-context-toggle {
  grid-area: context;
}

.chat-input-composer.is-multiline .chat-send-btn {
  grid-area: send;
  justify-self: end;
}

.chat-context-toggle {
  order: -1;
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--composer-border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.chat-context-toggle:hover {
  border-color: var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.chat-context-toggle.is-open,
.chat-context-toggle[aria-expanded='true'] {
  border-color: var(--accent);
  background: var(--chip-active);
  color: var(--chip-active-text);
}

.chat-context-toggle:active {
  transform: scale(0.94);
}

.chat-context-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.chat-context-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  min-height: 44px;
  max-height: calc(1.5rem * 4 + 20px);
  height: auto;
  overflow-y: hidden;
  outline: none;
  transition: height 160ms ease;
}

.chat-input.is-scrollable {
  overflow-y: auto;
}

.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: var(--panel-alt);
  color: var(--text);
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.chat-send-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.95);
}

.chat-send-btn:active {
  transform: scale(0.96);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--panel);
}

.chat-input.is-scrollable::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-input.is-scrollable::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-input.is-scrollable::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 999px;
}

.chat-input.is-scrollable::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

.chat-input.is-scrollable {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .chat-assistant-container {
    bottom: 16px;
    right: 16px;
  }

  .chat-fab {
    width: 52px;
    height: 52px;
  }

  .chat-panel {
    position: fixed;
    width: calc(100% - 32px);
    height: calc(100vh - 120px);
    bottom: 0;
    right: 16px;
    left: 16px;
    max-width: none;
    transform-origin: bottom right;
  }

  .chat-message-bubble {
    max-width: 90%;
  }
}

/* Dark and reference themes supply their Chat surfaces through semantic tokens. */
html[data-theme="matte"] .chat-message.user .chat-message-bubble,
html[data-theme="graphite"] .chat-message.user .chat-message-bubble,
html[data-theme="pure-black"] .chat-message.user .chat-message-bubble {
  color: var(--text-primary);
}

.library-b {
  background:
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.22), transparent 26%),
    linear-gradient(145deg, #45506a, #161d2d 46%, #090b10 100%);
}

.library-c {
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 245, 247, 0.84), transparent 28%),
    linear-gradient(145deg, #f1dfe0, #cf9f9e 52%, #886565 100%);
}

.library-d {
  background:
    radial-gradient(circle at 48% 18%, rgba(255, 252, 244, 0.45), transparent 24%),
    linear-gradient(145deg, #d2c8bc, #98897b 52%, #5d5049 100%);
}

.library-e {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.35), transparent 24%),
    linear-gradient(145deg, #d3d0cb, #66615c 48%, #171717 100%);
}

.library-f {
  background:
    radial-gradient(circle at 34% 18%, rgba(233, 240, 255, 0.42), transparent 24%),
    linear-gradient(145deg, #cfdaf2, #63739a 50%, #1b2234 100%);
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  animation: rise 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Editorial-specific styles */

.studio-feed-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-metadata);
}

.studio-feed-empty p {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.studio-feed-empty p:first-child {
  font-size: 1.1rem;
  color: var(--headline);
}

.studio-feed-prompt {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.studio-feed-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.studio-feed-item:hover .studio-feed-actions {
  opacity: 1;
}

.action-btn {
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--soft-surface);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 150ms ease;
}

.action-btn:hover {
  background: var(--panel-alt);
  border-color: var(--text);
  transform: translateY(-1px);
}

.action-btn.delete-btn {
  color: #c85a54;
  border-color: rgba(200, 90, 84, 0.3);
}

.action-btn.delete-btn:hover {
  background: rgba(200, 90, 84, 0.08);
  border-color: rgba(200, 90, 84, 0.6);
}

.generate-tile-button.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.generate-tile-button.is-loading .generate-tile {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ============================================
   IMAGE VIEWER - Global Immersive Modal
   ============================================ */

.image-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.4, 0, 0.2, 1), pointer-events 320ms step-end;
}

.image-viewer-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 320ms cubic-bezier(0.4, 0, 0.2, 1), pointer-events 0ms;
}

/* One continuous full-viewport glass surface; also handles backdrop clicks. */
.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 11, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: backdropFadeIn 320ms ease-out;
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(12px);
  }
}

/* Full-viewport layer; image, metadata and controls position independently. */
.image-viewer-container {
  --viewer-gutter: 24px;
  --viewer-zone-top: 72px;
  --viewer-zone-bottom: var(--viewer-gutter);
  --viewer-stage-gap: var(--viewer-gutter);
  --viewer-rail-width: clamp(140px, 11vw, 180px);
  --viewer-details-width: clamp(272px, 22vw, 320px);
  --viewer-side-safe: max(
    calc(var(--viewer-rail-width) + var(--viewer-gutter) + var(--viewer-stage-gap)),
    calc(var(--viewer-details-width) + var(--viewer-gutter) + var(--viewer-stage-gap))
  );
  position: absolute;
  inset: 0;
  animation: containerFadeIn 320ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes containerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Independent fullscreen content layers. */
.image-viewer-content {
  position: absolute;
  inset: 0;
  animation: contentScaleIn 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes contentScaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Full-viewport image stage; its center is always the viewport center. */
.image-viewer-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.image-viewer-image-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100vw - var(--viewer-side-safe) - var(--viewer-side-safe));
  height: min(76vh, calc(100vh - 168px));
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  pointer-events: auto;
}

.image-viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  width: auto;
  height: auto;
  transform: scale(var(--viewer-image-zoom, 1));
  transform-origin: center;
  transition: transform 160ms ease;
  will-change: transform;
}

.image-viewer-image-shell--recovery {
  flex-direction: column;
  gap: 16px;
}

.image-viewer-image--recovery {
  max-width: min(512px, 72vw);
  max-height: min(512px, 52vh);
}

.image-viewer-image[hidden],
.image-viewer-loader[hidden],
.image-viewer-error[hidden] {
  display: none;
}

.image-viewer-loader,
.image-viewer-error {
  color: rgba(255, 255, 255, 0.78);
  font: 500 0.86rem/1.5 "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
}

.image-viewer-error {
  max-width: 280px;
  text-align: center;
}

/* Page-owned sequence only; the rail never queries or reorders images. */
.image-viewer-thumbnail-rail {
  position: absolute;
  z-index: 3;
  top: var(--viewer-zone-top);
  bottom: var(--viewer-zone-bottom);
  left: var(--viewer-gutter);
  width: var(--viewer-rail-width);
  padding: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: auto;
}

.image-viewer-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.image-viewer-thumbnails:hover,
.image-viewer-thumbnails:focus-within,
.image-viewer-thumbnails.is-scrolling {
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.image-viewer-thumbnails:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.42);
  outline-offset: -1px;
  border-radius: 6px;
}

.image-viewer-thumbnails::-webkit-scrollbar,
.image-viewer-metadata::-webkit-scrollbar {
  width: 4px;
}

.image-viewer-thumbnails::-webkit-scrollbar-track,
.image-viewer-metadata::-webkit-scrollbar-track {
  background: transparent;
}

.image-viewer-thumbnails::-webkit-scrollbar-thumb,
.image-viewer-metadata::-webkit-scrollbar-thumb {
  border-radius: 999px;
}

.image-viewer-thumbnails::-webkit-scrollbar-thumb {
  background: transparent;
  transition: background-color 180ms ease;
}

.image-viewer-thumbnails:hover::-webkit-scrollbar-thumb,
.image-viewer-thumbnails:focus-within::-webkit-scrollbar-thumb,
.image-viewer-thumbnails.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
}

.image-viewer-metadata::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
}

.image-viewer-thumbnail {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  padding: 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.image-viewer-thumbnail:hover,
.image-viewer-thumbnail:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

.image-viewer-thumbnail[aria-selected="true"] {
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.image-viewer-thumbnail img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  object-fit: cover;
  object-position: center;
}

/* Close button */
.image-viewer-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 4;
  pointer-events: auto;
}

.image-viewer-close-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 200ms ease;
  padding: 0;
  line-height: 1;
}

.image-viewer-close-btn:hover {
  color: rgba(255, 255, 255, 1);
}

/* Navigation arrows */
.image-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.image-viewer-nav-left {
  left: var(--viewer-side-safe);
}

.image-viewer-nav-right {
  right: var(--viewer-side-safe);
}

.image-viewer-nav-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
  padding: 0;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 300;
}

.image-viewer-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 1);
}

.image-viewer-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Details remain independently positioned without an enclosing panel surface. */
.image-viewer-metadata {
  position: absolute;
  z-index: 3;
  top: var(--viewer-zone-top);
  right: var(--viewer-gutter);
  bottom: var(--viewer-zone-bottom);
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: var(--viewer-details-width);
  padding: 10px 19px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: auto;
}

.viewer-inspector-section {
  display: grid;
  gap: 11px;
}

.viewer-inspector-section + .viewer-inspector-section {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.viewer-actions-section {
  margin-top: auto;
}

.viewer-section-heading {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font: 650 0.67rem/1.2 Manrope, "Segoe UI", sans-serif;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.viewer-metadata-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.viewer-badge {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--inverse-text);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  font-weight: 500;
  font-family: "Segoe UI", sans-serif;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.viewer-prompt {
  color: var(--inverse-text);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.viewer-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font: 400 0.78rem/1.55 "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}

.viewer-description[hidden] {
  display: none;
}

.viewer-details {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.viewer-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.78);
  font: 500 0.75rem/1.4 "Segoe UI", sans-serif;
}

.viewer-detail[hidden],
.viewer-origin[hidden],
.viewer-prompt[hidden] {
  display: none;
}

.viewer-detail dt,
.viewer-detail dd {
  margin: 0;
}

.viewer-detail dt {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.52);
}

.viewer-detail dt svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.viewer-detail dd {
  text-align: right;
  overflow-wrap: anywhere;
}

.viewer-actions {
  display: grid;
  gap: 8px;
}

.viewer-actions[hidden] {
  display: none;
}

.viewer-action {
  position: relative;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--inverse-text);
  font: 600 0.72rem/1.2 Manrope, "Segoe UI", sans-serif;
  text-align: left;
  cursor: pointer;
}

.viewer-action:hover:not(:disabled),
.viewer-action:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.viewer-action:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.viewer-action svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.viewer-action--destructive {
  margin-top: 9px;
  color: rgba(235, 157, 157, 0.9);
}

.viewer-action--destructive::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.viewer-action:disabled {
  opacity: 0.5;
  cursor: wait;
}

.viewer-action-select {
  min-height: 34px;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(20, 18, 16, 0.92);
  color: var(--inverse-text);
  padding: 6px 9px;
}

.viewer-action-status {
  color: rgba(255, 255, 255, 0.78);
  font: 500 0.75rem/1.4 "Segoe UI", sans-serif;
  align-self: center;
}

.image-viewer-delete-confirmation {
  position: fixed;
  z-index: 6;
  width: min(280px, calc(100vw - 48px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(25, 23, 21, 0.97);
  color: var(--inverse-text);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

.image-viewer-delete-confirmation h2 {
  margin: 0;
  font: 650 0.88rem/1.35 Manrope, "Segoe UI", sans-serif;
}

.image-viewer-delete-confirmation > p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.67);
  font: 400 0.76rem/1.45 "Segoe UI", sans-serif;
}

.image-viewer-delete-confirmation .viewer-delete-error {
  color: rgba(235, 157, 157, 0.95);
}

.image-viewer-delete-confirmation .viewer-delete-error[hidden] {
  display: none;
}

.viewer-delete-confirmation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 15px;
}

.viewer-delete-confirmation-actions button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font: 600 0.72rem/1 Manrope, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.viewer-delete-confirmation-actions button:hover:not(:disabled),
.viewer-delete-confirmation-actions button:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.viewer-delete-confirmation-actions .viewer-delete-confirm {
  border-color: rgba(193, 83, 83, 0.52);
  color: rgba(235, 157, 157, 0.95);
}

.viewer-delete-confirmation-actions .viewer-delete-confirm:hover:not(:disabled),
.viewer-delete-confirmation-actions .viewer-delete-confirm:focus-visible {
  border-color: rgba(164, 62, 62, 0.9);
  background: rgba(164, 62, 62, 0.9);
  color: #fff;
}

.viewer-delete-confirmation-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.image-viewer-controls {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 9px;
  background: rgba(25, 23, 21, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.image-viewer-control {
  appearance: none;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: 600 0.72rem/1 Manrope, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.image-viewer-control:hover:not(:disabled),
.image-viewer-control:focus-visible {
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 1);
  outline: none;
}

.image-viewer-control:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.image-viewer-control:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.image-viewer-control svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.image-viewer-zoom-value {
  min-width: 46px;
  color: rgba(255, 255, 255, 0.72);
  font: 600 0.7rem/1 Manrope, "Segoe UI", sans-serif;
  text-align: center;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .image-viewer-container {
    inset: 0;
    --viewer-side-safe: 24px;
  }

  .image-viewer-thumbnail-rail {
    display: none;
  }

  .image-viewer-image-shell {
    width: calc(100vw - 48px);
    height: 52vh;
    border-radius: 4px;
  }

  .image-viewer-close {
    top: 16px;
    right: 16px;
  }

  .image-viewer-close-btn {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }

  .image-viewer-nav-left {
    left: 12px;
  }

  .image-viewer-nav-right {
    right: 12px;
  }

  .image-viewer-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }

  .viewer-prompt {
    font-size: 0.95rem;
  }

  .image-viewer-metadata {
    top: auto;
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
    max-height: 28vh;
    padding: 15px;
  }

  .image-viewer-controls {
    bottom: calc(28vh + 28px);
  }
}
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.notification {
  border-radius: 6px;
  padding: 16px 20px;
  font-size: 0.95rem;
  z-index: 10000;
  max-width: 400px;
}

.notification-error {
  background-color: #ff6b6b;
  color: white;
}

.notification-success {
  background-color: #51cf66;
  color: white;
}

    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar,
  .hero-grid,
  .split-section,
  .studio-layout,
  .user-overview-top,
  .user-overview-meta,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    min-height: auto;
    border-radius: 32px;
    padding: 24px;
  }

  .app-sidebar,
  .site-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .brand-mark {
    align-self: center;
  }

  .site-nav {
    flex-direction: row;
    align-items: center;
  }

  .nav-group-main {
    grid-template-columns: auto 20px;
  }

  .nav-submenu {
    padding-left: 0;
  }

  .nav-link {
    text-align: center;
  }

  .nav-cta {
    margin-top: 0;
    width: auto;
  }

  .feature-stack,
  .collection-grid,
  .curriculum-grid,
  .output-grid,
  .editorial-columns,
  .canvas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .canvas-flow-shell {
    min-height: 1120px;
  }

  .output-node {
    left: 360px;
  }

  .canvas-surface {
    width: 100%;
    min-height: auto;
    padding: 0;
  }

  .canvas-connection-layer {
    display: none;
  }

  .hero-stage {
    min-height: 620px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 100%);
    padding-top: 16px;
  }

  .hero-copy h1,
  .page-intro h1,
  .studio-form h1,
  .profile-copy h1 {
    font-size: clamp(2.8rem, 16vw, 4.2rem);
  }

  .hero-metrics,
  .feature-stack,
  .collection-grid,
  .curriculum-grid,
  .output-grid,
  .editorial-columns,
  .library-grid,
  .canvas-grid {
    grid-template-columns: 1fr;
  }

  .face-node,
  .pose-node,
  .clothing-node,
  .background-node,
  .output-node {
    position: relative;
    left: auto;
    top: auto;
  }

  .canvas-toolbar {
    width: 100%;
    justify-content: center;
  }

  .canvas-viewport {
    min-height: auto;
    overflow: visible;
  }

  .canvas-flow-shell {
    display: grid;
    gap: 22px;
    min-height: auto;
  }

  .canvas-reference-card,
  .canvas-final-output {
    width: 100%;
  }

  .large-card {
    position: relative;
    inset: auto;
  }

  .floating-note {
    position: relative;
    width: 100%;
    margin-top: 16px;
  }

  .hero-stage {
    min-height: auto;
  }

  .portrait-panel,
  .studio-form,
  .studio-output {
    min-height: auto;
  }

  .site-header,
  .page-intro,
  .user-overview-card,
  .create-panel,
  .library-panel,
  .studio-panel,
  .quote-panel {
    padding: 22px;
  }

  .canvas-stage,
  .canvas-board {
    min-height: auto;
  }

  .studio-feed-image {
    min-height: 280px;
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-link {
    text-align: left;
  }

  .nav-cta {
    width: 100%;
  }

  .brand-mark {
    align-self: center;
  }

  .home-focus-card {
    min-height: 520px;
    padding: 34px 24px;
    border-radius: 28px;
  }

  .home-color-orbs {
    gap: 14px;
  }

  .home-color-orb {
    width: 26px;
    height: 26px;
  }
}

/* Subscription Modal Styles */
.subscription-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.subscription-modal-overlay.hidden {
  display: none;
}

body.is-modal-open {
  overflow: hidden;
}

.subscription-modal {
  width: min(1200px, calc(100vw - 96px));
  max-width: 1200px;
  max-height: calc(100vh - 96px);
  overflow: hidden;
  padding: 36px;
  border-radius: 32px;
  background: linear-gradient(180deg, #3a3f4d 0%, #32373f 100%);
  border: 1px solid #52585a;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.32), inset 0 1px 0 #4a5058;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: #ffffff;
}

.subscription-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  border: 1px solid #52585a;
  border-radius: 50%;
  background: rgba(82, 88, 90, 0.4);
  color: #ffffff;
  font-size: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.subscription-modal-close:hover {
  transform: translateY(-1px);
  background: rgba(82, 88, 90, 0.6);
}

.subscription-modal-heading {
  text-align: center;
  margin-bottom: 16px;
}

.subscription-modal-heading h2 {
  margin: 0;
  font-size: clamp(0.875rem, 1.2vw, 1.3rem);
  letter-spacing: -0.02em;
  color: #ffffff;
  font-weight: 500;
  line-height: 1.2;
}

.subscription-subtitle {
  margin: 0;
  max-width: 52rem;
  color: #d4d7de;
  line-height: 1.6;
}

.subscription-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 24px;
  width: 100%;
}

.subscription-plan-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 36px;
  border-radius: 32px;
  background: linear-gradient(135deg, #d8dce5 0%, #cacfe0 100%);
  border: 1px solid #b8bfd2;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  min-height: 360px;
  color: #1a1a1a;
}

.subscription-plan-card p {
  margin: 0;
  color: #3a3f4d;
}

.plan-label {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.plan-price {
  font-size: 0.9em;
  font-weight: 600;
  color: #5a5f6d;
  opacity: 0.8;
}

.plan-description {
  color: #3a3f4d;
  font-size: 0.95rem;
  line-height: 1.6;
}

.subscription-plan-card .button {
  margin-top: auto;
  width: 100%;
  background: #2a2e3a;
  color: #ffffff;
  border-color: #3a3f4d;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.subscription-plan-card .button:hover {
  background: #32373f;
  transform: translateY(-1px);
}

.subscription-button {
  margin-top: 16px;
}

/* ============================================================================
   ACCOUNT MENU STYLES
   ============================================================================ */

.account-menu-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10030;
}

.account-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--soft-surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.account-menu-trigger:hover {
  transform: translateY(-1px);
  background: var(--chip-surface);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.account-menu-trigger:active {
  transform: translateY(0);
}

.account-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 160px;
  border-radius: 16px;
  background: var(--soft-surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: menuFadeIn 160ms ease;
}

.account-menu-dropdown.hidden {
  display: none;
}

.account-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 0.92rem;
  transition: background-color 140ms ease, color 140ms ease;
}

.account-menu-item:hover {
  background-color: var(--chip-surface);
  color: var(--headline);
}

.account-menu-item:active {
  background-color: var(--border);
}

.account-logout-btn {
  color: #d4495b;
}

.account-logout-btn:hover {
  background-color: rgba(212, 73, 91, 0.08);
  color: #e85a6a;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .account-menu-container {
    top: 16px;
    right: 16px;
  }

  .account-menu-trigger {
    width: 40px;
    height: 40px;
  }

  .account-menu-dropdown {
    min-width: 140px;
  }
}

@media (max-width: 640px) {
  .account-menu-container {
    top: 12px;
    right: 12px;
  }

  .account-menu-trigger {
    width: 38px;
    height: 38px;
  }

  .account-menu-item {
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .account-menu-dropdown {
    min-width: 130px;
    border-radius: 12px;
  }
}

/* Shared desktop navigation: compact labelled sidebar and persistent icon rail. */
.nav-icon {
  display: none;
}

.sidebar-tooltip {
  position: fixed;
  z-index: 10020;
  max-width: min(220px, calc(100vw - 84px));
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
}

.sidebar-tooltip[hidden],
.sidebar-restore-tab {
  display: none !important;
}

@media (min-width: 1101px) {
  body[data-page="login"] .home-top-brand .maison-edna-logo,
  body[data-page="signup"] .home-top-brand .maison-edna-logo {
    transform: scale(1.55);
  }

  .app-sidebar {
    box-sizing: border-box;
    width: 208px;
    min-width: 208px;
    gap: 12px;
    padding: 16px 12px;
    border-radius: 24px;
    overflow: visible;
    transition: width 260ms ease, min-width 260ms ease, padding 260ms ease;
  }

  .brand-mark {
    width: 39px;
    height: 35px;
    padding: 2px 4px;
    flex: 0 0 auto;
  }

  .maison-edna-logo {
    max-width: 31px;
    max-height: 31px;
  }

  .site-nav {
    flex: 1 1 auto;
    min-height: 0;
    gap: 3px;
    padding: 3px;
    border-radius: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
  }

  .site-nav:hover,
  .site-nav:focus-within {
    scrollbar-color: var(--scrollbar-hover) transparent;
  }

  .site-nav::-webkit-scrollbar {
    width: 4px;
    height: 4px;
    background: transparent;
  }

  .site-nav::-webkit-scrollbar-track,
  .site-nav::-webkit-scrollbar-corner {
    background: transparent;
    box-shadow: none;
  }

  .site-nav::-webkit-scrollbar-thumb {
    border: 0;
    border-radius: 999px;
    background: var(--scrollbar);
  }

  .site-nav:hover::-webkit-scrollbar-thumb,
  .site-nav:focus-within::-webkit-scrollbar-thumb,
  .site-nav::-webkit-scrollbar-thumb:hover,
  .site-nav::-webkit-scrollbar-thumb:active {
    background: var(--scrollbar-hover);
  }

  .site-nav::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
  }

  .nav-group {
    gap: 3px;
  }

  .nav-group + .nav-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .nav-group-main {
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 4px;
  }

  .nav-submenu {
    gap: 3px;
    padding-left: 8px;
  }

  .nav-link,
  .nav-sublink {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 36px;
    gap: 8px;
    padding: 0 8px;
    border-radius: 10px;
  }

  .nav-link {
    font-size: 0.86rem;
  }

  .nav-sublink {
    font-size: 0.78rem;
  }

  .nav-icon {
    display: block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
  }

  .nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-collapse-panel {
    flex: 0 0 auto;
  }

  .sidebar-collapse-toggle {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  body:not([data-page='home']):has(.app-sidebar) .page-shell {
    width: calc(100% - 236px - 40px);
    margin-left: 236px;
  }

  body.chat-expanded:not([data-page='home']):has(.app-sidebar) .page-shell {
    width: calc(100% - 236px - 300px - 40px);
  }

  body[data-page='canvas']:has(.app-sidebar) .page-shell,
  body[data-page='canvas']:has(.app-sidebar) .page-shell.canvas-c7-shell {
    width: calc(100% - 236px);
    margin-left: 236px;
  }

  body[data-page='canvas'].chat-expanded:has(.app-sidebar) .page-shell,
  body[data-page='canvas'].chat-expanded:has(.app-sidebar) .page-shell.canvas-c7-shell {
    width: calc(100% - 236px - 300px);
  }

  body.collapsed-sidebar .app-sidebar {
    width: 54px !important;
    min-width: 54px !important;
    gap: 10px;
    padding: 12px 8px !important;
    border: 1px solid var(--border) !important;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    overflow: visible;
  }

  body.collapsed-sidebar .app-sidebar > * {
    opacity: 1;
    pointer-events: auto;
  }

  body.collapsed-sidebar .app-sidebar .brand-mark {
    align-self: center;
  }

  body.collapsed-sidebar .site-nav {
    width: 36px;
    align-self: center;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }

  body.collapsed-sidebar .nav-group,
  body.collapsed-sidebar .nav-submenu {
    width: 36px;
    gap: 3px;
  }

  body.collapsed-sidebar .nav-group-main {
    display: block;
    width: 36px;
  }

  body.collapsed-sidebar .nav-submenu {
    display: grid;
    padding-left: 0;
  }

  body.collapsed-sidebar .nav-expand,
  body.collapsed-sidebar .nav-label {
    display: none;
  }

  body.collapsed-sidebar .nav-link,
  body.collapsed-sidebar .nav-sublink {
    width: 36px;
    height: 36px;
    min-height: 36px;
    gap: 0;
    padding: 0;
    justify-content: center;
    border-radius: 9px;
  }

  body.collapsed-sidebar .nav-link.active,
  body.collapsed-sidebar .nav-sublink.active {
    background: var(--nav-active);
    color: var(--nav-active-text);
  }

  body.collapsed-sidebar .nav-link.active::before,
  body.collapsed-sidebar .nav-sublink.active::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    width: 2px;
    height: 18px;
    border-radius: 2px;
    background: currentColor;
    transform: translateY(-50%);
  }

  body.collapsed-sidebar .sidebar-collapse-panel {
    width: 36px;
    justify-content: center;
  }

  body.collapsed-sidebar:not([data-page='home']):has(.app-sidebar) .page-shell {
    width: calc(100% - 82px - 40px);
    margin-left: 82px;
  }

  body.collapsed-sidebar.chat-expanded:not([data-page='home']):has(.app-sidebar) .page-shell {
    width: calc(100% - 82px - 300px - 40px);
  }

  body.collapsed-sidebar[data-page='canvas']:has(.app-sidebar) .page-shell,
  body.collapsed-sidebar[data-page='canvas']:has(.app-sidebar) .page-shell.canvas-c7-shell {
    width: calc(100% - 82px);
    margin-left: 82px;
  }

  body.collapsed-sidebar[data-page='canvas'].chat-expanded:has(.app-sidebar) .page-shell,
  body.collapsed-sidebar[data-page='canvas'].chat-expanded:has(.app-sidebar) .page-shell.canvas-c7-shell {
    width: calc(100% - 82px - 300px);
  }

  body.collapsed-sidebar .canvas-ui-overlay {
    padding-left: 82px !important;
  }
}

/* Active Canvas owns the full browser-left boundary; navigation remains an overlay. */
@media (min-width: 1101px) {
  body[data-page='canvas']:has(#canvas-workspace:not([hidden])) .page-shell.canvas-c7-shell {
    position: relative;
    z-index: 0;
    width: 100%;
    margin-left: 0;
  }

  body[data-page='canvas'].chat-expanded:has(#canvas-workspace:not([hidden])) .page-shell.canvas-c7-shell {
    width: calc(100% - 300px);
  }
}

/* Reference dark-theme component-role routing; color properties only. */
html[data-theme='midnight'] .app-sidebar,
html[data-theme='graphite'] .app-sidebar,
html[data-theme='pure-black'] .app-sidebar {
  background-color: var(--surface-navigation);
}

html[data-theme='midnight'] input[type='text'],
html[data-theme='midnight'] input[type='email'],
html[data-theme='midnight'] input[type='password'],
html[data-theme='midnight'] textarea:not(#prompt):not(#canvas-prompt):not(.chat-input),
html[data-theme='midnight'] select,
html[data-theme='graphite'] input[type='text'],
html[data-theme='graphite'] input[type='email'],
html[data-theme='graphite'] input[type='password'],
html[data-theme='graphite'] textarea:not(#prompt):not(#canvas-prompt):not(.chat-input),
html[data-theme='graphite'] select,
html[data-theme='pure-black'] input[type='text'],
html[data-theme='pure-black'] input[type='email'],
html[data-theme='pure-black'] input[type='password'],
html[data-theme='pure-black'] textarea:not(#prompt):not(#canvas-prompt):not(.chat-input),
html[data-theme='pure-black'] select {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html[data-theme='midnight'] .chat-conversation-inline-input,
html[data-theme='midnight'] .chat-conversation-inline-form button,
html[data-theme='midnight'] .chat-intelligence-controls select,
html[data-theme='midnight'] .chat-intelligence-controls button,
html[data-theme='midnight'] .chat-modal-input,
html[data-theme='graphite'] .chat-conversation-inline-input,
html[data-theme='graphite'] .chat-conversation-inline-form button,
html[data-theme='graphite'] .chat-intelligence-controls select,
html[data-theme='graphite'] .chat-intelligence-controls button,
html[data-theme='graphite'] .chat-modal-input,
html[data-theme='pure-black'] .chat-conversation-inline-input,
html[data-theme='pure-black'] .chat-conversation-inline-form button,
html[data-theme='pure-black'] .chat-intelligence-controls select,
html[data-theme='pure-black'] .chat-intelligence-controls button,
html[data-theme='pure-black'] .chat-modal-input {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html[data-theme='midnight'] .chat-modal,
html[data-theme='graphite'] .chat-modal,
html[data-theme='pure-black'] .chat-modal {
  background-color: var(--surface-elevated);
}

html[data-theme='midnight'] .brand-dna-menu,
html[data-theme='midnight'] .chat-select-menu,
html[data-theme='midnight'] .account-menu-dropdown,
html[data-theme='graphite'] .brand-dna-menu,
html[data-theme='graphite'] .chat-select-menu,
html[data-theme='graphite'] .account-menu-dropdown,
html[data-theme='pure-black'] .brand-dna-menu,
html[data-theme='pure-black'] .chat-select-menu,
html[data-theme='pure-black'] .account-menu-dropdown {
  background-color: var(--surface-opaque);
}

html[data-theme='midnight'] .prompt-input-wrapper:focus-within,
html[data-theme='graphite'] .prompt-input-wrapper:focus-within,
html[data-theme='pure-black'] .prompt-input-wrapper:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 8%, transparent);
}

html[data-theme='midnight'] .chat-conversation-inline-input:focus-visible,
html[data-theme='graphite'] .chat-conversation-inline-input:focus-visible,
html[data-theme='pure-black'] .chat-conversation-inline-input:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 28%, transparent);
}

html[data-theme='midnight'] .chat-intelligence-controls select:focus-visible,
html[data-theme='midnight'] .chat-intelligence-controls button:focus-visible,
html[data-theme='graphite'] .chat-intelligence-controls select:focus-visible,
html[data-theme='graphite'] .chat-intelligence-controls button:focus-visible,
html[data-theme='pure-black'] .chat-intelligence-controls select:focus-visible,
html[data-theme='pure-black'] .chat-intelligence-controls button:focus-visible {
  outline-color: var(--focus-ring);
}

html[data-theme='midnight'] .chat-input-composer:focus-within,
html[data-theme='graphite'] .chat-input-composer:focus-within,
html[data-theme='pure-black'] .chat-input-composer:focus-within {
  border-color: var(--focus-ring);
}

html[data-theme='midnight'] .canvas-grid-layer,
html[data-theme='graphite'] .canvas-grid-layer,
html[data-theme='pure-black'] .canvas-grid-layer {
  background-image:
    radial-gradient(circle, color-mix(in srgb, var(--text-muted) 20%, transparent) 1px, transparent 1px),
    linear-gradient(to right, color-mix(in srgb, var(--text-muted) 10%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--text-muted) 10%, transparent) 1px, transparent 1px);
}

html[data-theme='midnight'] body[data-settings-page] .theme-popup-menu {
  background-color: var(--surface-opaque);
}

html[data-theme='midnight'] body[data-settings-page] .settings-edit-grid input {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html[data-theme='midnight'] body[data-settings-page] .settings-logout {
  border-color: color-mix(in srgb, var(--destructive) 45%, transparent);
  color: var(--destructive);
}

html[data-theme='midnight'] body[data-settings-page] .settings-logout:hover {
  background-color: color-mix(in srgb, var(--destructive) 8%, transparent);
}

/* Refined six-theme component-role routing; color properties only. */
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .app-sidebar {
  background-color: var(--surface-navigation);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) input[type='text'],
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) input[type='email'],
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) input[type='password'],
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) textarea:not(#prompt):not(#canvas-prompt):not(.chat-input),
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) select {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-conversation-inline-input,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-conversation-inline-form button,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-intelligence-controls select,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-intelligence-controls button,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-modal-input {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-modal {
  background-color: var(--surface-elevated);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .brand-dna-menu,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-select-menu,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .account-menu-dropdown {
  background-color: var(--surface-opaque);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .prompt-input-wrapper:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 8%, transparent);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-conversation-inline-input:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 28%, transparent);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-intelligence-controls select:focus-visible,
html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-intelligence-controls button:focus-visible {
  outline-color: var(--focus-ring);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .chat-input-composer:focus-within {
  border-color: var(--focus-ring);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) .canvas-grid-layer {
  background-image:
    radial-gradient(circle, color-mix(in srgb, var(--text-muted) 20%, transparent) 1px, transparent 1px),
    linear-gradient(to right, color-mix(in srgb, var(--text-muted) 10%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--text-muted) 10%, transparent) 1px, transparent 1px);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) body[data-settings-page] .theme-popup-menu {
  background-color: var(--surface-opaque);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) body[data-settings-page] .settings-edit-grid input {
  border-color: var(--border-input);
  background-color: var(--surface-input);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) body[data-settings-page] .settings-logout {
  border-color: color-mix(in srgb, var(--destructive) 45%, transparent);
  color: var(--destructive);
}

html:is([data-theme='light'], [data-theme='light-sand'], [data-theme='baby-pink'], [data-theme='tiffany-blue'], [data-theme='baby-green'], [data-theme='matte']) body[data-settings-page] .settings-logout:hover {
  background-color: color-mix(in srgb, var(--destructive) 8%, transparent);
}

/* Sand accent role consolidation; color properties only. */
html[data-theme='light-sand'] .nav-cta,
html[data-theme='light-sand'] .button-dark,
html[data-theme='light-sand'] #brand-edit-save-btn,
html[data-theme='light-sand'] .add-images-footer button.primary,
html[data-theme='light-sand'] .collection-cover-select-btn.primary,
html[data-theme='light-sand'] .collection-action-add,
html[data-theme='light-sand'] .item-cover-select-btn.primary,
html[data-theme='light-sand'] .product-detail-action,
html[data-theme='light-sand'] .product-shelf-add,
html[data-theme='light-sand'] .product-shelf-dialog-actions .primary,
html[data-theme='light-sand'] .product-management-actions .is-primary,
html[data-theme='light-sand'] .refinement-submit,
html[data-theme='light-sand'] .settings-archive-button.is-primary,
html[data-theme='light-sand'] .models-primary,
html[data-theme='light-sand'] .model-action-primary,
html[data-theme='light-sand'] .model-dialog-actions .primary,
html[data-theme='light-sand'] .model-studio-save-actions .primary,
html[data-theme='light-sand'] .chat-modal-button-primary {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
}

html[data-theme='light-sand'] #brand-extract-dna-btn,
html[data-theme='light-sand'] #brand-create-btn,
html[data-theme='light-sand'] #collection-create-btn,
html[data-theme='light-sand'] #PRODUCT-create-btn {
  border-color: var(--active-fill) !important;
  background-color: var(--active-fill) !important;
  color: var(--active-text) !important;
}

html[data-theme='light-sand'] .generate-tile {
  background-color: var(--active-fill);
}

html[data-theme='light-sand'] .chat-input-composer .chat-context-chips button,
html[data-theme='light-sand'] .chat-input-composer .chat-context-chips button:hover {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
  opacity: 1;
}

html[data-theme='light-sand'] .chat-context-toggle:not(:disabled):hover {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
}

html[data-theme='light-sand'] .chat-send-btn:not(:disabled) {
  border-color: transparent;
  background-color: var(--panel-alt);
  color: var(--text);
}

html[data-theme='light-sand'] .chat-send-btn:not(:disabled):hover {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
}

html[data-theme='light-sand'] .chat-select-option[aria-selected='true'],
html[data-theme='light-sand'] .chat-library-card[aria-selected='true'],
html[data-theme='light-sand'] .chat-context-toggle.is-open,
html[data-theme='light-sand'] .chat-context-toggle[aria-expanded='true'],
html[data-theme='light-sand'] .runway-lineup-entry.is-active,
html[data-theme='light-sand'] .runway-output-mode[aria-pressed='true'],
html[data-theme='light-sand'] .runway-inspector-tabs button[aria-selected='true'],
html[data-theme='light-sand'] .model-studio-modes button[aria-selected='true'],
html[data-theme='light-sand'] .view-slot[aria-selected='true'],
html[data-theme='light-sand'] .canvas-item-context-row button[aria-pressed='true'] {
  background-color: var(--selected-fill);
  color: var(--selected-text);
}

html[data-theme='light-sand'] .chat-library-card[aria-selected='true'],
html[data-theme='light-sand'] .chat-context-toggle.is-open,
html[data-theme='light-sand'] .chat-context-toggle[aria-expanded='true'],
html[data-theme='light-sand'] .runway-lineup-entry.is-active,
html[data-theme='light-sand'] .runway-candidate.is-active,
html[data-theme='light-sand'] .runway-output-mode[aria-pressed='true'],
html[data-theme='light-sand'] .view-slot[aria-selected='true'],
html[data-theme='light-sand'] body[data-settings-page] .theme-swatch.active {
  border-color: var(--border-selected);
}

html[data-theme='light-sand'] .view-slot[aria-selected='true'] {
  box-shadow: inset 0 0 0 1px var(--selected-line);
}

html[data-theme='light-sand'] .refinement-view-action[aria-pressed='true'] {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
}

html[data-theme='light-sand'] body[data-settings-page] .theme-swatch.active {
  box-shadow: 0 0 0 4px var(--selected-fill), inset 0 0 0 1px var(--selected-line);
}

html[data-theme='light-sand'] .canvas-collage-item.is-selected,
html[data-theme='light-sand'] .canvas-image-container.canvas-item-selected {
  outline-color: var(--border-selected);
}

html[data-theme='light-sand'] input[type='text']:focus,
html[data-theme='light-sand'] input[type='email']:focus,
html[data-theme='light-sand'] input[type='password']:focus,
html[data-theme='light-sand'] textarea:focus,
html[data-theme='light-sand'] .verification-code-input:focus,
html[data-theme='light-sand'] .username-input-container.focused {
  border-color: var(--focus-ring);
}

html[data-theme='light-sand'] .profile-settings-button:focus-visible,
html[data-theme='light-sand'] body[data-page='user'] .view-all-button:focus-visible,
html[data-theme='light-sand'] .settings-archive-back:focus-visible,
html[data-theme='light-sand'] .settings-archive-button:focus-visible,
html[data-theme='light-sand'] .settings-archive-open:focus-visible,
html[data-theme='light-sand'] .model-studio-modes button:focus-visible,
html[data-theme='light-sand'] .model-studio-prompt .generate-tile-button:focus-visible,
html[data-theme='light-sand'] .runway-inspector-tabs button:focus-visible,
html[data-theme='light-sand'] body[data-page='runway'] .runway-prompt-box .generate-tile-button:focus-visible,
html[data-theme='light-sand'] .canvas-list-card:focus-visible,
html[data-theme='light-sand'] .canvas-list-actions-trigger:focus-visible,
html[data-theme='light-sand'] .canvas-list-actions-menu-item:focus-visible,
html[data-theme='light-sand'] .canvas-upload-menu button:focus-visible,
html[data-theme='light-sand'] .canvas-item-context-row button:focus-visible,
html[data-theme='light-sand'] .canvas-arrange-menu button:focus-visible {
  outline-color: var(--focus-ring);
}

html[data-theme='light-sand'] body[data-page='editorial'] .editorial-context-button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .generate-tile-button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-context-menu button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-context-chip button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-picker-header button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-reference-preview > button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-brand-picker-back:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-brand-logo-button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] .editorial-brand-picker-actions button:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] [data-generation-reference-controls] .editorial-reference-upload-tile:focus-visible,
html[data-theme='light-sand'] body[data-page='editorial'] [data-generation-reference-controls] .editorial-reference-list label:has(input[data-reference-kind]:focus-visible) {
  outline-color: var(--focus-ring);
}

html[data-theme='light-sand'] body[data-page='editorial'] .editorial-brand-logo-button[aria-checked='true'] {
  border-color: var(--border-selected);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--selected-line) 24%, transparent);
}

html[data-theme='light-sand'] body[data-page='editorial'] [data-generation-reference-controls] .editorial-reference-list label:has(input[data-reference-kind]:checked) {
  border-color: var(--border-selected) !important;
}

html[data-theme='light-sand'] .catalog-prompt-box:focus-within,
html[data-theme='light-sand'] .catalog-node input:focus,
html[data-theme='light-sand'] .catalog-node textarea:focus,
html[data-theme='light-sand'] .catalog-node select:focus,
html[data-theme='light-sand'] .catalog-node .catalog-brand-field select:focus-visible {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--focus-ring) 28%, transparent);
}

html[data-theme='light-sand'] .catalog-applies-trigger:focus-visible {
  border-color: var(--focus-ring) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 28%, transparent);
}

html[data-theme='light-sand'] .catalog-node.is-selected {
  border-color: var(--border-selected);
  background-color: var(--selected-fill);
  color: var(--selected-text);
  box-shadow: 0 0 0 2px var(--selected-line), 0 14px 34px rgba(30, 24, 21, .11);
}

html[data-theme='light-sand'] .catalog-node-preview.is-dragover {
  border-color: var(--border-selected);
  background-color: var(--selected-fill);
}

html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-tab[aria-selected='true'],
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-ruler-toggle[aria-pressed='true'],
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-choice[aria-pressed='true'],
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-lock[aria-pressed='true'],
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell input[type='checkbox']:checked {
  border-color: var(--active-fill);
  background-color: var(--active-fill);
  color: var(--active-text);
}

html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-field input[type='range'],
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-check input {
  accent-color: var(--active-fill);
}

html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-canonical-layer[aria-selected='true'] {
  border-color: var(--border-selected);
  background-color: var(--selected-fill);
  color: var(--selected-text);
  box-shadow: inset 3px 0 0 var(--selected-line);
}

html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-pattern-composer-box:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus-ring) 12%, transparent), 0 10px 28px rgba(34, 26, 22, .09);
}

html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell textarea:focus-visible,
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell input:focus-visible,
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell select:focus-visible,
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell button:focus-visible,
html[data-theme='light-sand'] body[data-page='pattern-factory'] .pf-shell summary:focus-visible {
  outline-color: var(--focus-ring);
}
