/* ================================================================
   Settings / Novels list / Characters page
   ================================================================ */
.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}
.page-title {
  font-size: 26px;
  margin-bottom: 6px;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin-bottom: 28px;
  line-height: 1.55;
}
.section { margin-bottom: 32px; }
.section h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.section h2 .section-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.toolbar .spacer { flex: 1; }

/* ===== Novels grid ===== */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.novel-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.novel-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #ec4899));
  opacity: 0;
  transition: opacity .25s;
}
.novel-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.novel-card:hover::before { opacity: 1; }
.novel-card .title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.novel-card .meta {
  font-size: 11px;
  color: var(--fg-faint);
  font-feature-settings: "tnum";
}
.novel-card .desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.novel-card .actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

/* ===== Settings — agent cards ===== */
.agent-config {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.agent-config-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: 18px 20px;
  transition: border-color .2s, box-shadow .2s;
}
.agent-config-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.agent-config-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.agent-config-card .agent-key {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-muted);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--fg-muted);
  font-weight: 500;
  border: 1px solid var(--border);
}
.agent-config-card .field { margin-bottom: 12px; }
.agent-config-card textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 130px;
}

.template-block textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 240px;
}

/* ===== Characters page ===== */
.char-list {
  display: flex; flex-direction: column; gap: 10px;
}
.char-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .2s, box-shadow .2s;
}
.char-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.char-row .name {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}
.char-row .meta {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.char-row .body { flex: 1; min-width: 0; }
.char-row .actions { display: flex; gap: 6px; }
.tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 3px 9px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--fg-muted);
  margin-right: 4px;
  font-weight: 500;
}

.kv-editor {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg-subtle);
  display: flex; flex-direction: column; gap: 8px;
}
.kv-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 6px;
  align-items: start;
}
.kv-row .input { padding: 6px 9px; font-size: 12px; }
.kv-row textarea { padding: 6px 9px; font-size: 12px; min-height: 36px; line-height: 1.5; }

/* ===== Empty states ===== */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}
.empty p { margin-bottom: 14px; font-size: 13.5px; }

/* ================================================================
   Settings page tabs
   ================================================================ */
.settings-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
  overflow-x: auto;
  width: fit-content;
}
.settings-tabs button {
  padding: 8px 18px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
  font-family: inherit;
}
.settings-tabs button:hover { color: var(--fg); }
.settings-tabs button.active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.settings-pane { display: none; }
.settings-pane.active { display: block; animation: fade-in-up .2s ease-out; }
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ================================================================
   Agent sub-tabs (settings 안의 에이전트 페이지 안에서 사용)
   ================================================================ */
.agent-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.agent-tabs button {
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s, background .15s;
  font-family: inherit;
  border-radius: var(--radius) var(--radius) 0 0;
}
.agent-tabs button:hover:not(.active) {
  color: var(--fg);
  background: var(--bg-hover);
}
.agent-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
