:root {
  --sidebar-width: 220px;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
}

body {
  background: var(--bg);
  font-family: 'Segoe UI', sans-serif;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

#sidebar .brand {
  padding: 24px 20px 16px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid #334155;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background .15s;
}
#sidebar .brand:hover {
  background: rgba(255,255,255,.05);
}

#sidebar .brand span {
  font-size: 0.7rem;
  color: #64748b;
  display: block;
  font-weight: 400;
  margin-top: 2px;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

#sidebar nav a:hover,
#sidebar nav a.active {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

#sidebar nav a.active {
  border-left: 3px solid var(--sidebar-active);
}

/* 설정 서브메뉴 */
#sidebar .submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .2s ease;
}
#sidebar .submenu.open { max-height: 700px; }
#sidebar .submenu a {
  padding: 9px 20px 9px 44px;
  font-size: 0.82rem;
  color: #94a3b8;
}
#sidebar .submenu a:hover,
#sidebar .submenu a.active {
  color: #fff;
  background: rgba(255,255,255,0.05);
}
#sidebar .submenu a.active { border-left: 3px solid var(--sidebar-active); }
#sidebar nav a .arrow {
  margin-left: auto;
  font-size: .7rem;
  color: #64748b;
  transition: transform .2s;
}
#sidebar nav a.open .arrow { transform: rotate(180deg); }

#sidebar .sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid #334155;
  color: #64748b;
  font-size: 0.8rem;
}

#sidebar .sidebar-footer .username {
  color: #94a3b8;
  font-weight: 600;
}

/* ── Main content ── */
#main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 16px 32px 32px 32px;
  font-size: 1.25rem;
  min-width: 680px;
}

#main .form-control,
#main .form-select,
#main .btn,
#main .form-label,
#main label {
  font-size: 1.1rem;
}

/* 버튼 텍스트 줄바꿈 방지 */
.btn {
  white-space: nowrap;
}

/* ── Cards ── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  color: #64748b;
  font-size: 1.1rem;
  margin-top: 4px;
}

/* ── Table ── */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}

.table-card .table-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.table-card .table-header h5 {
  margin: 0;
  font-weight: 600;
}

.table th {
  font-size: 1.03rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.table td {
  vertical-align: middle;
  font-size: 1.13rem;
}

/* ── Badges ── */
.badge-active {
  background: #dcfce7;
  color: #16a34a;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-closed {
  background: #f1f5f9;
  color: #64748b;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-admin {
  background: #fef3c7;
  color: #d97706;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
}

/* ── Page title ── */
.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 24px;
}

/* ── Schedule tag ── */
.schedule-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
}

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: #64748b;
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* ── FullCalendar custom ── */
.fc-event {
  cursor: pointer;
  font-size: 0.78rem !important;
  padding: 1px 4px !important;
}
.fc-daygrid-more-link {
  color: #e53e3e !important;
  font-weight: 600;
}

#calendar-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Upcoming list ── */
.upcoming-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.upcoming-item:last-child { border-bottom: none; }

.upcoming-date {
  min-width: 52px;
  text-align: center;
  background: #eff6ff;
  border-radius: 8px;
  padding: 6px 4px;
}

