:root {
  color-scheme: light;
  --ink: #172033;
  --text: #2f3a4c;
  --muted: #667085;
  --subtle: #8d99aa;
  --line: #d7dee8;
  --line-soft: #e7edf4;
  --canvas: #eef2f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --teal: #087f8c;
  --teal-dark: #075e68;
  --blue: #2b59c3;
  --green: #168447;
  --orange: #c66a12;
  --red: #c9352b;
  --shadow-sm: 0 1px 2px rgba(23, 32, 51, .06);
  --shadow-md: 0 12px 28px rgba(23, 32, 51, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: 0;
}

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

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease;
}

button:hover:not(:disabled) {
  border-color: #b8c4d3;
  box-shadow: var(--shadow-sm);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 1px 2px rgba(23, 32, 51, .14);
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
  box-shadow: none;
}

input,
select,
textarea {
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 140, .14);
}

.hidden-control {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 62px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
}

.brand,
.admin-brand,
.admin-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  font-size: 18px;
  font-weight: 850;
}

.brand > span:last-child,
.admin-title > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #151b26;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #475467;
  font-size: 14px;
}

.nav a {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 6px;
}

.nav a.active {
  background: #e8f6f7;
  color: var(--teal-dark);
  font-weight: 850;
}

.nav-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.topbar .nav-actions {
  grid-column: 3;
}

.topbar-spacer {
  min-width: 1px;
}

.top-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 6px;
  color: #475467;
  font-size: 14px;
  font-weight: 800;
}

.top-link.active {
  background: #e8f6f7;
  color: var(--teal-dark);
}

.brand-logo-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(300px, 24vw);
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.brand-logo-center img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 46px;
  object-fit: contain;
}

.system-chip,
.panel-note,
.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.system-chip {
  border: 1px solid #d7e6ef;
  background: #f7fbfd;
  color: #526779;
}

.eyebrow,
.panel-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn,
.admin-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 850;
}

