:root {
  --bg: #0b0b0d;
  --panel: #111114;
  --sidebar: #050506;
  --gold: #d4af37;
  --gold-dim: #9a7b2e;
  --text: #f4ede1;
  --muted: #b5a78f;
  --line: rgba(212, 175, 55, 0.35);
  --danger: #e07878;
  --ok: #7cb88a;
  /* 滚动条：与金色主题协调 */
  --scrollbar-track: rgba(5, 5, 6, 0.75);
  --scrollbar-thumb: rgba(212, 175, 55, 0.38);
  --scrollbar-thumb-hover: rgba(232, 207, 122, 0.55);
  --scrollbar-thumb-active: rgba(212, 175, 55, 0.72);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow-x: hidden;
  isolation: isolate;
}

code { font-family: Consolas, monospace; color: var(--gold); font-size: 13px; }

/* 主内容区、侧栏、弹窗、多行输入等纵向滚动条 — WebKit / Blink + Firefox */
.content,
.sidebar,
.modal-dialog,
textarea {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.modal-dialog::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.content::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.modal-dialog::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.content::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.modal-dialog::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover), var(--scrollbar-thumb));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.modal-dialog::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-active), var(--scrollbar-thumb-hover));
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:active,
.sidebar::-webkit-scrollbar-thumb:active,
.modal-dialog::-webkit-scrollbar-thumb:active,
textarea::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
  background-clip: padding-box;
}

.content::-webkit-scrollbar-corner,
.sidebar::-webkit-scrollbar-corner,
.modal-dialog::-webkit-scrollbar-corner,
textarea::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}
.brand { display: flex; gap: 12px; padding: 22px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.brand.center { flex-direction: column; text-align: center; border: 0; }
.brand-mark {
  width: 4px; height: 22px; border-radius: 2px;
  background: linear-gradient(180deg, #e8cf7a, var(--gold), var(--gold-dim));
}
.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.24);
}
.brand-mark.lg { width: 6px; height: 28px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: block;
  padding: 12px 14px;
  margin: 4px 0;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(212, 175, 55, 0.08); border-color: var(--line); }
