/* ── 변수 & 리셋 ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Slate + Indigo 팔레트 */
  --bg:            #ffffff;
  --bg-page:       #f8fafc;   /* slate-50 */
  --bg-muted:      #f1f5f9;   /* slate-100 */
  --bg-row:        #f8fafc;

  --text-1:        #0f172a;   /* slate-900 */
  --text-2:        #475569;   /* slate-600 */
  --text-3:        #94a3b8;   /* slate-400 */

  --border:        #e2e8f0;   /* slate-200 */
  --border-md:     #cbd5e1;   /* slate-300 */

  /* 민코딩 primary */
  --blue:          #409EFF;
  --blue-hover:    #2E8FEB;
  --blue-light:    #ECF5FF;
  --blue-border:   #A0CFFF;

  /* Emerald success */
  --green:         #059669;   /* emerald-600 */
  --green-light:   #ecfdf5;   /* emerald-50 */
  --green-border:  #a7f3d0;   /* emerald-200 */

  /* Rose danger */
  --red:           #e11d48;   /* rose-600 */
  --red-light:     #fff1f2;   /* rose-50 */
  --red-border:    #fda4af;   /* rose-300 */

  --orange:        #d97706;   /* amber-600 */

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:        0 4px 16px rgba(15,23,42,.08), 0 1px 4px rgba(15,23,42,.04);
  --shadow-lg:     0 10px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.06);
}

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Apple SD Gothic Neo', 'Malgun Gothic', -apple-system,
               BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── 헤더 ────────────────────────────────────────────────────────────────────── */
header {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.4px;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.logo-icon {
  width: 26px;
  height: 26px;
  background: var(--blue);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

/* ── 레이아웃 ─────────────────────────────────────────────────────────────────── */
main { padding: 2rem; }
.container { max-width: 1280px; margin: 0 auto; }

/* ── 페이지 박스 ─────────────────────────────────────────────────────────────── */
.page-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}

/* ── 페이지 헤더 ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: .75rem;
}

/* 체크리스트 sticky 헤더 */
.checklist-sticky-header {
  position: sticky;
  top: 56px;
  z-index: 40;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: -2rem -2.25rem 1.75rem;
  padding: 1.1rem 2.25rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.3px;
}

.header-left  { display: flex; flex-direction: column; gap: .4rem; }
.header-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; flex-wrap: wrap; }

.back-link {
  font-size: .78rem;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  transition: color .15s;
  font-weight: 500;
}
.back-link svg { width: .9em; height: .9em; flex-shrink: 0; }
.back-link:hover { color: var(--blue); }

.title-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}

.sub-text { font-size: .8rem; color: var(--text-3); margin-top: .05rem; }

/* ── 배지 ────────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .18rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .1px;
}
.badge-location {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}
.badge-readonly {
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fde68a;
}

/* ── 버튼 ────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .825rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: -.1px;
  line-height: 1;
}
.btn:active { transform: scale(.97); }

/* 아이콘 크기 — 1em 기반으로 폰트 크기에 자동 비례 */
.btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: block; /* inline gap 제거 */
}

/* 아이콘만 있는 버튼: 정사각형 패딩 */
.btn-icon { padding: .5rem; }
.btn-icon.btn-sm { padding: .4rem; }
.btn-icon.btn-xs { padding: .32rem; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 1px 3px rgba(64,158,255,.25);
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); box-shadow: 0 2px 6px rgba(64,158,255,.3); }

.btn-default {
  background: var(--bg);
  color: var(--text-1);
  border-color: var(--border-md);
  box-shadow: var(--shadow-sm);
}
.btn-default:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

.btn-danger {
  background: var(--bg);
  color: var(--red);
  border-color: var(--red-border);
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { background: var(--red-light); border-color: var(--red); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-1); }

.btn-sm { padding: .35rem .75rem; font-size: .775rem; }
.btn-xs { padding: .28rem .6rem;  font-size: .72rem; }

/* ── 리스트 테이블 (index 페이지) ────────────────────────────────────────────── */
.list-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.list-table thead tr {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}