.primary-btn {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.secondary-btn {
  border-color: #cbd9f5;
  background: #f1f5ff;
  color: var(--blue);
}

.ghost-btn {
  border-color: var(--line);
  background: #fff;
  color: #344054;
}

.danger-btn {
  border-color: #efc6c2;
  background: #fff4f3;
  color: var(--red);
}

.admin-action {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid #cbd9f5;
  border-radius: 6px;
  border-color: #cbd9f5;
  background: #f1f5ff;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

/* Home */
.page-home {
  background: #eef2f6;
}

.search-layout {
  width: calc(100vw - 56px);
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 44px;
}

.search-console {
  margin-bottom: 18px;
}

.console-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.console-head h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.catalog-summary {
  width: 164px;
  min-height: 84px;
  display: grid;
  align-content: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.catalog-summary span,
.catalog-summary small {
  color: var(--muted);
  font-size: 12px;
}

.catalog-summary strong {
  margin: 2px 0;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.search-card,
.results-panel,
.admin-card,
.task-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.search-card {
  padding: 16px 20px;
}

.search-card-inner {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(460px, 980px) minmax(150px, 190px);
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.console-title {
  min-width: 0;
}

.console-title h1 {
  margin: 0;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.12;
}

.search-tools {
  min-width: 0;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(360px, 980px) 46px;
  justify-content: center;
  gap: 10px;
}

.search-card .search-row {
  grid-template-columns: minmax(0, 1fr) 46px;
  justify-content: stretch;
}

.search-card .filter-line {
  max-width: none;
  margin: 0;
  justify-content: flex-start;
}

.search-card .catalog-summary {
  justify-self: end;
  width: 164px;
}

.search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: stretch;
}

.search-input,
.settings-row input,
.settings-row select,
#adminToken {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
}

.search-field .search-input {
  border-radius: 8px 0 0 8px;
  border-right: 0;
}

.search-field .primary-btn {
  border-radius: 0 8px 8px 0;
}

.search-input::placeholder,
.settings-row input::placeholder {
  color: #9aa4b2;
}

.native-select-hidden {
  display: none !important;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-button {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 38px 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.custom-select-button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-62%) rotate(45deg);
  transition: transform .16s ease;
}

.custom-select.open .custom-select-button {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.custom-select.open .custom-select-button::after {
  transform: translateY(-35%) rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(560px, 82vw);
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #d8e2ec;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.custom-select-option {
  width: 100%;
  min-height: 36px;
  display: block;
  border: 0;
  border-radius: 7px;
  padding: 8px 34px 8px 10px;
  background: transparent;
  color: #253247;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-option:hover:not(:disabled),
.custom-select-option:focus-visible {
  background: #edf8f6;
  color: #0f766e;
  outline: none;
}

.custom-select-option.selected {
  position: relative;
  background: #e7f8f6;
  color: #0f766e;
}

.custom-select-option.selected::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 12px;
  border-right: 2px solid #0f766e;
  border-bottom: 2px solid #0f766e;
  transform: translateY(-62%) rotate(45deg);
}

.custom-select-option:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.icon-btn {
  width: 46px;
  min-height: 42px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 850;
}

.filter-line {
  max-width: 1036px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 auto;
  padding-top: 14px;
}

.filter-title {
  margin-right: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.pill {
  min-height: 30px;
  padding: 0 11px;
  border-color: #dfe7ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
}

.pill:hover:not(:disabled),
.pill.active {
  border-color: #b9dfe4;
  background: #ecfafa;
  color: var(--teal-dark);
  font-weight: 850;
}

.results-panel {
  padding: 18px;
  min-height: calc(100vh - 320px);
}

.results-head,
.task-head,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.results-head {
  margin-bottom: 14px;
}

.results-head h2,
.admin-card h2,
.task-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

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

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.asset-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.asset-card:hover {
  border-color: #b9c7d7;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  aspect-ratio: 2 / 1.1;
  background: var(--line);
}

.preview {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  min-width: 0;
  background: #f3f6f9;
  cursor: zoom-in;
  font: inherit;
  overflow: hidden;
}

.preview:focus-visible {
  outline: 3px solid rgba(31, 154, 168, .35);
  outline-offset: -3px;
}

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

.badge,
.line-label {
  position: absolute;
  z-index: 1;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  background: rgba(16, 24, 40, .78);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  padding: 3px 6px;
}

.line-label {
  top: 8px;
  right: 8px;
}

.line-label.left {
  left: 8px;
  right: auto;
}

.badge {
  left: 8px;
  bottom: 8px;
}

.asset-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.asset-title {
  min-height: 40px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.42;
  font-weight: 850;
}

.asset-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 25px;
}

.tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  background: #edf7f8;
  color: var(--teal-dark);
  padding: 3px 7px;
  font-size: 12px;
}

.asset-meta {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.asset-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 2px;
}

.asset-actions button,
.asset-actions a {
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.asset-actions button {
  border-color: #bfe0e5;
  background: #edf9fa;
  color: var(--teal-dark);
  font-weight: 850;
}

.asset-actions button:first-child {
  border-color: #d3dce7;
  background: #fff;
  color: #344054;
}

.empty-state,
.empty-cell {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fbfdff;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 20px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.page-btn {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 850;
}

.page-btn.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.page-ellipsis,
.page-info,
.page-jump {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.page-jump {
  gap: 6px;
}

.page-jump input {
  width: 64px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
}

.gallery-layout {
  width: min(1760px, calc(100vw - 56px));
  padding-top: 34px;
}

.gallery-hero {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, auto);
  gap: 18px;
  align-items: end;
  margin-bottom: 30px;
}

.hero-copy h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.06;
}

.gallery-search {
  grid-column: 1 / -1;
  padding: 12px;
  border-color: #dce4ee;
  box-shadow: 0 14px 34px rgba(23, 32, 51, .08);
}

.gallery-search .search-row {
  grid-template-columns: minmax(220px, 1fr) 104px 48px;
}

.gallery-search .search-input {
  height: 52px;
  border-color: transparent;
  background: #f7f9fb;
  font-size: 15px;
}

.gallery-search .primary-btn,
.gallery-search .icon-btn {
  min-height: 52px;
}

.gallery-hero .filter-line {
  grid-column: 1 / -1;
  padding: 0;
}

.gallery-hero .pill {
  min-height: 34px;
  padding: 0 13px;
  border-color: #dce5ef;
  background: rgba(255, 255, 255, .76);
}

.gallery-hero .pill:hover:not(:disabled),
.gallery-hero .pill.active {
  background: #102033;
  border-color: #102033;
  color: #fff;
}

.gallery-hero .catalog-summary {
  justify-self: end;
  width: 180px;
  min-height: 90px;
  border-color: #dce4ee;
  box-shadow: 0 12px 26px rgba(23, 32, 51, .08);
}

.gallery-results {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gallery-results .results-head {
  margin-bottom: 18px;
}

.gallery-results .results-head h2 {
  font-size: 20px;
}

.gallery-results .asset-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.gallery-card {
  border: 0;
  background: transparent;
  overflow: visible;
}

.gallery-card:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.asset-photo {
  position: relative;
  display: block;
  aspect-ratio: var(--ratio, 4 / 5);
  overflow: hidden;
  border-radius: 8px;
  background: #e8edf3;
  box-shadow: 0 16px 34px rgba(23, 32, 51, .11);
}

.asset-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .22s ease, filter .22s ease;
}

.gallery-card:hover .asset-photo img {
  transform: scale(1.025);
  filter: saturate(1.04);
}

.asset-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(to top, rgba(16, 24, 40, .42), rgba(16, 24, 40, 0));
  opacity: .78;
  pointer-events: none;
}

.image-kind {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  color: #172033;
  font-size: 12px;
  font-weight: 850;
}

.gallery-card .badge {
  left: 12px;
  bottom: 12px;
  z-index: 1;
  background: rgba(16, 24, 40, .72);
}

.missing-label {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #667085;
  font-size: 13px;
  font-weight: 850;
}

.image-missing .missing-label {
  display: grid;
}

.gallery-card .asset-body {
  gap: 10px;
  padding: 14px 2px 0;
}

.asset-headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 12px;
  align-items: start;
}

.gallery-card .asset-title {
  min-height: 0;
  font-size: 15px;
  line-height: 1.4;
}

.gallery-card .asset-filename {
  margin-top: 5px;
  color: #7a8698;
}

.lineart-mini {
  position: relative;
  width: 62px;
  height: 76px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.lineart-mini span {
  position: absolute;
  left: 5px;
  bottom: 5px;
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(16, 24, 40, .78);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.lineart-mini.image-missing::before {
  content: "线稿";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.gallery-card .tags {
  min-height: 0;
  gap: 6px;
}

.gallery-card .tag {
  background: #ffffff;
  border: 1px solid #dce7ef;
  color: #3b5268;
}

.gallery-card .asset-meta {
  grid-template-columns: 1fr auto;
}

.gallery-card .asset-actions {
  grid-template-columns: 1fr 1fr;
  padding-top: 2px;
}

.gallery-card .asset-actions button,
.gallery-card .asset-actions a {
  background: #fff;
}

.gallery-card .asset-actions button {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.gallery-card .asset-actions button:first-child {
  border-color: #dce7ef;
  background: #fff;
  color: #3b5268;
}

/* Visual image-search homepage */
.page-home {
  background: #f3f7f5;
}

.page-home .topbar {
  height: 66px;
  border-bottom: 0;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 0 rgba(16, 24, 40, .08);
}

.page-home .nav a.active {
  background: #111827;
  color: #fff;
}

.page-home .system-chip {
  background: #fff;
  color: #344054;
}

.visual-search {
  min-height: calc(100vh - 66px);
}

.visual-hero {
  width: 100%;
  background: #111111;
  color: #fff;
}

.visual-hero-inner {
  width: min(1760px, calc(100vw - 56px));
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(360px, .92fr) minmax(420px, .78fr);
  gap: 54px;
  align-items: center;
  margin: 0 auto;
  padding: 54px 0 56px;
}

.visual-hero .eyebrow {
  color: #81d8cf;
}

.visual-hero h1 {
  max-width: 680px;
  margin: 0 0 26px;
  color: #fff;
  font-size: 58px;
  line-height: 1.08;
}

.hero-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 108px 52px;
  gap: 10px;
  max-width: 840px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
}

.hero-search .search-input {
  height: 54px;
  border-color: transparent;
  background: #fff;
  color: #111827;
  font-size: 15px;
}

.hero-search .primary-btn,
.hero-search .icon-btn {
  min-height: 54px;
}

.hero-search .primary-btn {
  border-color: #81d8cf;
  background: #81d8cf;
  color: #101010;
}

.hero-search .primary-btn:hover:not(:disabled) {
  border-color: #b7f0e9;
  background: #b7f0e9;
}

.visual-hero .filter-line {
  max-width: 860px;
  padding-top: 16px;
}

.visual-hero .pill {
  min-height: 34px;
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: #e9eef5;
}

.visual-hero .pill:hover:not(:disabled),
.visual-hero .pill.active {
  border-color: #fff;
  background: #fff;
  color: #111827;
}

.hero-showcase {
  height: 360px;
  display: grid;
  grid-template-columns: 1.05fr .78fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}

.hero-showcase[hidden] {
  display: none;
}

.showcase-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #2a2a2a;
}

.showcase-tile:first-child {
  grid-row: span 2;
}

.hero-showcase.count-1,
.hero-showcase.count-2 {
  grid-template-rows: 1fr;
}

.hero-showcase.count-1 {
  grid-template-columns: 1fr;
}

.hero-showcase.count-2 {
  grid-template-columns: 1fr 1fr;
}

.hero-showcase.count-1 .showcase-tile:first-child,
.hero-showcase.count-2 .showcase-tile:first-child {
  grid-row: auto;
}

.showcase-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: .9;
}

.showcase-tile span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .55);
}

.visual-results {
  width: min(1760px, calc(100vw - 56px));
  margin: 34px auto 56px;
}

.visual-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.visual-results-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.visual-grid.few-results {
  grid-template-columns: repeat(auto-fit, minmax(380px, 460px));
  justify-content: center;
  gap: 34px;
}

.visual-card {
  min-width: 0;
}

.visual-frame {
  position: relative;
  aspect-ratio: var(--ratio, 3 / 4);
  overflow: hidden;
  border-radius: 8px;
  background: #dfe7ed;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.visual-photo {
  display: block;
  width: 100%;
  height: 100%;
}

.visual-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .22s ease, filter .22s ease;
}

