:root {
  --ink: #15201c;
  --muted: #65716c;
  --line: #dfe6e2;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --green-950: #0b261c;
  --green-900: #12372a;
  --green-800: #19503b;
  --green-700: #216a4d;
  --green-100: #dff2e8;
  --amber: #e99a25;
  --amber-soft: #fff2d9;
  --red: #c9473d;
  --red-soft: #fde9e6;
  --blue: #367aa3;
  --blue-soft: #e5f2fa;
  --shadow: 0 16px 40px rgba(18, 55, 42, .08);
  --radius: 16px;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column; padding: 22px 16px 18px; color: #fff; background: var(--green-950); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand-mark { width: 42px; height: 42px; display: inline-grid; flex: 0 0 42px; place-items: center; border-radius: 13px; color: var(--green-950); background: #aee6c7; font-size: 20px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .04em; font-size: 16px; }
.brand small { margin-top: 1px; color: #8eb2a2; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.main-nav { display: grid; gap: 5px; }
.main-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 11px; color: #a9c1b6; transition: .18s ease; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.main-nav a.active { color: #fff; background: var(--green-800); box-shadow: inset 3px 0 #aee6c7; }
.nav-icon { width: 23px; text-align: center; font-size: 17px; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: grid; grid-template-columns: 36px 1fr 30px; align-items: center; gap: 9px; padding: 14px 4px 0; border-top: 1px solid rgba(255,255,255,.1); }
.user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--green-950); background: #ccebd9; font-weight: 800; }
.user-meta { min-width: 0; }
.user-meta strong, .user-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 13px; }
.user-meta small { color: #87a99a; font-size: 10px; }
.icon-button { border: 0; color: #a9c1b6; background: transparent; cursor: pointer; font-size: 20px; }

.main-column { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; height: 76px; display: flex; align-items: center; gap: 16px; padding: 0 34px; border-bottom: 1px solid rgba(223,230,226,.85); background: rgba(255,255,255,.9); backdrop-filter: blur(14px); }
.topbar-title { display: flex; flex-direction: column; margin-right: auto; }
.topbar-title small { color: var(--muted); font-size: 11px; }
.topbar-title strong { font-size: 19px; letter-spacing: -.01em; }
.menu-button { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.content { max-width: 1500px; margin: 0 auto; padding: 28px 34px 54px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow { margin-bottom: 5px; color: var(--green-700); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; cursor: pointer; font-weight: 650; transition: .16s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(18,55,42,.1); }
.button-primary { color: #fff; border-color: var(--green-800); background: var(--green-800); }
.button-secondary { color: var(--green-800); border-color: #b9d8c8; background: #eef8f2; }
.button-danger { color: #fff; border-color: var(--red); background: var(--red); }
.button-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.button-compact { min-height: 36px; padding: 7px 13px; font-size: 13px; }
.button-large { width: 100%; min-height: 50px; font-size: 15px; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.alert { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 15px; border: 1px solid; border-radius: 11px; }
.alert span { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 22px; border-radius: 50%; font-weight: 900; }
.alert-success { color: #155d40; border-color: #b8dfc9; background: #eaf8f0; }
.alert-warning { color: #7d5312; border-color: #ecd39f; background: #fff7e7; }
.alert-danger { color: #842f28; border-color: #edc2bd; background: #fff0ee; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { position: relative; min-height: 142px; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; width: 82px; height: 82px; right: -28px; bottom: -28px; border: 16px solid var(--green-100); border-radius: 50%; opacity: .8; }
.stat-card.attention::after { border-color: var(--amber-soft); }
.stat-card.danger::after { border-color: var(--red-soft); }
.stat-card small { color: var(--muted); font-weight: 650; }
.stat-card strong { display: block; margin-top: 13px; font-size: 34px; line-height: 1; letter-spacing: -.04em; }
.stat-card .stat-foot { margin-top: 12px; color: var(--muted); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; }
.card-header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfcfb; border-radius: 0 0 var(--radius) var(--radius); }
.section-stack { display: grid; gap: 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8eeeb; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f8faf9; font-size: 11px; font-weight: 750; letter-spacing: .04em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdfc; }
td strong { display: block; }
td small { display: block; color: var(--muted); }
.table-link { color: var(--green-700); font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.muted { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; background: #edf1ef; color: #52605a; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: #1e704f; background: #e2f4ea; }
.badge-danger { color: #a43830; background: #fbe7e4; }
.badge-warning { color: #95600f; background: #fff0d2; }
.badge-info { color: #286d96; background: #e4f2fa; }
.badge-neutral { color: #5e6964; background: #edf1ef; }

.filters { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, .35fr)) auto; gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.filters .button { align-self: end; }
label { display: grid; gap: 6px; color: #3e4a45; font-size: 12px; font-weight: 680; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #ced8d3; border-radius: 9px; outline: none; color: var(--ink); background: #fff; transition: .15s ease; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(33,106,77,.12); }
input::placeholder, textarea::placeholder { color: #9aa49f; }
.form-stack { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.help { color: var(--muted); font-size: 11px; font-weight: 400; }
.check-line { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.check-line input { width: 18px; min-height: 18px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.password-field button { position: absolute; right: 8px; top: 7px; border: 0; color: var(--green-700); background: transparent; cursor: pointer; font-size: 12px; }

.empty-state { padding: 46px 24px; text-align: center; }
.empty-state-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: var(--green-700); background: var(--green-100); font-size: 24px; }
.empty-state h3 { margin: 0 0 6px; }
.empty-state p { max-width: 480px; margin: 0 auto 18px; color: var(--muted); }

.detail-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 24px; margin-bottom: 18px; padding: 24px; border-radius: 18px; color: #fff; background: var(--green-900); box-shadow: var(--shadow); }
.detail-hero::after { content: ""; position: absolute; right: -40px; top: -65px; width: 220px; height: 220px; border: 38px solid rgba(174,230,199,.11); border-radius: 50%; }
.detail-hero h1 { margin: 3px 0 7px; font-size: 27px; }
.detail-hero p { margin: 0; color: #a9c8ba; }
.hero-code { display: inline-flex; align-items: center; padding: 5px 9px; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; font: 12px/1.2 ui-monospace, monospace; }
.hero-actions { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 9px; }
.hero-actions .button { border-color: rgba(255,255,255,.24); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; }
.detail-item { padding: 13px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-item:nth-child(4n) { border-right: 0; }
.detail-item small { display: block; color: var(--muted); font-size: 11px; }
.detail-item strong { display: block; margin-top: 3px; font-size: 13px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tabs button { min-height: 38px; padding: 8px 15px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; font-weight: 650; }
.tabs button.active { color: #fff; background: var(--green-800); }

.task-list { display: grid; gap: 12px; }
.task-item { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.task-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.task-item h3 { margin: 0; font-size: 15px; }
.task-item p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.due { color: var(--red); font-size: 11px; font-weight: 750; }
.result-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.result-choice label { position: relative; display: block; cursor: pointer; }
.result-choice input { position: absolute; opacity: 0; pointer-events: none; }
.result-choice span { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #f8faf9; }
.result-choice input:checked + .choice-normal { color: #176343; border-color: #78bd98; background: #e5f6ed; box-shadow: inset 0 0 0 1px #78bd98; }
.result-choice input:checked + .choice-abnormal { color: #9a342d; border-color: #dd8e86; background: #fdecea; box-shadow: inset 0 0 0 1px #dd8e86; }
.abnormal-fields { display: grid; grid-template-columns: .35fr 1fr; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 10px; background: #fff5f3; }
.task-summary { position: sticky; top: 94px; }

.scan-layout { display: grid; grid-template-columns: minmax(0,1fr) 370px; gap: 20px; }
.scanner { position: relative; min-height: 460px; overflow: hidden; display: grid; place-items: center; border-radius: 20px; color: #fff; background: var(--green-950); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: relative; z-index: 2; width: min(58vw, 270px); aspect-ratio: 1; border: 2px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(5,22,16,.42); }
.scanner-frame::before, .scanner-frame::after { content: ""; position: absolute; left: 13%; right: 13%; height: 2px; background: #7ff0b5; box-shadow: 0 0 12px #7ff0b5; }
.scanner-frame::before { top: 32%; }
.scanner-frame::after { bottom: 32%; opacity: .45; }
.scanner-copy { position: absolute; z-index: 3; bottom: 28px; left: 20px; right: 20px; text-align: center; }
.scanner-copy p { color: #b7cfc4; }

.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { position: relative; padding: 0 0 22px 30px; }
.timeline-item::before { content: ""; position: absolute; left: 8px; top: 10px; bottom: -6px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 3px; top: 5px; width: 11px; height: 11px; border: 3px solid #fff; border-radius: 50%; background: var(--green-700); box-shadow: 0 0 0 1px var(--green-700); }
.timeline-item strong { display: block; }
.timeline-item p { margin: 4px 0; color: var(--muted); }
.timeline-item small { color: #8b9691; }

.auth-page { min-height: 100vh; background: #eef3f0; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.08fr) minmax(430px, .92fr); }
.login-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 8vw; color: #fff; background: var(--green-950); }
.login-story::before { content: ""; position: absolute; left: -15vw; bottom: -28vw; width: 55vw; height: 55vw; border: 8vw solid rgba(174,230,199,.08); border-radius: 50%; }
.login-story::after { content: ""; position: absolute; right: -14vw; top: -18vw; width: 42vw; height: 42vw; border: 1px solid rgba(174,230,199,.16); border-radius: 50%; box-shadow: 0 0 0 5vw rgba(174,230,199,.035), 0 0 0 10vw rgba(174,230,199,.025); }
.story-badge { position: relative; z-index: 1; width: max-content; padding: 6px 10px; border: 1px solid rgba(174,230,199,.26); border-radius: 999px; color: #aee6c7; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.login-story h1 { position: relative; z-index: 1; margin: 24px 0 16px; font-size: clamp(42px,5vw,72px); line-height: 1.1; letter-spacing: -.055em; }
.login-story > p { position: relative; z-index: 1; max-width: 580px; margin: 0; color: #abc6ba; font-size: 16px; }
.story-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 60px; }
.story-grid div { padding: 14px 0; border-top: 1px solid rgba(255,255,255,.15); }
.story-grid strong, .story-grid span { display: block; }
.story-grid strong { margin-bottom: 4px; }
.story-grid span { color: #89a99a; font-size: 11px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px,6vw,90px); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.login-card { max-width: 440px; }
.login-card h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.login-card > p { margin: 5px 0 25px; color: var(--muted); }
.login-hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 11px 13px; border-radius: 9px; color: var(--muted); background: #e5ebe7; font-size: 11px; }
.login-hint code { color: var(--green-800); }
.login-footer { margin-top: 34px; color: #87928d; }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; text-align: center; background: var(--canvas); }
.error-page main { max-width: 500px; }
.error-code { color: var(--green-700); font-size: 74px; font-weight: 900; letter-spacing: -.07em; }
.error-page h1 { margin: -10px 0 8px; }
.error-page p { margin: 0 0 20px; color: var(--muted); }

.mobile-nav, .sidebar-backdrop { display: none; }

@media (max-width: 1120px) {
  :root { --sidebar: 218px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .detail-grid { grid-template-columns: repeat(3,1fr); }
  .detail-item:nth-child(4n) { border-right: 1px solid var(--line); }
  .detail-item:nth-child(3n) { border-right: 0; }
  .filters { grid-template-columns: repeat(2,1fr); }
  .login-story { padding: 7vw; }
}

@media (max-width: 820px) {
  body { padding-bottom: 70px; }
  .sidebar { width: min(82vw, 290px); transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(5,22,16,.48); }
  .sidebar-open .sidebar-backdrop { display: block; }
  .main-column { margin-left: 0; }
  .topbar { height: 64px; padding: 0 16px; }
  .topbar-title small { display: none; }
  .topbar-title strong { font-size: 17px; }
  .topbar > .button { display: none; }
  .menu-button { display: block; }
  .content { padding: 20px 14px 28px; }
  .mobile-nav { position: fixed; z-index: 24; left: 0; right: 0; bottom: 0; height: 66px; display: grid; grid-template-columns: repeat(5,1fr); padding: 6px max(8px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); font-size: 10px; }
  .mobile-nav a span { font-size: 19px; line-height: 1; }
  .mobile-nav a.active { color: var(--green-700); font-weight: 750; }
  .mobile-nav .scan-nav { width: 52px; height: 52px; align-self: center; justify-self: center; margin-top: -22px; border: 4px solid var(--canvas); border-radius: 50%; color: #fff; background: var(--green-800); box-shadow: 0 8px 20px rgba(18,55,42,.26); }
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 12px; }
  .page-actions { justify-content: flex-end; }
  .page-actions .button { min-height: 36px; padding: 7px 11px; font-size: 12px; }
  .grid-2, .grid-equal, .scan-layout { grid-template-columns: 1fr; }
  .task-summary { position: static; }
  .detail-hero { grid-template-columns: 1fr; padding: 19px; }
  .detail-hero h1 { font-size: 22px; }
  .hero-actions { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: repeat(2,1fr); }
  .detail-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .detail-item:nth-child(2n) { border-right: 0; }
  .form-grid-3 { grid-template-columns: repeat(2,1fr); }
  .field-span-3 { grid-column: span 2; }
  .scanner { min-height: 390px; }
  .login-shell { display: block; min-height: 100vh; }
  .login-story { min-height: 270px; padding: 46px 28px 42px; justify-content: flex-end; }
  .login-story h1 { margin: 17px 0 8px; font-size: 38px; }
  .login-story > p { font-size: 13px; }
  .story-grid { display: none; }
  .login-panel { padding: 28px 24px 50px; }
  .login-brand { margin-bottom: 24px; }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .stat-card { min-height: 120px; padding: 15px; }
  .stat-card strong { font-size: 28px; }
  .stat-card .stat-foot { font-size: 10px; }
  .page-head { display: block; }
  .page-actions { justify-content: flex-start; margin-top: 12px; }
  .filters, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .field-span-2, .field-span-3 { grid-column: span 1; }
  .filters { padding: 12px; }
  .card-header { padding: 13px 14px; }
  .card-body { padding: 14px; }
  th, td { padding: 10px 11px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .detail-item { padding: 11px 12px; }
  .task-item { padding: 13px; }
  .abnormal-fields { grid-template-columns: 1fr; }
  .form-actions { position: sticky; bottom: 72px; z-index: 10; margin: 10px -14px -14px; padding: 12px 14px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
  .form-actions .button-primary { flex: 1; }
  .login-story { min-height: 240px; }
  .login-story h1 { font-size: 32px; }
  .login-hint { display: grid; }
}