.nav-item.active {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--gold-dim);
  color: var(--gold);
}

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.muted { color: var(--muted); }
.link-out { color: var(--gold); text-decoration: none; }
.link-out:hover { text-decoration: underline; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.topbar {
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 17, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 600; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(135deg, rgba(232, 207, 122, 0.24), rgba(154, 123, 46, 0.22));
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
}
.topbar-user strong {
  color: var(--text);
  font-weight: 800;
}
.topbar-logout {
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
}
.topbar-logout:hover {
  background: rgba(212, 175, 55, 0.2);
  text-decoration: none;
}

.content { padding: 24px 28px 40px; flex: 1; overflow-y: auto; min-height: 0; }

.flash {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  color: var(--gold);
}
.flash.err { border-color: rgba(224, 120, 120, 0.5); color: var(--danger); background: rgba(224, 120, 120, 0.1); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.card-k { font-size: 12px; color: var(--muted); }
.card-v { font-size: 28px; font-weight: 700; color: var(--gold); margin-top: 6px; }
.card-note { font-size: 11px; margin-top: 8px; line-height: 1.35; }
.card-warn .card-v { color: #e8c96a; }
.card-danger-soft {
  border-color: rgba(224, 120, 120, 0.45);
  background: rgba(224, 120, 120, 0.06);
}
.card-danger-soft .card-v { color: var(--danger); }

.order-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.order-summary-card {
  position: relative;
  overflow: hidden;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid rgba(212, 175, 55, 0.26);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(17, 17, 20, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.order-summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--gold);
  opacity: 0.85;
}

.order-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.order-summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
}

.order-summary-card em {
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}

.order-summary-card--paid::before { background: var(--ok); }
.order-summary-card--paid strong { color: var(--ok); }
.order-summary-card--failed::before { background: var(--danger); }
.order-summary-card--failed strong { color: var(--danger); }
.order-summary-card--amount::before { background: linear-gradient(180deg, #f3d980, var(--gold)); }

@media (max-width: 980px) {
  .order-summary-cards { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

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

.toolbar { margin-bottom: 20px; }
.inline-form, .stack-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.stack-form { flex-direction: column; align-items: stretch; }
.stack-form.small .row { display: flex; flex-wrap: wrap; gap: 10px; }
.stack-form.narrow { max-width: 440px; }
.stack-form label { font-size: 12px; color: var(--muted); margin-top: 8px; }
.stack-form label:first-child { margin-top: 0; }

.list-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.list-toolbar-split {
  justify-content: space-between;
  align-items: stretch;
}

.list-toolbar-split .list-search-form {
  width: auto;
  flex: 1 1 620px;
  max-width: 760px;
  flex-wrap: nowrap;
}

.list-toolbar-split .list-search-form input[type="search"],
.list-toolbar-split .list-search-form input[name="q"] {
  flex: 1 1 280px;
}

.list-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.list-toolbar-note {
  flex-basis: 100%;
}

.list-search-form input[type="search"],
.list-search-form input[name="q"] {
  min-width: 260px;
}
.theme-select {
  min-width: 130px;
  border-color: rgba(212, 175, 55, 0.42);
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.03)),
    #18161a;
  color: var(--text);
}

.theme-select.anti-red-pool-multi {
  width: 100%;
  min-height: 220px;
  padding: 8px 10px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination-info {
  color: var(--muted);
  font-size: 12px;
  margin-right: 4px;
}

.pagination-link,
.pagination-ellipsis {
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--gold);
  text-decoration: none;
  background: rgba(212, 175, 55, 0.08);
}

.pagination-link:hover {
  background: rgba(212, 175, 55, 0.16);
}

.pagination-link.is-active {
  color: #0b0b0d;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

.pagination-link.is-disabled {
  pointer-events: none;
  opacity: 0.42;
}

.pagination-ellipsis {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

input, select, textarea {
  background: #18161a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  min-height: 42px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--gold) 50%, transparent 50%) calc(100% - 12px) 50% / 6px 6px no-repeat,
    linear-gradient(180deg, rgba(212, 175, 55, 0.08), rgba(212, 175, 55, 0.025)),
    #18161a;
  border-color: rgba(212, 175, 55, 0.32);
  cursor: pointer;
}
select:hover {
  border-color: rgba(212, 175, 55, 0.52);
  background-color: #1f1b18;
}
.modal-dialog select {
  min-height: 42px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
textarea { min-width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  min-width: 19px;
  min-height: 19px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.46);
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.08), rgba(212, 175, 55, 0.02)),
    #111114;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 0 rgba(212, 175, 55, 0);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: #08080a;
  clip-path: polygon(14% 52%, 0 66%, 39% 100%, 100% 18%, 84% 4%, 36% 68%);
}

input[type="checkbox"]:checked {
  border-color: rgba(243, 218, 141, 0.9);
  background:
    linear-gradient(135deg, #f3da8d, var(--gold) 55%, var(--gold-dim)),
    var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12), 0 8px 18px rgba(212, 175, 55, 0.16);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:hover {
  border-color: rgba(243, 218, 141, 0.78);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.6);
  outline-offset: 3px;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: rgba(212, 175, 55, 0.18); }
.btn.primary {
  border: 0;
  background: linear-gradient(135deg, #e8cf7a, var(--gold), var(--gold-dim));
  color: #14110e;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.danger { border-color: rgba(224, 120, 120, 0.5); color: var(--danger); background: rgba(224, 120, 120, 0.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.wide { width: 100%; }
form.inline { display: inline; }
.action-dropdown { position: relative; display: inline-block; }
.action-dropdown > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.action-dropdown > summary::-webkit-details-marker { display: none; }
.action-dropdown > summary::after {
  content: "▾";
  margin-left: 8px;
  color: var(--gold);
  font-size: 11px;
}
.action-dropdown[open] > summary {
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.18);
  box-shadow: 0 10px 22px rgba(212, 175, 55, 0.1);
}
.action-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 50;
  min-width: 168px;
  padding: 8px;
  border: 1px solid rgba(212, 175, 55, 0.36);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.08), rgba(212, 175, 55, 0.02)),
    rgba(13, 13, 16, 0.98);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
  backdrop-filter: blur(8px);
}
.action-dropdown-menu::before {
  content: "";
  position: absolute;
  right: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(212, 175, 55, 0.36);
  border-top: 1px solid rgba(212, 175, 55, 0.36);
  background: rgba(13, 13, 16, 0.98);
}
.action-dropdown-menu .btn,
.action-dropdown-menu form,
.action-dropdown-menu button { display: block; width: 100%; }
.action-dropdown-menu .btn,
.action-dropdown-menu button {
  margin: 0 0 6px;
  text-align: left;
  border-radius: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
}
.action-dropdown-menu .btn:hover,
.action-dropdown-menu button:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.25);
  transform: none;
}
.action-dropdown-menu form:last-child button,
.action-dropdown-menu .btn:last-child { margin-bottom: 0; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.table th { background: rgba(212, 175, 55, 0.06); color: var(--muted); font-weight: 600; font-size: 12px; }
.table tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }

.tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.tag.ok { background: rgba(124, 184, 138, 0.15); color: var(--ok); }
.tag.off { background: rgba(224, 120, 120, 0.12); color: var(--danger); }
.tag.warn { background: rgba(212, 175, 55, 0.14); color: var(--gold); }

.subh { font-size: 16px; margin: 0 0 16px; color: var(--gold); }
.panel { margin-top: 28px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.panel ul { margin: 8px 0 0; padding-left: 18px; }

.foot {
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 32px;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.08);
}
.login-card h1 { margin: 10px 0 6px; font-size: 22px; }

/* modal */
body.modal-open { overflow: hidden; }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { margin: 0; font-size: 16px; color: var(--gold); }

.modal-body { padding: 18px; }

.modal-foot {
  padding: 14px 18px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-body .stack-form label { margin-top: 10px; }
.modal-body .stack-form label:first-of-type { margin-top: 0; }

.app-dialog-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2600;
  background: rgba(0, 0, 0, 0.62);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.app-dialog-backdrop.open { display: flex; }
.app-dialog {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.app-dialog-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.app-dialog-head h3 {
  margin: 0;
  color: var(--gold);
  font-size: 16px;
}
.app-dialog-body {
  padding: 18px;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}
.app-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(212, 175, 55, 0.14);
}

.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.domain-toolbar {
  align-items: stretch;
}
.domain-toolbar-split {
  justify-content: space-between;
}
.domain-toolbar .domain-search-form,
.domain-toolbar .domain-add-form {
  width: auto;
  flex-wrap: nowrap;
}
.domain-toolbar .domain-search-form {
  flex: 0 1 620px;
}
.domain-toolbar .domain-search-form input[type="search"] {
  flex: 1 1 260px;
}
.domain-toolbar .domain-add-form {
  flex: 0 1 auto;
}
.user-toolbar-split {
  justify-content: space-between;
  align-items: stretch;
}
.user-toolbar-split .user-search-form {
  width: auto;
  flex: 0 1 620px;
  flex-wrap: nowrap;
}
.user-toolbar-split > .muted {
  flex-basis: 100%;
}
.site-toolbar-split {
  justify-content: space-between;
  align-items: stretch;
}
.site-toolbar-split .site-search-form {
  width: auto;
  flex: 0 1 720px;
  flex-wrap: nowrap;
}
.site-toolbar-split .site-search-form input[type="search"] {
  flex: 1 1 360px;
}
.site-toolbar-split > .muted {
  flex-basis: 100%;
}

@media (max-width: 760px) {
  .list-toolbar-split .list-search-form {
    flex-wrap: wrap;
    max-width: none;
  }

  .list-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.fullscreen-loading-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 6, 0.78);
  backdrop-filter: blur(4px);
}
.fullscreen-loading-backdrop.open {
  display: flex;
}
.fullscreen-loading-box {
  min-width: 260px;
  padding: 28px 30px;
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 18px;
  background: rgba(17, 17, 20, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.fullscreen-loading-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.18);
  border-top-color: var(--gold);
  animation: fullscreen-loading-spin 0.9s linear infinite;
}
.fullscreen-loading-text {
  color: var(--gold);
  font-weight: 700;
}
@keyframes fullscreen-loading-spin {
  to { transform: rotate(360deg); }
}

/* 系统设置顶部分段式选项卡（类似 Tab / 切换条） */
.settings-tabs-bar {
  width: 100%;
  max-width: none;
  margin: 0 0 22px;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 88%, #000 12%);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.settings-tabs .settings-tab {
  flex: 1 1 auto;
  min-width: min(100%, 7.5rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}
.settings-tabs .settings-tab:hover {
  color: var(--text);
  background: rgba(212, 175, 55, 0.07);
  border-color: rgba(212, 175, 55, 0.12);
}
.settings-tabs .settings-tab:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.55);
  outline-offset: 2px;
}
.settings-tabs .settings-tab.is-active {
  color: var(--gold);
  background: linear-gradient(165deg, rgba(212, 175, 55, 0.14) 0%, var(--panel) 55%);
  border-color: rgba(212, 175, 55, 0.32);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}
