:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  --canvas: #0a101d;
  --navy: #0e1728;
  --panel: #131e31;
  --panel-raised: #192740;
  --field: #0e182a;
  --ink: #eaf0fc;
  --muted: #acbbd6;
  --line: #2c3c59;
  --control-line: #586d91;
  --blue: #9cbaff;
  --blue-hover: #c2d4ff;
  --primary: #90b2ff;
  --primary-hover: #adc6ff;
  --primary-ink: #0c1932;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.55; }
form, h1, h2, p, ol, ul { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #3697fe; outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

.screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 5;
  top: .75rem;
  left: .75rem;
  transform: translateY(-160%);
  padding: .5rem 1rem;
  color: var(--ink);
  background: var(--panel-raised);
}
.skip-link:focus { transform: translateY(0); }

.brand {
  display: flex;
  align-items: center;
  gap: .68rem;
  min-width: 0;
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand-icon {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding-bottom: 9px;
  gap: 2px;
  border-radius: 10px;
  background: #3869f2;
}
.brand-icon i { width: 5px; border-radius: 1.5px; background: white; }
.brand-icon i:nth-child(1) { height: 8px; opacity: .65; }
.brand-icon i:nth-child(2) { height: 12px; opacity: .82; }
.brand-icon i:nth-child(3) { height: 16px; }

.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); min-height: 100svh; }
.login-side, .hero {
  position: relative;
  isolation: isolate;
  color: white;
  overflow: hidden;
  background: radial-gradient(ellipse at 100% 10%, #244c9e 0%, transparent 61%), linear-gradient(138deg, #0e1933, #1a2d57);
}
.login-side::before, .hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .48;
  content: "";
  background-image: linear-gradient(#b1c7fb25 1px, transparent 1px), linear-gradient(90deg, #b1c7fb25 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(115deg, transparent 6%, #000 93%);
}
.login-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 7rem);
}
.login-side .brand { position: absolute; top: 2.5rem; left: clamp(2.5rem, 6vw, 7rem); }
.login-intro { max-width: 36rem; }
.login-intro h1 {
  max-width: 11em;
  font-size: clamp(2.2rem, 4vw, 4.1rem);
  line-height: 1.18;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.login-intro p { margin-top: 1.3rem; max-width: 29rem; color: #d1dcf6; font-size: 1.0625rem; }
.login-flow, .hero-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0;
  list-style: none;
}
.login-flow { margin-top: 2.5rem; gap: .6rem; }
.login-flow li { padding: .38rem .65rem; border: 1px solid #afc2f553; border-radius: 8px; color: #e9efff; font-size: .875rem; }
.login-main { display: grid; place-items: center; padding: 2rem; background: var(--canvas); }
.login-form { width: min(100%, 24rem); }
.login-form h2 { font-size: 1.8rem; line-height: 1.24; }
.login-form > p { margin: .6rem 0 2rem; color: var(--muted); }
.login-form .primary { width: 100%; margin-top: 1.2rem; }

.workspace { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100svh; }
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 1.6rem 1rem 1rem;
  background: var(--navy);
  border-right: 1px solid var(--line);
}
.sidebar .brand { padding-inline: .4rem; }
.navigation { display: grid; gap: .32rem; margin-top: 2rem; }
.nav-link, .sign-out {
  display: flex;
  align-items: center;
  gap: .62rem;
  min-height: 45px;
  padding: .6rem .72rem;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #bfcbe4;
  font-size: .9375rem;
  text-decoration: none;
  text-align: left;
  white-space: nowrap;
}
.nav-link svg, .sign-out svg { flex: none; width: 19px; height: 19px; }
.nav-link:hover, .sign-out:hover { background: #ffffff10; color: white; }
.nav-link[aria-current="page"] { color: white; font-weight: 700; background: #203b79; border-color: #4866aa62; }
.sign-out { margin-top: auto; padding: .65rem .74rem; border: 0; background: transparent; }
.workspace-body { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 68px;
  padding-inline: clamp(1.125rem, 3vw, 2.5rem);
  background: var(--navy);
  border-bottom: 1px solid var(--line);
}
.topbar p { font-size: .9375rem; font-weight: 700; }
.content { max-width: 1580px; margin-inline: auto; padding: 2rem clamp(1.125rem, 3vw, 2.5rem) 3rem; }
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: .8rem 1.2rem;
  margin-bottom: 1.35rem;
}
.page-heading h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.2; }
.page-heading p { margin-top: .5rem; color: var(--muted); }
.heading-actions:empty { display: none; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.6rem;
  min-height: 224px;
  padding: clamp(1.3rem, 3vw, 2.5rem);
  border-radius: 20px;
}
.hero h1 { font-size: clamp(1.7rem, 3.25vw, 2.8rem); line-height: 1.17; letter-spacing: -.03em; }
.hero p { max-width: 36rem; margin-top: .65rem; color: #d4e1fe; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; }
.hero-flow { gap: .4rem .7rem; max-width: 22rem; }
.hero-flow li {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .54rem .65rem;
  border: 1px solid #b6c8fa49;
  border-radius: 8px;
  color: #e3edff;
  background: #0f1d40a8;
  font-size: .875rem;
  white-space: nowrap;
}
.hero-flow li::before { width: 7px; height: 7px; border-radius: 50%; content: ""; background: #85afff; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-height: 42px;
  padding: .55rem .9rem;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
}
.button.primary { background: var(--primary); color: var(--primary-ink); }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { border-color: var(--control-line); background: var(--panel); color: var(--ink); }
.button.secondary:hover { background: var(--panel-raised); }
.button.compact { min-height: 37px; padding: .43rem .68rem; }
.button.on-hero { background: var(--primary); color: var(--primary-ink); }
.button.on-hero:hover { background: var(--primary-hover); }
.button.outline-hero { color: white; background: #ffffff10; border-color: #c7d4fa66; }
.button.outline-hero:hover { background: #ffffff28; }
.link-button {
  padding: .17rem 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
}
.link-button:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 3px; }
.icon-button {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
}
.icon-button:hover { color: var(--ink); background: var(--panel-raised); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; margin-block: 1rem; }
.metric {
  position: relative;
  min-height: 124px;
  padding: .95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.metric p { margin-top: .45rem; color: var(--muted); font-size: .875rem; }
.metric strong { display: block; font-size: 1.75rem; line-height: 1.14; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; }
.metric-icon svg { width: 19px; height: 19px; }
.tone-blue { color: #abc5ff; background: #243866; }
.tone-violet { color: #d7beff; background: #382c56; }
.tone-cyan { color: #92e3fa; background: #193c4d; }
.tone-amber { color: #ffdc91; background: #433721; }
.tone-green { color: #9de8bb; background: #1d3d38; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card-heading { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.card-heading h2 { font-size: 1.05rem; }
.integration-list { padding: 0 1rem; list-style: none; }
.integration-list li { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .78rem 0; }
.integration-list li + li { border-top: 1px solid var(--line); }
.integration-list strong { font-size: .9375rem; }
.integration-list p, .subtext { color: var(--muted); font-size: .875rem; }
.integration-list p { margin-top: .1rem; }
.badge { display: inline-block; border-radius: 6px; padding: .22rem .52rem; font-size: .875rem; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.is-good { color: #9ce9ba; background: #203e37; }
.is-warning { color: #ffdb93; background: #49371e; }
.is-error { color: #ffc0cb; background: #512e3d; }
.is-neutral { color: #c5d4f0; background: #29374f; }
.empty { display: grid; justify-items: center; gap: .4rem; padding: 2.5rem 1rem; text-align: center; }
.empty strong { font-size: 1rem; }
.empty p { color: var(--muted); font-size: .9375rem; }
.empty .link-button { margin-top: .2rem; }
.table-wrap { overflow-x: auto; border-radius: inherit; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .82rem 1rem; vertical-align: middle; }
th { color: var(--muted); background: var(--field); font-size: .875rem; font-weight: 650; white-space: nowrap; }
td { font-size: .9375rem; }
td:has(.tf), td:last-child { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-raised); }
.subtext { display: block; margin-top: .15rem; }
.detail { max-width: 26rem; min-width: 8rem; overflow-wrap: anywhere; white-space: normal; }
.truncate { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .8rem; }
.table-filters { display: flex; flex-wrap: wrap; gap: .65rem; padding: .85rem; border-bottom: 1px solid var(--line); }
.table-filters label:first-child { flex: 1 1 15rem; max-width: 24rem; }

.field { display: grid; min-width: 0; gap: .32rem; align-content: start; color: var(--ink); }
.field > span { font-size: .9rem; font-weight: 650; }
.field small, .muted, .optional { color: var(--muted); font-size: .875rem; font-weight: 400; }
input:not([type=checkbox]), textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: .5rem .65rem;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--field);
}
input::placeholder, textarea::placeholder { color: #9cadce; }
input[readonly] { color: var(--muted); background: var(--panel-raised); }
textarea { resize: vertical; }
textarea[name="html"] { font-family: "Cascadia Mono", Consolas, monospace; font-size: .90625rem; }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 1.02rem center, right .72rem center;
  background-size: .31rem .31rem;
  background-repeat: no-repeat;
}
.input-prefix { display: flex; }
.input-prefix > span { display: grid; place-items: center; padding-inline: .55rem; border: 1px solid var(--control-line); border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); background: var(--panel-raised); }
.input-prefix input { border-radius: 0 8px 8px 0; }
.checkbox { display: flex; gap: .55rem; align-items: center; width: fit-content; }
.checkbox input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.form-error { border: 1px solid #875067; border-radius: 8px; color: #ffc3cd; background: #41263a; padding: .65rem .75rem; overflow-wrap: anywhere; }
.login-form .form-error { margin-top: .7rem; }

.dialog {
  width: min(720px, calc(100% - 1.25rem));
  padding: 0;
  max-height: min(90svh, 54rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 25px 80px #0009;
}
.dialog::backdrop { background: #020612b8; }
.dialog form { display: flex; flex-direction: column; max-height: min(90svh, 54rem); }
.dialog-header, .dialog-footer {
  display: flex;
  align-items: center;
  flex: none;
  gap: .65rem;
  padding: .75rem 1rem;
  background: var(--navy);
}
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 1.2rem; }
.dialog-footer { justify-content: end; border-top: 1px solid var(--line); }
.dialog-body { overflow-y: auto; padding: 1rem; overscroll-behavior: contain; }
.dialog-error { margin: .3rem 1rem .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.span-two { grid-column: 1 / -1; }
.upload-line { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.upload-button { cursor: pointer; }
.upload-line:focus-within .upload-button { outline: 3px solid #3697fe; outline-offset: 3px; }
.number-rows { display: grid; gap: .65rem; margin-bottom: .65rem; }
.number-help { margin-bottom: .65rem; }
.number-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: .55rem; }
.number-row .remove-number { margin-bottom: .18rem; border-color: var(--line); }
.notice {
  position: fixed;
  z-index: 10;
  right: 1rem;
  bottom: 1rem;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: .72rem 1rem;
  border-radius: 9px;
  color: white;
  background: #243b64;
  border: 1px solid #59729c;
  box-shadow: 0 10px 28px #0006;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .hero-flow { max-width: 12rem; flex-wrap: wrap; }
}

@media (max-width: 930px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.4rem), 1fr)); }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 740px) {
  .login { grid-template-columns: minmax(0, 1fr); align-content: start; background: var(--canvas); }
  .login-side { padding: 1.2rem 1.15rem 1.55rem; }
  .login-side .brand { position: static; margin-bottom: 1.2rem; }
  .login-intro h1 { max-width: 18em; font-size: clamp(1.55rem, 5.5vw, 2.1rem); }
  .login-intro p { margin-top: .6rem; font-size: 1rem; }
  .login-flow { margin-top: .8rem; gap: .3rem; }
  .login-flow li { padding: .27rem .45rem; }
  .login-main { padding: 1.5rem 1.15rem 2rem; }
  .login-form h2 { font-size: 1.45rem; }
  .login-form > p { margin: .4rem 0 1rem; }
  .workspace { display: block; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
    min-height: initial;
    padding: .85rem .75rem .65rem;
    border-right: 0;
  }
  .navigation { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: .24rem; margin-top: 0; }
  .nav-link { min-height: 39px; padding: .39rem .45rem; gap: .3rem; font-size: .875rem; }
  .nav-link svg, .sign-out svg { width: 16px; height: 16px; }
  .sign-out { grid-column: 2; grid-row: 1; margin-top: 0; min-height: 35px; padding: .3rem; font-size: .875rem; gap: .27rem; }
  .topbar { min-height: 53px; padding-inline: .95rem; }
  .content { padding: 1rem .85rem 2rem; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; gap: .9rem; border-radius: 14px; }
  .hero-flow { max-width: none; gap: .4rem; }
  .hero-flow li { padding: .3rem .45rem; }
  .metrics { gap: .65rem; }
  .metric { min-height: 108px; padding: .72rem; }
  .metric strong { font-size: 1.45rem; }
  th, td { padding: .68rem .75rem; }
}

@media (max-width: 430px) {
  .nav-link svg { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-two { grid-column: auto; }
  .number-row { grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--line); padding: .58rem; border-radius: 8px; }
  .number-row .field { grid-column: 1; }
  .number-row .remove-number { grid-column: 2; grid-row: 1; align-self: start; }
}
