/* A quiet, image-first workspace. Loaded after the shared component styles. */
:root {
  --bg: #fcfcfb;
  --rail: #f5f5f3;
  --ink: #262625;
  --muted: #8b8b87;
  --line: #e7e7e3;
  --blue: #252525;
  --white: #fff;
  --rail-width: 216px;
  color-scheme: light;
}

html { min-width: 320px; }
body { background: var(--bg); }
button, a, summary, input, select, textarea { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid #767674;
  outline-offset: 3px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid #b8b8b6;
  outline-offset: 1px;
}
button, a, summary { -webkit-tap-highlight-color: transparent; }
button svg, summary svg { pointer-events: none; }

/* The rail keeps navigation separate from the open creation canvas. */
.sidebar {
  display: flex;
  width: var(--rail-width);
  padding: 19px 11px 12px;
  overflow: visible;
  border-right-color: #ebebe7;
  background: var(--rail);
}
.rail-brand { padding: 6px 11px 19px; }
.brand { gap: 10px; }
.brand img { width: 25px; height: 25px; }
.brand strong {
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.6px;
}
.nav { gap: 2px; margin-top: 0; }
.nav a {
  min-height: 36px;
  gap: 9px;
  padding: 8px 11px;
  color: #666662;
  font-size: 13px;
  border-radius: 8px;
}
.nav a svg { width: 17px; height: 17px; stroke-width: 1.6; }
.nav a.active, .nav a:hover { background: #eaeae7; color: var(--ink); }
.nav a.active { font-weight: 550; }
.rail-scroll {
  flex: 1;
  min-height: 50px;
  margin-top: 23px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d9d9d7 transparent;
}
.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  gap: 8px;
  padding: 0 11px;
  color: #969694;
  font-size: 10px;
  letter-spacing: .3px;
}
.rail-heading button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 5px;
  color: #929290;
}
.rail-heading button:hover { background: #e8e8e6; color: #33332f; }
.rail-heading button svg { width: 15px; height: 15px; }
.conversation-search { margin: 5px 7px 10px; }
.conversation-search input {
  width: 100%;
  padding: 9px 10px;
  color: #5e5e5c;
  font-size: 11px;
  background: #ffffff80;
  border: 1px solid #e6e6e4;
  border-radius: 6px;
}
.conversation-search input::placeholder { color: #a1a19f; }
.chat-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 31px;
  margin: 1px 0;
  padding: 0 3px 0 10px;
  gap: 4px;
  border-radius: 7px;
}
.chat-link:hover, .chat-link.active { background: #eaeae8; }
.chat-main {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 7px;
  min-width: 0;
  min-height: 31px;
  padding: 5px 0;
  text-align: left;
  font-size: 11px;
  color: #777775;
}
.chat-main > span:not(.chat-indicator) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-link.active .chat-main { color: #343430; }
.chat-indicator { display: block; width: 4px; height: 4px; border-radius: 50%; flex: 0 0 4px; background: #626260; }
.chat-menu { position: static; flex: 0 0 auto; }
.chat-menu > summary {
  display: grid;
  place-items: center;
  width: 23px;
  height: 26px;
  border-radius: 4px;
  color: #969694;
  font-size: 16px;
}
.chat-menu > summary svg { width: 16px; height: 16px; }
.chat-menu > summary:hover, .chat-menu[open] > summary { background: #dededc; color: #383836; }
.chat-menu .row-menu-content { top: 31px; right: 1px; z-index: 50; }
.folder-group { margin: 4px 0; }
.folder-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 10px;
  color: #747472;
  font-size: 11px;
  border-radius: 6px;
}
.folder-group > summary:hover { background: #eeeeec; }
.folder-group > summary::before { content: '›'; font-size: 16px; line-height: 1; color: #a0a09e; transition: transform .15s; }
.folder-group[open] > summary::before { transform: rotate(90deg); }
.folder-group > summary svg { width: 14px; height: 14px; }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-group .chat-link { margin-left: 10px; }
.folder-tools { display: flex; gap: 7px; padding: 1px 10px 5px 30px; }
.folder-tools button { padding: 4px 0; font-size: 10px; color: #969694; }
.folder-tools button:hover { color: #33332f; }
.conversation-nav > .notice { padding: 0 11px; font-size: 10px; color: #a0a09e; }
.rail-my { margin-top: 14px; }
.my-links { display: grid; gap: 2px; padding-top: 2px; }
.my-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 31px;
  padding: 6px 11px;
  color: #777775;
  border-radius: 6px;
  font-size: 11px;
}
.my-links a svg { width: 15px; height: 15px; }
.my-links a:hover, .my-links a.active { background: #eaeae8; color: #353533; }
.rail-bottom { flex: 0 0 auto; margin-top: 0; padding-top: 11px; }
.rail-admin { font-size: 10px; padding: 7px 11px; margin-bottom: 5px; }
.rail-admin:hover, .rail-admin.active { color: #30302c; }
.rail-account { padding: 9px; gap: 8px; background: #ffffff8c; border-color: #e5e5e3; border-radius: 8px; }
.rail-account strong { font-size: 11px; }
.rail-account small { font-size: 10px; color: #959593; }
.rail-account .text-button { font-size: 10px; color: #5d5d5b; }
.avatar { background: #e6e6e4; color: #686866; }
.workspace { margin-left: var(--rail-width); min-width: 0; }
.main { padding: 34px 46px 54px; }
.topbar { display: none; }

/* Conversation scrolls independently; the composer stays in view. */
.main.conversation-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 400px;
  padding: 0;
  overflow: hidden;
}
.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 74px;
  gap: 16px;
  padding: 22px 37px;
}
.conversation-header h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #565654;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}
.conversation-header h1 .local-badge { display: inline-block; margin-left: 9px; vertical-align: middle; }
.conversation-header .local-badge { color: #b0b0ae; font-size: 9px; font-weight: 400; }
.conversation-tools { display: flex; align-items: center; flex: 0 0 auto; gap: 6px; }
.conversation-tools button, .conversation-tools a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 5px 8px;
  gap: 6px;
  border-radius: 6px;
  color: #969694;
  font-size: 10px;
}
.conversation-tools button:hover, .conversation-tools a:hover { background: #f0f0ee; color: #565654; }
.conversation-tools svg { width: 15px; height: 15px; }
.conversation-feed {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #e5e5e3 transparent;
  padding: 24px max(32px, calc((100% - 760px) / 2)) 25px;
}
.conversation-feed:has(.conversation-empty) { display: flex; align-items: center; justify-content: center; padding-top: 0; }
.conversation-empty { width: 100%; padding: 20px; text-align: center; transform: translateY(-18px); }
.conversation-empty h2 { color: #393935; font-size: 25px; letter-spacing: -.7px; font-weight: 450; line-height: 1.5; margin: 0 0 13px; }
.conversation-empty p { margin: 0; color: #a3a3a1; font-size: 11px; line-height: 1.9; }
.chat-turn { width: 100%; min-width: 0; margin: 0 auto 37px; }
.turn-user { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; min-width: 0; }
.turn-user-text { width: fit-content; max-width: min(78%, 610px); padding: 13px 18px; border-radius: 19px 19px 4px 19px; background: #efefeb; color: #595957; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-refs { display: flex; justify-content: flex-end; gap: 7px; max-width: min(78%, 610px); margin: 0; flex-wrap: wrap; }
.turn-refs img { display: block; width: 72px; height: 72px; object-fit: cover; border: 1px solid #e6e6e4; border-radius: 8px; background: #f1f1ef; }
.turn-result { margin-top: 23px; min-width: 0; }
.turn-image { display: block; max-width: 100%; padding: 0; cursor: zoom-in; text-align: left; border-radius: 10px; }
.turn-image img { display: block; width: auto; height: auto; max-width: min(100%, 520px); max-height: 450px; object-fit: contain; border-radius: 10px; background: #f0f0ee; }
.turn-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 12px; color: #a9a9a7; font-size: 9px; line-height: 1.7; }
.turn-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 9px 0 0; }
.turn-actions button, .turn-actions a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid transparent; border-radius: 5px; color: #8a8a88; font-size: 10px; }
.turn-actions button:hover, .turn-actions a:hover { background: #efefed; color: #464644; }
.turn-actions svg { width: 13px; height: 13px; }
.turn-pending { display: flex; align-items: center; gap: 10px; min-height: 70px; color: #979795; font-size: 11px; }
.turn-pending .spinner { width: 17px; height: 17px; border-color: #e3e3e1; border-top-color: #777775; }
.turn-failed { padding: 14px 0; color: #a37167; font-size: 11px; line-height: 1.8; }
.turn-failed p { margin: 0 0 7px; }
.turn-failed button { padding: 4px 0; color: #6f6f6d; text-decoration: underline; text-underline-offset: 3px; font-size: 10px; }
.composer-dock { position: relative; z-index: 5; flex: 0 0 auto; width: 100%; padding: 7px 30px 27px; background: var(--bg); }
.composer-boundary { width: 100%; max-width: 760px; margin: 0 auto; }
.composer {
  position: relative;
  padding: 18px 17px 12px;
  border: 1px solid #e3e3e1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 5px 25px #25252305;
}
.composer:focus-within { border-color: #cececc; box-shadow: 0 5px 25px #25252306; }
.composer-textarea {
  display: block;
  width: 100%;
  min-height: 62px;
  max-height: 165px;
  margin: 0;
  padding: 0 3px 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #454543;
  font-size: 13px;
  line-height: 1.9;
  resize: none;
  scrollbar-width: thin;
}
.composer-textarea::placeholder { color: #a6a6a4; }
.composer-textarea:focus { outline: none; }
.composer .form-error:empty { display: none; }
.composer .form-error { padding: 5px 3px 10px; color: #a76b5f; font-size: 10px; line-height: 1.7; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.composer-left, .composer-right { display: flex; align-items: center; min-width: 0; gap: 9px; }
.composer-left { flex: 1; }
.composer-right { flex: 0 1 auto; }
.composer-note { color: #b0b0ae; font-size: 9px; line-height: 1.5; }
.attachment-menu { position: relative; flex: 0 0 auto; }
.attachment-menu > summary { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #e6e6e4; border-radius: 50%; color: #8c8c8a; font-size: 21px; line-height: 1; }
.attachment-menu > summary svg { width: 16px; height: 16px; }
.attachment-menu > summary:hover, .attachment-menu[open] > summary { background: #f3f3f1; color: #474745; }
.attachment-popover, .attachment-menu > .row-menu-content { position: absolute; z-index: 80; top: auto; bottom: 42px; left: -3px; right: auto; min-width: 166px; max-width: calc(100vw - 45px); padding: 6px; background: #fff; border: 1px solid #e4e4e2; border-radius: 10px; box-shadow: 0 10px 35px #26262412; }
.attachment-popover button, .attachment-popover label { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 12px; border-radius: 5px; color: #696967; text-align: left; font-size: 11px; cursor: pointer; }
.attachment-popover button:hover, .attachment-popover label:hover { background: #f3f3f1; }
.attachment-popover svg { width: 16px; height: 16px; }
.composer-settings { position: relative; min-width: 0; }
.composer-settings > summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; max-width: 154px; padding: 5px 9px; border-radius: 7px; background: #f7f7f4; border: 1px solid #eeeeea; color: #747470; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.composer-settings > summary:hover, .composer-settings[open] > summary { background: #eeeeec; color: #4d4d4b; }
.composer-settings > summary::after { content: '⌃'; color: #a0a09e; font-size: 12px; margin-left: 1px; }
.composer-settings[open] > summary::after { transform: rotate(180deg); }
.composer-settings > summary svg { width: 13px; height: 13px; }
.settings-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.composer-send { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: #292925; color: #fff; font-size: 22px; line-height: 1; }
.composer-send svg { width: 17px; height: 17px; stroke-width: 1.8; }
.composer-send:hover { background: #090908; }
.composer-send:disabled { opacity: .28; }
.composer-send .spinner { width: 15px; height: 15px; border-color: #ffffff65; border-top-color: #fff; }
.settings-popover { position: absolute; z-index: 70; right: 0; bottom: 42px; width: 280px; max-width: calc(100vw - 32px); max-height: min(360px, calc(100dvh - 215px)); padding: 14px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #e3e3e1; border-radius: 11px; background: #fff; box-shadow: 0 12px 45px #25252312; }
.setting-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0 0 12px; font-size: 10px; color: #929290; }
.setting-field:last-of-type { margin-bottom: 0; }
.setting-field select { width: 100%; min-width: 0; min-height: 32px; padding: 6px 8px; border: 1px solid #e8e8e6; border-radius: 6px; background: #f6f6f4; color: #5f5f5d; font-size: 11px; }
.composer-ratios { min-width: 0; margin: 0; padding: 0; border: 0; }
.composer-ratios legend { padding: 0; margin-bottom: 9px; color: #929290; font-size: 10px; }
.composer-ratios .ratio-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.composer-ratios .ratio-option span { height: 34px; padding: 0 3px; border-color: #ebebe9; border-radius: 6px; color: #989896; background: #fafaf7; font-size: 10px; }
.composer-ratios .ratio-option:has(input:checked) span { background: #ececea; border-color: #bdbdbb; color: #474745; }
.composer-ratios .ratio-option:has(input:focus-visible) span { outline-color: #999997; }
#composer-cost { display: block; padding-top: 10px; margin-top: 11px; border-top: 1px solid #eeeeec; text-align: center; color: #a1a19f; font-size: 10px; line-height: 1.7; }
.composer-reference { min-height: 0; }
.composer-reference .reference-previews { gap: 8px; }
.composer-reference .reference-previews:empty { display: none; }
.composer-reference .reference-item { flex: 0 0 60px; width: 60px; height: 60px; margin: 0 0 13px; }
.composer-reference .reference-item img { border: 1px solid #e6e6e4; border-radius: 7px; background: #f2f2f0; }
.composer-reference .reference-order, .composer-reference .reference-move button { background: #fffffff0; color: #747472; }
.composer-reference .reference-remove { color: #858583; border-color: #dddddb; }
.composer-reference.dragging { min-height: 68px; margin-bottom: 11px; padding: 8px; outline: 1px dashed #a9a9a7; border-radius: 8px; background: #f3f3f1; }
.composer-reference.dragging::after { content: '松开添加参考图片'; display: block; padding: 10px; text-align: center; color: #929290; font-size: 11px; }

/* Shared surfaces stay neutral, including the style workflow and admin. */
.primary { background: #2c2c2a; border-color: #2c2c2a; }
.primary:hover { background: #11110f; border-color: #11110f; }
.secondary { border-color: #dfdfdd; background: #fff; color: #777775; }
.secondary:hover { background: #f5f5f3; }
.text-button { color: #6f6f6d; }
.panel, .stat { background: #ffffffc9; border-color: #e5e5e3; }
.page-head h1 { font-size: 25px; font-weight: 500; }
.credit-number { color: #424240; }
.admin-tabs .active { background: #ebebe9; border-color: #d6d6d4; color: #585856; }
.console-segments { background: #eeeeec; }
.console-segments .active { color: #555553; }
.check input { accent-color: #555553; }
.field { color: #848482; }
.field input, .field textarea, .field select { border-color: #e4e4e2; color: #595957; }
.field input:focus, .field textarea:focus, .field select:focus { outline-color: #bdbdbb; }
th { background: #f5f5f3; color: #929290; }
.row-menu > summary:hover, .row-menu[open] > summary { background: #eeeeec; color: #60605e; }
.row-menu-content { border-color: #e6e6e4; box-shadow: 0 8px 30px #26262412; }
.row-menu-content button:hover, .row-menu-content a:hover { background: #f5f5f3; }
dialog { background: #fcfcf9; border-color: #e3e3e1; box-shadow: 0 25px 100px #29292720; }
dialog::backdrop { background: #26262466; backdrop-filter: blur(4px); }
dialog .close { background: #f2f2f0de; color: #90908e; }
dialog .close:hover { background: #e9e9e7; }
.creation-preview { background: #f3f3f1; }
.preview-top, .preview-bottom { color: #999997; }
.preview-top > span:first-child { color: #777775; }
.photo-stage { border-color: #d8d8d6; background: #fafaf8; }
.photo-stage.has-photo { border-color: #e6e6e4; background: #eeeeec; }
.photo-stage.dragging { outline-color: #a5a5a3; }
.upload-message { color: #a4a4a2; }
.upload-message strong { color: #929290; }
.upload-message small, .section-label { color: #aaaaa8; }
.ratio-selector legend { color: #8f8f8d; }
.ratio-option:has(input:checked) span { border-color: #b6b6b4; background: #f0f0ee; color: #828280; }
.style-reference > summary { border-color: #eeeeec; color: #9d9d9b; }
.style-task-panel { min-width: 0; margin-top: 23px; padding-top: 20px; border-top: 1px solid #e5e5e3; }
.style-task-panel .turn-pending { min-height: 70px; }
.style-task-panel .turn-image img { max-width: 100%; max-height: 350px; margin: auto; }
.style-task-panel .turn-actions { justify-content: center; }
.style-task-panel .turn-meta { justify-content: center; text-align: center; }
.local-picker img { background: #f0f0ee; }
.local-picker span { color: #939391; }
#toast { background: #353533; }
.main.gallery-page { padding-top: 22px; }
.collection-head { gap: 25px; }
.collection-head h1 { font-size: 24px; font-weight: 500; }
.tab { color: #a3a3a1; }
.tab.active:after { background: #838381; }
.search { border-color: #e7e7e5; color: #a6a6a4; border-radius: 7px; }
.categories { margin: 16px 0 26px; }
.chip { color: #a0a09e; }
.chip.active { background: #eeeeec; color: #828280; }
.art { background: #eeeeec; border-radius: 9px; }
.art:after { background: linear-gradient(transparent, #24242275); }
.card-info h2 { font-size: 13px; color: #686866; }
.card-info .arrow { color: #a3a3a1; }
.gallery-footer { color: #b2b2b0; }

@media (min-width: 1600px) {
  .main { padding-left: 62px; padding-right: 62px; }
  .main.conversation-page { padding: 0; }
  .conversation-header { padding-left: 45px; padding-right: 45px; }
  .composer-dock { padding-bottom: 35px; }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .sidebar { width: var(--rail-width); padding-left: 11px; padding-right: 11px; }
  .workspace { margin-left: var(--rail-width); }
  .main { padding: 27px 30px 45px; }
  .main.conversation-page { padding: 0; }
  .conversation-header { padding-left: 27px; padding-right: 27px; }
  .conversation-feed { padding-left: 30px; padding-right: 30px; }
  .composer-dock { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }
  .workspace { margin-left: 0; min-height: 100dvh; }
  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    display: flex;
    width: min(var(--rail-width), calc(100vw - 58px));
    padding: 19px 11px 14px;
    transform: translateX(-105%);
    visibility: hidden;
    box-shadow: 10px 0 45px #22222012;
    transition: transform .2s, visibility .2s;
  }
  body.nav-open .sidebar { visibility: visible; transform: translateX(0); }
  body.nav-open::before { content: ''; position: fixed; z-index: 45; inset: 0; background: #26262444; backdrop-filter: blur(2px); }
  .sidebar-backdrop { position: fixed; z-index: 46; inset: 0; padding: 0; background: #26262444; backdrop-filter: blur(2px); }
  body.nav-open:has(.sidebar-backdrop)::before { display: none; }
  .topbar { display: flex; height: 56px; padding: 0 17px; border-color: #ededeb; background: var(--bg); }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .topbar .brand img { width: 21px; height: 21px; }
  .topbar .brand strong { font-size: 17px; }
  .mobile-sidebar-toggle { display: grid; place-items: center; width: 38px; height: 44px; padding: 2px; border-radius: 5px; color: #969694; }
  .mobile-sidebar-toggle:hover { background: #eeeeec; }
  .mobile-sidebar-toggle svg { width: 18px; height: 18px; }
  .userbar { gap: 7px; }
  .userbar .pill { padding: 6px 8px; font-size: 9px; color: #929290; }
  .mobile-account { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0 6px 8px; min-height: 44px; font-size: 12px; color: #454541; white-space: nowrap; }
  .mobile-balance { padding: 4px 8px; border-radius: 20px; background: #f0f0ec; color: #65655e; font-size: 11px; font-variant-numeric: tabular-nums; }
  .userbar .avatar { width: 26px; height: 26px; font-size: 10px; }
  .main { padding: 23px 18px max(24px, env(safe-area-inset-bottom, 0px)); }
  .main.conversation-page { height: calc(100dvh - 56px); min-height: 0; padding: 0; }
  .conversation-header { min-height: 52px; padding: 13px 20px; gap: 9px; }
  .conversation-header h1 { font-size: 11px; }
  .conversation-header .local-badge { font-size: 8px; }
  .conversation-header h1 .local-badge { margin-left: 6px; }
  .conversation-tools { gap: 1px; }
  .conversation-tools button, .conversation-tools a { min-width: 25px; padding: 5px; font-size: 9px; }
  .conversation-feed { padding: 14px 20px 20px; }
  .conversation-empty { padding: 0 10px; transform: translateY(-14px); }
  .conversation-empty h2 { font-size: 23px; margin-bottom: 12px; letter-spacing: -.5px; }
  .conversation-empty p { max-width: 255px; margin: 0 auto; font-size: 10px; line-height: 1.9; }
  .chat-turn { margin-bottom: 30px; }
  .turn-user { gap: 8px; }
  .turn-user-text { max-width: 88%; padding: 11px 14px; border-radius: 16px 16px 3px 16px; font-size: 12px; line-height: 1.8; }
  .turn-refs { max-width: 88%; }
  .turn-result { margin-top: 19px; }
  .turn-image img { max-width: 100%; max-height: 410px; border-radius: 8px; }
  .turn-meta { margin-top: 9px; font-size: 8px; }
  .turn-actions { gap: 2px; margin-top: 6px; }
  .turn-actions button, .turn-actions a { font-size: 9px; padding: 6px; }
  .turn-refs img { width: 60px; height: 60px; }
  .composer-dock { padding: 6px 12px max(10px, env(safe-area-inset-bottom, 0px)); }
  .composer { padding: 11px 11px 8px; border-radius: 18px; }
  .composer-textarea { min-height: 44px; height: 48px; max-height: 115px; font-size: 16px; line-height: 1.5; padding: 1px 3px 6px; }
  .composer-toolbar { gap: 7px; }
  .composer-left, .composer-right { gap: 7px; }
  .composer-left { flex: none; }
  .composer-note { font-size: 10px; white-space: nowrap; }
  .attachment-menu > summary { width: 29px; height: 29px; }
  .composer-settings > summary { max-width: min(154px, 42vw); min-height: 29px; padding: 5px 8px; gap: 5px; font-size: 10px; }
  .composer-settings > summary svg { width: 12px; height: 12px; }
  .composer-send { width: 31px; height: 31px; }
  .composer-send svg { width: 16px; height: 16px; }
  .settings-popover { right: -35px; bottom: calc(100% + 10px); width: 280px; max-width: calc(100vw - 32px); max-height: min(360px, calc(100dvh - 150px)); padding: 14px; border-radius: 11px; }
  .composer-ratios .ratio-options { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .composer-ratios .ratio-option span { height: 35px; font-size: 10px; }
  .composer-reference .reference-item { flex-basis: 52px; width: 52px; height: 52px; margin-bottom: 11px; }
  .main.gallery-page { padding-top: 14px; }
  .collection-head { gap: 15px; }
  .collection-head h1 { font-size: 22px; }
  .tab { font-size: 10px; }
  .categories { margin: 14px 0 22px; }
  .chip { padding: 6px 9px; font-size: 10px; }
  .gallery { column-gap: 13px; }
  .card-info h2 { font-size: 12px; }
  .card-info .arrow { font-size: 14px; }
  .page-head h1 { font-size: 22px; }
  .style-task-panel .turn-image img { max-height: 300px; }
  #toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  body:has(.conversation-page) #toast { bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 390px) {
  .composer-settings > summary { max-width: min(145px, 42vw); }
  .conversation-header .local-badge { display: none; }
  .composer-ratios .ratio-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* A personal image library, with selection and details kept close to the work. */
.my-gallery { max-width: 1480px; margin: 0 auto; }
.gallery-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 28px; }
.gallery-title h1 { margin: 0 0 9px; font-size: 25px; font-weight: 500; letter-spacing: -.5px; }
.gallery-title p { margin: 0; font-size: 11px; line-height: 1.8; color: #a0a09e; }
.gallery-upload-label { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 9px 13px; border: 1px solid #e2e2e0; border-radius: 7px; background: #fff; color: #6d6d6b; font-size: 10px; cursor: pointer; white-space: nowrap; }
.gallery-upload-label:hover { background: #f5f5f3; }
.gallery-upload-label input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.gallery-upload-label:focus-within { outline: 2px solid #9d9d9b; outline-offset: 3px; }
.gallery-upload-label svg { width: 14px; height: 14px; }
.gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 20px; }
.gallery-query { display: flex; align-items: stretch; gap: 6px; flex: 1 1 190px; max-width: 380px; min-width: 0; }
.gallery-date-filter { display: inline-flex; align-items: stretch; flex: none; border: 1px solid #e8e8e6; border-radius: 7px; background: #fff; color: #767672; }
.gallery-date-filter:focus-within { outline: 2px solid #bdbdbb; outline-offset: 1px; }
.gallery-date-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 39px; padding: 0 10px; }
.gallery-date-clear { align-self: stretch; padding: 0 9px; border-left: 1px solid #eee; color: #696963; font-size: 15px; }
.gallery-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #e8e8e6; border-radius: 7px; background: #fff; color: #aaaaa8; }
.gallery-search > span { flex-shrink: 0; white-space: nowrap; }
.gallery-search svg { width: 14px; height: 14px; }
.gallery-search input { flex: 1; width: auto; min-width: 0; padding: 0; border: 0; background: transparent; color: #696967; font-size: 11px; }
.gallery-search input:focus { outline: 0; }
.gallery-search:focus-within { outline: 2px solid #bdbdbb; outline-offset: 1px; }
.gallery-search input::placeholder { color: #b1b1af; }
.gallery-source, .gallery-sort { display: flex; align-items: center; gap: 7px; color: #a5a5a3; font-size: 10px; }
.gallery-source select, .gallery-sort select { max-width: 170px; padding: 9px 10px; border: 1px solid #e8e8e6; border-radius: 6px; background: #fff; color: #828280; font-size: 10px; }
.gallery-sort { margin-left: auto; }
.gallery-tabs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 0 0 18px; }
.gallery-tabs button { padding: 7px 12px; border-radius: 6px; font-size: 10px; color: #9b9b99; }
.gallery-tabs button:hover { background: #f1f1ef; color: #6f6f6d; }
.gallery-tabs button.active { background: #eaeae8; color: #686866; }
.gallery-summary { margin: 0 0 18px; color: #b1b1af; font-size: 10px; }
.gallery-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 10px 13px; margin-bottom: 19px; border: 1px solid #e5e5e3; border-radius: 7px; background: #f7f7f5; color: #969694; font-size: 10px; }
.gallery-selection button { padding: 5px 7px; font-size: 10px; color: #747472; border-radius: 4px; }
.gallery-selection button:hover { background: #eaeae8; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 25px 21px; }
.gallery-card { position: relative; min-width: 0; }
.gallery-image-button { display: block; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 9px; overflow: hidden; background: #f0f0ee; }
.gallery-image-button img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery-image-button:hover img { transform: scale(1.015); }
.gallery-card.is-selected .gallery-image-button { outline: 2px solid #939391; outline-offset: 3px; }
.gallery-card-info { padding-top: 11px; }
.gallery-card-info h2 { margin: 0 0 5px; color: #787876; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-card-info h2 button { max-width: 100%; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.gallery-card-meta { color: #b5b5b3; font-size: 9px; line-height: 1.7; }
.gallery-card-tools { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.gallery-card-tools button { display: inline-flex; align-items: center; gap: 4px; padding: 3px 0; color: #a5a5a3; font-size: 9px; }
.gallery-card-tools svg { width: 13px; height: 13px; }
.gallery-card-tools button:hover, .gallery-card-tools button[aria-pressed="true"] { color: #6f6f6d; }
.gallery-card-tools button[aria-pressed="true"] svg { fill: currentColor; }
.gallery-empty { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.gallery-empty h2 { margin: 0 0 12px; font-size: 20px; font-weight: 450; color: #6a6a68; }
.gallery-empty p { margin: 0; font-size: 11px; line-height: 1.9; color: #adadab; }
.gallery-usage { margin-top: 29px; padding-top: 18px; border-top: 1px solid #ececea; color: #babab8; font-size: 9px; line-height: 1.9; }
.gallery-inspector { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(260px,1fr); min-height: 450px; }
.gallery-inspector-image { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 25px; background: #f0f0ee; }
.gallery-inspector-image img { display: block; max-width: 100%; max-height: 70dvh; width: auto; height: auto; object-fit: contain; border-radius: 6px; }
.gallery-inspector-details { min-width: 0; padding: 42px 28px 28px; }
.gallery-inspector-details h2 { margin: 0 0 15px; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.gallery-inspector-details p, .gallery-inspector-details dl { font-size: 11px; line-height: 1.9; color: #aaaaa8; }
.gallery-inspector-details dt { color: #a0a09e; font-size: 10px; margin-top: 13px; }
.gallery-inspector-details dd { margin: 4px 0 0; color: #7c7c7a; overflow-wrap: anywhere; }
.gallery-detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.gallery-detail-actions .primary, .gallery-detail-actions .secondary { padding: 9px 12px; font-size: 10px; }
.gallery-prompt { padding: 12px; border: 1px solid #e5e5e3; border-radius: 6px; background: #f8f8f6; font-size: 11px; line-height: 1.9; color: #888886; white-space: pre-wrap; overflow-wrap: anywhere; }
.gallery-rename-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 22px; }
.gallery-rename-form .field { flex: 1; min-width: 140px; margin-bottom: 0; }
.gallery-rename-form .secondary { min-height: 40px; padding: 9px 12px; font-size: 10px; }
@media (min-width: 1600px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) and (min-width: 761px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 17px; }
  .gallery-toolbar { gap: 9px; }
  .gallery-source select, .gallery-sort select { max-width: 125px; }
}
@media (max-width: 760px) {
  .gallery-header { align-items: flex-start; margin-bottom: 23px; gap: 12px; }
  .gallery-title h1 { font-size: 22px; margin-bottom: 8px; }
  .gallery-title p { font-size: 10px; max-width: 210px; }
  .gallery-upload-label { font-size: 9px; padding: 8px 10px; min-height: 32px; }
  .gallery-toolbar { gap: 8px; padding-bottom: 15px; }
  .gallery-query { max-width: none; flex-basis: 100%; min-height: 42px; }
  .gallery-source, .gallery-sort { font-size: 9px; gap: 6px; }
  .gallery-source select, .gallery-sort select { padding: 8px; font-size: 9px; max-width: 125px; }
  .gallery-tabs { gap: 3px; padding-bottom: 13px; }
  .gallery-tabs button { font-size: 9px; padding: 7px 10px; }
  .gallery-summary { font-size: 9px; margin-bottom: 16px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 13px; }
  .gallery-card-info h2 { font-size: 11px; }
  .gallery-card-meta { font-size: 8px; }
  .gallery-card-tools { gap: 7px; }
  .gallery-card-tools button { font-size: 8px; }
  .gallery-card-tools svg { width: 12px; height: 12px; }
  .gallery-inspector { display: block; }
  .gallery-inspector-image { padding: 22px; }
  .gallery-inspector-image img { max-height: 47dvh; }
  .gallery-inspector-details { padding: 25px 23px; }
  .gallery-inspector-details h2 { font-size: 20px; }
  .gallery-usage { font-size: 8px; }
}
/* Gallery source/sort controls are selects in the reusable view. */
select.gallery-source, select.gallery-sort { display: block; min-height: 35px; max-width: 170px; padding: 9px 10px; border: 1px solid #e8e8e6; border-radius: 6px; background: #fff; color: #82827e; font-size: 10px; }
.gallery-tabs .gallery-summary { margin: 0 0 0 auto; padding: 7px 0 7px 12px; }
.gallery-selection > div { margin-left: auto; }
.gallery-empty h1 { margin: 0 0 12px; color: #555551; font-size: 23px; font-weight: 500; }
@media (max-width: 760px) {
  select.gallery-source, select.gallery-sort { min-height: 32px; padding: 8px; font-size: 9px; max-width: 150px; }
}
@media (max-width: 390px) {
  .composer-settings > summary { overflow: hidden; }
  .settings-label { flex-shrink: 1; }
}

/* Compact controls used by the conversational shell. */
.nav .rail-new {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 8px;
  color: #62625e;
  font-size: 13px;
  text-align: left;
}
.nav .rail-new svg { width: 17px; height: 17px; stroke-width: 1.6; }
.nav .rail-new:hover { background: #eaeae7; color: #262625; }
.nav a small { margin-left: auto; font-size: 8px; font-weight: 400; color: #b3b3b1; white-space: nowrap; }
.conversation-search { display: block; }
.rail-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 7px 7px;
  padding: 0 3px;
}
.rail-scope select {
  min-width: 0;
  max-width: 115px;
  min-height: 28px;
  padding: 5px 1px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9e9e9c;
  font-size: 10px;
  cursor: pointer;
}
.rail-scope button { flex: 0 0 auto; padding: 5px 2px; border-radius: 4px; color: #adadab; font-size: 9px; }
.rail-scope button:hover { color: #61615f; }
.rail-empty { display: block; margin: 8px 0 0; padding: 6px 11px; color: #b2b2b0; font-size: 10px; font-weight: 400; line-height: 1.9; }
.folder-group .rail-empty { padding: 2px 10px 5px 30px; margin: 0; }
.folder-group > summary > span:last-child:not(.folder-name) { color: #b6b6b4; font-size: 9px; }
.chat-indicator { width: 10px; height: 14px; flex: 0 0 10px; border-radius: 0; background: transparent; color: #a0a09e; font-size: 11px; line-height: 14px; }
.chat-indicator:empty { display: none; }
.conversation-header > div:first-child { display: flex; align-items: center; min-width: 0; gap: 10px; }
.conversation-header > div:first-child .local-badge { flex: 0 0 auto; white-space: nowrap; }
.conversation-empty > span { display: block; margin: 0 auto 19px; color: #b8b8b6; font-size: 25px; line-height: 1; }
.composer-footnote { display: block; padding: 10px 8px 0; color: #b7b7b5; font-size: 10px; line-height: 1.6; text-align: center; }
.composer-settings > summary::after { content: none; }
.settings-chevron { display: block; flex: 0 0 auto; font-size: 11px; line-height: 1; color: #a7a7a5; }
.composer-settings[open] .settings-chevron { transform: rotate(180deg); }
.composer-ratios { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.composer-ratios > label { position: relative; display: block; min-width: 0; }
.composer-ratios > label > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.composer-ratios > label > span { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 34px; padding: 4px; border: 1px solid #e8e8e6; border-radius: 6px; background: #f9f9f6; color: #a1a19f; font-size: 10px; line-height: 1.5; white-space: nowrap; }
.composer-ratios > label:has(input:checked) > span { border-color: #bdbdbb; background: #ececea; color: #626260; }
.composer-ratios > label:has(input:focus-visible) > span { outline: 2px solid #999997; outline-offset: 2px; }
.composer-ratios > label:has(input:disabled) { opacity: .5; }
.turn-pending .generation-orbit { width: 17px; height: 17px; margin: 0; border-color: #dededc; border-top-color: #929290; }
.turn-pending button { padding: 5px 0; color: #858583; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.composer-reference button.reference-move { padding: 1px 4px; border-radius: 3px; background: #fffffff0; color: #858583; font-size: 10px; }
.sidebar-shade { display: none; }
@media (max-width: 760px) {
  body.nav-open::before { display: none; }
  body.nav-open .sidebar-shade { position: fixed; z-index: 46; inset: 0; display: block; background: #26262444; backdrop-filter: blur(2px); }
  .conversation-header > div:first-child { gap: 7px; }
  .composer-footnote { display: none; }
  .conversation-empty > span { margin-bottom: 17px; font-size: 23px; }
}

/* Two compact, independently collapsible navigation sections. */
.rail-scroll { margin-top: 0; }
.rail-section { margin: 0 0 10px; min-width: 0; }
.rail-section-heading {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  border-radius: 7px;
  color: #5f5f5b;
}
.rail-section-heading:hover { background: #ecece9; }
.section-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 7px;
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.section-entry svg { width: 17px; height: 17px; stroke-width: 1.5; }
.section-entry.active { color: #252523; }
.section-chevron {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  height: 32px;
  color: #9b9b97;
  font-size: 20px;
  line-height: 1;
  transition: transform .15s;
}
.rail-section[open] > .rail-section-heading .section-chevron { transform: rotate(90deg); }
.rail-section-body { padding: 3px 0 5px 12px; }
.style-category-nav { display: grid; gap: 1px; }
.style-category-nav button {
  min-height: 31px;
  padding: 6px 11px 6px 27px;
  border-radius: 6px;
  color: #92928d;
  font-size: 11px;
  text-align: left;
}
.style-category-nav button:hover, .style-category-nav button.active { background: #eaeae7; color: #4c4c48; }
.conversation-list-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 0 5px 0 11px;
  color: #aaa9a4;
  font-size: 10px;
}
.conversation-manage { position: static; }
.conversation-manage > summary, .folder-menu > summary {
  display: grid;
  place-items: center;
  width: 26px;
  height: 27px;
  border-radius: 5px;
  color: #a2a29d;
  font-size: 15px;
}
.conversation-manage > summary:hover, .folder-menu > summary:hover { color: #54544f; background: #e7e7e3; }
.conversation-manage .row-menu-content { top: 29px; right: 1px; z-index: 55; }
.folder-block { position: relative; }
.folder-block .folder-group { margin: 2px 0; }
.folder-block .folder-group > summary { padding-right: 35px; }
.folder-block .folder-group > summary > span:last-child { display: none; }
.folder-menu { position: absolute; top: 3px; right: 4px; }
.folder-menu .row-menu-content { top: 28px; right: 0; z-index: 55; }
.folder-menu > summary, .chat-menu > summary { opacity: 0; }
.folder-block:hover > .folder-menu > summary,
.folder-block:focus-within > .folder-menu > summary,
.folder-menu[open] > summary,
.chat-link:hover .chat-menu > summary,
.chat-link:focus-within .chat-menu > summary,
.chat-menu[open] > summary { opacity: 1; }
@media (hover: none) {
  .folder-menu > summary, .chat-menu > summary { opacity: 1; }
}

/* Fixed creation entrances, then separate style and conversation history. */
.rail-primary { margin-bottom: 14px; }
.rail-primary .rail-new.active { background: #eaeae7; color: var(--ink); font-weight: 550; }
.rail-scroll { margin-top: 0; }
.style-record-folder { margin: 0 0 12px; }
.style-record-folder > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 6px;
  color: #71716c;
  font-size: 11px;
}
.style-record-folder > summary:hover { background: #ecece9; }
.style-record-folder > summary svg { width: 15px; height: 15px; color: #91918b; }
.style-record-folder > summary small { margin-left: auto; color: #aaa9a3; font-size: 9px; }
.style-folder-chevron { color: #a8a79f; font-size: 17px; line-height: 1; }
.style-record-folder[open] > summary .style-folder-chevron { transform: rotate(90deg); }
#style-record-list { padding: 3px 0 0 19px; }
.style-record-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  color: #777771;
  text-align: left;
  font-size: 10px;
}
.style-record-link:hover { color: #383834; background: #eaeae7; }
.style-record-link > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-record-link > small { flex: 0 0 auto; color: #aaa99f; font-size: 9px; }
.conversation-nav .conversation-list-heading { padding-left: 11px; min-height: 30px; }
.style-record-preview { display: flex; align-items: center; justify-content: center; gap: 17px; margin: 22px 0; }
.style-record-preview figure { min-width: 0; flex: 1; margin: 0; }
.style-record-preview figcaption { margin-bottom: 9px; font-size: 10px; color: #a09f97; }
.style-record-preview img { display: block; width: 100%; max-height: 65dvh; object-fit: contain; border-radius: 6px; }
.style-record-state { flex: 1; min-width: 160px; padding: 27px 10px; color: #96958e; text-align: center; font-size: 12px; line-height: 1.8; }
.style-record-state.pending { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.style-record-state .generation-orbit { width: 25px; height: 25px; margin: 0; }
@media (max-width: 760px) {
  .style-record-preview { flex-direction: column; align-items: stretch; }
  .style-record-preview img { max-height: 45dvh; }
}
.style-result-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 20px; color: #a09f97; font-size: 11px; }
.style-result-tools .secondary { padding: 9px 13px; font-size: 11px; }

.statement-pages { display: flex; gap: 16px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; }
.statement-pages span { color: var(--muted); }
.quota-feedback { margin: 0 4px 8px; font-size: 13px; }
.quota-feedback[hidden], #style-recheck[hidden] { display: none; }
.style-run-group > summary { display:flex; align-items:center; gap:6px; padding:5px 9px; min-height:30px; border-radius:6px; color:#666660; font-size:11px; cursor:pointer; }
.style-run-group > summary:hover { background:#eaeae7; }
.style-run-group > summary::before { content:'›'; color:#93938d; }
.style-run-group[open] > summary::before { transform:rotate(90deg); }
.style-run-group > summary span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.style-run-group > summary small { margin-left:auto; white-space:nowrap; }
.style-run-group .style-record-link { padding-left:19px; }

/* Navigation stays on the image, leaving the gallery's detail actions intact. */
[data-photo-stage] { position: relative; overflow: clip; touch-action: none; }
[data-photo-stage] img { -webkit-user-drag: none; user-select: none; cursor: zoom-in; }
[data-photo-stage].photo-zoomed img { cursor: grab; }
[data-photo-stage].photo-zoomed:active img { cursor: grabbing; }
[data-photo-stage]:focus:not(:focus-visible) { outline: none; }
.photo-lightbox { display: grid; place-items: center; min-height: min(45dvh, 360px); }
.photo-lightbox:has(.photo-position) { padding-block: 44px; }
.photo-lightbox .full-image { max-height: min(75dvh, calc(92dvh - 90px)); }
.photo-position { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); color: #555; background: #ffffffe6; border-radius: 20px; padding: 2px 9px; font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; }
.turn-refs button { padding: 0; background: transparent; border: 0; border-radius: 8px; cursor: zoom-in; }

.task-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.style-record-state:not(.pending) .task-time { display: block; font-size: 11px; }

.cat-portrait { display:block; border-radius:50%; object-fit:cover; flex:none; }
.mobile-account .cat-portrait { width:29px; height:29px; }
.rail-account .cat-portrait { width:34px; height:34px; }
.profile-page { max-width:820px; margin:0 auto; color:#26342e; }
.profile-head,.profile-section-head,.profile-identity,.profile-settings { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.profile-head { margin-bottom:20px; }
.profile-head h1 { margin:0; font-size:26px; letter-spacing:-.04em; }
.profile-head .text-button,.profile-section-head span { font-size:12px; color:#68746d; }
.profile-card { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:24px; padding:28px; color:#f7f5e8; background:#283f36; border-radius:19px; }
.profile-identity { justify-content:flex-start; gap:16px; min-width:0; }
.profile-identity div { min-width:0; }
.profile-identity h2 { font-size:21px; margin:0 0 5px; overflow-wrap:anywhere; color:inherit; }
.profile-identity p { font-size:12px; color:#c3d3c7; margin:0; overflow-wrap:anywhere; }
.profile-avatar { position:relative; padding:0; border:2px solid #e0e4d1; border-radius:50%; flex:none; }
.profile-avatar .cat-portrait { width:70px; height:70px; }
.profile-avatar span { position:absolute; bottom:-1px; right:-3px; background:#f7f5e8; color:#29473c; border-radius:50%; width:21px; height:21px; }
.profile-wallet { text-align:right; }
.profile-wallet span { display:block; color:#d7e1cd; font-size:12px; }
.profile-wallet strong { font-family:Georgia,serif; font-size:clamp(30px,5vw,49px); font-weight:400; line-height:1.15; font-variant-numeric:tabular-nums; }
.profile-limits { grid-column:1/-1; display:grid; grid-template-columns:repeat(4,1fr); margin:0; padding-top:16px; border-top:1px solid #ffffff2c; }
.profile-limits dt { font-size:11px; color:#c1d1c6; }
.profile-limits dd { margin:5px 0 0; font-size:14px; }
.profile-page .profile-gallery { display:flex; gap:12px; align-items:center; margin:14px 0 22px; padding:16px 20px; background:#f1f1e8; border:0; border-radius:12px; color:#344d3e; }
.profile-gallery > span:last-child { margin-left:auto; }
.profile-history { padding:19px 22px; border:1px solid #e0e4de; border-radius:14px; background:#fff; }
.profile-section-head h2,.avatar-picker h2 { margin:0; font-size:17px; }
.profile-history table { width:100%; }
.profile-history td,.profile-history th { text-align:left; padding:10px 6px; }
.profile-history td:nth-child(2) { font-weight:600; font-variant-numeric:tabular-nums; }
.profile-history td small { display:block; color:#707972; font-size:10px; overflow-wrap:anywhere; }
.profile-settings { margin-top:17px; align-items:flex-start; padding-inline:4px; color:#646d65; font-size:12px; }
.profile-settings details { flex:1; } .profile-settings form { max-width:330px; padding:14px 0; }
.avatar-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:20px; }
.avatar-grid button { padding:5px; border:2px solid transparent; border-radius:12px; font-size:12px; }
.avatar-grid button[aria-pressed=true],.avatar-grid button:hover { border-color:#547661; background:#f1f4ee; }
.avatar-grid img { width:100%; height:auto; margin-bottom:5px; }
.record-pages { display:flex; align-items:center; justify-content:center; gap:10px; margin:12px 0 3px; font-size:11px; color:#677069; }
.record-pages button { padding:5px 4px; color:inherit; } .record-pages button:disabled { opacity:.4; }
@media(max-width:600px){
 .profile-card { padding:18px; gap:16px; grid-template-columns:minmax(0,1fr); }
 .profile-avatar .cat-portrait { width:56px; height:56px; }
 .profile-wallet { display:flex; justify-content:space-between; align-items:baseline; text-align:left; }
 .profile-history { padding:14px 12px; } .profile-history table { min-width:0; table-layout:fixed; font-size:11px; }
 .profile-history th:first-child { width:33%; } .profile-history th:nth-child(2) { width:19%; }
 .profile-history td { white-space:normal; overflow-wrap:anywhere; }
}

.chat-scopes { display:flex; align-items:center; gap:3px; margin:2px 7px 8px; }
.chat-scopes button { flex:1; padding:6px 0; font-size:11px; color:#686a64; border-radius:5px; }
.chat-scopes button[aria-pressed=true] { color:#343d35; background:#e6e9e1; }
.turn-meta .turn-star { color:#a67214; font-size:13px; margin-right:4px; }
.turn-menu > summary { cursor:pointer; }
.turn-menu .row-menu-content { top:auto; bottom:100%; left:0; right:auto; }
.turn-menu .row-menu-content button { display:block; width:100%; text-align:left; color:#575953; }

.profile-chat-entry { display:flex; align-items:center; justify-content:space-between; margin:-9px 0 20px; padding:14px 20px; background:#f3f4ef; border-radius:12px; font-weight:600; }
#chat-manager .profile-head { margin:18px 0; }
#chat-manager .chat-scopes { max-width:300px; margin:0 0 14px; }
.manager-rows { padding:12px; background:white; border:1px solid var(--line); border-radius:12px; }
.manager-rows .chat-link { min-height:42px; }
.manager-rows .chat-main { font-size:14px; }
.manager-rows .chat-menu { visibility:visible; opacity:1; }
.grid-tools { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin:0 0 12px; }
.grid-tools button { padding:5px 10px; border-radius:7px; font-size:12px; color:#4c5d53; background:#f0f2ef; }
.gallery-image-button { -webkit-touch-callout:none; user-select:none; }
.gallery-image-button img { -webkit-user-drag:none; }
.gallery-card.is-selected .gallery-image-button { outline-color:#43735d; }
.gallery-card.is-selected .gallery-image-button::after { content:'✓'; position:absolute; bottom:7px; right:7px; background:#365e49; color:#fff; border-radius:50%; width:21px; height:21px; }
.gallery-image-button { position:relative; }
#gallery-calendar { position:fixed; inset:auto; padding:12px; margin:0; width:262px; max-width:calc(100vw - 16px); border:1px solid var(--line); border-radius:13px; background:white; box-shadow:0 8px 30px #20302720; color:#344337; }
#gallery-calendar header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; font-size:13px; }
#gallery-calendar header button { padding:4px 12px; font-size:20px; }
.calendar-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:2px; text-align:center; }
.calendar-days small { color:#68746c; }
.calendar-days button { min-height:29px; border-radius:7px; font-size:12px; }
.calendar-days button:disabled { color:#aaa; }
.calendar-days .has-photos { background:#e4eee5; font-weight:700; color:#275238; }
.calendar-days [aria-pressed=true] { outline:2px solid #48674e; outline-offset:-2px; }


/* The library keeps navigation around the grid and photo details in the viewer. */
.library-bar, .library-controls, .library-zoom, .photo-controls, .photo-strip {
  display:flex; align-items:center;
}
.library-bar { justify-content:space-between; gap:8px; margin:0 0 10px; }
.library-bar .gallery-tabs { padding:0; flex-wrap:nowrap; }
.library-bar .gallery-tabs button { padding:9px 13px; font-size:13px; color:#73746f; white-space:nowrap; border-radius:18px; }
.library-bar .gallery-tabs button.active { color:#242923; background:#e8ebe5; }
.library-controls { gap:4px; }
.library-controls button, .photo-controls button, .library-search-toggle {
  display:inline-grid; place-items:center; min-width:35px; height:35px; border-radius:18px; font-size:13px; color:#4b504b;
}
.library-controls button:hover,.library-search-toggle:hover,.photo-controls button:hover { background:#e9ece6; }
.library-controls [aria-expanded=true] { background:#ecefe9; }
.library-zoom { border-inline-end:1px solid #dedfdc; margin-inline-end:5px; padding-inline-end:5px; }
.library-zoom button,.library-search-toggle { font-size:18px; }
.my-gallery .gallery-toolbar { flex-wrap:nowrap; gap:7px; padding:0 0 12px; align-items:center; }
.my-gallery .gallery-toolbar[hidden], .gallery-inspector [hidden] { display:none; }
.gallery-toolbar select, .gallery-toolbar .gallery-date-filter, .library-search-toggle {
  height:35px; border:1px solid #e2e4df; border-radius:9px; color:#555b53; background:#fff;
}
.gallery-toolbar select { width:auto; min-width:0; padding:0 6px; font-size:12px; }
.gallery-toolbar .gallery-search { max-width:240px; height:35px; padding:0 9px; }
.gallery-toolbar .gallery-search input { width:100%; font-size:14px; }
.gallery-date-button[aria-pressed=true] { color:#225e44; background:#e4efe6; }
.my-gallery .gallery-grid { gap:5px; }
.my-gallery .gallery-image-button { border-radius:4px; }
.library-bar .gallery-summary { margin:0 0 0 5px; padding:0; font-size:.85em; color:#576251; font-variant-numeric:tabular-nums; }
.library-storage-trigger { anchor-name:--gallery-storage-button; font-weight:bold; letter-spacing:.08em; }
#library-storage { width:min(260px,calc(100vw - 24px)); margin:auto; padding:16px; border:1px solid #dedfd9; border-radius:14px; color:#343a32; box-shadow:0 7px 24px #25292320; }
#library-storage strong { font-size:14px; }
#library-storage p { margin:7px 0 12px; font-size:12px; line-height:1.6; color:#687065; }
#library-storage button { padding:0 10px; background:#f0f2ee; margin:2px; }
@supports (position-area: bottom span-left) {
  #library-storage { position-anchor:--gallery-storage-button; position-area:bottom span-left; inset:auto; margin:5px 0 0 auto; }
}
#modal:has(.gallery-inspector) {
  inset:0; width:100%; height:100dvh; max-width:100%; max-height:100dvh; margin:0; padding:0;
  border:0; border-radius:0; overflow:hidden; background:#f8f8f6;
}
#modal:has(.gallery-inspector) > .close { position:absolute; z-index:3; top:max(10px,env(safe-area-inset-top)); right:auto; left:max(12px,env(safe-area-inset-left)); background:#f1f2ee; }
.gallery-inspector {
  display:grid; position:relative; isolation:isolate; height:100%; min-height:0; grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto; color:#262923; background:#f8f8f6;
}
.photo-heading { min-height:56px; padding:max(10px,env(safe-area-inset-top)) 58px 6px; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:1px; }
.photo-heading time { font-size:14px; font-weight:550; font-variant-numeric:tabular-nums; }
.photo-heading .photo-position { position:static; padding:0; background:none; color:#787d74; font-size:10px; }
.gallery-inspector .gallery-inspector-image { padding:0; min-height:0; height:100%; background:transparent; }
.gallery-inspector .gallery-inspector-image img { max-height:100%; max-width:100%; border-radius:0; }
.photo-dock { display:grid; justify-items:center; gap:10px; min-width:0; padding:10px 8px max(12px,env(safe-area-inset-bottom)); }
.photo-strip { justify-content:center; width:100%; gap:3px; }
.photo-strip button { min-width:0; width:37px; height:39px; padding:0; border-radius:4px; overflow:hidden; opacity:.68; }
.photo-strip button[aria-current=true] { width:46px; opacity:1; outline:2px solid #526952; outline-offset:1px; margin:0 3px; }
.photo-strip img { width:100%; height:100%; object-fit:cover; }
.photo-controls { border:1px solid #dedfd9; background:#fff; border-radius:30px; padding:2px 6px; gap:3px; }
.photo-controls button { min-width:41px; height:38px; }
.photo-controls button[aria-pressed=true] svg { fill:#ac524b; stroke:#ac524b; }
.photo-controls .library-zoom { border-inline-end:none; border-inline-start:1px solid #dedfdc; margin:0; padding:0 0 0 5px; }
.gallery-inspector .gallery-inspector-details { position:absolute; z-index:2; bottom:calc(100px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(440px,calc(100% - 24px)); max-height:52%; overflow:auto; padding:19px; border:1px solid #dedfd9; border-radius:16px; box-shadow:0 8px 40px #18201626; background:#fff; }
.gallery-inspector-details .gallery-prompt { white-space:pre-wrap; overflow-wrap:anywhere; }
.gallery-inspector.immersive { display:block; background:#000; }
.gallery-inspector.immersive :is(.photo-heading,.photo-dock), #modal:has(.gallery-inspector.immersive) > .close { display:none; }
@media (max-width:760px) {
  .library-bar .gallery-tabs button { font-size:12px; padding:8px 9px; }
  .library-zoom { display:none; }
  .gallery-toolbar.searching { gap:3px; }
  .gallery-toolbar.searching select { max-width:72px; font-size:11px; }
  .gallery-toolbar.searching .gallery-search input { font-size:16px; }
  .gallery-toolbar.searching .gallery-search { max-width:none; }
  .my-gallery .gallery-grid { gap:3px; grid-template-columns:repeat(3,minmax(0,1fr)); }
  .my-gallery .gallery-image-button { border-radius:2px; }
}

.my-gallery:has(.gallery-selection) [data-action="gallery-start-select"] { display:none; }

.auth-body.auth-register { padding:26px clamp(20px,5vw,32px) 20px; }
.auth-register h2 { margin:0 0 4px; font-size:23px; }
.auth-register > p { margin:0 0 14px; }
.auth-register .field { margin:0 0 9px; gap:4px; }
.auth-register .field input { padding:8px 11px; }
.auth-register .form-error:empty { display:none; }
.auth-register .auth-switch { margin-top:10px; }
.auth-register h2 + form { margin-top:14px; }
.registration-code-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.registration-code-row .secondary { white-space:nowrap; }
.registration-code-row .secondary[aria-disabled="true"] { opacity:.55; cursor:not-allowed; }
.registration-code-status { margin:0; color:var(--muted); font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
.account-badge { --badge-ink:#76531a; --badge-paper:#faf0ce; display:inline-flex; align-items:center; gap:3px; max-width:100%; vertical-align:middle; padding:3px 8px; border-radius:12px; background:var(--badge-paper); color:var(--badge-ink); font:600 11px/1.3 system-ui,sans-serif; overflow-wrap:anywhere; }
.badge-jade { --badge-ink:#255e48; --badge-paper:#e0f2e7; }
.badge-violet { --badge-ink:#634e85; --badge-paper:#eee7f7; }
.badge-blue { --badge-ink:#345877; --badge-paper:#e2edf7; }
.user-badge-trigger { vertical-align:middle; padding:2px 4px; border-radius:12px; color:#536553; font-size:12px; }
.user-badge-trigger:hover { background:#edf1eb; }
.user-badge-trigger:not(:has(.account-badge)) { border:1px dashed #a9b6a9; padding-inline:7px; }
.badge-preview { margin:14px 0; border-radius:12px; padding:14px; background:#f5f6f2; }
.badge-preview small { display:block; color:#636a64; }
#console-badge-form [hidden] { display:none; }

.rail-brand { display:flex; align-items:center; justify-content:space-between; }
.cmimi-link { display:inline-flex; flex:none; align-items:center; justify-content:center; width:38px; height:38px; }
.cmimi-link img { width:29px; height:29px; border-radius:9px; }
.cmimi-link:focus-visible { outline:2px solid #516659; border-radius:10px; }
@media (max-width:760px) {
  .mobile-brand .cmimi-link { width:32px; height:42px; }
  .mobile-brand .cmimi-link img { width:25px; height:25px; }
}