.list-table th {
  padding: .8rem 1.1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.list-table th.text-center { text-align: center; }

.list-table td {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}
.list-table tr:last-child td { border-bottom: none; }
.list-table tbody tr { transition: background .12s; }
.list-table tbody tr:hover { background: #fafafa; }

.list-num { color: var(--text-3); font-size: .78rem; text-align: center; font-variant-numeric: tabular-nums; }

.list-title-link {
  font-weight: 600;
  color: var(--text-1);
  transition: color .15s;
  font-size: .875rem;
}
.list-title-link:hover { color: var(--blue); }

.list-desc { font-size: .78rem; color: var(--text-3); margin-left: .15rem; }
.list-location { color: var(--text-2); font-size: .8rem; }
.list-date     { color: var(--text-3); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 진행률 바 */
.progress-wrap { display: flex; align-items: center; gap: .6rem; }
.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  min-width: 60px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-bar-fill.full { background: var(--green); }
.progress-label { font-size: .73rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.action-btns { display: flex; gap: .35rem; justify-content: center; }

/* 빈 상태 */
.empty-state {
  padding: 5rem 2rem;
  text-align: center;
  color: var(--text-3);
}
.empty-icon { font-size: 2.75rem; margin-bottom: 1rem; opacity: .6; }
.empty-state p { font-size: .9rem; margin-bottom: 1.5rem; color: var(--text-2); }

/* ── 모달 ────────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
.modal.hidden { display: none; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp .18s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem 1rem;
}
.modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--text-1); letter-spacing: -.2px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-size: .9rem;
}
.modal-close:hover { background: var(--bg-muted); color: var(--text-1); }

.modal-body { padding: .75rem 1.5rem 1.25rem; }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: .4rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .2px;
}
.required { color: var(--red); }

.form-group input,
.form-group textarea {
  width: 100%;
  padding: .55rem .8rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-1);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64,158,255,.12);
}
.form-group textarea { resize: vertical; min-height: 72px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .9rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

/* ── 체크리스트 테이블 ────────────────────────────────────────────────────────── */
.checklist-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.checklist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.checklist-table thead tr {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}

.checklist-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.checklist-table th.text-center { text-align: center; }

.checklist-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: .875rem;
}

/* 카테고리 헤더 행 */
.category-row td {
  background: var(--blue-light);
  color: var(--blue);
  font-size: .7rem;
  font-weight: 700;
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--blue-border);
  letter-spacing: .4px;
  text-transform: uppercase;
}

.item-row { transition: background .1s; }
.item-row:last-child td { border-bottom: none; }
.item-row:hover { background: #fafafa; }
.item-row.row-yes { background: var(--green-light) !important; }
.item-row.row-no  { background: var(--red-light) !important; }

.col-num     { width: 56px; text-align: center; }
.col-item    { width: auto; }
.col-yes,
.col-no      { width: 84px; text-align: center; }
.col-note    { width: 26%; }
.col-actions { width: 160px; }

.text-center { text-align: center; }
.row-num-text { color: var(--text-3); font-size: .78rem; font-variant-numeric: tabular-nums; }

.item-link {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: opacity .15s;
  font-weight: 500;
}
.item-link:hover { opacity: .75; text-decoration: underline; }
.link-icon { font-size: .7rem; opacity: .7; }

.loading-row {
  padding: 3rem;
  text-align: center;
  color: var(--text-3);
  font-size: .875rem;
}
.empty-row {
  text-align: center;
  color: var(--text-3);
  padding: 3rem;
  font-size: .875rem;
}

/* ── 라디오 pill 버튼 ─────────────────────────────────────────────────────────── */
.radio-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.radio-label input[type="radio"] { display: none; }

.radio-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: .32rem .75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-md);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  white-space: nowrap;
  letter-spacing: .1px;
}

.radio-label:hover .radio-yes { border-color: var(--green); color: var(--green); background: var(--green-light); }
.radio-label:hover .radio-no  { border-color: var(--red);   color: var(--red);   background: var(--red-light); }

.radio-label input:checked + .radio-yes {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5,150,105,.22);
}
.radio-label input:checked + .radio-no {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(225,29,72,.22);
}
.radio-label input:disabled + .radio-pill {
  cursor: not-allowed;
  opacity: .45;
}