@media (max-width: 720px) {
  .settings-tabs .settings-tab {
    min-width: calc(50% - 4px);
    font-size: 12px;
    padding: 9px 8px;
  }
}

/* settings page */
.settings-page-form.stack-form {
  width: 100%;
  max-width: none;
  gap: 0;
}
.settings-page-form.stack-form .settings-field > label { margin-top: 0; }

.settings-section {
  margin-bottom: 22px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(212, 175, 55, 0.06) 0%, var(--panel) 42%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.settings-section:last-of-type { margin-bottom: 0; }

.settings-section-title {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 1.3;
}

.settings-lead {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
}
.settings-lead code { font-size: 12px; }

.settings-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(340px, 1fr));
  gap: 18px 24px;
  align-items: start;
}

.settings-billing-grid {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px 20px;
  align-items: end;
}

.settings-field { min-width: 0; width: 100%; }
.settings-field input,
.settings-field select,
.settings-field textarea,
.settings-page-form input,
.settings-page-form select,
.settings-page-form textarea,
.settings-section input,
.settings-section select,
.settings-section textarea {
  width: 100%;
  min-width: 0;
}

.settings-field input[type="checkbox"],
.settings-page-form input[type="checkbox"],
.settings-section input[type="checkbox"],
.stack-form input[type="checkbox"],
.portal-check-label input[type="checkbox"],
.settings-token-clear-label input[type="checkbox"] {
  width: 19px;
  height: 19px;
  min-width: 19px;
  min-height: 19px;
  max-width: 19px;
  flex: 0 0 19px;
}

.settings-field-note {
  min-height: 100%;
}

.settings-field-block,
.settings-bot-token-row,
.settings-token-clear-wrap,
.settings-check-list {
  grid-column: 1 / -1;
}
.settings-field > label,
.settings-block-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.settings-block-label { margin-bottom: 8px; }

.settings-hint {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
}
.settings-hint code { font-size: 11px; }

.settings-field-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed rgba(212, 175, 55, 0.22);
}

.settings-field-note {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.05);
}
.template-ftp-list {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}
.template-ftp-card {
  padding: 16px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}
.template-ftp-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.template-ftp-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.settings-note-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  margin-bottom: 6px;
}
.settings-note-body { margin: 0; font-size: 12px; line-height: 1.5; }

.settings-form-actions {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.settings-bot-form {
  margin-top: 8px;
  width: 100%;
  max-width: none;
}
.settings-bot-token-row .settings-bot-token-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.settings-token-clear-wrap {
  margin-top: 16px;
}
.settings-token-clear-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(224, 120, 120, 0.08)),
    rgba(0, 0, 0, 0.14);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.settings-token-clear-label:hover {
  border-color: rgba(224, 120, 120, 0.72);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(224, 120, 120, 0.14)),
    rgba(0, 0, 0, 0.16);
  box-shadow: 0 0 0 3px rgba(224, 120, 120, 0.08);
}
.settings-token-clear-label input {
  flex-shrink: 0;
}
.settings-token-clear-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #ffb3b3;
}
.settings-bot-form .settings-form-actions {
  margin-top: 4px;
}

/* 机器人头像：自定义文件选择按钮 */
.settings-file-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 4px;
}
.settings-file-upload-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.settings-file-input-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
  z-index: 2;
}
.settings-file-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(145deg, rgba(232, 207, 122, 0.22) 0%, rgba(212, 175, 55, 0.12) 45%, rgba(154, 123, 46, 0.14) 100%);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
  pointer-events: none;
  user-select: none;
}
.settings-file-upload-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.9;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E") center / contain no-repeat;
}
.settings-file-upload-pick:hover .settings-file-upload-btn {
  border-color: rgba(232, 207, 122, 0.65);
  filter: brightness(1.06);
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.settings-file-upload-pick:active .settings-file-upload-btn {
  transform: scale(0.98);
}
.settings-file-upload-pick:focus-within .settings-file-upload-btn {
  outline: 2px solid rgba(212, 175, 55, 0.55);
  outline-offset: 3px;
}
.settings-file-upload-name {
  font-size: 13px;
  min-width: 0;
  flex: 1 1 160px;
  word-break: break-all;
  line-height: 1.4;
}
.settings-file-upload-name.has-file {
  color: var(--text);
  font-weight: 600;
}

.portal-download-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 16px;
  background: rgba(5, 5, 6, 0.35);
  align-items: stretch;
  /* 同一行内三块等高；移动端单列时每行也保持统一最小高度 */
  grid-auto-rows: minmax(52px, auto);
}
.portal-download-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  box-sizing: border-box;
  min-height: 52px;
  margin: 0;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  text-align: center;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}
