:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #ffffff;
  font-synthesis: none;
  --text: #172129;
  --orange: #e8612c;
  --warning-soft: #fff3e9;
  --warning-text: #984019;
  --primary-hover: #8e1b2b;
  --primary: #b42336;
  --primary-soft: #fff0f2;
  --sidebar: #761d2c;
  --success: #05664f;
  --success-soft: #e8f5f0;
  --amber: var(--orange);
  --line: #e5e7eb;
  --muted: #64727c;
  --canvas: #ffffff;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.app-shell--guest { display: block; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 12px 18px; background: var(--sidebar); color: #fff; border-right: 1px solid var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 0 10px 24px; color: #fff; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: .03em; }
.brand small { margin-top: 3px; color: #f3cdd3; font-size: 12px; letter-spacing: .1em; }
.side-nav { display: grid; gap: 8px; }
.side-nav a, .logout-button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border: 0; border-radius: 6px; color: #fff7f8; background: transparent; font-size: 15px; font-weight: 650; text-decoration: none; }
.side-nav a small { display:block; margin-top:2px; color:inherit; font-size:11px; font-weight:500; opacity:.72; }
.side-nav a:hover, .side-nav a:focus-visible, .side-nav a.active { color: var(--primary); background: var(--primary-soft); }
.side-nav img, .logout-button img { width: 19px; height: 19px; filter: brightness(0) invert(1); opacity: .85; }

.side-nav a.active { box-shadow: none; }
.side-nav a:hover img, .side-nav a:focus-visible img, .side-nav a.active img, .logout-button:hover img, .logout-button:focus-visible img { filter: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #984453; padding-top: 15px; }
.environment { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; color: #f3cdd3; font-size: 12px; }
.environment > span { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px rgba(232,97,44,.12); }
.logout-button { width: 100%; cursor: pointer; }
.logout-button:hover, .logout-button:focus-visible { color: var(--primary); background: var(--primary-soft); }
.workspace { min-width: 0; }
.topbar { height: 98px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; box-shadow: none; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.page-heading h1 { margin: 0; color: var(--text); font-size: clamp(24px, 2vw, 30px); line-height: 1.15; }
.topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.maturity-badge { padding: 6px 9px; border: 1px solid #f5ceb7; border-radius: 5px; color: var(--warning-text); background: var(--warning-soft); font-size: 12px; font-weight: 800; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: white; background: var(--primary); font-size: 13px; font-weight: 800; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; max-width: 160px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 14px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.page-content { max-width: 1500px; margin: 0 auto; padding: 22px 24px 36px; }
footer { max-width: 1500px; margin: 0 auto; padding: 0 24px 22px; color: var(--muted); font-size: 12px; }
.page-content > section:not(.metric-strip):not(.panel), .page-content > article, .content-card { margin: 16px 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 5px 20px rgba(31,35,41,.035); }
.page-content h2 { color: var(--text); font-size: 17px; }
.page-content h3 { color: var(--text); font-size: 14px; }
.grid, .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grid article, .cards article { margin: 0; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.metric { font-size: 30px; }
.badge { display: inline-block; margin-left: 4px; padding: 3px 8px; border-radius: 999px; background: #eef1f3; color: #52606b; font-size: 11px; }
.warning { background: var(--warning-soft); color: var(--warning-text); }
.notice { padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--warning-soft); color: var(--warning-text); font-size: 13px; line-height: 1.6; }
.error { padding: 12px 14px; border-left: 3px solid #b84040; background: #fff0f0; color: #792828; }
.empty, .empty-state { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
td { font-size: 13px; }
label { display: block; margin: 12px 0; color: var(--text); font-size: 13px; font-weight: 600; }
input, textarea, select { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #d5d8de; border-radius: 5px; color: var(--text); background: #fff; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(180,35,54,.2); border-color: var(--primary); }
textarea { min-height: 104px; resize: vertical; }
button { padding: 9px 14px; border: 0; border-radius: 5px; color: white; background: var(--primary); cursor: pointer; }
button:hover { background: var(--primary-hover); }
output { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
code { overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; }
.app-shell--guest .topbar { justify-content: center; }
.app-shell--guest .page-content { max-width: 520px; padding-top: 50px; }

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 14px; }
  .brand { padding-bottom: 13px; }
  .side-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-nav a { justify-content: center; min-height: 39px; padding: 7px; font-size: 11px; }
  .side-nav img { width: 16px; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; }
  .sidebar-foot form { width: auto; }
  .environment { margin: 0; padding: 0 8px; }
  .logout-button { min-height: 34px; padding: 0 8px; font-size: 11px; }
  .topbar { height: 76px; padding: 0 16px; }
  .maturity-badge, .user-copy { display: none; }
  .page-content { padding: 16px; }
  footer { padding: 0 16px 18px; }
  .grid, .cards { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .side-nav { display: flex; gap: 4px; overflow-x: auto; }
  .side-nav a { flex: 0 0 auto; }
  .brand small { display: none; }
  .page-heading h1 { font-size: 21px; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 8px; }
}
