.configs-page .cfg-main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 56px) 22px 90px;
}

.cfg-head {
  max-width: 680px;
  margin: 0 auto 40px;
  text-align: center;
}
.cfg-head h1 {
  margin: 14px 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.cfg-head .sub {
  margin: 0 auto;
  max-width: 540px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.cfg-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
}

.cfg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.cfg-search {
  display: flex;
  flex: 1 1 260px;
  max-width: 420px;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}
.cfg-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
}
.cfg-filters {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}
.cfg-filters button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}
.cfg-filters button.on {
  background: var(--accent);
  color: #0a0812;
  font-weight: 600;
}

.cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(274px, 1fr));
  gap: 14px;
}
.cfg-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #131318, #0b0b0f);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.cfg-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.cfg-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.cfg-card h3 {
  margin: 0 0 3px;
  font-size: 16px;
  color: #fff;
}
.cfg-card .author {
  color: var(--muted);
  font-size: 12.5px;
}
.cfg-badge {
  flex-shrink: 0;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cfg-badge.public { color: var(--accent-2); border-color: rgba(196, 181, 253, 0.32); }
.cfg-badge.private { color: #ffc98b; border-color: rgba(255, 201, 139, 0.32); }
.cfg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cfg-tags span {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}
.cfg-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.cfg-card-foot .meta {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}
.cfg-mine {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cfg-empty {
  padding: 64px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}
.cfg-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  padding: 4px 0 42px;
  color: var(--faint);
  font-size: 12px;
}
.cfg-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.cfg-footer a { color: var(--muted); }
.cfg-footer a:hover { color: #fff; }

.cfg-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}
.cfg-modal.show { display: flex; }
.cfg-sheet {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0e0e13;
}
.cfg-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cfg-sheet-head h3 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}
.cfg-sheet-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.cfg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cfg-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cfg-field > span:first-child {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cfg-field input,
.cfg-field textarea,
#view-data {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
.cfg-field textarea,
#view-data {
  min-height: 170px;
  font-family: var(--mono);
  font-size: 12.5px;
  resize: vertical;
  white-space: pre;
}
.cfg-field input:focus,
.cfg-field textarea:focus { border-color: var(--accent); }
.cfg-switch-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.cfg-switch-row > span:first-child {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}
.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.18s ease;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.cfg-note { color: var(--faint); font-size: 12px; }
.cfg-result {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}
.cfg-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cfg-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn.danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #ffb3b3;
}
.btn.danger:hover { background: rgba(248, 113, 113, 0.14); }
.nav-links a.active { color: #fff; background: rgba(255, 255, 255, 0.06); }

.cfg-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.cfg-sort {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}
.cfg-sort button {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
}
.cfg-sort button.on {
  background: rgba(139, 124, 255, 0.18);
  color: var(--accent-2);
}
.cfg-tags-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -4px 0 20px;
}
.cfg-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.35;
}
.cfg-tag:hover {
  color: #fff;
  border-color: var(--line-strong);
}
.cfg-tag.on {
  color: #0a0812;
  border-color: var(--accent);
  background: var(--accent);
  font-weight: 600;
}
.cfg-tag i {
  font-style: normal;
  opacity: 0.55;
  font-size: 10px;
}
.cfg-card-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.cfg-like,
.cfg-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}
.cfg-like {
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
}
.cfg-like:hover {
  color: var(--accent-2);
  border-color: rgba(196, 181, 253, 0.28);
  background: rgba(139, 124, 255, 0.08);
}
.cfg-like.on { color: #f0abfc; }
.cfg-like svg { flex: none; }
.cfg-view-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}
.cfg-field textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}
.cfg-sheet:focus { outline: none; }

@media (max-width: 640px) {
  .configs-page .cfg-main { padding-top: calc(var(--nav-h) + 30px); }
  .cfg-head-actions { flex-direction: column; }
  .cfg-head-actions .btn { justify-content: center; }
  .cfg-search { max-width: none; }
  .cfg-toolbar-right { width: 100%; justify-content: space-between; }
  .cfg-sort button { padding: 7px 10px; }
  .cfg-card-foot { gap: 10px; }
  .cfg-sheet { max-height: 92vh; padding: 18px; }
}
