/* 공용 부품 — includes/ui.php 가 이 마크업을 만든다. 화면 이름(.home-…)을 넣지 않는다. 견본: /dev/components
   틀: saldeonjip components.css(토큰 이름 같음) — 이레솔루션 모양(둥근 정도·남색 위 변형)으로 바꿈. */

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h-md); padding: 0 var(--space-6);
  border: 1px solid transparent; border-radius: var(--r-full); cursor: pointer;
  font-size: var(--text-md); font-weight: var(--weight-bold); line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; transition: transform var(--dur) var(--ease); }
.btn:hover svg:last-child:not(:first-child) { transform: translateX(3px); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 20px -10px var(--primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-accent { background: var(--accent); color: var(--on-accent); }   /* 남색 바탕 위 주 동작 */
.btn-accent:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--primary-ink); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-ink); }
.btn-on-navy { background: transparent; color: var(--on-navy); border-color: rgba(255, 255, 255, .32); }
.btn-on-navy:hover { background: rgba(255, 255, 255, .08); color: var(--on-navy); border-color: rgba(255, 255, 255, .6); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { filter: brightness(.95); color: var(--on-danger); }
.btn-sm { min-height: var(--control-h-sm); padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn-lg { min-height: var(--control-h-lg); padding: 0 var(--space-7); font-size: var(--text-lg); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading svg { opacity: 0; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--on-primary); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--primary); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.icon-btn { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-full); background: transparent; color: inherit; cursor: pointer; transition: background var(--dur) var(--ease); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ── 입력 ── */
.field { display: grid; gap: var(--space-2); min-width: 0; }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--text); }
.field-label .req { color: var(--danger); margin-left: 2px; }
.field-label .opt { font-weight: var(--weight-normal); color: var(--text-3); margin-left: var(--space-1); }
.field-hint { font-size: var(--text-sm); color: var(--text-3); }
.field-error { font-size: var(--text-sm); color: var(--danger); font-weight: var(--weight-medium); }
.input, .textarea {
  width: 100%; min-height: var(--control-h-md); padding: 0 var(--space-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: var(--text-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { padding: var(--space-3) var(--space-4); min-height: 160px; resize: vertical; line-height: var(--leading-normal); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input-suffix { position: relative; }
.input-suffix > .input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.check { display: flex; gap: var(--space-3); align-items: flex-start; min-height: 44px; padding: var(--space-2) 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
@media (min-width: 600px) { .radio-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radio-card span {
  display: flex; align-items: center; justify-content: center; min-height: var(--control-h-md); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); text-align: center; font-weight: var(--weight-medium);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.radio-card span:hover { border-color: var(--text-3); }
.radio-card input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: var(--weight-bold); box-shadow: inset 0 0 0 1px var(--primary); }
.radio-card input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.form-grid { display: grid; gap: var(--space-5); }
@media (min-width: 600px) { .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
/* 허니팟 — 사람에게는 안 보이고 읽히지도 않는다 */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent-box { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--r); background: var(--surface-2); font-size: var(--text-sm); color: var(--text-2); }

/* 파일 끌어놓기 칸(폼 안 — 문의 첨부). 원래 <input type=file> 을 칸 전체에 깔아 끌어놓기·누르기 둘 다(JS 없이도) */
.filedrop { position: relative; display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-5) var(--space-4); border: 2px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); text-align: center; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.filedrop:hover, .filedrop.is-over, .filedrop:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.filedrop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filedrop svg { width: 26px; height: 26px; color: var(--primary-ink); }
.filedrop-title { font-weight: var(--weight-bold); }
.filedrop-help { font-size: var(--text-xs); color: var(--text-2); }
.filedrop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.filedrop-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); }
.filedrop-list li.is-error { border-color: var(--danger); color: var(--danger); }

/* ── 카드·배지·알림 상자 ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--space-6) var(--space-5); box-shadow: var(--shadow-card); }
@media (min-width: 600px) { .card { padding: var(--space-7); } }
.card-title { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.card-link { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card-link:hover { border-color: var(--border-strong); color: inherit; transform: translateY(-2px); box-shadow: var(--shadow-2); }

.badge { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 26px; padding: 0 var(--space-3); border-radius: var(--r-full); font-size: var(--text-xs); font-weight: var(--weight-bold); white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge svg { width: 14px; height: 14px; }
.badge-primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-success { background: var(--success-soft); color: var(--success); }

.alert { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--r); background: var(--surface-2); color: var(--text); font-size: var(--text-sm); border: 1px solid var(--border); }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.alert-info { background: var(--primary-soft); border-color: transparent; }
.alert-info svg { color: var(--primary-ink); }
.alert-warn { background: var(--warn-soft); border-color: transparent; }
.alert-warn svg { color: var(--warn); }
.alert-error { background: var(--danger-soft); border-color: transparent; }
.alert-error svg { color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: transparent; }
.alert-success svg { color: var(--success); }
.alert strong { display: block; margin-bottom: 2px; }

/* ── 빈 상태 ── */
.empty { text-align: center; padding: var(--space-8) var(--space-4); display: grid; gap: var(--space-3); justify-items: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.empty svg { width: 36px; height: 36px; color: var(--text-3); }
.empty-title { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.empty p { color: var(--text-2); max-width: 40ch; }

/* ── 정의 목록(값 표) ── */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0; font-size: var(--text-sm); }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: var(--weight-medium); min-width: 0; }

/* ── 표(모바일에선 카드로) ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-2); font-weight: var(--weight-bold); background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table a { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 40px; font-weight: var(--weight-bold); }
.table a svg { width: 16px; height: 16px; }
@media (max-width: 599px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .table-cards tr:last-child { border-bottom: 0; }
  .table-cards td { border: 0; padding: var(--space-1) 0; display: flex; justify-content: space-between; gap: var(--space-3); }
  .table-cards td::before { content: attr(data-label); color: var(--text-2); font-weight: var(--weight-medium); flex: none; }
}

/* ── 글 목록(유지보수 게시판·관리자) ── */
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.post-list > li { border-bottom: 1px solid var(--border); }
.post-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-4) var(--space-1); color: inherit; text-decoration: none; min-height: 64px; transition: background var(--dur) var(--ease); }
a.post-row:hover { background: var(--surface-2); color: inherit; }
.post-title { display: flex; gap: var(--space-2); align-items: center; font-weight: var(--weight-bold); min-width: 0; }
.post-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-title svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.post-meta { grid-column: 1 / -1; display: flex; gap: var(--space-3); color: var(--text-3); font-size: var(--text-sm); }
@media (min-width: 600px) { .post-meta { grid-column: auto; grid-row: 1; grid-column-start: 2; } .post-row { grid-template-columns: minmax(0, 1fr) auto auto; } }

