/* ============================================================
   admin.css — hr 모던 리뉴얼 규칙(카드·인라인테이블·커스텀모달·f-row)을 따른다
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Noto Sans KR', sans-serif; }
html { background: #eef1f5; }
body { color: #1f2937; font-size: 14px; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
li { list-style: none; }
.hidden { display: none !important; }
.container { width: 100%; max-width: 1380px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title h2 { font-size: 20px; font-weight: 700; color: #0f1e3c; }
.page-title p { font-size: 13px; color: #64748b; margin-top: 2px; }
.footer { text-align: center; padding: 18px; font-size: 12px; color: #94a3b8; }

/* ── 카드 ── */
.info-card { background: #fff; border-radius: 10px; box-shadow: 0 2px 14px rgba(0,0,0,.07); margin-bottom: 18px; overflow: hidden; }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 18px; color: #fff; font-size: 13.5px; font-weight: 600; background: linear-gradient(135deg,#1e3a5f,#2563eb); }
.card-hd--ai { background: linear-gradient(135deg,#6d28d9,#a855f7); }
.card-hd--img { background: linear-gradient(135deg,#065f46,#10b981); }
.card-hd--loc { background: linear-gradient(135deg,#c2410c,#f97316); }
.card-hd--etc { background: linear-gradient(135deg,#334155,#64748b); }
.card-hd-actions { display: flex; gap: 6px; }
.card-body { padding: 16px 18px; }

/* ── 통계 타일 ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-tile { background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(0,0,0,.05); border-left: 4px solid #2563eb; }
.stat-tile b { display: block; font-size: 26px; color: #0f1e3c; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 12.5px; color: #64748b; }
.stat-tile.warn { border-left-color: #f59e0b; } .stat-tile.ai { border-left-color: #8b5cf6; } .stat-tile.ok { border-left-color: #10b981; }
.bar-list li { display: grid; grid-template-columns: 110px 1fr 60px; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.bar-list .bar { height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.bar-list .bar i { display: block; height: 100%; background: #3b82f6; }
.bar-list em { font-style: normal; text-align: right; color: #475569; font-variant-numeric: tabular-nums; }

/* ── 검색 영역 (hr searchArea 규칙: input.filter 엔터/변경 즉시 검색) ── */
.searchArea { background: linear-gradient(to bottom,#fff,#f8fafc); border-radius: 10px; box-shadow: 0 1px 5px rgba(0,0,0,.05); padding: 14px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.colGrp { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.colGrp.wide { flex: 1 1 320px; }
.colHd { font-size: 11.5px; color: #64748b; font-weight: 600; }
.colBd input, .colBd select, .f-input, .f-ctrl input, .f-ctrl select, .f-ctrl textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 13.5px; background: #fff; color: #111827; }
.colBd input:focus, .colBd select:focus, .f-input:focus, .f-ctrl input:focus, .f-ctrl select:focus, .f-ctrl textarea:focus { outline: 2px solid #93c5fd; border-color: #3b82f6; }
.smart-input { position: relative; }
.smart-input input { padding-left: 34px; font-size: 14.5px; }
.smart-input::before { content: '✦'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8b5cf6; }
.parsed-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; min-height: 4px; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 16px; border: none; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; transition: opacity .15s, transform .1s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; } .btn-primary:hover { background: #1d4ed8; }
.btn-ai { background: linear-gradient(135deg,#7c3aed,#a855f7); color: #fff; } .btn-ai:hover { opacity: .9; }
.btn-ok { background: #059669; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-ghost { background: #f1f5f9; color: #475569; } .btn-ghost:hover { background: #e2e8f0; }
.btn-light { background: rgba(255,255,255,.18); color: #fff; } .btn-light:hover { background: rgba(255,255,255,.3); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.tbl-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.tbl-toolbar .muted { font-size: 13px; color: #64748b; }

/* ── 칩 ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: #eef2ff; color: #3730a3; white-space: nowrap; }
.chip.cls { background: #e0f2fe; color: #075985; } .chip.mtr { background: #fef3c7; color: #92400e; } .chip.shape { background: #ede9fe; color: #5b21b6; }
.chip.none { background: #f1f5f9; color: #94a3b8; }
.chip.st-N { background: #fee2e2; color: #991b1b; } .chip.st-R { background: #fef3c7; color: #92400e; } .chip.st-S { background: #ede9fe; color: #6d28d9; } .chip.st-Y { background: #d1fae5; color: #065f46; }
.chip.why { background: #f0fdf4; color: #166534; }

/* ── 인라인 테이블 ── */
.tableOutFrm { background: #fff; border-radius: 10px; box-shadow: 0 2px 14px rgba(0,0,0,.06); padding: 14px; overflow-x: auto; }
.inline-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.inline-tbl th { background: #f8fafc; color: #475569; font-weight: 600; padding: 9px 6px; border-bottom: 2px solid #e5e7eb; text-align: center; white-space: nowrap; }
.inline-tbl td { padding: 7px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; text-align: center; }
.inline-tbl td.l { text-align: left; }
.inline-tbl tbody tr { cursor: pointer; }
.inline-tbl tbody tr:hover td { background: #f8fafc; }
.tbl-empty { padding: 40px !important; color: #94a3b8; text-align: center; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #f1f5f9; display: block; margin: 0 auto; }
.thumb.none { display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 20px; }
.pager { display: flex; justify-content: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager button { min-width: 32px; padding: 5px 8px; border: 1px solid #e5e7eb; background: #fff; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.pager button.on { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── 폼 (f-row > f-label + f-ctrl) ── */
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.f-grid .full { grid-column: 1 / -1; }
@media (max-width: 900px) { .f-grid { grid-template-columns: 1fr; } }
.f-row { display: flex; align-items: flex-start; gap: 10px; }
.f-label { width: 96px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: #475569; padding-top: 9px; }
.f-ctrl { flex: 1; min-width: 0; }
.f-ctrl textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.f-hint { font-size: 11.5px; color: #94a3b8; margin-top: 3px; }
.f-ctrl.ai-filled select, .f-ctrl.ai-filled input, .f-ctrl.ai-filled textarea { border-color: #a855f7; background: #faf5ff; }
.ai-badge { display: inline-flex; gap: 4px; align-items: center; margin-top: 4px; font-size: 11.5px; color: #6d28d9; }
.ai-badge .conf { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: #e9d5ff; overflow: hidden; vertical-align: middle; }
.ai-badge .conf i { display: block; height: 100%; background: #7c3aed; }
.ai-badge.low { color: #b45309; } .ai-badge.low .conf i { background: #f59e0b; }
.ai-badge.changed { color: #64748b; text-decoration: line-through; }

/* ── 등록 화면 2단 ── */
.edit-layout { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .edit-layout { grid-template-columns: 1fr; } }
.img-drop { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 26px 14px; text-align: center; color: #64748b; cursor: pointer; transition: background .15s, border-color .15s; }
.img-drop.over, .img-drop:hover { background: #f0f9ff; border-color: #3b82f6; color: #1d4ed8; }
.img-drop b { display: block; font-size: 14px; margin-bottom: 4px; }
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.img-cell { position: relative; border-radius: 8px; overflow: hidden; background: #f1f5f9; aspect-ratio: 1; }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell .lbl { position: absolute; left: 6px; top: 6px; background: rgba(15,30,60,.75); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 4px; }
.img-cell .del { position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(220,38,38,.9); color: #fff; cursor: pointer; font-size: 13px; line-height: 22px; }
.img-cell select { position: absolute; left: 4px; bottom: 4px; right: 4px; font-size: 11px; padding: 2px; border-radius: 4px; border: none; background: rgba(255,255,255,.9); }
.ai-panel { margin-top: 14px; padding: 14px; border-radius: 10px; background: linear-gradient(135deg,#faf5ff,#f5f3ff); border: 1px solid #e9d5ff; }
.ai-panel h4 { font-size: 13.5px; color: #5b21b6; margin-bottom: 6px; }
.ai-panel p { font-size: 12.5px; color: #4c1d95; line-height: 1.6; }
.ai-panel .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.dup-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 8px; }
.dup-box.warn { background: #fffbeb; border-color: #fcd34d; }
.dup-box h4 { font-size: 13px; color: #92400e; }
.dup-box:not(.warn) h4 { color: #475569; }
.dup-box a { display: flex; gap: 10px; align-items: center; font-size: 12.5px; padding: 4px; border-radius: 6px; }
.dup-box a:hover { background: rgba(0,0,0,.04); }
.dup-box img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sticky-actions { position: sticky; bottom: 0; background: rgba(238,241,245,.95); backdrop-filter: blur(4px); padding: 12px 0; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #e2e8f0; }

/* ── AI 검수함 ── */
.review-card { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 14px; border-bottom: 1px solid #f1f5f9; }
.review-card:last-child { border-bottom: none; }
.review-card img { width: 150px; height: 150px; object-fit: cover; border-radius: 8px; background: #f1f5f9; cursor: zoom-in; }
.review-card h4 { font-size: 14.5px; margin-bottom: 6px; }
.review-card h4 small { color: #94a3b8; font-weight: 400; margin-left: 6px; }
.cmp-grid { display: grid; grid-template-columns: 60px 1fr 1fr; gap: 6px 10px; align-items: center; font-size: 12.5px; }
.cmp-grid .h { font-weight: 600; color: #64748b; font-size: 11.5px; }
.cmp-grid select { padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12.5px; width: 100%; }
.cmp-grid select.diff { border-color: #a855f7; background: #faf5ff; }
.review-desc { font-size: 12px; color: #475569; margin-top: 8px; line-height: 1.55; }
.review-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.review-card.done { opacity: .45; }
@media (max-width: 700px) { .review-card { grid-template-columns: 1fr; } .review-card img { width: 100%; height: 220px; } }

/* ── 커스텀 모달 ── */
.custom-modal-wrap { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; }
.custom-modal-wrap.on { display: flex; }
.custom-modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(3px); }
.custom-modal-box { position: relative; background: #fff; border-radius: 12px; width: 92%; max-width: 520px; box-shadow: 0 10px 40px rgba(0,0,0,.25); overflow: hidden; animation: cmUp .2s ease-out; }
@keyframes cmUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.custom-modal-hd { padding: 14px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; }
.custom-modal-hd a { cursor: pointer; color: #94a3b8; font-size: 18px; }
.custom-modal-bd { padding: 20px; max-height: 75vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.custom-modal-ft { padding: 12px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 6px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 10000; display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.on { display: flex; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 6px; }

/* ── 토스트 ── */
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: #0f1e3c; color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 13px; opacity: 0; transition: .25s; z-index: 10001; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: #b91c1c; }

/* ── 진행 바 ── */
.progress { height: 10px; border-radius: 5px; background: #e5e7eb; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg,#7c3aed,#3b82f6); transition: width .3s; }
.log-box { font-family: Consolas, monospace; font-size: 12px; background: #0f172a; color: #cbd5e1; border-radius: 8px; padding: 10px 12px; max-height: 220px; overflow-y: auto; white-space: pre-wrap; margin-top: 10px; }

/* ── 로그인 ── */
.login-body { background: radial-gradient(circle at 30% 20%, #1e3a5f, #0f1e3c 70%); align-items: center; justify-content: center; }
.login-card { width: 92%; max-width: 380px; background: #fff; border-radius: 16px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-brand { text-align: center; margin-bottom: 8px; }
.login-icon { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 14px; background: linear-gradient(135deg,#1e3a5f,#2563eb); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; }
.login-brand h1 { font-size: 19px; color: #0f1e3c; }
.login-brand p { font-size: 12.5px; color: #64748b; margin-top: 4px; }
.login-save { font-size: 12.5px; color: #64748b; display: flex; gap: 6px; align-items: center; }
.login-link { text-align: center; font-size: 12.5px; color: #64748b; }
