:root {
  color-scheme: light;
  --paper: #f4f1eb;
  --panel: #fcfbf8;
  --panel-strong: #ffffff;
  --ink: #211f1b;
  --muted: #777168;
  --line: #ddd7cd;
  --line-soft: #ebe6dd;
  --accent: #d94f31;
  --accent-dark: #b63c23;
  --accent-soft: #f7ddd5;
  --sage: #70806b;
  --shadow: 0 18px 50px rgba(44, 38, 30, 0.08);
  --shadow-soft: 0 8px 24px rgba(44, 38, 30, 0.07);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --sidebar: 236px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, rgba(217, 79, 49, 0.12), transparent 28%),
    radial-gradient(circle at 82% 82%, rgba(112, 128, 107, 0.16), transparent 28%),
    var(--paper);
}

.login-card {
  width: min(440px, 100%);
  padding: 48px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  background: rgba(252, 251, 248, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card h1 { margin: 8px 0 12px; font-size: clamp(34px, 7vw, 50px); letter-spacing: -0.05em; }
.login-intro { margin: 0 0 32px; color: var(--muted); line-height: 1.7; }
.login-mark, .brand-mark { display: flex; align-items: flex-end; gap: 4px; }
.login-mark { height: 46px; margin-bottom: 26px; }
.login-mark span, .brand-mark span { display: block; border-radius: 999px; background: var(--accent); transform: rotate(15deg); }
.login-mark span:nth-child(1) { width: 13px; height: 30px; }
.login-mark span:nth-child(2) { width: 13px; height: 45px; background: var(--ink); }
.login-mark span:nth-child(3) { width: 13px; height: 24px; background: var(--sage); }

.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; }
.field em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.field input, .field textarea, .field select, .filter-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background: var(--panel-strong);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input, .field select, .filter-row select { height: 46px; padding: 0 13px; }
.field textarea { min-height: 92px; padding: 12px 13px; resize: vertical; line-height: 1.65; }
.field input:focus, .field textarea:focus, .field select:focus, .filter-row select:focus, .search-box:focus-within {
  border-color: rgba(217, 79, 49, 0.62);
  box-shadow: 0 0 0 3px rgba(217, 79, 49, 0.1);
}
.full { grid-column: 1 / -1; }
.form-error { min-height: 20px; margin: -6px 0 0; color: #b72f27; font-size: 13px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
}
.button svg { width: 18px; height: 18px; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .46; cursor: not-allowed; }
.button.primary { color: white; background: var(--accent); box-shadow: 0 8px 20px rgba(217, 79, 49, 0.22); }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); box-shadow: 0 10px 24px rgba(217, 79, 49, .27); }
.button.secondary { border-color: var(--ink); background: var(--ink); color: white; }
.button.ghost { border-color: var(--line); background: transparent; }
.button.ghost:hover { border-color: var(--ink); background: var(--panel-strong); }
.button.wide { width: 100%; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--ink); }
.danger-text { color: #b53a2d; }
.danger-text:hover { color: #8f2117; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 30px 18px 22px;
  border-right: 1px solid var(--line-soft);
  background: rgba(252, 251, 248, 0.92);
  backdrop-filter: blur(18px);
}
.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.brand-block strong { display: block; font-size: 19px; letter-spacing: -0.03em; }
.brand-block small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.brand-mark { width: 28px; height: 32px; }
.brand-mark span { width: 7px; }
.brand-mark span:nth-child(1) { height: 20px; }
.brand-mark span:nth-child(2) { height: 30px; background: var(--ink); }
.brand-mark span:nth-child(3) { height: 16px; background: var(--sage); }
.main-nav { display: grid; gap: 8px; margin-top: 42px; }
.nav-button {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.nav-button svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.nav-button:hover { color: var(--ink); background: rgba(33, 31, 27, .045); }
.nav-button.active { color: var(--accent-dark); background: var(--accent-soft); }
.sidebar-foot { display: grid; gap: 16px; margin-top: auto; padding: 0 10px; }
.storage-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #669064; box-shadow: 0 0 0 4px rgba(102, 144, 100, .12); }

.content-shell { min-height: 100vh; margin-left: var(--sidebar); }
.page { width: min(1460px, 100%); margin: 0 auto; padding: 54px 46px 90px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.055em; line-height: 1; }
.page-subtitle { margin: 14px 0 0; color: var(--muted); line-height: 1.6; }
.mobile-header, .mobile-nav { display: none; }

.search-panel { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.search-box {
  min-width: 280px;
  flex: 1;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-box svg { flex: 0 0 auto; width: 19px; height: 19px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #a49e95; }
.filter-row { display: flex; align-items: center; gap: 9px; }
.filter-row select { width: auto; min-width: 116px; background-color: var(--panel-strong); }

.gallery-grid { columns: 5 220px; column-gap: 18px; }
.image-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  overflow: hidden;
  border: 1px solid rgba(221, 215, 205, .82);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: 0 2px 0 rgba(33, 31, 27, .02);
  cursor: pointer;
  text-align: left;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.image-card:hover { transform: translateY(-3px); border-color: #cfc7bb; box-shadow: var(--shadow-soft); }
.image-card img { display: block; width: 100%; height: auto; min-height: 130px; background: #e9e5de; }
.group-count-badge { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 6px 9px; border-radius: 999px; color: white; background: rgba(25, 24, 21, .78); box-shadow: 0 3px 12px rgba(0,0,0,.15); font-size: 10px; font-weight: 750; backdrop-filter: blur(7px); }
.card-body { padding: 13px 14px 14px; }
.card-body h3 { margin: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.card-body p { display: -webkit-box; margin: 7px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-body p.card-note::before { content: "备注 · "; color: var(--accent-dark); font-weight: 750; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mini-tag { max-width: 100%; padding: 4px 7px; overflow: hidden; border-radius: 6px; background: var(--paper); color: #665f55; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.image-card-skeleton { height: 280px; animation: shimmer 1.3s infinite linear; background: linear-gradient(110deg, #e8e3dc 8%, #f4f1eb 18%, #e8e3dc 33%); background-size: 200% 100%; }
.gallery-group { display: inline-block; width: 100%; margin: 4px 0 22px; padding: 16px; break-inside: avoid; column-span: all; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(252, 251, 248, .82); }
.gallery-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.gallery-group-heading strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.gallery-group-heading span { flex: 0 0 auto; color: var(--accent-dark); font-size: 11px; font-weight: 750; }
.gallery-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: start; }
.gallery-group-grid .image-card { display: block; margin: 0; }
@keyframes shimmer { to { background-position-x: -200%; } }

.empty-state { padding: 80px 24px; border: 1px dashed var(--line); border-radius: var(--radius-lg); text-align: center; }
.empty-state h2 { margin: 20px 0 8px; }
.empty-state p { margin: 0 0 22px; color: var(--muted); }
.empty-state.small { padding: 50px 20px; }
.empty-visual { display: flex; justify-content: center; align-items: flex-end; gap: 5px; height: 55px; }
.empty-visual span { width: 20px; border-radius: 99px; transform: rotate(12deg); background: var(--accent); }
.empty-visual span:nth-child(1) { height: 34px; }
.empty-visual span:nth-child(2) { height: 55px; background: var(--ink); }
.empty-visual span:nth-child(3) { height: 26px; background: var(--sage); }
.load-more-wrap { display: flex; justify-content: center; padding: 32px 0 0; }

.panel { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--panel); box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); gap: 24px; align-items: start; }
.upload-panel { min-height: 520px; padding: 18px; }
.shared-form-panel { position: sticky; top: 24px; padding: 26px; }
.drop-zone {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 36px;
  border: 1.5px dashed #cfc7bb;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(247, 221, 213, .34), rgba(255,255,255,.7));
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(.997); }
.drop-zone h2 { margin: 18px 0 7px; font-size: 22px; }
.drop-zone p { margin: 0; color: var(--muted); }
.drop-zone > span { margin-top: 13px; color: var(--sage); font-size: 12px; font-weight: 700; }
.drop-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); }
.drop-icon svg { width: 27px; height: 27px; }
.selected-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 4px 12px; }
.selected-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.selected-item { min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel-strong); }
.selected-preview { position: relative; overflow: hidden; background: #e9e5de; aspect-ratio: 1; }
.selected-preview img { width: 100%; height: 100%; object-fit: cover; }
.selected-note { display: block; width: 100%; min-height: 66px; padding: 9px 10px; resize: vertical; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; outline: 0; color: var(--ink); background: var(--panel-strong); font: inherit; font-size: 11px; line-height: 1.45; }
.selected-note:focus { box-shadow: inset 0 0 0 2px rgba(210, 112, 91, .22); }
.selected-note::placeholder { color: #999187; }
.selected-status { position: absolute; inset: auto 6px 6px; padding: 5px 7px; overflow: hidden; border-radius: 7px; background: rgba(25,24,21,.84); color: white; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(5px); }
.selected-status.done { background: rgba(72, 112, 70, .92); }
.selected-status.error { background: rgba(166, 50, 37, .92); }
.selected-remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(25,24,21,.76); color: white; cursor: pointer; }
.panel-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.panel-title-row h2 { margin: 0; font-size: 21px; }
.soft-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; font-weight: 750; white-space: nowrap; }
.compression-note { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border-radius: 12px; color: #4e5d49; background: #edf0e9; }
.compression-note svg { flex: 0 0 auto; width: 22px; height: 22px; }
.compression-note strong, .compression-note span { display: block; }
.compression-note strong { font-size: 12px; }
.compression-note span { margin-top: 3px; color: #72806d; font-size: 11px; line-height: 1.5; }

.styles-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.style-create-panel { position: sticky; top: 24px; padding: 26px; }
.style-create-panel h2 { margin: 0 0 22px; }
.styles-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.compact-search { min-width: 220px; height: 44px; }
.styles-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.style-card { position: relative; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--panel); }
.style-card-top { display: flex; align-items: flex-start; gap: 10px; }
.style-check { margin: 4px 0 0; accent-color: var(--accent); }
.style-card h3 { margin: 0; font-size: 16px; }
.style-card .style-category { display: inline-block; margin-top: 5px; color: var(--accent-dark); font-size: 11px; font-weight: 750; }
.style-card p { margin: 14px 0; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.style-card-actions { display: flex; align-items: center; gap: 12px; }
.style-card-actions button { font-size: 12px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.settings-grid > .panel { padding: 28px; }
.generator-panel { grid-column: 1 / -1; }
.generator-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 20px; }
.generator-create-row .button { min-width: 120px; }
.generator-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.generator-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--panel-strong); }
.generator-row.is-inactive { opacity: .62; background: var(--paper); }
.generator-name-field > span { color: var(--sage); font-size: 11px; }
.generator-row.is-inactive .generator-name-field > span { color: var(--muted); }
.generator-actions { display: flex; align-items: center; gap: 9px; padding-bottom: 1px; }
.generator-actions .button { min-height: 40px; padding-inline: 14px; font-size: 12px; }
.generator-actions .text-button { font-size: 12px; white-space: nowrap; }
.inline-manage { width: max-content; font-size: 12px; }
.compact-form { gap: 15px; }
.section-copy { max-width: 650px; margin: -6px 0 22px; color: var(--muted); line-height: 1.7; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.warning-note { margin: 16px 0 0; color: #92764b; font-size: 12px; line-height: 1.5; }
.stat-panel { display: flex; flex-direction: column; justify-content: space-between; min-height: 240px; background: var(--ink); color: white; }
.stat-panel .eyebrow { color: #f0a28f; }
.big-stat { display: flex; align-items: baseline; gap: 10px; }
.big-stat strong { font-size: 64px; line-height: 1; letter-spacing: -0.07em; }
.big-stat span { color: #bdb7ae; }
.stat-breakdown { display: flex; gap: 16px; color: #bdb7ae; font-size: 12px; }
.stat-breakdown strong { color: white; }

.detail-dialog { width: min(1180px, calc(100vw - 32px)); height: min(90vh, 900px); height: min(90dvh, 900px); max-height: calc(100dvh - 24px); padding: 0; overflow: hidden; border: 0; border-radius: 24px; background: var(--panel); box-shadow: 0 28px 100px rgba(22, 19, 15, .32); }
.detail-dialog::backdrop { background: rgba(25, 22, 18, .56); backdrop-filter: blur(6px); }
.detail-shell { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(430px, .95fr); overflow: hidden; }
.detail-media-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #e8e4dd; }
.detail-image-wrap { position: relative; min-height: 0; flex: 1 1 auto; display: grid; place-items: center; overflow: hidden; background: #e8e4dd; touch-action: pan-y; }
.detail-image-wrap img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.detail-image-nav { position: absolute; inset-block: 0; z-index: 2; width: 34%; display: flex; align-items: center; padding: 20px; border: 0; outline: 0; color: white; background: transparent; cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.detail-image-nav.previous { left: 0; justify-content: flex-start; }
.detail-image-nav.next { right: 0; justify-content: flex-end; }
.detail-image-nav span { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.54); border-radius: 50%; background: rgba(25,24,21,.48); box-shadow: 0 5px 20px rgba(0,0,0,.18); font-size: 38px; font-weight: 300; line-height: 1; opacity: .45; transform: scale(.94); transition: opacity .18s ease, transform .18s ease, background .18s ease; backdrop-filter: blur(7px); }
.detail-image-nav:hover span, .detail-image-nav:focus-visible span { opacity: 1; transform: scale(1); background: rgba(25,24,21,.72); }
.detail-group-panel { flex: 0 0 auto; padding: 14px 16px 17px; border-top: 1px solid rgba(120, 112, 101, .18); background: rgba(252, 251, 248, .92); }
.detail-group-summary { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-group-strip { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.detail-group-thumb { flex: 0 0 72px; width: 72px; height: 72px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: #e8e4dd; cursor: grab; opacity: .72; user-select: none; -webkit-touch-callout: none; }
.detail-group-thumb.active { border-color: var(--accent); opacity: 1; box-shadow: 0 0 0 2px rgba(210, 112, 91, .16); }
.detail-group-thumb.dragging { cursor: grabbing; opacity: .34; }
.detail-group-thumb.drag-target { border-color: var(--sage); opacity: 1; transform: translateY(-3px); }
.detail-group-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-content { min-width: 0; min-height: 0; height: 100%; padding: 34px 26px 42px 34px; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-color: #c9c1b6 transparent; scrollbar-width: auto; }
.detail-content::-webkit-scrollbar { width: 11px; }
.detail-content::-webkit-scrollbar-track { background: transparent; }
.detail-content::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: #c9c1b6; background-clip: padding-box; }
.detail-content::-webkit-scrollbar-thumb:hover { background: #a9a095; background-clip: padding-box; }
.dialog-close { position: absolute; top: 16px; right: 16px; z-index: 3; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.84); box-shadow: var(--shadow-soft); cursor: pointer; font-size: 24px; line-height: 1; }
.detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-right: 34px; }
.detail-heading h2 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.group-management { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--paper); }
.group-management summary { padding: 14px; cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 750; list-style-position: inside; }
.group-management[open] summary { border-bottom: 1px solid var(--line-soft); }
.group-management-body { padding: 14px; }
.group-management-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.group-management-body > small { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.detail-meta { padding: 12px 13px; border-radius: 10px; background: var(--paper); color: var(--muted); font-size: 12px; line-height: 1.7; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 10px; pointer-events: none; }
.toast { max-width: 360px; padding: 13px 16px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 13px; line-height: 1.5; animation: toast-in .22s ease; }
.toast.error { background: #9d3026; }
.clipboard-helper { position: fixed; top: -1000px; left: -1000px; width: 1px; height: 1px; opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .page { padding-inline: 30px; }
  .search-panel { align-items: stretch; flex-direction: column; }
  .import-layout { grid-template-columns: 1fr; }
  .shared-form-panel { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
  .styles-list { grid-template-columns: 1fr; }
}

@media (max-height: 760px) and (min-width: 761px) {
  .detail-dialog { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .detail-content { padding: 24px 20px 32px 26px; }
  .detail-heading h2 { font-size: 22px; }
  .detail-actions { margin: 15px 0; }
  .compact-form { gap: 12px; }
}

@media (max-width: 760px) {
  :root { --radius-lg: 20px; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .content-shell { margin-left: 0; }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 15;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(244, 241, 235, .9);
    backdrop-filter: blur(16px);
  }
  .brand-block.compact { padding: 0; }
  .brand-block.compact .brand-mark { transform: scale(.82); transform-origin: left center; }
  .brand-block.compact strong { font-size: 17px; }
  .icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-strong); }
  .icon-button svg { width: 20px; height: 20px; }
  .page { padding: 34px 16px 30px; }
  .page-heading { margin-bottom: 24px; }
  .page-heading h1 { font-size: 38px; }
  .page-subtitle { font-size: 14px; }
  .desktop-only { display: none !important; }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-soft);
    background: rgba(252, 251, 248, .94);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
  .mobile-nav button.active { color: var(--accent-dark); background: var(--accent-soft); }
  .search-box { min-width: 0; }
  .filter-row { margin-inline: -16px; padding-inline: 16px; overflow-x: auto; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row select { flex: 0 0 auto; min-width: 116px; }
  .gallery-grid { columns: 2 145px; column-gap: 10px; }
  .gallery-group { margin-bottom: 14px; padding: 11px; border-radius: 16px; }
  .gallery-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .image-card { margin-bottom: 10px; border-radius: 12px; }
  .card-body { padding: 10px; }
  .card-body p { display: none; }
  .card-meta { margin-top: 7px; }
  .card-meta .mini-tag:nth-child(n+2) { display: none; }
  .import-layout, .styles-layout { display: block; }
  .upload-panel, .shared-form-panel, .style-create-panel { padding: 14px; }
  .upload-panel { min-height: 0; }
  .shared-form-panel { margin-top: 16px; }
  .drop-zone { min-height: 240px; padding: 26px 18px; }
  .selected-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .style-create-panel { position: static; margin-bottom: 20px; }
  .styles-toolbar { position: sticky; top: 72px; z-index: 10; padding-block: 6px; background: var(--paper); }
  .settings-grid > .panel { padding: 21px; }
  .generator-create-row, .generator-row { grid-template-columns: 1fr; align-items: stretch; }
  .generator-list { grid-template-columns: 1fr; }
  .generator-actions { justify-content: space-between; }
  .detail-dialog { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .detail-shell { height: 100vh; height: 100dvh; min-height: 0; max-height: 100vh; max-height: 100dvh; display: block; overflow-y: auto; }
  .detail-media-column { height: auto; display: block; overflow: visible; }
  .detail-image-wrap { min-height: 0; height: 44dvh; }
  .detail-image-wrap img { max-height: 44dvh; }
  .detail-image-nav { width: 36%; padding: 12px; }
  .detail-image-nav span { width: 40px; height: 40px; font-size: 32px; opacity: .72; }
  .detail-group-panel { position: sticky; top: 0; z-index: 2; padding: 10px 12px 12px; }
  .detail-group-thumb { flex-basis: 62px; width: 62px; height: 62px; }
  .detail-content { height: auto; min-height: 0; overflow: visible; padding: 24px 18px 80px; scrollbar-gutter: auto; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #upload-to-group { grid-column: 1 / -1; }
  .group-management-actions { align-items: stretch; flex-direction: column; }
  .detail-footer { align-items: stretch; flex-direction: column-reverse; }
  .login-card { padding: 34px 24px; }
  .toast-region { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; }
  .toast { max-width: none; }
}

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