/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #ffffff;
  --bg-warm:      #f6f5f4;
  --surface:      #ffffff;
  --border:       rgba(0, 0, 0, 0.1);
  --border-input: #dddddd;

  --text:         rgba(0, 0, 0, 0.95);
  --text-sec:     #615d59;
  --text-muted:   #a39e98;

  --blue:         #0075de;
  --blue-dark:    #005bab;
  --blue-focus:   #097fe8;
  --blue-badge-bg:   #f2f9ff;
  --blue-badge-text: #097fe8;

  --success:      #1aae39;
  --success-bg:   #f0fdf4;
  --success-border: rgba(26, 174, 57, 0.25);

  --danger:       #dd5b00;
  --danger-bg:    #fff7ed;
  --danger-border: rgba(221, 91, 0, 0.25);

  --warn:         #dd5b00;
  --warn-bg:      #fff7ed;
  --warn-border:  rgba(221, 91, 0, 0.2);

  --shadow-card:
    rgba(0,0,0,0.04)  0px 4px 18px,
    rgba(0,0,0,0.027) 0px 2.025px 7.85px,
    rgba(0,0,0,0.02)  0px 0.8px 2.93px,
    rgba(0,0,0,0.01)  0px 0.175px 1.04px;

  --radius-btn:  4px;
  --radius-sm:   4px;
  --radius:      8px;
  --radius-card: 12px;
  --radius-pill: 9999px;
}

html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Nav ===== */
.nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  text-decoration: none;
}
.nav-logo:hover { text-decoration: none; color: var(--text); }
.nav-logo-icon {
  width: 22px;
  height: 22px;
  background: var(--text);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 2px; }
.nav-link {
  color: var(--text-sec);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.12s, background 0.12s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--bg-warm); text-decoration: none; }
.nav-link.is-active { color: var(--blue); background: var(--blue-badge-bg); font-weight: 600; }
.nav-link.is-active:hover { color: var(--blue-dark); background: var(--blue-badge-bg); }

/* ===== Container ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.page-subtitle {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }

.btn-ghost {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.08); color: var(--text); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: #ffe8d5; }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.btn-success:hover { background: #dcfce7; }

.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-lg  { padding: 8px 20px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ===== Inputs ===== */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus {
  border-color: var(--blue-focus);
  box-shadow: 0 0 0 2px rgba(7, 127, 232, 0.15);
}
.input::placeholder { color: var(--text-muted); }

.input-lg { font-size: 14px; padding: 8px 12px; }
.input-json {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 12px;
  resize: vertical;
  line-height: 1.6;
  background: var(--bg-warm);
}

.select {
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.select:focus {
  border-color: var(--blue-focus);
  box-shadow: 0 0 0 2px rgba(7, 127, 232, 0.15);
}

/* ===== Filter Bar ===== */
.filter-bar { margin-bottom: 16px; }
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-group .input  { max-width: 240px; }
.filter-group .select { min-width: 120px; }

/* ===== Bulk Action Bar ===== */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--blue-badge-bg);
  border: 1px solid rgba(7, 127, 232, 0.25);
  border-radius: var(--radius-card);
}
.bulk-info { font-size: 13px; color: var(--text); margin-right: 4px; }
.bulk-info strong { color: var(--blue); }
.bulk-bar .select { min-width: 160px; }

.row-check, #selectAll {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--blue);
}

/* ===== Table ===== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead {
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
}
.table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-sec);
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { background: var(--bg); transition: background 0.1s; }
.table tbody tr:hover { background: var(--bg-warm); }
.table tbody tr.row-hidden { opacity: 0.4; }

.thumb {
  width: 64px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}
.thumb-empty {
  width: 64px;
  height: 36px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.video-title {
  color: var(--text);
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 280px;
  line-height: 1.4;
  text-decoration: none;
}
.video-title:hover { color: var(--blue); text-decoration: underline; }
.video-channel {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Text Utilities ===== */
.text-muted  { color: var(--text-muted); }
.text-green  { color: var(--blue); }        /* accent color in new theme */
.text-danger { color: var(--danger); }
.text-mono   { font-family: 'JetBrains Mono', 'Menlo', monospace; font-size: 12px; }

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 14px;
  font-size: 13px;
}

/* ===== Status Badges ===== */
.badge-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.badge-toggle:active { transform: scale(0.95); }

