/* ===== 기본 리셋 & 변수 ===== */
:root {
  --color-D:    #4A90D9;
  --color-E:    #E67E22;
  --color-N:    #8E44AD;
  --color-D12:  #1A5276;
  --color-N12:  #5B2C6F;
  --color-P8:   #27AE60;
  --color-H8:   #16A085;
  --color-Off:  #BDC3C7;
  --color-Hol:  #F1C40F;
  --color-연:   #E74C3C;
  --color-보:   #A9CCE3;
  --color-So:   #EB984E;
  --color-테:   #95A5A6;

  --header-bg: #2C3E50;
  --header-txt: #ECF0F1;
  --weekend-bg: #F8F0FB;
  --row-even: #F9FBFD;
  --row-odd: #FFFFFF;
  --border: #E5E8EB;
  --sticky-shadow: 2px 0 4px rgba(0,0,0,0.06);
  --island-radius: 14px;
  --island-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --gap: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  background: #F0F2F5;
  color: #2C3E50;
}

/* ===== 페이드인 애니메이션 ===== */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== 헤더 ===== */
#app-header {
  background: var(--header-bg);
  color: var(--header-txt);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#app-header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#month-label {
  font-size: 14px;
  opacity: 0.85;
}

/* ===== 인증 버튼 ===== */
#auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

#user-name-display {
  font-size: 13px;
  opacity: 0.9;
}

#usage-display {
  font-size: 11px;
  background: rgba(255,255,255,0.15);
  padding: 3px 8px;
  border-radius: 10px;
  opacity: 0.85;
}

.auth-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
}

.auth-btn:hover {
  background: rgba(255,255,255,0.28);
}

.auth-btn.secondary {
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  opacity: 0.8;
}

/* ===== 로그인 모달 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  animation: fadeSlideIn 0.3s ease-out;
}

.modal-box h2 {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--header-bg);
}

.modal-field {
  margin-bottom: 14px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #555;
}

.modal-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.modal-field input:focus {
  border-color: #2980B9;
  box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}

.modal-error {
  font-size: 12px;
  color: #e74c3c;
  margin-bottom: 10px;
}

.modal-hint {
  font-size: 11px;
  color: #888;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-actions .auth-btn {
  flex: 1;
  background: var(--header-bg);
  color: #fff;
  border: none;
  padding: 10px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-actions .auth-btn:hover {
  opacity: 0.85;
}

.modal-actions .auth-btn.secondary {
  background: #ecf0f1;
  color: #555;
  opacity: 1;
}

.modal-actions .auth-btn.secondary:hover {
  background: #dce1e4;
}

/* ===== 인증 게이트 ===== */
#auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
}

.auth-gate-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: var(--island-shadow);
  max-width: 400px;
  width: 90%;
  animation: fadeSlideIn 0.4s ease-out;
}

.auth-gate-box h2 {
  font-size: 20px;
  color: var(--header-bg);
  margin-bottom: 12px;
}

.auth-gate-box p {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-gate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-gate-actions .action-btn {
  padding: 10px 28px;
  font-size: 14px;
}

.auth-gate-hint {
  font-size: 12px !important;
  color: #999 !important;
  margin-bottom: 0 !important;
}

/* ===== 앱 콘텐츠 영역 ===== */
#app-content {
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* ===== Island 공통 ===== */
.island, #month-bar, #filter-bar, #favorite-bar, #action-bar, #legend {
  background: #fff;
  border-radius: var(--island-radius);
  box-shadow: var(--island-shadow);
  animation: fadeSlideIn 0.35s ease-out both;
}

/* ===== 월 선택 바 ===== */
#month-bar {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  animation-delay: 0.05s;
}

.month-btn {
  padding: 6px 14px;
  border: 1px solid #DDE1E5;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
}

.month-btn:hover {
  background: #EBF5FB;
  border-color: #AED6F1;
}

.month-btn.active {
  background: var(--header-bg);
  color: #fff;
  border-color: var(--header-bg);
  box-shadow: 0 2px 6px rgba(44,62,80,0.25);
}

/* ===== 필터 버튼 ===== */
#filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: wrap;
  animation-delay: 0.1s;
}

.filter-btn {
  padding: 5px 12px;
  border: 1px solid #DDE1E5;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all var(--transition);
}