.visual-card:hover .visual-photo img {
  transform: scale(1.025);
  filter: saturate(1.04);
}

.visual-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
}

.visual-card:hover .visual-actions,
.visual-card:focus-within .visual-actions {
  opacity: 1;
  transform: translateY(0);
}

.visual-actions button,
.visual-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  background: rgba(17, 24, 39, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.lineart-preview {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  width: 104px;
  height: 132px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .28);
}

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

.lineart-preview span {
  position: absolute;
  left: 7px;
  bottom: 7px;
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border-radius: 5px;
  background: rgba(17, 24, 39, .8);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.lineart-preview.image-missing::before {
  content: "线稿";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #667085;
  font-size: 13px;
  font-weight: 850;
}

.visual-info {
  padding: 14px 2px 0;
}

.visual-info .asset-title {
  min-height: 0;
  font-size: 16px;
  line-height: 1.35;
}

.visual-info .asset-filename {
  margin-top: 6px;
  color: #6f7b8d;
}

.visual-info .tags {
  min-height: 0;
  margin-top: 11px;
  gap: 7px;
}

.visual-info .tag {
  border: 1px solid #d8e6df;
  background: #fff;
  color: #3d574c;
}

.visual-info .asset-meta {
  grid-template-columns: 1fr auto;
  margin-top: 10px;
}

.visual-grid .empty-state {
  background: #fff;
  box-shadow: var(--shadow-sm);
}

/* Liblib-style asset plaza */
.page-home {
  background: #0f1117;
  color: #eef2f8;
}

.page-home .shell {
  background: #0f1117;
}

.page-home .topbar.libi-topbar {
  height: 64px;
  grid-template-columns: minmax(230px, 1fr) auto minmax(160px, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(15, 17, 23, .92);
  box-shadow: none;
}

.page-home .brand {
  color: #fff;
}

.page-home .logo {
  background: #f6f8fb;
  color: #0f1117;
}

.page-home .nav a {
  color: #aab3c2;
}

.page-home .nav a.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.page-home .system-chip {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .08);
  color: #d8deea;
}

.libi-page {
  width: min(1760px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.libi-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 28px;
}

.libi-hero-main,
.libi-status {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: #171a22;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
}

.libi-hero-main {
  padding: 24px;
}

.libi-kicker {
  display: inline-flex;
  margin-bottom: 9px;
  color: #78d5cf;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.libi-hero h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: 34px;
  line-height: 1.16;
}

.libi-searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 104px 48px;
  gap: 10px;
  max-width: 920px;
}

.libi-searchbar .search-input {
  height: 48px;
  border-color: rgba(255, 255, 255, .1);
  background: #0f1117;
  color: #fff;
}

.libi-searchbar .search-input::placeholder {
  color: #7f8999;
}

.libi-searchbar .primary-btn {
  min-height: 48px;
  border-color: #f2f3f5;
  background: #f2f3f5;
  color: #10131a;
}

.libi-searchbar .primary-btn:hover:not(:disabled) {
  border-color: #78d5cf;
  background: #78d5cf;
}

.libi-searchbar .icon-btn {
  min-height: 48px;
  border-color: rgba(255, 255, 255, .12);
  background: #232733;
  color: #fff;
}

.libi-channel {
  gap: 10px;
  padding-top: 16px;
}

.libi-channel .pill {
  min-height: 34px;
  padding: 0 14px;
  border-color: rgba(255, 255, 255, .1);
  background: #212531;
  color: #c3cad6;
}

.libi-channel .pill:hover:not(:disabled),
.libi-channel .pill.active {
  border-color: #78d5cf;
  background: rgba(120, 213, 207, .14);
  color: #8de8df;
}

.libi-status {
  display: grid;
  align-content: center;
  padding: 20px;
}

.libi-status span,
.libi-status small {
  color: #9aa4b5;
  font-size: 12px;
}

.libi-status strong {
  margin: 4px 0;
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.libi-results {
  min-width: 0;
}

.libi-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.libi-results-head .panel-kicker {
  color: #78d5cf;
}

.libi-results-head h2 {
  margin: 0;
  color: #fff;
  font-size: 24px;
  line-height: 1.18;
}

.libi-results .result-count,
.libi-results .pagination {
  color: #9aa4b5;
}

.libi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 20px;
}

.libi-grid.few-results {
  grid-template-columns: repeat(auto-fit, minmax(340px, 430px));
  justify-content: center;
}

.libi-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  background: #171a22;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .2);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.libi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 213, 207, .45);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
}

