/* 가이드: 매뉴얼·체크리스트·템플릿 (3단 + 복사 중심) */

.guide-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5100;
  flex-direction: column;
  background: #f0f2f6;
}

.guide-screen.open {
  display: flex;
}

.guide-topbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f2f6;
  color: #1e293b;
  border-bottom: 1px solid #e2e8f0;
}

.guide-topbar__title {
  font-weight: 700;
  font-size: 15px;
  margin-right: auto;
  color: #0f172a;
}

.guide-topbar .guide-search {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
}

.guide-topbar .guide-search::placeholder {
  color: #94a3b8;
}

.guide-topbar select.guide-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 13px;
}

.guide-topbar label.guide-fav-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.guide-topbar .icon-btn {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  padding: 5px 12px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.guide-topbar .icon-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.guide-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
}

.guide-tree-backdrop {
  display: none;
}

/* PC: 목록 열은 좁게 고정·상한, 상세 열이 나머지 폭 사용 */
.guide-main {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr);
  min-width: 0;
  min-height: 0;
}

.guide-tree {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow: auto;
  padding: 10px 8px;
}

.guide-tree__group {
  margin-bottom: 6px;
}

.guide-tree__parent {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-tree__parent:hover {
  background: #f1f5f9;
}

.guide-tree__parent.is-active {
  background: #e0f2fe;
  color: #0369a1;
}

.guide-tree__children {
  padding: 2px 0 6px 8px;
}

.guide-tree__leaf {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px 6px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.guide-tree__leaf:hover {
  background: #f8fafc;
}

.guide-tree__leaf.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.guide-list-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.guide-law {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}

.guide-law__search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.guide-law__input {
  flex: 1 1 160px;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  box-sizing: border-box;
}

.guide-law__input::placeholder {
  color: #94a3b8;
}

.guide-law__btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.guide-law__btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.guide-law__results {
  flex: 1;
  min-height: 80px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.guide-law__results-placeholder {
  margin: 0;
  text-align: center;
  padding: 8px 4px;
}

.guide-law__item {
  cursor: default;
}

.guide-law__body {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-law__article {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.guide-law__article-title {
  margin: 0 0 6px;
  font-size: 14px;
  color: #0f172a;
}

.guide-law__clauses {
  margin: 6px 0 0;
  padding-left: 16px;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

.guide-law__viewer {
  width: 100%;
  min-height: 56vh;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.guide-list-head {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
}

.guide-list {
  flex: 1;
  overflow: auto;
  padding: 8px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-card {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px 10px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.guide-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.guide-card.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.guide-card__title {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  padding-right: 28px;
}

.guide-card__meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-card__updated {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  text-align: right;
}

.guide-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.guide-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.guide-card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.guide-badge {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #fef3c7;
  color: #b45309;
  font-weight: 600;
}

.guide-detail {
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.guide-detail__mobbar {
  display: none;
}

.guide-detail__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.guide-detail__inner {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.guide-detail__head h2 {
  margin: 0 0 8px;
  font-size: 17px;
  color: #0f172a;
}

.guide-detail__desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.guide-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.guide-btn-copy {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.guide-btn-copy:hover {
  filter: brightness(1.05);
}

.guide-btn-copy:active {
  transform: scale(0.99);
}

.guide-btn-sec {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.guide-btn-sec:hover {
  background: #f8fafc;
}

.guide-btn-sec--danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.guide-detail__content {
  margin: 0;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #1e293b;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.guide-detail__empty {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
}

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 600px) {
  .guide-modal {
    align-items: center;
  }
}

.guide-modal.hidden {
  display: none !important;
}

.guide-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.guide-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 16px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

@media (min-width: 600px) {
  .guide-modal__panel {
    border-radius: 12px;
  }
}

.guide-modal__title {
  margin: 0 0 14px;
  font-size: 17px;
}

.guide-field {
  margin-bottom: 12px;
}

.guide-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
}

.guide-field input,
.guide-field select,
.guide-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.guide-field textarea {
  min-height: 120px;
  resize: vertical;
}

.guide-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.guide-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5300;
  padding: 10px 18px;
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.guide-toast.hidden {
  display: none;
}

body.guide-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  /* 모바일: 상단바·본문 버튼·본문 여백 컴팩트 */
  .guide-topbar {
    padding: 5px 8px;
    gap: 4px 6px;
  }

  .guide-topbar__title {
    font-size: 13px;
  }

  .guide-topbar .guide-search {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
    min-width: 96px;
  }

  .guide-topbar label.guide-fav-label {
    font-size: 11px;
    gap: 4px;
  }

  .guide-topbar .icon-btn {
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.15;
    border-radius: 5px;
  }

  .guide-list-head {
    padding: 5px 10px;
    font-size: 11px;
  }

  .guide-list {
    padding: 6px 8px 12px;
    gap: 6px;
  }

  .guide-card {
    padding: 8px 10px;
    border-radius: 8px;
  }

  .guide-card__title {
    font-size: 13px;
  }

  .guide-detail__inner {
    padding: 8px 10px;
  }

  .guide-detail__head h2 {
    font-size: 15px;
    margin: 0 0 4px;
  }

  .guide-detail__desc {
    font-size: 12px;
    margin: 0 0 6px;
    line-height: 1.4;
  }

  .guide-detail__actions {
    gap: 5px;
    margin-bottom: 8px;
  }

  .guide-btn-copy {
    flex: 0 0 auto;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 7px;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.28);
  }

  .guide-btn-sec {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 6px;
  }

  .guide-detail__content {
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.55;
    border-radius: 8px;
  }

  .guide-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
  }

  /* 좌측 분류 패널: 기본 숨김, 열릴 때만 배경 + 슬라이드 */
  .guide-tree-backdrop {
    display: none;
  }

  .guide-screen.guide-tree-open .guide-tree-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 5110;
    background: rgba(15, 23, 42, 0.45);
  }

  .guide-tree {
    position: fixed;
    left: 0;
    top: var(--guide-topbar-h, 56px);
    bottom: 0;
    width: min(88vw, 300px);
    max-width: 300px;
    z-index: 5111;
    border-right: 1px solid #e2e8f0;
    border-bottom: none;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    max-height: none;
  }

  .guide-screen.guide-tree-open .guide-tree {
    transform: translateX(0);
  }

  .guide-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .guide-list-wrap {
    flex: 1 1 44%;
    min-height: 0;
    border-right: none;
  }

  .guide-list {
    flex: 1;
    min-height: 0;
  }

  /* 미선택: 목록만 전체 높이 */
  .guide-screen:not(.guide-mobile-detail-open) .guide-detail {
    display: none;
  }

  .guide-screen:not(.guide-mobile-detail-open) .guide-list-wrap {
    flex: 1;
  }

  /* 항목 선택: 상세 전체화면 */
  .guide-detail__mobbar {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 5px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
  }

  .guide-detail__back {
    margin: 0;
    padding: 4px 4px 4px 0;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #1d4ed8;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .guide-screen.guide-mobile-detail-open .guide-list-wrap {
    display: none;
  }

  .guide-screen.guide-mobile-detail-open .guide-detail {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--guide-topbar-h, 56px);
    bottom: 0;
    z-index: 5103;
    flex: none;
    border-top: none;
    max-height: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}