.filter-btn:hover {
  background: #EBF5FB;
}

.filter-btn.active {
  background: var(--header-bg);
  color: #fff;
  border-color: var(--header-bg);
}

/* ===== 액션 바 ===== */
#action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
  animation-delay: 0.15s;
}

.action-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
}

.action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.action-btn:active:not(:disabled) {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn.primary {
  background: #2980B9;
  color: #fff;
}

.action-btn.warning {
  background: #E74C3C;
  color: #fff;
}

.action-btn.ai {
  background: linear-gradient(135deg, #8E44AD, #6C3483);
  color: #fff;
}

.action-btn.reset {
  background: #95A5A6;
  color: #fff;
}

#solve-info {
  font-size: 11px;
  color: #7F8C8D;
  margin-left: 8px;
}

/* ===== 로딩 스피너 ===== */
#loading-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #2980B9;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #D5D8DC;
  border-top-color: #2980B9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 메인 콘텐츠 (테이블 + 위반 패널) ===== */
#main-content {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
  animation: fadeSlideIn 0.4s ease-out 0.2s both;
}

/* ===== 근무표 컨테이너 ===== */
#schedule-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--island-radius);
  box-shadow: var(--island-shadow);
  padding: 6px;
}

/* ===== 테이블 ===== */
#schedule-table {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: max-content;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

/* 테이블 렌더 시 행 순차 애니메이션 (opacity만, 레이아웃 안 흔들림) */
#schedule-table tbody tr {
  animation: fadeIn 0.15s ease-out both;
}

/* 헤더 행 */
#schedule-table thead th {
  background: var(--header-bg);
  color: var(--header-txt);
  font-weight: 600;
  font-size: 11px;
  padding: 6px 3px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 첫 열 (간호사명) sticky — prev_tail 있으면 이름이 첫 열 아님 */
#schedule-table .name-cell {
  position: sticky;
  left: 0;
  z-index: 20;
  min-width: 42px;
  max-width: 42px;
  background: #EBF5FB;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--sticky-shadow);
  font-size: 12px;
}

#schedule-table thead .name-header {
  position: sticky;
  left: 0;
  z-index: 30;
  background: var(--header-bg);
  min-width: 42px;
  max-width: 42px;
}

/* DE-only 배지 */
.de-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--color-D);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 2px;
  vertical-align: top;
  line-height: 14px;
}

.name-cell.de-only {
  background: #D6EAF8 !important;
}

/* N전담 배지 */
.nd-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--color-N);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 2px;
  vertical-align: top;
  line-height: 14px;
}

.name-cell.nd-only {
  background: #E8DAEF !important;
}

/* shift-editor active 상태 */
.shift-option.active {
  outline: 2px solid #3498DB;
  outline-offset: -1px;
}

/* 요일 행 */
#schedule-table thead tr.weekday-row th {
  font-size: 10px;
  font-weight: 400;
  padding: 2px 3px;
  background: #3D566E;
}

#schedule-table thead tr.weekday-row .name-header {
  background: #3D566E;
}

/* 주말 열 헤더 */
#schedule-table thead th.weekend {
  background: #4A235A;
}

/* 데이터 행 */
#schedule-table tbody tr:nth-child(even) {
  background: var(--row-even);
}

#schedule-table tbody tr:nth-child(odd) {
  background: var(--row-odd);
}

#schedule-table tbody tr {
  transition: background var(--transition);
}

#schedule-table tbody tr:hover {
  background: #EAF2FF;
}

/* 데이터 셀 */
#schedule-table tbody td {
  text-align: center;
  padding: 4px 2px;
  border: 1px solid var(--border);
  min-width: 32px;
  font-size: 11px;
  font-weight: 500;
  transition: background var(--transition);
}

/* 주말 열 */
#schedule-table tbody td.weekend {
  background-color: var(--weekend-bg);
}

#schedule-table tbody tr:hover td.weekend {
  background-color: #DFF0FF;
}

/* ===== 근무 칩 ===== */
.shift-chip {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  min-width: 26px;
  text-align: center;
  letter-spacing: 0.2px;
}

