:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #dde3ea;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --warn: #c2410c;
  --warn-soft: #fff1e6;
  --err: #b91c1c;
  --err-soft: #fde8e8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; line-height: 1.5; }
h1, h2, h3 { margin: 0; }
button, input, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: normal; }

.top { background: #1e293b; color: #fff; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.top h1 { font-size: 1.35rem; }
.top h1 small { font-size: .8rem; color: #94a3b8; font-weight: normal; margin-left: 6px; }
.top-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-label { display: flex; align-items: center; gap: 8px; font-weight: bold; }
.date-label input { padding: 8px 10px; border-radius: 8px; border: 0; font-size: 1.05rem; }

.btn { padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; font-weight: 600; }
.btn:hover { background: #f1f5f9; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.big { padding: 14px 24px; font-size: 1.1rem; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.steps { max-width: 1400px; margin: 16px auto 0; padding: 0 20px; display: flex; align-items: center; gap: 10px; }
.step { flex: 1; text-align: center; padding: 10px; border-radius: 999px; background: #e2e8f0; color: var(--muted); font-weight: 600; }
.step.done { background: var(--ok-soft); color: var(--ok); }
.step.active { background: var(--blue); color: #fff; }
.arrow { color: var(--muted); font-size: 1.3rem; }

main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 60px; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel h2 { font-size: 1.3rem; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.num { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; align-items: center; justify-content: center; font-size: 1.1rem; }
.hint { color: var(--muted); margin: 4px 0 14px; }
h3.sub { margin: 26px 0 10px; font-size: 1.12rem; }

.banner { border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; font-weight: 600; }
.banner.err { background: var(--err-soft); color: var(--err); border: 2px solid #f5b5b5; font-size: 1.15rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #fbc9a4; }
.banner.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #a7dfb9; }
.banner.info { background: var(--blue-soft); color: #1e40af; border: 1px solid #bcd0fb; }
.banner ul { margin: 6px 0 0; padding-left: 20px; font-weight: normal; }

.dropzone { border: 2px dashed #b6c2d1; border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; background: #fafcff; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone.big { padding: 26px; font-size: 1.1rem; margin-bottom: 18px; }
.dz-icon { font-size: 2rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card.ok { border-color: #8fd3a6; }
.card.issues { border-color: #f7b27d; }
.card.error { border-color: #f19a9a; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-head h3 { font-size: 1.1rem; }
.card .sites { font-size: .82rem; color: var(--muted); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.badge.waiting { background: #eef1f5; color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.issues { background: var(--warn-soft); color: var(--warn); }
.badge.error { background: var(--err-soft); color: var(--err); }
.card .dropzone { padding: 12px; font-size: .92rem; }
.card-stats { font-size: .92rem; }
.card-stats b { font-size: 1.05rem; }
.card-files { font-size: .85rem; color: var(--muted); }
.card-files li { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-files ul { margin: 0; padding: 0; list-style: none; }
.card-error { color: var(--err); font-size: .9rem; font-weight: 600; }
.row-right { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn.danger-fill { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-fill:hover { background: #991b1b; }
.check-row { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; }
.check-row input { width: 20px; height: 20px; margin-top: 3px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .label { color: var(--muted); font-size: .9rem; }
.kpi .value { font-size: 1.9rem; font-weight: 800; }
.kpi .value small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.kpi.warn { background: var(--warn-soft); border-color: #fbc9a4; }
.kpi.warn .value { color: var(--warn); }
.kpi.ok .value { color: var(--ok); }

.charts { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 14px; margin-top: 14px; }
.chart-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.chart-box h3 { font-size: 1rem; margin-bottom: 6px; }
.chart-wrap { position: relative; height: 280px; }
@media (max-width: 1000px) { .charts { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: #f1f5f9; position: sticky; top: 0; cursor: default; white-space: nowrap; }
th.sortable { cursor: pointer; }
th.sortable:hover { background: #e2e8f0; }
td.n, th.n { text-align: right; }
tr.total td { font-weight: 800; background: #f8fafc; }
.table-scroll { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-tools { margin-bottom: 8px; }
.table-tools input { width: 100%; max-width: 420px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.issue-table td.reason { color: var(--err); font-weight: 600; }
.empty { padding: 18px; text-align: center; color: var(--muted); background: #f8fafc; border-radius: 8px; }
.sub-details { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.sub-details summary { cursor: pointer; font-weight: 700; }
.sub-details[open] summary { margin-bottom: 10px; }
.warn-list { margin: 0; padding-left: 20px; }
.warn-list li { margin: 4px 0; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; margin-top: 14px; }
.dl-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.dl-item .what { font-size: .82rem; color: var(--muted); }
.dl-item .fname { font-weight: 600; word-break: break-all; }
.dl-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.busy-box { background: #fff; padding: 28px 40px; border-radius: 14px; text-align: center; font-size: 1.15rem; font-weight: 700; }
.spinner { width: 46px; height: 46px; border: 5px solid #dbeafe; border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(1100px, 94vw); max-height: 88vh; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,23,42,.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
#modalBody { padding: 18px 20px 24px; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.result-list li.ok { border-left: 6px solid var(--ok); }
.result-list li.issues { border-left: 6px solid var(--warn); }
.result-list li.error { border-left: 6px solid var(--err); }
.form-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.form-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 200px; }
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--blue-soft); }

.clickable-box { cursor: pointer; transition: .15s; }
.clickable-box:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.chart-box h3 .more { float: right; font-size: .82rem; color: var(--blue); font-weight: 600; }
.modal-chart { position: relative; margin: 10px 0 18px; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mini-kpis .kpi .value { font-size: 1.5rem; }
tr.sub-row td { background: #fafcff; font-size: .88rem; }
tr.sub-row td:first-child { padding-left: 26px; }
.bar-cell { position: relative; min-width: 120px; }
.bar-cell .bar { position: absolute; left: 0; top: 6px; bottom: 6px; background: var(--blue-soft); border-radius: 4px; }
.bar-cell span { position: relative; }
.back-row { margin-bottom: 12px; }
#mallTable td:first-child { white-space: nowrap; }

/* 로그인 화면 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 32px; width: min(440px, 100%); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.login-card h1 { font-size: 2rem; color: #1e293b; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-card label, .stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
.login-card input, .stack input, .stack select, .stack textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: normal; }
.form-msg { min-height: 1.2em; font-weight: 600; }
.form-msg.err { color: var(--err); }
.form-msg.ok { color: var(--ok); }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.user-chip { display: inline-flex; gap: 6px; margin-left: 6px; padding-left: 10px; border-left: 1px solid #475569; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: #1e40af; font-size: .8rem; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 16px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
.secret-box { background: #fff7d6; border: 1px solid #f2d36b; border-radius: 8px; padding: 10px 14px; font-family: monospace; font-size: 1.15rem; user-select: all; }
.req-status { font-weight: 700; }
td.wrap { white-space: pre-wrap; max-width: 420px; }
#modalBody table td:first-child { white-space: nowrap; }

/* 원본보관창고 */
.arch-table td, .arch-table th { text-align: center; }
.arch-table td:first-child, .arch-table th:first-child { text-align: left; }
.arch-file { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: .85rem; text-decoration: none; margin: 2px; white-space: nowrap; }
.arch-file:hover { background: #c9efd6; }
.arch-file.old { background: #eef1f5; color: var(--muted); }
.arch-none { color: #c3cad3; }
th .zip-link { display: block; font-weight: normal; font-size: .78rem; color: var(--blue); text-decoration: none; }
.arch-table td { vertical-align: middle; }
.arch-table .btn { white-space: nowrap; }
.form-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
