* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif; background: #f3f5f7; color: #1f2937; }
.hidden { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f766e, #115e59); }
.login-box { background: #fff; padding: 36px 32px; border-radius: 14px; width: 340px; text-align: center; box-shadow: 0 18px 40px rgba(0,0,0,.2); }
.login-box h1 { margin: 0; font-size: 28px; color: #0f766e; letter-spacing: 2px; }
.login-box .sub { color: #6b7280; font-size: 13px; margin: 6px 0 18px; }
.login-box input { width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }
.login-box button { width: 100%; padding: 11px; background: #0f766e; color: #fff; border: 0; border-radius: 8px; font-size: 16px; cursor: pointer; }
.login-box button:hover { background: #0b5b55; }
.login-box .err { color: #dc2626; font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-box .tip { background: #fef3c7; color: #92400e; font-size: 12px; padding: 6px; border-radius: 6px; margin-bottom: 10px; }

/* 顶栏 */
.topbar { background: #0f766e; color: #fff; display: flex; align-items: center; padding: 0 18px; height: 54px; gap: 16px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab, .rptab { background: transparent; border: 0; color: #c7dedb; padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.tab:hover, .rptab:hover { background: rgba(255,255,255,.12); color: #fff; }
.tab.active, .rptab.active { background: #fff; color: #0f766e; font-weight: 600; }
.who { font-size: 13px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.link { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.panel { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
h3 { font-size: 15px; margin: 18px 0 8px; color: #374151; }

.date-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.date-bar input, .date-bar select { padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; }
.date-bar button, .row-actions button { padding: 7px 14px; border: 1px solid #d1d5db; background: #fff; border-radius: 7px; cursor: pointer; font-size: 14px; }
.date-bar button:hover, .row-actions button:hover { background: #f3f4f6; }
button.primary { background: #0f766e; color: #fff; border-color: #0f766e; }
button.primary:hover { background: #0b5b55; }
.spacer { flex: 1; }
.hint { color: #6b7280; font-size: 12px; }
.msg { font-size: 13px; margin-left: 10px; }
.msg.ok { color: #047857; }
.msg.err { color: #dc2626; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.card { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; }
.card label { font-size: 12px; color: #6b7280; }
.card .num { font-size: 24px; font-weight: 700; color: #0f766e; margin-top: 4px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { border-bottom: 1px solid #e5e7eb; padding: 8px 10px; text-align: left; }
table.grid th { background: #f9fafb; color: #4b5563; font-weight: 600; font-size: 13px; }
table.grid tr:hover td { background: #f9fafb; }
table.grid td.r, table.grid th.r { text-align: right; }
table.grid input, table.grid select { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
table.grid input.amount { background: #f3f4f6; border: 0; }
.bad { color: #dc2626; }
.good { color: #047857; }
.muted { color: #9ca3af; }
.bar { height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: #14b8a6; }

.row-actions { margin: 12px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.total-line { margin-top: 10px; font-size: 15px; font-weight: 600; text-align: right; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px; width: 420px; max-width: 92vw; }
.modal-box h4 { margin: 0 0 12px; font-size: 16px; }
.modal-box label { display: block; font-size: 13px; color: #4b5563; margin: 10px 0 4px; }
.modal-box input, .modal-box select { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; }
.modal-actions { margin-top: 16px; text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 60; }

@media print {
  .topbar, .date-bar, .row-actions, .tabs, .who { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; }
}
@media (max-width: 720px) {
  .brand { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
}