.chip-D    { background: var(--color-D);   }
.chip-E    { background: var(--color-E);   }
.chip-N    { background: var(--color-N);   }
.chip-D12  { background: var(--color-D12); }
.chip-N12  { background: var(--color-N12); }
.chip-P8   { background: var(--color-P8);  }
.chip-H8   { background: var(--color-H8);  }
.chip-Off  { background: var(--color-Off); color: #777; }
.chip-Hol  { background: var(--color-Hol); color: #555; }
.chip-연   { background: var(--color-연);  }
.chip-보   { background: var(--color-보);  color: #2C3E50; }
.chip-So   { background: var(--color-So);  }
.chip-테   { background: var(--color-테); color: #fff; }

/* ===== 요약 행 ===== */
.summary-row td {
  font-size: 10px;
  font-weight: 700;
  background: #F4F6F7 !important;
  color: #2C3E50;
  padding: 3px 2px;
}

.summary-row .name-cell {
  font-size: 10px;
  background: #E8EAED !important;
}

.summary-d  { color: var(--color-D);   }
.summary-e  { color: var(--color-E);   }
.summary-n  { color: var(--color-N);   }
.summary-12 { color: var(--color-D12); }

/* ===== 범례 ===== */
#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  animation-delay: 0.25s;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.legend-swatch {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* ===== 수동 편집 셀 ===== */
td.manual-edit {
  background-color: #FF69B4 !important;
}

/* ===== 공휴일 헤더 ===== */
th.holiday {
  background: #E74C3C !important;
  color: #fff;
}

#schedule-table thead tr.weekday-row th.holiday {
  background: #C0392B !important;
}

/* ===== 위반 표시 ===== */
td.violation-hard {
  outline: 2px solid #E74C3C;
  outline-offset: -2px;
}

td.violation-soft {
  outline: 2px solid #F39C12;
  outline-offset: -2px;
}

/* ===== 위반 패널 (오른쪽 사이드 island) ===== */
#violations-panel {
  background: #fff;
  border-radius: var(--island-radius);
  box-shadow: var(--island-shadow);
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  animation: fadeSlideIn 0.4s ease-out 0.25s both;
}

.violations-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--header-bg);
  user-select: none;
  border-bottom: 1px solid var(--border);
  border-radius: var(--island-radius) var(--island-radius) 0 0;
  flex-shrink: 0;
  transition: background var(--transition);
}

.violations-toggle:hover {
  background: #F8F9FA;
}

#violations-body {
  padding: 6px 12px 12px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(100vh - 200px);
}

.violation-section-hard {
  font-size: 12px;
  color: #E74C3C;
  margin: 8px 0 4px;
}

.violation-section-soft {
  font-size: 12px;
  color: #F39C12;
  margin: 8px 0 4px;
}

.violation-item {
  font-size: 11px;
  padding: 4px 10px;
  margin: 3px 0;
  border-radius: 6px;
  transition: background var(--transition);
}

.violation-item.hard {
  background: #FDEDEC;
  color: #922B21;
  border-left: 3px solid #E74C3C;
}

.violation-item.soft {
  background: #FEF9E7;
  color: #7D6608;
  border-left: 3px solid #F39C12;
}

.violation-item:hover {
  filter: brightness(0.97);
}

/* ===== 셀 편집 드롭다운 ===== */
#shift-editor {
  position: fixed;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  padding: 8px;
  animation: fadeSlideIn 0.15s ease-out;
}

#shift-editor-options {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 200px;
}

.shift-option {
  padding: 5px 10px;
  border: 1px solid #D5D8DC;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.1s;
}

.shift-option:hover {
  transform: scale(1.1);
}

/* ===== 전달 근무 열 ===== */
.prev-tail-header {
  background: #5D6D7E !important;
  color: #AEB6BF !important;
  font-weight: 400 !important;
  opacity: 0.8;
}

.prev-tail-cell {
  background: #F2F3F4 !important;
  opacity: 0.55;
  min-width: 32px;
}

.prev-tail-cell .shift-chip {
  opacity: 0.75;
}

.separator-col {
  width: 4px !important;
  min-width: 4px !important;
  max-width: 4px !important;
  padding: 0 !important;
  background: #BDC3C7 !important;
  border: none !important;
}

#schedule-table thead th.separator-col {
  background: #7F8C8D !important;
}

