:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d8e0ea;
  --blue: #2563eb;
  --green: #12805c;
  --red: #c2413b;
  --amber: #a16207;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans KR",
    sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.1;
}

.dashboard-title {
  font-size: clamp(20px, 1.95vw, 27px);
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-width: 86px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.status-pill.running {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--blue);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}

.control-panel,
.summary-grid,
.progress-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 12px;
  padding: 16px;
  align-items: end;
}

.field-row {
  display: grid;
  gap: 7px;
}

label,
.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfe;
}

input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.12);
}

button {
  min-width: 96px;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  background: #94a3b8;
  cursor: wait;
}

button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--red);
}

button.secondary:disabled {
  background: #eef2f7;
  color: #94a3b8;
}

button.danger {
  min-width: 70px;
  border: 1px solid rgba(194, 65, 59, 0.35);
  background: #ffffff;
  color: var(--red);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
}

.metric {
  display: grid;
  place-content: center;
  min-height: 96px;
  background: #fbfcfe;
  text-align: center;
}

.metric strong {
  margin-top: 6px;
  font-size: 28px;
}

.progress-area {
  margin-top: 16px;
  padding: 16px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.sheet-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.hidden {
  display: none;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: #e6ebf2;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.log {
  display: grid;
  gap: 8px;
  max-height: 560px;
  margin: 16px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.log-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.log-item strong {
  color: var(--ink);
}

.log-item span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.log-item.success {
  border-color: rgba(18, 128, 92, 0.28);
}

.log-item.success strong {
  color: var(--green);
}

.log-item.error {
  border-color: rgba(194, 65, 59, 0.28);
}

.log-item.error strong {
  color: var(--red);
}

.keyword-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.editor-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.keyword-list {
  display: grid;
  gap: 8px;
}

.keyword-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.keyword-index {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.editor-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.editor-message.success {
  color: var(--green);
}

.editor-message.error {
  color: var(--red);
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 680px);
    padding: 20px 0;
  }

  .topbar,
  .workspace,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .nav-actions,
  .editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .keyword-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .keyword-row button {
    grid-column: 2;
  }

  .log-item {
    grid-template-columns: 1fr;
  }
}
