.configs-page {
  position: relative;
  z-index: 4;
  max-width: 1320px;
  margin: 0 auto;
  padding: 34px 24px 70px;
}

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

.configs-head h1 {
  margin: 0 0 8px;
  color: var(--white);
  font-size: clamp(30px, 4vw, 46px);
}

.configs-head p {
  max-width: 680px;
  color: var(--text2);
  font-size: 14px;
}

.configs-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(23, 23, 21, .92);
}

.configs-filter label {
  color: var(--text2);
  font-size: 13px;
}

.configs-filter select,
.config-upload-card input,
.config-upload-card select,
.config-upload-card textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.configs-filter select {
  max-width: 260px;
  height: 38px;
  padding: 0 10px;
}

.configs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.config-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 120px 150px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(255, 255, 255, .018);
  color: var(--text);
}

.config-row:hover {
  border-color: rgba(241, 6, 93, .42);
  background: rgba(241, 6, 93, .045);
}

.config-file-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 3px;
  color: var(--primary);
  background: rgba(241, 6, 93, .1);
  font-size: 24px;
}

.config-title {
  color: var(--white);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-meta {
  margin-top: 3px;
  color: var(--text2);
  font-size: 12px;
}

.config-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(10px);
}

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

.config-upload-card,
.config-detail {
  position: relative;
  width: min(620px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg2);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .45);
}

.config-upload-card h2,
.config-detail h1 {
  margin: 0 0 18px;
  color: var(--white);
}

.config-upload-card label {
  display: block;
  margin-bottom: 12px;
  color: var(--text2);
  font-size: 13px;
}

.config-upload-card input,
.config-upload-card select {
  height: 42px;
  margin-top: 6px;
  padding: 0 10px;
}

.config-upload-card textarea {
  min-height: 120px;
  margin-top: 6px;
  padding: 10px;
  resize: vertical;
}

#configUploadMsg {
  display: block;
  margin-top: 10px;
  color: var(--text2);
  font-size: 13px;
}

.config-back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text2);
}

.config-detail {
  width: 100%;
}

.config-description {
  color: var(--text2);
  white-space: pre-wrap;
  line-height: 1.6;
}

.attachment-box {
  margin-top: 24px;
}

.attachment-title {
  margin-bottom: 10px;
  color: var(--text2);
  font-size: 13px;
}

.attachment-file {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 170px;
  height: 132px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .025);
  color: var(--text);
}

.attachment-file:hover {
  border-color: rgba(241, 6, 93, .45);
}

.attachment-file .file-big {
  color: var(--primary);
  font-size: 50px;
  line-height: 1;
}

.attachment-file span {
  width: 132px;
  margin-top: 12px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .configs-head {
    align-items: stretch;
    flex-direction: column;
  }
  .config-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .config-row > .config-meta:nth-child(n+3) {
    display: none;
  }
}

.config-back {
  padding: 8px 12px;
  border: 1px solid rgba(241, 6, 93, .28);
  border-radius: 3px;
  background: rgba(241, 6, 93, .06);
  color: var(--white);
  font-weight: 800;
}

.configs-filter select,
.config-upload-card select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%), linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 10px) 16px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.config-row-file {
  grid-template-columns: 170px minmax(0, 1fr) 120px 150px;
  align-items: stretch;
}

.config-file-thumb,
.attachment-file {
  position: relative;
  width: 170px;
  min-height: 132px;
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.018);
  overflow: hidden;
}

.config-file-thumb .config-file-icon,
.attachment-file .file-big {
  width: auto;
  height: auto;
  background: transparent;
  color: var(--primary);
  font-size: 58px;
  line-height: 1;
}

