:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-deep: #030a14;
  --panel: rgba(13, 29, 50, .86);
  --panel-2: rgba(17, 38, 65, .92);
  --line: rgba(111, 154, 207, .18);
  --line-strong: rgba(88, 150, 232, .35);
  --text: #edf6ff;
  --muted: #8ea5bf;
  --blue: #2f80ff;
  --blue-2: #185ed8;
  --green: #24d693;
  --red: #ff5578;
  --orange: #ff9f43;
  --purple: #8d61ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  font-family: Inter, "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg-deep); color: var(--text); }
body {
  background:
    radial-gradient(circle at 62% -20%, rgba(37, 107, 205, .2), transparent 36%),
    radial-gradient(circle at 92% 75%, rgba(24, 83, 165, .12), transparent 35%),
    linear-gradient(135deg, #07111f, #040a13 70%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: #9cc9ff; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(460px, 100%); padding: 38px; border: 1px solid var(--line-strong); border-radius: 22px;
  background: linear-gradient(145deg, rgba(16, 37, 64, .96), rgba(7, 17, 31, .98));
  box-shadow: 0 32px 100px rgba(0, 0, 0, .5); display: grid; gap: 25px;
}
.login-card h1 { margin: 4px 0 9px; font-size: 30px; }
.eyebrow { color: #5aa3ff; font-size: 12px; letter-spacing: .16em; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #2f8cff, #1558c7); box-shadow: 0 6px 20px rgba(47, 128, 255, .35); transform: rotate(30deg); }
.brand-mark span { width: 13px; height: 13px; border: 3px solid #bfe2ff; border-radius: 50%; }
.brand-mark.large { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.large span { width: 20px; height: 20px; }

.stack-form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #b9c9db; font-size: 13px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 11px 12px;
  color: var(--text); background: rgba(5, 14, 26, .78); outline: none; transition: .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 128, 255, .13); }
textarea { resize: vertical; }
.form-error { min-height: 20px; margin: 0; color: #ff8aa2; }

.primary, .secondary, .ghost, .icon-button, .filter, .link-button, .close-button {
  border: 0; border-radius: 8px; color: var(--text); transition: .18s ease;
}
.primary { background: linear-gradient(135deg, var(--blue), #1b67e7); padding: 10px 17px; box-shadow: 0 8px 22px rgba(47, 128, 255, .22); }
.primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.secondary { background: rgba(69, 112, 161, .13); border: 1px solid var(--line-strong); padding: 9px 16px; }
.secondary:hover, .ghost:hover, .icon-button:hover { background: rgba(74, 132, 204, .22); }
.ghost { background: transparent; padding: 8px 10px; color: var(--muted); }
.wide { width: 100%; padding: 13px; font-weight: 700; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 210px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 22, 40, .99), rgba(4, 12, 23, .99));
  display: flex; flex-direction: column; z-index: 20;
}
.brand { height: 66px; padding: 0 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); font-size: 16px; }
#nav { padding: 12px 9px; display: grid; gap: 3px; overflow-y: auto; }
.nav-item { border: 0; border-radius: 7px; color: #a8bad0; background: transparent; padding: 10px 12px; display: flex; align-items: center; gap: 11px; text-align: left; }
.nav-item i { width: 18px; text-align: center; font-style: normal; color: #b5c8dd; }
.nav-item:hover { color: #fff; background: rgba(40, 101, 183, .13); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(38, 118, 238, .75), rgba(26, 89, 186, .38)); box-shadow: inset 3px 0 #4e9cff; }
.nav-section { padding: 14px 12px 5px; color: #57718e; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }
.server-mini { margin: auto 12px 14px; padding: 13px; border-radius: 11px; border: 1px solid var(--line); background: rgba(16, 35, 57, .6); font-size: 11px; color: var(--muted); }
.server-mini div { color: #dbeaff; margin-bottom: 11px; }
.server-mini b { float: right; color: var(--green); }
.server-mini p { display: flex; justify-content: space-between; margin: 8px 0 0; }
.server-mini span { color: #b6c9dd; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); margin-right: 6px; }

.main-area { grid-column: 2; min-width: 0; }
.topbar { height: 66px; position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(5, 15, 28, .9); backdrop-filter: blur(16px); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.service-pill { padding: 6px 10px; border: 1px solid rgba(36, 214, 147, .26); border-radius: 6px; color: #9cecc8; background: rgba(36, 214, 147, .08); }
.service-pill i { display: inline-block; width: 7px; height: 7px; background: var(--green); border-radius: 50%; margin-right: 7px; }
.admin-chip { display: flex; align-items: center; gap: 8px; color: #e7f3ff; }
.avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #aec5e3, #607795); color: #10213a; font-weight: 800; }
.icon-button { width: 34px; height: 34px; background: transparent; font-size: 18px; }
.mobile-only { display: none; }

.content { padding: 22px; max-width: 1680px; margin: 0 auto; }
.view { display: none; animation: fade .2s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .5; transform: translateY(4px); } }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading h2 { margin: 0 0 5px; font-size: 25px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.date-chip { border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; color: #b7c8da; background: rgba(14, 32, 54, .65); font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card { min-height: 132px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(17, 39, 66, .88), rgba(10, 24, 43, .86)); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 100px; height: 100px; border-radius: 50%; right: -45px; top: -45px; background: var(--accent, rgba(47,128,255,.16)); filter: blur(4px); }
.stat-icon { width: 45px; height: 45px; border-radius: 10px; display: grid; place-items: center; background: var(--icon, linear-gradient(135deg,#2e8cff,#1d64e5)); font-size: 21px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.stat-value { font-size: 27px; font-weight: 760; margin: 12px 0 3px; }
.stat-label { color: var(--muted); font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(14, 32, 55, .9), rgba(8, 21, 38, .92)); box-shadow: 0 10px 30px rgba(0,0,0,.1); overflow: hidden; }
.panel.span-2 { grid-column: span 2; }
.panel-title { min-height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-title h3 { margin: 0; font-size: 14px; }
.panel-title span { color: var(--muted); font-size: 11px; }
.link-button { background: transparent; color: #5da5ff; font-size: 12px; }
.compact-list, .status-list { min-height: 210px; padding: 10px 14px; }
.compact-row, .status-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(111,154,207,.1); align-items: center; }
.compact-row:last-child, .status-row:last-child { border: 0; }
.compact-row strong, .status-row strong { font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-row small, .status-row small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 10px; background: rgba(47,128,255,.13); color: #87b9ff; border: 1px solid rgba(47,128,255,.18); }
.badge.green { background: rgba(36,214,147,.1); color: #72e8b8; border-color: rgba(36,214,147,.18); }
.badge.red { background: rgba(255,85,120,.1); color: #ff8da5; border-color: rgba(255,85,120,.2); }
.badge.orange { background: rgba(255,159,67,.1); color: #ffc078; border-color: rgba(255,159,67,.2); }

.bar-chart { height: 245px; padding: 20px 22px; display: flex; gap: 16px; align-items: end; justify-content: space-around; }
.chart-column { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 8px; color: var(--muted); font-size: 10px; }
.chart-bar { width: min(36px, 70%); min-height: 4px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #4c9bff, #246edc); box-shadow: 0 0 20px rgba(47,128,255,.18); }
.empty-state { display: grid; place-items: center; color: #5e7690; }
.donut-wrap { min-height: 210px; padding: 20px; display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 18px; }
.donut { width: 125px; height: 125px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content: ""; width: 74px; height: 74px; border-radius: 50%; background: #0c2037; position: absolute; }
.donut b { position: relative; z-index: 1; font-size: 18px; }
.legend { display: grid; gap: 9px; font-size: 11px; }
.legend div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }

.filter-row { display: flex; gap: 8px; margin-bottom: 15px; flex-wrap: wrap; }
.filter { background: rgba(18, 40, 68, .72); border: 1px solid var(--line); padding: 8px 13px; color: var(--muted); }
.filter.active { background: rgba(47,128,255,.18); border-color: rgba(47,128,255,.4); color: #cfe5ff; }
.provider-grid, .resource-grid { display: grid; grid-template-columns: repeat(3, minmax(280px, 1fr)); gap: 14px; }
.provider-card, .resource-card { border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, rgba(16,36,61,.92), rgba(8,20,36,.94)); padding: 17px; }
.provider-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.provider-title { display: flex; gap: 11px; min-width: 0; }
.provider-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg,#2f80ff,#6e57ed); font-size: 19px; flex: 0 0 auto; }
.provider-title h3, .resource-card h3 { margin: 1px 0 4px; font-size: 14px; }
.provider-title p, .resource-card p { margin: 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-meta { margin: 17px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.provider-meta div { background: rgba(4,13,24,.4); padding: 9px; border-radius: 7px; }
.provider-meta span { display: block; color: var(--muted); font-size: 9px; margin-bottom: 4px; }
.provider-meta b { font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 7px; justify-content: flex-end; }
.mini-button { border: 1px solid var(--line); border-radius: 6px; background: rgba(50,95,150,.12); color: #a8c7ea; padding: 6px 10px; font-size: 11px; }
.mini-button:hover { background: rgba(47,128,255,.2); }
.mini-button.danger { color: #ff8ba3; }
.resource-preview { height: 112px; border-radius: 8px; margin-bottom: 13px; display: grid; place-items: center; background: radial-gradient(circle, rgba(47,128,255,.18), rgba(4,13,24,.5)); font-size: 38px; }
.resource-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin: 12px 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 780px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid rgba(111,154,207,.1); font-size: 11px; }
th { color: #8ca4bd; font-weight: 600; background: rgba(18,39,65,.5); white-space: nowrap; }
td { color: #c6d5e5; }
tbody tr:hover { background: rgba(47,128,255,.04); }
.form-panel { padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .span-2 { grid-column: span 2; }
.switch-label { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.switch-label input { width: 17px; height: 17px; accent-color: var(--blue); }
.actions { display: flex; justify-content: flex-end; }

.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: none; }
.modal::backdrop { background: rgba(0, 7, 15, .76); backdrop-filter: blur(5px); }
.modal-card { width: min(480px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 15px; background: linear-gradient(145deg,#102844,#081728); box-shadow: var(--shadow); padding: 22px; }
.wide-modal { width: min(920px, calc(100vw - 28px)); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.modal-head h3 { margin: 0 0 5px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 12px; }
.close-button { background: transparent; color: var(--muted); font-size: 25px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { position: fixed; right: 22px; top: 78px; z-index: 100; max-width: 380px; padding: 12px 16px; border-radius: 9px; background: #123452; border: 1px solid #3477b7; box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #461b2a; border-color: #a83e60; }

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .provider-grid, .resource-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .main-area { grid-column: 1; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 0 12px; }
  .top-actions > a, .service-pill { display: none; }
  .content { padding: 15px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel.span-2 { grid-column: auto; }
  .provider-grid, .resource-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .page-heading { align-items: start; }
  .date-chip { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: 26px; }
  .admin-chip span:last-child { display: none; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
}
