:root {
  --ink: #10222b;
  --navy: #0b1d26;
  --navy-soft: #14323e;
  --teal: #0c9b73;
  --teal-dark: #087558;
  --mint: #dff5ed;
  --coral: #ef6a50;
  --amber: #d89523;
  --paper: #f7f9f9;
  --white: #fff;
  --muted: #6c7c83;
  --line: #dce5e3;
  --shadow: 0 1px 3px rgba(8, 36, 45, .06);
  --radius: 10px;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid rgba(12, 155, 115, .32); outline-offset: 2px; }

.boot-screen, .login-page { min-height: 100vh; display: grid; place-items: center; }
.boot-screen { color: var(--muted); }
.brand-mark { display: grid; grid-template-columns: repeat(4, 9px); gap: 4px; margin: 0 auto 18px; }
.brand-mark span { width: 9px; height: 26px; border-radius: 6px; background: var(--teal); animation: pulse 1.2s ease-in-out infinite; }
.brand-mark span:nth-child(2) { animation-delay: .12s; }
.brand-mark span:nth-child(3) { animation-delay: .24s; }
.brand-mark span:nth-child(4) { animation-delay: .36s; }
@keyframes pulse { 50% { transform: scaleY(.45); opacity: .45; } }

.shell { min-height: 100vh; padding-left: 260px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 240px; display: flex; flex-direction: column; color: var(--ink); border-right: 1px solid var(--line); background: var(--white); }
.logo { padding: 30px 28px 26px; border-bottom: 1px solid var(--line); }
.logo strong { display: block; color: var(--navy); font-size: 20px; letter-spacing: 0; }
.logo small { display: block; margin-top: 6px; color: #789097; font-size: 11px; letter-spacing: 0; }
.nav { padding: 18px 14px; overflow-y: auto; }
.nav-label { margin: 16px 14px 8px; color: #91a1a5; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 13px; min-height: 46px; padding: 0 14px; border-radius: 12px; color: #62757b; font-size: 14px; }
.nav a:hover { color: var(--navy); background: #f3f7f6; }
.nav a.active { color: var(--teal-dark); background: #edf8f4; }
.nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sidebar-foot { margin-top: auto; padding: 20px 28px 26px; border-top: 1px solid var(--line); color: #829398; font-size: 11px; line-height: 1.8; }

.topbar { position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: #fff; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--ink); }
.account { display: flex; align-items: center; gap: 12px; }
.account-avatar { width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; color: #fff; background: var(--teal); font-weight: 800; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-meta { text-align: right; }
.account-meta strong, .account-meta span { display: block; }
.account-meta strong { font-size: 13px; }
.account-meta span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.mobile-menu { display: none; border: 0; background: none; color: var(--ink); font-size: 24px; }

.shell { padding-left: 240px; }
.main { width: min(1480px, 100%); margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { display: none; }
h1 { margin: 0; font-size: 26px; line-height: 1.3; letter-spacing: 0; }
.page-desc { max-width: 640px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.head-actions, .toolbar, .tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn { min-height: 42px; padding: 0 17px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--white); font-weight: 650; font-size: 13px; transition: .18s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: #aec0bc; box-shadow: 0 8px 22px rgba(16,34,43,.08); }
.btn.primary { border-color: var(--teal); color: #fff; background: var(--teal); }
.btn.danger { border-color: #f0c1b8; color: #b6402a; background: #fff7f5; }
.btn.quiet { border-color: transparent; background: transparent; box-shadow: none; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn.block { width: 100%; }

.signal-rail { display: none; }
.signal-rail span { height: 5px; border-radius: 6px; background: #d7e2df; }
.signal-rail span.live { background: var(--teal); }
.signal-rail span.warn { background: var(--amber); }
.signal-rail span.issue { background: var(--coral); }

.grid { display: grid; gap: 18px; }
.grid.metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
dialog.panel { width: min(520px,calc(100vw - 32px)); border: 1px solid var(--line); }
dialog::backdrop { background: rgba(16,34,43,.22); backdrop-filter: blur(2px); }
.card { padding: 22px; }
.metric-card { position: relative; min-height: 126px; overflow: hidden; }
.metric-card::after { display: none; }
.metric-card.accent { color: var(--ink); border-color: var(--line); background: #fff; }
.metric-label { position: relative; z-index: 1; color: var(--muted); font-size: 12px; }
.accent .metric-label { color: var(--teal-dark); }
.metric-value { position: relative; z-index: 1; display: block; margin-top: 18px; font-size: 28px; line-height: 1; font-weight: 700; letter-spacing: 0; }
.metric-note { position: relative; z-index: 1; display: block; margin-top: 14px; color: var(--muted); font-size: 11px; }
.accent .metric-note { color: #5d8278; }

.section { margin-top: 34px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 18px; color: var(--muted); background: #f7f9f8; font-size: 11px; font-weight: 650; text-align: left; letter-spacing: .04em; white-space: nowrap; }
td { padding: 16px 18px; border-top: 1px solid #edf1f0; vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fbfa; }
.cell-title { display: block; font-weight: 700; }
.cell-sub { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px; color: #246453; background: var(--mint); font-size: 11px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.status.warn { color: #8b5b0e; background: #fff4dc; }
.status.warn::before { background: var(--amber); }
.status.issue { color: #a93e2a; background: #fff0ed; }
.status.issue::before { background: var(--coral); }
.status.muted { color: #64757b; background: #edf1f0; }
.status.muted::before { background: #91a1a4; }
.machine-code { font: 700 13px "IBM Plex Mono", "SFMono-Regular", monospace; letter-spacing: .04em; }

.field { display: grid; gap: 7px; }
.field > span, .form-label { color: #54666d; font-size: 12px; font-weight: 650; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #ccd9d6; border-radius: 10px; color: var(--ink); background: #fff; transition: .15s; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); outline: 3px solid rgba(12,155,115,.1); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.panel { padding: 24px; }
.panel-title { margin: 0 0 20px; font-size: 16px; }
.toolbar .input { width: 260px; }
.tabs { padding: 4px; border-radius: 12px; background: #e7eeec; }
.tab { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.tab.active { color: var(--ink); background: #fff; box-shadow: 0 3px 10px rgba(16,34,43,.08); }

.empty, .error-box, .loading-box { min-height: 180px; display: grid; place-items: center; padding: 30px; border: 1px dashed #c9d6d3; border-radius: var(--radius); color: var(--muted); background: rgba(255,255,255,.55); text-align: center; line-height: 1.7; }
.error-box { min-height: auto; border-style: solid; border-color: #efc1b8; color: #a93e2a; background: #fff7f5; }
.module-error { display: grid; justify-items: start; gap: 14px; }
.module-error .error-box { width: 100%; justify-items: start; text-align: left; }
.loading-box { border: 0; }
.skeleton { overflow: hidden; min-height: 150px; border-radius: var(--radius); background: linear-gradient(90deg,#e9eeed 25%,#f6f8f7 45%,#e9eeed 65%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.login-page { position: relative; overflow: hidden; padding: 24px; color: var(--ink); background: #f5f7f7; }
.login-page::before, .login-page::after { display: none; }
.login-wrap { position: relative; z-index: 2; width: 420px; display: block; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 30px rgba(12,52,61,.08); overflow: hidden; }
.login-intro { min-height: 560px; display: flex; flex-direction: column; justify-content: space-between; padding: 52px; border-right: 1px solid var(--line); background: linear-gradient(145deg,#fff,#f0faf6); }
.login-intro h1 { max-width: 460px; color: var(--navy); font-size: clamp(38px,5vw,66px); }
.login-intro p { max-width: 430px; color: #687e84; line-height: 1.8; }
.login-signal { display: grid; grid-template-columns: repeat(8,1fr); gap: 6px; }
.login-signal span { height: 8px; border-radius: 8px; background: #dce8e5; }
.login-signal span:nth-child(-n+5) { background: var(--teal); }
.login-form { align-self: center; display: grid; gap: 18px; padding: 40px; }
.login-form h2 { margin: 12px 0 0; font-size: 22px; }
.login-brand { display: flex; align-items: baseline; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.login-logo { color: var(--teal-dark); font-size: 20px; font-weight: 700; }
.login-brand small { color: var(--muted); font-size: 12px; }
.login-form > p { margin: -8px 0 8px; color: #788c91; font-size: 12px; }
.login-form .field span { color: #53676d; }
.login-form .input { border-color: #cbd9d6; color: var(--ink); background: #fbfdfc; }
.login-form .btn { margin-top: 6px; min-height: 48px; }
.login-error { min-height: 20px; color: #ff9b86; font-size: 12px; }

.anomaly-list { display: grid; gap: 10px; }
.anomaly { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 14px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.anomaly:hover { border-color: #b4c7c3; }
.anomaly-light { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.anomaly.warn .anomaly-light { background: var(--amber); box-shadow: none; }
.anomaly.issue .anomaly-light { background: var(--coral); box-shadow: none; }
.anomaly h3 { margin: 0; font-size: 14px; }
.anomaly p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.anomaly strong { font-size: 22px; font-weight: 700; }

.model-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.model-card { overflow: hidden; padding: 0; }
.model-cover { width: 100%; aspect-ratio: 4/3; display: grid; place-items: center; object-fit: cover; color: #759099; background: linear-gradient(145deg,#dce9e6,#edf3f2); font: 800 34px "Arial Narrow",sans-serif; }
.model-body { padding: 18px; }
.model-body h3 { margin: 0; font-size: 15px; }
.model-meta { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0 16px; color: var(--muted); font-size: 11px; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #e6eeec; }
.product-line { display: flex; align-items: center; gap: 12px; }
.editor-row { display: grid; grid-template-columns: minmax(180px,1.4fr) repeat(3,minmax(100px,.6fr)) auto; gap: 12px; align-items: end; padding: 16px 0; border-top: 1px solid #edf1f0; }
.editor-row:first-child { border-top: 0; }
.switch { appearance: none; width: 38px; height: 22px; padding: 2px; border-radius: 20px; background: #c8d2d0; transition: .2s; }
.switch::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.switch:checked { background: var(--teal); }
.switch:checked::before { transform: translateX(16px); }
.summary-band { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; border-radius: 16px; overflow: hidden; background: var(--line); }
.summary-band > div { padding: 18px; background: #fff; text-align: center; }
.summary-band strong, .summary-band span { display: block; }
.summary-band strong { font: 800 22px "DIN Alternate",sans-serif; }
.summary-band span { margin-top: 5px; color: var(--muted); font-size: 10px; }

.chart { width: 100%; height: 280px; display: block; }
.chart-grid { stroke: #e4ebe9; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--teal); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-compare { fill: none; stroke: #9aabad; stroke-width: 2; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.upload-drop { min-height: 220px; display: grid; place-items: center; padding: 28px; border: 2px dashed #b9ccc7; border-radius: 18px; color: var(--muted); background: #f8fbfa; text-align: center; cursor: pointer; }
.upload-drop.drag { border-color: var(--teal); background: var(--mint); }
.preview-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-top: 16px; }
.preview-image { position: relative; }
.preview-image img { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; }
.remove-image { position: absolute; top: 7px; right: 7px; width: 30px; height: 30px; border: 0; border-radius: 50%; color: #fff; background: rgba(16,34,43,.78); font-size: 20px; line-height: 1; }
.progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e4ebe9; }
.progress-value { height: 100%; border-radius: inherit; background: var(--teal); transition: width .25s ease; }
.job-progress { max-width: 840px; }
.rule-row { display: grid; grid-template-columns: minmax(180px,1fr) minmax(120px,.4fr) auto auto; gap: 12px; align-items: end; padding: 14px 0; border-top: 1px solid #edf1f0; }
.rule-row:first-child { border-top: 0; }
.profile-editor { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
.setting-list { border-top: 1px solid #edf1f0; }
.setting-row { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid #edf1f0; font-size: 13px; }
.scan-dialog { width: min(520px,calc(100vw - 32px)); }
.scan-video { width: 100%; min-height: 280px; margin-top: 18px; border-radius: 12px; object-fit: cover; background: #10222b; }
.model-viewer { width: 100%; height: min(68vh,650px); display: grid; place-items: center; border-radius: 18px; color: var(--muted); background: radial-gradient(circle,#fff,#e7efed); }
.detail-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 18px; }
.detail-list { display: grid; gap: 0; }
.detail-item { display: flex; justify-content: space-between; gap: 24px; padding: 13px 0; border-top: 1px solid #edf1f0; font-size: 13px; }
.detail-item:first-child { border-top: 0; }
.detail-item span:first-child { color: var(--muted); }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 100; max-width: 360px; padding: 13px 18px; border-radius: 11px; color: #fff; background: var(--navy); box-shadow: 0 16px 50px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a94432; }

@media (max-width: 1180px) {
  .grid.metrics { grid-template-columns: repeat(3,1fr); }
  .model-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 860px) {
  .shell { padding-left: 0; padding-bottom: 72px; }
  .sidebar { inset: auto 0 0 0; width: auto; height: 66px; flex-direction: row; border: 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 34px rgba(16,34,43,.08); }
  .logo,.nav-label,.sidebar-foot { display: none; }
  .nav { width: 100%; display: flex; padding: 7px 8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { min-width: 70px; min-height: 52px; flex: 1 0 70px; flex-direction: column; justify-content: center; gap: 3px; padding: 0 4px; font-size: 9px; }
  .nav a.active { box-shadow: none; }
  .nav svg { width: 18px; height: 18px; }
  .topbar { height: 64px; padding: 0 20px; }
  .account-meta,.breadcrumb { display: none; }
  .mobile-menu { display: none; }
  .main { padding: 26px 18px 50px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid.metrics,.grid.two,.grid.three { grid-template-columns: repeat(2,1fr); }
  .model-grid { grid-template-columns: repeat(2,1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .editor-row { grid-template-columns: 1fr 1fr; padding: 18px 0; }
  .editor-row > :first-child { grid-column: 1/-1; }
  .rule-row { grid-template-columns: 1fr 1fr; }
  .rule-row > :first-child { grid-column: 1/-1; }
  .summary-band { grid-template-columns: repeat(2,1fr); }
  .login-wrap { width: min(420px,100%); }
}
@media (max-width: 540px) {
  .grid.metrics,.grid.two,.grid.three,.model-grid,.form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .metric-card { min-height: 132px; }
  .head-actions,.toolbar { width: 100%; }
  .head-actions .btn,.toolbar .input { flex: 1; width: auto; }
  .table-wrap { margin-inline: -18px; border-radius: 0; }
  th,td { padding-inline: 14px; }
  .login-page { padding: 0; }
  .login-page { align-items: start; padding: 15vh 16px 24px; }
  .login-wrap { border-radius: 8px; }
  .login-form { padding: 30px 24px; }
  .preview-grid { grid-template-columns: repeat(2,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
