:root {
  color-scheme: dark;
  --bg: #10110f;
  --surface: #181a17;
  --surface-strong: #20231e;
  --ink: #f1efe7;
  --muted: #9ea096;
  --line: rgba(241, 239, 231, 0.14);
  --accent: #f06a2b;
  --accent-soft: rgba(240, 106, 43, 0.14);
  --ok: #a9d46e;
  --warn: #e6bd5d;
  --bad: #f17a70;
  --shadow: rgba(0, 0, 0, 0.34);
  --display: "Avenir Next Condensed", "DIN Alternate", "PingFang SC", sans-serif;
  --body: "Avenir Next", "PingFang SC", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #e9e6dc;
  --surface: #f6f3ea;
  --surface-strong: #dedbcf;
  --ink: #1d1f1b;
  --muted: #666a61;
  --line: rgba(29, 31, 27, 0.16);
  --accent: #d94f12;
  --accent-soft: rgba(217, 79, 18, 0.12);
  --ok: #4d7d24;
  --warn: #86620b;
  --bad: #b82f27;
  --shadow: rgba(51, 47, 36, 0.14);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% 4%, var(--accent-soft), transparent 28rem),
    linear-gradient(120deg, transparent 0 63%, rgba(255,255,255,.022) 63% 63.2%, transparent 63.2%),
    var(--bg);
  font-family: var(--body);
  line-height: 1.5;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

button, input, select { font: inherit; }
button { color: inherit; }

.masthead {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--accent); color: #111; font: 800 22px/1 var(--display); transform: skew(-8deg);
}
.brand strong { display: block; letter-spacing: .16em; font: 700 15px/1 var(--display); }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; letter-spacing: .14em; }
.masthead-actions { display: flex; align-items: center; gap: 14px; }
.masthead-actions form { margin: 0; }
.signed-in-user { color: var(--muted); font-size: 12px; }
.environment { padding: 5px 9px; border: 1px solid var(--line); color: var(--muted); font: 700 10px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: .2s ease; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; }
.hero { min-height: 520px; display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 9vw; padding: 92px 0 78px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 18px; color: var(--accent); font: 700 11px/1 var(--display); letter-spacing: .18em; }
.hero h1 { margin: 0; max-width: 940px; font: 650 clamp(50px, 7vw, 112px)/.94 var(--display); letter-spacing: -.045em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-note { align-self: end; padding: 24px 0 0 28px; border-left: 1px solid var(--line); }
.hero-note p { margin: 16px 0 28px; max-width: 370px; font-size: 17px; }
.hero-note small { color: var(--muted); }
.live-dot { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 18%, transparent); }

