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

body {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: #0d0d0d;
  min-height: 100vh;
  padding: 24px;
  color: #e0e0e0;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid #222;
}

header h1 { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
#datetime { font-size: 12px; color: #555; }

/* ─── 상단 탭 네비게이션 ─── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid #222;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  background: none; border: none;
  color: #666; font-size: 14px; font-weight: 600;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
}
.tab-btn:hover { color: #ccc; }
.tab-btn.active {
  color: #F59E0B;
  border-bottom-color: #F59E0B;
}

/* 가로 스와이프 컨테이너 (CSS scroll-snap) */
.tab-scroller {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;            /* Firefox */
  -ms-overflow-style: none;          /* IE/Edge */
  overscroll-behavior-x: contain;
  width: 100%;
}
.tab-scroller::-webkit-scrollbar { display: none; }
.tab-panel {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding-right: 1px;   /* iOS Safari scroll-snap 안정화 */
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  background: #161616;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #222;
}

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

.card-title { display: flex; align-items: center; gap: 8px; }

.dot { width: 8px; height: 8px; border-radius: 50%; }

.card-title span { font-size: 13px; font-weight: 600; color: #ccc; }

.badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px; color: #fff; opacity: 0.85;
}

.task-list { list-style: none; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #1e1e1e;
}

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

.task-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #666;
  width: 14px; height: 14px;
  flex-shrink: 0; cursor: pointer;
}

.task-content { flex: 1; min-width: 0; }

.task-text {
  font-size: 13px; color: #ddd; line-height: 1.4;
  word-break: keep-all;
}