/* ── 인라인 편집 ──────────────────────────────────────────────────────────────── */
.inline-edit { display: flex; flex-direction: column; gap: .4rem; }
.inline-cat-combobox { flex: none; width: 100%; }
.inline-category { font-size: .75rem; color: var(--blue); }
.inline-name { font-weight: 600; }
.inline-link { font-size: .78rem; color: var(--text-2); }
.inline-edit-actions { display: flex; gap: .4rem; margin-top: .15rem; }

.item-row.editing { background: #fefce8 !important; }
.item-row.editing td { vertical-align: top; }

/* ── 비고 textarea ───────────────────────────────────────────────────────────── */
.note-input {
  width: 100%;
  min-height: 32px;
  height: 32px;
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-family: inherit;
  color: var(--text-1);
  resize: none;
  overflow-y: hidden;
  background: var(--bg);
  transition: border-color .15s, height .15s, box-shadow .15s;
  line-height: 1.5;
}
.note-input:focus {
  outline: none;
  border-color: var(--blue);
  height: 64px;
  overflow-y: auto;
  box-shadow: 0 0 0 3px rgba(64,158,255,.12);
}
.note-input:disabled { background: var(--bg-muted); color: var(--text-3); cursor: default; }

/* ── 읽기모드 테이블 ─────────────────────────────────────────────────────────── */
.col-result { width: 168px; }
.ro-row td  { padding: .9rem 1rem; vertical-align: middle; }
.ro-row .col-item { font-size: .9rem; line-height: 1.55; }
.ro-note { vertical-align: middle; }

.answer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  min-width: 64px;
  padding: .32rem .75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: .1px;
}
.badge-yes {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5,150,105,.22);
}
.badge-no {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(225,29,72,.22);
}
.badge-pending {
  background: var(--bg);
  border-color: var(--border-md);
  color: var(--text-3);
}

.note-text  { display: block; color: var(--text-2); font-size: .875rem; line-height: 1.6; white-space: pre-wrap; }
.note-empty { color: var(--text-3); font-size: .875rem; }

/* ── 카테고리 행 내부 (편집모드 이동 버튼) ─────────────────────────────────── */
.category-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-move-group {
  display: flex;
  gap: .2rem;
  flex-shrink: 0;
}

/* ── 액션 버튼 ───────────────────────────────────────────────────────────────── */
.action-cell {
  display: flex;
  flex-direction: row;
  gap: .35rem;
  align-items: center;
  justify-content: center;
}

/* move-group / 수정·삭제 사이 구분선 */
.act-sep {
  width: 1px;
  height: 18px;
  background: var(--border-md);
  flex-shrink: 0;
  margin: 0 .1rem;
}

.move-group {
  display: inline-flex;
  flex-direction: column;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.move-group .btn {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: .22rem .38rem;
  color: var(--text-3);
  background: var(--bg);
  line-height: 1;
}
.move-group .btn:hover { background: var(--bg-muted); color: var(--blue); }
.move-group .btn:first-child { border-bottom: 1px solid var(--border); }
.move-group .btn svg { width: .85em; height: .85em; }

.btn-edit-action {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border-md);
  box-shadow: var(--shadow-sm);
}
.btn-edit-action:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-light); }

.btn-del-action {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border-md);
  box-shadow: var(--shadow-sm);
}
.btn-del-action:hover { color: var(--red); border-color: var(--red); background: var(--red-light); }

/* ── 읽기/편집 모드 가시성 ─────────────────────────────────────── */
.page-readonly .edit-only { display: none !important; }
.page-edit .ro-only { display: none !important; }