.libi-cover {
  position: relative;
  display: block;
  aspect-ratio: var(--ratio, 3 / 4);
  overflow: hidden;
  background: #242936;
}

.libi-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .2s ease, filter .2s ease;
}

.libi-card:hover .libi-cover img {
  transform: scale(1.03);
  filter: saturate(1.05);
}

.libi-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(15, 17, 23, .74);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.libi-cover-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}

.libi-card:hover .libi-cover-actions,
.libi-card:focus-within .libi-cover-actions {
  opacity: 1;
  transform: translateY(0);
}

.libi-cover-actions button,
.libi-cover-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  color: #10131a;
  font-size: 12px;
  font-weight: 900;
}

.libi-card-body {
  padding: 14px;
}

.libi-card .asset-title {
  min-height: 0;
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
}

.libi-card .asset-filename {
  margin-top: 5px;
  color: #7f8999;
}

.libi-card .tags {
  min-height: 0;
  gap: 6px;
  margin-top: 11px;
}

.libi-card .tag {
  border: 1px solid rgba(255, 255, 255, .08);
  background: #222734;
  color: #c5ceda;
}

.libi-lineart {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: #10131a;
}

.lineart-thumb {
  position: relative;
  width: 48px;
  height: 58px;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
}

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

.lineart-thumb.image-missing::before {
  content: "线稿";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.libi-lineart b,
.libi-lineart small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.libi-lineart b {
  color: #fff;
  font-size: 13px;
}

.libi-lineart small {
  margin-top: 4px;
  color: #858f9f;
  font-size: 12px;
}

.libi-card .asset-meta {
  grid-template-columns: 1fr auto;
  margin-top: 11px;
  color: #858f9f;
}

.libi-grid .empty-state {
  border-color: rgba(255, 255, 255, .12);
  background: #171a22;
  color: #9aa4b5;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, .42);
}

.auth-modal[hidden] {
  display: none;
}

.auth-panel {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 22px 48px rgba(23, 32, 51, .22);
}

.auth-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.auth-msg {
  min-height: 20px;
  margin: 8px 0 14px;
  color: var(--red);
  font-size: 13px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-open {
  overflow: hidden;
}

.admin-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, .46);
  backdrop-filter: blur(4px);
}

