:root {
  color-scheme: light;
  --bg: #f4f6f2; --surface: #fff; --sidebar: #fbfcf9; --stroke: #dfe6df;
  --ink: #192d26; --muted: #4d6559; --primary: #17573e; --accent: #215e46;
  --active: #e6f1e9; --alt: #f0f5f0; --mint: #e2efe6; --mint-ink: #235541;
  --amber: #faf0da; --amber-ink: #76510c; --violet: #f0eaf6; --violet-ink: #65447c;
  --blue: #e6eff6; --blue-ink: #345a74; --rose: #f8eae6; --rose-ink: #894337;
  --hero: #173e30; --hero-text: #fffdf8; --hero-muted: #d0e4d8; --bar: #408568;
  --focus: #9a540a; --shadow: 0 6px 26px #223e2910;
  font: 15px/1.5 "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131e19; --surface: #1c2a23; --sidebar: #17231d; --stroke: #35473c;
  --ink: #eef4ee; --muted: #bdcec3; --primary: #215b43; --accent: #b1e3c3;
  --active: #294239; --alt: #24352c; --mint: #2a4436; --mint-ink: #b3e2c5;
  --amber: #443922; --amber-ink: #fae0a1; --violet: #3c304b; --violet-ink: #e3c7fa;
  --blue: #263c4a; --blue-ink: #bfdced; --rose: #492f2e; --rose-ink: #f6c6bd;
  --hero: #224638; --hero-text: #fffdf8; --hero-muted: #d8ede0; --bar: #92d5ad;
  --focus: #ffc078; --shadow: 0 6px 26px #0003;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 12; top: 10px; left: 10px; transform: translateY(-160%);
  padding: 10px 14px; border-radius: 8px; background: var(--surface); color: var(--ink); }