/* ===== 인원 설정 팝오버 ===== */
#staffing-editor {
  position: fixed;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  padding: 10px 14px;
  min-width: 140px;
  animation: fadeSlideIn 0.15s ease-out;
}

.staffing-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--header-bg);
  margin-bottom: 8px;
  text-align: center;
}

.staffing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  justify-content: center;
}

.staffing-label {
  font-size: 12px;
  font-weight: 700;
  width: 16px;
  text-align: center;
}

.staffing-label-D { color: var(--color-D); }
.staffing-label-E { color: var(--color-E); }
.staffing-label-N { color: var(--color-N); }

.staffing-minus,
.staffing-plus {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.staffing-minus:hover,
.staffing-plus:hover {
  background: #e8f0fe;
  border-color: #2980B9;
  color: #2980B9;
}

.staffing-value {
  font-size: 14px;
  font-weight: 700;
  width: 20px;
  text-align: center;
  color: var(--header-bg);
}

.staffing-cell {
  transition: background var(--transition);
}

.staffing-cell:hover {
  background: #E8F6F3 !important;
}

/* ===== Off 수 열 ===== */
.off-count-cell {
  font-weight: 700;
  font-size: 11px;
  color: #7F8C8D;
  background: #F4F6F7 !important;
  min-width: 30px;
}

/* ===== 오른쪽 이름 + 근무 카운트 열 ===== */
.right-name-cell {
  font-size: 10px;
  font-weight: 600;
  color: #34495E;
  background: #F8F9FA !important;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: static !important;
}

.right-name-header {
  position: static !important;
}

.count-header {
  font-size: 10px;
  min-width: 24px;
  max-width: 28px;
}

.shift-count-cell {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  color: #555;
  background: #F8F9FA !important;
  min-width: 24px;
  max-width: 28px;
}

/* ===== 로딩 / 에러 ===== */
#status {
  text-align: center;
  padding: 32px;
  color: #7F8C8D;
  font-size: 14px;
}

/* ===== 솔버 시각화 (테이블 기반) ===== */
#solver-status-bar {
  background: #1a1a2e;
  border-radius: var(--island-radius) var(--island-radius) 0 0;
  padding: 10px 14px 8px;
  margin: -6px -6px 4px -6px;
}

.solver-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.solver-bar-left .spinner {
  width: 14px; height: 14px;
  border-width: 2px;
  border-top-color: #3498DB;
}

.solver-phase-text {
  color: #BDC3C7;
  font-size: 12px;
  font-weight: 600;
}

#solver-status-bar .solver-progress {
  height: 3px;
  background: #2C3E50;
  border-radius: 2px;
  overflow: hidden;
}

#solver-status-bar .solver-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2980B9, #8E44AD, #E74C3C);
  background-size: 200% 100%;
  animation: solver-progress-glow 1.5s ease-in-out infinite;
  width: 0%;
  transition: width 0.3s;
}

@keyframes solver-progress-glow {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}

#schedule-table.solving {
  opacity: 0.85;
}

#schedule-table.solving tbody td:not(.name-cell):not(.off-count-cell):not(.right-name-cell):not(.shift-count-cell) {
  cursor: default;
}

.cell-flash {
  animation: cellPulse 0.15s ease-out;
}

@keyframes cellPulse {
  0% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ===== 병동 관리 모달 ===== */
.ward-invite-box {
  background: #F0F7FF;
  border: 1px solid #AED6F1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.ward-invite-box label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  display: block;
  margin-bottom: 6px;
}

.ward-code-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ward-code-display span:first-child {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--header-bg);
  font-family: monospace;
}

.ward-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.15s;
}

.ward-member-row:hover {
  background: #f5f5f5;
}

.ward-member-name {
  font-weight: 600;
  color: var(--header-bg);
  min-width: 60px;
}

.ward-member-role {
  font-size: 10px;
  background: #E8DAEF;
  color: #6C3483;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.ward-member-email {
  color: #888;
  font-size: 11px;
  flex: 1;
}

.ward-member-remove {
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid #E74C3C;
  border-radius: 6px;
  background: #fff;
  color: #E74C3C;
  cursor: pointer;
  transition: all 0.15s;
}

.ward-member-remove:hover {
  background: #E74C3C;
  color: #fff;
}