section { padding: 74px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.section-heading h2, .guardrail h2, dialog h2 { margin: 0; font: 620 clamp(30px, 3.5vw, 54px)/1 var(--display); letter-spacing: -.025em; }
.section-copy { max-width: 480px; margin: 0; color: var(--muted); }
.text-button { border: 0; padding: 8px 0; border-bottom: 1px solid currentColor; background: transparent; cursor: pointer; }
.text-button:hover { color: var(--accent); }
.primary-button { border: 1px solid var(--accent); padding: 11px 17px; background: var(--accent); color: #15120f; font-weight: 700; cursor: pointer; box-shadow: 5px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.primary-button:hover { transform: translate(2px,2px); box-shadow: 3px 3px 0 var(--ink); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.service-card { position: relative; min-height: 230px; padding: 25px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 20px 50px -35px var(--shadow); }
.service-card::after { content: attr(data-index); position: absolute; right: 12px; bottom: -26px; color: var(--surface-strong); font: 800 110px/1 var(--display); }
.service-card .card-top { display: flex; justify-content: space-between; gap: 12px; }
.service-card h3 { margin: 36px 0 10px; font: 620 28px/1 var(--display); }
.service-card p { position: relative; z-index: 1; max-width: 320px; margin: 0; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; font: 700 10px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.healthy { color: var(--ok); }.status.degraded { color: var(--warn); }.status.unreachable { color: var(--bad); }
.latency { color: var(--muted); font: 600 11px/1 var(--display); }
.loading span { display: block; height: 12px; margin-bottom: 16px; background: linear-gradient(90deg, var(--surface-strong), var(--line), var(--surface-strong)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.loading span:nth-child(2) { width: 62%; margin-top: 52px; height: 25px; }.loading span:nth-child(3) { width: 84%; }

.region-map { display: grid; grid-template-columns: 1fr 70px 1fr; gap: 18px; align-items: stretch; }
.region-card { border: 1px solid var(--line); background: var(--surface); padding: 28px; }
.region-card h3 { margin: 0 0 6px; font: 650 34px/1 var(--display); }
.region-card > p { margin: 0 0 28px; color: var(--muted); }
.region-card h4 { margin: 22px 0 8px; color: var(--accent); font: 700 10px/1 var(--display); letter-spacing: .14em; }
.region-card ul { margin: 0; padding: 0; list-style: none; }
.region-card li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.region-bridge { display: grid; place-items: center; color: var(--accent); font: 700 11px/1 var(--display); writing-mode: vertical-rl; letter-spacing: .12em; }

.registry-panel { border: 1px solid var(--line); background: var(--surface); }
.registry-header, .asset-row { display: grid; grid-template-columns: 2fr 1fr .8fr 1fr; gap: 18px; align-items: center; padding: 16px 20px; }
.registry-header { color: var(--muted); border-bottom: 1px solid var(--line); font: 700 10px/1 var(--display); letter-spacing: .12em; }
.asset-row { border-bottom: 1px solid var(--line); }
.asset-row:last-child { border-bottom: 0; }
.asset-title strong { display: block; }.asset-title small, .asset-row code { color: var(--muted); }
.asset-row code { font-size: 11px; }
.badge { width: fit-content; padding: 5px 7px; background: var(--surface-strong); color: var(--muted); font: 700 10px/1 var(--display); }
.badge.published { color: var(--ok); }.badge.in_review, .badge.approved { color: var(--warn); }.badge.withdrawn { color: var(--bad); }
.empty-state { padding: 60px 24px; text-align: center; }.empty-state strong { display: block; font: 600 24px/1 var(--display); }.empty-state span { display: block; margin-top: 10px; color: var(--muted); }

.domain-panel { border: 1px solid var(--line); background: var(--surface); }
.domain-summary { display: flex; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.domain-summary strong { font: 650 20px/1 var(--display); }.domain-summary span { color: var(--muted); }
.domain-row { display: grid; grid-template-columns: 1.7fr 1fr 1fr .8fr; gap: 18px; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.domain-row:last-child { border-bottom: 0; }
.domain-row strong, .domain-row small { display: block; }.domain-row small, .domain-row code, .domain-row time { margin-top: 4px; color: var(--muted); font-size: 11px; }
.ticket-row .badge.pending { color: var(--bad); }.ticket-row .badge.answered { color: var(--warn); }.ticket-row .badge.fixed { color: var(--ok); }

.identity-list { display: grid; gap: 12px; }
.identity-card { display: grid; grid-template-columns: 1.1fr .6fr 2.2fr auto; gap: 18px; align-items: center; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.identity-person strong, .identity-person small { display: block; }
.identity-person small { margin-top: 5px; color: var(--muted); }
.identity-roles { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.identity-roles label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.identity-roles input { width: auto; }

.login-page { min-height: 100vh; }
.login-shell { width: min(1320px, calc(100% - 48px)); min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; gap: 8vw; align-items: center; }
.login-intro { border: 0; padding: 70px 0; }
.login-intro .brand { width: fit-content; margin-bottom: 14vh; }
.login-intro h1 { margin: 0; font: 650 clamp(48px, 6vw, 90px)/.95 var(--display); letter-spacing: -.045em; }
.login-intro h1 em { color: var(--accent); font-style: normal; }
.login-intro > p:not(.eyebrow) { max-width: 580px; margin: 30px 0; color: var(--muted); font-size: 17px; }
.login-boundary { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; max-width: 520px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.login-boundary span { color: var(--accent); font: 700 10px/1.5 var(--display); letter-spacing: .14em; }
.login-panel { position: relative; border: 1px solid var(--line); background: var(--surface); padding: clamp(28px, 5vw, 64px); box-shadow: 0 35px 80px -45px var(--shadow); }
.login-panel h2 { margin: 0 0 32px; font: 620 clamp(32px, 4vw, 56px)/1 var(--display); }
.login-theme { position: absolute; right: 20px; top: 20px; }
.sso-button { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 18px; border: 1px solid var(--accent); color: var(--ink); background: var(--accent-soft); text-decoration: none; }
.sso-button:hover { background: var(--surface-strong); }
.sso-button strong, .sso-button small { display: block; }.sso-button small { margin-top: 4px; color: var(--muted); }
.dingtalk-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: #1677ff; font-weight: 800; }
.login-divider { display: flex; align-items: center; gap: 14px; margin: 28px 0; color: var(--muted); font-size: 11px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.admin-login summary { cursor: pointer; color: var(--muted); }
.admin-login form { display: grid; gap: 16px; margin-top: 20px; }
.admin-login label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.login-notice, .login-error { padding: 12px; border-left: 2px solid var(--warn); background: var(--surface-strong); }
.login-error { border-color: var(--bad); color: var(--bad); }
.login-footer { width: auto; padding: 28px 0 0; margin-top: 34px; border-top: 1px solid var(--line); }

.guardrail { display: grid; grid-template-columns: 180px 1fr 160px; align-items: end; gap: 32px; }
.guardrail > div p { max-width: 740px; margin: 20px 0 0; color: var(--muted); font-size: 17px; }
.guard-index { color: var(--accent); text-align: right; font: 800 110px/.75 var(--display); }

footer { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 42px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }
.inline-error, .form-error { color: var(--bad); }

dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 40px 100px var(--shadow); }
dialog::backdrop { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(7px); }
dialog form { padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.dialog-copy { color: var(--muted); max-width: 620px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
input, select { width: 100%; color: var(--ink); background: var(--bg); border: 1px solid var(--line); padding: 11px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 22px; align-items: center; }

.reveal { opacity: 0; transform: translateY(16px); animation: reveal .65s cubic-bezier(.22,.8,.35,1) forwards; }
.delay-1 { animation-delay: .08s; }.delay-2 { animation-delay: .16s; }.delay-3 { animation-delay: .24s; }
@keyframes reveal { to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 72px 0 58px; }
  .hero-note { margin-top: 30px; }
  .cards { grid-template-columns: 1fr; }
  .region-map { grid-template-columns: 1fr; }
  .region-bridge { min-height: 50px; writing-mode: initial; }
  .guardrail { grid-template-columns: 1fr; }.guard-index { text-align: left; }
  .identity-card { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; padding: 36px 0; }
  .login-intro { padding-bottom: 0; }.login-intro .brand { margin-bottom: 60px; }
}

@media (max-width: 620px) {
  .masthead, main, footer { width: min(100% - 28px, 1480px); }
  .brand small, .environment, .signed-in-user { display: none; }
  .hero h1 { font-size: 48px; }
  section { padding: 54px 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .registry-header { display: none; }
  .asset-row { grid-template-columns: 1fr 1fr; }
  .domain-summary { flex-direction: column; }
  .domain-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