/* ── 카테고리 관리 섹션 ─────────────────────────────────────────────────────── */
.cat-manage-section {
  margin-top: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cat-manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .85rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  gap: .5rem;
}
.cat-manage-header:hover { background: var(--bg-muted); }
.cat-toggle-icon {
  color: var(--text-3);
  transition: transform .2s;
  flex-shrink: 0;
}
.cat-manage-header[aria-expanded="true"] .cat-toggle-icon { transform: rotate(180deg); }
.cat-manage-body { padding: 0 1.5rem 1.25rem; }
.section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-3);
}
.cat-manage-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: .9rem;
  min-height: 4px;
}
.cat-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .85rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: opacity .2s;
}
.cat-manage-row-new { border-color: var(--blue-border); background: var(--blue-light); }
.cat-manage-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--blue);
  min-width: 0;
  flex: 1;
}
.cat-manage-name .cat-edit-input {
  font-size: .875rem;
  height: 28px;
  padding: .2rem .5rem;
  width: 100%;
  max-width: 320px;
}
.cat-manage-btns { display: flex; gap: .35rem; flex-shrink: 0; margin-left: .75rem; }
.cat-add-row { display: flex; gap: .5rem; }
.cat-add-row .form-input { flex: 1; }

/* ── 항목 추가 영역 ──────────────────────────────────────────────────────────── */
.add-item-section {
  margin-top: 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.add-item-section h3 {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: .9rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.add-item-row {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}

.form-input {
  flex: 1;
  min-width: 120px;
  padding: .5rem .8rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-1);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64,158,255,.12);
}
.form-input.input-error { border-color: var(--red); animation: shake .3s ease; }
.link-input { flex: 1.3; }

/* ── Combobox ────────────────────────────────────────────────────────────────── */
.combobox { position: relative; flex: 0.8; min-width: 130px; }
.add-item-row select.form-input { flex: 0.8; min-width: 130px; max-width: 200px; cursor: pointer; }

.combobox-trigger {
  position: relative;
  display: flex;
  align-items: center;
}

.combobox-input {
  flex: 1;
  padding-right: 2rem !important;
  cursor: text;
}

.combobox-arrow {
  position: absolute;
  right: .45rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .2rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
  font-size: .875rem;
}
.combobox-arrow:hover { color: var(--text-1); background: var(--bg-muted); }
.combobox-arrow svg { width: .9em; height: .9em; }

.combobox-list {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 120;
  max-height: 210px;
  overflow-y: auto;
  padding: .3rem;
  list-style: none;
}
.combobox-list.hidden { display: none; }

.cb-item {
  padding: .42rem .7rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  cursor: pointer;
  color: var(--text-1);
  transition: background .1s;
  white-space: nowrap;
}
.cb-item:hover,
.cb-item.active { background: var(--blue-light); color: var(--blue); }

.cb-empty {
  padding: .5rem .7rem;
  font-size: .8rem;
  color: var(--text-3);
  text-align: center;
}

.add-hint { margin-top: .55rem; font-size: .72rem; color: var(--text-3); }

/* ── 저장 상태 ──────────────────────────────────────────────────────────────── */
.save-status { font-size: .75rem; font-weight: 500; display: inline-flex; align-items: center; gap: .25rem; }
.save-status.saving { color: var(--orange); }
.save-status.saved  { color: var(--green); }
.save-status.error  { color: var(--red); }

