:root {
  color-scheme: light dark;
  font-family: "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  font-synthesis: none;
  --graphite: #171c21;
  --graphite-raised: #242a31;
  --canvas: #f7f6f2;
  --surface: #fff;
  --surface-subtle: #f2f5f7;
  --ink: #101419;
  --muted: #737d89;
  --dark-muted: #aeb8c5;
  --border: #d6dce2;
  --accent: #18bfe8;
  --accent-strong: #078eb3;
  --accent-soft: rgba(24, 191, 232, .14);
  --success: #17845f;
  --success-soft: #e8f6f0;
  --danger: #be2f39;
  --danger-soft: #fff0f1;
  --warning: #b86f06;
  --warning-soft: #fff5e2;
  --info: #2479b9;
  --info-soft: #edf7ff;
  --radius: .625rem;
  --sidebar-width: 16rem;
  background: var(--canvas);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 20rem; min-height: 100%; background: var(--canvas); }
body { min-width: 20rem; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, input, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: .1875rem solid var(--accent); outline-offset: .1875rem; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .78rem; }

.skip-link { position: fixed; top: .5rem; left: 50%; z-index: 100; padding: .625rem 1rem; color: #fff; background: var(--graphite); border-radius: .375rem; transform: translate(-50%, -160%); transition: transform 160ms ease; }
.skip-link:focus { transform: translate(-50%, 0); }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 40; display: flex; flex-direction: column; width: var(--sidebar-width); height: 100vh; padding: 1.5rem 1rem 1.25rem; overflow-y: auto; color: #eef3f7; background: var(--graphite); }
.brand-lockup { display: flex; align-items: center; gap: .75rem; min-height: 3.25rem; padding: 0 .75rem; }
.brand-icon { display: grid; width: 2.625rem; height: 2.625rem; flex: 0 0 2.625rem; place-items: center; color: #fff; background: var(--accent); border-radius: .625rem; font-size: 1.5rem; font-weight: 700; }
.brand-copy { display: grid; gap: .125rem; }
.brand-copy strong { font-size: 1.3125rem; font-weight: 600; letter-spacing: .02em; line-height: 1; }
.brand-copy small { color: var(--dark-muted); font-size: .625rem; letter-spacing: .24em; }
.nav-list { display: grid; gap: .5rem; margin-top: 3rem; }
.nav-list a { position: relative; display: flex; min-height: 3.25rem; align-items: center; gap: .875rem; padding: 0 1.125rem; color: var(--dark-muted); text-decoration: none; border-radius: .5rem; transition: color 180ms ease, background 180ms ease; }
.nav-list a::before { position: absolute; inset: .4375rem auto .4375rem -1rem; width: .1875rem; background: transparent; border-radius: 0 .1875rem .1875rem 0; content: ""; }
.nav-list a:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-list a[aria-current="page"] { color: #fff; background: var(--graphite-raised); }
.nav-list a[aria-current="page"]::before { background: var(--accent); }
.nav-list i { font-size: 1.35rem; }
.sidebar-account { display: flex; align-items: center; gap: .75rem; margin-top: auto; padding: 1.25rem .75rem .25rem; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-account > i { font-size: 1.65rem; }
.sidebar-account span { display: grid; gap: .1875rem; }
.sidebar-account strong { font-size: .875rem; }
.sidebar-account small { color: var(--dark-muted); font-size: .75rem; }
.nav-open, .nav-close, .nav-scrim { display: none; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; height: 4.5rem; align-items: center; justify-content: space-between; padding: 0 2rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(.75rem); }
.topbar-start, .topbar-end, .role-chip, .live-label { display: flex; align-items: center; }
.topbar-start, .topbar-end { gap: .875rem; }
.topbar-start > span { color: var(--muted); font-size: .875rem; font-weight: 600; letter-spacing: .04em; }
.topbar-start strong { font-size: .8125rem; }
.topbar-divider { width: 1px; height: 1.375rem; background: var(--border); }
.live-label { gap: .375rem; color: var(--success); font-size: .75rem; font-weight: 600; }
.role-chip { gap: .5rem; font-size: .8125rem; }
.role-chip i { color: var(--muted); font-size: 1.8rem; }
.icon-button, .nav-open, .nav-close { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; padding: 0; color: inherit; background: transparent; border: 0; border-radius: .5rem; cursor: pointer; }
.icon-button:hover, .nav-open:hover, .nav-close:hover { background: var(--surface-subtle); }
.workspace-main { width: min(100%, 88rem); margin: 0 auto; padding: 2rem; }
.workspace-main:focus { outline: none; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.75rem; }
.page-heading h1 { margin: 0; font-size: clamp(1.875rem, 3vw, 2.625rem); line-height: 1.1; letter-spacing: -.04em; }
.page-heading p { margin: .5rem 0 0; color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.page-heading time { color: var(--muted); font-size: .75rem; white-space: nowrap; }

.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.overview-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 1rem; }
.hero-panel { grid-column: 1 / span 8; padding: 1.5rem; }
.health-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.health-heading h2, .section-header h2, .list-panel h2 { margin: 0; font-size: 1.125rem; }
.health-heading p { margin: .375rem 0 0; color: var(--muted); font-size: .8125rem; }
.health-badge { display: flex; align-items: center; gap: .625rem; padding: .625rem .75rem; border-radius: .5rem; }
.health-badge.success { color: var(--success); background: var(--success-soft); }
.health-badge.warning { color: var(--warning); background: var(--warning-soft); }
.health-badge > i { font-size: 1.875rem; }
.health-badge span { display: grid; gap: .1875rem; }
.health-badge strong { font-size: 1.0625rem; }
.health-badge small { color: var(--muted); font-size: .6875rem; }
.metrics-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 1.25rem 0; }
.metric { position: relative; display: grid; gap: .25rem; padding: 0 1.125rem; border-right: 1px solid var(--border); }
.metric:first-child { padding-left: 0; }
.metric:last-child { padding-right: 0; border-right: 0; }
.metric span, .metric > i { color: var(--muted); font-size: .75rem; }
.metric strong { font-size: clamp(1.625rem, 2.4vw, 2.25rem); font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric small { color: var(--success); font-size: .6875rem; font-weight: 600; }
.metric > i { position: absolute; top: 0; right: 1.125rem; font-size: 1.5rem; }
.honest-trend { display: flex; min-height: 10rem; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.5rem; background: var(--surface-subtle); border: 1px dashed var(--border); border-radius: .5rem; }
.honest-trend h3 { margin: 0 0 .5rem; font-size: .875rem; }
.honest-trend p { max-width: 30rem; margin: 0; color: var(--muted); font-size: .8125rem; line-height: 1.65; }
.honest-trend > strong { color: var(--accent-strong); font-size: 2.5rem; font-variant-numeric: tabular-nums; }
.honest-trend > strong small { display: block; color: var(--muted); font-size: .6875rem; text-align: right; }
.right-stack { display: grid; grid-column: 9 / span 4; gap: 1rem; align-content: start; }
.side-panel, .bottom-panel, .list-panel { padding: 1.25rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-header > a { min-height: 2.5rem; display: inline-flex; align-items: center; color: var(--accent-strong); font-size: .75rem; font-weight: 600; text-decoration: none; }
.section-header > span { color: var(--muted); font-size: .75rem; }
.action-list { margin-top: .625rem; }
.action-list a { display: grid; grid-template-columns: 2.625rem minmax(0,1fr) auto; min-height: 4.25rem; align-items: center; gap: .75rem; padding: .75rem 0; text-decoration: none; border-bottom: 1px solid var(--border); }
.action-list a:last-child { border-bottom: 0; }
.action-list a:hover { background: var(--surface-subtle); }
.action-list a > span:nth-child(2), .service-mini-list div > span:nth-child(2) { display: grid; gap: .25rem; }
.action-list strong, .service-mini-list strong { font-size: .8125rem; }
.action-list small, .service-mini-list small { color: var(--muted); font-size: .6875rem; line-height: 1.4; }
.tone-icon { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border-radius: .5rem; font-size: 1.25rem; }
.tone-icon.danger { color: var(--danger); background: var(--danger-soft); }
.tone-icon.warning { color: var(--warning); background: var(--warning-soft); }
.tone-icon.info { color: var(--info); background: var(--info-soft); }
.tone-icon.success { color: var(--success); background: var(--success-soft); }
.service-mini-list { margin-top: .625rem; }
.service-mini-list > div { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .625rem; min-height: 3.75rem; border-bottom: 1px solid var(--border); }
.service-mini-list > div:last-child { border-bottom: 0; }
.service-mini-list b { color: var(--muted); font-size: .625rem; }
.status-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.status-dot.healthy { background: var(--success); }
.status-dot.degraded { background: var(--warning); }
.status-dot.down { background: var(--danger); }
.bottom-panel { grid-column: span 6; }
.bar-chart { display: grid; height: 10.5rem; grid-template-columns: repeat(7, minmax(1.75rem,1fr)); align-items: end; gap: .5rem; margin: 1.25rem 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--border); }
.bar-chart li { display: grid; height: 100%; grid-template-rows: minmax(0,1fr) auto auto; align-items: end; gap: .25rem; color: var(--muted); text-align: center; }
.bar-chart .bar { width: min(2rem,70%); min-height: .25rem; justify-self: center; background: var(--accent); border-radius: .1875rem .1875rem 0 0; transition: height 300ms ease; }
.bar-height-1 { height: 10%; }
.bar-height-2 { height: 20%; }
.bar-height-3 { height: 30%; }
.bar-height-4 { height: 40%; }
.bar-height-5 { height: 50%; }
.bar-height-6 { height: 60%; }
.bar-height-7 { height: 70%; }
.bar-height-8 { height: 80%; }
.bar-height-9 { height: 90%; }
.bar-height-10 { height: 100%; }
.bar-chart small { font-size: .625rem; }
.bar-chart b { min-height: 1rem; color: var(--ink); font-size: .625rem; font-variant-numeric: tabular-nums; }

.list-panel { min-height: 20rem; }
.list-panel > .section-header { padding-bottom: 1rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th, td { padding: .8rem .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface-subtle); font-size: .6875rem; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--surface-subtle); }
.status-chip { display: inline-flex; min-height: 1.75rem; align-items: center; padding: 0 .625rem; color: var(--muted); background: var(--surface-subtle); border-radius: 2rem; font-size: .6875rem; font-weight: 700; white-space: nowrap; }
.status-chip.active, .status-chip.healthy, .status-chip.authorized { color: var(--success); background: var(--success-soft); }
.status-chip.disabled, .status-chip.down { color: var(--danger); background: var(--danger-soft); }
.status-chip.degraded { color: var(--warning); background: var(--warning-soft); }
.empty-state { display: grid; min-height: 16rem; place-items: center; align-content: center; gap: .5rem; color: var(--muted); text-align: center; }
.empty-state i { color: var(--accent-strong); font-size: 2.25rem; }
.empty-state strong { color: var(--ink); }
.empty-state span { max-width: 28rem; font-size: .8125rem; line-height: 1.6; }
.inline-action { display: grid; min-width: 20rem; grid-template-columns: minmax(9rem,1fr) auto; gap: .5rem; }
.inline-action .form-result { grid-column: 1 / -1; }
input { width: 100%; min-height: 2.625rem; padding: 0 .75rem; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: .4375rem; }
.primary-button, .secondary-button { min-height: 2.625rem; padding: 0 1rem; border-radius: .4375rem; cursor: pointer; font-weight: 700; }
.primary-button { color: #05232b; background: var(--accent); border: 1px solid var(--accent); }
.secondary-button { color: var(--accent-strong); background: var(--surface); border: 1px solid var(--accent); }
.primary-button:hover, .secondary-button:hover { filter: brightness(.96); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .6; }
.form-result { min-height: 1rem; color: var(--muted); font-size: .6875rem; }
.form-result.is-error { color: var(--danger); }
.form-result.is-success { color: var(--success); }
.policy-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
.policy-grid article { padding: 1.25rem; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: .5rem; }
.policy-grid article > div:first-child { display: flex; align-items: center; gap: .75rem; }
.policy-grid h3 { margin: 0; }
.policy-grid dl { display: grid; grid-template-columns: 7rem minmax(0,1fr); gap: .625rem; margin: 1rem 0; font-size: .8125rem; }
.policy-grid dt { color: var(--muted); }
.policy-grid dd { margin: 0; overflow-wrap: anywhere; }
.policy-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.policy-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .6875rem; }
.policy-form .wide, .policy-form .form-result { grid-column: 1 / -1; }
.service-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3,minmax(0,1fr)); }
.service-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: start; gap: 1rem; padding: 1.25rem; }
.service-card h2 { margin: 0 0 .375rem; font-size: 1rem; }
.service-card p { margin: 0 0 .75rem; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.service-card time { color: var(--muted); font-size: .625rem; overflow-wrap: anywhere; }

.login-page { display: grid; place-items: center; padding: 1.5rem; background: var(--graphite); }
.login-shell { display: grid; width: min(52rem,100%); grid-template-columns: 1fr 1fr; overflow: hidden; background: var(--surface); border: 1px solid #333c45; border-radius: .75rem; box-shadow: 0 2rem 6rem rgba(0,0,0,.3); }
.login-brand { display: grid; min-height: 30rem; place-items: center; align-content: center; padding: 3rem; color: #fff; background: #11161b; text-align: center; }
.login-logo { margin-bottom: 1rem; }
.login-brand h1 { margin: 0; font-size: 2rem; letter-spacing: .08em; }
.login-brand p { color: var(--dark-muted); letter-spacing: .16em; }
.login-form { display: grid; align-content: center; gap: .75rem; padding: 3rem; }
.login-form h2 { margin: 0; font-size: 1.75rem; }
.login-form > p { margin: 0 0 .75rem; color: var(--muted); font-size: .8125rem; line-height: 1.6; }
.login-form label { margin-top: .375rem; font-size: .75rem; font-weight: 600; }
.login-form .primary-button { margin-top: .75rem; }
.form-alert { padding: .75rem; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb,var(--danger) 30%,transparent); border-radius: .4375rem; font-size: .75rem; }

@media (max-width: 70rem) {
  .bottom-panel { grid-column: 1 / -1; }
  .service-grid { grid-template-columns: 1fr; }
}

@media (max-width: 56.25rem) {
  :root { --sidebar-width: 0; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: 16rem; transform: translateX(-100%); transition: transform 220ms ease; }
  body.nav-opened .sidebar { transform: translateX(0); }
  .nav-close, .nav-open { display: grid; }
  .nav-close { margin-left: auto; color: #fff; }
  .nav-scrim { position: fixed; inset: 0; z-index: 35; display: block; pointer-events: none; background: rgba(5,8,12,.58); border: 0; opacity: 0; transition: opacity 220ms ease; }
  body.nav-opened .nav-scrim { pointer-events: auto; opacity: 1; }
  .overview-grid { grid-template-columns: 1fr; }
  .hero-panel, .right-stack, .bottom-panel { grid-column: 1; }
  .policy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 40.625rem) {
  .topbar { height: 4rem; padding: 0 .75rem; }
  .topbar-divider, .live-label, .role-chip { display: none; }
  .workspace-main { padding: 1.5rem 1rem 3rem; }
  .page-heading { display: grid; gap: .875rem; margin-bottom: 1.25rem; }
  .hero-panel, .side-panel, .bottom-panel, .list-panel { padding: 1rem; }
  .health-heading { display: grid; }
  .health-badge { justify-self: start; }
  .metrics-row { grid-template-columns: 1fr; gap: .875rem; }
  .metric, .metric:first-child, .metric:last-child { padding: 0 0 .875rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .metric:last-child { padding-bottom: 0; border-bottom: 0; }
  .metric > i { right: 0; }
  .honest-trend { display: grid; gap: 1rem; }
  .honest-trend > strong small { text-align: left; }
  .bar-chart { gap: .2rem; }
  .bar-chart small { writing-mode: vertical-rl; justify-self: center; }
  .policy-form { grid-template-columns: 1fr; }
  .policy-form .wide { grid-column: auto; }
  .service-card { grid-template-columns: auto minmax(0,1fr); }
  .service-card > .status-chip { grid-column: 2; justify-self: start; }
  .responsive-table { overflow: visible; }
  .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .responsive-table tr { padding: .75rem 0; border-bottom: 1px solid var(--border); }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td { display: grid; grid-template-columns: 6.25rem minmax(0,1fr); gap: .75rem; padding: .625rem 0; border: 0; overflow-wrap: anywhere; }
  .responsive-table td::before { color: var(--muted); content: attr(data-label); font-size: .6875rem; font-weight: 600; }
  .responsive-table .inline-action { min-width: 0; grid-template-columns: 1fr; }
  .responsive-table .inline-action .form-result { grid-column: auto; }
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .login-brand { min-height: 13rem; padding: 2rem; }
  .login-form { padding: 2rem 1.5rem 3rem; }
}

@media (prefers-color-scheme: dark) {
  :root { --canvas:#11161b; --surface:#181e24; --surface-subtle:#222930; --ink:#f3f7fa; --muted:#a8b2bd; --border:#333c45; --accent-strong:#52d2f1; --accent-soft:rgba(24,191,232,.18); --success:#61cca4; --success-soft:#183c31; --danger:#ff7b84; --danger-soft:#422126; --warning:#f2b14e; --warning-soft:#3e301b; --info:#74b9eb; --info-soft:#1b3447; }
  .primary-button { color: #041b21; }
}

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