.portal-download-tab > span {
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 1.35;
  text-wrap: balance;
}
.portal-download-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.portal-download-tab:hover {
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.32);
  background: rgba(212, 175, 55, 0.08);
}
.portal-download-tab.active,
.portal-download-tab:has(input:checked) {
  color: #17120a;
  border-color: rgba(232, 207, 122, 0.75);
  background: linear-gradient(135deg, #e8cf7a, var(--gold), var(--gold-dim));
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.portal-download-tab:active {
  transform: scale(0.98);
}
.portal-download-clear-panel {
  padding: 14px 16px;
  border: 1px dashed rgba(212, 175, 55, 0.45);
  border-radius: 14px;
  background: rgba(212, 175, 55, 0.08);
  color: var(--muted);
  line-height: 1.7;
}

/* 用户后台「下载」弹窗：下载链接独占一行且铺满宽度 */
.portal-download-modal-body {
  max-width: none;
}
.portal-download-url-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 6px;
}
.portal-download-url-panel input[type="text"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .portal-download-tabs {
    grid-template-columns: 1fr;
  }
}

.settings-telegram-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(340px, 1fr));
  gap: 16px 20px;
  margin-bottom: 16px;
}
.settings-code {
  margin: 0;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  white-space: pre-wrap;
  background: #18161a;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: Consolas, "Cascadia Mono", monospace;
}
.settings-inline-danger {
  margin: 0;
  padding-top: 4px;
}

.settings-section-muted {
  background: rgba(17, 17, 20, 0.85);
  box-shadow: none;
}
.settings-env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  font-size: 13px;
}
.settings-env-grid > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.2);
}
.settings-env-full { grid-column: 1 / -1; }
.settings-env-k {
  font-weight: 700;
  color: var(--gold);
  font-size: 12px;
  min-width: 5.5em;
}
.settings-env-v { color: var(--text); flex: 1; min-width: 0; }
.settings-env-v-path { word-break: break-all; font-size: 12px; color: var(--muted); }

@media (max-width: 820px) {
  .settings-grid-2,
  .settings-billing-grid,
  .settings-telegram-grid,
  .settings-env-grid {
    grid-template-columns: 1fr;
  }
}

.portal-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  margin: 4px 0 10px;
  padding: 0;
  line-height: 1.45;
  vertical-align: middle;
}
.portal-check-label:hover {
  color: var(--gold);
}
.portal-check-label input { flex-shrink: 0; }

.settings-field > label.portal-check-label,
.stack-form label.portal-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 0;
  color: var(--text);
  line-height: 1.45;
}

.settings-field > label.portal-check-label:hover,
.stack-form label.portal-check-label:hover {
  color: var(--gold);
}

.portal-body .portal-sidebar {
  border-right-color: rgba(124, 184, 138, 0.35);
}
.portal-body .nav-item.active {
  border-color: rgba(124, 184, 138, 0.55);
  color: #a8d4b4;
}

.portal-expiry-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.1);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.user-time-cell {
  min-width: 200px;
  max-width: 280px;
  vertical-align: top;
}
.user-time-stack {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.user-time-stack .user-time-countdown {
  margin-top: 4px;
  font-weight: 600;
  color: var(--text);
}
.user-time-stack--urgent,
.user-time-stack--urgent .user-time-countdown {
  color: var(--danger);
}
.user-time-stack--expired,
.user-time-stack--expired .user-time-countdown {
  color: var(--danger);
}

/* 用户后台弹窗：datetime-local 日历图标在深色背景下可见 */
.portal-expires-datetime {
  color-scheme: dark;
}
.portal-expires-datetime::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.92;
  cursor: pointer;
}

.portal-impersonation-banner {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.12);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.portal-impersonation-banner .link-out { margin-left: 10px; }

