* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", sans-serif;
  background: #f5f6f8;
  color: #1f2937;
  line-height: 1.5;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.brand { font-weight: 700; font-size: 16px; }

nav { display: flex; align-items: center; gap: 16px; }
nav a {
  color: #374151;
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { color: #2563eb; }

.user { color: #6b7280; font-size: 13px; }
.inline-form { display: inline; margin: 0; }

main {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
}

h1 { margin-top: 0; font-size: 22px; }

.card {
  background: #fff;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.center { text-align: center; max-width: 480px; margin: 80px auto; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.primary { background: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.discord { background: #5865F2; color: #fff; }
.btn.discord:hover { background: #4752c4; }
.btn.ghost {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}
.btn.ghost:hover { background: #f3f4f6; }

.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.filters label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #6b7280;
  gap: 4px;
}
.filters input, .filters select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}

.meta { color: #6b7280; font-size: 13px; margin: 12px 0; }

table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
th {
  background: #f9fafb;
  text-align: left;
  padding: 12px;
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td {
  padding: 12px;
  border-top: 1px solid #f3f4f6;
  font-size: 14px;
  vertical-align: middle;
}
tr.ongoing { background: #fef9c3; }
tr.inactive { color: #9ca3af; }

code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.error {
  color: #b91c1c;
  background: #fee2e2;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
}

.pager {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
  font-size: 14px;
}
.pager a {
  color: #2563eb;
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
}
.pager a:hover { background: #eff6ff; }
.pager span { color: #6b7280; }

footer {
  text-align: center;
  color: #9ca3af;
  padding: 32px 24px;
  font-size: 12px;
}

tr.current { background: #fef9c3; }

.badge {
  display: inline-block;
  background: #fbbf24;
  color: #78350f;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  font-weight: 600;
}

.ok {
  color: #166534;
  background: #dcfce7;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
}

.rate-form, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 16px 0;
}
.rate-form label, .filters label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #6b7280;
  gap: 4px;
}
.rate-form input, .rate-form select,
.filters input, .filters select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: #111827;
}

section { margin: 24px 0; }
section h2 { margin-bottom: 8px; font-size: 18px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}
.stat-card .label {
  color: #6b7280;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-top: 6px;
}
.stat-card .sub {
  color: #6b7280;
  font-size: 12px;
  margin-top: 4px;
}

.warn {
  color: #92400e;
  background: #fef3c7;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
}

.stat-card.highlight {
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.stat-card.highlight .value { color: #065f46; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.pay { font-weight: 600; color: #065f46; font-variant-numeric: tabular-nums; }

.payroll-summary tbody tr:hover { background: #f9fafb; }
.payroll-summary .total-row {
  background: #f3f4f6;
  border-top: 2px solid #d1d5db;
  font-size: 15px;
}
.payroll-summary .total-row .pay { color: #065f46; font-size: 16px; }

.emp-detail {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
}
.emp-detail summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.emp-detail summary::-webkit-details-marker { display: none; }
.emp-detail summary::before {
  content: '▶';
  font-size: 10px;
  color: #6b7280;
  transition: transform 0.15s;
}
.emp-detail[open] summary::before { transform: rotate(90deg); }
.emp-detail summary .pay-pill {
  margin-left: auto;
  background: #d1fae5;
  color: #065f46;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.emp-detail table { margin-top: 12px; }

.login-card { max-width: 360px; margin: 60px auto; padding: 32px; }
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #374151;
  text-align: left;
}
.login-form input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  background: #fff;
}
.login-form input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.btn.block { display: block; width: 100%; box-sizing: border-box; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 12px;
  margin: 16px 0 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.center { text-align: center; }

.server-switcher select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  color: #111827;
  cursor: pointer;
}
.server-label {
  font-size: 13px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 999px;
}
tr.absent { background: #fef3c7; opacity: 0.8; }
