:root {
  --bg: #f3f6f9;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #5b6775;
  --line: #d9e0e7;
  --accent: #0d6efd;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: #0f172a; color: #fff; }
.topbar nav a { color: #c8d4e6; text-decoration: none; margin: 0 8px; }
.topbar nav a.active { color: #fff; font-weight: 600; }
.brand { font-weight: 700; }
.container { max-width: 1280px; margin: 16px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.filter-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.date-input { width: 176px; min-width: 176px; }
.filter-note { color: var(--muted); font-size: 12px; line-height: 1.6; border: 1px dashed var(--line); background: #f8fafc; border-radius: 8px; padding: 8px 10px; max-width: 460px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, textarea, button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
input, textarea { width: 100%; background: #fff; }
button { background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; }
button:hover { opacity: 0.9; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--line); }
.actions { display: flex; gap: 8px; align-items: end; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; }
th { background: #f8fafc; }
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { background: #eef4ff; }
.selectable-row { cursor: pointer; }
.selectable-row:hover { background: #f7fbff; }
.selected-row { background: #e8f2ff !important; }
.chart { width: 100%; min-height: 360px; }
.err { color: #d22; }
pre { white-space: pre-wrap; word-break: break-all; }
.checkbox-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.cb { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.muted-tip { color: var(--muted); font-size: 12px; }

.login-bg { display: grid; min-height: 100vh; place-items: center; }
.login-card { width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.login-card h1 { margin: 0 0 12px 0; font-size: 20px; }

@media (max-width: 1024px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .checkbox-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .date-input { width: 100%; min-width: 0; }
  .filter-note { max-width: none; width: 100%; }
}