/* ── 탭(링크) ── */
.tabs { display: flex; gap: var(--space-1); padding: 4px; border-radius: var(--r-full); background: var(--surface-2); flex-wrap: wrap; width: fit-content; max-width: 100%; }
.tabs a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--r-full); color: var(--text-2); text-decoration: none; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ── 페이지 넘김 ── */
.pager { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }
.pager a, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: var(--r-full); text-decoration: none; color: var(--text-2); }
.pager a:hover { background: var(--surface-2); }
.pager [aria-current="page"] { background: var(--primary); color: var(--on-primary); font-weight: var(--weight-bold); }

/* ── 접고 펴기(자주 묻는 질문) ── */
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); min-height: 64px; padding: var(--space-4) var(--space-1); cursor: pointer; font-weight: var(--weight-bold); font-size: var(--text-lg); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 22px; height: 22px; flex: none; color: var(--text-3); transition: transform var(--dur) var(--ease); }
.faq details[open] summary svg { transform: rotate(45deg); color: var(--primary-ink); }
.faq .faq-a { padding: 0 var(--space-1) var(--space-5); color: var(--text-2); max-width: 68ch; }

/* ── 토스트 ── */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); z-index: 90; display: grid; gap: var(--space-2); width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); min-height: 48px; border-radius: var(--r); background: var(--tip-bg); color: var(--tip-text); box-shadow: var(--shadow-2); font-size: var(--text-sm); animation: toast-in .2s var(--ease); }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast-error svg { color: var(--tip-err); }
.toast-success svg { color: var(--tip-ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── 확인 대화상자(브라우저 confirm 대신) ── */
.dialog { border: 0; padding: 0; background: transparent; max-width: min(92vw, 440px); width: 100%; color: var(--text); }
.dialog::backdrop { background: var(--overlay); }
.dialog-box { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); display: flex; flex-direction: column; max-height: 86vh; max-height: 86dvh; }
.dialog-body { padding: var(--space-6) var(--space-6) var(--space-4); overflow-y: auto; overscroll-behavior: contain; display: grid; gap: var(--space-3); }
.dialog-title { font-size: var(--text-lg); }
.dialog-actions { display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-4) var(--space-6) var(--space-6); flex-wrap: wrap; }
.dialog-actions .btn { flex: 1 1 120px; }

