:root {
  --bg: #0f0d0a;
  --surface: #1a1713;
  --surface-hover: #252119;
  --border: #2e2a23;
  --text: #e8dfd0;
  --text-muted: #8a826d;
  --accent: #ffd400;
  --accent-dim: rgba(255, 212, 0, 0.1);
  --green: #4ade80;
  --red: #f87171;
  --sans: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
.app { max-width: 960px; margin: 0 auto; padding: 40px 24px; }

h1 { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.subtitle { color: var(--text-muted); margin-bottom: 32px; }

/* Section */
.section { margin-bottom: 40px; }
.section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 16px; font-weight: 700; flex: 1; }
.section-header .badge {
  background: var(--accent-dim); color: var(--accent);
  padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700;
}

/* Generate form */
.gen-form {
  display: grid; grid-template-columns: auto 1fr auto auto auto;
  gap: 8px; align-items: end;
}
.gen-form label { font-size: 12px; color: var(--text-muted); }
.gen-form input, .gen-form select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px 12px;
  font-family: var(--sans); font-size: 13px;
}
.gen-form input:focus, .gen-form select:focus {
  outline: none; border-color: var(--accent);
}
.gen-form input[type="date"] { width: 150px; }
.gen-form select { width: 180px; }
.btn {
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  padding: 8px 20px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--accent); color: var(--bg);
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}

/* Progress */
.progress-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; margin-top: 16px;
  display: none;
}
.progress-box.active { display: block; }
.progress-box .step {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 13px;
}
.progress-box .step .icon { width: 18px; text-align: center; }
.progress-box .step.done { color: var(--green); }
.progress-box .step.running { color: var(--accent); }
.progress-box .step.pending { color: var(--text-muted); }
.progress-box .log {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--text-muted); line-height: 1.6;
  max-height: 200px; overflow-y: auto; white-space: pre-wrap;
}

/* File list */
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px;
  text-decoration: none; color: var(--text);
  transition: background 0.15s;
}
.file-item:hover { background: var(--surface-hover); }
.file-item .file-icon { font-size: 18px; opacity: 0.6; }
.file-item .file-name { flex: 1; font-weight: 500; }
.file-item .file-type {
  font-size: 11px; padding: 2px 8px; border-radius: 3px;
  background: var(--accent-dim); color: var(--accent); font-weight: 700;
}
.file-item .file-type.candidates {
  background: rgba(99, 102, 241, 0.1); color: #818cf8;
}
.file-item .file-date { color: var(--text-muted); font-size: 12px; }
.file-item .file-del {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 4px;
  padding: 4px 8px; font-size: 11px; cursor: pointer;
  font-family: var(--sans); transition: color 0.15s, border-color 0.15s;
}
.file-item .file-del:hover { color: var(--red); border-color: var(--red); }

.empty { color: var(--text-muted); font-size: 13px; padding: 20px 0; }

/* View toggle */
.view-toggle {
  display: flex; gap: 4px; margin-left: 8px;
}
.view-toggle .view-btn {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.view-toggle .view-btn:hover { color: var(--text); }
.view-toggle .view-btn.active {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-dim);
}

/* Calendar */
.calendar { padding: 4px 0; }
.cal-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 12px; font-weight: 700;
}
.cal-nav button {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 4px;
  width: 28px; height: 28px; font-size: 16px; cursor: pointer;
}
.cal-nav button:hover { background: var(--surface-hover); }
.cal-nav span { min-width: 120px; text-align: center; }

.cal-grid {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.cal-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 4px;
  align-items: stretch;
}
.cal-row-header { color: var(--text-muted); }
.cal-row-header .cal-dow {
  text-align: center; font-weight: 600; padding: 6px 0;
}
.cal-week-label {
  display: flex; align-items: center; justify-content: flex-end;
  color: var(--text-muted); font-weight: 600; padding-right: 6px;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  position: relative;
}
.cal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 4px;
  min-height: 70px;
  color: var(--text-muted);
  font-size: 11px;
}
.cal-day.other-month { opacity: 0.3; }
.cal-day.today {
  color: var(--accent);
  font-weight: 700;
}
.cal-post-bar {
  position: absolute;
  left: 2px; right: 2px;
  padding: 6px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-weight: 700; font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  z-index: 2;
  transition: filter 0.15s;
}
.cal-post-bar:hover { filter: brightness(1.2); }

@media (max-width: 640px) {
  .gen-form {
    grid-template-columns: 1fr 1fr;
  }
  .gen-form .btn { grid-column: 1 / -1; }
  .cal-row { grid-template-columns: 24px 1fr; font-size: 10px; }
  .cal-day { min-height: 58px; padding: 4px 2px; }
  .cal-post-bar { padding: 4px 6px; font-size: 10px; }
}