.admin-dialog[hidden] {
  display: none;
}

.admin-dialog-panel {
  width: min(560px, 100%);
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 26px 60px rgba(23, 32, 51, .26);
}

.admin-dialog-head {
  margin-bottom: 12px;
}

.admin-dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.admin-dialog-message {
  min-height: 20px;
  margin: 0 0 18px;
  color: #344054;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.admin-dialog-body {
  margin: 0 0 18px;
}

.admin-dialog-body[hidden] {
  display: none;
}

.dialog-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
}

.dialog-choice-grid button {
  min-height: 46px;
}

.batch-settings-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
}

.dialog-setting-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.dialog-setting-row[hidden] {
  display: none;
}

.dialog-setting-row input,
.dialog-setting-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
}

.dialog-mode-segment {
  min-height: 42px;
}

.dialog-form-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.admin-dialog-field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.admin-dialog-field[hidden] {
  display: none;
}

.admin-dialog-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdff;
  font-weight: 500;
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-dialog-actions button {
  min-width: 92px;
}

@media (min-width: 1920px) {
  .search-layout {
    width: calc(100vw - 80px);
    padding-top: 34px;
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 18px;
  }

  .search-card,
  .results-panel {
    padding: 20px;
  }

  .preview-pair {
    aspect-ratio: 2 / 1.18;
  }
}

@media (min-width: 2560px) {
  .search-layout {
    width: calc(100vw - 112px);
    padding-top: 38px;
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
  }

  .search-card,
  .results-panel {
    padding: 24px;
  }
}

@media (min-width: 3600px) {
  .search-layout {
    width: calc(100vw - 144px);
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 26px;
  }
}

/* Admin */
.page-admin {
  background: #eef2f6;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  background: #eef2f6;
}

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #151b26;
  color: #d6deea;
  border-right: 1px solid rgba(255, 255, 255, .08);
}

.admin-brand {
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: #fff;
}

.admin-brand .logo {
  background: #f8fafc;
  color: #151b26;
}

.admin-brand strong,
.admin-brand small {
  display: block;
  line-height: 1.15;
}

.admin-brand strong {
  font-size: 15px;
}

.admin-brand small {
  margin-top: 3px;
  color: #9da8ba;
  font-size: 11px;
}

