/* ─── Design System (solapi-inspired) ─── */
:root {
  --primary: #4361EE;
  --primary-dark: #3347CC;
  --primary-light: #6B83F2;
  --primary-bg: #EEF2FF;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #22C55E;
  --success-bg: #F0FDF4;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --error: #EF4444;
  --error-bg: #FEF2F2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --transition: 0.15s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.header-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}
.header-client {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.header-right { display: flex; align-items: center; }
.header-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ─── Tab Bar ─── */
.tab-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tab-bar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
}
.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ─── Main ─── */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tab-content { display: none; flex-direction: column; gap: 20px; }
.tab-content--active { display: flex; }

/* ─── Card ─── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card-actions { display: flex; gap: 8px; align-items: center; }
.card-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.card-body { padding: 20px 24px; }
.card-body--flush { padding: 0; }

/* ─── Forms ─── */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group--grow { flex: 1; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.required { color: var(--error); font-size: 11px; }
.optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-group textarea {
  resize: vertical;
  line-height: 1.5;
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover { background: var(--primary-dark); }
.btn--primary:disabled { background: var(--text-muted); cursor: not-allowed; }
.btn--outline {
  background: var(--card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}
.btn--ghost {
  background: none;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}
.btn--ghost:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.btn--icon {
  padding: 6px 12px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--icon:hover { background: var(--bg); }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; align-items: center; }

/* ─── SEO Checks ─── */
.seo-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
}
.seo-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.seo-check--pass { background: var(--success-bg); color: #166534; }
.seo-check--warn { background: var(--warning-bg); color: #92400E; }
.seo-icon { font-size: 14px; flex-shrink: 0; }

/* ─── Loading ─── */
.loading-body { text-align: center; padding: 48px 24px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: var(--text-muted); }

/* ─── Preview ─── */
.preview-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.preview-title-wrap { margin-bottom: 20px; }
.preview-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.preview-content { line-height: 1.8; }
.preview-content h3 {
  font-size: 17px;
  color: var(--text);
  margin: 28px 0 10px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-bg);
}
.preview-content p {
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--text-secondary);
}
.preview-content .expert-profile {
  background: var(--primary-bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 16px;
  border-left: 3px solid var(--primary);
}
.preview-content .simipil {
  background: var(--warning-bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Edit mode */
.edit-mode .preview-title {
  outline: none;
  border: 1px dashed var(--primary-light);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--primary-bg);
}
.edit-mode .preview-content [contenteditable="true"] {
  outline: none;
  border: 1px dashed transparent;
  border-radius: 4px;
  padding: 4px 8px;
  margin: -4px -8px;
  transition: all var(--transition);
}
.edit-mode .preview-content [contenteditable="true"]:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.edit-mode .preview-content [contenteditable="true"]:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.btn--edit-active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Preview images */
.preview-image-wrap {
  margin: 16px 0;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.preview-image-wrap:hover { box-shadow: 0 0 0 2px var(--primary-light); }
.preview-image-wrap::after {
  content: '클릭하여 편집';
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--transition);
}
.preview-image-wrap:hover::after { opacity: 1; }
.preview-image-wrap img { width: 100%; display: block; }

/* FAQ */
.faq-item { margin-bottom: 14px; }
.faq-q { font-weight: 700; color: var(--text); font-size: 15px; }
.faq-a { margin-top: 4px; font-size: 14px; color: var(--text-secondary); padding-left: 20px; }

/* 출처 검수 패널 — neutral 상태 */
.seo-check--neutral {
  background: var(--bg);
  border-left: 3px solid var(--text-muted);
}

/* 출처 인라인 링크 */
.source-link {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  margin-left: 2px;
}
.source-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── Tags ─── */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.sub-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.internal-links span {
  display: block;
  font-size: 14px;
  color: var(--primary-light);
  margin-bottom: 4px;
}

/* ─── Planner (List-based Calendar) ─── */

/* Summary bar */
.planner-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.ps-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.ps-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ps-icon--week { background: var(--primary-bg); }
.ps-icon--pub { background: var(--success-bg); }
.ps-icon--sched { background: #EEF2FF; }
.ps-icon--draft { background: var(--bg); }
.ps-info { display: flex; flex-direction: column; }
.ps-num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.ps-label { font-size: 12px; color: var(--text-muted); }

/* Filter pills */
.filter-pills { display: flex; gap: 6px; }
.pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.pill:hover { border-color: var(--primary-light); color: var(--text-secondary); }
.pill--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Week group */
.week-group { margin-bottom: 8px; }
.week-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
}
.week-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}
.week-badge {
  font-size: 11px;
  background: var(--bg);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 10px;
}
.week-line { flex: 1; height: 1px; background: var(--border-light); }
.week-this .week-label { color: var(--primary); }
.week-this .week-badge { background: var(--primary-bg); color: var(--primary); }

/* Content row */
.content-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.content-row:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.cr-date {
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}
.cr-date-day {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.cr-date-dow {
  font-size: 11px;
  color: var(--text-muted);
}

.cr-divider {
  width: 1px;
  height: 36px;
  background: var(--border-light);
  flex-shrink: 0;
}

.cr-body { flex: 1; min-width: 0; }
.cr-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-channel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.cr-channel--blog { background: #DCFCE7; color: #166534; }
.cr-channel--instagram { background: #FCE7F3; color: #9D174D; }
.cr-channel--kakao { background: #FEF3C7; color: #92400E; }

.cr-status {
  flex-shrink: 0;
}
.status-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.status-btn--published { background: var(--success-bg); color: #166534; }
.status-btn--published:hover { background: #BBF7D0; }
.status-btn--scheduled { background: var(--primary-bg); color: var(--primary-dark); }
.status-btn--scheduled:hover { background: #DDD6FE; }
.status-btn--draft { background: var(--bg); color: var(--text-muted); border: 1px dashed var(--border); }
.status-btn--draft:hover { background: #E2E8F0; }

.cr-actions {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.content-row:hover .cr-actions { opacity: 1; }
.cr-act {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}
.cr-act:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.cr-act--del:hover { border-color: var(--error); color: var(--error); background: var(--error-bg); }

/* Empty planner */
.planner-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Add content modal form */
.modal-form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.modal-form-row .form-group { flex: 1; }

/* ─── Stats Grid (CRM) ─── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
}
.table tr:hover td { background: var(--bg); }
.table .actions { display: flex; gap: 4px; }
.table .actions button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: inherit;
  transition: all var(--transition);
}
.table .actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Message Preview ─── */
.msg-preview {
  background: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  min-height: 60px;
  border: 1px solid var(--border-light);
}

/* ─── Send Logs ─── */
.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.log-item:last-child { border-bottom: none; }
.log-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.log-status--success { background: var(--success-bg); color: #166534; }
.log-status--fail { background: var(--error-bg); color: #991B1B; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; }
.modal-body .form-group { margin-bottom: 12px; }
.modal-body textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  text-align: right;
}
.modal-footer--actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 폼 모달 */
.modal--form {
  width: 480px;
}
.modal--form .form-row {
  display: flex;
  gap: 12px;
}
.modal--form .form-group {
  margin-bottom: 16px;
}

/* 이미지 편집 채팅 모달 */
.modal--edit-chat {
  width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-body--chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  flex: 1;
  overflow: hidden;
}
.edit-preview-wrap {
  text-align: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px;
  flex-shrink: 0;
}
.edit-preview-wrap img {
  max-height: 200px;
  border-radius: 6px;
}
.chat-history {
  flex: 1;
  min-height: 120px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-hint {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  padding: 16px 0;
}
.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}
.chat-msg--assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 2px;
}
.chat-msg--loading {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.chat-input-row .btn {
  flex-shrink: 0;
  height: 40px;
  align-self: flex-end;
}

/* ─── Keyword Analysis ─── */
.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat-num--sm { font-size: 18px; }
.stat-num--primary { color: var(--primary); }

.comp-high { color: #DC2626; }
.comp-mid { color: #D97706; }
.comp-low { color: #16A34A; }

.comp-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.comp-badge.comp-high { background: var(--error-bg); }
.comp-badge.comp-mid { background: var(--warning-bg); }
.comp-badge.comp-low { background: var(--success-bg); }

/* Sortable table headers */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
  white-space: nowrap;
}
.sortable:hover { color: var(--primary); }
.sortable .sort-icon::after { content: '\2195'; margin-left: 4px; font-size: 11px; opacity: 0.3; }
.sortable.sort-active .sort-icon::after { opacity: 1; color: var(--primary); }
.sortable.sort-asc .sort-icon::after { content: '\2191'; }
.sortable.sort-desc .sort-icon::after { content: '\2193'; }

/* Trend bar chart */
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-top: 12px;
}
.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.trend-bar {
  width: 100%;
  max-width: 48px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: height 0.3s ease;
}
.trend-bar:hover { background: var(--primary-dark); }
.trend-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
}
.trend-bar:hover .trend-val { opacity: 1; }
.trend-month {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Blog results */
.blog-result-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.blog-result-item:last-child { border-bottom: none; }
.blog-result-item:hover { background: var(--bg); }
.blog-rank {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-result-body { flex: 1; min-width: 0; }
.blog-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blog-result-title:hover { color: var(--primary); }
.blog-result-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.blog-result-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .header-inner { padding: 0 16px; }
  .header-badge { display: none; }
  .tab-bar-inner { padding: 0 16px; }
  .main { padding: 16px; }
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }
  .stats-grid, .stats-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .cal-cell { min-height: 80px; padding: 4px; }
  .cal-item { font-size: 10px; padding: 2px 4px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }
}

/* ─── Draft bar / Assets / Ideas (추가 기능) ─── */
.draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.draft-bar-left { display: flex; gap: 8px; }
.draft-status {
  font-size: 12px;
  color: var(--text-muted);
}

.asset-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.asset-help {
  font-size: 12px;
  color: var(--text-muted);
}
.asset-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.asset-thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  aspect-ratio: 1 / 1;
}
.asset-thumb:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.asset-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  line-height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.asset-thumb-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 10px;
  padding: 3px 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 섹션 선택 하이라이트 (이미지 삽입 대상) */
.preview-content h3.section-selected,
.preview-content p.section-selected {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
  border-radius: 4px;
}
.uploaded-inserted-img {
  display: block;
  max-width: 100%;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.uploaded-inserted-wrap {
  position: relative;
  margin: 12px 0;
}
.uploaded-inserted-wrap .uploaded-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 14px;
}

/* Ideas 리스트 */
.idea-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  background: var(--card);
}
.idea-item:hover { border-color: var(--primary); }
.idea-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.idea-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.idea-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.idea-volume {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary-dark);
}
.idea-volume--높음 { background: #DCFCE7; color: #166534; }
.idea-volume--중간 { background: #FEF3C7; color: #92400E; }
.idea-volume--낮음 { background: #F1F5F9; color: #475569; }

/* Drafts 리스트 */
.draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  gap: 8px;
}
.draft-info { flex: 1; min-width: 0; }
.draft-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-date {
  font-size: 11px;
  color: var(--text-muted);
}
.draft-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ═══════════════════════════════════════════
   Floating Inline Toolbar (rich text formatting)
   ═══════════════════════════════════════════ */
.inline-toolbar {
  position: absolute;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #1A1A2E;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
  font-family: 'Pretendard', -apple-system, sans-serif;
  color: #fff;
  user-select: none;
  animation: itbFadeIn 0.12s ease-out;
}
@keyframes itbFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.itb-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.itb-btn:hover { background: rgba(255, 255, 255, 0.14); }
.itb-btn strong { font-weight: 800; }
.itb-btn em { font-style: italic; }
.itb-btn u { text-decoration: underline; }
.itb-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 4px;
}
.itb-ico { font-size: 12px; letter-spacing: -0.2px; }

.itb-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1A1A2E;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  min-width: 160px;
  animation: itbFadeIn 0.1s ease-out;
}
.itb-pop-title {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
  font-weight: 600;
}
.itb-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.itb-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.itb-swatch:hover {
  transform: scale(1.12);
  border-color: #fff;
}

/* ─── Draft Loader: CARD/IMG placeholders (v2.1 치매보험 초안) ─── */
.draft-card-placeholder {
  margin: 20px 0;
  text-align: center;
}
.draft-card-placeholder img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.draft-img-placeholder {
  margin: 20px 0;
  padding: 32px 20px;
  border: 2px dashed #CBD5E1;
  border-radius: 8px;
  background: #F8FAFC;
  text-align: center;
  color: #64748B;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.draft-img-placeholder .dip-label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.3px;
}
.draft-img-placeholder .dip-desc {
  font-size: 13px;
  color: #64748B;
}

/* 네이버용 복사 버튼 강조 */
#btn-copy-naver {
  font-weight: 700;
}

/* ─── Login Overlay ─── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden {
  display: none;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.login-form .form-group {
  text-align: left;
  margin-bottom: 16px;
}
.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.login-form input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition);
  outline: none;
}
.login-form input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.login-error {
  font-size: 13px;
  color: var(--error);
  background: var(--error-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  text-align: left;
}
.btn--full {
  width: 100%;
  justify-content: center;
}

/* 로그아웃 버튼 */
.btn-logout {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition), border-color var(--transition);
}
.btn-logout:hover {
  color: var(--error);
  border-color: var(--error);
}
