:root {
  color-scheme: light;
  --ink: #15191d;
  --muted: #66706d;
  --line: #dfe5e2;
  --line-strong: #c8d1cd;
  --paper: #f4f7f5;
  --surface: #ffffff;
  --surface-muted: #edf2ef;
  --green: #103e36;
  --green-2: #176454;
  --green-soft: #dcebe5;
  --red: #e60012;
  --red-dark: #ad0010;
  --danger-soft: #fff0f1;
  --shadow: 0 16px 42px rgba(17, 35, 29, .1);
  --radius: 14px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
::selection { color: #fff; background: var(--red); }
:focus-visible { outline: 3px solid rgba(230, 0, 18, .32); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #e9eeeb; }
::-webkit-scrollbar-thumb { background: #aebbb5; border: 2px solid #e9eeeb; border-radius: 8px; }

[hidden] { display: none !important; }

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 17px;
  font-weight: 650;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--red); }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { color: var(--green); background: #fff; border-color: var(--line-strong); }
.button-secondary:hover { border-color: var(--green); background: var(--surface-muted); }
.button-quiet { min-height: 34px; color: #fff; background: transparent; border-color: rgba(255,255,255,.28); padding: 0 12px; }
.button-quiet:hover { background: rgba(255,255,255,.1); }

.watermark-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
  opacity: .09;
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  grid-auto-rows: 150px;
  place-items: center;
}
.watermark-layer span {
  color: #153e36;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  transform: rotate(-24deg);
}

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(420px, .75fr); background: #fff; }
.login-brand {
  position: relative;
  min-height: 100vh;
  padding: clamp(38px, 5vw, 76px);
  overflow: hidden;
  color: #fff;
  background: var(--green);
  isolation: isolate;
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: auto -22% -42% 5%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  box-shadow: 0 0 0 74px rgba(255,255,255,.025), 0 0 0 150px rgba(255,255,255,.02);
  z-index: -1;
}
.login-logo { width: min(230px, 44vw); filter: brightness(0) invert(1); }
.login-brand-copy { position: relative; z-index: 2; max-width: 680px; margin-top: clamp(120px, 18vh, 210px); }
.login-brand-copy h1 { max-width: 10ch; margin: 0; font-size: clamp(42px, 5.5vw, 78px); line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }
.login-brand-copy p { max-width: 34em; margin: 30px 0 0; color: #d3e4de; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.8; }
.login-tagline { position: absolute; left: clamp(38px, 5vw, 76px); bottom: 42px; margin: 0; color: #c4d8d1; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
.signal-field { position: absolute; width: clamp(260px, 33vw, 520px); aspect-ratio: 1; right: -7%; top: 19%; display: grid; place-items: center; }
.signal-field img { width: 34%; filter: brightness(0) invert(1); opacity: .94; }
.signal-orbit { position: absolute; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; }
.signal-orbit-a { inset: 13%; }
.signal-orbit-b { inset: 2%; border-style: dashed; }
.signal-point { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 5px 18px rgba(0,0,0,.24); }
.signal-point-a { left: 12%; top: 33%; }
.signal-point-b { right: 18%; top: 19%; }
.signal-point-c { right: 10%; bottom: 27%; }

.login-panel { display: grid; place-items: center; padding: 42px; background: #fbfcfb; }
.login-panel-inner { width: min(390px, 100%); }
.login-context { margin: 0 0 14px; color: var(--red); font-size: 13px; font-weight: 750; letter-spacing: .08em; }
.login-panel h2 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: -.025em; }
.login-help { margin: 14px 0 32px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.login-panel form { display: grid; gap: 10px; }
.login-panel label, .account-form > label, .form-row label { margin-top: 6px; color: #303733; font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
}
input:hover, select:hover { border-color: #93a49d; }
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(23,100,84,.1); outline: none; }
.login-panel .button { margin-top: 16px; min-height: 46px; }
.form-error { margin: 8px 0 0; padding: 11px 13px; color: #8a0712; background: var(--danger-soft); border-radius: 10px; font-size: 13px; line-height: 1.55; }
.consent-row { display: grid; grid-template-columns: 18px 1fr; align-items: start; gap: 9px; margin-top: 12px !important; color: var(--muted) !important; font-size: 12px !important; font-weight: 500 !important; line-height: 1.65; }
.consent-row input { width: 16px; min-height: 16px; margin: 3px 0 0; accent-color: var(--green); }
.consent-row a { color: var(--green-2); font-weight: 700; text-underline-offset: 2px; }
.login-policy { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 30px; border-block: 1px solid var(--line); }
.login-policy span { padding: 11px 3px; color: var(--muted); font-size: 11px; text-align: center; }
.login-policy span + span { border-left: 1px solid var(--line); }
.login-terms { color: #7c8581; font-size: 11px; line-height: 1.7; }

.privacy-dialog { width: min(620px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); border: 0; border-radius: 16px; padding: 0; color: var(--ink); background: #fff; box-shadow: 0 28px 90px rgba(8, 28, 22, .28); }
.privacy-dialog::backdrop { background: rgba(8, 25, 20, .58); backdrop-filter: blur(3px); }
.privacy-dialog-head { padding: 25px 28px 18px; border-bottom: 1px solid var(--line); }
.privacy-dialog-head span { color: var(--red); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.privacy-dialog-head h2 { margin: 7px 0 0; font-size: 24px; }
.privacy-dialog-body { max-height: 58vh; overflow: auto; padding: 20px 28px; color: #48514d; font-size: 13px; line-height: 1.8; }
.privacy-dialog-body h3 { margin: 20px 0 4px; color: var(--green); font-size: 14px; }
.privacy-dialog-body p { margin: 0 0 10px; }
.privacy-dialog form { display: flex; justify-content: flex-end; padding: 16px 28px 24px; border-top: 1px solid var(--line); }
.privacy-dialog .button { min-width: 110px; }

.app-shell { min-height: 100vh; padding-top: 64px; padding-left: 236px; }
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: 64px;
  display: grid;
  grid-template-columns: 236px 1fr auto;
  align-items: center;
  color: #fff;
  background: var(--green);
  box-shadow: 0 7px 24px rgba(12, 39, 33, .17);
}
.brand-lockup { height: 64px; display: flex; align-items: center; gap: 11px; padding: 0 18px; color: #fff; text-decoration: none; border-right: 1px solid rgba(255,255,255,.15); }
.brand-lockup img { width: 96px; filter: brightness(0) invert(1); }
.brand-lockup span { font-size: 10px; line-height: 1.35; color: #dce9e5; }
.header-release { display: flex; align-items: center; gap: 9px; padding-left: 24px; color: #d7e6e1; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4fd1a7; box-shadow: 0 0 0 4px rgba(79,209,167,.14); }
.account-menu { height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 18px 0 24px; }
.account-menu div { display: grid; justify-items: end; gap: 2px; }
.account-menu strong { font-size: 12px; }
.account-menu span { color: #c9dbd5; font-size: 10px; }

.app-sidebar { position: fixed; inset: 64px auto 0 0; z-index: 40; width: 236px; display: flex; flex-direction: column; padding: 24px 14px 16px; background: #fff; border-right: 1px solid var(--line); }
.nav-section-label { padding: 0 12px 11px; color: #8a938f; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.module-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 58px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; border: 0; border-radius: 11px; padding: 7px 12px; color: #48514d; background: transparent; text-align: left; }
.nav-item:hover { color: var(--green); background: var(--surface-muted); }
.nav-item.is-active { color: var(--green); background: var(--green-soft); }
.nav-item.is-active::before { content: ""; position: absolute; left: 0; width: 3px; height: 28px; border-radius: 0 3px 3px 0; background: var(--red); }
.nav-item svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { display: grid; gap: 3px; }
.nav-item strong { font-size: 13px; }
.nav-item small { color: #89928e; font-size: 10px; }
.sidebar-access { margin-top: auto; padding: 16px 13px; background: var(--surface-muted); border-radius: 12px; }
.sidebar-access span, .sidebar-access small { display: block; color: var(--muted); font-size: 10px; }
.sidebar-access strong { display: block; margin: 7px 0 5px; color: var(--green); font-size: 13px; }

.research-canvas { min-height: calc(100vh - 64px); padding: 34px clamp(24px, 3.5vw, 54px) 60px; }
.research-view, .admin-view { max-width: 1500px; margin: 0 auto; }
.research-header { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 27px; }
.research-header h1 { margin: 0; font-size: clamp(27px, 2.5vw, 38px); line-height: 1.1; letter-spacing: -.035em; }
.research-header p { max-width: 64ch; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.research-context { min-width: 190px; }
.research-context label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.research-context select { min-height: 40px; font-weight: 650; }

.loading-state { min-height: 460px; display: grid; grid-template-columns: repeat(3, 10px); justify-content: center; align-content: center; gap: 7px; }
.loading-state span { width: 10px; height: 36px; background: var(--green); animation: load-bars 900ms ease-in-out infinite alternate; }
.loading-state span:nth-child(2) { animation-delay: 140ms; background: var(--red); }
.loading-state span:nth-child(3) { animation-delay: 280ms; }
.loading-state p { grid-column: 1 / -1; margin: 12px -70px 0; color: var(--muted); font-size: 12px; text-align: center; }
@keyframes load-bars { from { transform: scaleY(.35); opacity: .4; } to { transform: scaleY(1); opacity: 1; } }
.error-state { max-width: 560px; margin: 90px auto; padding: 30px; text-align: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.error-state h2 { margin: 0; font-size: 20px; }
.error-state p { color: var(--muted); line-height: 1.7; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; border-block: 1px solid var(--line-strong); background: #fff; }
.metric { min-height: 104px; padding: 21px 22px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin: 9px 0 4px; color: var(--green); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.metric small { color: #7c8581; font-size: 10px; }
.metric strong.is-negative { color: var(--red-dark); }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .75fr); gap: 18px; }
.analysis-primary, .analysis-secondary, .evidence-table-section, .account-form, .account-list-section, .release-section, .audit-section { background: #fff; border-radius: var(--radius); box-shadow: 0 12px 32px rgba(20, 43, 35, .07); }
.analysis-primary, .analysis-secondary { min-height: 430px; padding: 23px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.period-badge { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; }

.rank-chart { display: grid; gap: 13px; }
.rank-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 72px; align-items: center; gap: 12px; font-size: 11px; }
.rank-name { color: #39423e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-progress { width: 100%; height: 18px; border: 0; border-radius: 0; appearance: none; background: #edf1ef; overflow: hidden; }
.rank-progress::-webkit-progress-bar { background: #edf1ef; }
.rank-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--red), #f04c58); }
.rank-progress::-moz-progress-bar { background: var(--red); }
.rank-row.is-selected .rank-name { color: var(--green); font-weight: 750; }
.rank-row.is-selected .rank-progress::-webkit-progress-value { background: var(--green-2); }
.rank-row.is-selected .rank-progress::-moz-progress-bar { background: var(--green-2); }
.rank-value { color: #202622; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }

.trend-stage { min-height: 322px; display: flex; flex-direction: column; justify-content: center; }
.trend-stage svg { width: 100%; height: 250px; overflow: visible; }
.trend-grid { stroke: #e4e9e6; stroke-width: 1; }
.trend-area { fill: rgba(16,62,54,.09); }
.trend-line { fill: none; stroke: var(--green-2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.trend-point { fill: #fff; stroke: var(--green-2); stroke-width: 2; }
.trend-axis-label { fill: #7d8782; font-size: 9px; }
.trend-caption { margin-top: 13px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.empty-chart { min-height: 260px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

.evidence-table-section { margin-top: 18px; padding: 23px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 11px 12px; color: #68716d; background: #f2f5f3; font-weight: 650; text-align: left; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf0ee; color: #303733; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: #f8faf9; }
.value-positive { color: var(--green-2); font-weight: 650; }
.value-negative { color: var(--red-dark); font-weight: 650; }

.detail-drawer { position: fixed; z-index: 70; top: 64px; right: 0; bottom: 0; width: min(430px, 92vw); padding: 25px; background: #fff; box-shadow: -18px 0 42px rgba(19,44,36,.18); transform: translateX(105%); transition: transform 240ms cubic-bezier(.16,1,.3,1); }
.detail-drawer.is-open { transform: translateX(0); }
.detail-drawer-head { display: flex; justify-content: space-between; align-items: start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-drawer-head span { color: var(--red); font-size: 10px; font-weight: 750; }
.detail-drawer-head h2 { margin: 7px 0 0; font-size: 22px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; font-size: 24px; line-height: 1; }
.icon-button:hover { color: var(--ink); border-color: var(--line-strong); }
.detail-body { padding-top: 21px; }
.detail-field { display: grid; grid-template-columns: 102px 1fr; gap: 14px; padding: 13px 0; border-bottom: 1px solid #eef1ef; }
.detail-field dt { color: var(--muted); font-size: 11px; }
.detail-field dd { margin: 0; color: #222925; font-size: 13px; font-weight: 600; word-break: break-word; }
.detail-watermark { margin-top: 28px; padding: 11px; color: #8b5f61; background: var(--danger-soft); font-size: 10px; line-height: 1.6; }

.admin-grid { display: grid; grid-template-columns: minmax(420px, .8fr) minmax(0, 1.2fr); gap: 18px; }
.account-form, .account-list-section, .release-section, .audit-section { padding: 23px; }
.account-form { display: grid; gap: 9px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > div { display: grid; gap: 7px; }
fieldset { display: flex; gap: 15px; margin: 8px 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 6px; color: var(--muted); font-size: 11px; }
fieldset label { display: flex; align-items: center; gap: 6px; color: #35403b; font-size: 12px; }
fieldset input { width: auto; min-height: auto; accent-color: var(--red); }
.form-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 11px; }
.account-list { display: grid; gap: 8px; max-height: 530px; overflow: auto; }
.account-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 13px; background: #f5f8f6; border-radius: 10px; }
.account-row strong { display: block; font-size: 12px; }
.account-row p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.account-actions { display: flex; align-items: center; gap: 6px; }
.small-action { min-height: 31px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--green); background: #fff; font-size: 10px; }
.small-action:hover { border-color: var(--green); }
.release-section { margin-top: 18px; }
.release-list { display: grid; gap: 8px; }
.release-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 13px; background: #f5f8f6; border-radius: 10px; }
.release-row strong { font-size: 12px; }
.release-row p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.status-badge { padding: 5px 8px; color: #17634d; background: #e2f3ec; border-radius: 999px; font-size: 10px; font-weight: 700; }
.audit-section { margin-top: 18px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; max-width: min(520px, calc(100vw - 32px)); transform: translateX(-50%); padding: 12px 16px; color: #fff; background: #16211d; border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 1100px) {
  .login-view { grid-template-columns: 1fr 420px; }
  .signal-field { opacity: .7; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-secondary { min-height: 360px; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .login-view { display: block; background: var(--green); }
  .login-brand { min-height: 39vh; padding: 28px 24px 40px; }
  .login-brand-copy { margin-top: 64px; }
  .login-brand-copy h1 { font-size: 39px; }
  .login-brand-copy p { margin-top: 17px; font-size: 14px; }
  .signal-field { width: 250px; right: -90px; top: 60px; opacity: .45; }
  .login-tagline { display: none; }
  .login-panel { min-height: 61vh; padding: 34px 24px 48px; border-radius: 24px 24px 0 0; }
  .app-shell { padding: 116px 0 0; }
  .app-header { height: 64px; grid-template-columns: 1fr auto; }
  .brand-lockup { border-right: 0; }
  .brand-lockup span, .header-release, .account-menu div { display: none; }
  .app-sidebar { inset: 64px 0 auto; width: auto; height: 52px; padding: 5px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-section-label, .sidebar-access { display: none; }
  .module-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 4px; }
  .nav-item { min-height: 42px; grid-template-columns: 20px 1fr; padding: 4px 8px; }
  .nav-item::before, .nav-item small { display: none; }
  .nav-item svg { width: 17px; }
  .nav-item strong { font-size: 11px; }
  .research-canvas { padding: 24px 14px 52px; }
  .research-header { align-items: stretch; flex-direction: column; gap: 16px; }
  .research-context { width: 100%; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .analysis-primary, .analysis-secondary, .evidence-table-section { padding: 18px 15px; }
  .rank-row { grid-template-columns: 48px minmax(0,1fr) 63px; gap: 8px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-drawer { top: 116px; }
  .watermark-layer { grid-template-columns: repeat(2, minmax(250px, 1fr)); grid-auto-rows: 140px; }
}

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