:root {
  --blue: #2f6fed;
  --blue-dark: #1d4fc4;
  --green: #1e9e5a;
  --red: #d64545;
  --amber: #c98a1a;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e4e7ee;
  --text: #1f2430;
  --text-muted: #6b7280;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------- 상단 바 / 브랜드 ---------- */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(47, 111, 237, .35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.page-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.topbar .root-path {
  font-size: 12px;
  color: var(--text-muted);
  font-family: Consolas, monospace;
  background: #f1f3f8;
  padding: 5px 12px;
  border-radius: 999px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar nav a {
  margin-left: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.topbar nav a + a { margin-left: 16px; }

.topbar nav a:hover { color: var(--blue); }

.container {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 20px;
}

/* ---------- 로그인 / 초기 설정 화면 ---------- */

.auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.auth-container {
  margin: auto;
  padding: 40px 20px;
  width: 100%;
}

.auth-card {
  text-align: left;
}

.auth-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.auth-divider {
  text-align: center;
  color: #9aa1af;
  font-size: 12px;
  margin: 10px 0;
}

/* ---------- 카드 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .2px;
  margin: -22px -24px 18px;
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
  background: #fafbfe;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .badge {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue-dark);
  font-weight: 700;
}

/* ---------- 공통 파일 업로드 필드 ---------- */

.field-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fbfcfe;
}

.label-note {
  font-weight: 500;
  color: #9aa1af;
}

.meta-filename {
  font-family: Consolas, monospace;
  color: var(--text);
}

.inline-upload {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.inline-upload input[type=file] {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- 실행 패널 ---------- */

.run-panel {
  margin: 22px 0 28px;
}

/* ---------- 사이트 카드 ---------- */

.grid-sites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.site-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s;
}

.site-card:hover { box-shadow: 0 2px 8px rgba(16, 24, 40, .06); }

.site-card.has-pending { border-color: var(--blue); background: #f2f6ff; }

.site-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.site-card h3 {
  margin: 0;
  font-size: 15px;
}

.site-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.site-card .pending-list {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0;
  max-height: 60px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

/* ---------- 드래그앤드롭 영역 ---------- */

.dropzone {
  border: 2px dashed #c7cfe0;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: #fff;
}

.dropzone .dz-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-bottom: 4px;
}

.dropzone .dz-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.dropzone .dz-hint {
  font-size: 11px;
  color: #9aa1af;
}

.dropzone:hover { border-color: #9fb0d8; }

.dropzone.drag-over {
  border-color: var(--blue);
  background: #eef2ff;
  transform: scale(1.01);
}

.dropzone.drag-over .dz-text { color: var(--blue-dark); }

.dropzone.has-files {
  border-style: solid;
  border-color: var(--green);
  background: #eafaf0;
}

.dropzone.has-files .dz-icon { background: #d6f3e3; color: var(--green); }
.dropzone.has-files .dz-text { color: var(--green); }

.dropzone input[type=file] { display: none; }

/* ---------- 버튼 ---------- */

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: white;
  background: var(--blue);
  transition: background .15s, transform .05s;
}

.btn:hover { background: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #eef0f5; color: var(--text); }
.btn.secondary:hover { background: #e2e5ee; }
.btn.danger { background: #fdecec; color: var(--red); }
.btn.danger:hover { background: #fbdada; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.full { width: 100%; text-align: center; }
.btn.big { padding: 16px; font-size: 16px; box-shadow: 0 2px 8px rgba(47, 111, 237, .25); }

.actions { margin-top: 10px; display: flex; gap: 8px; }

form.inline { display: inline; }

/* ---------- 입력 요소 ---------- */

input[type=text],
input[type=password] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}

select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
  background: #fff;
}

input[type=text]:focus,
input[type=password]:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- 안내 / 상태 ---------- */

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}

.flash.success { background: #eafaf0; color: var(--green); }
.flash.error { background: #fdecec; color: var(--red); }
.flash.success::before { content: "✓ "; }
.flash.error::before { content: "⚠ "; }

.status-ok, .status-review, .status-error, .status-pending, .status-idle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-ok { background: #eafaf0; color: var(--green); }
.status-review { background: #fdf3e3; color: var(--amber); }
.status-error { background: #fdecec; color: var(--red); }
.status-pending { background: #eef2ff; color: var(--blue-dark); }
.status-idle { background: #f1f3f8; color: var(--text-muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 700; font-size: 12px; background: #fafbfe; position: sticky; top: 0; }
tbody tr:hover { background: #f8f9fc; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.run-summary-item {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.run-summary-item strong { margin-right: 8px; }

.helptext { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
