:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI","PingFang SC","Noto Sans CJK SC",system-ui,sans-serif;
  color: #233b34;
  background: #eef1ea;
  --forest: #16352e;
  --ink: #233b34;
  --muted: #54695d;
  --line: #dce4d9;
  --sheet: #fffefa;
  --green: #255d4e;
  --sage: #e1eee3;
  --gold: #e4bd7d;
  --error: #963e31;
  --radius: 15px;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
body { margin: 0; min-width: 280px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button, a.action { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #a16e2a; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; top: -80px; left: 16px; z-index: 8; padding: 12px; background: white; }
.skip:focus { top: 12px; }
.boot { display: grid; min-height: 80vh; place-items: center; color: var(--muted); }
.layout { display: grid; grid-template-columns: 221px minmax(0,1fr); min-height: 100vh; }
.sidebar { align-self: start; position: sticky; top: 0; height: 100dvh; overflow: auto; padding: 25px 15px 20px; color: #f1f5ec; background: var(--forest); scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 10px; padding: 3px 9px 20px; }
.brand img { width: 39px; height: 39px; object-fit: contain; border-radius: 9px; }
.brand strong { display: block; font-size: 19px; line-height: 1.2; letter-spacing: .04em; }
.brand small { color: #b9cbbf; font-size: 12px; }
.nav-group { padding: 13px 11px 5px; font-size: 12px; color: #b6c9be; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 9px; min-height: 39px; padding: 6px 10px; border-radius: 9px; color: #e3ede5; text-decoration: none; font-size: 14px; margin-bottom: 2px; }
.nav a:hover { background: #25473d; }
.nav a[aria-current] { background: #315649; color: #fff7e7; font-weight: 700; }
.nav svg, .action svg, .topbar svg { width: 17px; height: 17px; flex: none; }
.nav a[aria-current] svg { color: #ebc983; }
.workspace { min-width: 0; }
.topbar { min-height: 66px; background: #fffefa; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px clamp(17px,3vw,42px); }
.topbar strong { font-size: 14px; }
.topbar-actions, .toolbar, .form-actions, .row-actions, .pill-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-actions { justify-content: end; }
.small-role { color: var(--muted); font-size: 13px; }
#menu-toggle { display: none; }
#main-content { max-width: 1530px; padding: 27px clamp(16px,3vw,42px) 45px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.55rem,3vw,2.15rem); line-height: 1.25; margin-bottom: 6px; }
h2 { font-size: 17px; letter-spacing: .01em; }
h3 { font-size: 15px; }
.subtle { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.kpi { background: var(--sheet); border: 1px solid var(--line); padding: 15px 17px; border-radius: var(--radius); min-width: 0; }
.kpi-label { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.kpi-label svg { width: 20px; height: 20px; color: #577c68; flex: none; }
.kpi strong { display: block; padding: 5px 0; font-size: clamp(1.25rem,2.8vw,2rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: 12px; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 15px; min-width: 0; }
.card-head { padding: 14px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 17px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(235px,1fr); gap: 15px; }
.chart { width: 100%; min-height: 170px; max-height: 250px; margin-top: 7px; overflow: visible; }
.gridline { stroke: #dce5db; }
.chart text { fill: var(--muted); font: 12px system-ui,sans-serif; }
.legend { display: flex; gap: 15px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: #2f725e; }
.legend span:nth-child(2) i { background: #a16a34; }
.legend span:nth-child(3) i { background: #6b6c99; }
.summary-list { margin: 0; }
.summary-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.summary-list div:last-child { border-bottom: 0; }
.summary-list dt { color: var(--muted); font-size: 14px; }
.summary-list dd { margin: 0; font-weight: 650; text-align: right; }
.action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 41px; padding: 7px 12px; border-radius: 8px; background: #fffefa; border: 1px solid #cbd8cb; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 650; white-space: nowrap; }
.action:hover { background: #f0f5ed; }
.action.primary { color: #fffdf4; background: var(--green); border-color: var(--green); }
.action.primary:hover { background: #1a463a; }
.action.danger { color: var(--error); background: #fff5ef; border-color: #e5bfb3; }
.action.compact { min-height: 36px; padding: 5px 9px; font-size: 13px; }
.action.ghost { background: transparent; border-color: transparent; }
.chip { display: inline-flex; border-radius: 20px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: #edf0e9; color: #4a6254; white-space: nowrap; }
.chip.good { background: #e0efe4; color: #285543; }
.chip.warn { background: #fcf0d6; color: #72511c; }
.chip.bad { background: #fae8e2; color: #903a31; }
.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: end; }
.field { display: grid; gap: 4px; font-size: 14px; color: var(--ink); }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea { min-height: 41px; border: 1px solid #cbd8cb; border-radius: 8px; color: var(--ink); background: #fffefa; padding: 8px 10px; min-width: 0; }
input[type="checkbox"] { min-height: auto; accent-color: var(--green); }
textarea { resize: vertical; min-height: 75px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 650; color: var(--muted); background: #f4f6ef; white-space: nowrap; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7f9f3; }
.order-renewals > td { padding: 12px 16px 16px 24px; background: #f4f6ef; }
.order-renewals > td > div { border-left: 2px solid #a8c1ad; padding-left: 14px; }
.order-renewals h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.order-renewals .table-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fffefa; }
.order-renewals .table-wrap + .action { margin-top: 8px; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-box { min-width: 165px; max-width: 420px; }
.id-link { color: #226451; font-weight: 700; text-decoration: none; white-space: nowrap; }
button.id-link { background: none; border: 0; padding: 3px 0; text-align: left; }
.id-link:hover { text-decoration: underline; }
.empty { padding: 30px 15px; color: var(--muted); text-align: center; }
.pagination { border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 8px 13px; font-size: 13px; }
.details-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.detail-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.notice-text { min-width: 180px; max-width: 450px; white-space: pre-wrap; }
pre { margin: 0; background: #f0f4ee; border-radius: 8px; padding: 12px; max-height: 50vh; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
dialog { width: min(540px,calc(100% - 26px)); border: 1px solid var(--line); border-radius: 16px; padding: 0; color: var(--ink); background: var(--sheet); box-shadow: 0 7px 37px #142f3140; max-height: calc(100dvh - 32px); }
dialog::backdrop { background: #122e28a3; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 10px 17px; }
.dialog-body { display: grid; gap: 10px; padding: 15px 17px; }
.detail-dialog[open] { display: flex; flex-direction: column; width: min(1060px,calc(100% - 26px)); overflow: hidden; }
.detail-dialog .dialog-title { flex: none; background: var(--sheet); }
.detail-dialog .dialog-title h2 { overflow-wrap: anywhere; }
.detail-dialog .dialog-title .toolbar { flex: none; }
.detail-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 15px 17px; background: #f5f7f1; }
.detail-scroll > .card:last-child, .detail-scroll > .details-grid:last-child .card { margin-bottom: 0; }
.detail-feedback { padding: 7px 17px; background: var(--sage); font-size: 14px; }
.detail-feedback:empty { display: none; }
.nested-detail::backdrop { background: #122e2855; }
.form-actions { justify-content: end; }
.error { color: var(--error); font-size: 14px; min-height: 22px; }
.auth-shell { display: grid; place-items: center; min-height: 100dvh; padding: 20px; background: radial-gradient(ellipse at 18% 5%,#315f51,transparent 50%),linear-gradient(145deg,#112e28,#1b4137); }
.auth-box { max-width: 410px; width: 100%; border-radius: 18px; padding: clamp(20px,6vw,32px); background: var(--sheet); border-top: 4px solid var(--gold); }
.auth-box .brand { padding: 0 0 14px; color: var(--ink); }
.auth-box .brand small { color: var(--muted); }
.auth-box form { display: grid; gap: 12px; margin-top: 16px; }
#toast { position: fixed; right: 16px; bottom: 16px; z-index: 10; background: var(--forest); color: #fffefa; padding: 10px 13px; border-radius: 8px; max-width: calc(100vw - 32px); }
#toast:empty { display: none; }
@media (max-width: 980px) { .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); } .dashboard-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(240px,85vw); z-index: 5; box-shadow: 0 0 0 100vmax #10282066; }
  .sidebar:not(.open) { display: none; }
  #menu-toggle { display: inline-flex; }
  .page-head { align-items: start; flex-direction: column; }
  .details-grid { grid-template-columns: 1fr; }
  .small-role { display: none; }
  .topbar { padding-inline: 12px; }
  .kpi { padding-inline: 12px; }
  th, td { padding-inline: 10px; }
  .action.compact { min-height: 40px; }
  .detail-dialog .dialog-title, .detail-scroll { padding-inline: 10px; }
  .detail-dialog .dialog-title .toolbar { gap: 0; }
}
