* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", "PingFang SC", sans-serif; background: #f4f6fa; color: #222; }
header { display:flex; justify-content:space-between; align-items:center; padding: 12px 24px; background:#1f2937; color:#fff; }
header h1 { margin:0; font-size:20px; }
.top-right { display:flex; gap:8px; align-items:center; }
.top-right button { cursor:pointer; padding:6px 12px; border:none; border-radius:4px; background:#3b82f6; color:#fff; }
.top-right button:hover { background:#2563eb; }
#userBadge { background:#10b981; padding:4px 10px; border-radius:4px; font-size:13px; }

main { display:grid; grid-template-columns: 1fr 320px; gap:16px; padding:16px; }
.calendar-panel { background:#fff; border-radius:8px; padding:16px; box-shadow:0 1px 3px rgba(0,0,0,0.06); }
.cal-header { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.cal-header h2 { margin:0; flex:0 0 auto; min-width:140px; text-align:center; }
.cal-header .hint { font-size:12px; color:#6b7280; margin-left:auto; }
.cal-header button { padding:4px 10px; cursor:pointer; }

.weekdays, .calendar { display:grid; grid-template-columns: repeat(7,1fr); gap:4px; }
.weekdays div { text-align:center; padding:6px 0; font-weight:600; color:#6b7280; font-size:13px; }
.calendar .cell {
  min-height: 80px; background:#f9fafb; border:1px solid #e5e7eb; border-radius:6px;
  padding:4px 6px; cursor:pointer; position:relative; user-select:none;
  display:flex; flex-direction:column;
}
.calendar .cell:hover { background:#eff6ff; }
.calendar .cell.other-month { opacity:.35; }
.calendar .cell.selected { background:#dbeafe; border-color:#3b82f6; }
.calendar .cell.settled::after {
  content:"✔已结"; position:absolute; top:2px; right:4px;
  font-size:10px; color:#059669; background:#d1fae5; padding:1px 4px; border-radius:3px;
}
.cell .date-num { font-weight:600; }
.cell .amount { font-size:12px; margin-top:auto; color:#111827; }
.cell .amount.neg { color:#dc2626; }
.cell .amount.pos { color:#059669; }

.sidebar { background:#fff; border-radius:8px; padding:16px; box-shadow:0 1px 3px rgba(0,0,0,0.06); }
.sidebar h3 { margin-top:0; }
#summary .total { font-size:22px; font-weight:700; color:#2563eb; }
#summary .row, #dayDetail .row { display:flex; justify-content:space-between; padding:2px 0; font-size:13px; }

.modal { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal.hidden, .hidden { display:none !important; }
.modal-content { background:#fff; border-radius:8px; padding:20px 24px; min-width:320px; }
.modal-content.wide { min-width:520px; }
.modal-content label { display:block; margin:8px 0; }
.modal-content input[type=text], .modal-content input[type=password], .modal-content input:not([type=checkbox]) {
  padding:6px 8px; border:1px solid #d1d5db; border-radius:4px; margin-left:6px;
}
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
.modal-actions button, .inline button { cursor:pointer; padding:6px 14px; border:none; border-radius:4px; background:#3b82f6; color:#fff; }
.modal-actions .close, #adminModal .close { background:#6b7280; }
.err { color:#dc2626; margin-top:8px; font-size:13px; }
table { width:100%; border-collapse:collapse; margin-top:8px; }
th, td { border:1px solid #e5e7eb; padding:6px 8px; text-align:left; font-size:14px; }
th { background:#f3f4f6; }
.inline { display:flex; gap:8px; align-items:center; margin-top:8px; }
.inline input { flex:1; }