/* ── 콤보박스(기본 select 펼침 대신 — 규칙서 §8-1) ── */
.cbx { position: relative; }
.cbx-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cbx-input { padding-right: 48px; cursor: text; }
.cbx-arrow { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-3); pointer-events: none; }
.cbx-arrow svg { width: 20px; height: 20px; }
.cbx-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; margin: 0; padding: var(--space-1); list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-2); max-height: 280px; overflow-y: auto; }
.cbx.is-up .cbx-list { top: auto; bottom: calc(100% + 4px); }
.cbx-opt { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border-radius: var(--r-sm); cursor: pointer; }
.cbx-opt[aria-selected="true"] { font-weight: var(--weight-bold); color: var(--primary-ink); }
.cbx-opt.is-active { background: var(--primary-soft); }
.cbx-empty { padding: var(--space-3); color: var(--text-3); font-size: var(--text-sm); }

/* ── 툴팁(기본 title 대신 — 규칙서 §8-1) ── */
.tip { position: fixed; z-index: 100; max-width: 260px; padding: var(--space-2) var(--space-3); border-radius: var(--r-sm); background: var(--tip-bg); color: var(--tip-text); font-size: var(--text-xs); line-height: 1.5; box-shadow: var(--shadow-2); pointer-events: none; opacity: 0; transition: opacity 120ms var(--ease); }
.tip.is-on { opacity: 1; }

/* ── 아이콘 ── */
.icon { width: 20px; height: 20px; flex: none; }

/* ── 업로드 끌어놓기(ui_dropzone · assets/js/dropzone.js — 관리자 사례 이미지·로고) ── */
.dropzone { display: grid; gap: var(--space-2); }
.dz-area { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); border: 2px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dz-area:hover, .dropzone.is-over .dz-area { border-color: var(--primary); background: var(--primary-soft); }
.dz-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-full); background: var(--surface); color: var(--primary-ink); }
.dz-ico svg { width: 22px; height: 22px; }
.dz-title { font-weight: var(--weight-bold); }
.dz-help { font-size: var(--text-xs); color: var(--text-2); }
.dz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.dz-list:empty { display: none; }
.dz-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); transition: opacity 400ms var(--ease); }
.dz-item.is-leaving { opacity: 0; }
.dz-thumb { width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dz-body { display: grid; gap: 2px; min-width: 0; }
.dz-name { font-size: var(--text-sm); font-weight: var(--weight-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-meta { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-2); }
.dz-meta svg { width: 16px; height: 16px; flex: none; }
.dz-item.is-done .dz-meta { color: var(--success); }
.dz-item.is-error { border-color: var(--danger); }
.dz-item.is-error .dz-meta { color: var(--danger); font-weight: var(--weight-bold); }
.dz-bar { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.dz-bar > span { display: block; height: 100%; width: var(--pct, 0%); background: var(--primary); }   /* 진행 값이 바뀔 때마다 바로 — 폭 움직임(레이아웃) 없음 */

/* ── 이미지 모음(관리자 사례 이미지 — 순서·지우기) ── */
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.thumbs li { display: grid; gap: var(--space-2); }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.thumbs .row { justify-content: space-between; }
