:root {
  color-scheme: light;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  --ink: #17233d;
  --quiet: #59677f;
  --line: #e2e7f0;
  --blue: #345be5;
  --deep-blue: #2549c8;
  --paper: #f4f6fb;
  --nav: #111a2d;
  --shadow: 0 2px 12px #202e5106;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 2px solid #6180f0; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 32px); letter-spacing: -.04em; }
h2 { font-size: 17px; letter-spacing: -.015em; }
small { font-size: 12px; }

.loading { min-height: 100vh; display: grid; place-items: center; color: var(--quiet); }
.page-loading { padding: 24px 0; color: var(--quiet); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }

.sidebar {
  height: 100dvh; min-height: 0; position: sticky; top: 0;
  display: flex; flex-direction: column; padding: 24px 16px 16px;
  color: #aebbd1; background: var(--nav); border-right: 1px solid #ffffff0c;
}
.identity { display: flex; align-items: center; gap: 12px; color: #f8faff; }
.identity strong { font-size: 19px; font-weight: 750; letter-spacing: -.025em; }
.sidebar-brand { flex: none; margin: 0 8px 21px; padding: 0 0 24px; border-bottom: 1px solid #ffffff13; }
.sidebar-brand span:not(.brand-mark) { display: grid; gap: 2px; }
.sidebar-brand small { color: #a7b3cb; }
.brand-mark {
  width: 39px; height: 39px; border-radius: 12px; background: linear-gradient(150deg,#7896ff,#3e63e9 73%);
  display: inline-flex; justify-content: center; align-items: center; gap: 3px; flex: none;
  box-shadow: 0 6px 14px #3157e84c, inset 0 1px 0 #ffffff52;
}
.brand-mark i { display: block; width: 4px; height: 15px; background: #fff; border-radius: 3px; transform: skewY(-20deg); }
.brand-mark i:nth-child(2) { height: 20px; opacity: .9; }
.brand-mark i:nth-child(3) { height: 11px; opacity: .8; }
.sidebar nav { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-group { margin-top: 25px; }
.nav-group p { margin: 0 0 8px 12px; color: #93a3c1; font-size: 12px; font-weight: 600; }
.nav-link {
  min-height: 43px; display: flex; align-items: center; gap: 12px;
  margin: 3px 0; padding: 0 12px; border-radius: 8px; font-weight: 550;
}
.nav-link:hover { background: #ffffff0c; color: white; }
.nav-link.current { color: #fff; background: #263a68; box-shadow: inset 3px 0 #7896ff; }
.nav-link.current .icon { color: #aec0ff; }
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 18px 7px 4px; border-top: 1px solid #ffffff13;
}
.avatar {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; background: #dfe8ff; color: #294ac2; font-weight: 750;
}
.account-name { display: grid; gap: 2px; min-width: 0; }
.account-name strong { color: #f6f8fd; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.account-name small { color: #9aa9c4; }
.signout {
  margin-left: auto; border: 0; background: transparent; color: #c0cce1;
  border-radius: 8px; width: 34px; height: 34px; font-size: 22px;
}
.signout:hover { background: #ffffff13; color: white; }

.topbar {
  border-bottom: 1px solid var(--line); background: #fff; min-height: 61px; padding: 0 clamp(20px, 3vw, 44px);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--quiet); font-size: 13px;
}
.topbar i { margin: 0 5px; color: #8795aa; font-style: normal; }
.topbar strong { color: var(--ink); }
.refresh {
  display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line);
  background: white; color: var(--quiet); padding: 7px 11px; border-radius: 7px; white-space: nowrap;
}
.refresh:hover, .outline:hover { color: var(--blue); border-color: #aebdf6; background: #f8faff; }
.content { max-width: 1560px; margin: 0 auto; padding: 31px clamp(20px, 3vw, 44px) 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-heading p { margin-top: 8px; color: var(--quiet); line-height: 1.55; }
.hero {
  min-height: 185px; padding: 31px 35px; margin-bottom: 21px; position: relative; isolation: isolate;
  overflow: hidden; color: #fff; display: flex; align-items: center; border-radius: 14px;
  background: radial-gradient(ellipse at 86% -5%, #3e62c7 0, transparent 59%), linear-gradient(111deg,#142346,#263e80);
  box-shadow: 0 8px 22px #203b7821;
}
.hero h2 { font-size: 25px; letter-spacing: -.025em; }
.hero p { color: #dce5ff; margin: 9px 0 19px; }
.hero a { display: inline-flex; align-items: center; gap: 13px; padding: 8px 13px; border: 1px solid #ffffff45; border-radius: 8px; background: #ffffff17; }
.hero a:hover { background: #ffffff2f; }
.hero-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.hero-art::before {
  content: ""; position: absolute; width: 54%; height: 160%; left: 55%; top: -22%; opacity: .25;
  background: radial-gradient(circle, #c4d8ff 1px, transparent 1.5px) 0 0 / 18px 18px;
  mask-image: linear-gradient(90deg,transparent,black);
}
.hero-art i {
  position: absolute; top: -32px; right: 2%; width: 32%; height: 235px;
  border: 1px solid #b7c8ff66; border-radius: 34px; transform: rotate(-21deg) skewX(-9deg);
  background: linear-gradient(130deg,#aec4ff32,transparent 63%);
}
.hero-art i:nth-child(2) { top: -8px; right: 5%; }
.hero-art i:nth-child(3) { top: 16px; right: 8%; }
.hero-art i:nth-child(4) { top: 40px; right: 11%; }

.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin-bottom: 22px; }
.metric, .panel { background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.metric { display: flex; align-items: center; gap: 14px; min-height: 89px; padding: 16px; }
.metric div { display: grid; gap: 3px; }
.metric small { color: var(--quiet); }
.metric strong { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.tile { display: inline-grid; place-items: center; flex: none; width: 41px; height: 41px; border-radius: 11px; }
.blue { background: #edf2ff; color: #345be5; }
.violet { background: #f2edff; color: #704fcb; }
.green { background: #e6f5ef; color: #168267; }
.amber { background: #fff3df; color: #9e5d0d; }

.overview-panels { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel-heading { padding: 20px 20px 15px; }
.directory-row {
  display: flex; align-items: center; gap: 12px; min-height: 72px;
  padding: 12px 20px; border-top: 1px solid #edf0f5;
}
.directory-row:hover { background: #f8faff; }
.directory-row:last-child { border-radius: 0 0 13px 13px; }
.directory-copy { flex: 1; display: grid; gap: 6px; }
.directory-copy small, .directory-count, .chevron { color: var(--quiet); }
.directory-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.chevron { font-size: 22px; line-height: 1; }
.shortcuts .directory-row { min-height: 55px; gap: 12px; }
.shortcuts .directory-row > .icon { color: #516ba7; }
.shortcuts .chevron { margin-left: auto; }

.primary, .outline, .subtle, .danger {
  border: 1px solid transparent; border-radius: 8px; min-height: 36px;
  padding: 7px 12px; font-weight: 600; white-space: nowrap;
}
.primary { color: #fff; background: var(--blue); box-shadow: 0 4px 10px #345be523; }
.primary:hover { background: var(--deep-blue); }
.outline { background: #fff; border-color: var(--line); color: var(--quiet); }
.subtle { border: 0; background: transparent; color: #2b50c8; }
.subtle:hover { background: #edf2ff; }
.danger { background: #b9273a; color: white; }
.danger:hover { background: #a21d2e; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; }
.list-toolbar form { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.list-toolbar input { width: min(285px, 42vw); min-height: 36px; }
.list-count { color: var(--quiet); white-space: nowrap; font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { border-top: 1px solid #e9edf4; padding: 12px 15px; overflow-wrap: anywhere; }
th { background: #f7f9fd; color: #53647f; font-weight: 650; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td:last-child { white-space: nowrap; }
td .subtle { padding-inline: 8px; font-size: 13px; }
tr:hover td { background: #fbfcff; }
.cell-identity { display: grid; gap: 5px; min-width: 105px; }
.cell-identity small { color: var(--quiet); }
.badge {
  display: inline-block; font-size: 12px; padding: 4px 8px;
  border-radius: 6px; white-space: nowrap; background: #edf0f5; color: #55647d;
}
.badge.active, .badge.live { background: #e6f6ee; color: #126747; }
.badge.changed, .badge.scheduled { background: #fff1db; color: #885210; }
.badge.revoked, .badge.disabled { background: #ffebed; color: #982a3b; }
.empty { border-top: 1px solid var(--line); display: grid; place-items: center; align-content: center; gap: 12px; min-height: 218px; color: var(--quiet); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 15px 20px; border-top: 1px solid var(--line); }
.failure { padding: 25px; display: flex; gap: 16px; align-items: center; }

input, select, textarea {
  width: 100%; min-width: 0; min-height: 40px; border: 1px solid #d9e1ed;
  border-radius: 8px; padding: 9px 11px; background: white; color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: #6d87ee; outline: 2px solid #dce5ff; outline-offset: 0; }
input[readonly] { color: var(--quiet); background: #f4f6fa; }
textarea { resize: vertical; line-height: 1.55; }
label { display: grid; align-content: start; gap: 7px; min-width: 0; color: #34445e; font-size: 13px; font-weight: 600; }
label input, label textarea, label select { font-weight: 400; }
.error { font-size: 13px; color: #a72437; overflow-wrap: anywhere; }
.error:empty { display: none; }
#notice {
  position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: calc(100% - 48px);
  color: white; background: #233c65; border-radius: 10px; padding: 12px 16px; box-shadow: 0 8px 25px #13233e32;
}
#notice:empty { display: none; }
#notice.notice-error { background: #a52b3c; }

dialog {
  border: 1px solid var(--line); border-radius: 15px; padding: 0; width: min(640px, calc(100vw - 24px));
  max-height: min(86dvh, 860px); color: var(--ink); box-shadow: 0 24px 80px #101b3b40;
}
dialog::backdrop { background: #0b15365e; }
.dialog-form { display: flex; flex-direction: column; max-height: min(85dvh, 850px); }
.dialog-header, .dialog-footer { padding: 15px 22px; flex: none; display: flex; align-items: center; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-footer { justify-content: end; gap: 8px; border-top: 1px solid var(--line); }
.dialog-content { overflow-y: auto; padding: 19px 22px; display: grid; gap: 14px; min-height: 0; }
.close { border: 0; border-radius: 7px; background: #f2f4f9; color: var(--quiet); width: 32px; height: 32px; font-size: 20px; }
.close:hover { background: #e7ecf7; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.connections { border: 1px solid var(--line); border-radius: 9px; padding: 10px; min-width: 0; margin: 0; }
.connections legend, summary { font-size: 13px; color: #34445e; font-weight: 600; }
.connections small { margin-left: 8px; color: var(--quiet); }
.connection-row { display: flex; gap: 8px; margin: 0 0 8px; }
.connection-row select:first-child { flex: 2; }
.connection-row select { flex: 1; }
details label { margin-top: 10px; }
summary { cursor: pointer; }
.code-input { font-family: Consolas, monospace; }
.confirm-copy { line-height: 1.6; color: var(--quiet); }

.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.08fr 1fr; }
.auth-intro {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 82% 67%, #2b4b9d, transparent 62%), #111c39;
  color: white; padding: 47px clamp(32px,7vw,96px);
}
.auth-heading { margin: auto 0; padding-bottom: 42px; }
.auth-heading h1 { font-size: clamp(34px,5vw,66px); line-height: 1.12; }
.auth-heading p { color: #d3def9; margin-top: 18px; font-size: 16px; }
.auth-geometry { position: absolute; z-index: -1; inset: 0; overflow: hidden; }
.auth-geometry span {
  position: absolute; width: 55%; height: 54%; right: -16%; bottom: -2%; transform: rotate(-26deg);
  border: 1px solid #a7beff50; border-radius: 38px; background: linear-gradient(140deg,#7d9cff2c,transparent 62%);
}
.auth-geometry span:nth-child(2) { right: -8%; bottom: -8%; }
.auth-geometry span:nth-child(3) { right: 0; bottom: -14%; }
.auth-main { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle,#dbe3f2 1px,transparent 1.2px) 0 0 / 20px 20px,#f5f7fc; }
.auth-card {
  width: min(410px,100%); background: #fff; border: 1px solid #ecf0f7; border-radius: 20px;
  display: grid; gap: 18px; padding: 34px; box-shadow: 0 16px 49px #24396315;
}
.auth-card h2 { font-size: 24px; margin-bottom: 5px; }
.auth-card .primary { margin-top: 2px; min-height: 42px; }
.auth-brand { display: none; color: var(--ink); }

.icon { position: relative; display: inline-block; width: 18px; height: 18px; flex: none; color: inherit; }
.icon::before, .icon::after { position: absolute; box-sizing: border-box; content: ""; }
.i-grid::before { width: 6px; height: 6px; border-radius: 1px; background: currentColor; top: 2px; left: 2px; box-shadow: 8px 0, 0 8px, 8px 8px; }
.i-user::before { width: 7px; height: 7px; border: 1.6px solid; border-radius: 50%; top: 0; left: 5.5px; }
.i-user::after { width: 15px; height: 8px; border: 1.6px solid; border-radius: 7px 7px 3px 3px; top: 9px; left: 1.5px; }
.i-device::before { top: 2px; left: 1px; width: 16px; height: 11px; border: 1.6px solid; border-radius: 3px; }
.i-device::after { width: 8px; height: 1.6px; top: 15px; left: 5px; background: currentColor; }
.i-ticket::before { top: 4px; left: 1px; width: 16px; height: 11px; border: 1.6px solid; border-radius: 3px; }
.i-ticket::after { width: 4px; height: 5px; border-right: 1.5px dashed; bottom: 6px; left: 7px; }
.i-layers::before, .i-layers::after { width: 11px; height: 11px; left: 3.5px; transform: rotate(45deg) skew(-8deg,-8deg); border: 1.5px solid; border-radius: 2px; }
.i-layers::before { top: 1px; }
.i-layers::after { top: 5px; border-top-color: transparent; border-left-color: transparent; }
.i-film::before { top: 2px; left: 1px; width: 16px; height: 14px; border: 1.6px solid; border-radius: 3px; }
.i-film::after { top: 6px; left: 7px; border-left: 5px solid; border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.i-component::before { top: 2px; left: 2px; width: 14px; height: 14px; transform: rotate(45deg) scale(.8); border: 1.7px solid; border-radius: 3px; }
.i-component::after { width: 5px; height: 5px; border-radius: 1px; top: 6.5px; left: 6.5px; background: currentColor; }
.i-refresh::before { inset: 3px; border: 1.5px solid; border-right-color: transparent; border-radius: 50%; }
.i-refresh::after { top: 2px; right: 2px; width: 5px; height: 5px; border-bottom: 1.5px solid; border-right: 1.5px solid; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 195px minmax(0,1fr); }
  .metrics { gap: 9px; }
  .metric { padding: 12px; gap: 8px; }
  .metric .tile { width: 33px; height: 33px; }
}
@media (max-width: 800px) {
  .auth { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-brand { display: flex; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-panels { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; padding: 11px 12px 7px; gap: 10px; }
  .sidebar-brand { border: 0; padding: 0; margin: 0; }
  .sidebar-foot { grid-column: 2; grid-row: 1; border: 0; gap: 5px; padding: 0; }
  .avatar { display: none; }
  .account-name { max-width: 100px; }
  .sidebar nav { grid-row: 2; grid-column: 1/-1; display: flex; gap: 4px; overflow-x: auto; }
  .nav-group { display: flex; gap: 4px; margin: 0; }
  .nav-group p { display: none; }
  .nav-link { white-space: nowrap; gap: 7px; min-height: 36px; padding: 0 9px; }
  .content, .topbar { padding-inline: 14px; }
  .topbar { min-height: 51px; }
  .page-heading { margin-bottom: 17px; }
  .content { padding-top: 23px; }
  .hero { padding: 21px; min-height: 166px; }
  .list-toolbar { padding: 12px; }
  .list-count { display: none; }
  td:last-child { white-space: normal; min-width: 84px; }
}
@media (max-width: 385px) {
  .form-grid { grid-template-columns: 1fr; }
  .connection-row { flex-wrap: wrap; }
  .connection-row select { min-width: 105px; }
  .hero-art { opacity: .48; }
}
