:root {
  --navy: #091426;
  --navy-soft: #10233e;
  --canvas: #f3f7fc;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --text: #17243a;
  --muted: #718096;
  --border: #dce6f2;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --cyan: #06b6d4;
  --teal: #14b8a6;
  --violet: #7c3aed;
  --orange: #f97316;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 20px 50px rgba(24, 42, 73, .10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--canvas);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  color: white;
  background:
    radial-gradient(circle at 15% 4%, rgba(6, 182, 212, .19), transparent 28%),
    linear-gradient(180deg, var(--navy), #07101f);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 9px 30px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(125, 211, 252, .48);
  border-radius: 12px;
  color: #c9f5ff;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(145deg, rgba(37, 99, 235, .58), rgba(6, 182, 212, .22));
  box-shadow: 0 10px 26px rgba(6, 182, 212, .15);
}

.brand strong { display: block; letter-spacing: .15em; font-size: 16px; }
.brand span { display: block; margin-top: 4px; color: #7dd3fc; font-size: 9px; letter-spacing: .17em; }

nav { display: grid; gap: 7px; }

.nav-item {
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 10px;
  color: #b9c7da;
  text-align: left;
  background: transparent;
  transition: .18s ease;
}

.nav-item span {
  display: inline-block;
  width: 34px;
  color: #5f7897;
  font-size: 11px;
  font-weight: 700;
}

.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active {
  color: white;
  background: linear-gradient(90deg, rgba(37, 99, 235, .46), rgba(37, 99, 235, .13));
  box-shadow: inset 3px 0 #38bdf8;
}
.nav-item.active span { color: #7dd3fc; }

.server-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(125, 211, 252, .15);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 5px rgba(74, 222, 128, .1);
}
.server-card strong { display: block; font-size: 12px; }
.server-card small { display: block; margin-top: 4px; color: #8296b1; font-size: 9px; }

.main { min-width: 0; }

.topbar {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -.02em; }
h2 { margin-bottom: 8px; font-size: 18px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  transition: .18s ease;
}
.button.primary {
  color: white;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .19);
}
.button.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 235, .27); }
.button.ghost { color: #40526c; border-color: var(--border); background: white; }
.button.ghost:hover { border-color: #b9cae0; background: var(--surface-alt); }
.button.danger { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.button.wide { width: 100%; min-height: 46px; }

.avatar {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  color: #e0f2fe;
  font-weight: 800;
  background: var(--navy-soft);
}

.content { padding: 24px 30px 40px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(30, 52, 83, .045);
}
.stat-card::after {
  position: absolute;
  right: -23px;
  top: -27px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: .075;
}
.stat-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin: 8px 0 5px; color: var(--text); font-size: 30px; letter-spacing: -.04em; }
.stat-card small { color: #91a0b4; }
.stat-card.blue { color: var(--blue); border-top: 3px solid var(--blue); }
.stat-card.teal { color: var(--teal); border-top: 3px solid var(--teal); }
.stat-card.violet { color: var(--violet); border-top: 3px solid var(--violet); }
.stat-card.orange { color: var(--orange); border-top: 3px solid var(--orange); }

.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(30, 52, 83, .055);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin-bottom: 5px; }
.panel-head p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 9px; }

input, select, textarea {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: var(--surface-alt);
}
input:focus, select:focus, textarea:focus {
  border-color: #85aaf7;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .09);
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1020px; }
th, td { padding: 14px 15px; border-bottom: 1px solid #edf2f7; text-align: left; vertical-align: middle; }
th { color: #78889e; font-size: 11px; font-weight: 800; background: #fbfdff; }
td { color: #35455d; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }

.license-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #1e3a5f;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-weight: 700;
  letter-spacing: .02em;
}
.copy-mini {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--blue);
  background: white;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.badge.green { color: #15803d; background: #ecfdf3; }
.badge.red { color: #b91c1c; background: #fef2f2; }
.badge.blue { color: #1d4ed8; background: #eff6ff; }
.badge.violet { color: #6d28d9; background: #f5f3ff; }
.badge.orange { color: #c2410c; background: #fff7ed; }
.badge.gray { color: #59677b; background: #f1f5f9; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-action {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #496079;
  font-size: 10px;
  font-weight: 700;
  background: white;
}
.row-action:hover { color: var(--blue); border-color: #b7c9e3; }
.row-action.warning { color: #c2410c; }
.link-action { display: inline-flex; align-items: center; text-decoration: none; }
.actions-column { min-width: 220px; }
.empty { padding: 46px; color: var(--muted); text-align: center; }

.update-layout {
  display: grid;
  gap: 20px;
}

.update-form {
  padding: 22px;
}

.update-form label {
  display: grid;
  gap: 8px;
  color: #44546b;
  font-size: 12px;
  font-weight: 700;
}

.update-form textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.6;
}

.update-form input[type="file"] {
  padding: 7px;
  background: white;
}

.update-form input[type="file"]::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #1d4ed8;
  font-weight: 700;
  background: #eaf1ff;
}

.check-line {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  margin-top: 15px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f4f8ff;
}

.check-line input {
  width: 17px;
  min-height: 17px;
  margin: 0;
}

.upload-progress {
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid #c7d9f7;
  border-radius: 10px;
  background: #f7faff;
}

.upload-progress > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: #385477;
  font-size: 11px;
}

.upload-progress progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe7f5;
}

.upload-progress progress::-webkit-progress-bar { background: #dbe7f5; }
.upload-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.publish-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}

.publish-actions small { color: var(--muted); }
.updates-table { min-width: 1080px; }
.updates-table td { max-width: 310px; }
.version-number { display: block; color: #12396b; font-size: 15px; }
.version-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.hash-value {
  display: block;
  margin-top: 5px;
  color: #8a9aae;
  font-family: "Cascadia Mono", Consolas, monospace;
}
.release-notes { color: #53657c; line-height: 1.6; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 13, 27, .66);
  backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 16px;
  background: white;
  box-shadow: 0 30px 90px rgba(0,0,0,.25);
}
.login-card { width: min(440px, 100%); padding: 36px; }
.login-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--teal));
  content: "";
}
.login-brand { margin-bottom: 25px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.login-card p, .modal-note { color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-card small { display: block; margin-top: 15px; color: #93a1b4; text-align: center; }

.modal label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #44546b;
  font-size: 12px;
  font-weight: 700;
}
.modal-close {
  position: absolute;
  right: 17px;
  top: 15px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: #718096;
  font-size: 24px;
  background: #f3f6fa;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.form-message { min-height: 21px; padding-top: 7px; color: var(--red); font-size: 11px; }
.result-modal textarea { width: 100%; height: 220px; resize: vertical; font-family: Consolas, monospace; line-height: 1.7; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: 360px;
  padding: 13px 17px;
  border-radius: 10px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  background: #10233e;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .nav-item:not(.active)::after, .server-card div { display: none; }
  .nav-item { padding: 13px 5px; text-align: center; font-size: 0; }
  .nav-item span { width: auto; font-size: 11px; }
  .server-card { justify-content: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px; flex-direction: row; align-items: center; }
  .brand { padding: 0; }
  .brand > div:last-child { display: block; }
  nav { display: flex; margin-left: auto; }
  .nav-item { width: 46px; }
  .server-card { display: none; }
  .topbar { padding: 15px 18px; align-items: flex-start; }
  .top-actions .ghost, .avatar { display: none; }
  .content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 108px; padding: 15px; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .filters { width: 100%; }
  .filters > * { flex: 1; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}
