/* 업무용 도구답게 정보 밀도를 높이고 장식은 줄인다. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #d9dce2;
  --line-soft: #eceef2;
  --text: #1d2129;
  --muted: #6b7280;
  --accent: #a4368c;      /* LG U+ 양식의 자주색 계열 */
  --accent-dark: #82296f;
  --ok: #1a7f5a;
  --warn: #b45309;
  --err: #c0392b;
  --focus: #f2760c;
  --radius: 6px;
}

* { box-sizing: border-box; }

/* display 를 지정한 클래스가 hidden 속성을 덮어쓰지 않도록 못 박는다. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
               "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}


/* --- 레이아웃 --- */
.layout {
  display: grid;
  grid-template-columns: 360px minmax(440px, 1fr);
  gap: 14px; padding: 16px;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.panel h2 {
  margin: 18px 0 8px; font-size: 13px; font-weight: 700;
  text-transform: none; color: var(--muted);
  border-bottom: 1px solid var(--line-soft); padding-bottom: 6px;
}
.panel h2:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { border: 0; margin: 0; padding: 0; }

/* --- 폼 --- */

input[type="text"], input[type="number"], textarea {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; color: inherit; background: #fff;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(164, 54, 140, 0.12);
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

button {
  padding: 7px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--line-soft); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.secondary { background: #fff; border-color: var(--line); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--text); }
button.small { padding: 3px 8px; font-size: 12px; }

.muted { color: var(--muted); font-size: 12px; }
.note {
  font-size: 12px; color: var(--muted); margin: 8px 0;
  padding: 7px 9px; background: var(--line-soft); border-radius: var(--radius);
}
.note.warn { background: #fef4e6; color: var(--warn); }
.note.err { background: #fdecea; color: var(--err); }
.note.ok { background: #e7f6ef; color: var(--ok); }

/* --- 드롭존 --- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; background: #fbfbfc;
  transition: border-color .12s, background .12s;
}
.dropzone p { margin: 0 0 4px; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: #faf3f8; }
.dropzone button { margin-top: 8px; }

/* --- 파일 목록 --- */
.file-list { list-style: none; margin: 10px 0 6px; padding: 0; max-height: 190px; overflow-y: auto; }
.file-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  margin-bottom: 5px; font-size: 13px; cursor: pointer; background: #fff;
}
.file-list li:hover { border-color: var(--line); }
.file-list li.active { border-color: var(--accent); background: #faf3f8; }
.file-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.file-list .state { font-size: 11px; white-space: nowrap; }
.file-list .state.ok { color: var(--ok); }
.file-list .state.err { color: var(--err); }
.file-list .remove {
  border: 0; background: transparent; color: var(--muted);
  padding: 0 4px; font-size: 15px; line-height: 1;
}

/* --- 진행률 --- */
.progress { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .18s; }

/* --- 미리보기 --- */
.preview-panel { min-height: 460px; }
.preview-tools { display: flex; align-items: center; gap: 4px; }
.preview-stage {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: #eef0f3; padding: 10px; display: grid; place-items: center;
  min-height: 380px; max-height: 74vh; overflow: auto;
}
.preview-empty { color: var(--muted); font-size: 13px; }
.preview-holder { position: relative; line-height: 0; }
.preview-holder img { max-width: 100%; height: auto; box-shadow: 0 1px 6px rgba(0,0,0,.16); background:#fff; }
.region-holder {
  margin-top: 10px; border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 8px; background: #eef0f3; line-height: 0;
}
.region-holder img { max-width: 100%; height: auto; background: #fff; }

/* --- 결과 --- */
.result-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-soft); border-left-width: 3px;
  border-radius: var(--radius); padding: 7px 9px; margin-bottom: 6px; font-size: 13px;
}
.result-item.ok { border-left-color: var(--ok); }
.result-item.err { border-left-color: var(--err); }
.result-item .info { flex: 1; min-width: 0; }
.result-item .title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-item .detail { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.result-item .download { flex: none; white-space: nowrap; }

/* --- 토스트 --- */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  background: #2b2f36; color: #fff; padding: 10px 14px;
  border-radius: var(--radius); font-size: 13px; max-width: 380px;
  box-shadow: 0 4px 14px rgba(0,0,0,.24);
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* --- 체크박스 --- */
.check {
  display: flex; align-items: center; gap: 7px;
  margin: 12px 0 2px; font-size: 13px; cursor: pointer; color: var(--text);
}
.check input { margin: 0; }

/* --- 실행 버튼 줄 --- */
.actions { display: flex; gap: 8px; margin: 12px 0 10px; }
.actions button { flex: 1; }

/* --- 결과 --- */
.results { max-height: 260px; overflow-y: auto; margin-top: 4px; }
.results:empty { display: none; }

/* --- 로그아웃 (비밀번호 잠금이 켜진 경우에만 보인다) --- */
#logout {
  position: fixed; right: 14px; top: 10px; z-index: 30;
}
