* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2430;
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #11151d;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-title { margin: 0 0 4px; font-size: 24px; }
.login-subtitle { margin: 0 0 24px; color: #6b7280; font-size: 14px; }
.login-form label { display: block; margin-bottom: 14px; font-size: 13px; color: #374151; }
.login-form input {
  width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.login-form button {
  width: 100%; margin-top: 8px; padding: 12px; border: none; border-radius: 8px;
  background: #f5762e; color: #fff; font-weight: 600; font-size: 15px; cursor: pointer;
}
.login-form button:hover { background: #e0651f; }
.alert-error {
  background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
}

/* ---------- Dashboard shell ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 28px; background: #fff; border-bottom: 1px solid #e5e7eb;
}
.topbar h1 { margin: 0; font-size: 22px; }
.subtitle { margin: 2px 0 0; color: #6b7280; font-size: 13px; }
.period-toggle a {
  display: inline-block; padding: 8px 14px; margin-left: 6px; border-radius: 8px;
  text-decoration: none; color: #374151; font-size: 13px; background: #f3f4f6;
}
.period-toggle a.active { background: #4f46e5; color: #fff; }
.logout-link { background: #fff !important; border: 1px solid #d1d5db; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }

.date-range-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.date-range-row label { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 6px; }
.date-range-row input[type="date"] { padding: 6px 8px; border-radius: 6px; border: 1px solid #d1d5db; }
.date-range-row button { padding: 7px 16px; border-radius: 8px; border: none; background: #4f46e5; color: #fff; cursor: pointer; font-size: 13px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-card { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.kpi-label { display: block; font-size: 11px; letter-spacing: 0.04em; color: #9ca3af; margin-bottom: 6px; }
.kpi-value { display: block; font-size: 22px; font-weight: 700; }

.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.rank-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }

.card { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; }
.card-header-row h3 { margin: 0; }

.rank-row-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.rank-row-item:last-child { border-bottom: none; }
.empty { color: #9ca3af; font-size: 13px; }

.inline-form select { padding: 6px 10px; border-radius: 6px; border: 1px solid #d1d5db; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-row input, .filter-row select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 13px;
}
.filter-row button {
  padding: 8px 16px; border-radius: 8px; border: none; background: #111827; color: #fff; cursor: pointer;
}
.reset-btn {
  padding: 8px 16px; border-radius: 8px; background: #f3f4f6; color: #374151;
  text-decoration: none; font-size: 13px; display: inline-flex; align-items: center;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 10px; color: #9ca3af; font-weight: 600; font-size: 11px; text-transform: uppercase; border-bottom: 1px solid #e5e7eb; }
td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; white-space: nowrap; }
.type-in { color: #2563eb; font-weight: 600; }
.type-out { color: #ea580c; font-weight: 600; }
.table-note { color: #9ca3af; font-size: 12px; margin: 10px 0 0; }
.load-more { display: inline-block; margin-top: 8px; color: #4f46e5; font-size: 13px; text-decoration: none; }

@media (max-width: 900px) {
  .chart-row, .rank-row { grid-template-columns: 1fr; }
}