:root {
  --bg: #08080a;
  --bg-elev: #0d0d10;
  --panel: #111114;
  --panel-2: #15151a;
  --panel-3: #1a1a20;
  --line: #232329;
  --line-soft: #1b1b21;
  --text: #ececf1;
  --text-2: #a9a9b4;
  --text-3: #6e6e7a;
  --accent: #e8e8ee;
  --green: #38d39f;
  --green-dim: rgba(56, 211, 159, 0.12);
  --amber: #f0a429;
  --amber-dim: rgba(240, 164, 41, 0.12);
  --red: #ff5c5c;
  --red-dim: rgba(255, 92, 92, 0.12);
  --blue: #5b9dff;
  --violet: #a78bfa;
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mono: 'SF Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 15% -10%, #14141c 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #101018 0%, transparent 55%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a2a32;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------- shell ------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  border-right: 1px solid var(--line-soft);
  background: rgba(10, 10, 13, 0.72);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 20px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff, #9a9aa8);
  color: #0a0a0c;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.85;
  flex: 0 0 16px;
}

.nav-item:hover {
  background: #16161c;
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-item.active svg {
  opacity: 1;
}

.nav-sep {
  height: 1px;
  background: var(--line-soft);
  margin: 8px 6px;
}

.side-foot {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.user-chip:hover {
  background: #16161c;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, #3a3a46, #1e1e26);
  color: #d8d8e2;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  flex: 0 0 30px;
}

.user-chip .who {
  min-width: 0;
}

.user-chip .who b {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .who span {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 60px;
  max-width: 1560px;
}

.loading {
  color: var(--text-3);
  padding: 40px 4px;
}

/* ------------------------------ typography ------------------------------ */

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

.page-title {
  margin: 0;
  font-size: 27px;
  font-weight: 660;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-badge {
  font-size: 11.5px;
  font-weight: 600;
  background: #1c1c23;
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ------------------------------- buttons ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #15151b;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #1b1b22;
  color: var(--text);
  border-color: #2e2e37;
}

.btn.primary {
  background: #f2f2f5;
  border-color: #f2f2f5;
  color: #0a0a0c;
  font-weight: 600;
}

.btn.primary:hover {
  background: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #ff8d8d;
  border-color: #3a2226;
  background: #1a1214;
}

.btn.danger:hover {
  background: #241518;
}

.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn.icon {
  width: 34px;
  padding: 0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  font-size: 12.5px;
}

/* -------------------------------- cards -------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card + .card {
  margin-top: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}

.card-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 0 0 16px;
}

/* ------------------------------- metrics ------------------------------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.metric .label {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric .value {
  font-size: 25px;
  font-weight: 640;
  margin-top: 8px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric .value small {
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0;
}

.metric .hint {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-3);
}

.metric.green .value {
  color: var(--green);
}
.metric.amber .value {
  color: var(--amber);
}
.metric.red .value {
  color: var(--red);
}

/* ------------------------------- tables ------------------------------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  background: #0f0f13;
}

table.data td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--text-2);
}

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

table.data tbody tr:hover td {
  background: #14141a;
}

table.data td.strong {
  color: var(--text);
  font-weight: 520;
}

.cell-main {
  color: var(--text);
  font-weight: 550;
  font-size: 13.5px;
}

.cell-sub {
  color: var(--text-3);
  font-size: 11.5px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.2px;
}

.num {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.muted {
  color: var(--text-3);
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ------------------------------- badges ------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(56, 211, 159, 0.22);
}
.badge.warn {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: rgba(240, 164, 41, 0.22);
}
.badge.err {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(255, 92, 92, 0.22);
}
.badge.info {
  color: #9fb6ff;
  background: rgba(91, 157, 255, 0.12);
  border-color: rgba(91, 157, 255, 0.22);
}
.badge.neutral {
  color: var(--text-2);
  background: #1a1a21;
  border-color: var(--line);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-2);
  background: #191920;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

/* ------------------------------ progress ------------------------------ */

.bar {
  height: 5px;
  border-radius: 99px;
  background: #24242c;
  overflow: hidden;
  width: 100%;
  min-width: 60px;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6f7bff, #a78bfa);
}

.bar.warn > i {
  background: linear-gradient(90deg, #f0a429, #ff7a45);
}
.bar.err > i {
  background: linear-gradient(90deg, #ff5c5c, #ff2f6d);
}
.bar.ok > i {
  background: linear-gradient(90deg, #38d39f, #4ade80);
}

/* ------------------------------- inputs ------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.field .hint {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.input,
.select,
textarea.input {
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0f0f13;
  padding: 0 11px;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

textarea.input {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.5;
}

.input::placeholder {
  color: #55555f;
}

.input:focus,
.select:focus,
textarea.input:focus {
  border-color: #3b3b48;
  box-shadow: 0 0 0 3px rgba(120, 120, 160, 0.12);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.search-box .input {
  padding-left: 32px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0;
}

.chip {
  border: 1px solid var(--line);
  background: #121217;
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: #33333e;
  color: var(--text);
}

.chip.active {
  background: #1e1e27;
  border-color: #3d3d4b;
  color: #fff;
}

.chip b {
  font-weight: 600;
  color: var(--text);
}

.chip .n {
  background: #23232c;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 11px;
  color: var(--text-2);
}

.chip.err .n {
  background: rgba(255, 92, 92, 0.16);
  color: #ff9a9a;
}

/* ------------------------------- toggle ------------------------------- */

.toggle {
  width: 34px;
  height: 19px;
  border-radius: 99px;
  background: #2a2a33;
  border: 1px solid #34343f;
  position: relative;
  cursor: pointer;
  transition: background 0.16s ease;
  flex: 0 0 34px;
}

.toggle::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #8b8b98;
  top: 2px;
  left: 2px;
  transition: all 0.16s ease;
}

.toggle.on {
  background: #2f6f55;
  border-color: #3f8f6d;
}

.toggle.on::after {
  left: 17px;
  background: #d7fbe9;
}

/* ------------------------------- modal ------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 5, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
  animation: fade 0.14s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(880px, 100%);
  background: linear-gradient(180deg, #16161c, #101014);
  border: 1px solid #2b2b34;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop 0.16s ease;
}

.modal.sm {
  width: min(460px, 100%);
}

.modal.md {
  width: min(620px, 100%);
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.99);
    opacity: 0;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
}

.modal-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -0.2px;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.modal-close {
  border: 0;
  background: #1b1b22;
  color: var(--text-2);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}

.modal-close:hover {
  background: #24242d;
  color: #fff;
}

.modal-body {
  padding: 4px 24px 8px;
  max-height: min(74vh, 880px);
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--line-soft);
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.section {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0f0f13;
  padding: 16px;
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.section-head .step {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #1e1e26;
  border: 1px solid #2f2f3a;
  color: var(--text-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
}

.section-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.section-head p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
}

.step-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 6px;
}

.step-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: #101015;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-card:hover {
  border-color: #3a3a46;
}

.step-card.active {
  border-color: #4a5ae8;
  box-shadow: 0 0 0 1px rgba(74, 90, 232, 0.35), 0 6px 22px rgba(74, 90, 232, 0.12);
}

.step-card .n {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
}

.step-card h5 {
  margin: 9px 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.step-card p {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.link-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.link-box .input {
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ------------------------------- toast ------------------------------- */

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #1b1b22;
  border: 1px solid #2e2e38;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  min-width: 200px;
  max-width: 420px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: slide 0.18s ease;
}

.toast.err {
  border-color: #4a2328;
  background: #23161a;
  color: #ffb4b4;
}

.toast.ok {
  border-color: #22483a;
  background: #121d18;
  color: #a8f0d4;
}

@keyframes slide {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ------------------------------- misc ------------------------------- */

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 12.5px;
}

.kv dt {
  color: var(--text-3);
}

.kv dd {
  margin: 0;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 4px;
  background: #101015;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
}

.tabs button.active {
  background: #1f1f28;
  color: #fff;
}

.spark {
  width: 100%;
  height: 64px;
  display: block;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.pager .pages {
  display: flex;
  gap: 6px;
  align-items: center;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, #15151b, #0f0f13);
  border: 1px solid #26262f;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 660;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--text-3);
  font-size: 12.5px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grow {
  flex: 1;
}

.right {
  margin-left: auto;
}

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

.code-block {
  font-family: var(--mono);
  font-size: 12px;
  background: #0b0b0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  color: #b9c4d6;
  line-height: 1.65;
  white-space: pre;
}

.window-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-2);
}

.window-pill .bar {
  width: 46px;
}

@media (max-width: 980px) {
  .sidebar {
    width: 64px;
    flex: 0 0 64px;
    align-items: center;
  }
  .brand {
    padding: 6px 0 16px;
    font-size: 0;
  }
  .nav-item {
    justify-content: center;
    padding: 10px;
    font-size: 0;
    gap: 0;
  }
  .user-chip .who,
  .side-foot .logout-text {
    display: none;
  }
  .main {
    padding: 20px 16px 50px;
  }
  .page-title {
    font-size: 22px;
  }
}

/* 复选框 */
input[type='checkbox'] {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #34343f;
  background: #101014;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}
input[type='checkbox']:checked {
  background: #5b60e8;
  border-color: #6d72ff;
}
input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}