.upcoming-date .day { font-size: 1.2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.upcoming-date .month { font-size: 0.7rem; color: #64748b; }

.upcoming-info .case-name { font-size: 1.03rem; color: #64748b; }
.upcoming-info .sched-name { font-size: 1.13rem; font-weight: 600; }

.alert-danger-custom { background: #fff1f2; color: #be123c; border-radius: 8px; padding: 10px 14px; font-size: 1.1rem; }


/* ── FullCalendar 요일 색상 ── */
/* 일요일 헤더 */
.fc-col-header-cell.fc-day-sun a,
.fc-col-header-cell.fc-day-sun { color: #e53e3e !important; }
/* 토요일 헤더 */
.fc-col-header-cell.fc-day-sat a,
.fc-col-header-cell.fc-day-sat { color: #2563eb !important; }
/* 일요일 날짜 숫자 */
.fc-daygrid-day.fc-day-sun .fc-daygrid-day-number,
.fc-list-day.fc-day-sun .fc-list-day-text,
.fc-list-day.fc-day-sun .fc-list-day-side-text { color: #e53e3e !important; }
/* 토요일 날짜 숫자 */
.fc-daygrid-day.fc-day-sat .fc-daygrid-day-number,
.fc-list-day.fc-day-sat .fc-list-day-text,
.fc-list-day.fc-day-sat .fc-list-day-side-text { color: #2563eb !important; }
/* 평일 날짜 숫자 */
.fc-daygrid-day-number { color: #1a202c; font-size: 0.9rem !important; }
.fc-daygrid-day-top { flex-direction: row !important; align-items: center; }
.fc-holiday-name {
  font-size: 0.9rem;
  color: #e53e3e;
  margin-left: 4px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* ── Flatpickr 요일 색상 ── */
/* 일요일 헤더 */
.flatpickr-weekdaycontainer .flatpickr-weekday:first-child { color: #e53e3e !important; font-weight: 700; }
/* 토요일 헤더 */
.flatpickr-weekdaycontainer .flatpickr-weekday:last-child { color: #2563eb !important; font-weight: 700; }

/* 날짜 셀 요일별 색상 */
.flatpickr-day.fp-sunday { color: #e53e3e !important; }
.flatpickr-day.fp-saturday { color: #2563eb !important; }

/* flatpickr 공휴일 */
.flatpickr-day.fp-holiday { color: #e53e3e !important; }
/* 선택된 날짜는 흰색 유지 */
.flatpickr-day.selected.fp-sunday,
.flatpickr-day.selected.fp-saturday,
.flatpickr-day.selected.fp-holiday { color: #fff !important; }

/* 이전/다음 달 날짜 흐리게 */
.flatpickr-day.prevMonthDay.fp-sunday,
.flatpickr-day.nextMonthDay.fp-sunday { color: #fca5a5 !important; }
.flatpickr-day.prevMonthDay.fp-saturday,
.flatpickr-day.nextMonthDay.fp-saturday { color: #93c5fd !important; }

/* ── Flatpickr 2x 크기 ── */
.flatpickr-calendar {
  font-size: 1.1rem !important;
  width: 560px !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
  padding: 8px !important;
}
.flatpickr-months {
  padding: 6px 0 !important;
}
.flatpickr-months .flatpickr-month {
  height: 44px !important;
}
.flatpickr-current-month {
  font-size: 1.15rem !important;
  padding-top: 8px !important;
}
.flatpickr-current-month .numInputWrapper {
  width: 7ch !important;
}
.flatpickr-weekdays {
  height: 40px !important;
}
span.flatpickr-weekday {
  font-size: 1rem !important;
  line-height: 40px !important;
}
.flatpickr-days {
  width: 560px !important;
}
.dayContainer {
  width: 560px !important;
  min-width: 560px !important;
  max-width: 560px !important;
}
.flatpickr-day {
  max-width: 76px !important;
  height: 56px !important;
  line-height: 56px !important;
  font-size: 1.05rem !important;
  border-radius: 8px !important;
}
.flatpickr-prev-month svg,
.flatpickr-next-month svg {
  width: 20px !important;
  height: 20px !important;
}
.flatpickr-time {
  height: 50px !important;
}
.flatpickr-time input {
  font-size: 1.1rem !important;
  height: 50px !important;
}

/* ── Sidebar Tracker Widget ── */
#sidebar-tracker {
  padding: 12px 16px;
  border-top: 1px solid #334155;
}
#sidebar-tracker #st-stopped {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sidebar-tracker .st-label {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#sidebar-tracker .st-start-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background .15s;
}
#sidebar-tracker .st-start-btn:hover { background: #1d4ed8; }
#sidebar-tracker #st-running { display: flex; flex-direction: column; gap: 3px; }
#sidebar-tracker #st-elapsed {
  font-size: 1.2rem;
  font-weight: 700;
  color: #22c55e;
  letter-spacing: 1px;
  font-family: monospace;
}
#sidebar-tracker .st-info-row {
  font-size: 0.78rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sidebar-tracker .st-info-activity {
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 600;
}
#sidebar-tracker .st-stop-btn {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  margin-top: 6px;
  transition: background .15s;
  width: 100%;
}
#sidebar-tracker .st-stop-btn:hover { background: #b91c1c; }

/* ── Tracker Start Modal ── */
.ts-recent-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 120px;
  max-width: 180px;
}
.ts-recent-card:hover, .ts-recent-card.selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.ts-rc-ref { font-size: 0.85rem; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-rc-sub { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.ts-activity-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e293b;
}
.ts-activity-card:hover {
  opacity: 0.85;
}
.ts-activity-card.selected {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
.ts-more-btn {
  font-size: 0.8rem;
  padding: 3px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  text-align: center;
}
.ts-more-btn:hover {
  background: #f1f5f9;
}
.ts-cat-filter-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}
.ts-cat-btn {
  font-size: 0.8rem;
  padding: 3px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.ts-cat-btn:hover { background: #f1f5f9; }
.ts-cat-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.ts-cat-ctrl { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.ts-cat-ctrl:hover { background: #2563eb; border-color: #2563eb; }
.ts-cat-divider {
  width: 1px;
  height: 18px;
  background: #e2e8f0;
  display: inline-block;
  margin: 0 2px;
}

/* ── 드래그 가능한 테이블 헤더 ── */
#case-thead th[draggable] {
  cursor: grab;
  user-select: none;
  transition: background .12s;
  white-space: nowrap;
}
#case-thead th[draggable]:active { cursor: grabbing; }
#case-thead th[draggable].drag-over {
  background: #eff6ff;
  color: #2563eb;
  border-bottom: 2px solid #2563eb;
}
#case-thead th[draggable].dragging { opacity: .4; }