.portal-current-pw-view {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.portal-sites-table .user-time-cell {
  min-width: 160px;
  max-width: 220px;
}
.portal-site-account-expiry {
  font-size: 12px;
}
.portal-sites-table th,
.portal-sites-table td {
  vertical-align: top;
}

/* Premium visual polish */
:root {
  --bg: #07070a;
  --panel: rgba(18, 17, 20, 0.88);
  --sidebar: rgba(5, 5, 7, 0.92);
  --line: rgba(212, 175, 55, 0.24);
  --line-soft: rgba(212, 175, 55, 0.12);
  --gold-hi: #f2d98b;
  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.32);
  --shadow-gold: 0 14px 48px rgba(212, 175, 55, 0.08);
}

body {
  background:
    radial-gradient(circle at 18% 10%, rgba(212, 175, 55, 0.16), transparent 32%),
    radial-gradient(circle at 88% 4%, rgba(124, 184, 138, 0.08), transparent 30%),
    radial-gradient(circle at 72% 90%, rgba(212, 175, 55, 0.08), transparent 34%),
    linear-gradient(135deg, #050506 0%, #101015 45%, #07070a 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 45% 30%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 45% 30%, #000 0%, transparent 72%);
  animation: bg-grid-drift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: -2;
  opacity: 0.5;
  background:
    radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.18), transparent 18%),
    radial-gradient(circle at 78% 18%, rgba(124, 184, 138, 0.1), transparent 20%),
    radial-gradient(circle at 65% 82%, rgba(212, 175, 55, 0.1), transparent 18%);
  filter: blur(8px);
  animation: bg-orb-flow 24s ease-in-out infinite alternate;
}

@keyframes bg-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 42px 42px, 42px 42px; }
}

@keyframes bg-orb-flow {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { transform: translate3d(2%, 2%, 0) scale(1.04); }
  100% { transform: translate3d(1%, -2%, 0) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .nav-item,
  .card {
    animation: none !important;
    transition: none !important;
  }
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(20, 19, 23, 0.94), rgba(5, 5, 7, 0.96)),
    var(--sidebar);
  border-right-color: rgba(212, 175, 55, 0.22);
  box-shadow: 18px 0 52px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}

.brand {
  padding: 24px 18px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), transparent 65%);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, #f3da8d, #d4af37 48%, #8b6b21),
    var(--gold);
  box-shadow: 0 10px 28px rgba(212, 175, 55, 0.22);
}

.brand-title {
  font-size: 16px;
  letter-spacing: 0.06em;
}

.nav {
  padding: 16px 12px;
}

.nav-item {
  position: relative;
  margin: 6px 0;
  padding: 13px 15px;
  border-radius: 14px;
  color: rgba(244, 237, 225, 0.86);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  transform: translateX(3px);
  background: rgba(212, 175, 55, 0.09);
  border-color: rgba(212, 175, 55, 0.22);
}

.nav-item.active {
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.05)),
    rgba(255, 255, 255, 0.02);
  border-color: rgba(212, 175, 55, 0.46);
  box-shadow: inset 3px 0 0 var(--gold), 0 12px 28px rgba(0, 0, 0, 0.22);
}

.main {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%);
}

.topbar {
  padding: 22px 30px;
  background: rgba(12, 12, 15, 0.64);
  border-bottom-color: rgba(212, 175, 55, 0.18);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #fff3c2, #d4af37 52%, #9a7b2e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.content {
  padding: 30px 34px 46px;
}

.flash,
.card,
.panel,
.settings-section,
.table,
.modal-dialog,
.app-dialog,
.login-card {
  backdrop-filter: blur(16px);
}

.flash {
  border-color: rgba(212, 175, 55, 0.34);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.06));
  box-shadow: var(--shadow-gold);
}

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

.card {
  position: relative;
  overflow: hidden;
  border-color: rgba(212, 175, 55, 0.2);
  border-radius: 18px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    linear-gradient(165deg, rgba(212, 175, 55, 0.07), rgba(18, 17, 20, 0.86) 46%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -46px;
  top: -50px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.22), transparent 65%);
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 175, 55, 0.42);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38), 0 10px 30px rgba(212, 175, 55, 0.08);
}

.card-k {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-v {
  font-size: 32px;
  color: var(--gold-hi);
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.18);
}