/* ── 진행률 chip 그룹 ────────────────────────────────────────────────────────── */
.progress-chips {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.prog-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  border: 1px solid;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prog-chip svg { width: .85em; height: .85em; flex-shrink: 0; }

.chip-yes     { background: var(--green-light); color: var(--green); border-color: var(--green-border); }
.chip-no      { background: var(--red-light);   color: var(--red);   border-color: var(--red-border); }
.chip-pending { background: var(--bg-muted);    color: var(--text-3); border-color: var(--border); }

/* ── 애니메이션 ─────────────────────────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

/* ── 반응형 태블릿 (≤ 900px) ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .td-date, .td-status { display: none; }
  .col-note { width: 25%; }
}

/* ── 반응형 모바일 (≤ 767px) ────────────────────────────────────────────────── */
@media (max-width: 767px) {
  html { font-size: 14px; }
  main { padding: .875rem; }
  header { padding: 0 1rem; height: 52px; }

  .page-box { padding: 1.1rem 1rem; }

  .page-header { flex-direction: column; gap: .6rem; }
  .page-header h1 { font-size: 1.1rem; }
  .header-right { width: 100%; justify-content: space-between; flex-wrap: wrap; }

  .checklist-sticky-header {
    top: 52px;
    margin: -1.1rem -1rem 1.25rem;
    padding: .85rem 1rem;
    border-radius: 0;
  }

  /* 인덱스: 테이블 → 카드 */
  .list-table-wrap { border: none; background: transparent; box-shadow: none; }
  .list-table,
  .list-table thead,
  .list-table tbody { display: block; }
  .list-table thead { display: none; }

  .list-table tbody tr {
    display: block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .75rem;
    box-shadow: var(--shadow-sm);
  }
  .list-table tbody tr:last-child { margin-bottom: 0; }
  .list-table td { display: block; padding: 0; border: none; }

  .td-num { display: none; }
  .td-title { margin-bottom: .5rem; }
  .list-title-link { font-size: .95rem; }
  .list-desc { display: block; font-size: .75rem; margin-top: .15rem; }

  .td-location {
    display: inline-block;
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid var(--blue-border);
    border-radius: 20px;
    padding: .1rem .55rem;
    font-size: .7rem;
    font-weight: 600;
    margin-bottom: .55rem;
  }
  .td-location:empty { display: none; }

  .td-progress { margin-bottom: .55rem; }
  .td-progress .progress-chips { flex-wrap: wrap; }
  .td-date, .td-status { display: none; }
  .td-actions { margin-top: .25rem; }
  .action-btns { justify-content: flex-start; }

  /* 체크리스트: 테이블 → flex */
  .checklist-table-wrap {
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin: 0 -1rem 1.25rem;
  }

  .checklist-table,
  .checklist-table tbody { display: block; }
  .checklist-table thead { display: none; }

  .category-row { display: block; }
  .category-row td { display: block; padding: .45rem 1rem; }

  .item-row {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: .75rem 1rem .7rem;
    border-bottom: 1px solid var(--border);
    gap: .4rem 0;
  }

  .item-row td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box;
  }

  .col-num { display: none !important; }

  .col-item {
    flex: 0 0 100% !important;
    width: 100% !important;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.45;
  }

  .col-yes,
  .col-no {
    flex: 0 0 auto !important;
    width: auto !important;
    text-align: left !important;
    margin-right: .5rem;
  }

  .radio-pill { min-width: 62px; padding: .42rem .85rem; font-size: .85rem; }

  .col-note { flex: 0 0 100% !important; width: 100% !important; margin-top: .3rem; }
  .note-input { width: 100%; }

  .col-actions {
    flex: 0 0 100% !important;
    width: 100% !important;
    position: static !important;
    margin-top: .4rem;
  }
  .col-actions .action-cell { flex-direction: row; justify-content: flex-end; gap: .4rem; align-items: center; }

  .add-item-section {
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin: 0 -1rem;
    padding: 1rem;
  }
  .add-item-row { flex-direction: column; gap: .5rem; }
  .form-input, .link-input { width: 100%; flex: none; }
  .combobox { flex: none; width: 100%; }
  .add-item-row select.form-input { flex: none; width: 100%; max-width: 100%; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-content {
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpMobile .2s ease;
  }
  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .inline-edit-actions { flex-wrap: wrap; }
  .item-row.editing .col-item { padding-right: 0; }

  .progress-chips { gap: .25rem; }
  .prog-chip { padding: .2rem .5rem; font-size: .7rem; }
  .save-status { min-width: 0; }
  .btn { padding: .45rem .9rem; }
  .btn-sm { padding: .35rem .7rem; }
}