.admin-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 10px;
}

.admin-menu a {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  color: #cad3e0;
  font-size: 14px;
}

.admin-menu a:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.admin-menu a.active {
  background: #0f766e;
  color: #fff;
  font-weight: 850;
}

.admin-main {
  min-width: 0;
}

.admin-top {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-logo-center {
  width: min(320px, 28vw);
  height: 48px;
}

.admin-title {
  font-size: 18px;
  font-weight: 850;
}

.admin-badge {
  background: #fff7ed;
  color: #9a4b12;
}

.admin-user {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.admin-content {
  padding: 18px 20px 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.admin-card,
.task-panel {
  padding: 18px;
}

.panel-title {
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-note {
  border: 1px solid #d7e5ef;
  background: #f8fbfd;
  color: #526779;
}

.intake-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.intake-field input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.intake-field input::placeholder {
  color: #94a3b8;
  font-weight: 600;
}

.drop-large {
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed #a8b8c9;
  border-radius: 8px;
  background: #f8fafc;
  color: #253247;
  text-align: center;
}

.drop-large:hover:not(:disabled) {
  border-color: var(--teal);
  background: #effafa;
}

.drop-large.drag-over {
  border-color: var(--teal);
  background: #e7f8f6;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.28);
}

.drop-large strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.upload-mark {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border: 1px solid #cad8e6;
  border-radius: 8px;
  background: #fff;
}

.upload-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 15px;
  width: 13px;
  height: 13px;
  border-left: 3px solid var(--teal);
  border-top: 3px solid var(--teal);
  transform: translateX(-50%) rotate(45deg);
}

.upload-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 3px;
  height: 21px;
  border-radius: 3px;
  background: var(--teal);
  transform: translateX(-50%);
}

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

.chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  color: #475467;
  font-size: 13px;
}

.chosen span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #d7e5ef;
  border-radius: 8px;
  background: #fbfdff;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #253247;
  font-size: 13px;
  font-weight: 900;
}

.upload-progress-head b {
  color: var(--teal-dark);
  font-variant-numeric: tabular-nums;
}

.upload-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.upload-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #31b7c4);
  transition: width .22s ease;
}

.upload-progress-meta {
  margin-top: 9px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.upload-progress.failed {
  border-color: #f4c7c3;
  background: #fff8f7;
}

.upload-progress.failed .upload-progress-head b,
.upload-progress.failed .upload-progress-meta {
  color: var(--red);
}

.upload-progress.failed .upload-progress-track span {
  background: #d92d20;
}

.settings-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.settings-row label {
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.settings-row-stack {
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}

.mode-segment {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #d6e1ec;
  border-radius: 8px;
  background: #f3f7fb;
}

.mode-segment button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526173;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.mode-segment button:hover:not(:disabled) {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.mode-segment button.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 16px rgba(8, 127, 140, .18);
}

.mode-segment-stack {
  grid-template-columns: 1fr;
}

.mode-segment-stack button {
  white-space: normal;
  text-align: center;
}

.pipeline-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pipeline-readout span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe7f2;
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line-soft);
}

.action-row,
.task-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.task-actions {
  justify-content: flex-end;
}

.task-panel {
  margin-top: 16px;
}

.process-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.process-settings {
  min-width: 0;
}

.pipeline-composer {
  grid-template-columns: minmax(260px, .82fr) minmax(280px, .9fr) minmax(420px, 1.28fr);
  align-items: stretch;
}

.pipeline-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
}

.pipeline-block-wide {
  gap: 14px;
}

.pipeline-block .reverse-prompt-box {
  padding: 0;
  border: 0;
  background: transparent;
}

.pipeline-block #reversePromptSystem {
  min-height: 220px;
}

.reverse-prompt-box {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
}

#reversePromptSystem {
  width: 100%;
  min-height: 350px;
  flex: 1 1 auto;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  font-size: 13px;
  line-height: 1.65;
}

.workflow-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.workflow-editor {
  padding-right: 18px;
  border-right: 1px solid var(--line-soft);
}

.workflow-list {
  min-width: 0;
}

.workflow-list-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
  gap: 18px;
  align-items: start;
}

.gpt-config-box {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfdff;
}

.ai-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-config-panel {
  min-width: 0;
}

.ai-config-actions {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.gpt-config-box .settings-row {
  grid-template-columns: 86px minmax(0, 1fr);
}

.gpt-route-list {
  display: grid;
  gap: 8px;
  margin: 6px 0 14px;
}

.gpt-route-list span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #dbe7f2;
  border-radius: 6px;
  background: #fff;
  color: #475467;
  font-size: 12px;
}

