/* =========================================================
   메모로그 V2 CSS — 최종본
   - 달력: V1 방식 (날짜 좌상단, 개수 우하단 뱃지)
   - 강조색: #fe4d71 (북로그 핑크)
   - PICK: 왼쪽 세로탭 #fe4d71
   - 설정 모달: 라디오버튼 강제 표시
   - textarea: 리갈노트
   - 툴바: 한 줄
   ========================================================= */

:root {
  --ml-text:      var(--text,  #0F172A);
  --ml-muted:     var(--muted, #6B7280);
  --ml-panel:     var(--panel, #FFFFFF);
  --ml-border:    var(--line,  #E5E7EB);
  --ml-brand:     var(--brand, #635BFF);  /* 원래 보라색 복원 */
  --ml-brand-lt:  #EEF2FF;
  --ml-brand-dk:  #4f48e0;
  --ml-pick:      #fe4d71;          /* PICK 전용 핑크 */
  --ml-pick-lt:   #fff0f3;
  --ml-shadow:    0 2px 12px rgba(17,24,39,.06);
  --ml-shadow-lg: 0 8px 32px rgba(17,24,39,.12);
  --ml-radius:    16px;
  --ml-radius-sm: 10px;
  --ml-note-bg:   #fff9c4;
  --ml-note-line: #e0e0e0;
  --ml-note-red:  #ff8a80;
}

*, *::before, *::after { box-sizing: border-box; }
.ml-body { color: var(--ml-text); line-height: 1.6; }
.ml-wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }

/* ===== 공지 배너 ===== */
.ml-notices { display: grid; gap: 10px; margin-bottom: 20px; }
.ml-notices[data-count="1"] { grid-template-columns: 1fr; }
.ml-notices[data-count="2"] { grid-template-columns: 1fr 1fr; }
.ml-notices[data-count="3"] { grid-template-columns: 1fr 1fr 1fr; }
.ml-notice-item {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 14px 20px; border-radius: var(--ml-radius-sm);
  font-size: 14px; font-weight: 600; text-align: center;
  cursor: default; transition: filter .15s, transform .15s; word-break: keep-all;
}
.ml-notice-item.is-link { cursor: pointer; }
.ml-notice-item.is-link:hover { filter: brightness(.93); transform: translateY(-1px); }

/* ===== 메인 그리드 1:2 ===== */
.ml-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 1024px) {
  .ml-grid { grid-template-columns: 1fr 2fr; align-items: stretch; }
}

/* ===== 카드 공통 ===== */
.ml-card {
  background: var(--ml-panel); border: 1px solid var(--ml-border);
  border-radius: var(--ml-radius); padding: 20px; box-shadow: var(--ml-shadow);
}
.ml-cal-col  { display: flex; flex-direction: column; }
.ml-cal-col .ml-card  { flex: 1; }
.ml-write-col { display: flex; flex-direction: column; }
.ml-write-col .ml-card { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }

/* =============================================================
   달력 — V1 스타일 완전 복원
   ★ 날짜 숫자: 좌상단 (position:absolute top/left)
   ★ 개수 배지: 우하단 (position:absolute right/bottom)
   ★ 헤더: 중앙 정렬 (년/월 크게)
   ============================================================= */

.ml-cal-header { margin-bottom: 12px; text-align: center; }

/* 년/월 크게 */
.ml-cal-title {
  display: block;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ml-text);
}
.ml-cal-stats {
  display: block;
  font-size: 13px;
  color: var(--ml-muted);
  margin-bottom: 10px;
}
.ml-cal-stats strong { color: var(--ml-brand); font-weight: 700; }

.ml-cal-today-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px; margin-bottom: 8px;
  border-top: 1px solid var(--ml-border); padding-top: 10px;
}
.ml-cal-today  { font-size: 13px; color: var(--ml-muted); }
.ml-cal-actions { display: flex; gap: 4px; }

/* 요일 헤더 */
.ml-weekhead {
  display: grid; grid-template-columns: repeat(7,1fr);
  text-align: center; font-size: 14px; font-weight: 600;
  color: var(--ml-muted); margin: 8px 0;
}
.ml-weekhead .is-sun { color: #fe4d71; }
.ml-weekhead .is-sat { color: #3B82F6; }

/* 날짜 그리드 */
.ml-cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr);
  gap: 6px;
}
@media (min-width: 640px) { .ml-cal-grid { gap: 8px; } }

/* 날짜 셀 — V1 방식 */
.ml-day {
  position: relative;
  aspect-ratio: 1/1;
  border: 1px solid var(--ml-border);
  border-radius: 12px;
  background: var(--ml-panel);
  /* flexbox는 배지 중앙 배치용이 아닌 컨테이너용 */
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: pointer;
  transition: background .1s, border-color .1s;
  padding: 0;
  overflow: hidden;
}
.ml-day:hover { background: #F9FAFB; }

/* 날짜 숫자 — 좌상단 (V1 방식) */
.ml-day-num {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  line-height: 1;
  z-index: 1;
}

/* 이전달·다음달 */
.ml-day.out { background: #F3F4F6; border-color: #EBEDF0; cursor: default; }
.ml-day.out:hover { background: #F3F4F6; }
.ml-day.out .ml-day-num { color: #9CA3AF; }

/* 요일 색상 */
.ml-day.is-sun .ml-day-num { color: #fe4d71; }
.ml-day.is-sat .ml-day-num { color: #3B82F6; }
.ml-day.out.is-sun .ml-day-num,
.ml-day.out.is-sat .ml-day-num { color: #C8CAD0; }

/* 오늘 */
.ml-day.is-today { border-color: var(--ml-brand); border-width: 2px; }
.ml-day.is-today .ml-day-num { color: var(--ml-brand); font-weight: 700; }

/* 선택일 */
.ml-day.is-selected { outline: 2px solid var(--ml-brand); outline-offset: 0; }
.ml-day.is-selected .ml-day-num { color: var(--ml-brand); font-weight: 700; }

/* 개수 배지 — 우하단 (V1 방식) */
.ml-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: #fe4d71;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  z-index: 2;
}

/* ===== 버튼 ===== */
.ml-btn {
  border: 1px solid var(--ml-border); background: var(--ml-panel);
  border-radius: 10px; padding: 7px 11px; font-size: 13px;
  cursor: pointer; transition: .12s; line-height: 1;
}
.ml-btn:hover  { background: #F3F4F6; }
.ml-btn:active { transform: scale(.97); }
.ml-btn-primary { background: var(--ml-brand); color: #fff; border-color: var(--ml-brand); font-weight: 600; }
.ml-btn-primary:hover { background: var(--ml-brand-dk); }

/* ===== 글쓰기 탭 ===== */
.ml-write-tabs {
  display: flex; gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: #F3F4F6;
  border-radius: var(--ml-radius-sm);
}
.ml-write-tab {
  flex: 1;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  border: none; background: transparent; cursor: pointer;
  color: var(--ml-muted); border-radius: 7px;
  transition: background .15s, color .15s, box-shadow .15s;
  text-align: center;
}
.ml-write-tab:hover:not(.active) {
  background: #E5E7EB;
  color: var(--ml-text);
}
.ml-write-tab.active {
  background: #fff;
  color: var(--ml-brand);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  font-weight: 700;
}
.ml-write-panel { width: 100%; }

/* ===== infobar ===== */
.ml-infobar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--ml-border);
}
.ml-infobar-stats { display: flex; gap: 8px; }
.ml-stat-box {
  display: flex; flex-direction: column; align-items: center;
  background: var(--ml-brand-lt); border-radius: var(--ml-radius-sm); padding: 6px 14px;
}
.ml-stat-label { font-size: 10px; color: var(--ml-muted); font-weight: 500; }
.ml-stat-value { font-size: 16px; font-weight: 800; color: var(--ml-brand); line-height: 1.3; }
.ml-stat-value.accent { color: var(--ml-brand); }
.ml-infobar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ml-infobar-user  { font-size: 12px; color: var(--ml-muted); }


/* ===== Today's Inspiration 헤더 (이미지 참고) ===== */
.ml-inspiration-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ml-border);
}
.ml-inspiration-left { flex: 1; min-width: 0; }
.ml-inspiration-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ml-text);
  margin-bottom: 4px;
  letter-spacing: -.01em;
}
.ml-inspiration-text {
  font-size: 13px;
  color: var(--ml-muted);
  line-height: 1.5;
  min-height: 18px;
}
/* 설정 버튼: 이미지처럼 원형 아이콘 */
.ml-settings-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ml-brand-lt);
  border: none;
  cursor: pointer;
  color: var(--ml-brand);
  transition: .15s;
  flex-shrink: 0;
}
.ml-settings-btn:hover { background: var(--ml-brand); color: #fff; }

/* ===== 수정 배너 ===== */
.ml-edit-banner {
  display: none; align-items: center; gap: 8px;
  background: var(--ml-pick-lt); border: 1.5px solid var(--ml-pick);
  border-radius: var(--ml-radius-sm); padding: 8px 14px;
  font-size: 13px; color: var(--ml-pick); font-weight: 600; margin-bottom: 10px;
}
.ml-edit-banner.show { display: flex; }
.ml-edit-cancel-btn {
  margin-left: auto; cursor: pointer; font-weight: 400;
  color: var(--ml-muted); font-size: 12px; border: none; background: none;
}
.ml-edit-cancel-btn:hover { color: var(--ml-pick); }

/* ===== 명언 ===== */
.ml-inspiration { font-size: 12px; color: var(--ml-muted); margin-bottom: 12px; min-height: 18px; line-height: 1.5; }

/* ===== 기분 ===== */
.ml-moods { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ml-mood-btn {
  border: 1.5px solid var(--ml-border); background: var(--ml-panel);
  border-radius: 20px; padding: 5px 12px; font-size: 13px;
  cursor: pointer; transition: .12s; user-select: none;
}
.ml-mood-btn:hover  { border-color: var(--ml-brand); background: var(--ml-brand-lt); }
.ml-mood-btn.active { border-color: var(--ml-brand); background: var(--ml-brand-lt); color: var(--ml-brand); font-weight: 600; }
.ml-mood-btn.is-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ===== textarea 리갈노트 ===== */
.ml-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ml-textarea {
  width: 100%;
  background-color: var(--ml-note-bg);
  /*
   * 리갈노트 배경:
   * - 빨간 세로선: 좌측 20~22px (border 1px 포함 시 시각적으로 ~18~20px)
   * - 가로 줄: font-size 15px × line-height 26px 간격으로 정확히 일치
   * - background-position-y: padding-top 8px에서 줄이 시작하도록
   */
  background-image:
    linear-gradient(90deg, transparent 37px, var(--ml-note-red) 37px, var(--ml-note-red) 39px, transparent 39px),
    linear-gradient(var(--ml-note-line) 1px, transparent 1px);
  background-position: 0 0, 0 1.1em;  /* 북로그와 동일 — 첫 줄 위치 맞춤 */
  background-size: 100% 100%, 100% 1.5em;  /* line-height와 동일 단위 */
  padding: 20px 20px 20px 50px !important;  /* 빨간선(39px) 오른쪽 11px에서 텍스트 시작 */
  font-size: 15px;
  line-height: 1.5em;            /* 북로그와 동일 — em 단위로 배경과 자동 일치 */
  border: 1px solid #e0e0e0; border-radius: var(--ml-radius-sm);
  resize: vertical; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.ml-textarea:focus   { outline: none; border-color: var(--ml-brand); box-shadow: 0 0 0 3px rgba(254,77,113,.1); }
/* .ml-textarea.locked 제거 — 권한없음은 .ml-textarea-locked div로 처리 */
.ml-textarea.editing { border-color: var(--ml-pick) !important; background-color: var(--ml-pick-lt); box-shadow: 0 0 0 3px rgba(254,77,113,.12) !important; }
.ml-char-count { font-size: 11px; color: var(--ml-muted); text-align: right; margin-top: 4px; }

/* 권한없음: 리갈패드 div (textarea 대신) */
.ml-textarea-locked {
  width: 100%;
  background-color: var(--ml-note-bg);
  background-image:
    linear-gradient(90deg, transparent 37px, var(--ml-note-red) 37px, var(--ml-note-red) 39px, transparent 39px),
    linear-gradient(var(--ml-note-line) 1px, transparent 1px);
  background-position: 0 0, 0 1.1em;
  background-size: 100% 100%, 100% 1.5em;
  border: 1px solid #e0e0e0;
  border-radius: var(--ml-radius-sm);
  padding: 16px 16px 16px 48px;
  line-height: 1.6em;
  height: auto;   /* 내용에 맞게 자동 확장 */
}
.ml-preview-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 140px;
  font-size: 14px; color: var(--ml-muted); font-weight: 500;
}

/* 차트 영역 */
.ml-chart-area {
  padding: 14px 16px 14px 48px !important;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ml-chart-stats {
  font-size: 13px; color: var(--ml-muted);
  margin-bottom: 14px; font-weight: 500;
}
.ml-chart-stats strong { color: var(--ml-brand); font-weight: 700; }

.ml-chart-section { margin-bottom: 16px; }
.ml-chart-section:last-child { margin-bottom: 0; }

.ml-chart-label {
  font-size: 12px; font-weight: 600; color: var(--ml-muted);
  margin-bottom: 8px; letter-spacing: .01em;
}

/* 막대그래프 SVG */
.ml-bar-svg { display: block; width: 100%; overflow: visible; }

/* 히트맵 SVG */
.ml-heat-svg { display: block; width: 100%; }

/* 히트맵 요일 레이블 */
.ml-heat-days {
  display: flex; flex-direction: column;
  position: absolute; left: 0; top: 0;
}
/* 요일: 히트맵 옆이 아닌 아래에 간단히 */
.ml-heat-days {
  display: flex; flex-direction: row; justify-content: space-around;
  font-size: 10px; color: #9CA3AF; margin-top: 4px;
  position: static;
}
.ml-heat-days span { flex: 1; text-align: center; }
/* 미리보기 목록 */
.ml-preview-list  { display: flex; flex-direction: column; gap: 0; width: 100%; }
.ml-preview-item  {
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.ml-preview-item:last-child { border-bottom: none; padding-bottom: 0; }
/* 메타 행: 아바타 + 닉네임/날짜 */
.ml-preview-meta  { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ml-preview-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: #fff; border: 1px solid #eee;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 20px;
}
.ml-preview-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ml-preview-info  { display: flex; flex-direction: row; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.ml-preview-nick  { font-size: 14px; font-weight: 700; color: var(--ml-text); white-space: nowrap; }
.ml-preview-date  { font-size: 11px; color: var(--ml-muted); white-space: nowrap; }
/* 본문 */
.ml-preview-content {
  font-size: 14px; color: var(--ml-text); line-height: 1.6em;
  white-space: pre-wrap; word-break: break-word;
}
/* 통계 */
.ml-preview-stats {
  font-size: 12px; color: var(--ml-muted); margin-top: 4px;
}
.ml-preview-stats strong { color: var(--ml-brand); font-weight: 700; }

/* ===== 글쓰기 하단 ===== */
.ml-write-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ml-secret-toggle {
  display: flex; align-items: center; gap: 5px; font-size: 13px;
  color: var(--ml-muted); cursor: pointer; user-select: none;
  padding: 6px 10px; border: 1.5px solid var(--ml-border); border-radius: 8px; transition: .12s;
}
.ml-secret-toggle:hover { border-color: #94A3B8; }
.ml-secret-toggle.active { border-color: var(--ml-pick); background: var(--ml-pick-lt); color: var(--ml-pick); }
.ml-secret-toggle input { display: none; }
.ml-submit {
  flex: 1; min-width: 100px; padding: 11px 20px;
  background: var(--ml-brand); color: #fff; border: none;
  border-radius: 9px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
}
.ml-submit:hover   { background: var(--ml-brand-dk); }
.ml-submit.disabled { background: #9CA3AF; cursor: not-allowed; }

/* ===== 검색+툴바 한 줄 ===== */
.ml-search-toolbar {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ml-border);
  flex-wrap: nowrap; overflow-x: auto;
}
.ml-search-input {
  flex: 1; min-width: 80px; padding: 7px 12px; font-size: 13px;
  border: 1.5px solid var(--ml-border); border-radius: 20px;
  outline: none; transition: border-color .15s; background: var(--ml-panel);
}
.ml-search-input:focus { border-color: var(--ml-brand); }
.ml-search-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--ml-border); background: var(--ml-panel);
  cursor: pointer; font-size: 14px; display: flex;
  align-items: center; justify-content: center; transition: .12s; flex-shrink: 0;
}
.ml-search-btn:hover { background: var(--ml-brand-lt); border-color: var(--ml-brand); }
.ml-tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  padding: 7px 10px; border-radius: var(--ml-radius-sm);
  border: 1.5px solid var(--ml-border); background: var(--ml-panel);
  font-size: 12px; font-weight: 500; cursor: pointer;
  text-decoration: none; color: var(--ml-text); transition: .15s;
  white-space: nowrap; flex-shrink: 0;
}
.ml-tool-btn:hover { background: #F3F4F6; border-color: #94A3B8; color: var(--ml-text); }
.ml-tool-btns { display: none; }

/* ===== 목록 헤더 ===== */
.ml-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.ml-list-title  { font-size: 15px; font-weight: 700; margin: 0; }
.ml-list-actions { display: flex; gap: 6px; align-items: center; }
.ml-list-btn {
  font-size: 12px; padding: 5px 12px; border-radius: 16px;
  border: 1px solid var(--ml-border); background: var(--ml-panel);
  cursor: pointer; color: var(--ml-muted); transition: .12s;
}
.ml-list-btn:hover          { background: #F3F4F6; color: var(--ml-text); }
.ml-list-btn.active         { background: var(--ml-brand); color: #fff; border-color: var(--ml-brand); }
.ml-list-btn.search-active  { background: var(--ml-pick-lt); color: var(--ml-pick); border-color: var(--ml-pick); }

/* ===== 페이징 ===== */
.ml-paging {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  padding: 6px 0;
  flex-wrap: wrap;
}
/* 버튼 공통 */
.ml-page-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: #F3F4F6;   /* 연한 회색 배경 */
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  transition: background .12s, color .12s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.ml-page-btn:hover:not(:disabled):not(.active) {
  background: #635BFF;
  color: #fff;
}
/* 현재 페이지 */
.ml-page-btn.active {
  background: #635BFF;
  color: #fff;
  font-weight: 700;
}
/* 비활성(첫/끝 페이지에서 «/» 등) */
.ml-page-btn:disabled:not(.active) {
  background: #FAFAFA;
  color: #C4C9D4;
  cursor: default;
}
/* 화살표 버튼 */
.ml-page-btn.arrow { font-size: 15px; font-weight: 400; }
/* Total N / M page */
.ml-page-info {
  font-size: 12px;
  color: var(--ml-muted);
  margin-left: 8px;
  white-space: nowrap;
}

/* 날짜 필터 배너 */
.ml-date-filter-bar {
  display: none; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--ml-brand-lt);
  border-radius: var(--ml-radius-sm); margin-bottom: 12px;
  font-size: 13px; color: var(--ml-brand); font-weight: 600;
}
.ml-date-filter-bar.show { display: flex; }
.ml-date-filter-clear { margin-left: auto; cursor: pointer; font-weight: 400; color: var(--ml-muted); font-size: 12px; }
.ml-date-filter-clear:hover { color: var(--ml-brand); }

/* ===== 메이슨리 — flex 컬럼 방식 (더보기 시 위치 불변) ===== */
.ml-masonry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.ml-masonry-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* 컬럼 수 조정: 기본 1, 600px↑ 2, 960px↑ 3 */
.ml-masonry-col:nth-child(2),
.ml-masonry-col:nth-child(3) { display: none; }
@media (min-width: 600px) {
  .ml-masonry-col:nth-child(2) { display: flex; }
}
@media (min-width: 960px) {
  .ml-masonry-col:nth-child(3) { display: flex; }
}

/* =============================================================
   메모 카드 — 리갈노트
   PICK: 이미지3 왼쪽 세로탭 #fe4d71
   ============================================================= */
.ml-memo-card {
  width: 100%; display: block;
  padding: 19px 14px 22px 48px;
  background-color: var(--ml-note-bg);
  background-image:
    linear-gradient(90deg, transparent 37px, var(--ml-note-red) 37px, var(--ml-note-red) 39px, transparent 39px),
    linear-gradient(var(--ml-note-line) 1px, transparent 1px);
  background-position: 0 0, 0 1.1em;
  background-size: 100% 100%, 100% 1.6em;
  line-height: 1.6em;
  border: 1px solid #e0e0e0;
  border-radius: var(--ml-radius);
  box-shadow: var(--ml-shadow);
  transition: box-shadow .15s, transform .15s;
  position: relative;
  overflow: hidden;
}
.ml-memo-card:hover { box-shadow: var(--ml-shadow-lg); transform: translateY(-2px); }

/* PICK 카드: 좌상단 가로 뱃지 방식 (이미지 참고)
   - 카드: 브랜드 컬러 border
   - 좌상단: pick색 배경 + 가로 라벨 뱃지
*/
.ml-memo-card.is-pick {
  border: 2px solid var(--ml-brand);
}

/* PICK 세로 배지 — 북로그 방식: JS에서 .ml-pick-side div로 삽입 */
.ml-pick-side {
  position: absolute;
  left: 0;
  top: 14px;
  width: 34px;          /* 빨간선(37px) 바로 앞까지 */
  /* writing-mode로 자연스러운 세로 텍스트 */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  padding: 8px 2px;
  border-radius: 0 6px 6px 0;
  text-align: center;
  letter-spacing: .08em;
  max-height: 90px;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}

/* 비밀글 카드 */
.ml-memo-card.is-secret {
  background-color: #F5F5F5;
  background-image:
    linear-gradient(90deg, transparent 37px, #B0BEC5 37px, #B0BEC5 39px, transparent 39px),
    linear-gradient(#CFD8DC 1px, transparent 1px);
  border-color: #CFD8DC;
}
.ml-memo-card.is-secret-locked {
  min-height: 80px; padding: 20px; display: flex;
  align-items: center; justify-content: center;
  color: var(--ml-muted); font-size: 13px; gap: 8px;
  background-image: none; background-color: #F8FAFC; border-style: dashed;
  overflow: hidden;
}

/* 카드 내부 */
.ml-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ml-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #eee; font-size: 16px;
}
.ml-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ml-card-meta {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
}
.ml-card-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.ml-card-time {
  font-size: 11px; color: var(--ml-muted);
  white-space: nowrap; flex-shrink: 0; margin-left: auto;
}
.ml-card-badges { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.ml-badge-secret { font-size: 11px; padding: 2px 6px; border-radius: 8px; background: #F1F5F9; color: #64748B; }

.ml-card-body { font-size: 14px; line-height: 1.6em; white-space: pre-wrap; word-break: break-word; color: var(--ml-text); margin-top: 4px; margin-bottom:10px; }
/* clamped 제거됨 */

.ml-card-foot {
  display: flex; align-items: center; justify-content: flex-end;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,.07); gap: 4px;
}
.ml-card-btns { display: flex; gap: 4px; }
.ml-card-btn {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--ml-border); background: rgba(255,255,255,.8);
  cursor: pointer; color: var(--ml-muted); transition: .12s;
}
.ml-card-btn:hover     { background: #F3F4F6; color: var(--ml-text); }
.ml-card-btn.del:hover { background: #FEF2F2; color: #fe4d71; border-color: #FCA5A5; }
.ml-card-btn.pick-active { color: var(--ml-pick); border-color: var(--ml-pick); background: var(--ml-pick-lt); }

/* PICK 팝오버 */
.ml-pick-popover {
  display: none; position: absolute;
  bottom: 8px; right: 8px;
  background: #fff; border: 1px solid var(--ml-border);
  border-radius: var(--ml-radius-sm); padding: 12px;
  box-shadow: var(--ml-shadow-lg); z-index: 200; width: 230px;
}
.ml-pick-popover.show { display: block; }
.ml-pick-popover-label { font-size: 11px; color: var(--ml-muted); display: block; margin-bottom: 4px; }
.ml-pick-text-input {
  width: 100%; padding: 5px 8px; border: 1.5px solid var(--ml-border);
  border-radius: 6px; font-size: 12px; margin-bottom: 8px;
}
.ml-pick-text-input:focus { outline: none; border-color: var(--ml-brand); }
.ml-pick-color-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ml-pick-color-row span { font-size: 11px; color: var(--ml-muted); }
.ml-pick-color-swatch { width: 32px; height: 28px; padding: 2px; border-radius: 5px; border: 1px solid var(--ml-border); cursor: pointer; }
/* 미리보기: 세로탭 모양 */
.ml-pick-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  border-left: 5px solid var(--ml-pick);
  background: var(--ml-pick-lt);
  font-size: 12px; font-weight: 700;
  margin-bottom: 10px;
  color: var(--ml-pick);
}
.ml-pick-popover-btns { display: flex; gap: 6px; }
.ml-pick-popover-btns button {
  flex: 1; padding: 6px; border-radius: 6px;
  border: 1px solid var(--ml-border); font-size: 12px; cursor: pointer; background: #fff;
}
.ml-pick-save-btn   { background: var(--ml-pick) !important; color: #fff !important; border-color: var(--ml-pick) !important; }
.ml-pick-remove-btn { color: #fe4d71; }
.ml-pick-cancel-btn { color: var(--ml-muted); }

/* 시간 수정 */
.ml-time-edit { font-size: 12px; color: var(--ml-muted); background: none; border: none; padding: 0 2px; cursor: pointer; vertical-align: middle; }
.ml-time-edit:hover { color: var(--ml-brand); }

/* 더 보기 */
.ml-more-wrap { text-align: center; margin-top: 16px; }
.ml-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 32px;
  border: 2px solid #635BFF;
  border-radius: 24px;
  background: var(--ml-panel);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
  color: #635BFF;
}
.ml-more-btn:hover {
  background: #635BFF;
  color: #fff;
}
.ml-more-btn::before { content: '↓'; font-size: 16px; font-weight: 700; }

/* 빈 목록 */
.ml-empty { text-align: center; padding: 48px 20px; color: var(--ml-muted); font-size: 14px; }
.ml-empty-icon { font-size: 36px; margin-bottom: 12px; }

/* =============================================================
   설정 모달 — 라디오버튼 완전 강제 표시
   그누보드가 input[type=radio] { display:none } 을 덮어씌우는
   경우를 대비해 모든 관련 요소에 !important 적용
   ============================================================= */
.ml-modal-bg {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,.65) !important;
  z-index: 999999 !important;
  align-items: center;
  justify-content: center;
}
.ml-modal-bg.show { display: flex !important; }

.ml-modal {
  background: #fff !important;
  border-radius: var(--ml-radius) !important;
  width: 92% !important;
  max-width: 640px !important;
  max-height: 88vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.25) !important;
  position: relative !important;
  z-index: 1000000 !important;
}

.ml-modal-head {
  display: flex !important; align-items: center !important;
  padding: 16px 20px !important; border-bottom: 1px solid var(--ml-border) !important;
  flex-shrink: 0 !important; background: #fff !important;
}
.ml-modal-head h3 { margin: 0 !important; font-size: 16px !important; flex: 1 !important; }
.ml-modal-close {
  width: 28px !important; height: 28px !important;
  border: none !important; background: none !important; cursor: pointer !important;
  color: var(--ml-muted) !important; font-size: 18px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  border-radius: 6px !important; z-index: 1000001 !important; position: relative !important;
}
.ml-modal-close:hover { background: #F3F4F6 !important; }

.ml-modal-tabs {
  display: flex !important;
  border-bottom: 1px solid var(--ml-border) !important;
  flex-shrink: 0 !important;
  background: #fff !important;
}
.ml-tab {
  flex: 1 !important; padding: 11px 8px !important; font-size: 13px !important;
  font-weight: 500 !important; text-align: center !important;
  border: none !important; background: none !important; cursor: pointer !important;
  color: var(--ml-muted) !important; border-bottom: 2px solid transparent !important;
  transition: .12s !important; position: relative !important; z-index: 1000001 !important;
}
.ml-tab.active { color: var(--ml-brand) !important; border-bottom-color: var(--ml-brand) !important; font-weight: 700 !important; }

.ml-modal-body {
  padding: 20px !important;
  overflow-y: auto !important;
  flex: 1 !important;
  background: #fff !important;
  position: relative !important;
  z-index: 1000001 !important;
}
.ml-modal-foot {
  padding: 14px 20px !important;
  border-top: 1px solid var(--ml-border) !important;
  text-align: right !important;
  flex-shrink: 0 !important;
  background: #fff !important;
  position: relative !important;
  z-index: 1000001 !important;
}

/* 설정 폼 필드 */
.ml-field { margin-bottom: 16px !important; position: relative !important; }
.ml-field > label {
  display: block !important;
  font-size: 13px !important; font-weight: 600 !important; margin-bottom: 6px !important;
  color: var(--ml-text) !important;
}
.ml-field input[type="number"],
.ml-field input[type="text"],
.ml-field select {
  display: block !important;
  width: 100% !important; padding: 8px 10px !important;
  border: 1.5px solid var(--ml-border) !important;
  border-radius: var(--ml-radius-sm) !important;
  font-size: 13px !important; background: #fff !important;
  appearance: auto !important; -webkit-appearance: auto !important;
  visibility: visible !important; opacity: 1 !important;
}
.ml-field input[type="number"]:focus,
.ml-field input[type="text"]:focus,
.ml-field select:focus { outline: none !important; border-color: var(--ml-brand) !important; }

/* ★★★ 라디오버튼 — 그누보드 덮어쓰기 완전 방지 ★★★ */
.ml-radio-group {
  display: flex !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}
.ml-radio-group label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  cursor: pointer !important;
  margin-bottom: 0 !important;
  user-select: none !important;
  position: relative !important;
}
/* 라디오버튼 자체: 모든 숨김 속성 해제 */
.ml-radio-group label input[type="radio"] {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  cursor: pointer !important;
  position: relative !important;
  z-index: 1000002 !important;
  flex-shrink: 0 !important;
  /* 브라우저 기본 라디오 스타일 강제 */
  appearance: radio !important;
  -webkit-appearance: radio !important;
  accent-color: var(--ml-brand) !important;
}
/* 라디오버튼 커스텀 스타일링 금지 (가상 요소 방지) */
.ml-radio-group label input[type="radio"]::before,
.ml-radio-group label input[type="radio"]::after { display: none !important; content: none !important; }

.ml-field-row { display: flex !important; gap: 12px !important; }
.ml-field-row .ml-field { flex: 1 !important; }
.ml-section-title {
  font-size: 11px !important; font-weight: 700 !important;
  text-transform: uppercase !important; color: var(--ml-muted) !important;
  letter-spacing: .05em !important; margin: 18px 0 10px !important;
  padding-bottom: 6px !important; border-bottom: 1px solid var(--ml-border) !important;
}

/* 공지 관리 */
.ml-notice-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ml-notice-row { border: 1px solid var(--ml-border); border-radius: var(--ml-radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ml-notice-row-head { display: flex; align-items: center; gap: 8px; }
.ml-notice-preview { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
.ml-color-pair { display: flex; gap: 6px; align-items: center; }
.ml-color-input { width: 36px !important; height: 32px !important; padding: 2px !important; border-radius: 6px !important; cursor: pointer; }
.ml-notice-add-btn {
  width: 100%; padding: 10px; border: 1.5px dashed var(--ml-border);
  border-radius: var(--ml-radius-sm); background: none; cursor: pointer;
  font-size: 13px; color: var(--ml-muted); transition: .12s;
}
.ml-notice-add-btn:hover { border-color: var(--ml-brand); color: var(--ml-brand); background: var(--ml-brand-lt); }

/* 날짜 선택 모달 */
.ml-datepicker-dlg {
  background: var(--ml-panel); border-radius: var(--ml-radius);
  padding: 24px; width: 90%; max-width: 340px; box-shadow: var(--ml-shadow-lg);
}
.ml-datepicker-dlg h3 { margin: 0 0 18px; font-size: 16px; text-align: center; }
.ml-datepicker-actions { display: flex; gap: 10px; margin-top: 18px; }
.ml-datepicker-actions .ml-btn { flex: 1; text-align: center; padding: 10px; }

/* ===== 반응형 ===== */
@media (max-width: 767px) {
  .ml-notices[data-count="2"],
  .ml-notices[data-count="3"] { grid-template-columns: 1fr; }
  .ml-masonry-col:nth-child(2),
  .ml-masonry-col:nth-child(3) { display: none !important; }
  .ml-write-col .ml-card { overflow-y: visible; display: block; }
  .ml-chart-area { flex: none !important; overflow-y: visible !important; min-height: 0 !important; }
  .ml-search-toolbar { flex-wrap: wrap; }
  .ml-textarea-locked { height: auto !important; overflow-y: visible !important; }
}
@media (max-width: 599px) {
  .ml-field-row { flex-direction: column !important; }
}