.skip-link:focus { transform: none; }
button, .btn { white-space: normal; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
h1, .hero h2 { font: 500 clamp(2.3rem, 4vw, 3.1rem)/1.1 Georgia, "Songti SC", "SimSun", serif; letter-spacing: -.045em; }
h2 { font-size: 1.22rem; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: 1rem; line-height: 1.3; }
small, .muted { color: var(--muted); }
strong, .number { font-variant-numeric: tabular-nums; }
.icon {
  display: inline-block; width: 20px; height: 20px; flex: 0 0 20px;
  background: currentColor; mask: var(--icon) center/contain no-repeat;
}
.shell { min-height: 100dvh; display: grid; grid-template-columns: 234px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 25px 15px 16px;
  background: var(--sidebar); border-right: 1px solid var(--stroke); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 1px 6px 29px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.brand strong { display: block; font-size: 1.02rem; line-height: 1.3; letter-spacing: -.03em; }
.brand small { display: block; font-size: .74rem; }
.nav-group { margin: 0 0 14px; }
.nav-group p { margin: 0 10px 5px; font-size: .7rem; font-weight: 750; letter-spacing: .105em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 42px; width: 100%; color: var(--muted);
  border: 0; border-radius: 10px; text-align: left; background: transparent; padding: 8px 10px; font-weight: 600;
}
.nav-item .icon { width: 18px; height: 18px; flex-basis: 18px; }
.nav-item:hover, .nav-item[aria-current="page"] { background: var(--active); color: var(--ink); }
.nav-item[aria-current="page"] { font-weight: 750; }
.side-bottom { margin-top: auto; border-top: 1px solid var(--stroke); padding: 13px 5px 0; }
.avatar { width: 37px; height: 37px; flex: 0 0 37px; border-radius: 50%; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; font-weight: 750; }
.person { display: flex; align-items: center; gap: 10px; }
.person small { display: block; }
.main-shell { min-width: 0; }
.mast {
  min-height: 70px; padding: 10px clamp(18px, 3.4vw, 50px); background: var(--sidebar); border-bottom: 1px solid var(--stroke);
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.mast-trail { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--muted); font-size: .88rem; }
.mast-trail img { display: none; width: 34px; height: 34px; border-radius: 9px; }
.mast-trail .icon { width: 13px; height: 13px; flex-basis: 13px; }
.mast-actions, .actions, .inline { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.badge {
  display: inline-flex; gap: 5px; align-items: center; background: var(--alt); color: var(--muted);
  padding: 4px 8px; border-radius: 6px; font-size: .74rem; line-height: 1.35; font-weight: 720;
}
.badge .icon { width: 13px; height: 13px; flex-basis: 13px; }
.tone-mint { background: var(--mint); color: var(--mint-ink); }
.tone-amber { background: var(--amber); color: var(--amber-ink); }
.tone-violet { background: var(--violet); color: var(--violet-ink); }
.tone-blue { background: var(--blue); color: var(--blue-ink); }
.tone-rose { background: var(--rose); color: var(--rose-ink); }
.btn {
  min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  border: 1px solid var(--stroke); border-radius: 10px; background: var(--surface); padding: 7px 12px; font-weight: 700;
}
.btn:hover { background: var(--alt); }
.btn.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: #28664c; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent); }
.btn.quiet:hover { background: var(--alt); }
.btn.icon-only { width: 42px; padding: 0; }
.btn .icon { width: 17px; height: 17px; flex-basis: 17px; }
main { max-width: 1510px; margin: auto; padding: 30px clamp(18px, 3.4vw, 50px) 55px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 25px; }
.heading p { color: var(--muted); margin-top: 8px; }
.heading .kicker { margin-top: 0; margin-bottom: 7px; }
.kicker { display: flex; align-items: center; gap: 8px; font-size: .73rem; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.hero {
  position: relative; background: var(--hero); color: var(--hero-text); border-radius: 23px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr); min-height: 248px; isolation: isolate;
}
.hero-body { padding: 24px 26px; grid-column: 1; grid-row: 1; z-index: 1; align-self: center; }
.hero h2 { margin: 7px 0 9px; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.hero p { color: var(--hero-muted); margin-bottom: 16px; max-width: 35ch; }
.hero .kicker { color: var(--hero-muted); margin: 0; }
.hero .btn { background: #f4f6e8; color: #193d2d; border: 0; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center; grid-column: 2; grid-row: 1; min-height: 248px; position: absolute; inset: 0; }
.hero::after { content: ""; grid-column: 2; grid-row: 1; position: absolute; inset: 0; background: linear-gradient(90deg, var(--hero), transparent 38%); z-index: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; min-width: 0; }
.grid.dashboard-lead { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: stretch; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.detail { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  padding: 18px; border-radius: 18px; border: 1px solid var(--stroke); background: var(--surface);
  min-width: 0; box-shadow: var(--shadow); overflow-wrap: anywhere;
}
.card > p { margin-top: 6px; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.card-head > div { min-width: 0; }
.card-head > .btn, .mast-actions .btn { flex-shrink: 0; overflow-wrap: normal; white-space: nowrap; }
.card-head small { display: block; margin-top: 4px; }
.section-title { display: flex; align-items: center; gap: 8px; }
.section-title .icon { color: var(--accent); }
.stat { min-height: 113px; }
.stat-top { display: flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 650; font-size: .86rem; }
.stat-top .icon { width: 16px; height: 16px; flex-basis: 16px; }
.stat strong { display: block; margin: 3px 0 1px; font-size: 1.95rem; line-height: 1.23; letter-spacing: -.045em; }
.stat small { display: block; }
.tile-icon, .row-icon { display: grid; place-items: center;  width: 41px; height: 41px; border-radius: 11px; flex: 0 0 41px; }
.row-icon { width: 39px; height: 39px; flex-basis: 39px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin: 2px 0 15px; }
.quick-actions button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px;
  border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface); font-size: .76rem; font-weight: 700; padding: 6px 2px;
}
.quick-actions button:hover { background: var(--alt); }
.quick-actions .tile-icon { width: 31px; height: 31px; flex-basis: 31px; border-radius: 8px; }
.quick-actions .icon { width: 16px; height: 16px; }
.panel-note { display: flex; align-items: start; gap: 10px; padding: 11px; background: var(--alt); border-radius: 10px; color: var(--muted); font-size: .86rem; }
.panel-note .icon { width: 17px; height: 17px; flex-basis: 17px; margin-top: 2px; color: var(--accent); }
.panel-note strong { color: var(--ink); }
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; gap: 11px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--stroke); min-width: 0; }
.line:last-child { border-bottom: 0; }
.line > div:nth-child(2) { flex: 1; min-width: 0; }
.line small { display: block; }
.line-tail { color: var(--muted); text-align: right; font-size: .8rem; }
.timeline .line { position: relative; gap: 14px; align-items: start; padding: 13px 0; }
.timeline .line time { min-width: 52px; flex: 0 0 52px; font-weight: 750; font-variant-numeric: tabular-nums; padding-top: 6px; }
.timeline .line > div:nth-child(2) { flex: 0 0 39px; }
.timeline .line > div:nth-child(3) { flex: 1; }
.timeline .line .btn { min-height: 40px; }
.chart { display: grid; grid-template-columns: repeat(var(--count, 7), minmax(0, 1fr)); align-items: end; gap: 7px; padding: 9px 1px 4px; min-height: 174px; }
.chart-column { display: grid; grid-template-rows: 122px auto; text-align: center; gap: 6px; min-width: 0; }
.chart-track {
  display: flex; justify-content: center; align-items: end; border-bottom: 1px solid var(--stroke);
  background: repeating-linear-gradient(to top, transparent 0, transparent 29px, var(--stroke) 29px, var(--stroke) 30px);
}
.chart-bar { width: min(67%, 45px); height: max(3px,var(--height)); border-radius: 6px 6px 0 0; background: var(--bar); opacity: .72; }
.chart-column.current .chart-bar { opacity: 1; background: var(--accent); }
.chart-bar.has-range, .chart-column.current .chart-bar.has-range {
  background: linear-gradient(to top, var(--bar) var(--known), var(--mint) var(--known));
  border: 1px solid var(--bar);
}
.chart-null { color: var(--muted); font-size: .72rem; }
.chart-column small { font-size: .74rem; overflow-wrap: normal; }
.chart.dense { gap: 3px; }
.chart.dense .chart-column small { font-size: .59rem; }
.segmented { display: flex; flex-wrap: wrap; padding: 3px; gap: 3px; border: 1px solid var(--stroke); background: var(--alt); border-radius: 10px; }
.segmented button { background: transparent; border: 0; border-radius: 7px; min-height: 36px; font-size: .85rem; padding: 4px 10px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 730; box-shadow: var(--shadow); }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.search { display: flex; gap: 8px; align-items: center; min-width: min(100%, 250px); }
.search input { width: 100%; }
.scroll-table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .88rem; }
th, td { padding: 11px 8px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; font-weight: 750; }
tr:last-child td { border-bottom: 0; }
table.wide { min-width: 540px; }
.meter { height: 8px; background: var(--alt); border-radius: 20px; overflow: hidden; margin: 7px 0; }
.meter span { display: block; width: var(--width); height: 100%; background: var(--bar); }
.nutrition-tiles .stat { min-height: 100px; }
.report-chart { margin-bottom: 16px; }
.report-chart details { color: var(--accent); font-size: .84rem; }
.report-chart details p { margin: 7px 0; }
.stack, .health-notes { display: grid; gap: 12px; align-content: start; min-width: 0; }
.health-overview { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; }
.health-overview strong { font-size: 1.64rem; letter-spacing: -.035em; }
.source-list { padding-inline-start: 1.2rem; }
.source-list a { color: var(--accent); }
.intake-tail { display: flex; align-items: center; gap: 4px; }
.intake-tail .btn { min-height: 42px; }
.camera-after { display: grid; justify-items: start; gap: 6px; margin: 10px 0; }
.camera-after .camera-image img { width: 220px; }
.actor-switch .icon { width: 16px; height: 16px; flex-basis: 16px; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 440px); padding: 24px; }
.auth-card img { margin-bottom: 14px; border-radius: 10px; }
.auth-card form { margin-top: 18px; }
.camera-image { position: relative; border-radius: 13px; overflow: hidden; background: var(--alt); }
.camera-image img { width: 100%; aspect-ratio: 1.55; object-fit: cover; }
.photo-document img { max-height: 420px; object-fit: contain; }
.camera-status:not(:empty) { margin-top: 10px; }
.camera-import-fields { margin-top: 12px; }
.document-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.camera-image .badge { position: absolute; left: 10px; bottom: 10px; background: #f5faf1; color: #254536; }
.camera-controls { margin: 13px 0; }
.product { display: flex; flex-direction: column; gap: 11px; }
.product .card-head { margin: 0; align-items: center; }
.product .actions { margin-top: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label { display: grid; align-content: start; gap: 4px; color: var(--muted); font-size: .86rem; font-weight: 650; }
.form-grid label > :is(input, select, textarea) { max-width: 100%; }
.field-full { grid-column: 1/-1; }
input, select, textarea {
  border: 1px solid var(--stroke); border-radius: 8px; min-height: 42px; padding: 7px 9px;
  background: var(--surface); color: var(--ink); min-width: 0;
}
textarea { min-height: 73px; resize: vertical; }
.check, .form-grid label.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.check input { width: 19px; min-height: 19px; accent-color: var(--accent); }
.form-actions { margin-top: 14px; }
.profile-data { display: grid; gap: 10px; }
.profile-data div { display: flex; align-items: start; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--stroke); padding: 6px 0 11px; }
.profile-data dd { margin: 0; font-weight: 690; text-align: right; }
.profile-data dt { color: var(--muted); }
.mobile-nav { display: none; }
dialog {
  background: var(--surface); color: var(--ink); border: 1px solid var(--stroke); border-radius: 17px;
  padding: 19px; width: min(540px, calc(100% - 28px)); max-height: calc(100dvh - 34px); overflow: auto;
  box-shadow: 0 12px 55px #0005;
}
dialog::backdrop { background: #14251eb0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 13px; }
#notice:not(:empty) {
  position: fixed; bottom: 20px; right: 20px; z-index: 10; max-width: min(420px, calc(100% - 40px));
  padding: 10px 14px; background: var(--hero); color: var(--hero-text); border: 1px solid var(--stroke); border-radius: 10px; box-shadow: var(--shadow);
}
@media (max-width: 1120px) {
  .shell { grid-template-columns: 202px minmax(0, 1fr); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.dashboard-lead { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1.12fr) minmax(0, .68fr); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .mast { position: sticky; top: 0; z-index: 4; }
  .mast-trail img { display: block; }
  .mast-trail .trail-detail { display: none; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 5;
    left: 0; right: 0; bottom: 0; padding: 3px 8px max(4px, env(safe-area-inset-bottom));
    background: var(--sidebar); border-top: 1px solid var(--stroke);
  }
  .mobile-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 2px;
    min-height: 52px; border: 0; color: var(--muted); background: transparent; font-size: .67rem; font-weight: 680;
  }
  .mobile-nav button[aria-current="page"] { color: var(--accent); }
  .mobile-nav button .icon { width: 19px; height: 19px; flex-basis: 19px; }
  .mobile-nav .mobile-camera .icon { mask-size: 19px; background-color: #fff; }
  .mobile-nav .mobile-camera > span:first-child { display: grid; place-items: center; border-radius: 13px; width: 41px; height: 31px; background: var(--primary); }
  html { scroll-padding-top: 80px; scroll-padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  main { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  #notice:not(:empty) { bottom: 68px; }
}
@media (max-width: 610px) {
  .mast { padding: 8px 13px; min-height: 57px; gap: 6px; }
  .mast-trail { gap: 6px; }
  .mast-trail strong { font-size: .78rem; }
  .mast-actions { gap: 5px; flex-wrap: nowrap; }
  .mast-actions .btn { min-height: 44px; padding: 4px 7px; }
  .mast-actions .btn.icon-only { width: 44px; padding: 0; }
  .mast-actions .camera-label, .mast-actions .capture-top { display: none; }
  .mast-actions .badge { padding: 4px 5px; font-size: .65rem; }
  main { padding: 22px 13px calc(82px + env(safe-area-inset-bottom)); }
  .segmented button { min-height: 44px; }
  .heading { margin-bottom: 16px; align-items: start; flex-direction: column; }
  .heading p { margin-top: 5px; }
  h1 { font-size: clamp(2rem, 10vw, 2.55rem); }
  .grid { gap: 10px; margin-bottom: 10px; }
  .grid.two, .grid.detail, .grid.three, .grid.dashboard-lead { grid-template-columns: minmax(0, 1fr); }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 13px; border-radius: 14px; }
  .hero { border-radius: 16px; min-height: 206px; grid-template-columns: minmax(0, 1.38fr) minmax(0, .8fr); }
  .hero img { min-height: 206px; }
  .hero-body { padding: 15px; }
  .hero h2 { font-size: 1.74rem; }
  .hero p { font-size: .87rem; }
  .chart-column { grid-template-rows: 103px auto; }
  .chart { min-height: 142px; }
  .timeline .line { gap: 7px; }
  .timeline .line time { min-width: 41px; flex-basis: 41px; font-size: .82rem; }
  .timeline .line > div:nth-child(2) { flex-basis: 32px; }
  .timeline .row-icon { width: 32px; height: 32px; }
  .timeline .row-icon .icon { width: 16px; height: 16px; }
  .timeline .btn { width: 44px; padding: 0; }
  .profile-data div { gap: 8px; }
}
@media (max-width: 360px) {
  .mast-trail img { display: none; }
  .mast-actions .actor-switch .icon { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { flex-wrap: wrap; }
}

.rehearsal-notice { padding: 6px 12px; text-align: center; font-size: .82rem; color: white; background: #174b37; }
