/* x-ad.css — 운영자 화면(ad) 전용. 클래스는 모두 .ad- 로 시작하고 색·간격은 app.css 토큰만 씁니다. */

/* 제목·문단 */
.ad-h2 { font-size: var(--fs-lg); }
.ad-block { display: block; margin-top: 2px; }
.ad-pad { padding: 12px 18px; }
.ad-strong { font-size: var(--fs-md); color: var(--ink); }
.ad-count { font-size: var(--fs-sm); color: var(--ink-2); }
.ad-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ad-v-sm { font-size: 20px !important; }

/* 조회 조건 */
.ad-filter { display: flex; flex-direction: column; gap: 12px; }
.ad-frow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; min-width: 0; }
.ad-flabel { flex: 0 0 auto; min-width: 72px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); padding: 0; float: left; }
.ad-frow .input, .ad-frow .select { min-height: 42px; width: auto; }
.ad-grow { flex: 1 1 240px; min-width: 0; }
.ad-btns { display: flex; gap: 8px; margin-left: auto; }
.ad-dates { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ad-dates .input { width: 160px; }
.ad-chips { flex-wrap: wrap; overflow: visible; }
.ad-chips .chip { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); }
.ad-inline { min-height: 42px; padding: 0; align-items: center; }
.ad-mtabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
.ad-mtabs a { white-space: nowrap; }

/* 알약 모양 라디오 */
.ad-pills { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.ad-pills label { position: relative; display: inline-flex; }
.ad-pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ad-pills span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: all var(--t-short) var(--ease); }
.ad-pills label:hover span { border-color: var(--ink-2); color: var(--ink); }
.ad-pills input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.ad-pills input:focus-visible + span { box-shadow: var(--focus); }
.ad-pills input:disabled + span { opacity: .45; cursor: not-allowed; }

/* 지표 카드 */
.ad-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ad-metric { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); transition: border-color var(--t-short) var(--ease), box-shadow var(--t-short) var(--ease); }
.ad-metric:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.ad-metric .k { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); }
.ad-metric .v { font: 700 26px/1.2 var(--font-num); }
.ad-metric .d { font-size: 13px; }
.ad-wait { font-size: var(--fs-md) !important; color: var(--warn-ink); }
.ad-delta { display: inline-flex; align-items: center; gap: 3px; font: 600 13px var(--font-num); color: var(--ink-3); }
.ad-delta.is-good { color: var(--accent-ink); }
.ad-delta.is-bad { color: var(--danger-ink); }
@media (max-width: 1200px) { .ad-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .ad-metrics { grid-template-columns: 1fr; } }

/* 비중 막대 */
.ad-share { display: inline-flex; align-items: center; gap: 8px; min-width: 140px; }
.ad-share-bar { flex: 1; height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.ad-share-bar span { display: block; height: 100%; background: var(--accent); }

/* 표 */
.ad-tw { position: relative; overflow-x: auto; }
.ad-bar + .ad-tw, .ad-filter + .ad-tw { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ad-table { width: 100%; }
.ad-table td.num, .ad-table th { white-space: nowrap; }
.ad-who { display: flex; flex-direction: column; min-width: 0; word-break: break-all; }
.ad-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ad-inline-form { display: inline-flex; margin: 0; }

/* 상세 2단 */
.ad-2col { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ad-kv { grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); }
.ad-kv dd { word-break: break-word; min-width: 0; }
.ad-reveal { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.ad-reveal summary { cursor: pointer; width: fit-content; }
.ad-reveal summary:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
.ad-prose { white-space: normal; line-height: 1.75; }
.ad-prevnext { display: grid; gap: 8px; padding: 14px 18px; }
.ad-narrow { max-width: 760px; }

/* 폼 배치 */
.ad-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ad-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.ad-span-all { grid-column: 1 / -1; }
.ad-mall { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; min-width: 0; }
.ad-mall-head { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.ad-mall-head .mall-mark { width: 36px; height: 36px; font-size: 15px; border-radius: 11px; }
.ad-mall-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; margin-top: 10px; }
.ad-sticky-save { position: sticky; bottom: 0; z-index: 5; justify-content: flex-end; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }
.ad-adjust { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, .7fr) minmax(0, 1.4fr) auto; gap: 12px 16px; align-items: start; }
.ad-adjust-btn { padding-top: 27px; }
.ad-login-note { margin-top: 24px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

/* 주소 있는 모달: 뒤 화면 위에 덮기 */
.ad-overlay { position: fixed; inset: 0; z-index: 70; background: var(--scrim); overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; }
.ad-overlay .sheet-page { min-height: 0; padding: 0; background: transparent; width: 100%; }
.ad-overlay .sheet { width: min(560px, 100%); max-height: none; }
.ad-overlay .modal-foot { flex-wrap: wrap; }

@media (max-width: 1100px) {
  .ad-adjust { grid-template-columns: 1fr 1fr; }
  .ad-adjust-memo { grid-column: 1 / -1; }
  .ad-adjust-btn { padding-top: 0; }
  .ad-mall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .ad-2col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ad-form-2, .ad-form-grid, .ad-adjust, .ad-mall-grid { grid-template-columns: 1fr; }
  .ad-btns { margin-left: 0; width: 100%; }
  .ad-btns .btn { flex: 1; }
  .ad-dates { width: 100%; }
  .ad-dates .input { flex: 1; width: auto; min-width: 0; }
  .ad-frow .select { flex: 1 1 140px; }
  .ad-flabel { min-width: 0; width: 100%; }
  .ad-hide-m { display: none !important; }
  .ad-kv { grid-template-columns: 1fr; gap: 2px 0; }
  .ad-kv dd { margin-bottom: 8px; }
  /* 표 → 카드 */
  .ad-table { min-width: 0; }
  .ad-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ad-table, .ad-table tbody, .ad-table tr, .ad-table td { display: block; }
  .ad-table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .ad-table tr:last-child { border-bottom: 0; }
  .ad-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 5px 0; border: 0; text-align: right; white-space: normal !important; }
  .ad-table td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-3); }
  .ad-table td:not([data-label]) { justify-content: flex-end; }
  .ad-table td:not([data-label])::before { content: none; }
  .ad-table td > .ad-who, .ad-table td > .ad-acts { align-items: flex-end; text-align: right; justify-content: flex-end; }
  .ad-sticky-save .btn { flex: 1; }
  .ad-overlay { place-items: end center; padding: 16px 0 0; }
  .ad-overlay .sheet { border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* 공통 부품 보정(운영 화면 안에서만) */
.ad-grid > * { min-width: 0; }
.ad-stats .stat .v, .ad-stats .stat .d { display: block; }
.ad-stats .stat .v .badge { font-size: var(--fs-sm); }
.ad-table .num { text-align: left; }
.ad-grid .stat .v, .ad-grid .stat .d { display: block; }
.ad-ph { flex-wrap: wrap; }
.ad-ph h2 { min-width: 0; }
