:root {
  --ink: #11152d;
  --ink-2: #1b2140;
  --ink-3: #252d50;
  --paper: #f4f3f7;
  --paper-2: #fbfafc;
  --muted: #7b8198;
  --muted-2: #aeb3c5;
  --line: #e4e4ec;
  --aqua: #87f2d8;
  --aqua-2: #56d9be;
  --coral: #ff8e7e;
  --amber: #ffc86b;
  --violet: #8275f4;
  --shadow: 0 18px 55px rgba(24, 27, 60, .1);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Manrope', 'Noto Sans SC', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
img { display: block; max-width: 100%; }
::selection { background: rgba(130, 117, 244, .24); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar-backdrop { display: none; }
.sidebar {
  width: 272px;
  flex-shrink: 0;
  overflow-y: auto;
  min-height: 100vh;
  padding: 30px 22px 22px;
  background:
    radial-gradient(circle at 20% 4%, rgba(135,242,216,.11), transparent 25%),
    radial-gradient(circle at 90% 75%, rgba(130,117,244,.2), transparent 28%),
    var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 12;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px; }
.brand-mark {
  width: 96px; height: 96px; flex-shrink: 0; border: 1px solid rgba(135,242,216,.65);
  border-radius: 12px; display: grid; place-items: center; position: relative;
  cursor: pointer; user-select: none;
  color: var(--aqua); font: 700 24px/1 'DM Mono', monospace; letter-spacing: -.08em;
}
.brand-mark i { position: absolute; width: 6px; height: 6px; background: var(--coral); border-radius: 50%; right: -3px; top: -3px; }
.brand-mark.has-custom-icon { border: 0; border-radius: 0; background: transparent; }
.brand-mark:focus-visible { outline: 2px solid var(--aqua); outline-offset: 4px; }
.brand-mark.has-custom-icon img { width: 100%; height: 100%; object-fit: contain; background: transparent; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.04em; }
.brand-sub { margin-top: 3px; color: #8b91aa; font-size: 11px; letter-spacing: .03em; }
.side-nav { display: grid; gap: 6px; margin-top: 44px; }
.nav-item {
  color: #9ca3bd; width: 100%; display: flex; align-items: center; gap: 12px; height: 45px;
  background: transparent; border-radius: 13px; padding: 0 12px; text-align: left; transition: .2s ease;
  font-size: 13px; font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { color: var(--ink); background: var(--aqua); box-shadow: 0 8px 24px rgba(87,221,194,.14); }
.nav-item-link, .nav-item-link:hover { text-decoration: none; }
.nav-item b { margin-left: auto; font: 500 11px 'DM Mono', monospace; opacity: .7; }
.nav-icon { width: 20px; font-size: 18px; line-height: 1; text-align: center; }
.side-divider { height: 1px; background: rgba(255,255,255,.1); margin: 28px 6px 24px; }
.side-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 4px; }
.side-label { padding: 0 12px; color: #6f7694; font-size: 10px; letter-spacing: .14em; font-weight: 700; }
.side-label-edit { color: #8e96b5; background: transparent; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 3px 7px; font-size: 10px; text-decoration: none; transition: .2s ease; }
.side-label-edit:hover { color: var(--aqua); border-color: rgba(135,242,216,.5); background: rgba(135,242,216,.08); }
.side-categories { display: grid; gap: 2px; margin-top: 11px; }
.side-cat {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px;
  color: #9ca3bd; background: transparent; font-size: 12px; text-align: left; transition: .2s ease;
}
.side-cat:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-cat, .side-cat:hover, .side-help, .side-help:hover { text-decoration: none; }
.side-cat.active { color: var(--aqua); background: rgba(135,242,216,.08); }
.side-cat i { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 2px; transform: rotate(45deg); }
.side-cat b { margin-left: auto; font: 400 10px 'DM Mono', monospace; color: #6f7694; }
.side-cat { min-width: 0; width: 100%; }
.side-cat > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.side-cat i, .side-cat b { flex-shrink: 0; }
.sidebar-bottom { margin-top: auto; }
.mini-stats { border-top: 1px solid rgba(255,255,255,.1); padding: 21px 7px 17px; display: grid; grid-template-columns: repeat(3,1fr); }
.mini-stats div { display: grid; gap: 4px; }
.mini-stats strong { color: #fff; font-size: 16px; letter-spacing: -.04em; }
.mini-stats span { color: #737b99; font-size: 10px; }
.side-help {
  width: 100%; height: 42px; border-radius: 12px; color: #d7d9e5; background: rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 9px; padding: 0 12px; font-size: 11px; transition: .2s ease;
}
.side-help:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-help > span:first-child { color: var(--amber); font-size: 16px; }
.side-help .arrow { margin-left: auto; color: #737b99; font-size: 16px; }

.main-content { flex: 1; min-width: 0; max-width: 1680px; padding: 0 54px 34px; }
.topbar { height: 87px; display: flex; align-items: center; justify-content: space-between; }
.breadcrumb { display: flex; align-items: center; gap: 11px; color: #9a9eb0; font-size: 12px; }
.breadcrumb b { color: #c9cad3; font-weight: 400; }
.breadcrumb strong { color: #454962; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.sync-status { color: #8b90a4; font-size: 11px; display: flex; align-items: center; gap: 7px; }
.sync-status i { width: 7px; height: 7px; background: #63d9ab; border-radius: 50%; box-shadow: 0 0 0 3px rgba(99,217,171,.15); }
.sync-status[data-library-save-status] { border: 0; padding: 5px 0; background: transparent; font: inherit; font-size: 11px; cursor: pointer; }
.sync-status[data-phase="pending"], .sync-status[data-phase="offline"], .sync-status[data-phase="conflict"] { color: #a86715; }
.sync-status[data-phase="pending"] i, .sync-status[data-phase="offline"] i, .sync-status[data-phase="conflict"] i { background: #e3a543; box-shadow: 0 0 0 3px rgba(227,165,67,.15); }
.sync-status[data-phase="saving"] i, .sync-status[data-phase="loading"] i { background: #7e9ddd; box-shadow: 0 0 0 3px rgba(126,157,221,.15); }
.library-conflict-modal .modal-card { width: min(540px, calc(100vw - 32px)); }
.sync-status[data-library-save-status] span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-conflict-modal p { margin: 20px 28px 0; color: var(--muted); line-height: 1.7; }
.library-conflict-fields { max-height: 180px; margin: 16px 28px; overflow: auto; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.library-conflict-modal .modal-actions { padding: 4px 28px 24px; }
.avatar { width: 34px; height: 34px; border-radius: 12px; background: var(--ink); color: var(--aqua); font-size: 12px; font-weight: 800; }
.mode-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; border: 1px solid #d9d8e4; border-radius: 9px; color: #6e7287; background: #fff; font-size: 10px; font-weight: 800; white-space: nowrap; transition: .2s ease; }
.mode-toggle:hover { color: var(--ink); border-color: #aaa0e7; background: #fbfaff; }
.mode-toggle[data-mode="admin"] { color: #51459d; border-color: #cbc5ee; background: #f4f1ff; }
.mode-toggle[data-mode="preview"] { color: #3d7b70; border-color: #b9ddd4; background: #effaf7; }
.mode-toggle-icon { display: inline-grid; place-items: center; width: 15px; height: 15px; font-size: 12px; line-height: 1; }
.mode-toggle-label { line-height: 1; }
.admin-password-card { width: min(420px, calc(100vw - 32px)); }
.admin-password-form { padding: 22px 28px 26px; }
.admin-password-form .field { margin-bottom: 8px; }
.admin-password-error { margin: 0 0 12px; color: #c94f58; font-size: 11px; font-weight: 700; }
.admin-password-error[hidden] { display: none; }
.admin-password-form .modal-actions { justify-content: flex-end; }
.mobile-menu { display: none; background: transparent; font-size: 22px; color: var(--ink); }

.hero {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 12px 0;
  text-align: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-3);
  font: 500 10px/1.5 'DM Mono', monospace;
  letter-spacing: .18em;
  animation: heroEyebrowBreath 2.8s ease-in-out infinite;
}
.hero-eyebrow-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(255,142,126,.12), 0 0 8px rgba(255,142,126,.38);
  animation: heroEyebrowDotBreath 2.8s ease-in-out infinite;
}
@keyframes heroEyebrowBreath {
  0%, 100% { opacity: .68; text-shadow: 0 0 0 transparent; }
  50% { opacity: 1; text-shadow: 0 0 10px rgba(130,117,244,.24); }
}
@keyframes heroEyebrowDotBreath {
  0%, 100% { transform: scale(.82); opacity: .62; box-shadow: 0 0 0 3px rgba(255,142,126,.1), 0 0 6px rgba(255,142,126,.22); }
  50% { transform: scale(1.14); opacity: 1; box-shadow: 0 0 0 5px rgba(255,142,126,.16), 0 0 15px rgba(255,142,126,.64); }
}
.hero-logo {
  display: block;
  width: min(100%, 1060px);
  height: auto;
  object-fit: contain;
}
.hero-description { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.hero-meta strong { color: var(--ink-3); font-size: 14px; margin-right: 3px; }
.meta-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero-eyebrow-dot { animation: none; }
}

/* Keep the editor readable when the browser is zoomed out. */
#editorModal .field > span,
#editorModal .image-binding-row,
#editorModal .dynamic-link-head span,
#editorModal .prompt-set-editor-head strong { font-size: 12px; }
#editorModal .field > span small,
#editorModal .dynamic-link-head small,
#editorModal .prompt-set-editor-head small { font-size: 11px; }
#editorModal .field input,
#editorModal .field textarea,
#editorModal .field select { font-size: 13px; }
#editorModal .field input,
#editorModal .field select { height: 42px; }
#editorModal .field textarea { min-height: 132px; line-height: 1.6; }
#editorModal .image-category-trigger { height: 42px; font-size: 13px; }
#editorModal .image-category-option { font-size: 12px; }
#editorModal .image-binding-row select,
#editorModal .image-binding-select { height: 38px; font-size: 12px; }
#editorModal .dynamic-link-head .small-btn,
#editorModal .small-btn,
#editorModal .ghost-btn,
#editorModal .primary-btn { min-height: 36px; font-size: 12px; }
#editorModal .link-row input { height: 40px; font-size: 12px; }
#editorModal .dynamic-link-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
#editorModal .bulk-link-panel { display: grid; gap: 9px; margin: 0 0 10px; padding: 12px; border: 1px solid #e3e1ec; border-radius: 10px; background: #faf9fd; }
#editorModal .bulk-link-panel[hidden] { display: none; }
#editorModal .bulk-link-panel .field { margin: 0; }
#editorModal .bulk-link-panel textarea { min-height: 96px; resize: vertical; }
#editorModal .bulk-link-actions { display: flex; justify-content: flex-end; gap: 7px; }
#editorModal .bulk-link-actions button { min-height: 34px; font-size: 12px; }
#editorModal .remove-link { width: 36px; height: 36px; flex-basis: 36px; font-size: 20px; }
#editorModal .prompt-set-editor-tab { height: 40px; font-size: 12px; }
#editorModal .prompt-set-editor-tab-index { width: 22px; height: 22px; font-size: 10px; }
#editorModal .set-parameter-title { font-size: 12px; }
#editorModal .set-parameter-title small { font-size: 11px; }
#editorModal .set-parameter-grid .field > span { font-size: 11px; }
#editorModal .set-parameter-grid .field input,
#editorModal .set-parameter-grid .field select { height: 36px; font-size: 12px; }

.workspace-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 42px 0 23px; }
.workspace-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.section-kicker { color: #989cad; font: 500 10px 'DM Mono', monospace; letter-spacing: .15em; }
.workspace-head h2 { font-size: 26px; letter-spacing: -.06em; margin: 10px 0 6px; }
.workspace-head p { margin: 0; color: var(--muted); font-size: 12px; }
.gallery-edit-toggle { min-width: 68px; }
.gallery-edit-toggle.active { color: var(--ink); border-color: #aaa0e7; background: #eeecfb; }
.primary-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 17px; color: var(--ink);
  background: var(--aqua); border-radius: 12px; font-size: 12px; font-weight: 800; transition: .2s ease;
  box-shadow: 0 9px 20px rgba(86,217,190,.16);
}
.primary-btn:hover { background: #9ff6e3; transform: translateY(-1px); }
.primary-btn span { font-size: 17px; line-height: 1; }
.toolbar { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.search-wrap { width: min(460px, 100%); height: 45px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: center; padding: 0 13px; gap: 10px; transition: .2s; }
.search-wrap:focus-within { border-color: rgba(130,117,244,.5); box-shadow: 0 0 0 4px rgba(130,117,244,.08); }
.search-icon { color: #969cb1; font-size: 24px; line-height: 1; transform: rotate(-20deg); }
.search-wrap input { border: 0; outline: 0; background: transparent; color: var(--ink); width: 100%; font-size: 12px; }
.search-wrap input::placeholder { color: #afb3c1; }
.search-wrap kbd { display: none; }
.toolbar-right { display: flex; align-items: center; gap: 9px; }
.select-wrap { display: flex; align-items: center; gap: 7px; color: #9da1b0; font-size: 11px; }
.select-wrap select { border: 0; outline: 0; background: transparent; color: #4e536a; font-size: 11px; font-weight: 700; cursor: pointer; }
.toolbar-divider { width: 1px; height: 20px; background: var(--line); margin: 0 5px; }
.view-btn { width: 31px; height: 31px; border-radius: 9px; color: #a5a8b7; background: transparent; font-size: 16px; }
.view-btn.active { color: var(--ink); background: #e3e1ec; }
.filter-row { display: flex; align-items: center; gap: 7px; overflow-x: auto; padding: 0 0 22px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; height: 31px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: #8b8fa1; font-size: 11px; transition: .2s; }
.filter-chip:hover { border-color: #bbb9d1; color: var(--ink); }
.filter-chip.active { color: #fff; background: var(--ink); border-color: var(--ink); box-shadow: 0 7px 14px rgba(17,21,45,.1); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(222px, 1fr)); gap: 17px; }
.template-card { min-width: 0; background: var(--paper-2); border: 1px solid rgba(227,227,237,.85); border-radius: 18px; overflow: hidden; transition: .22s ease; position: relative; animation: cardIn .35s ease both; }
.template-card:hover { transform: translateY(-4px); border-color: rgba(130,117,244,.26); box-shadow: var(--shadow); }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.card-media { aspect-ratio: 3 / 4; height: auto; position: relative; background: #eef0f5; overflow: hidden; cursor: pointer; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.template-card:hover .card-media img { transform: scale(1.045); }
.card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,18,42,.03) 38%, rgba(14,18,42,.52) 100%); pointer-events: none; }
.card-topline { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; align-items: center; justify-content: flex-end; }
.card-top-actions { display: flex; align-items: center; gap: 5px; }
.favorite-btn { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: rgba(17,21,45,.43); font-size: 16px; opacity: 0; pointer-events: none; transition: .2s; }
.template-card:hover .favorite-btn, .favorite-btn:focus-visible { opacity: 1; pointer-events: auto; }
.favorite-btn:hover, .favorite-btn.active { background: var(--coral); color: #fff; }
.card-delete-trigger { appearance: none; -webkit-appearance: none; width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 29px; box-sizing: border-box; padding: 0; margin: 0; border-radius: 50%; color: #fff; background: var(--coral); border: 1px solid rgba(255,255,255,.5); box-shadow: 0 4px 12px rgba(214,82,72,.3); cursor: pointer; transition: .2s ease; }
.card-delete-trigger svg { display: block; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.card-delete-trigger:hover { color: #fff; background: #f8756d; border-color: #fff; box-shadow: 0 5px 15px rgba(214,82,72,.4); transform: scale(1.06); }
.template-card.editing { border-color: rgba(130,117,244,.45); box-shadow: 0 0 0 2px rgba(130,117,244,.08); }
.template-card.editing:hover { transform: translateY(-2px); }
.card-hover { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; opacity: 0; transform: translateY(4px); transition: .2s ease; }
.template-card:hover .card-hover { opacity: 1; transform: translateY(0); }
.card-hover span { color: #fff; font-size: 10px; }
.card-open { color: var(--ink); background: var(--aqua); border-radius: 7px; font-size: 10px; padding: 7px 9px; font-weight: 800; }
.card-body { padding: 14px 14px 15px; }
.card-title-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.card-title { margin: 0; font-size: 15px; letter-spacing: -.045em; line-height: 1.25; }
.card-count { color: #9ca0b0; font: 10px 'DM Mono', monospace; padding-top: 2px; white-space: nowrap; }
.card-description { min-height: 31px; color: #9296a8; font-size: 10px; line-height: 1.55; margin: 7px 0 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag-list { display: flex; gap: 4px; min-width: 0; overflow: hidden; }
.mini-tag { color: #777c91; background: #f0eff5; padding: 4px 6px; border-radius: 5px; font-size: 9px; white-space: nowrap; }
.link-status { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; color: #3973d9; font-size: 9px; font-weight: 700; line-height: 1; white-space: nowrap; }
.link-status-icon { display: block; width: 13px; height: 13px; flex: 0 0 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.link-status-icon .link-status-back { opacity: .48; }
.prompt-status { display: flex; align-items: center; gap: 4px; color: #8c90a1; font-size: 9px; white-space: nowrap; }
.prompt-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--aqua-2); }
.empty-state { text-align: center; padding: 88px 20px; color: var(--muted); }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 15px; border: 1px dashed #b8b7cb; border-radius: 15px; font-size: 28px; color: var(--violet); }
.empty-state h3 { color: var(--ink); font-size: 16px; margin: 0 0 7px; }
.empty-state p { margin: 0 0 17px; font-size: 12px; }
.ghost-btn { height: 36px; border-radius: 10px; border: 1px solid var(--line); color: #62677d; background: transparent; padding: 0 13px; font-size: 11px; transition: .2s; }
.ghost-btn:hover { color: var(--ink); border-color: #a9a8be; background: #fff; }
.footer-note { display: flex; justify-content: space-between; color: #a5a8b6; font-size: 10px; margin-top: 38px; padding: 0 2px; }
.footer-note span:first-child { color: #787d95; font: 500 10px 'DM Mono', monospace; }

.backdrop { position: fixed; inset: 0; background: rgba(8,10,24,.44); opacity: 0; pointer-events: none; transition: .25s ease; z-index: 30; backdrop-filter: blur(3px); }
.backdrop.open { opacity: 1; pointer-events: auto; }
.detail-drawer { position: fixed; z-index: 31; right: 0; top: 0; bottom: 0; width: min(590px, 100vw); background: var(--paper-2); transform: translateX(100%); transition: .35s cubic-bezier(.22,.7,.25,1); box-shadow: -20px 0 65px rgba(8,10,24,.16); display: flex; flex-direction: column; touch-action: pan-y; overscroll-behavior-x: contain; }
.detail-drawer.open { transform: translateX(0); }
.drawer-head { flex: 0 0 auto; padding: 22px 24px 16px; display: flex; align-items: start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-kicker { color: #9ea2b3; font: 500 9px 'DM Mono', monospace; letter-spacing: .15em; }
.drawer-mode-badge { display: inline-flex; align-items: center; width: fit-content; margin-top: 8px; padding: 4px 7px; border-radius: 6px; color: #51459d; background: #f0edff; font-size: 10px; font-weight: 800; }
.drawer-mode-badge[data-mode="preview"] { color: #28786b; background: #eaf8f4; }
.drawer-head h2 { font-size: 27px; letter-spacing: -.06em; margin: 9px 0 0; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; color: #82869a; background: #f0eff5; font-size: 22px; line-height: 1; transition: .2s; }
.icon-btn:hover { color: var(--ink); background: #e6e5ee; }
.drawer-body { overflow-y: auto; padding: 18px 24px 30px; touch-action: pan-y; overscroll-behavior-x: contain; }
.drawer-cover { border-radius: 18px; overflow: hidden; height: 275px; background: #eef0f5; position: relative; }
.drawer-cover img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.drawer-cover-label { position: absolute; left: 14px; bottom: 14px; color: #fff; font: 9px 'DM Mono', monospace; background: rgba(17,21,45,.58); padding: 6px 8px; border-radius: 6px; backdrop-filter: blur(6px); }
.drawer-code-type { position: absolute; right: 14px; bottom: 14px; min-height: 28px; padding: 0 10px; border: 1px solid rgba(255,255,255,.72); border-radius: 8px; color: #fff; background: rgba(17,21,45,.64); box-shadow: 0 5px 16px rgba(17,21,45,.18); backdrop-filter: blur(6px); font-size: 12px; font-weight: 800; appearance: none; text-align: center; text-align-last: center; cursor: pointer; }
.drawer-code-type option { color: var(--ink); background: #fff; }
.drawer-code-type:focus-visible { outline: 2px solid var(--aqua-2); outline-offset: 3px; }
.drawer-code-type.code-type-wechat { background: #27b96f; }
.drawer-code-type.code-type-alipay { background: #3b91d4; }
.drawer-code-type.code-type-domain { background: #f28c28; }
.drawer-code-type.code-type-payment { background: #e45d63; }
.drawer-code-type.code-type-qq { background: #7a68d8; }
.lightbox-code-type { position: absolute; top: 6px; left: 50%; min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.22); transform: translateX(-50%); font-size: 13px; font-weight: 800; line-height: 30px; white-space: nowrap; }
.lightbox-code-type[hidden] { display: none; }
.lightbox-code-type.code-type-wechat { background: #27b96f; }
.lightbox-code-type.code-type-alipay { background: #3b91d4; }
.lightbox-code-type.code-type-domain { background: #f28c28; }
.lightbox-code-type.code-type-payment { background: #e45d63; }
.lightbox-code-type.code-type-qq { background: #7a68d8; }
.lightbox-modal { place-items: start center; padding: 16px 20px 20px; overflow: auto; touch-action: pan-y; overscroll-behavior-x: contain; }
.lightbox-inner, .lightbox-stage, .lightbox-image { touch-action: pan-y; }
.lightbox-inner { position: relative; width: min(1100px, calc(100vw - 220px)); max-width: none; max-height: calc(100vh - 36px); display: flex; flex-direction: column; align-items: center; padding: 12px 48px 12px; }
.lightbox-inner .lightbox-code-type { position: static; transform: none; flex: 0 0 auto; margin: 0 0 10px; min-height: 30px; }
.lightbox-stage { display: grid; place-items: center; min-width: 0; min-height: 0; width: 100%; flex: 0 0 auto; }
.lightbox-inner img { display: block; max-width: 100%; max-height: min(84vh, calc(100vh - 120px)); object-fit: contain; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.lightbox-meta { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 20px; margin-top: 8px; flex: 0 0 auto; }
.lightbox-caption { position: static; max-width: calc(100% - 72px); overflow: hidden; color: #d7d9e5; font-size: 12px; line-height: 20px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-counter { position: absolute; right: 0; bottom: 0; color: rgba(215,217,229,.72); font: 10px/20px 'DM Mono', monospace; }
.lightbox-close { position: fixed; right: 22px; top: 16px; z-index: 3; }
@media (max-width: 700px) {
  .lightbox-modal { padding: 10px 12px 14px; }
  .lightbox-inner { width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 8px 12px 10px; }
  .lightbox-inner img { max-height: calc(100vh - 112px); }
  .lightbox-close { right: 12px; top: 10px; }
}
.image-code-type-select.code-type-wechat, #formCoverCodeType.code-type-wechat { color: #3c8660; background: #edf7f0; border-color: #b9dfc7; }
.image-code-type-select.code-type-alipay, #formCoverCodeType.code-type-alipay { color: #4d79a4; background: #edf4fb; border-color: #bfd4e8; }
.image-code-type-select.code-type-domain, #formCoverCodeType.code-type-domain { color: #9a6b25; background: #fff6e8; border-color: #edd5aa; }
.image-code-type-select.code-type-payment, #formCoverCodeType.code-type-payment { color: #a65358; background: #fff0f0; border-color: #e7bfc1; }
.image-code-type-select.code-type-qq, #formCoverCodeType.code-type-qq { color: #6555b4; background: #f1efff; border-color: #ccc5f1; }
.drawer-info { display: flex; justify-content: space-between; gap: 15px; margin: 19px 0 22px; }
.drawer-summary { color: #888da0; font-size: 11px; line-height: 1.7; max-width: 390px; }
.drawer-summary strong { color: var(--ink); font-size: 13px; }
.drawer-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: end; }
.small-btn { height: 32px; display: inline-flex; align-items: center; gap: 6px; border-radius: 9px; padding: 0 10px; border: 1px solid var(--line); color: #63687c; background: transparent; font-size: 10px; font-weight: 700; white-space: nowrap; }
.small-btn:hover { border-color: #aaa8be; color: var(--ink); background: #fff; }
.small-btn.accent { background: var(--ink); border-color: var(--ink); color: var(--aqua); }
.detail-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: #eeedf3; margin-bottom: 18px; }
.detail-tab { flex: 1; height: 32px; border-radius: 8px; background: transparent; color: #989cad; font-size: 10px; font-weight: 700; }
.detail-tab.active { color: var(--ink); background: #fff; box-shadow: 0 3px 9px rgba(17,21,45,.07); }
.detail-section { margin-top: 17px; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.detail-section-title { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 800; letter-spacing: -.02em; }
.detail-section-title i { width: 7px; height: 7px; border-radius: 2px; background: var(--coral); transform: rotate(45deg); }
.section-note { color: #a4a7b5; font-size: 10px; }
.variant-row { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.variant-row::-webkit-scrollbar { display: none; }
.variant-btn { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: #85899c; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 10px; }
.variant-btn.active { color: var(--ink); background: #e8e6f3; border-color: #cfcaee; font-weight: 700; }
.prompt-set-switcher { border: 1px solid var(--line); border-radius: 11px; background: #faf9fc; padding: 11px 12px 2px; margin: 0 0 5px; }
.prompt-set-switcher-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.prompt-set-switcher-title strong { color: var(--ink); font-size: 11px; }
.prompt-set-switcher-title span { color: #9b9eae; font-size: 9px; }
.prompt-block { border: 1px solid var(--line); background: #f7f6fa; border-radius: 12px; position: relative; }
.prompt-block pre { margin: 0; padding: 16px 42px 16px 15px; white-space: pre-wrap; word-break: break-word; color: #5c6175; font: 11px/1.75 'DM Mono', 'Noto Sans SC', monospace; max-height: 210px; overflow: auto; }
.prompt-copy { position: absolute; right: 9px; top: 9px; width: 27px; height: 27px; border-radius: 7px; background: #fff; border: 1px solid #e5e4eb; color: #8f93a4; font-size: 12px; }
.prompt-copy:hover { color: var(--violet); border-color: #c4bfee; }
.prompt-label { display: inline-flex; align-items: center; gap: 5px; padding: 10px 15px 0; color: #858a9d; font-size: 10px; font-weight: 700; }
.prompt-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--aqua-2); }
.prompt-label.negative i { background: var(--coral); }
.parameter-site { margin-top: 6px; }
.website-parameter-site { border: 0; border-radius: 0; overflow: visible; background: #fff; color: #000; }
.parameter-site-head { display: none; }
.param-list { padding: 0 4px; }
.param-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; align-items: center; column-gap: 12px; min-height: 54px; padding: 7px 0; border-bottom: 1px solid #e4e4e7; }
.param-row:last-child { border-bottom: 0; }
.param-copy { min-width: 0; align-self: center; }
.param-name { display: block; color: #000; font-size: 13px; line-height: 1.3; font-weight: 800; letter-spacing: -.02em; }
.param-control { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.param-control-wide { justify-content: flex-end; }
.param-range { flex: 1 1 auto; min-width: 0; width: 100%; height: 3px; accent-color: #18181b; }
.param-select { width: 100%; border: 1px solid #e4e4e7; background: #fff; border-radius: 7px; color: #111; height: 32px; font-size: 11px; padding: 0 8px; }
.param-value { flex: 0 0 56px; width: 56px; height: 32px; border: 1px solid #e4e4e7; border-radius: 7px; background: #fff; color: #111; font: 11px 'DM Mono', monospace; text-align: center; outline: 0; }
.param-value:focus { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.09); }
.param-help { display: block; margin-top: 3px; color: #71717a; font-size: 9px; line-height: 1.32; font-weight: 500; }
.param-switch { position: relative; display: inline-flex; width: 42px; height: 24px; cursor: pointer; }
.param-switch input { position: absolute; opacity: 0; pointer-events: none; }
.param-switch-track { width: 42px; height: 24px; border-radius: 999px; background: #dedfe4; box-shadow: inset 0 1px 2px rgba(17,21,45,.05); transition: .2s ease; }
.param-switch-track::after { content: ''; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(17,21,45,.12); transition: .2s ease; }
.param-switch input:checked + .param-switch-track { background: #222; }
.param-switch input:checked + .param-switch-track::after { transform: translateX(18px); }
.reference-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.reference-strip img { width: 74px; height: 56px; object-fit: contain; background: #eef0f5; border-radius: 7px; border: 1px solid var(--line); cursor: zoom-in; }
.save-bar { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.drawer-thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding: 2px 4px; scrollbar-width: none; scroll-behavior: smooth; overscroll-behavior-x: contain; }
.drawer-thumbs::-webkit-scrollbar { display: none; }
.drawer-thumbs img { flex: 0 0 auto; width: 64px; height: 48px; object-fit: contain; background: #eef0f5; border-radius: 7px; opacity: .55; border: 2px solid transparent; cursor: pointer; transition: .2s; }
.drawer-thumbs img:hover, .drawer-thumbs img.active { opacity: 1; border-color: var(--aqua-2); }

.preview-detail-summary { display: grid; gap: 13px; padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.preview-detail-summary-copy { display: grid; gap: 5px; }
.preview-detail-kicker { color: #a0a4b2; font: 500 10px 'DM Mono', monospace; letter-spacing: .12em; }
.preview-detail-summary-copy strong { color: var(--ink); font-size: 18px; line-height: 1.25; }
.preview-detail-summary-copy > span:last-child { color: #85899c; font-size: 11px; }
.preview-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.preview-detail-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; color: #65617b; background: #f0eff7; font-size: 10px; font-weight: 700; }
.preview-detail-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 18px; }
.preview-detail-image { position: relative; display: grid; gap: 7px; min-width: 0; padding: 0; border: 0; border-radius: 11px; color: var(--ink); background: transparent; text-align: left; cursor: zoom-in; }
.preview-detail-image img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; border: 1px solid #e2e1e9; border-radius: 10px; background: #f3f3f7; transition: .2s ease; }
.preview-detail-label { overflow: hidden; padding: 0 2px; color: #777c91; font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.preview-detail-code-type { position: absolute; top: 8px; right: 8px; z-index: 1; display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; color: #fff; box-shadow: 0 4px 12px rgba(17,21,45,.18); font-size: 10px; font-weight: 800; line-height: 24px; white-space: nowrap; }
.preview-detail-code-type.code-type-wechat { background: #31ae70; }
.preview-detail-code-type.code-type-alipay { background: #4b8fca; }
.preview-detail-code-type.code-type-domain { background: #e18a2c; }
.preview-detail-code-type.code-type-payment { background: #d96568; }
.preview-detail-code-type.code-type-qq { background: #7769c5; }
.preview-detail-image:hover img, .preview-detail-image:focus-visible img { border-color: #aaa0e7; box-shadow: 0 6px 18px rgba(86,74,174,.12); transform: translateY(-2px); }
.preview-detail-image:focus-visible { outline: 0; }

body[data-library-mode="preview"] [data-admin-only] { display: none !important; }
body[data-library-mode="preview"] .mini-stats { grid-template-columns: repeat(2, 1fr); }

/* Keep detail text readable even when the browser is zoomed out. */
#detailDrawer .drawer-kicker { font-size: 10px; }
#detailDrawer .drawer-cover-label { font-size: 11px; }
#detailDrawer .drawer-summary { min-width: 0; font-size: 13px; }
#detailDrawer .drawer-summary strong { font-size: 15px; }
#detailDrawer .small-btn,
#detailDrawer .detail-tab,
#detailDrawer .variant-btn,
#detailDrawer .prompt-label,
#detailDrawer .section-note,
#detailDrawer .save-bar .ghost-btn,
#detailDrawer .save-bar .primary-btn { font-size: 12px; }
#detailDrawer .detail-section-title { flex-wrap: wrap; font-size: 15px; }
#detailDrawer .detail-section-title > i { flex-shrink: 0; }
#detailDrawer .section-note { flex-shrink: 0; }
#detailDrawer .prompt-set-switcher-title { flex-wrap: wrap; }
#detailDrawer .prompt-set-switcher-title strong { font-size: 13px; }
#detailDrawer .prompt-set-switcher-title span { font-size: 11px; }
#detailDrawer .prompt-block pre { font-size: 14px; line-height: 1.7; }
#detailDrawer .param-name { font-size: 15px; }
#detailDrawer .param-help { font-size: 11px; line-height: 1.45; }
#detailDrawer .param-select,
#detailDrawer .param-value { font-size: 13px; }
#detailDrawer .param-value,
#detailDrawer .param-select[data-param-key="size"],
#detailDrawer .param-select[data-param-key="error"] {
  color: #1b2140;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#detailDrawer .drawer-image-category,
#detailDrawer .image-category-trigger { font-size: 13px; }
#detailDrawer .drawer-image-category small,
#detailDrawer .image-category-option,
#detailDrawer .parameter-unconfirmed-badge { font-size: 12px; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: .25s ease; }
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card { width: min(760px, 100%); max-height: min(780px, calc(100vh - 40px)); overflow-y: auto; background: var(--paper-2); border-radius: 22px; box-shadow: 0 25px 80px rgba(10,12,32,.24); transform: translateY(8px) scale(.98); transition: .25s ease; }
.modal.open .modal-card { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 25px 28px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 23px; letter-spacing: -.06em; margin: 8px 0 0; }
#editorForm { padding: 22px 28px 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid.compact { grid-template-columns: repeat(4, 1fr); }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { color: #71768a; font-size: 10px; font-weight: 700; }
.field > span b { color: var(--coral); }
.field > span small { color: #a7aab7; font-weight: 400; margin-left: 4px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #dedde7; background: #faf9fc; color: var(--ink); border-radius: 9px; padding: 0 11px; outline: 0; font-size: 11px; transition: .2s; }
.field input, .field select { height: 38px; }
.field textarea { padding-top: 10px; padding-bottom: 10px; line-height: 1.55; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.1); }
.dynamic-link-section { margin: 2px 0 15px; padding: 13px; border: 1px solid #dedde7; border-radius: 11px; background: #faf9fc; }
.dynamic-link-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.dynamic-link-head > div { display: grid; gap: 4px; }
.dynamic-link-head span { color: #71768a; font-size: 10px; font-weight: 700; }
.dynamic-link-head small { color: #a7aab7; font-size: 10px; }
.dynamic-link-head .small-btn { height: 28px; padding: 0 9px; font-size: 10px; }
.dynamic-link-list { display: grid; gap: 7px; }
.image-binding-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: -4px 0 15px; color: #858a9d; font-size: 10px; }
.image-binding-row label { flex: 1 1 180px; }
.image-binding-row label, .image-assignment-fields label { display: grid; gap: 5px; min-width: 0; }
.image-binding-row select, .image-binding-select, .image-code-type-select, .image-category-select, .drawer-image-category select { height: 32px; min-width: 0; width: 100%; border: 1px solid #dedde7; background: #fff; color: var(--ink); border-radius: 8px; padding: 0 8px; outline: 0; font-size: 10px; text-overflow: ellipsis; }
.image-binding-row select:focus, .image-binding-select:focus, .image-code-type-select:focus, .image-category-select:focus, .drawer-image-category select:focus { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.1); }
.image-category-select:disabled, #formCoverCategory:disabled { color: var(--muted); background: #f0eff5; cursor: default; }
.image-category-picker { position: relative; width: 100%; min-width: 0; }
.image-category-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 32px; min-width: 0; padding: 0 9px; border: 1px solid #dedde7; border-radius: 8px; background: #fff; color: var(--ink); outline: 0; font-size: 10px; text-align: left; }
.field .image-category-trigger { height: 38px; background: #faf9fc; font-size: 11px; }
.image-category-trigger:hover { border-color: #c5c0e8; background: #fcfbff; }
.image-category-trigger:focus-visible { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.1); }
.image-category-trigger-text { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
.image-category-trigger i { flex: 0 0 auto; color: #8b88a8; font-style: normal; font-size: 13px; line-height: 1; }
.image-category-options { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; display: grid; max-height: 220px; min-width: 175px; overflow: auto; padding: 5px; border: 1px solid #dedde7; border-radius: 9px; background: #fff; box-shadow: 0 12px 28px rgba(36,33,72,.16); }
.image-category-options[hidden] { display: none; }
.image-category-option { display: flex; align-items: center; gap: 7px; min-height: 29px; padding: 4px 6px; border-radius: 6px; color: #62677b; font-size: 10px; cursor: pointer; }
.image-category-option:hover { background: #f4f1ff; color: var(--ink); }
.image-category-option input[type="checkbox"] { flex: 0 0 14px; width: 14px; height: 14px; margin: 0; padding: 0; accent-color: #7667d7; }
.image-category-picker.is-disabled .image-category-trigger { color: var(--muted); background: #f0eff5; cursor: default; }
.image-category-picker.is-disabled .image-category-trigger i { color: #b7b5c2; }
.link-row { display: flex; align-items: flex-start; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .16s, box-shadow .16s, opacity .16s, transform .16s; }
.link-row.is-dragging { opacity: .72; border-color: #aaa0e7; box-shadow: 0 9px 24px rgba(86,74,174,.14); transform: scale(.995); }
.link-row.is-drop-target { border-color: #aaa0e7; box-shadow: inset 0 3px 0 #8a7ce8; }
.link-drag-handle { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 34px; margin-top: 0; padding: 0; border: 0; border-radius: 7px; color: #9892b4; background: #f1eff9; font-size: 19px; line-height: 1; cursor: grab; touch-action: none; user-select: none; }
.link-drag-handle:hover { color: #6f61cf; background: #e9e5fb; }
.link-drag-handle:active, .link-row.is-dragging .link-drag-handle { cursor: grabbing; }
.link-drag-handle:focus-visible { color: #6f61cf; outline: 2px solid rgba(118,103,215,.38); outline-offset: 2px; }
.link-row-index { display: grid; place-items: center; flex: 0 0 24px; height: 34px; color: #9a96b0; font: 600 10px/1 'DM Mono', monospace; }
.link-row-content { display: grid; flex: 1; min-width: 0; gap: 8px; }
.detail-link-input-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.detail-link-input-row .detail-link-input { flex: 1 1 auto; min-width: 0; }
.detail-link-thumb { display: grid; place-items: center; flex: 0 1 auto; width: fit-content; min-width: 0; max-width: 110px; height: fit-content; max-height: 62px; overflow: hidden; border: 1px solid #dedde7; border-radius: 7px; background: #f5f4f8; color: #aaa7b5; font-size: 9px; line-height: 1; }
.detail-link-thumb img { display: block; width: auto; height: auto; max-width: 108px; max-height: 60px; object-fit: contain; }
.detail-link-thumb.has-image { border-color: #d6d2eb; background: #fff; }
.detail-link-thumb.is-error { color: #b29da1; background: #fff7f6; border-color: #ead6d3; }
.image-assignment-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; color: #858a9d; font-size: 10px; }
.link-row .image-assignment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-category-note { color: var(--muted); font-size: 10px; line-height: 1.5; }
.link-row input { width: 100%; min-width: 0; height: 34px; border: 1px solid #dedde7; background: #fff; color: var(--ink); border-radius: 8px; padding: 0 10px; outline: 0; font-size: 10px; }
.link-row input:focus { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.1); }
.remove-link { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; color: #9a9eae; background: #f0eff5; font-size: 17px; line-height: 1; }
.drawer-image-category { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 14px; color: var(--ink-3); font-size: 11px; }
.drawer-image-category select, .drawer-image-category .image-category-picker { flex: 1 1 140px; width: auto; max-width: 260px; font-size: 11px; }
.drawer-image-category small { color: var(--muted); font-size: 10px; }
.remove-link:hover { color: var(--coral); background: #fff0ed; }
.link-empty { color: #adb0bd; font-size: 10px; padding: 3px 1px 1px; }
.prompt-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.prompt-set-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; margin: 3px 0 12px; }
.prompt-set-editor-head > div { display: grid; gap: 4px; }
.prompt-set-editor-head strong { color: #4c5268; font-size: 12px; }
.prompt-set-editor-head small { color: #a0a4b2; font-size: 10px; }
.prompt-set-editor-tabs { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding: 4px; border: 1px solid #dedde7; border-radius: 11px; background: #f7f6fa; scrollbar-width: none; }
.prompt-set-editor-tabs::-webkit-scrollbar { display: none; }
.prompt-set-editor-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-width: 92px; max-width: 190px; height: 34px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #85899c; font-size: 10px; font-weight: 700; text-align: left; }
.prompt-set-editor-tab:hover { color: var(--ink); background: #fff; }
.prompt-set-editor-tab.active { color: var(--ink); border-color: #cfcaee; background: #fff; box-shadow: 0 3px 9px rgba(17,21,45,.08); }
.prompt-set-editor-tab-index { flex: 0 0 auto; display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: #8f8ba9; background: #eceaf5; font: 600 9px 'DM Mono', monospace; }
.prompt-set-editor-tab.active .prompt-set-editor-tab-index { color: #fff; background: var(--violet); }
.prompt-set-editor-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-set-editor-list { display: grid; gap: 13px; }
.prompt-set-editor-list > .prompt-set-editor[hidden] { display: none; }
.prompt-set-editor { border: 1px solid #dedde7; border-radius: 13px; background: #faf9fc; padding: 13px; }
.prompt-set-editor-title { display: flex; align-items: flex-start; gap: 9px; }
.prompt-set-editor-title .field { flex: 1; }
.prompt-set-editor-title .field input { background: #fff; }
.remove-prompt-set { flex: 0 0 auto; width: 31px; height: 31px; margin-top: 20px; border-radius: 8px; color: #999dab; background: #f0eff5; font-size: 17px; line-height: 1; }
.remove-prompt-set:hover { color: var(--coral); background: #fff0ed; }
.set-parameter-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; border-top: 1px solid #e7e5ed; padding-top: 12px; margin: 1px 0 10px; color: #656a7d; font-size: 10px; font-weight: 800; }
.set-parameter-title small { color: #a7aab7; font-size: 9px; font-weight: 400; }
.unconfirmed-parameter-btn { margin-left: auto; min-height: 28px; padding: 0 9px; border: 1px solid #dedde7; border-radius: 8px; color: #777c91; background: #fff; font-size: 11px; font-weight: 600; cursor: pointer; transition: color .18s ease, border-color .18s ease, background .18s ease; }
.unconfirmed-parameter-btn:hover { color: var(--ink); border-color: #aaa0e7; background: #f7f5ff; }
.unconfirmed-parameter-btn.is-active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--violet), #9d93ff); box-shadow: 0 6px 16px rgba(130,117,244,.28), 0 0 0 3px rgba(130,117,244,.12); }
#editorModal .unconfirmed-parameter-btn { min-height: 32px; font-size: 12px; }
.parameter-unconfirmed-badge { display: inline-flex; align-items: center; min-height: 20px; margin-left: 7px; padding: 0 7px; border: 1px solid #e6c7bb; border-radius: 999px; color: #a7573f; background: #fff2ed; font-size: 10px; font-weight: 700; vertical-align: middle; }
.set-parameter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 9px; }
.set-parameter-grid .field { margin-bottom: 10px; }
.set-parameter-grid .field > span { font-size: 9px; }
.set-parameter-grid .field input, .set-parameter-grid .field select { height: 32px; padding: 0 7px; font-size: 10px; }
.form-section-title { display: flex; align-items: baseline; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; margin: 3px 0 14px; color: #4c5268; font-size: 12px; font-weight: 800; }
.form-section-title small { color: #a0a4b2; font-size: 10px; font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.guide-card { width: min(520px,100%); }
.guide-content { padding: 24px 28px 28px; }
.guide-step { display: flex; gap: 15px; padding: 0 0 20px; }
.guide-step > span { flex: 0 0 auto; color: var(--violet); font: 500 11px 'DM Mono', monospace; padding-top: 2px; }
.guide-step strong { color: var(--ink); font-size: 12px; }
.guide-step p { color: #858a9d; font-size: 11px; line-height: 1.7; margin: 7px 0 0; }
.guide-step .small-btn { margin-top: 10px; text-decoration: none; }
.extension-install-intro { margin: 0 0 18px; color: #777c91; font-size: 11px; line-height: 1.7; }
.guide-content > .small-btn { text-decoration: none; }
.guide-tip { display: flex; gap: 8px; color: #777c91; background: #f1f0f7; border-radius: 10px; padding: 12px; font-size: 10px; line-height: 1.6; }
.guide-tip span { color: var(--coral); font-size: 14px; }

#categoryEditorModal { background: rgba(10,12,32,.4); backdrop-filter: blur(3px); }
#categoryEditorModal[hidden] { display: none; }
.category-editor-card { width: min(620px, 100%); }
.category-editor-body { padding: 21px 28px 26px; }
.category-editor-note-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 17px; }
.category-editor-note { margin: 0; color: #858a9d; font-size: 11px; line-height: 1.7; }
.category-editor-note-row .small-btn { flex: 0 0 auto; white-space: nowrap; }
.category-name-list { display: grid; gap: 8px; }
.category-name-row { display: grid; grid-template-columns: 31px minmax(150px, 1fr) minmax(180px, 1.2fr) 32px; align-items: center; gap: 11px; padding: 9px 10px; border: 1px solid #e5e3ec; border-radius: 10px; background: #faf9fc; }
.category-name-index { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; color: #8884a8; background: #eceaf5; font: 600 9px 'DM Mono', monospace; }
.category-drag-handle { display: grid; place-items: center; width: 30px; height: 34px; padding: 0; border: 0; border-radius: 7px; color: #9290aa; background: transparent; cursor: grab; touch-action: none; user-select: none; font-size: 20px; line-height: 1; transition: color .15s ease, background .15s ease; }
.category-drag-handle:hover { color: #7466c8; background: #eeebf9; }
.category-drag-handle:active { cursor: grabbing; }
.category-drag-handle:focus-visible { outline: 2px solid #aaa0e7; outline-offset: 2px; }
.category-drag-handle:disabled { color: #c2c0ce; background: transparent; cursor: default; }
.category-name-row.is-dragging { position: relative; z-index: 1; border-color: #aaa0e7; background: #f3f0ff; box-shadow: 0 5px 16px rgba(99,85,173,.14); }
.category-name-row.is-dragging .category-drag-handle { color: #7466c8; background: #e8e2fc; cursor: grabbing; }
.category-name-row[data-category-fallback="true"] { background: #f5f4f8; }
.category-name-row[data-category-fallback="true"] .category-name-copy small { color: #9b98ae; }
.category-name-copy { display: grid; gap: 3px; min-width: 0; }
.category-name-copy strong { overflow: hidden; color: #555a70; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.category-name-copy small { color: #a5a8b5; font-size: 9px; }
.category-name-row input { width: 100%; height: 35px; border: 1px solid #dedde7; border-radius: 8px; padding: 0 10px; color: var(--ink); background: #fff; outline: 0; font-size: 11px; }
.category-name-row input:focus { border-color: #aaa0e7; box-shadow: 0 0 0 3px rgba(130,117,244,.1); }
.category-delete-trigger { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; color: #d94b4b; background: #fff0ed; font-size: 19px; line-height: 1; cursor: pointer; transition: .18s ease; }
.category-delete-trigger:hover { color: #fff; background: #e45d5d; }
.category-delete-trigger:focus-visible { outline: 2px solid rgba(228,93,93,.45); outline-offset: 2px; }
.category-delete-trigger:disabled { color: #b8bac5; background: #f0eff5; cursor: not-allowed; }
.category-name-error { color: #c44040; background: #fff0ed; padding: 9px 11px; border-radius: 8px; font-size: 11px; }
.category-editor-body .modal-actions { padding-top: 18px; flex-wrap: wrap; }
.category-editor-body #resetCategoryNames { margin-right: auto; }
@media (max-width: 560px) {
  .category-editor-body { padding: 18px 16px 20px; }
  .category-editor-note-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .category-editor-note-row .small-btn { align-self: flex-start; }
  .category-name-row { grid-template-columns: 31px minmax(0, 1fr) 32px; }
  .category-drag-handle { grid-column: 1; grid-row: 1 / span 2; height: 44px; }
  .category-name-row input { grid-column: 2; }
  .category-delete-trigger { grid-column: 3; grid-row: 1; }
}

.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 11px; box-shadow: 0 15px 35px rgba(10,12,32,.22); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast > span:first-child { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--aqua); color: var(--ink); font-size: 11px; font-weight: 800; }

.gallery-grid.list-view { grid-template-columns: 1fr; }
.list-view .template-card { display: grid; grid-template-columns: 180px 1fr; }
.list-view .card-media { aspect-ratio: 3 / 4; height: auto; }
.list-view .card-body { display: flex; flex-direction: column; justify-content: center; }
.list-view .card-description { min-height: 0; max-width: 510px; }
.list-view .card-hover { display: none; }

@media (max-width: 1100px) {
  .main-content { padding: 0 32px 30px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(204px, 1fr)); }
}
@media (max-width: 780px) {
  html.mobile-sidebar-open, html.mobile-sidebar-open body { overflow: hidden; }
  .sidebar { position: fixed; left: 0; min-height: 0; height: 100vh; height: 100dvh; transform: translateX(-100%); transition: .25s ease; box-shadow: 12px 0 40px rgba(8,10,24,.16); overscroll-behavior-y: contain; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 11; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: rgba(8,10,24,.32); touch-action: none; }
  .main-content { padding: 0 17px 26px; }
  .topbar { height: 68px; }
  .mobile-menu { display: block; }
  .breadcrumb { margin-right: auto; margin-left: 12px; }
  .top-actions { gap: 9px; }
  .sync-status { display: none; }
  .sync-status[data-library-save-status] { display: flex; max-width: min(48vw, 180px); }
  .sync-status[data-phase="pending"], .sync-status[data-phase="offline"], .sync-status[data-phase="conflict"] { display: flex; }
  .workspace-head { margin-top: 31px; align-items: start; }
  .workspace-head h2 { font-size: 22px; }
  .workspace-head .primary-btn { flex: 0 0 auto; padding: 0 12px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .search-wrap { width: 100%; }
  .toolbar-right { justify-content: flex-end; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
  .card-media { aspect-ratio: 3 / 4; height: auto; }
  .card-body { padding: 11px; }
  .card-title { font-size: 13px; }
  .card-description { font-size: 9px; }
  .card-count { display: none; }
  .mini-tag { font-size: 9px; }
  .link-status { font-size: 9px; }
  .prompt-status { font-size: 8px; }
  .footer-note { gap: 10px; line-height: 1.6; }
  .drawer-head { padding: 23px 20px 17px; }
  .drawer-body { padding: 18px 20px 30px; }
  .drawer-cover { height: 240px; }
  .param-list { padding: 0 8px; }
  .param-row { grid-template-columns: minmax(0, 1fr) 180px; column-gap: 12px; min-height: 58px; padding: 8px 0; }
  .param-name { font-size: 12px; }
  .param-help { font-size: 9px; }
  .param-select, .param-value { height: 34px; }
  .param-value { flex-basis: 58px; width: 58px; font-size: 11px; }
  .drawer-info { display: block; }
  .drawer-actions { justify-content: start; margin-top: 13px; }
  .form-grid, .prompt-form-grid { grid-template-columns: 1fr; gap: 0; }
  .set-parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.compact { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .modal-head { padding: 21px 20px 17px; }
  #editorForm { padding: 19px 20px 22px; }
}
@media (max-width: 430px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .card-media { aspect-ratio: 3 / 4; height: auto; }
  .card-body { padding: 9px; }
  .card-title { font-size: 13px; line-height: 1.4; }
  .card-bottom { flex-wrap: wrap; gap: 6px; margin-top: 7px; }
  .tag-list { flex: 1 0 auto; max-width: 100%; flex-wrap: wrap; }
  .link-status { margin-left: auto; gap: 4px; font-size: 9px; }
  .link-status-icon { width: 14px; height: 14px; flex-basis: 14px; }
  .form-grid.compact { grid-template-columns: 1fr; }
  .set-parameter-grid { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .param-row { grid-template-columns: 1fr; row-gap: 8px; min-height: 0; padding: 12px 0; }
  .param-control, .param-control-wide { justify-content: flex-start; }
  .param-row-choice .param-control { max-width: 100%; }
}

/* Gallery card sorting ---------------------------------------------------
   The sorting interaction is pointer driven in app.js.  These states stay
   independent from the category editor's drag styles so a card can be held
   on touch screens without changing the normal gallery layout. */
.gallery-grid.is-dragging,
.gallery-grid.gallery-dragging,
.gallery-grid[data-dragging="true"] {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing;
}

.gallery-sort-active,
.gallery-sort-active * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.template-card.is-pressing {
  border-color: rgba(130,117,244,.5);
  box-shadow: 0 0 0 3px rgba(130,117,244,.12);
  -webkit-user-select: none;
  user-select: none;
}

.template-card.is-pressing .card-media img {
  -webkit-user-drag: none;
}

.gallery-grid.is-dragging .template-card,
.gallery-grid.gallery-dragging .template-card,
.gallery-grid[data-dragging="true"] .template-card {
  /* Disable the card-in animation and hover lift while hit testing targets. */
  animation: none;
}

.gallery-grid.is-dragging .template-card:hover,
.gallery-grid.gallery-dragging .template-card:hover,
.gallery-grid[data-dragging="true"] .template-card:hover {
  transform: none;
}

.template-card.is-dragging,
.template-card.gallery-dragging,
.template-card.dragging,
.template-card[data-dragging="true"] {
  opacity: .2;
  transform: none !important;
  filter: saturate(.55);
  border-style: dashed;
  border-color: rgba(130,117,244,.55);
  box-shadow: none;
  transition: none !important;
  animation: none !important;
  pointer-events: none;
}

.template-card.is-dragging .card-media img,
.template-card.gallery-dragging .card-media img,
.template-card.dragging .card-media img,
.template-card[data-dragging="true"] .card-media img {
  transform: none !important;
}

/* The moving copy is appended to body and positioned by the pointer loop. */
.gallery-drag-ghost {
  position: fixed !important;
  left: 0;
  top: 0;
  z-index: 1000 !important;
  display: block !important;
  margin: 0 !important;
  opacity: .96 !important;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: grabbing !important;
  /* Keep this declaration as the idle fallback; app.js writes the live
     translate3d() inline on every pointer frame, which must be allowed to
     win over the stylesheet. */
  transform: translate3d(0, 0, 0) rotate(1.15deg) scale(1.025);
  transform-origin: center center;
  transition: none !important;
  animation: none !important;
  will-change: left, top, transform;
  border-color: rgba(130,117,244,.58) !important;
  box-shadow: 0 22px 46px rgba(18,20,54,.24), 0 0 0 3px rgba(130,117,244,.14) !important;
}

.gallery-drag-ghost.is-list-card,
.gallery-drag-ghost[data-layout="list"] {
  display: grid !important;
  grid-template-columns: 180px 1fr;
}

.gallery-drag-ghost.is-list-card .card-body,
.gallery-drag-ghost[data-layout="list"] .card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gallery-drag-ghost.is-list-card .card-hover,
.gallery-drag-ghost[data-layout="list"] .card-hover {
  display: none;
}

.gallery-drag-ghost:hover {
  transform: translate3d(0, 0, 0) rotate(1.15deg) scale(1.025);
}

.gallery-drag-ghost .card-media img,
.gallery-drag-ghost:hover .card-media img,
.gallery-drag-ghost .favorite-btn,
.gallery-drag-ghost .card-hover,
.gallery-drag-ghost .card-delete-trigger {
  transition: none !important;
}

.gallery-drag-ghost .card-media img,
.gallery-drag-ghost:hover .card-media img {
  transform: none !important;
}

.gallery-drag-ghost .favorite-btn,
.gallery-drag-ghost .card-delete-trigger,
.gallery-drag-ghost .card-hover {
  opacity: 0 !important;
}

/* A full-card slot makes the destination visible in both grid and list view. */
.gallery-drop-placeholder {
  position: relative;
  display: grid !important;
  grid-column: auto;
  grid-row: auto;
  place-items: center;
  min-width: 0;
  min-height: var(--drag-height, 300px);
  width: var(--drag-width, auto);
  height: var(--drag-height, auto);
  border: 2px dashed rgba(130,117,244,.68);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(130,117,244,.09), rgba(135,242,216,.08)),
    repeating-linear-gradient(135deg, rgba(130,117,244,.055) 0 7px, transparent 7px 14px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 0 0 4px rgba(130,117,244,.06);
  color: #7169b5;
  pointer-events: none;
  opacity: 1;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.gallery-drop-placeholder::before {
  content: '松开放到这里';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 11px;
  border: 1px solid rgba(130,117,244,.25);
  border-radius: 9px;
  background: rgba(255,255,255,.68);
  color: #7169b5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}

/* app.js supplies a real label for screen readers and localization.  Prefer
   it when present so the fallback pseudo label is not rendered twice. */
.gallery-drop-placeholder:has(> span)::before { content: none; }
.gallery-drop-placeholder > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 11px;
  border: 1px solid rgba(130,117,244,.25);
  border-radius: 9px;
  background: rgba(255,255,255,.68);
  color: #7169b5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}

.gallery-drop-placeholder.is-active,
.gallery-drop-placeholder.active,
.gallery-drop-placeholder[data-active="true"] {
  border-color: rgba(86,217,190,.92);
  background:
    linear-gradient(135deg, rgba(135,242,216,.17), rgba(130,117,244,.11)),
    repeating-linear-gradient(135deg, rgba(86,217,190,.08) 0 7px, transparent 7px 14px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65), 0 0 0 5px rgba(86,217,190,.12), 0 10px 26px rgba(86,217,190,.1);
  color: #257d6c;
}

.gallery-drop-placeholder.is-active::before,
.gallery-drop-placeholder.active::before,
.gallery-drop-placeholder[data-active="true"]::before {
  border-color: rgba(86,217,190,.38);
  color: #257d6c;
}

.gallery-drop-placeholder.is-active > span,
.gallery-drop-placeholder.active > span,
.gallery-drop-placeholder[data-active="true"] > span {
  border-color: rgba(86,217,190,.38);
  color: #257d6c;
}

.gallery-drop-placeholder > * {
  pointer-events: none;
}

.gallery-grid.is-dragging .gallery-drop-placeholder,
.gallery-grid.gallery-dragging .gallery-drop-placeholder,
.gallery-grid[data-dragging="true"] .gallery-drop-placeholder {
  animation: galleryDropPulse 1.15s ease-in-out infinite;
}

@keyframes galleryDropPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 0 0 4px rgba(130,117,244,.06); }
  50% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.62), 0 0 0 6px rgba(130,117,244,.12); }
}

/* List mode gets a row-shaped slot while preserving the card's media ratio. */
.gallery-grid.list-view .gallery-drop-placeholder {
  width: var(--drag-width, 100%);
  min-height: var(--drag-height, 180px);
  height: var(--drag-height, auto);
}

@media (max-width: 780px) {
  .gallery-drop-placeholder { border-radius: 14px; }
  .gallery-drop-placeholder::before,
  .gallery-drop-placeholder > span { font-size: 9px; padding: 6px 9px; }
  .gallery-drag-ghost { transform: translate3d(0, 0, 0) rotate(.8deg) scale(1.018); }
  .gallery-drag-ghost:hover { transform: translate3d(0, 0, 0) rotate(.8deg) scale(1.018); }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-drag-ghost,
  .gallery-drop-placeholder,
  .gallery-grid.is-dragging .gallery-drop-placeholder,
  .gallery-grid.gallery-dragging .gallery-drop-placeholder,
  .gallery-grid[data-dragging="true"] .gallery-drop-placeholder { animation: none !important; transition: none !important; }
}

.library-backup-actions { display:flex; align-items:center; gap:6px; position:relative; }
.backup-btn { display:inline-flex; align-items:center; justify-content:center; gap:5px; padding:7px 10px; border:1px solid #e2e5ed; border-radius:8px; color:#47516a; background:#fff; font-size:12px; font-weight:600; cursor:pointer; white-space:nowrap; }
.backup-btn span { font-size:16px; line-height:1; }
.backup-btn:hover { color:#5664cf; border-color:#b9c1f0; background:#f7f8ff; }
.backup-btn:disabled { opacity:.55; cursor:wait; }
.backup-btn .backup-menu-caret { margin-left:2px; flex-shrink:0; transition:transform .18s; }
.backup-btn[aria-expanded="true"] .backup-menu-caret { transform:rotate(180deg); }
.backup-btn[aria-expanded="true"] { color:#5664cf; border-color:#b9c1f0; background:#f7f8ff; }
.backup-menu { position:absolute; right:0; top:calc(100% + 8px); z-index:55; min-width:180px; padding:5px; border:1px solid #e2e5ed; border-radius:11px; background:#fff; box-shadow:0 8px 28px #25304b20; }
.backup-menu[hidden] { display:none; }
.backup-menu-item { display:flex; align-items:center; gap:11px; width:100%; padding:10px 11px; border:0; border-radius:7px; color:#38425c; background:transparent; text-align:left; font-size:13px; font-weight:600; cursor:pointer; }
.backup-menu-item:hover, .backup-menu-item:focus-visible { background:#f2f4ff; color:#5664cf; outline:none; }
.backup-menu-item small { display:block; margin-top:3px; color:#8790a2; font-size:11px; font-weight:400; }
.backup-menu-icon { display:grid; place-items:center; flex-shrink:0; width:32px; height:32px; border-radius:9px; color:#6574c7; background:#f0f2fb; }
.backup-menu-icon svg { display:block; }
.sidebar-bottom .library-backup-actions { width:100%; margin-top:8px; }
.sidebar-bottom .backup-btn { justify-content:flex-start; width:100%; height:42px; gap:9px; padding:0 12px; border:0; border-radius:12px; color:#d7d9e5; background:rgba(255,255,255,.06); font-size:11px; font-weight:400; }
.sidebar-bottom .backup-btn > svg:first-child { color:#aeb9f3; flex-shrink:0; }
.sidebar-bottom .backup-btn .backup-button-label { flex:1; font-size:11px; text-align:left; }
.sidebar-bottom .backup-btn .backup-menu-caret { color:#8d94ad; }
.sidebar-bottom .backup-btn:hover, .sidebar-bottom .backup-btn[aria-expanded="true"] { color:#fff; background:rgba(255,255,255,.1); }
.sidebar-bottom .backup-menu { top:auto; bottom:calc(100% + 8px); left:0; right:0; min-width:0; }
.sidebar-bottom .backup-status { top:auto; bottom:calc(100% + 8px); left:0; right:0; max-width:100%; white-space:normal; color:#47516a; }
.backup-status { position:absolute; right:0; top:calc(100% + 8px); z-index:50; padding:9px 13px; border-radius:8px; background:#fff; box-shadow:0 4px 24px #25304b20; font-size:12px; white-space:nowrap; }
.backup-status[hidden] { display:none; }
.backup-restore-card { max-width:520px; font-size:15px; line-height:1.7; }
.backup-restore-card p { margin:12px 0; }
.backup-info { color:#737c91; font-size:13px; }
[data-restore-error] { color:#c54151; }
@media(max-width:700px) { .backup-btn { padding:6px; font-size:11px; gap:3px; } .top-actions { gap:6px; } .top-actions .avatar { display:none; } .breadcrumb { display:none; } .outpaint-topbar { flex-wrap:wrap; } }
.parameter-autosave-hint { color:#718278; font-size:13px; align-self:center; }

.image-empty { display: grid; place-items: center; min-height: 160px; height: 100%; padding: 24px; color: var(--muted); font-size: 14px; text-align: center; background: #eef0f5; }