.badge-visible {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.badge-visible:hover { background: #dcfce7; }

.badge-hidden {
  background: var(--bg-warm);
  color: var(--text-muted);
  border-color: var(--border);
}
.badge-hidden:hover { background: #ece9e6; }

.badge-step {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  background: var(--bg);
  text-decoration: none;
}
.page-btn:hover { border-color: rgba(0,0,0,0.2); color: var(--text); background: var(--bg-warm); text-decoration: none; }
.page-btn-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 600;
}
.page-btn-active:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.page-info { margin-left: 8px; font-size: 12px; color: var(--text-muted); }
.page-ellipsis { display: inline-flex; align-items: center; padding: 5px 4px; font-size: 13px; color: var(--text-muted); }

/* ===== Video Header Card ===== */
.video-header-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.video-header-thumb {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.video-header-info { flex: 1; min-width: 0; }
.video-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: block;
  margin-bottom: 8px;
  text-decoration: none;
}
.video-header-title:hover { color: var(--blue); text-decoration: underline; }
.video-header-meta { display: flex; align-items: center; gap: 10px; }
.video-header-actions { flex-shrink: 0; }

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-section { margin-bottom: 24px; }
.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 8px;
}
.label-code {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-warm);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-weight: 400;
}

/* AI 추천 */
.ai-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--warn);
}
.ai-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(221, 91, 0, 0.12);
  border: 1px solid var(--warn-border);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
  color: var(--warn);
}
.btn-apply {
  margin-left: auto;
  background: transparent;
  color: var(--warn);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-apply:hover { background: rgba(221, 91, 0, 0.08); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header .form-label { margin-bottom: 0; }
.section-actions { display: flex; gap: 6px; }

/* ===== Recipe Steps ===== */
.steps-list { display: flex; flex-direction: column; gap: 8px; }
.step-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: box-shadow 0.12s;
}
.step-card:focus-within {
  box-shadow: var(--shadow-card);
  border-color: rgba(0,0,0,0.15);
}
.step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  flex-shrink: 0;
}
.step-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'JetBrains Mono', monospace;
}
.step-timer {
  font-size: 11px;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 4px;
  padding: 1px 6px;
}
.step-instruction {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  line-height: 1.5;
  font-size: 13px;
  background: var(--bg-warm);
}
.step-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}
.ingredient-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-badge-bg);
  border: 1px solid rgba(7, 127, 232, 0.2);
  color: var(--text-sec);
  font-weight: 500;
}
.ingredient-qty {
  color: var(--blue-badge-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
}
/* 타이머 / 타임스탬프 입력 */
.step-ti {
  width: 90px;
  font-size: 12px;
  padding: 3px 6px;
  text-align: center;
  flex-shrink: 0;
}
.step-vt {
  width: 68px;
  font-size: 12px;
  padding: 3px 6px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* 재료 3-column 그리드 */
.step-ingredients-grid {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ing-grid-header,
.ing-grid-row {
  display: grid;
  grid-template-columns: 1fr 80px 64px 28px;
  gap: 6px;
  align-items: center;
}
.ing-grid-header span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0 2px 2px;
}
.ing-grid-row .input,
.step-ingredients-grid .input {
  font-size: 12px;
  padding: 4px 8px;
  width: 100%;
}
.ing-remove {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted, #a39e98); font-size: 18px; line-height: 1;
  padding: 0; border-radius: 4px; width: 24px; height: 24px;
  justify-self: center;
}
.ing-remove:hover { color: var(--danger, #dd5b00); background: rgba(0, 0, 0, 0.05); }

.empty-steps {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius);
  background: var(--bg-warm);
}
.raw-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* ===== Form Footer ===== */
.form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Alert ===== */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid;
}
.alert-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

/* ===== Error Page ===== */
.error-box {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  padding: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.error-icon   { font-size: 32px; margin-bottom: 16px; }
.error-title  { font-size: 18px; font-weight: 700; letter-spacing: -0.25px; margin-bottom: 10px; }
.error-message { color: var(--text-sec); margin-bottom: 24px; font-size: 13px; }

/* ===== Inline select in table ===== */
select.input-lg {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
select.input-lg:focus {
  border-color: var(--blue-focus);
  box-shadow: 0 0 0 2px rgba(7, 127, 232, 0.15);
}

.select-inline {
  width: 100%;
  font-size: 12px;
  padding: 4px 7px;
  background: transparent;
  border-color: transparent;
  color: var(--text-sec);
  border-radius: var(--radius-btn);
  font-weight: 500;
}
.select-inline:hover { border-color: var(--border-input); background: var(--bg); }
.select-inline:focus { border-color: var(--blue-focus); background: var(--bg); color: var(--text); box-shadow: 0 0 0 2px rgba(7,127,232,0.12); }

.ai-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  padding-left: 2px;
}

/* ===== Inline text editing in table ===== */
.cell-editable-wrap { min-width: 120px; }
.inline-field { display: flex; flex-direction: column; gap: 4px; }
.inline-text {
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.1s;
  line-height: 1.4;
  font-weight: 500;
}
.inline-text:hover { background: rgba(0, 117, 222, 0.06); }
.inline-input {
  padding: 4px 8px;
  font-size: 13px;
  height: auto;
}
.ai-apply-btn {
  display: inline-block;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  text-align: left;
  letter-spacing: 0.1px;
}
.ai-apply-btn:hover { background: #ffe8d5; }
.ai-apply-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  pointer-events: none;
  border: 1px solid;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.18s ease;
}
.toast-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.toast-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Queue Page ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}
.stat-card.stat-success { border-color: var(--success-border); background: var(--success-bg); }
.stat-card.stat-danger  { border-color: var(--danger-border);  background: var(--danger-bg); }
.stat-card.stat-blue    { border-color: rgba(0,117,222,0.2);   background: var(--blue-badge-bg); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1;
}
.stat-success .stat-value { color: var(--success); }
.stat-danger  .stat-value { color: var(--danger); }
.stat-blue    .stat-value { color: var(--blue); }

.queue-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .queue-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
  background: var(--bg-warm);
}
.panel-body { padding: 16px; }

.category-breakdown { display: flex; flex-direction: column; gap: 5px; }
.breakdown-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.breakdown-cat { color: var(--text-sec); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown-bar-wrap { height: 6px; background: var(--bg-warm); border-radius: 3px; overflow: hidden; }
.breakdown-bar { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.3s; min-width: 2px; }
.breakdown-cnt { text-align: right; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.preview-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  color: var(--text-sec);
}
.preview-badge-ok  { background: var(--blue-badge-bg); border-color: rgba(0,117,222,0.25); color: var(--blue); }
.preview-badge-err { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

/* 큐 상태 배지 */
.q-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.q-pending    { background: var(--bg-warm); color: var(--text-muted); border-color: var(--border); }
.q-processing { background: var(--blue-badge-bg); color: var(--blue); border-color: rgba(0,117,222,0.2); }
.q-completed  { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.q-failed     { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

/* ===== Crawl Page ===== */
.term-list { display: flex; flex-direction: column; }
.term-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.term-row:last-child { border-bottom: none; }
.term-name { flex: 1; color: var(--text); font-weight: 500; }
.term-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.1s;
}
.term-remove:hover { color: var(--danger); }

.crawl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.crawl-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.crawl-stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.crawl-stat-val   { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); line-height: 1; }

.progress-bar-wrap {
  height: 6px;
  background: var(--bg-warm);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.log-box {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.log-entry {
  padding: 3px 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-success { color: var(--success); }
.log-error   { color: var(--danger); }
.log-info    { color: var(--blue); }
.log-muted   { color: var(--text-muted); }

/* ===== Reports Page ===== */
.report-content {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--text-sec);
  cursor: default;
}
.cat-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--blue-badge-bg);
  color: var(--blue-badge-text);
  border: 1px solid rgba(0,117,222,0.15);
}
.text-blue { color: var(--blue); }

/* ===== Loading ===== */
.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}

/* ===== Misc ===== */
.link-external::after {
  content: ' ↗';
  font-size: 10px;
  opacity: 0.4;
}

/* ===== 인라인 row 편집 — Navigation 등에서 사용 ===== */
.drag-handle {
  cursor: grab;
  color: var(--text-muted, #999);
  text-align: center;
  user-select: none;
  font-size: 14px;
  letter-spacing: -2px;
  width: 28px;
}
.drag-handle:active { cursor: grabbing; }
tr.row-dragging { opacity: 0.4; }
tr.row-drop-target td { box-shadow: inset 0 2px 0 0 var(--blue); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

/* ===== self-hosted 아이콘 커스텀 드롭다운 ===== */
.icon-select { position: relative; display: inline-block; min-width: 160px; }
.icon-select-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn, 6px);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.icon-select-btn:hover { border-color: var(--blue-focus); }
.icon-select-btn:focus { outline: none; border-color: var(--blue-focus); box-shadow: 0 0 0 2px rgba(7,127,232,0.15); }
.icon-select-thumb {
  width: 22px; height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
  background: repeating-conic-gradient(#f3f3f3 0% 25%, #fafafa 0% 50%) 50% / 8px 8px;
}
.icon-select-thumb-empty { background: var(--bg-warm); }
.icon-select-text {
  flex: 1; text-align: left; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-select-caret { color: var(--text-muted, #999); font-size: 10px; }
.icon-select-menu {
  position: fixed;
  width: 900px;
  max-width: calc(100vw - 16px);
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn, 6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: 480px;
  overflow-y: auto;
  padding: 0;
}
.icon-select-items {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  padding: 8px;
}
.icon-select-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  color: var(--text);
  font-family: inherit;
  transition: background 0.08s, border-color 0.08s, transform 0.06s;
}
.icon-select-item:hover { transform: scale(1.05); }
.icon-select-item:hover,
.icon-select-item.is-active { background: var(--bg-warm); border-color: var(--border-input); }
.icon-select-item.is-selected { background: var(--blue-badge-bg); border-color: var(--blue); }
.icon-select-item img { width: 100%; height: 100%; object-fit: contain; }
.icon-select-clear {
  display: block;
  width: calc(100% - 8px);
  margin: 4px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #888);
  font-family: inherit;
  aspect-ratio: auto;
}
.icon-select-clear:hover,
.icon-select-clear.is-active { background: var(--bg-warm); border-color: var(--border-input); }
.icon-select-clear.is-selected { background: var(--blue-badge-bg); border-color: var(--blue); color: var(--blue); }
.icon-select-search-wrap {
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: 4px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.icon-select-search {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.icon-select-search:focus { border-color: var(--blue-focus); box-shadow: 0 0 0 2px rgba(7,127,232,0.12); }
.icon-select-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #888);
}

/* ===== 알림 발송 카드 (notifications/list.ejs) ===== */
.send-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; margin-bottom: 24px; display: flex; flex-direction: column; gap: 18px; }
.send-row { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.send-row-textarea { align-items: start; }
@media (max-width: 640px) { .send-row { grid-template-columns: 1fr; gap: 6px; } }
.send-label { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0.01em; }
.send-row-textarea .send-label { padding-top: 10px; }
.send-control { position: relative; min-width: 0; }
.send-input, .send-textarea { width: 100%; font-size: 14px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-input); border-radius: var(--radius-btn, 6px); color: var(--text); font-family: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
.send-textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.send-input:focus, .send-textarea:focus { outline: none; border-color: var(--blue-focus); box-shadow: 0 0 0 2px rgba(7, 127, 232, 0.15); }
.send-hint { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; background: var(--bg); padding: 0 4px; pointer-events: none; }
.send-hint-static { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.send-row:not(.send-row-textarea) .send-hint { top: 50%; bottom: auto; transform: translateY(-50%); }
.send-actions { display: flex; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px; }
.btn-send { padding: 10px 22px; font-size: 14px; font-weight: 600; }

/* ===== Segmented control ===== */
.seg { display: inline-flex; background: var(--bg-warm); border: 1px solid var(--border-input); border-radius: var(--radius-btn, 6px); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: 0; background: transparent; color: var(--text-sec); padding: 6px 14px; font-size: 13px; font-weight: 500; border-radius: 4px; cursor: pointer; transition: background 0.12s, color 0.12s, box-shadow 0.12s; font-family: inherit; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--surface); color: var(--blue); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.seg-btn:focus-visible { outline: 2px solid var(--blue-focus); outline-offset: 1px; }
.seg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-link { background: none; border: 0; color: var(--blue); cursor: pointer; font-size: 12.5px; padding: 4px 6px; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #c0392b; }

.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff7e6; border: 1px solid #f5c97a; border-radius: 6px; font-size: 13px; color: #8a5a00; margin-bottom: 4px; }
.edit-banner .btn-link { color: #8a5a00; font-weight: 600; }

/* ===== User custom select (chips + dropdown) ===== */
.user-select { position: relative; }
.user-select .us-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.user-select .us-chips:empty { display: none; }
.user-select .us-search { width: 100%; font-size: 13.5px; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border-input); border-radius: var(--radius-btn, 6px); color: var(--text); font-family: inherit; }
.user-select .us-search:focus { outline: none; border-color: var(--blue-focus); box-shadow: 0 0 0 2px rgba(7, 127, 232, 0.15); }
.user-select .us-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; background: var(--bg-warm); border: 1px solid var(--border-input); border-radius: 999px; font-size: 12.5px; max-width: 280px; }
.user-select .us-chip-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.user-select .us-chip-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; border-radius: 999px; }
.user-select .us-chip-x:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.user-select .us-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); z-index: 100; }
.user-select .us-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; cursor: pointer; font-family: inherit; border-bottom: 1px solid var(--border); }
.user-select .us-item:last-child { border-bottom: 0; }
.user-select .us-item:hover, .user-select .us-item.is-active { background: var(--bg-warm); }
.user-select .us-item-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-select .us-item-sub { font-size: 11.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.user-select .us-empty { padding: 12px; font-size: 12.5px; color: var(--text-muted); text-align: center; }
