:root {
  --ink: #17312e;
  --muted: #758580;
  --green: #197562;
  --line: #e4eae6;
  --bg: #f5f7f4;
  --amber: #b77b29;
  --down: #bb6459;
  --up: #187961;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
button, .button { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 9px 15px; color: var(--ink); font-weight: 550; }
button:hover { border-color: var(--green); color: var(--green); }
.primary { background: var(--green); color: white !important; border-color: var(--green); }
.primary:hover { color: white !important; filter: brightness(0.95); }
.ghost { border-color: transparent; }
.danger { color: var(--down); border-color: #f0d3cf; }
.danger:hover { color: var(--down); border-color: var(--down); }

.layout { display: grid; grid-template-columns: 222px 1fr; min-height: 100vh; }
aside { background: #fff; border-right: 1px solid var(--line); padding: 30px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 750; letter-spacing: 1px; }
.mark { display: grid; place-items: center; background: var(--green); color: #fff; border-radius: 11px; width: 37px; height: 37px; }
.brand small { display: block; font-size: 9px; color: var(--muted); letter-spacing: 2px; }
.nav-title { font-size: 11px; letter-spacing: 2px; color: #94a19b; margin: 42px 12px 13px; }
nav button { display: block; text-align: left; width: 100%; border: 0; background: none; margin: 7px 0; padding: 12px; }
.active { background: #e8f2ed !important; color: var(--green) !important; }
nav span { display: inline-block; width: 29px; font-size: 18px; }
.aside-bottom { margin-top: auto; background: #f5f7f4; padding: 14px; border-radius: 10px; font-size: 12px; color: var(--muted); }
.aside-bottom strong { color: var(--ink); display: block; margin-bottom: 4px; }
.aside-bottom .row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.aside-bottom button { width: 100%; margin-top: 8px; }
main { padding: 27px 36px; min-width: 0; max-width: 1800px; width: 100%; margin: auto; }
.topline { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); padding-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.topline .dot { color: var(--green); }
.status-stale .dot { color: var(--amber); }
header { display: flex; justify-content: space-between; align-items: center; margin: 25px 0 20px; gap: 20px; }
h1 { font-size: 27px; letter-spacing: -.8px; line-height: 1.3; margin: 0 0 7px; }
h2 { font-size: 16px; margin: 0; }
p { margin: 6px 0; color: var(--muted); }
.actions, .filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions button, .filters button { white-space: nowrap; }
.notice { padding: 11px 16px; background: #fff8e8; color: #8a692d; border: 1px solid #eee1bd; border-radius: 9px; font-size: 12px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.notice button { font-size: 12px; padding: 4px 10px; background: transparent; border-color: #dbc994; }
.notice.ok { background: #eaf3ee; color: #1e6a51; border-color: #cee0d5; }
.filters { margin-bottom: 20px; }
.filters label { color: var(--muted); font-size: 12px; }
.filters input, .filters select, input, select { border: 1px solid var(--line); background: white; padding: 8px 11px; border-radius: 7px; min-width: 0; color: var(--ink); }
.filters input[type=month] { min-width: 140px; }
.push { margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.card { padding: 20px 22px; position: relative; }
.card small { color: var(--muted); font-size: 12px; }
.value { font-size: 30px; font-weight: 650; letter-spacing: -1px; margin: 11px 0 5px; font-variant-numeric: tabular-nums; }
.card:first-child { background: #1b6656; color: #fff; border: 0; }
.card:first-child small, .card:first-child p { color: #c2d9cf; }
.card p { font-size: 11px; }
.card .icon { position: absolute; right: 20px; top: 17px; border-radius: 7px; padding: 2px 8px; background: #f1f5ef; color: var(--green); }
.card:first-child .icon { background: #2c7567; color: #d0e3da; }
.grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(250px, 1fr); gap: 20px; margin-bottom: 20px; }
.panel-head { padding: 20px 22px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.caption { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 16px; height: 3px; background: var(--green); vertical-align: middle; margin-right: 5px; }
.legend i.old { background: #adbfa8; }
.chart { padding: 0 17px 9px; }
.chart svg { width: 100%; display: block; }
.rank { padding: 8px 22px 17px; }
.rank-row { display: grid; grid-template-columns: 24px 1fr auto; gap: 9px; align-items: center; margin: 13px 0; font-size: 12px; }
.rank-row em { font-style: normal; color: #94a29a; }
.bar { height: 5px; border-radius: 5px; background: #eff3ed; margin-top: 6px; overflow: hidden; }
.bar div { height: 100%; background: #75a48a; border-radius: 5px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; font-size: 12px; }
th { background: #f8faf7; color: var(--muted); font-weight: 500; padding: 13px 18px; border-bottom: 1px solid var(--line); }
td { padding: 14px 18px; border-bottom: 1px solid #eff2ed; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafbf8; }
.tag { padding: 3px 8px; border-radius: 5px; font-size: 11px; background: #edf4f0; color: var(--green); }
.tag.warn { color: #a77d31; background: #fcf4df; }
.up { color: var(--up); }
.down { color: var(--down); }
.table-foot { padding: 13px 20px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
footer { font-size: 11px; color: #98a49d; text-align: center; padding: 22px; }
.hidden { display: none !important; }
dialog { border: 0; border-radius: 15px; box-shadow: 0 25px 100px #16372c33; width: min(900px, 94vw); padding: 26px; color: var(--ink); max-height: 90vh; }
dialog::backdrop { background: #12322966; backdrop-filter: blur(3px); }
dialog .close { float: right; border: 0; font-size: 22px; padding: 0 8px; }
dialog h2 { font-size: 20px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.drop { border: 1.5px dashed #a5bdb0; background: #f6faf6; border-radius: 10px; padding: 28px; text-align: center; margin: 15px 0; }
.drop input { max-width: 100%; margin-top: 12px; }
.help { padding: 16px; background: #f4f7f2; border-radius: 9px; font-size: 12px; line-height: 1.9; color: #63756b; }
.error { color: var(--down); white-space: pre-wrap; }
.preview { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 15px 0; }
.btn-link { padding: 0; border: 0; background: none; color: var(--green); font-size: 12px; }
.toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: #183e32; color: #fff; padding: 12px 24px; border-radius: 9px; z-index: 99; box-shadow: 0 6px 20px #0002; max-width: 80vw; text-align: center; }
.toast.danger { background: #6c2a25; }
.user-list { display: grid; gap: 8px; margin-top: 10px; }
.user-list .row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.user-list .row .meta { font-size: 11px; color: var(--muted); }
.user-list .badge { background: #edf4f0; color: var(--green); padding: 2px 8px; border-radius: 5px; font-size: 11px; }
.user-list .badge.member { background: #f4f7f2; color: var(--muted); }
.user-list .badge.disabled { background: #fcf4df; color: #a77d31; }

.login-bg { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #1b6656, #0c3a2f); padding: 30px; }
.login-card { background: #fff; padding: 36px; border-radius: 16px; width: min(420px, 100%); box-shadow: 0 25px 80px #00000033; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .hint { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.login-card .field input { padding: 11px; border-radius: 8px; border: 1px solid var(--line); }
.login-card button.primary { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; }
.login-card .foot { font-size: 11px; color: var(--muted); margin-top: 18px; }
.login-card .alert { background: #fcf4df; color: #8a692d; border: 1px solid #eee1bd; border-radius: 8px; padding: 10px 14px; font-size: 12px; margin-bottom: 16px; }

@media (max-width: 1100px) {
  main { padding: 24px; }
  .layout { grid-template-columns: 180px 1fr; }
  aside { padding: 25px 12px; }
  .cards { gap: 10px; }
  .card { padding: 16px; }
  .value { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { display: block; }
  aside { height: auto; position: static; padding: 15px; }
  .brand small, .nav-title, .aside-bottom { display: none; }
  nav { display: flex; gap: 5px; margin-top: 8px; overflow-x: auto; }
  nav button { padding: 8px; font-size: 12px; flex-shrink: 0; }
  nav span { display: none; }
  .brand { font-size: 17px; }
  main { padding: 18px; }
  header { align-items: flex-start; flex-direction: column; }
  .cards { grid-template-columns: 1fr 1fr; }
  .push { margin-left: 0; }
  .topline { font-size: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .notice { align-items: flex-start; }
  .legend { font-size: 9px; }
  .card .icon { display: none; }
  .legend { white-space: nowrap; flex-shrink: 0; gap: 7px; }
  .panel-head > button { flex-shrink: 0; white-space: nowrap; }
}
/* 打印 / 导出 PDF：隐藏交互元素，只留报表内容 */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: #fff; }
  aside, .topline, .filters, header .actions, footer, .toast,
  #loginView, dialog, .notice button, .panel-head button, .btn-link {
    display: none !important;
  }
  .layout { display: block; }
  main { padding: 0; }
  .cards { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .card { box-shadow: none; border: 1px solid #d8e2db; padding: 10px 12px; break-inside: avoid; }
  .card .value { font-size: 18px; }
  .panel { box-shadow: none; border: 1px solid #d8e2db; break-inside: avoid; page-break-inside: avoid; }
  .grid { grid-template-columns: 1fr; }
  .table-wrap { overflow: visible; }
  table { font-size: 11px; }
  th, td { padding: 5px 7px; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .print-only { display: block !important; }
  a { color: inherit; text-decoration: none; }
}
.print-only { display: none; }

/* 分享看板（公开只读页） */
.share-body { background: #f4f8f5; min-height: 100vh; }
.share-loading { max-width: 520px; margin: 18vh auto; text-align: center; color: #556; }
.share-loading strong { display: block; font-size: 18px; color: #197562; margin-bottom: 8px; }
.share-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; background: #fff; border-bottom: 1px solid #e3ebe6; flex-wrap: wrap;
}
.share-meta { text-align: right; }
.share-meta strong { display: block; font-size: 15px; color: #1c2a24; }
.share-main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 40px; }
.share-main .cards { margin-bottom: 20px; }
.share-main .grid { margin-bottom: 20px; }
@media (max-width: 720px) {
  .share-head { padding: 13px 16px; }
  .share-main { padding: 16px 13px 30px; }
  .share-meta { text-align: left; }
}
