:root {
  --bg: #f5f4ef;
  --paper: #fffefa;
  --line: #e1e5dc;
  --ink: #243b3a;
  --muted: #74817b;
  --green: #27675c;
  --green-soft: #eaf1e8;
  --nav: #193e3a;
  --amber: #8d672b;
  --amber-soft: #f8f0dd;
  --red: #9e5143;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #86b4a5; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -.7px; line-height: 1.4; }
h2 { font-size: 14px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--green); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 9px 14px; background: var(--paper); border-radius: 6px; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.app { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 34px 20px 26px; background: var(--nav); color: #e8f0e7; }
.brand { font: 600 30px/1 Georgia, serif; letter-spacing: 3.5px; }
.brand-sub { margin-top: 13px; font-size: 10px; letter-spacing: 1.6px; color: #a7c0b5; }
.sidebar-line { height: 1px; background: #355750; margin: 30px 0 24px; }
.nav-heading { margin: 0 12px 14px; font-size: 11px; letter-spacing: 1.5px; color: #9db8ad; }
.nav { display: flex; flex-direction: column; gap: 7px; }
.nav-button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 8px; padding: 13px 12px; color: #bfd0c5; background: transparent; text-align: left; white-space: nowrap; }
.nav-button:hover { background: #234a44; color: white; }
.nav-button.active { background: #f2f4e9; color: #1b4840; }
.nav-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-count { margin-left: auto; min-width: 22px; padding: 0 4px; border-radius: 4px; font-size: 11px; text-align: center; background: #ffffff0c; }
.active .nav-count { background: #dfe8dd; }
.side-footer { margin-top: auto; padding: 30px 12px 0; color: #a7bfb3; font-size: 11px; }
.side-footer .connection-label { margin-bottom: 10px; color: #c2d2c6; }
.side-footer p:not(.connection-label) { display: flex; justify-content: space-between; margin-top: 7px; }
.side-footer p span { color: #9bb1a6; }
.ledger-status { margin-top: 20px; padding-top: 16px; border-top: 1px solid #355750; font-size: 10px; color: #b7c8b9; }
.main { min-width: 0; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 40px; border-bottom: 1px solid var(--line); background: #fbfbf7; }
.breadcrumb { display: flex; gap: 11px; color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 500; }
.role-control { display: flex; gap: 12px; align-items: center; }
.role-label, .live-role { font-size: 12px; color: var(--muted); }
.role-switch { display: flex; gap: 2px; padding: 4px; border: 1px solid #e1e5db; border-radius: 9px; background: #eaede5; }
.role-switch button { border: 0; padding: 5px 17px; min-height: 32px; border-radius: 6px; color: var(--muted); background: transparent; }
.role-switch button[aria-pressed="true"] { background: var(--paper); color: var(--green); box-shadow: 0 1px 5px #2f534611; }
.mobile-brand { display: none; }
.page { max-width: 1500px; margin: 0 auto; padding: 26px 40px 30px; }
.mode-banner { color: #7c806e; font-size: 12px; line-height: 1.8; margin-bottom: 22px; }
.mode-banner strong { color: #6f755f; font-weight: 600; }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { font-size: 9px; letter-spacing: 1.8px; color: var(--green); font-weight: 600; margin-bottom: 7px; }
.subtitle { color: var(--muted); margin-top: 8px; font-size: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 14px; border: 1px solid #d7ded2; border-radius: 7px; background: var(--paper); font-size: 14px; line-height: 1.6; }
.btn:hover:not(:disabled) { background: #edf2e8; }
.btn.primary { border-color: var(--green); background: var(--green); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #20584e; }
.btn.quiet { background: transparent; color: var(--muted); border-color: transparent; }
.refresh-button { flex-shrink: 0; font-size: 12px; min-height: 38px; }
.message { border: 1px solid #d4dfcb; border-radius: 8px; padding: 11px 14px; margin-bottom: 18px; background: #eef4e9; color: #47643e; overflow-wrap: anywhere; }
.error-message, .message.is-error { background: #fbf0e9; border-color: #ead6c8; color: var(--red); }
.uncertain-action { margin-bottom: 20px; border: 1px solid #e4d4ad; border-radius: 8px; padding: 15px; background: var(--amber-soft); color: #80632d; }
.uncertain-action p { font-size: 13px; }
.uncertain-action .action-row { margin-top: 11px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { border: 1px solid var(--line); border-radius: 9px; background: var(--paper); padding: 15px 19px; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-value { font-size: 25px; line-height: 1.3; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 11px; color: var(--muted); margin-left: 7px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-bar h2 span { font-size: 12px; font-weight: 400; margin-left: 5px; }
.muted { color: var(--muted); }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid #dce1d7; border-radius: 7px; background: var(--paper); padding: 7px 10px; }
.search svg { width: 16px; height: 16px; fill: none; stroke: #8a9a8a; stroke-width: 1.7; flex-shrink: 0; }
.search input { width: 190px; min-width: 0; background: transparent; border: 0; color: var(--ink); padding: 0; font-size: 12px; }
.search:focus-within { outline: 3px solid #86b4a5; outline-offset: 3px; }
.search input:focus-visible { outline: none; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.task-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.task-card { position: relative; width: 100%; min-width: 0; text-align: left; padding: 17px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.task-card:hover { border-color: #a4b7a6; }
.task-card.selected { border-color: var(--green); background: #fdfefa; box-shadow: 0 0 0 1px #27675c0a; }
.task-card.selected::before { content: ""; position: absolute; width: 3px; height: 25px; border-radius: 0 3px 3px 0; top: 21px; left: -1px; background: var(--green); }
.task-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.task-id { color: #6c8072; font-size: 11px; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 4px; background: var(--green-soft); color: #587153; font-size: 11px; line-height: 1.6; }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.gray { background: #edf0e9; color: #6f7d6b; }
.task-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.task-skus { display: block; font-size: 12px; color: var(--muted); margin-top: 9px; overflow-wrap: anywhere; }
.task-bottom { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid #e9ecdf; margin-top: 13px; padding-top: 10px; color: var(--muted); font-size: 11px; }
.task-bottom strong { color: #5c725f; font-weight: 500; font-variant-numeric: tabular-nums; }
.detail { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.detail-header { border-bottom: 1px solid var(--line); padding: 23px 25px 19px; }
.detail-kicker { color: #7f8d7d; font-size: 12px; margin-bottom: 8px; overflow-wrap: anywhere; }
.detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.detail-heading h2 { font-size: 20px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; }
.detail-summary { margin-top: 11px; color: #6d7e65; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; white-space: pre-line; }
.detail-body { padding: 20px 25px 24px; }
.operation-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 18px; font-size: 13px; }
.operation-meta span { color: var(--muted); margin-right: 8px; }
.operation-meta strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.block-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.block-title span { color: var(--muted); font-size: 12px; }
.table-wrap { border: 1px solid #e1e7d9; border-radius: 7px; overflow: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
th { padding: 10px 12px; background: #f3f5ed; color: #7b8b75; font-weight: 500; font-size: 12px; }
td { padding: 12px; border-top: 1px solid #e8ecdf; font-size: 14px; overflow-wrap: anywhere; }
th:first-child { width: 35%; }
th:last-child { width: 18%; }
.quantity { text-align: right; font-variant-numeric: tabular-nums; }
.empty-items { padding: 15px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 13px; }
.critical-facts { margin-top: 18px; padding: 3px 13px; border: 1px solid #e2e7d7; border-radius: 7px; }
.fact-line { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 15px; padding: 10px 0; font-size: 13px; }
.fact-line + .fact-line { border-top: 1px solid #e8ecdf; }
.fact-line dt { color: var(--muted); }
.fact-line dd { margin: 0; color: #4d6947; text-align: right; overflow-wrap: anywhere; white-space: pre-line; }
.background { margin-top: 21px; padding-top: 14px; border-top: 1px solid #e6eadd; }
.background summary { display: flex; gap: 8px; width: max-content; max-width: 100%; color: #6c8060; font-size: 14px; cursor: pointer; list-style: none; }
.background summary::-webkit-details-marker { display: none; }
.background summary::before { content: "＋"; color: #8a9a7b; }
.background[open] summary::before { content: "−"; }
.background-body { margin-top: 13px; font-size: 13px; color: #78896d; }
.background-body dl, .critical-facts { margin-bottom: 0; }
.background-body dl { margin-top: 0; }
.background-body .fact-line dd { color: #697d5c; }
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { margin-left: 3px; padding: 8px 0 9px 15px; border-left: 1px solid #dce4d3; position: relative; }
.event-list li::before { position: absolute; top: 17px; left: -3px; content: ""; width: 5px; height: 5px; border-radius: 50%; background: #a0b18d; }
.event-title { color: #627956; font-size: 13px; }
.event-time { font-size: 11px; color: #87947a; margin-bottom: 4px; }
.event-note { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.detail-actions { padding: 18px 25px 20px; border-top: 1px solid var(--line); background: #f8faf3; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.action-hint { font-size: 12px; color: #7c8b71; line-height: 1.9; margin-top: 11px; }
.note-form { margin-top: 18px; }
.note-form label { display: block; color: #667b5b; font-size: 13px; margin-bottom: 7px; }
.note-form textarea { display: block; width: 100%; min-height: 82px; resize: vertical; padding: 10px 12px; border: 1px solid #d9e1d0; border-radius: 6px; background: var(--paper); color: var(--ink); line-height: 1.7; }
.note-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.note-bottom span { font-size: 11px; color: #8a957f; }
.empty-state { padding: 34px 20px; color: #809071; font-size: 13px; line-height: 1.9; text-align: center; }
.empty-state strong { display: block; color: #627854; font-size: 15px; font-weight: 500; margin-bottom: 7px; }
.task-list > .empty-state { border: 1px dashed #d5dfcd; border-radius: 9px; }
.footer { margin-top: 24px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: #929b87; font-size: 11px; }
.reference-links { display: flex; flex-wrap: wrap; gap: 15px; }
.reference-links a { color: #788b6c; }
.noscript { padding: 20px; }
@media (min-width: 1500px) {
  .page { padding-left: 48px; padding-right: 48px; }
  .workspace { grid-template-columns: 310px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 1150px) {
  .app { grid-template-columns: 180px minmax(0, 1fr); }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .topbar { padding: 0 26px; }
  .page { padding: 25px 26px; }
  .workspace { grid-template-columns: 245px minmax(0, 1fr); gap: 15px; }
  .detail-header, .detail-body { padding-left: 20px; padding-right: 20px; }
  .detail-actions { padding-left: 20px; padding-right: 20px; }
  .role-label { font-size: 11px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 164px minmax(0, 1fr); }
  .brand { font-size: 26px; }
  .brand-sub { font-size: 9px; letter-spacing: .7px; }
  .nav-button { font-size: 12px; padding: 12px 9px; gap: 7px; }
  .workspace { grid-template-columns: 215px minmax(0, 1fr); gap: 13px; }
  .topbar { padding: 0 20px; }
  .page { padding: 24px 20px; }
  .role-control { gap: 8px; }
  .role-switch button { padding-left: 12px; padding-right: 12px; }
  .task-card { padding: 15px; }
  .detail-heading h2 { font-size: 18px; }
  th, td { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: relative; height: auto; padding: 0; }
  .brand, .brand-sub, .sidebar-line, .nav-heading, .side-footer { display: none; }
  .nav { flex-direction: row; overflow: auto; padding: 11px 16px; gap: 6px; }
  .nav-button { flex-shrink: 0; width: auto; min-height: 42px; padding: 9px 12px; font-size: 14px; }
  .nav-count { display: none; }
  .nav-icon { width: 16px; height: 16px; }
  .topbar { height: 67px; padding: 0 17px; background: var(--nav); border: 0; }
  .mobile-brand { display: block; color: #f0f4e7; font: 20px Georgia, serif; letter-spacing: 2px; }
  .breadcrumb { display: none; }
  .role-label, .live-role { color: #afc6b9; font-size: 11px; }
  .role-control { gap: 7px; }
  .role-switch { border-color: #3b6153; background: #31564a; padding: 3px; }
  .role-switch button { color: #b9ccbb; font-size: 12px; padding: 5px 10px; min-height: 31px; }
  .role-switch button[aria-pressed="true"] { background: #edf3e4; color: #2a5640; }
  .page { padding: 20px 17px 26px; }
  .mode-banner { font-size: 11px; margin-bottom: 20px; }
  h1 { font-size: 24px; }
  .heading-row { margin-bottom: 23px; gap: 12px; align-items: flex-start; }
  .eyebrow { font-size: 8px; }
  .subtitle { font-size: 11px; max-width: 240px; }
  .refresh-button { font-size: 11px; padding: 7px 10px; min-height: 35px; margin-top: 20px; }
  .stats { gap: 8px; margin-bottom: 24px; }
  .stat { padding: 12px 10px; border-radius: 8px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 22px; }
  .stat-unit { font-size: 10px; margin-left: 5px; }
  .search { padding: 8px; gap: 5px; }
  .search input { width: 145px; font-size: 11px; }
  .section-bar { gap: 8px; }
  .section-bar h2 { white-space: nowrap; font-size: 13px; }
  .workspace { display: flex; flex-direction: column; gap: 16px; }
  .task-list { flex-direction: row; width: 100%; max-width: 100%; overflow: auto; gap: 10px; padding-bottom: 5px; scroll-snap-type: x proximity; }
  .task-card { min-width: 255px; width: 255px; flex-shrink: 0; padding: 15px; scroll-snap-align: start; }
  .task-list > .empty-state { width: 100%; }
  .detail { width: 100%; border-radius: 10px; }
  .detail-header { padding: 19px 17px 17px; }
  .detail-body { padding: 18px 17px 21px; }
  .detail-actions { padding: 17px; }
  .detail-heading h2 { font-size: 19px; }
  .detail-summary { font-size: 14px; }
  .operation-meta { font-size: 12px; gap: 9px; }
  .block-title span { font-size: 11px; }
  .fact-line { gap: 10px; font-size: 13px; }
  .critical-facts { padding-left: 11px; padding-right: 11px; }
  .btn { font-size: 14px; }
  .footer { flex-direction: column; gap: 8px; }
  .message { font-size: 13px; }
  th { font-size: 11px; padding: 9px 7px; }
  td { font-size: 13px; padding: 12px 7px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .task-card, .nav-button { transition: background .15s, border-color .15s; }
}

fieldset { border: 1px solid var(--border, #dce5df); border-radius: 10px; padding: 16px; min-width: 0; }
legend { padding: 0 6px; font-weight: 600; }
.inspection-row { padding: 8px 0; border-bottom: 1px solid #e5ebe6; margin-bottom: 12px; }
.inspection-row input { width: 85px; padding: 8px; margin: 0 10px 0 5px; }
.inspection-row select { padding: 8px; max-width: 100%; }
.review-row { display: block; padding: 8px 0; }
#business-form textarea { display: block; width: 100%; box-sizing: border-box; margin: 8px 0 12px; }

.calendar-grid { display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;margin:20px 0; }
.calendar-day {border:1px solid #dce5df;border-radius:8px;padding:12px 5px;display:flex;flex-wrap:wrap;gap:6px;justify-content:center;}
.calendar-day span {width:100%;text-align:center;font-size:12px;color:#67756b;}
@media(max-width:600px){.calendar-grid{grid-template-columns:repeat(4,minmax(0,1fr));}}

.operation-field{display:block;margin:12px 0}.operation-field input,.operation-field select{display:block;box-sizing:border-box;width:100%;padding:10px;margin-top:6px;border:1px solid #cbd7ce;border-radius:6px;background:white;}
