* {
  box-sizing: border-box;
}

body.admin-shell,
body.admin-login {
  margin: 0;
  min-height: 100vh;
  background: #f5f7f8;
  color: #1f2933;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
}

a {
  color: #136f63;
}

.admin-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2e7;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.admin-brand-mark {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #136f63;
  color: #ffffff;
}

.admin-account {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.admin-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #d9e2e7;
  color: #1f2933;
  background: #ffffff;
}

.admin-layout {
  display: flex;
  padding-top: 56px;
}

.admin-sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 176px;
  padding: 16px 10px;
  background: #ffffff;
  border-right: 1px solid #d9e2e7;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 6px;
  color: #394b59;
}

.admin-nav a:hover,
.admin-nav a.active {
  color: #0f5d54;
  background: #e8f3f0;
  text-decoration: none;
}

.admin-content {
  width: 100%;
  min-width: 0;
  margin-left: 176px;
  padding: 22px 24px 36px;
}

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

.admin-page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

.admin-page-head p {
  margin: 5px 0 0;
  color: #6b7c86;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 94px;
  padding: 14px;
  border: 1px solid #d9e2e7;
  border-radius: 8px;
  background: #ffffff;
}

.metric-label {
  color: #6b7c86;
  font-size: 12px;
}

.metric-value {
  margin-top: 12px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
  color: #1f2933;
  word-break: break-word;
}

.metric-card.accent-green {
  border-top: 3px solid #1f9d7a;
}

.metric-card.accent-blue {
  border-top: 3px solid #2f80ed;
}

.metric-card.accent-amber {
  border-top: 3px solid #d9822b;
}

.metric-card.accent-red {
  border-top: 3px solid #c23030;
}

.metric-card.accent-gray {
  border-top: 3px solid #6b7c86;
}

.admin-panel {
  border: 1px solid #d9e2e7;
  border-radius: 8px;
  background: #ffffff;
}

.admin-section-gap {
  margin-top: 16px;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e6edf0;
}

.admin-panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.admin-panel-body {
  padding: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.filter-grid label {
  display: block;
  margin-bottom: 4px;
  color: #6b7c86;
  font-size: 12px;
  font-weight: 500;
}

.form-control {
  border-radius: 6px;
  border-color: #cfd9df;
  box-shadow: none;
}

.form-control:focus {
  border-color: #136f63;
  box-shadow: 0 0 0 2px rgba(19, 111, 99, 0.12);
}

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

.admin-form-actions {
  margin-top: 14px;
}

.theme-form-grid,
.material-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.theme-field {
  margin-bottom: 16px;
}

.theme-field label,
.material-fields label {
  display: block;
  margin-bottom: 5px;
  color: #52616b;
  font-size: 13px;
  font-weight: 600;
}

.theme-field em,
.material-fields em,
.required-mark {
  color: #c23030;
  font-style: normal;
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: #7b8b94;
  font-size: 12px;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.tag-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #394b59;
  font-size: 13px;
  font-weight: 400;
}

.custom-tags {
  max-width: 520px;
  margin-top: 12px;
}

.material-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #e6edf0;
}

.material-row:first-child { padding-top: 0; }
.material-row:last-child { border-bottom: 0; padding-bottom: 0; }

.row-number {
  min-width: 32px;
  padding-bottom: 8px;
  color: #7b8b94;
  font-size: 12px;
}

.material-fields {
  flex: 1;
}

.widget-fields {
  grid-template-columns: minmax(150px, 1fr) minmax(120px, .7fr) minmax(180px, 1.2fr) minmax(170px, 1fr);
}

.admin-alert {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 13px;
}