.gpt-route-list b {
  color: #253247;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.subpanel-title {
  margin: 0 0 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.detail-title {
  margin-top: 18px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.metric small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric b {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.metric.active {
  border-color: #b9dfe4;
  background: #f2fbfc;
}

.metric .status {
  width: fit-content;
  margin-top: 2px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 6px;
  background: #e8f1ff;
  color: #1d4ed8;
  font-size: 12px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.jobs {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  font-size: 13px;
}

.jobs th,
.jobs td {
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

.jobs th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.jobs td {
  color: #263244;
  transition: background-color 120ms ease;
}

.batch-jobs {
  min-width: 1580px;
  table-layout: fixed;
}

.batch-jobs th:nth-child(1),
.batch-jobs td:nth-child(1) { width: 240px; }
.batch-jobs th:nth-child(2),
.batch-jobs td:nth-child(2) { width: 210px; }
.batch-jobs th:nth-child(3),
.batch-jobs td:nth-child(3),
.batch-jobs th:nth-child(4),
.batch-jobs td:nth-child(4),
.batch-jobs th:nth-child(5),
.batch-jobs td:nth-child(5),
.batch-jobs th:nth-child(6),
.batch-jobs td:nth-child(6) { width: 72px; }
.batch-jobs th:nth-child(7),
.batch-jobs td:nth-child(7) { width: 230px; }
.batch-jobs th:nth-child(8),
.batch-jobs td:nth-child(8),
.batch-jobs th:nth-child(9),
.batch-jobs td:nth-child(9) { width: 150px; }
.batch-jobs th:nth-child(10),
.batch-jobs td:nth-child(10) { width: 130px; }
.batch-jobs th:nth-child(11),
.batch-jobs td:nth-child(11) { width: 190px; }

.jobs tr:last-child td {
  border-bottom: 0;
}

.jobs tbody tr:hover td {
  background: #fbfdff;
}

.jobs tr.selected-row td {
  background: #e8fbff;
}

.jobs tbody tr[data-batch-id] {
  cursor: pointer;
}

.jobs a {
  color: var(--blue);
  font-weight: 850;
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) repeat(3, minmax(150px, 1fr)) minmax(230px, 1.25fr) minmax(168px, auto);
  align-items: start;
  gap: 10px;
  margin-bottom: 12px;
}

.library-tools input,
.library-tools select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.library-tools .custom-select-button {
  min-height: 40px;
}

.library-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  gap: 8px;
}

.library-actions button {
  min-height: 40px;
  padding: 0 14px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.library-thumb {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6f9;
}

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

.usage-main {
  color: #101828;
  font-weight: 900;
  white-space: nowrap;
}

.action-stack {
  min-width: 172px;
}

.action-stack-inline {
  min-height: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.action-stack .admin-action {
  margin: 0;
}

.danger-text {
  color: var(--red);
  border-color: #ffd2d2;
  background: #fff7f7;
}

.library-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.status.done {
  background: #eaf8ef;
  color: var(--green);
}

.status.failed {
  background: #fff1f1;
  color: var(--red);
}

.status.running {
  background: #edf7ff;
  color: var(--blue);
}

.status.queued {
  background: #fff7e6;
  color: var(--orange);
}

.batch-status-cell {
  display: grid;
  gap: 8px;
  min-width: 168px;
}

.batch-upload-progress {
  display: grid;
  gap: 6px;
  max-width: 230px;
}

.batch-upload-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.batch-upload-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #31b7c4);
}

.batch-upload-meta {
  display: grid;
  gap: 2px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.batch-upload-meta strong {
  color: #253247;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.batch-upload-progress.stale .batch-upload-track span {
  background: #d92d20;
}

.batch-upload-progress.stale .batch-upload-meta strong {
  color: var(--red);
}

@media (max-width: 1460px) {
  .library-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .process-layout {
    grid-template-columns: 1fr;
  }

  #reversePromptSystem {
    min-height: 280px;
  }
}

@media (max-width: 1180px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .process-layout {
    grid-template-columns: 1fr;
  }

  #reversePromptSystem {
    min-height: 260px;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }

	  .workflow-list-grid {
	    grid-template-columns: 1fr;
	  }

	  .ai-config-grid {
	    grid-template-columns: 1fr;
	  }

	  .workflow-editor {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding-right: 0;
    padding-bottom: 16px;
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
    align-items: stretch;
    padding: 14px 16px;
  }

  .brand-logo-center {
    position: static;
    width: min(220px, 70vw);
    height: 40px;
    justify-self: center;
    transform: none;
    order: 1;
  }

  .brand {
    order: 0;
  }

  .nav {
    justify-content: flex-start;
  }

  .nav-actions {
    grid-column: auto;
    justify-content: flex-start;
    order: 2;
  }

  .search-layout {
    width: calc(100vw - 24px);
    padding: 18px 0 30px;
  }

  .gallery-layout {
    width: calc(100vw - 24px);
  }

  .gallery-hero {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 22px;
  }

  .gallery-hero .catalog-summary {
    justify-self: stretch;
    width: 100%;
  }

  .console-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-card-inner {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .search-card .catalog-summary {
    justify-self: stretch;
    width: 100%;
  }

  .catalog-summary {
    width: 100%;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .search-card .search-row {
    grid-template-columns: 1fr;
  }

  .gallery-search .search-row {
    grid-template-columns: 1fr;
  }

  .visual-hero-inner {
    width: calc(100vw - 28px);
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 36px 0 38px;
  }

  .visual-hero h1 {
    max-width: 100%;
    font-size: 46px;
  }

  .hero-search {
    grid-template-columns: 1fr;
  }

  .hero-search .icon-btn {
    width: 100%;
  }

  .hero-showcase {
    height: 300px;
  }

  .visual-results {
    width: calc(100vw - 28px);
    margin-top: 26px;
  }

  .visual-grid,
  .visual-grid.few-results {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
  }

  .icon-btn {
    width: 100%;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-side {
    position: static;
    height: auto;
  }

  .admin-brand {
    height: 58px;
  }

  .admin-top {
    align-items: flex-start;
  }

  .admin-logo-center {
    align-self: center;
  }

  .admin-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .admin-menu a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .admin-top {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .admin-user {
    text-align: left;
  }

  .admin-content {
    padding: 14px;
  }

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

  .settings-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .task-head,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .console-head h1 {
    font-size: 28px;
  }

  .hero-copy h1 {
    font-size: 32px;
  }

  .visual-hero h1 {
    font-size: 38px;
  }

  .visual-hero-inner {
    width: calc(100vw - 20px);
    padding: 28px 0 32px;
  }

  .hero-showcase {
    height: 250px;
    gap: 10px;
  }

  .visual-results {
    width: calc(100vw - 20px);
  }

  .asset-grid {
    grid-template-columns: 1fr;
  }

  .asset-actions {
    grid-template-columns: 1fr;
  }

  .gallery-results .asset-grid {
    grid-template-columns: 1fr;
  }

  .visual-grid,
  .visual-grid.few-results {
    grid-template-columns: 1fr;
  }

  .asset-headline {
    grid-template-columns: minmax(0, 1fr) 58px;
  }

  .lineart-mini {
    width: 58px;
    height: 70px;
  }

  .lineart-preview {
    width: 82px;
    height: 104px;
    right: 10px;
    bottom: 10px;
  }

  .visual-actions {
    opacity: 1;
    transform: none;
  }

  .visual-info .asset-title {
    font-size: 15px;
  }

  .preview-pair {
    aspect-ratio: 2 / 1.05;
  }

  .pipeline-readout {
    grid-template-columns: 1fr;
  }

  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .action-row,
  .task-actions,
  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row button,
  .task-actions button,
  .auth-actions button {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .page-home .topbar.libi-topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px 16px;
  }

  .libi-page {
    width: calc(100vw - 24px);
    padding-top: 18px;
  }

  .libi-hero {
    grid-template-columns: 1fr;
  }

  .libi-hero-main {
    padding: 18px;
  }

  .libi-searchbar {
    grid-template-columns: 1fr;
  }

  .libi-searchbar .icon-btn {
    width: 100%;
  }

  .libi-status {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .libi-status strong {
    margin: 0;
    font-size: 28px;
  }

  .libi-grid,
  .libi-grid.few-results {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 560px) {
  .libi-page {
    width: calc(100vw - 18px);
  }

  .libi-hero h1 {
    font-size: 30px;
  }

  .libi-channel {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .libi-channel .pill {
    flex: 0 0 auto;
  }

  .libi-status {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .libi-grid,
  .libi-grid.few-results {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .libi-cover-actions {
    opacity: 1;
    transform: none;
  }
}

/* Final frontend overrides */
.asset-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.prompt-panel {
  width: min(720px, 100%);
}

.prompt-panel textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: #fbfdff;
  font-size: 14px;
  line-height: 1.65;
}

.image-preview-panel {
  width: min(960px, calc(100vw - 32px));
  padding: 18px;
}

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

.image-preview-head h2 {
  margin: 0;
}

.image-preview-stage {
  display: grid;
  place-items: center;
  min-height: 260px;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  overflow: hidden;
}

.image-preview-stage img {
  max-width: 100%;
  max-height: 72vh;
  display: block;
  object-fit: contain;
}

#openImagePreviewLink {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

@media (max-width: 1900px) {
  .asset-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1540px) {
  .asset-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .asset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .asset-grid {
    grid-template-columns: 1fr;
  }
}