.config-file-thumb span,
.attachment-file span {
  width: calc(100% + 20px);
  margin: 10px -10px 0;
  padding: 5px 8px;
  background: rgba(0,0,0,.55);
  color: var(--white);
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.config-file-thumb small,
.attachment-file small {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 9px;
  color: var(--white);
  font-size: 12px;
  opacity: 0;
  transition: opacity .18s ease;
}

.config-file-thumb em,
.attachment-file em {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 24px;
  background: rgba(17,17,15,.82);
  color: var(--white);
  font-style: normal;
  font-size: 13px;
  opacity: 0;
  transition: opacity .18s ease;
  z-index: 1;
}

.config-file-thumb:hover em,
.attachment-file:hover em {
  opacity: 1;
}

.config-file-thumb:hover small,
.attachment-file:hover small {
  opacity: 1;
}

.config-file-thumb small,
.attachment-file small {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 9px;
  color: var(--white);
  font-size: 12px;
  opacity: 0;
  transition: opacity .18s ease;
  z-index: 2;
  text-align: center;
}

.config-owner-tools {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(255,255,255,.018);
}

.config-owner-tools h3 {
  margin: 0 0 12px;
  color: var(--white);
}

.config-owner-tools label {
  display: block;
  margin-bottom: 10px;
  color: var(--text2);
  font-size: 12px;
}

.config-owner-tools input,
.config-owner-tools textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.config-owner-tools textarea { min-height: 110px; resize: vertical; }
.config-tools-actions { display:flex; gap:10px; flex-wrap:wrap; }
#editCfgMsg { display:block; margin-top:10px; color:var(--text2); font-size:12px; }

@media (max-width: 760px) {
  .config-row-file { grid-template-columns: 1fr; }
  .config-file-thumb { width: 100%; }
}

.config-detail-page {
  padding-top: 18px;
}

.config-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.config-back:hover {
  color: var(--primary);
}

.config-limit,
#editTitleCount,
#editDescCount {
  float: right;
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
}

.native-file {
  display: none !important;
}

.custom-file-btn {
  margin-top: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(241, 6, 93, .35);
  border-radius: 3px;
  background: rgba(241, 6, 93, .08);
  color: var(--white);
  cursor: pointer;
  font: inherit;
}

.custom-file-btn:hover {
  border-color: rgba(241, 6, 93, .65);
  background: rgba(241, 6, 93, .14);
}