/* select 스타일 */
.modal-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  transition: border-color var(--transition);
}

.modal-field select:focus {
  border-color: #2980B9;
}

/* ===== 즐겨찾기 바 ===== */
#favorite-bar {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: wrap;
  align-items: center;
  animation-delay: 0.12s;
}

.fav-btn {
  padding: 5px 12px;
  border: 1px solid #DDE1E5;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
  color: #2C3E50;
}

.fav-btn:hover {
  background: #EBF5FB;
  border-color: #AED6F1;
}

.fav-btn.active {
  background: #2980B9;
  color: #fff;
  border-color: #2980B9;
}

.fav-filter-btn {
  background: #F0E6F6;
  border-color: #D2B4DE;
  color: #6C3483;
}

.fav-filter-btn:hover {
  background: #E8D5F5;
}

.fav-filter-btn.active {
  background: #8E44AD;
  color: #fff;
  border-color: #8E44AD;
}

.fav-add-btn {
  background: #E8F8F5;
  border-color: #A3E4D7;
  color: #1ABC9C;
  font-weight: 600;
}

.fav-add-btn:hover {
  background: #D1F2EB;
}

.fav-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #EBF5FB;
  border: 1px solid #AED6F1;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  color: #2471A3;
  white-space: nowrap;
}

.fav-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #85929E;
  transition: color 0.15s;
}

.fav-remove:hover {
  color: #E74C3C;
}

/* 즐겨찾기 행 하이라이트 */
#schedule-table tbody tr.fav-highlight {
  background: #EBF5FB !important;
}

#schedule-table tbody tr.fav-highlight:hover {
  background: #D4E6F1 !important;
}

#schedule-table tbody tr.my-highlight {
  background: #D5F5E3 !important;
}

#schedule-table tbody tr.my-highlight:hover {
  background: #ABEBC6 !important;
}

#schedule-table tbody tr.my-highlight .name-cell {
  background: #27AE60 !important;
  color: #fff;
}

#schedule-table tbody tr.fav-highlight .name-cell {
  background: #2980B9 !important;
  color: #fff;
}

#schedule-table tbody tr.my-highlight .name-cell {
  background: #27AE60 !important;
  color: #fff;
}

/* ===== 반응형 ===== */
@media (max-width: 1200px) {
  #main-content {
    flex-direction: column;
  }
  #violations-panel {
    max-width: 100%;
    min-width: auto;
    max-height: 240px;
  }
  #violations-body {
    max-height: 180px;
  }
}

@media (max-width: 768px) {
  #app-header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 6px;
  }
  #app-header h1 { font-size: 14px; }
  #header-right {
    flex-wrap: wrap;
    gap: 6px;
  }
  .modal-box {
    width: 92%;
    padding: 20px 18px;
  }
  .auth-gate-box {
    padding: 28px 20px;
  }
  #violations-panel {
    max-width: 100%;
    min-width: auto;
  }
  #favorite-bar {
    padding: 6px 10px;
  }
  .fav-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  :root { --gap: 6px; --island-radius: 10px; }
  #app-header h1 { font-size: 13px; }
  #month-label { font-size: 12px; }
  .auth-btn { font-size: 11px; padding: 4px 8px; }
  #month-bar { padding: 6px 8px; gap: 3px; }
  .month-btn { padding: 5px 10px; font-size: 11px; }
  #filter-bar { padding: 6px 8px; }
  .filter-btn { padding: 4px 8px; font-size: 11px; }
  #favorite-bar { padding: 6px 8px; gap: 4px; }
  .fav-btn { padding: 5px 8px; font-size: 10px; }
  .fav-tag { padding: 2px 8px; font-size: 10px; }
  #action-bar { padding: 8px 10px; }
  .action-btn { padding: 7px 14px; font-size: 11px; }
  #schedule-table tbody td { min-width: 28px; padding: 3px 1px; }
  .shift-chip { min-width: 22px; font-size: 9px; padding: 1px 3px; }
  #schedule-table thead th { font-size: 10px; padding: 5px 2px; }
  .name-cell { min-width: 36px !important; max-width: 36px !important; font-size: 11px !important; }
  #legend { padding: 8px 10px; }
  .legend-item { font-size: 10px; }
}
