:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #172033;
  background: #eef2f7;
  --navy: #10233f;
  --navy-2: #172f52;
  --blue: #1d5fd1;
  --blue-dark: #174da8;
  --blue-soft: #eaf1ff;
  --amber: #ffb547;
  --red: #ba3d3d;
  --line: #dce3ed;
  --muted: #657086;
  --surface: #ffffff;
  --shadow: 0 14px 38px rgba(16, 35, 63, .09);
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.6; background: radial-gradient(circle at 8% 0%, rgba(29, 95, 209, .10), transparent 30rem), #eef2f7; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
main { max-width: 1480px; margin: 0 auto; padding: 22px 28px 48px; }
.site-header { min-height: 78px; display: flex; align-items: center; gap: 16px; padding: 0 4px 18px; border-bottom: 1px solid rgba(16, 35, 63, .10); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(29, 95, 209, .25); font-weight: 800; font-size: 22px; }
.eyebrow, .panel-kicker, .auth-kicker { margin: 0; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.site-header h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.3; letter-spacing: -.02em; }
.header-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.security-badge { margin-left: auto; padding: 6px 11px; color: #126347; border: 1px solid #b9dfd0; background: #edf9f4; border-radius: 999px; font-size: 13px; font-weight: 700; }
.security-badge::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #18a474; }
#message { position: relative; margin: 16px 0; padding: 10px 16px 10px 42px; color: #24466f; background: #e8f1ff; border: 1px solid #cedffc; border-radius: 10px; font-size: 14px; }
#message::before { content: "i"; position: absolute; left: 16px; top: 10px; width: 18px; height: 18px; display: grid; place-items: center; color: #fff; background: var(--blue); border-radius: 50%; font-size: 12px; font-weight: 800; }
#message.error { color: #8b2c2c; background: #fff0f0; border-color: #f1caca; }
#message.error::before { content: "!"; background: var(--red); }
#auth { max-width: 930px; min-height: 500px; display: grid; grid-template-columns: 1.05fr .95fr; margin: 42px auto 0; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid rgba(16, 35, 63, .10); border-radius: 20px; box-shadow: var(--shadow); }
.auth-intro { position: relative; min-height: 500px; padding: 64px 52px; overflow: hidden; color: #fff; background: var(--navy); }
.auth-intro::before, .auth-intro::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.10); border-radius: 50%; }
.auth-intro::before { width: 320px; height: 320px; right: -125px; top: -100px; }
.auth-intro::after { width: 210px; height: 210px; left: -100px; bottom: -90px; }
.auth-kicker { color: #8fb9ff; }
.auth-intro h2 { max-width: 370px; margin: 16px 0 18px; font-size: 32px; line-height: 1.35; letter-spacing: -.03em; }
.auth-intro > p:not(.auth-kicker) { max-width: 390px; margin: 0; color: #bdcbe0; font-size: 15px; }
.auth-visual { position: absolute; left: 52px; right: 52px; bottom: 54px; height: 112px; display: flex; align-items: end; gap: 12px; padding: 0 22px 0 8px; border-bottom: 1px solid rgba(255,255,255,.22); }
.auth-visual::after { content: "每日数据趋势"; position: absolute; right: 0; top: -24px; color: #8496b2; font-size: 12px; }
.auth-visual i { flex: 1; min-width: 18px; background: linear-gradient(180deg, #5f99ff, #2367de); border-radius: 5px 5px 0 0; opacity: .92; }
.auth-visual i:nth-child(1) { height: 38%; }.auth-visual i:nth-child(2) { height: 58%; }.auth-visual i:nth-child(3) { height: 48%; }.auth-visual i:nth-child(4) { height: 78%; }.auth-visual i:nth-child(5) { height: 94%; background: linear-gradient(180deg, #ffc96f, #f59f23); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 54px 50px; }
.auth-panel h2 { margin: 8px 0 2px; font-size: 26px; line-height: 1.35; }
.auth-hint { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
#authForm { display: grid; gap: 18px; }
#authForm label { min-width: 0; }
#authForm button { width: 100%; margin-top: 6px; }
.auth-footnote { margin: 18px 0 0; color: #8a93a4; text-align: center; font-size: 12px; }
.account-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 11px 14px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(16,35,63,.04); }
.account-avatar { width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: var(--navy-2); border-radius: 9px; font-size: 13px; font-weight: 800; }
#identity { font-size: 14px; font-weight: 700; }
.account-spacer { flex: 1; }
.account-bar a { padding: 7px 11px; color: var(--blue); border-radius: 7px; text-decoration: none; font-size: 14px; font-weight: 700; }
.account-bar a:hover { background: var(--blue-soft); }
.account-bar #logout { padding: 8px 12px; color: #4f5c70; background: #f1f4f8; }
.portal-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 22px; align-items: start; }
.portal-sidebar { position: sticky; top: 18px; min-height: 570px; padding: 22px 14px 16px; color: #dbe6f6; background: var(--navy); border: 1px solid rgba(255,255,255,.04); border-radius: 16px; box-shadow: 0 16px 34px rgba(16,35,63,.16); }
.sidebar-brand { display: flex; flex-direction: column; margin: 0 10px 26px; color: #fff; font-weight: 800; }
.sidebar-brand small { color: #7890af; font-size: 10px; letter-spacing: .16em; }
.sidebar-label { margin: 0 10px 8px; color: #7890af; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.portal-sidebar nav { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.portal-sidebar nav button { position: relative; width: 100%; margin: 0; padding: 12px 14px 12px 38px; color: #c3d1e5; background: transparent; text-align: left; font-weight: 600; }
.portal-sidebar nav button::before { content: ""; position: absolute; left: 17px; top: 50%; width: 7px; height: 7px; border: 2px solid #7690b1; border-radius: 2px; transform: translateY(-50%); }
.portal-sidebar nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
.portal-sidebar nav button[aria-current="page"] { color: #fff; background: var(--blue); box-shadow: 0 7px 16px rgba(0,0,0,.18); }
.portal-sidebar nav button[aria-current="page"]::before { border-color: var(--amber); background: var(--amber); }
.sidebar-tip { position: absolute; left: 16px; right: 16px; bottom: 18px; display: grid; gap: 4px; padding: 13px; color: #95a9c5; background: rgba(255,255,255,.055); border-radius: 10px; font-size: 12px; line-height: 1.6; }
.sidebar-tip strong { color: #dbe6f6; font-size: 12px; }
#menuToggle { display: none; }
.portal-content { min-width: 0; }
.portal-content > section { min-height: 570px; margin: 0; padding: 28px 30px 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(16,35,63,.055); }
section > h2 { margin: 0; color: #15233a; font-size: 22px; line-height: 1.4; }
section > h2::after { content: ""; display: block; width: 36px; height: 3px; margin-top: 10px; background: var(--blue); border-radius: 2px; }
section > p { max-width: 980px; margin: 12px 0 22px; color: var(--muted); font-size: 14px; }
.portal-content h2:focus { outline: none; }
h3 { margin: 26px 0 14px; color: #26344b; font-size: 17px; }
form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
label { display: grid; flex: 1; min-width: 210px; gap: 7px; color: #354158; font-size: 14px; font-weight: 700; }
label small, small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; color: #182238; background: #fbfcfe; border: 1px solid #ccd5e2; border-radius: 8px; transition: border-color .16s, box-shadow .16s, background .16s; }
input::placeholder { color: #a0a8b5; }
input:hover, select:hover { border-color: #9eacc0; }
input:focus, select:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(29,95,209,.13); }
input[type="file"] { padding: 7px; background: #f7f9fc; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 12px; color: var(--blue); background: var(--blue-soft); border: 0; border-radius: 6px; font-weight: 700; cursor: pointer; }
button { min-height: 42px; padding: 10px 17px; color: #fff; background: var(--blue); border: 0; border-radius: 8px; cursor: pointer; font-weight: 750; transition: transform .14s, background .14s, box-shadow .14s; }
button:hover:not(:disabled) { background: var(--blue-dark); box-shadow: 0 5px 12px rgba(29,95,209,.18); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(255,181,71,.72); outline-offset: 3px; }
#uploadForm, #rightsUploadForm { display: grid; grid-template-columns: minmax(0,1fr); align-items: start; gap: 18px; padding: 22px; background: #f7f9fc; border: 1px solid #e3e8f0; border-radius: 12px; }
#uploadForm > label, #rightsUploadForm > label { min-width: 0; width: 100%; }
#uploadForm input[type="datetime-local"], #rightsUploadForm input[type="datetime-local"] { max-width: 380px; }
#uploadForm > button, #rightsUploadForm > button { justify-self: start; }
#preview, #rightsPreview, #metricPreview { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
#preview .table-wrap, #metricPreview .table-wrap { max-height: 360px; }
#conflictBox { margin-top: 16px; padding: 18px; color: #782e24; background: #fff2ed; border: 1px solid #f2cec3; border-radius: 10px; }
#rightsConflictBox { margin-top: 16px; padding: 18px; color: #782e24; background: #fff2ed; border: 1px solid #f2cec3; border-radius: 10px; }
.rights-history { margin-top: 14px; max-height: 360px; }
.warning { color: #9a3c2f !important; }
dl { display: flex; flex-wrap: wrap; gap: 10px; }
dl div { min-width: 132px; padding: 13px 15px; background: #f3f6fa; border: 1px solid #e4e9f0; border-radius: 9px; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 4px 0 0; color: #15233a; font-size: 23px; font-weight: 800; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid #e1e6ed; border-radius: 10px; }
table { width: 100%; min-width: 650px; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e7ebf1; text-align: left; font-size: 13px; overflow-wrap: anywhere; }
th { position: sticky; top: 0; z-index: 1; color: #506078; background: #f3f6fa; font-weight: 800; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faff; }
td button { min-height: 34px; margin: 2px 3px 2px 0; padding: 6px 10px; font-size: 12px; }
#metricEditor { width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
#metricsForm { display: block; }
.metric-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px; background: #f7f9fc; border: 1px solid #e3e8f0; border-radius: 10px; }
.metric-toolbar label { flex: 0 1 260px; }
.metric-inputs table { min-width: 800px; }
.metric-inputs input { min-width: 112px; padding: 8px 10px; }
.metric-inputs td:first-child { min-width: 130px; color: #bd3434; font-weight: 800; }
.metric-inputs td:last-child { min-width: 170px; color: var(--muted); }
.metric-inputs tr.edited { background: #fff8e9; }
.metric-inputs tr.edited td:last-child { color: #98551b; }
.metric-source { max-width: 680px; margin: 20px 0; }
#metricStatus { color: var(--muted); font-size: 14px; }
#codeAdmin .table-wrap { max-height: 390px; }
#codeAdmin form, #passwordForm, #userForm { margin-top: 14px; padding: 19px; background: #f7f9fc; border: 1px solid #e3e8f0; border-radius: 10px; }
#passwordForm h3 { flex-basis: 100%; margin: 0; }
#usersMessage, #codeMessage { color: #335a79; font-size: 14px; }
#setupField { flex-basis: 100%; }
@media (max-width: 900px) {
  main { padding: 14px 16px 34px; }
  .portal-layout { grid-template-columns: 190px minmax(0,1fr); gap: 14px; }
  .portal-sidebar { padding-inline: 10px; }
  .portal-content > section { padding: 24px 20px; }
}
@media (max-width: 760px) {
  main { padding: 12px 12px 28px; }
  .site-header { align-items: flex-start; padding-bottom: 14px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 11px; font-size: 19px; }
  .site-header h1 { font-size: 19px; }
  .header-subtitle, .security-badge { display: none; }
  #auth { grid-template-columns: 1fr; min-height: 0; margin-top: 18px; border-radius: 15px; }
  .auth-intro { min-height: 180px; padding: 28px 26px; }
  .auth-intro h2 { max-width: 290px; margin: 9px 0; font-size: 24px; }
  .auth-intro > p:not(.auth-kicker) { font-size: 13px; }
  .auth-visual { display: none; }
  .auth-panel { padding: 32px 26px; }
  .auth-panel h2 { font-size: 23px; }
  .account-bar { flex-wrap: wrap; }
  .account-spacer { display: none; }
  .account-bar a { margin-left: auto; }
  .portal-layout { display: block; }
  .portal-sidebar { position: static; min-height: 0; margin-bottom: 12px; padding: 10px; border-radius: 12px; }
  .sidebar-brand, .sidebar-label, .sidebar-tip { display: none; }
  #menuToggle { display: block; width: 100%; text-align: left; }
  .portal-sidebar #portalMenu { display: none; margin-top: 7px; }
  .portal-sidebar #portalMenu.is-open { display: flex; }
  .portal-content > section { min-height: 0; padding: 21px 17px; border-radius: 12px; }
  section > h2 { font-size: 20px; }
  form { display: grid; }
  label { min-width: 0; }
  #uploadForm { padding: 16px; }
  .metric-toolbar { display: grid; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
