* { box-sizing: border-box; margin: 0; padding: 0; }

/* 로그인 */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #4a6cf7 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: #fff;
  border-radius: 24px;
  padding: 36px 28px 28px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-icon { font-size: 2.4rem; margin-bottom: 10px; }

.login-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 20px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ccc;
  transition: background 0.15s, border-color 0.15s;
}

.pin-dots span.filled {
  background: #4a6cf7;
  border-color: #4a6cf7;
}

.pin-dots span.error {
  background: #ef4444;
  border-color: #ef4444;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.pin-btn {
  background: #f5f5f5;
  border: none;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a1a2e;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}

.pin-btn:active { background: #e0e4ff; transform: scale(0.94); }
.pin-clear { color: #ef4444; background: #fee2e2; }
.pin-del   { color: #555;    background: #f0f0f0; }

.pin-error {
  font-size: 0.82rem;
  color: #ef4444;
  min-height: 18px;
  font-weight: 500;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 4vw, 32px) clamp(6px, 3vw, 16px);
}

.container {
  width: 100%;
  max-width: 480px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a2e;
}

header button {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #4a6cf7;
  padding: 0 12px;
  line-height: 1;
  transition: color 0.2s;
}
header button:hover { color: #2345d4; }

.calendar {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 20px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #4a6cf7;
}

.calendar-weekdays span {
  text-align: center;
  padding: clamp(6px, 2vw, 10px) 0;
  font-size: clamp(0.6rem, 2vw, 0.75rem);
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
}

.calendar-weekdays span:first-child { color: #fca5a5; }
.calendar-weekdays span:last-child { color: #93c5fd; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.day-cell {
  border: 1px solid #f0f0f0;
  min-height: clamp(52px, 13vw, 72px);
  padding: clamp(2px, 1vw, 6px);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.day-cell:hover:not(.empty) { background: #f0f4ff; }

.day-cell.empty { cursor: default; background: #fafafa; }

.day-cell.today .day-num {
  background: #4a6cf7;
  color: #fff;
  border-radius: 50%;
  width: clamp(20px, 5.5vw, 28px);
  height: clamp(20px, 5.5vw, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-cell.selected { background: #eef1ff; }

.day-cell.has-data .day-num {
  font-weight: 700;
}

.day-cell.holiday {
  background: #fff8f8;
}
.day-cell.holiday:hover:not(.empty) {
  background: #fff0f0;
}
.day-cell.holiday .day-num {
  color: #ef4444 !important;
}

.holiday-badge {
  font-size: clamp(0.42rem, 1.5vw, 0.55rem);
  color: #ef4444;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.day-num {
  font-size: clamp(0.65rem, 2.2vw, 0.85rem);
  font-weight: 700;
  color: #333;
  width: clamp(20px, 5.5vw, 28px);
  height: clamp(20px, 5.5vw, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.day-cell:nth-child(7n+1) .day-num { color: #ef4444; }
.day-cell:nth-child(7n) .day-num { color: #3b82f6; }
.day-cell.today .day-num { color: #fff !important; }

.day-hours {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 3px;
}

.day-time-range {
  font-size: clamp(0.42rem, 1.5vw, 0.6rem);
  color: #4a6cf7;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.day-duration {
  font-size: clamp(0.45rem, 1.6vw, 0.65rem);
  color: #7c3aed;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

.holiday-multiplier {
  font-size: clamp(0.4rem, 1.4vw, 0.55rem);
  color: #ef4444;
  font-weight: 700;
  background: #fee2e2;
  border-radius: 3px;
  padding: 0 2px;
}

.holiday-tag {
  font-size: 0.8rem;
  color: #ef4444;
  font-weight: 600;
  background: #fee2e2;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 6px;
}

.stats-note {
  font-size: 0.75rem;
  color: #999;
  margin-top: 6px;
}

.input-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 20px;
}

.input-panel h2 {
  font-size: 1rem;
  color: #1a1a2e;
  margin-bottom: 20px;
  font-weight: 600;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.time-row label {
  width: 40px;
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.time-row select {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1a1a2e;
  background: #fafafa;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a6cf7' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.time-row select:focus {
  outline: none;
  border-color: #4a6cf7;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-row button {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-row button:hover { opacity: 0.85; }

#saveBtn { background: #4a6cf7; color: #fff; }
.danger { background: #fee2e2; color: #ef4444; }
.secondary { background: #f0f0f0; color: #666; }

.stats {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 20px 24px;
  font-size: 0.95rem;
  color: #333;
  text-align: center;
  line-height: 1.8;
}

.stats .stat-value {
  font-weight: 700;
  color: #4a6cf7;
  font-size: 1.05rem;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.9rem;
}

.stats-divider {
  color: #ddd;
  font-size: 0.9rem;
}

.stat-remain {
  color: #16a34a !important;
}

.stat-over {
  color: #ef4444 !important;
}

.stats-bar-wrap {
  margin: 10px auto 0;
  width: 90%;
  height: 7px;
  background: #e8eaf6;
  border-radius: 99px;
  overflow: hidden;
}

.stats-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* 월간 근무표 / 연간 현황 버튼 */
.table-toggle-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.table-toggle-btn {
  background: #fff;
  border: 2px solid #4a6cf7;
  color: #4a6cf7;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.02em;
}
.table-toggle-btn:hover,
.table-toggle-btn.active {
  background: #4a6cf7;
  color: #fff;
}

/* 근무표 테이블 */
.work-table-wrap {
  margin-top: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
}

.work-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.work-table thead tr {
  background: #4a6cf7;
  color: #fff;
}

.work-table th {
  padding: 11px 10px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.work-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  vertical-align: middle;
}

.work-table tbody tr:last-child td {
  border-bottom: none;
}

.work-table tbody tr:hover {
  background: #f8f9ff;
}

.work-table tbody tr.holiday-row {
  background: #fff8f8;
}
.work-table tbody tr.holiday-row:hover {
  background: #fff0f0;
}

.work-table tfoot tr {
  background: #f5f5f5;
  font-weight: 700;
}

.work-table tfoot td {
  padding: 12px 10px;
  border-top: 2px solid #e0e0e0;
  color: #1a1a2e;
}

.work-table .total-label {
  text-align: center;
  color: #4a6cf7;
  font-weight: 700;
}

.work-table .total-hours {
  color: #4a6cf7;
  font-weight: 700;
  font-size: 1rem;
}

.work-table .holiday-chip {
  display: inline-block;
  background: #fee2e2;
  color: #ef4444;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
}

.work-table .multiplier-chip {
  display: inline-block;
  background: #ede9fe;
  color: #7c3aed;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 3px;
}

/* 급여 요약 카드 */
.pay-summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 2px solid #f0f0f0;
}

.pay-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f5f5f5;
  flex-wrap: wrap;
  gap: 4px;
}

.pay-label {
  font-size: 0.88rem;
  color: #555;
  font-weight: 500;
  min-width: 90px;
}

.pay-amount {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.pay-amount.total {
  color: #4a6cf7;
  font-size: 1.15rem;
}

.pay-sub {
  font-size: 0.75rem;
  color: #999;
  margin-left: auto;
  padding-left: 12px;
}

.pay-summary-item.holiday-pay { background: #fff8f8; }
.pay-summary-item.holiday-pay .pay-amount { color: #ef4444; }

.pay-summary-item.total-pay { background: #f0f4ff; }

.pay-summary-item.insurance-section {
  background: #fafafa;
  border-top: 2px dashed #e0e0e0;
  margin-top: 2px;
}
.ins-title { font-weight: 700; color: #555; }
.ins-total { color: #e67e22; font-weight: 700; font-size: 1rem; }

.ins-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}
.ins-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 20px;
  font-size: 0.8rem;
  color: #777;
  border-bottom: 1px solid #f0f0f0;
}
.ins-item span:last-child { font-weight: 600; color: #555; }

.pay-notice {
  font-size: 0.75rem;
  color: #999;
  text-align: center;
  padding: 10px 16px;
  background: #fafafa;
}

.pay-summary-item.net-pay {
  background: #e8f5e9;
  border-top: 2px solid #c8e6c9;
}
.pay-amount.net {
  color: #2e7d32;
  font-size: 1.2rem;
  font-weight: 800;
}

.work-table .pay-cell {
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
}

/* 연간 현황 테이블 */
.annual-current {
  background: #eef1ff !important;
  font-weight: 600;
}
.annual-future td {
  color: #bbb;
}
.current-badge {
  display: inline-block;
  background: #4a6cf7;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 2px;
}

.work-table .normal-chip {
  display: inline-block;
  background: #e8f5e9;
  color: #388e3c;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
}

.work-table .sat-chip {
  display: inline-block;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
}