.custom-file-name {
  display: inline-block;
  max-width: 100%;
  margin: 8px 0 0 10px;
  color: var(--text2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.config-owner-wrap {
  margin-top: 22px;
}

.config-settings-toggle {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(255,255,255,.025);
  color: var(--white);
  cursor: pointer;
  padding: 9px 14px;
  font: inherit;
  font-weight: 800;
}

.config-settings-toggle:hover {
  border-color: rgba(241, 6, 93, .45);
  color: var(--primary);
}

.config-file-thumb .config-file-icon,
.attachment-file .file-big {
  position: relative;
  width: 48px;
  height: 58px;
  border: 5px solid var(--primary);
  border-radius: 6px 14px 6px 6px;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 1;
  box-shadow: 0 0 22px rgba(241, 6, 93, .10);
}

.config-file-thumb .config-file-icon::before,
.attachment-file .file-big::before {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-left: 5px solid var(--primary);
  border-bottom: 5px solid var(--primary);
  border-radius: 0 8px 0 5px;
  background: var(--bg2);
}

.config-file-thumb .config-file-icon::after,
.attachment-file .file-big::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 25px;
  height: 5px;
  border-top: 3px solid rgba(241, 6, 93, .65);
  border-bottom: 3px solid rgba(241, 6, 93, .45);
}

/* Compact config cards/detail */
.config-row-compact {
  grid-template-columns: 92px minmax(0, 1fr) 120px 130px;
  gap: 12px;
  min-height: 96px;
  padding: 10px 12px;
}

.config-row-compact .config-file-thumb {
  width: 82px;
  min-height: 76px;
  padding: 8px 6px 6px;
}

.config-row-compact .config-file-thumb .config-file-icon {
  width: 28px;
  height: 34px;
  border-width: 3px;
  border-radius: 4px 9px 4px 4px;
}

.config-row-compact .config-file-thumb .config-file-icon::before {
  top: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-left-width: 3px;
  border-bottom-width: 3px;
}

.config-row-compact .config-file-thumb .config-file-icon::after {
  left: 6px;
  right: 6px;
  top: 15px;
  height: 3px;
  border-top-width: 2px;
  border-bottom-width: 2px;
}

.config-row-compact .config-file-thumb span {
  margin-top: 6px;
  padding: 3px 5px;
  font-size: 10px;
}

.config-row-compact .config-file-thumb small {
  bottom: 5px;
  font-size: 10px;
}

.config-detail-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.config-settings-corner {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.config-detail .attachment-file {
  width: 118px;
  min-height: 108px;
  padding: 10px 7px 7px;
}

.config-detail .attachment-file .file-big {
  width: 38px;
  height: 46px;
  border-width: 4px;
}

.config-detail .attachment-file .file-big::before {
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-left-width: 4px;
  border-bottom-width: 4px;
}

.config-detail .attachment-file .file-big::after {
  left: 8px;
  right: 8px;
  top: 20px;
}

.config-detail .attachment-file span {
  font-size: 11px;
  margin-top: 7px;
}

.config-detail .attachment-file small {
  font-size: 10px;
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-combo {
  position: relative;
  width: auto;
  min-width: 200px;
  max-width: 100%;
  margin-top: 6px;
}

.configs-filter .custom-combo {
  margin-top: 0;
}

.custom-combo-btn {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(255,255,255,.025);
  color: var(--white);
  cursor: pointer;
  font: inherit;
  text-align: left;
  white-space: nowrap;
}

.custom-combo.open .custom-combo-btn {
  border-color: rgba(241, 6, 93, .55);
  box-shadow: 0 0 0 3px rgba(241, 6, 93, .08);
}

.custom-combo-arrow {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(45deg);
  transition: transform .18s ease;
}

.custom-combo.open .custom-combo-arrow {
  transform: rotate(225deg);
}

.custom-combo-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  border: 1px solid rgba(241, 6, 93, .25);
  border-radius: 3px;
  background: #171717;
  box-shadow: 0 18px 42px rgba(0,0,0,.45);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.custom-combo.open .custom-combo-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-combo-item {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.custom-combo-item:hover,
.custom-combo-item.active {
  background: rgba(241, 6, 93, .12);
  color: var(--white);
}

/* Centered config edit panel */
.config-owner-tools[hidden] {
  display: none !important;
}

.config-owner-tools:not([hidden]) {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(241, 6, 93, .38);
  background: #171717;
  box-shadow: 0 24px 90px rgba(0,0,0,.72), 0 0 0 9999px rgba(0,0,0,.54);
}

.config-owner-tools:not([hidden]) h3 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Comments styles */
.config-avg-rating {
  margin: 4px 0 8px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}
.comments-section {
  margin-top: 36px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.comments-section h2 {
  font-size: 20px;
  color: var(--white);
  margin-bottom: 18px;
}
.comment-form {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rating-stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  font-size: 22px;
  cursor: pointer;
}
.rating-stars span {
  color: var(--text2);
  transition: color 0.15s ease;
}
.rating-stars span:hover,
.rating-stars span:hover ~ span,
.rating-stars span.active,
.rating-stars span.active ~ span {
  color: #fbbf24;
}
.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-family: inherit;
  resize: vertical;
}
.comment-form button {
  align-self: flex-start;
}
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comment-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.012);
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.comment-author {
  color: var(--white);
  font-weight: 800;
}
.comment-stars {
  display: flex;
  font-size: 12px;
}
.star-display {
  color: var(--text2);
}
.star-display.filled {
  color: #fbbf24;
}
.comment-date {
  color: var(--text2);
  margin-left: auto;
}
.comment-body {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.no-comments, .login-prompt {
  color: var(--text2);
  font-size: 14px;
  padding: 10px 0;
}