.settings-section {
  border-radius: 18px;
  border-color: rgba(212, 175, 55, 0.18);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    linear-gradient(165deg, rgba(212, 175, 55, 0.06), rgba(17, 17, 20, 0.88) 42%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.settings-section-title {
  border-bottom-color: rgba(212, 175, 55, 0.18);
}

.table {
  border-collapse: separate;
  border-spacing: 0;
  border-color: rgba(212, 175, 55, 0.18);
  border-radius: 18px;
  background: rgba(17, 17, 20, 0.78);
  box-shadow: var(--shadow-soft);
}

.table th {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.11), rgba(212, 175, 55, 0.045));
  color: #dcc98f;
  letter-spacing: 0.04em;
}

.table th,
.table td {
  border-bottom-color: rgba(212, 175, 55, 0.12);
}

.table tbody tr {
  transition: background 0.14s ease;
}

.table tbody tr:hover {
  background: rgba(212, 175, 55, 0.045);
}

.sites-admin-table {
  overflow: visible;
}
.sites-admin-table td {
  position: relative;
}
.sites-admin-table .action-dropdown-menu {
  z-index: 1000;
}

input,
select,
textarea,
.settings-code {
  border-color: rgba(212, 175, 55, 0.2);
  background: rgba(6, 6, 8, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(212, 175, 55, 0.34);
}

.btn {
  border-radius: 11px;
  border-color: rgba(212, 175, 55, 0.26);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.14), rgba(212, 175, 55, 0.06));
  transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 175, 55, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.btn.primary {
  background: linear-gradient(135deg, #f4df95, #d4af37 48%, #9d7c27);
  box-shadow: 0 12px 28px rgba(212, 175, 55, 0.18);
}

.btn.primary:hover {
  filter: brightness(1.08) saturate(1.04);
}

.btn.danger {
  background: linear-gradient(145deg, rgba(224, 120, 120, 0.16), rgba(224, 120, 120, 0.06));
}

.tag {
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
}

.modal-backdrop,
.app-dialog-backdrop {
  background:
    radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.12), transparent 34%),
    rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-dialog,
.app-dialog {
  border-radius: 18px;
  border-color: rgba(212, 175, 55, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(17, 17, 20, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.modal-head,
.app-dialog-head {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.09), transparent 72%);
}

.settings-tabs {
  background: rgba(8, 8, 10, 0.62);
  border-color: rgba(212, 175, 55, 0.18);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.settings-tabs .settings-tab.is-active {
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.06));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.foot {
  background: rgba(5, 5, 7, 0.48);
}

@media (max-width: 900px) {
  .content {
    padding: 22px 18px 34px;
  }
  .cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  .layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
  }

  .brand {
    padding: 14px 16px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px 14px;
  }

  .nav-item {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 12px;
    white-space: nowrap;
  }

  .main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 16px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .page-title {
    font-size: 20px;
  }

  .topbar-user {
    width: 100%;
    justify-content: space-between;
    white-space: normal;
  }

  .content {
    overflow: visible;
    padding: 18px 14px 30px;
  }

  .toolbar-row,
  .domain-toolbar .domain-search-form,
  .user-toolbar-split .user-search-form,
  .site-toolbar-split .site-search-form,
  .list-toolbar-split .list-search-form {
    flex-wrap: wrap;
    width: 100%;
    max-width: none;
  }

  .list-search-form input[type="search"],
  .list-search-form input[name="q"],
  .list-search-form select,
  .theme-select {
    min-width: 0;
    width: 100%;
  }

  .list-search-form .btn,
  .list-search-form .ghost {
    flex: 1 1 auto;
    justify-content: center;
  }

  .list-toolbar-actions,
  .domain-toolbar-split > .list-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }

  .modal-backdrop,
  .app-dialog-backdrop {
    padding: 10px;
  }

  .modal-dialog,
  .app-dialog {
    width: min(100%, 560px);
    max-height: calc(100vh - 20px);
  }

  .settings-section {
    padding: 16px;
    border-radius: 16px;
  }

  .settings-tabs .settings-tab {
    min-width: calc(50% - 6px);
  }

  .settings-grid-2,
  .settings-billing-grid,
  .settings-telegram-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .settings-form-actions {
    position: sticky;
    bottom: 10px;
    z-index: 12;
    padding: 10px;
    border-radius: 14px;
    background: rgba(10, 10, 12, 0.84);
    backdrop-filter: blur(12px);
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .brand-logo,
  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .btn {
    padding: 8px 10px;
  }

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

  .settings-tabs .settings-tab {
    min-width: 100%;
  }
}
