:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --ink: #102033;
  --muted: #64748b;
  --line: #dbe4ee;
  --sidebar: #08111f;
  --sidebar-soft: #101e31;
  --cyan: #2dd4bf;
  --cyan-deep: #0f9f92;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --red: #ef4444;
  --green: #22c55e;
  --violet: #8b5cf6;
  --shadow: 0 18px 50px rgba(15, 35, 58, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 24px 18px; color: #dce8f4; background:
    radial-gradient(circle at 10% 0%, rgba(45, 212, 191, 0.18), transparent 34%),
    linear-gradient(180deg, #08111f 0%, #0b1829 100%);
  z-index: 30;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark { width: 44px; height: 44px; color: #f5f9fc; border-radius: 14px; background: #13263e; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.brand-mark svg { width: 30px; }
.brand-lockup strong { display: block; letter-spacing: .02em; font-size: 17px; }
.brand-lockup span { display: block; margin-top: 3px; color: #8092a8; font-size: 11px; }
.nav-list { display: grid; gap: 6px; }
.nav-item {
  border: 0; color: #91a4ba; background: transparent; padding: 11px 12px; border-radius: 12px;
  display: flex; align-items: center; gap: 11px; text-align: left; transition: .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(45,212,191,.18), rgba(45,212,191,.06)); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.05); font-size: 14px; }
.nav-item.active .nav-icon { color: #061b1a; background: var(--cyan); }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.privacy-note { display: flex; gap: 10px; align-items: center; }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: 12px; color: #c6d4e3; }
.privacy-note small { margin-top: 2px; color: #6f839b; font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(45,212,191,.1); }
.sidebar-foot p { color: #50647c; font-size: 10px; margin: 16px 0 0; }

.main-panel { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 88px; padding: 18px 30px;
  display: flex; align-items: center; gap: 20px; background: rgba(238,243,248,.88);
  backdrop-filter: blur(18px); border-bottom: 1px solid rgba(207, 219, 232, .75);
}
.topbar-title { min-width: 0; margin-right: auto; }
.topbar-title span { display: block; color: var(--cyan-deep); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar-title h1 { margin: 4px 0 0; font-size: clamp(20px, 2vw, 27px); letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.project-picker { display: grid; gap: 4px; min-width: 200px; }
.project-picker > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.project-picker select, .field select, .field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); padding: 10px 12px; outline: none;
}
.project-picker select:focus, .field select:focus, .field input:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(45,212,191,.12); }
.config-pill { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 11px; color: var(--muted); white-space: nowrap; }
.config-pill.ready { color: #087a6e; border-color: #b7f0e7; background: #effcf9; }
.icon-button { border: 1px solid var(--line); background: #fff; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.mobile-menu { display: none; }
.view { width: min(1500px, 100%); margin: 0 auto; padding: 30px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: -.035em; }
.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 760px; line-height: 1.65; }
.hero {
  position: relative; overflow: hidden; padding: 28px; border-radius: var(--radius-lg); color: #eef9ff;
  background: radial-gradient(circle at 88% 12%, rgba(45,212,191,.35), transparent 29%), linear-gradient(135deg, #0a1727, #12365b);
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.hero::after { content: ""; position: absolute; inset: auto -50px -90px auto; width: 260px; height: 260px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.hero-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; position: relative; z-index: 1; }
.hero-kicker { color: var(--cyan); font-weight: 800; font-size: 12px; letter-spacing: .1em; }
.hero h2 { margin: 10px 0 8px; font-size: clamp(24px, 3vw, 38px); max-width: 850px; letter-spacing: -.045em; }
.hero p { margin: 0; color: #b9cbdf; max-width: 820px; line-height: 1.7; }
.hero .status-orb { min-width: 110px; text-align: right; }
.hero .status-orb strong { display: block; font-size: 34px; }
.hero .status-orb span { color: #94a9c1; font-size: 11px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card, .card {
  border: 1px solid rgba(215,225,236,.9); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 8px 26px rgba(21,44,70,.035);
}
.kpi-card { padding: 18px; }
.kpi-card .label { color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: space-between; }
.kpi-card .value { margin-top: 10px; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.kpi-card .sub { margin-top: 6px; color: var(--muted); font-size: 11px; }
.card { padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.card-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.card-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }

.button {
  border: 0; border-radius: 12px; padding: 11px 16px; background: var(--ink); color: #fff; font-weight: 750; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .15s ease, filter .15s ease;
}
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, #10b9aa, #2dd4bf); color: #042a28; }
.button.secondary { background: #eef3f8; color: var(--ink); border: 1px solid var(--line); }
.button.ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.button.danger { color: #b42318; background: #fff1f0; border: 1px solid #ffd3cf; }
.button.small { padding: 7px 10px; border-radius: 9px; font-size: 11px; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 800; background: #edf2f7; color: #4a5c70; }
.badge.ok { color: #087a53; background: #e9fbf3; }
.badge.warning { color: #9a6200; background: #fff7e2; }
.badge.critical { color: #b42318; background: #fff0ee; }
.badge.blue { color: #175cd3; background: #eff4ff; }

.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.module-card { border: 1px solid var(--line); border-radius: 15px; padding: 15px; background: linear-gradient(180deg, #fff, #fbfdff); position: relative; overflow: hidden; }
.module-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--module-accent, var(--cyan)); }
.module-card strong { display: block; font-size: 14px; }
.module-card p { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 7px 0 0; }
.module-card .module-index { position: absolute; right: 12px; top: 10px; color: #d5e0eb; font-weight: 900; font-size: 22px; }

.funnel { display: grid; gap: 11px; }
.funnel-row { display: grid; grid-template-columns: 76px 1fr 72px; align-items: center; gap: 12px; }
.funnel-row span:first-child { color: var(--muted); font-size: 12px; }
.funnel-row strong { text-align: right; font-size: 12px; }
.bar { height: 9px; overflow: hidden; border-radius: 999px; background: #eaf0f6; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #33d6c5, #3b82f6); min-width: 2px; }

.actions-list { display: grid; gap: 11px; }
.action-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.action-item h4 { margin: 1px 0 5px; font-size: 13px; }
.action-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.action-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; color: #8190a2; font-size: 10px; }

.project-list { display: grid; gap: 13px; }
.project-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.project-card.active { border-color: #88e5d8; box-shadow: 0 0 0 3px rgba(45,212,191,.08); }
.project-card h3 { margin: 0; font-size: 16px; }
.project-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 11px; }
.project-stats { display: flex; gap: 17px; align-items: center; }
.mini-stat strong, .mini-stat span { display: block; text-align: right; }
.mini-stat strong { font-size: 19px; }
.mini-stat span { color: var(--muted); font-size: 10px; }

.upload-zone { border: 1.5px dashed #b8cadb; background: linear-gradient(180deg, #fbfdff, #f5f9fc); border-radius: 18px; padding: 28px; text-align: center; }
.upload-zone.dragging { border-color: var(--cyan-deep); background: #effcf9; }
.upload-zone h3 { margin: 12px 0 7px; }
.upload-zone p { margin: 0 auto 16px; max-width: 520px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.upload-icon { width: 50px; height: 50px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: #e9faf7; color: var(--cyan-deep); font-size: 24px; }
.file-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
input[type="file"] { display: none; }
.hint { color: #7b8a9e; font-size: 10px; }

.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.asset-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; }
.asset-preview { aspect-ratio: 16 / 10; background: #edf2f7; position: relative; overflow: hidden; }
.asset-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-preview .badge { position: absolute; left: 10px; top: 10px; backdrop-filter: blur(6px); }
.asset-body { padding: 14px; }
.asset-body h4 { margin: 0; font-size: 13px; word-break: break-all; }
.asset-body p { margin: 6px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 12px 13px; text-align: left; border-bottom: 1px solid #edf1f5; font-size: 12px; white-space: nowrap; }
th { color: #6b7b8e; background: #f8fafc; font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 6px; }
.field label { color: #596a7e; font-size: 11px; font-weight: 700; }
.field.full { grid-column: 1 / -1; }
.field small { color: #8b98a8; font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.empty-state { padding: 48px 24px; text-align: center; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.empty-state .upload-icon { margin-bottom: 8px; }
.empty-state h3 { margin: 12px 0 7px; }
.empty-state p { margin: 0 auto 18px; max-width: 540px; color: var(--muted); font-size: 12px; line-height: 1.65; }

.diagnosis-summary { border-left: 4px solid var(--cyan); }
.diagnosis-summary.critical { border-left-color: var(--red); }
.diagnosis-summary.warning { border-left-color: var(--amber); }
.evidence { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.evidence-item { border-radius: 13px; padding: 13px; background: #f6f9fc; }
.evidence-item span, .evidence-item strong { display: block; }
.evidence-item span { color: var(--muted); font-size: 10px; }
.evidence-item strong { margin-top: 6px; font-size: 15px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { border-radius: 999px; padding: 7px 10px; font-size: 11px; background: #f0f4f8; color: #506176; }
.risk-list { margin: 0; padding-left: 18px; color: #7c4a03; font-size: 12px; line-height: 1.9; }

.modal-root:empty { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(5,14,25,.58); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 20px; }
.modal { width: min(780px, 100%); max-height: 90vh; overflow: auto; border-radius: 22px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.modal-head { position: sticky; top: 0; z-index: 1; padding: 19px 22px; display: flex; justify-content: space-between; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-close { border: 0; background: #eef3f8; width: 34px; height: 34px; border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 180%); opacity: 0; padding: 12px 16px; border-radius: 12px; background: #07111f; color: #fff; box-shadow: 0 16px 45px rgba(0,0,0,.22); font-size: 12px; transition: .25s ease; max-width: min(520px, calc(100vw - 30px)); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #a61b1b; }
.skeleton { overflow: hidden; position: relative; background: #e8eef5; border-radius: 8px; min-height: 18px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.8), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 1180px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 22px 0 60px rgba(0,0,0,.24); }
  body.nav-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .topbar { padding: 14px 18px; }
  .view { padding: 22px 18px; }
  .kpi-grid, .grid-3, .evidence { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .project-picker { min-width: 150px; }
}
@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  .project-picker { width: 100%; }
  .config-pill { display: none; }
  .kpi-grid, .module-grid, .asset-grid, .form-grid, .grid-3, .evidence { grid-template-columns: 1fr; }
  .hero-top, .page-head, .project-card { grid-template-columns: 1fr; display: grid; }
  .hero .status-orb { text-align: left; }
  .project-stats { justify-content: space-between; }
  .funnel-row { grid-template-columns: 62px 1fr 58px; gap: 8px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 22px 22px 0 0; }
}