.task-item.done .task-text { text-decoration: line-through; color: #444; }

.task-meta { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }

.tag {
  font-size: 10px; padding: 1px 6px;
  border-radius: 8px; background: #222; color: #777;
}

.tag.urgent { background: #2a1515; color: #e05050; }
.tag.date   { background: #151a2a; color: #5080e0; }
.tag.person { background: #1a1525; color: #9060d0; }

.btn-delete {
  flex-shrink: 0;
  background: none; border: none;
  color: #333; font-size: 14px;
  cursor: pointer; padding: 0 2px;
  line-height: 1; transition: color 0.15s;
}
.btn-delete:hover { color: #e05050; }

.empty-msg { font-size: 12px; color: #333; text-align: center; padding: 16px 0; }

/* ─── 부모-자식 묶음 (아코디언) ─── */
.task-item { position: relative; }
.task-item.is-child {
  padding-left: 28px;
  border-left: 2px solid #2a2a2a;
  margin-left: 4px;
}
.task-item.is-parent .task-text {
  font-weight: 600;
  color: #fff;
}
.toggle-btn {
  background: none; border: none;
  color: #888; font-size: 14px;
  cursor: pointer; padding: 4px 6px;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
}
.toggle-btn:hover { color: #ccc; }
.task-item.is-parent .task-content { cursor: pointer; }
.btn-group {
  flex-shrink: 0;
  background: none; border: none;
  color: #444; font-size: 13px;
  cursor: pointer; padding: 0 4px;
  line-height: 1; transition: color 0.15s;
}
.btn-group:hover { color: #F59E0B; }
.group-popup {
  position: absolute;
  right: 8px; top: 100%;
  margin-top: 2px;
  background: #1f1f1f;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px 0;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 10;
}
.group-popup-head {
  font-size: 11px; color: #777;
  padding: 6px 12px;
}
.group-popup-item {
  display: block; width: 100%;
  background: none; border: none;
  color: #ddd; font-size: 12px;
  padding: 8px 12px; text-align: left;
  cursor: pointer; font-family: inherit;
}
.group-popup-item:hover { background: #2a2a2a; color: #fff; }
.group-popup-item.current { color: #F59E0B; }

.cat-yeonnam .dot  { background: #FF6B35; }
.cat-yeonnam .badge{ background: #FF6B35; }
.cat-bangi .dot    { background: #3B82F6; }
.cat-bangi .badge  { background: #3B82F6; }
.cat-studio .dot   { background: #10B981; }
.cat-studio .badge { background: #10B981; }
.cat-ai .dot       { background: #8B5CF6; }
.cat-ai .badge     { background: #8B5CF6; }
.cat-personal .dot   { background: #EC4899; }
.cat-personal .badge { background: #EC4899; }

.room-ref {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #222;
}
.room-ref-title {
  font-size: 10px; color: #444; margin-bottom: 8px; letter-spacing: 0.3px;
}
.room-row {
  display: flex; gap: 6px; align-items: baseline;
  padding: 4px 0; border-bottom: 1px solid #1a1a1a;
  font-size: 11px;
}
.room-row:last-child { border-bottom: none; }
.room-num {
  color: #555; flex-shrink: 0; width: 32px; font-weight: 600;
}
.room-name { color: #888; flex-shrink: 0; width: 90px; }
.room-status { color: #444; flex: 1; }
.room-status.done { color: #10B981; }
.room-status.wip  { color: #F59E0B; }
.room-status.wait { color: #555; }

footer { margin-top: 20px; text-align: center; font-size: 11px; color: #333; }

/* ─── 월별 그리드 달력 (구글 캘린더 스냅샷) ─── */
.cal-card {
  background: #161616; border: 1px solid #222; border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.cal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.cal-title { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.cal-nav {
  background: #2a2a2a; border: none; color: #ccc; font-size: 20px;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  transition: background 0.1s;
}
.cal-nav:hover { background: #3a3a3a; color: #fff; }
.cal-weekdays, .cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-wd {
  text-align: center; font-size: 12px; font-weight: 600;
  color: #777; padding: 6px 0;
}
.cal-wd.sun { color: #e05050; }
.cal-wd.sat { color: #5080e0; }
.cal-cell {
  height: 76px; background: #1a1a1a; border-radius: 8px;
  padding: 6px; cursor: pointer; border: 1px solid transparent;
  transition: background 0.1s, border-color 0.15s;
  display: flex; flex-direction: column; overflow: hidden;
}
.cal-cell:hover { background: #222; }
.cal-cell.dim { opacity: 0.3; }
.cal-cell.today { border-color: #F59E0B; background: #1f1a10; }
.cal-cell.today .cal-date { color: #F59E0B; font-weight: 700; }
.cal-cell.selected { border-color: #5080e0; background: #11182a; }
.cal-date { font-size: 14px; font-weight: 600; color: #ccc; margin-bottom: 3px; }
.cal-date.sun { color: #e05050; }
.cal-date.sat { color: #5080e0; }
.cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-ev {
  font-size: 10px; padding: 1px 4px; line-height: 1.3;
  background: #2a2515; color: #F59E0B; border-radius: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev-more { font-size: 9px; color: #888; padding: 1px 4px; }
.cal-day-detail {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid #222;
  display: none;
}
.cal-day-detail.visible { display: block; }
.cal-detail-head {
  font-size: 14px; color: #F59E0B; font-weight: 700; margin-bottom: 10px;
}
.cal-detail-empty { font-size: 12px; color: #555; }
.cal-detail-item {
  display: flex; gap: 12px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid #1a1a1a;
}
.cal-detail-item:last-child { border-bottom: none; }
.cal-detail-time {
  font-size: 12px; color: #F59E0B; width: 54px; flex-shrink: 0;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal-detail-title { font-size: 14px; color: #e0e0e0; flex: 1; word-break: keep-all; }
.cal-status { font-size: 11px; color: #444; text-align: right; margin-top: 8px; }

/* ─── 이번 주 패널 (세로 리스트, 핵심만 크게) ─── */
.week-card {
  background: #161616; border: 1px solid #222; border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.week-title {
  font-size: 16px; font-weight: 700; color: #fff;
  margin-bottom: 14px; letter-spacing: -0.3px;
}
.week-day-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid #1e1e1e;
  min-height: 44px;
}
.week-day-row:last-child { border-bottom: none; }
.week-day-row.today {
  background: #1f1a10; border-radius: 10px;
  border-bottom: 1px solid transparent;
  margin: 2px -10px; padding: 12px 10px;
}
.week-day-label {
  flex-shrink: 0; width: 56px;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 2px;
}
.week-day-wd { font-size: 11px; color: #777; font-weight: 600; }
.week-day-wd.sun { color: #e05050; }
.week-day-wd.sat { color: #5080e0; }
.week-day-date {
  font-size: 20px; font-weight: 700; color: #ccc;
  line-height: 1.2; margin-top: 2px;
}
.week-day-row.today .week-day-wd  { color: #F59E0B; }
.week-day-row.today .week-day-date { color: #F59E0B; }
.week-events {
  flex: 1; display: flex; flex-direction: column; gap: 5px;
  padding-top: 3px; min-width: 0;
}
.week-ev { display: flex; gap: 10px; align-items: baseline; }
.week-ev-time {
  font-size: 11px; color: #F59E0B; width: 42px; flex-shrink: 0;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.week-ev-title {
  flex: 1; color: #e0e0e0; font-size: 14px; line-height: 1.35;
  word-break: keep-all;
}
.week-ev-empty { font-size: 13px; color: #3a3a3a; }

/* ─── 메모 카드 (돼지명가 공통 / 연남점 / 방이점) ─── */
.notes-card {
  background: #161616; border: 1px solid #222; border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.notes-title {
  font-size: 16px; font-weight: 700; color: #fff;
  margin-bottom: 14px; letter-spacing: -0.3px;
}
.notes-section { margin-bottom: 14px; }
.notes-section:last-child { margin-bottom: 0; }
.notes-section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.notes-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.notes-section-label {
  font-size: 13px; font-weight: 600; color: #ccc;
}
.notes-saved {
  margin-left: auto; font-size: 10px; color: #555;
  font-variant-numeric: tabular-nums;
}
.notes-textarea {
  width: 100%; min-height: 128px; resize: vertical;
  background: #0d0d0d; border: 1px solid #222; border-radius: 8px;
  padding: 10px 12px; color: #e0e0e0; font-size: 13px; line-height: 1.5;
  font-family: inherit;
  transition: border-color 0.15s;
}
.notes-textarea:focus {
  outline: none; border-color: #444;
}
.notes-textarea::placeholder { color: #3a3a3a; }
.notes-section.notes-common .notes-dot { background: #C9A36B; }
.notes-section.notes-common .notes-textarea:focus { border-color: #C9A36B; }
.notes-section.notes-yeonnam .notes-dot { background: #FF6B35; }
.notes-section.notes-yeonnam .notes-textarea:focus { border-color: #FF6B35; }
.notes-section.notes-bangi .notes-dot { background: #3B82F6; }
.notes-section.notes-bangi .notes-textarea:focus { border-color: #3B82F6; }
.notes-section.notes-studio .notes-dot { background: #10B981; }
.notes-section.notes-studio .notes-textarea:focus { border-color: #10B981; }
.notes-section.notes-ai .notes-dot { background: #8B5CF6; }
.notes-section.notes-ai .notes-textarea:focus { border-color: #8B5CF6; }
.notes-section.notes-personal .notes-dot { background: #EC4899; }
.notes-section.notes-personal .notes-textarea:focus { border-color: #EC4899; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  body { padding: 16px; }
  .cal-cell { height: 62px; padding: 4px; }
  .cal-date { font-size: 13px; }
  .cal-ev { font-size: 9px; padding: 1px 3px; }
  .cal-title { font-size: 16px; }
  .cal-detail-title { font-size: 13px; }
}