.admin-alert.success { color: #166534; border-color: #9ad7ad; background: #f0fdf4; }
.admin-alert.error { color: #a01f1f; border-color: #efb6b6; background: #fff7f7; }

/* Theme publishing workspace */
.theme-content {
  padding: 30px 38px 48px;
}

.theme-workspace {
  max-width: 1180px;
  margin: 0 auto;
}

.theme-page-head {
  align-items: center;
  margin-bottom: 16px;
}

.page-kicker {
  display: block;
  margin-bottom: 8px;
  color: #167568;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
}

.theme-page-head h1 {
  font-size: 28px;
  letter-spacing: -.02em;
}

.page-legend,
.section-actions,
.theme-guide {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  color: #7b8b94;
  font-size: 12px;
}

.theme-guide {
  margin-bottom: 20px;
  padding: 11px 14px;
  border: 1px solid #d7e7e3;
  border-radius: 8px;
  background: #f4faf8;
  color: #52616b;
  font-size: 13px;
}

.theme-guide .fa { color: #8ab8ae; }

.guide-step,
.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #167568;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.guide-step { width: 20px; height: 20px; }

.requirement-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

.requirement-badge.required { color: #a01f1f; background: #fff0f0; }
.requirement-badge.optional { color: #52616b; background: #edf2f4; }

.theme-section-head {
  min-height: 76px;
  padding: 14px 18px;
}

.theme-section-head > div:first-child {
  display: grid;
  grid-template-columns: 30px auto;
  column-gap: 10px;
  align-items: center;
}

.theme-section-head h2 { grid-column: 2; }

.theme-section-head p {
  grid-column: 2;
  margin: 3px 0 0;
  color: #7b8b94;
  font-size: 12px;
}

.section-number {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  background: #e4f2ef;
  color: #11675c;
}

.theme-form-grid { gap: 18px; }

.theme-field label,
.material-fields label,
.sub-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

.tag-field {
  margin-top: 6px;
  margin-bottom: 0;
}

.tag-options { gap: 8px; }

.tag-options label {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d7e3e6;
  border-radius: 7px;
  background: #fff;
  transition: border-color .15s, background .15s;
}

.tag-options label:hover { border-color: #8ab8ae; background: #f4faf8; }
.tag-options input { accent-color: #167568; }

.custom-tags { max-width: none; margin-top: 14px; }

.material-row {
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

.row-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 48px;
  padding: 0;
  color: #5b7780;
  font-size: 11px;
  font-weight: 600;
}

.row-number i { color: #167568; font-size: 17px; }
.material-fields { gap: 16px; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #f0c1c1;
  border-radius: 7px;
  color: #b42318;
  background: #fffafa;
}

.icon-button:hover { background: #fff0f0; }
.admin-btn.compact { min-height: 34px; padding: 7px 10px; }

.publish-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 13px 16px;
  border: 1px solid #cfe0dc;
  border-radius: 9px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px rgba(34, 66, 76, .12);
}

.publish-bar strong { display: block; color: #243b45; font-size: 14px; }
.publish-bar span { display: block; margin-top: 3px; color: #6b7c86; font-size: 12px; }
.publish-button { min-width: 118px; min-height: 38px; }

.publish-actions,
.theme-tabs,
.theme-list-filter,
.theme-filter-actions,
.theme-card-title,
.theme-tag-list,
.theme-material-counts,
.theme-pagination {
  display: flex;
  align-items: center;
}

.publish-actions { gap: 8px; }

.theme-tabs {
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid #d9e2e7;
  border-radius: 10px;
  background: #fff;
}

.theme-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 7px;
  color: #52616b;
  font-size: 13px;
  font-weight: 600;
}

.theme-tabs a:hover,
.theme-tabs a.active {
  color: #0f5d54;
  background: #e8f3f0;
  text-decoration: none;
}

.theme-tabs a > span {
  min-width: 21px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #4f6d75;
  background: #dcebe8;
  font-size: 11px;
  text-align: center;
}

.theme-filter-panel { margin-bottom: 16px; }
.theme-list-filter { align-items: flex-end; gap: 12px; }
.theme-filter-field { flex: 1 1 280px; }
.theme-filter-field:nth-child(2) { flex: 0 1 220px; }
.theme-filter-field label {
  display: block;
  margin-bottom: 6px;
  color: #52616b;
  font-size: 12px;
  font-weight: 600;
}

.input-with-icon { position: relative; }
.input-with-icon > i {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 2;
  color: #91a0a8;
  transform: translateY(-50%);
}
.input-with-icon .form-control { padding-left: 34px; }
.theme-filter-actions { gap: 8px; }

.theme-list-head p {
  margin: 4px 0 0;
  color: #7b8b94;
  font-size: 12px;
}

.theme-list-body { padding: 0; }
.theme-card-list { display: grid; }
.theme-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 130px;
  padding: 16px;
  border-bottom: 1px solid #e6edf0;
  transition: background .18s ease;
}
.theme-list-card:last-child { border-bottom: 0; }
.theme-list-card:hover { background: #fbfdfd; }
.theme-card-detail-link {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.theme-card-detail-link:hover,
.theme-card-detail-link:focus { color: inherit; text-decoration: none; outline: 0; }
.theme-card-detail-link:focus-visible {
  border-radius: 9px;
  box-shadow: 0 0 0 3px rgba(22, 117, 104, .18);
}
.theme-cover {
  width: 104px;
  height: 96px;
  overflow: hidden;
  border: 1px solid #d9e2e7;
  border-radius: 9px;
  background: #eef3f5;
}
.theme-cover img { width: 100%; height: 100%; object-fit: cover; }
.theme-cover > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #9aabb3;
  font-size: 26px;
}
.theme-card-main { min-width: 0; }
.theme-card-title { gap: 9px; margin-bottom: 10px; }
.theme-card-title h3 {
  overflow: hidden;
  margin: 0;
  color: #243b45;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-id {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 5px;
  color: #167568;
  background: #e8f3f0;
  font-size: 11px;
  font-weight: 700;
}
.theme-tag-list { flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.theme-tag-list > span {
  padding: 3px 8px;
  border: 1px solid #dce6e9;
  border-radius: 999px;
  color: #52616b;
  background: #f8fafb;
  font-size: 11px;
}
.theme-tag-list > span.muted { color: #91a0a8; }
.theme-material-counts { flex-wrap: wrap; gap: 18px; color: #6b7c86; font-size: 12px; }
.theme-material-counts span { display: inline-flex; align-items: center; gap: 6px; }
.theme-material-counts i { color: #167568; }
.theme-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.theme-card-detail-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #167568;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity .18s ease, transform .18s ease;
}
.theme-list-card:hover .theme-card-detail-hint,
.theme-card-detail-link:focus .theme-card-detail-hint { opacity: 1; transform: translateX(0); }
.theme-card-action { align-self: center; }
.theme-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 56px 16px;
  color: #7b8b94;
  text-align: center;
}
.theme-empty > i { margin-bottom: 4px; color: #9fb1b8; font-size: 34px; }
.theme-empty strong { color: #394b59; font-size: 15px; }
.theme-pagination { justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.theme-pagination a {
  min-width: 34px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #d9e2e7;
  border-radius: 6px;
  color: #52616b;
  background: #fff;
  font-size: 12px;
  text-align: center;
}
.theme-pagination a:hover,
.theme-pagination a.active { color: #fff; border-color: #136f63; background: #136f63; text-decoration: none; }

.theme-basic-grid { grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); align-items: start; }
.upload-field { min-width: 0; }
.oss-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.upload-dropzone {
  display: grid;
  grid-template-columns: 76px minmax(160px, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 10px;
  border: 1px dashed #b8cbd0;
  border-radius: 9px;
  background: #f9fbfc;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.upload-dropzone:hover,
.upload-dropzone:focus,
.upload-dropzone.is-dragging {
  border-color: #167568;
  background: #f1f8f6;
  box-shadow: 0 0 0 3px rgba(22, 117, 104, .08);
}
.upload-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 72px;
  overflow: hidden;
  border-radius: 7px;
  color: #86a39d;
  background: #e8f3f0;
  font-size: 23px;
}
.upload-preview img { display: none; }
.upload-preview.has-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upload-preview.has-image > i {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 5px;
  border-radius: 50%;
  color: #fff;
  background: rgba(19, 111, 99, .88);
  font-size: 10px;
}
.upload-copy { min-width: 0; }
.upload-copy strong,
.upload-copy span { display: block; }
.upload-copy strong { overflow: hidden; color: #394b59; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.upload-copy span { margin-top: 5px; color: #7b8b94; font-size: 11px; }
.compact-zone { grid-template-columns: 62px minmax(150px, 1fr) auto; min-height: 82px; }
.compact-zone .upload-preview { width: 62px; height: 58px; }
.upload-progress {
  height: 4px;
  overflow: hidden;
  margin-top: 7px;
  border-radius: 999px;
  background: #e8eef0;
}
.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #167568;
  transition: width .15s;
}
.upload-status { min-height: 18px; padding-top: 4px; color: #6b7c86; font-size: 11px; }
.upload-field.is-success .upload-status { color: #16703b; }
.upload-field.is-error .upload-dropzone { border-color: #d96b6b; background: #fffafa; }
.upload-field.is-error .upload-status { color: #b42318; }
.upload-field.is-uploading .upload-dropzone { pointer-events: none; opacity: .82; }
.wallpaper-fields { grid-template-columns: minmax(420px, 1fr) minmax(150px, .28fr); align-items: start; }
.widget-fields { grid-template-columns: minmax(210px, .65fr) minmax(280px, 1fr); align-items: start; }
.widget-id-cell,
.widget-upload-cell { grid-column: 1 / -1; }
.widget-id-cell { position: relative; min-width: 0; }
.widget-id-value { display: none; }
.widget-picker-trigger {
  display: none;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 9px 12px;
  border: 1px solid #cfdde1;
  border-radius: 8px;
  color: #394b59;
  background: #fff;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.widget-picker-trigger:hover,
.widget-picker-trigger[aria-expanded="true"] {
  border-color: #6ba79d;
  background: #f8fcfb;
  box-shadow: 0 0 0 3px rgba(22, 117, 104, .08);
}
.widget-picker-trigger > .fa-angle-down {
  margin-left: auto;
  color: #7b8b94;
  font-size: 16px;
  transition: transform .15s;
}
.widget-picker-trigger[aria-expanded="true"] > .fa-angle-down { transform: rotate(180deg); }
.widget-picker-trigger-preview,
.widget-picker-option-preview {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 7px;
  color: #6f9891;
  background: #e8f3f0;
}
.widget-picker-trigger-preview { width: 54px; height: 48px; }
.widget-picker-trigger-preview img,
.widget-picker-option-preview img { width: 100%; height: 100%; object-fit: contain; background: #f3f7f7; }
.widget-picker-trigger-copy { min-width: 0; }
.widget-picker-trigger-copy strong,
.widget-picker-trigger-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-picker-trigger-copy strong { font-size: 13px; }
.widget-picker-trigger-copy small { margin-top: 4px; color: #7b8b94; font-size: 11px; }
.catalog-mode .widget-id-manual { display: none; }
.catalog-mode .widget-picker-trigger { display: flex; }
.catalog-mode .widget-upload-cell { display: none; }
.widget-picker {
  margin-top: 9px;
  padding: 12px;
  border: 1px solid #d5e3e5;
  border-radius: 9px;
  background: #f8fbfb;
  box-shadow: 0 12px 24px rgba(42, 72, 80, .09);
}
.widget-picker[hidden] { display: none; }
.widget-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.widget-picker-toolbar .input-with-icon { flex: 1; }
.widget-picker-count { flex: 0 0 auto; color: #6b7c86; font-size: 11px; }
.widget-picker-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding: 1px 3px 1px 1px;
}
.widget-picker-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 70px;
  padding: 8px 34px 8px 8px;
  border: 1px solid #d8e4e7;
  border-radius: 8px;
  color: #394b59;
  background: #fff;
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.widget-picker-option:hover { border-color: #82b2a9; background: #f1f8f6; transform: translateY(-1px); }
.widget-picker-option.is-selected { border-color: #167568; background: #eaf5f2; box-shadow: inset 0 0 0 1px #167568; }
.widget-picker-option-preview { width: 62px; height: 52px; font-size: 17px; }
.widget-picker-option-copy { min-width: 0; }
.widget-picker-option-copy strong,
.widget-picker-option-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-picker-option-copy strong { font-size: 12px; }
.widget-picker-option-copy small { margin-top: 5px; color: #768891; font-family: Menlo, Monaco, Consolas, monospace; font-size: 9px; }
.widget-picker-option > .fa-check-circle {
  position: absolute;
  top: 50%;
  right: 11px;
  color: #167568;
  opacity: 0;
  transform: translateY(-50%);
}
.widget-picker-option.is-selected > .fa-check-circle { opacity: 1; }
.widget-picker-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  color: #7b8b94;
  font-size: 12px;
}
.widget-picker-empty[hidden] { display: none; }
.widget-id-hint { display: block; margin-top: 6px; }

.widget-library-workspace { max-width: 1500px; }
.widget-library-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.widget-library-metrics > div {
  padding: 15px 17px;
  border: 1px solid #d8e3e6;
  border-radius: 10px;
  background: #fff;
}
.widget-library-metrics span,
.widget-library-metrics strong { display: block; }
.widget-library-metrics span { color: #73848e; font-size: 11px; font-weight: 600; }
.widget-library-metrics strong { margin-top: 5px; color: #183d43; font-size: 25px; }
.widget-library-filter-panel { margin-bottom: 16px; }
.widget-library-filter {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(190px, .34fr) minmax(180px, .3fr) auto;
  gap: 12px;
  align-items: end;
}
.widget-library-filter label {
  display: block;
  margin-bottom: 6px;
  color: #52616b;
  font-size: 12px;
  font-weight: 600;
}
.widget-library-list-head { align-items: center; }
.widget-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
}
.widget-library-grid[hidden],
.widget-library-empty[hidden] { display: none; }
.widget-library-card {
  overflow: hidden;
  border: 1px solid #d8e4e7;
  border-radius: 11px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.widget-library-card:hover {
  border-color: #91bdb5;
  box-shadow: 0 8px 20px rgba(44, 77, 84, .09);
  transform: translateY(-1px);
}
.widget-library-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  overflow: hidden;
  background: #f0f6f5;
}
.widget-library-preview > img { width: 100%; height: 100%; object-fit: contain; }
.widget-library-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #86a49f;
}
.widget-library-placeholder i { font-size: 28px; }
.widget-library-placeholder small { font-size: 11px; }
.widget-thumbnail-status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.widget-thumbnail-status.custom { color: #0f6658; background: #daf0ea; }
.widget-thumbnail-status.local { color: #536672; background: rgba(255,255,255,.9); }
.widget-thumbnail-status.missing { color: #a33b2c; background: #fff0ee; }
.widget-library-card-body { padding: 13px 14px 14px; }
.widget-library-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.widget-library-card-title h3 {
  min-width: 0;
  margin: 0;
  color: #243b45;
  font-size: 14px;
  font-weight: 700;
}
.widget-library-card-title > span {
  flex: 0 0 auto;
  color: #71838d;
  font-size: 10px;
}
.widget-library-card code {
  display: block;
  overflow: hidden;
  margin: 7px 0 11px;
  color: #60737d;
  background: transparent;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-library-upload-state { min-height: 23px; margin-bottom: 6px; }
.widget-library-progress { height: 4px; overflow: hidden; border-radius: 99px; background: #e6edef; }
.widget-library-progress span { display: block; width: 0; height: 100%; background: #167568; transition: width .15s; }
.widget-library-upload-state small { display: block; margin-top: 4px; color: #74858e; font-size: 10px; }
.widget-library-card.is-error .widget-library-upload-state small { color: #b42318; }
.widget-library-card.is-success .widget-library-upload-state small { color: #16703b; }
.widget-thumbnail-button { width: 100%; justify-content: center; }
.widget-library-empty {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #7d8e97;
  text-align: center;
}
.widget-library-empty i { font-size: 24px; }
.widget-library-empty strong { color: #425861; }

.theme-detail-head { align-items: flex-end; }
.theme-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: #617580;
  font-size: 12px;
  font-weight: 600;
}
.theme-back-link:hover { color: #136f63; text-decoration: none; }
.theme-detail-title { display: flex; align-items: center; gap: 11px; margin-top: 5px; }
.theme-detail-title h1 { margin: 0; }
.theme-detail-title .theme-id { font-size: 13px; }
.theme-detail-tags { margin: 14px 0 0; }
.theme-detail-overview { overflow: hidden; }
.theme-overview-body {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(320px, 1fr);
  gap: 30px;
  align-items: center;
}
.theme-detail-cover-wrap { min-width: 0; }
.theme-media-button {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: inherit;
  background: #edf3f4;
  cursor: zoom-in;
  text-align: left;
}
.theme-media-button:focus-visible {
  outline: 3px solid rgba(22, 117, 104, .34);
  outline-offset: 2px;
}
.theme-media-button img { display: block; width: 100%; height: 100%; object-fit: contain; }
.theme-detail-cover {
  height: 300px;
  border: 1px solid #d8e3e6;
  border-radius: 12px;
}
.theme-image-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #fff;
  background: rgba(27, 40, 46, .78);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .18s ease, transform .18s ease;
}
.theme-media-button:hover .theme-image-zoom,
.theme-media-button:focus .theme-image-zoom { opacity: 1; transform: translateY(0); }
.theme-media-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #91a2aa;
  background: #edf3f4;
}
.theme-media-empty > i { font-size: 28px; }
.theme-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.theme-summary-item {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid #e0e8eb;
  border-radius: 9px;
  background: #fafcfc;
}
.theme-summary-item > span {
  display: block;
  margin-bottom: 5px;
  color: #7a8b94;
  font-size: 11px;
}
.theme-summary-item > strong { color: #263d47; font-size: 14px; }
.theme-summary-item > code {
  display: block;
  overflow: hidden;
  color: #a92645;
  background: transparent;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-summary-wide { grid-column: 1 / -1; }
.theme-gallery-head { align-items: center; }
.theme-gallery-head p { margin: 4px 0 0; color: #7b8b94; font-size: 12px; }
.theme-gallery-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #167568;
  background: #e8f3f0;
  font-size: 12px;
  font-weight: 700;
}
.theme-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 16px;
}
.theme-media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dce5e8;
  border-radius: 10px;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.theme-media-card:hover {
  border-color: #afd0c9;
  box-shadow: 0 8px 24px rgba(38, 61, 71, .08);
  transform: translateY(-2px);
}
.theme-wallpaper-image { height: 310px; border-bottom: 1px solid #e3eaed; }
.theme-widget-image { height: 220px; border-bottom: 1px solid #e3eaed; }
.theme-media-meta { display: grid; gap: 7px; min-width: 0; padding: 12px 13px; }
.theme-media-meta > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-media-meta > span { color: #7b8b94; font-size: 11px; }
.theme-media-meta code {
  display: block;
  overflow: hidden;
  color: #596c76;
  background: transparent;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-media-index { color: #314752; font-size: 12px; font-weight: 700; }

body.lightbox-open { overflow: hidden; }
.theme-lightbox {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}
.theme-lightbox[hidden] { display: none; }
.theme-lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(13, 22, 27, .92);
  cursor: zoom-out;
}
.theme-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1320px, 100%);
  height: min(900px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: #111a1f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}
.theme-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 10px 14px 10px 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.theme-lightbox-toolbar > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.theme-lightbox-toolbar strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.theme-lightbox-toolbar span { flex: 0 0 auto; color: #9fb0b8; font-size: 11px; }
.theme-lightbox-close,
.theme-lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
.theme-lightbox-close { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; }
.theme-lightbox-close:hover,
.theme-lightbox-nav:hover { background: rgba(255, 255, 255, .17); }
.theme-lightbox-stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 24px 76px;
}
.theme-lightbox-stage > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.theme-lightbox-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 58px;
  border-radius: 9px;
  font-size: 26px;
  transform: translateY(-50%);
}
.theme-lightbox-nav.previous { left: 16px; }
.theme-lightbox-nav.next { right: 16px; }

@media (max-width: 760px) {
  .theme-content { padding: 20px 16px 36px; }
  .theme-page-head, .publish-bar { align-items: flex-start; flex-direction: column; }
  .page-legend { justify-content: flex-start; }
  .theme-guide { align-items: flex-start; flex-wrap: wrap; }
  .theme-form-grid, .material-fields, .widget-fields, .theme-basic-grid, .wallpaper-fields { grid-template-columns: 1fr; }
  .theme-section-head { align-items: flex-start; flex-direction: column; }
  .section-actions { width: 100%; justify-content: space-between; }
  .material-row { align-items: flex-start; }
  .row-number { flex: 0 0 38px; min-width: 38px; padding-top: 3px; }
  .theme-tabs, .theme-list-filter { align-items: stretch; flex-direction: column; }
  .theme-filter-field, .theme-filter-field:nth-child(2) { flex-basis: auto; }
  .theme-filter-actions { justify-content: flex-end; }
  .theme-list-card { grid-template-columns: 1fr; gap: 10px; }
  .theme-card-detail-link { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; }
  .theme-cover { width: 78px; height: 78px; }
  .theme-card-action { justify-self: end; }
  .theme-card-detail-hint { display: none; }
  .theme-overview-body { grid-template-columns: 1fr; gap: 18px; }
  .theme-detail-cover { height: 230px; }
  .theme-detail-summary { grid-template-columns: 1fr; }
  .theme-summary-wide { grid-column: auto; }
  .theme-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .theme-wallpaper-image { height: 240px; }
  .theme-widget-image { height: 160px; }
  .theme-media-meta { padding: 10px; }
  .theme-lightbox { padding: 0; }
  .theme-lightbox-dialog { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .theme-lightbox-stage { padding: 18px 52px; }
  .theme-lightbox-nav.previous { left: 6px; }
  .theme-lightbox-nav.next { right: 6px; }
  .upload-dropzone, .compact-zone { grid-template-columns: 58px minmax(100px, 1fr); }
  .upload-preview, .compact-zone .upload-preview { width: 58px; height: 56px; }
  .upload-dropzone .choose-file { grid-column: 1 / -1; }
  .publish-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 430px) {
  .theme-media-grid { grid-template-columns: 1fr; }
  .theme-wallpaper-image { height: 340px; }
}

.admin-checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 500;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid #cfd9df;
  border-radius: 6px;
  color: #1f2933;
  background: #ffffff;
}

.admin-btn:hover {
  color: #0f5d54;
  border-color: #8ab8ae;
  background: #f2faf8;
  text-decoration: none;
}

.admin-btn.primary {
  color: #ffffff;
  border-color: #136f63;
  background: #136f63;
}

.admin-btn.danger {
  color: #a01f1f;
  border-color: #efb6b6;
  background: #fff7f7;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e6edf0;
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  min-width: 960px;
  margin: 0;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6edf0;
  vertical-align: middle;
  font-size: 13px;
  white-space: nowrap;
}

.admin-table th {
  color: #52616b;
  background: #f8fafb;
  font-weight: 700;
}

.admin-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.text-muted {
  color: #7b8b94;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f5;
  color: #394b59;
  font-size: 12px;
}

.pagination-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: #6b7c86;
  font-size: 13px;
}

.modal-content {
  border-radius: 8px;
}

.modal-header,
.modal-footer {
  border-color: #e6edf0;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border: 1px solid #d9e2e7;
  border-radius: 8px;
  background: #ffffff;
}

.login-title {
  margin-bottom: 24px;
}

.login-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.login-title p {
  margin: 6px 0 0;
  color: #6b7c86;
  font-size: 13px;
}

@media (max-width: 900px) {
  .admin-sidebar {
    width: 64px;
  }

  .admin-nav span {
    display: none;
  }

  .admin-content {
    margin-left: 64px;
    padding: 18px 14px 28px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .widget-library-metrics { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .widget-library-filter { grid-template-columns: 1fr 1fr; }
  .widget-filter-search { grid-column: 1 / -1; }
  .widget-library-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 560px) {
  .admin-topbar {
    padding: 0 12px;
  }

  .admin-account span {
    display: none;
  }

  .admin-page-head {
    display: block;
  }

  .metric-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .widget-library-metrics,
  .widget-library-filter,
  .widget-library-grid { grid-template-columns: 1fr; }
  .widget-filter-search { grid-column: auto; }
}
