:root {
  --bg: #fafafa;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --line: #e5e5e5;
  --accent: #ff5a36;
  --accent-soft: #fff0ec;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
    "Helvetica Neue", Arial, sans-serif;
  padding: 16px 32px 80px;
}

/* ── Top tabs ──────────────────────────────────── */
.top-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.top-tabs .tab {
  padding: 10px 18px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  transition: background 0.1s, color 0.1s;
}
.top-tabs .tab:hover {
  color: var(--text);
  background: #f4f4f4;
}
.top-tabs .tab.active {
  color: var(--accent);
  background: var(--card);
  border-color: var(--line);
  border-bottom: 1px solid var(--card);
}
header { margin-bottom: 24px; }
h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.filters input,
.filters select,
.filters button {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.filters input { flex: 1 1 240px; min-width: 160px; }
.filters input:focus,
.filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters button {
  cursor: pointer;
  background: #f4f4f4;
}
.filters button:hover { background: #ececec; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.thumb {
  aspect-ratio: 4 / 5;
  background: #f0f0f0 center/cover no-repeat;
  position: relative;
  display: block;
}
.thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #bbb;
  height: 100%;
}
.platform-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
}
.platform-badge.instagram {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.platform-badge.youtube { background: #ff0000; }
.platform-badge.youtube-shorts { background: #000; }
.platform-badge.tiktok { background: #000; border: 1px solid #25f4ee; }
.platform-badge.twitter { background: #000; }
.platform-badge.slack-upload { background: #4a154b; } /* Slack 보라색 */
.platform-badge.other { background: rgba(0, 0, 0, 0.7); }
.body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.brand {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
}
.brand.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}
.actions a,
.actions button {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.actions a:hover,
.actions button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.actions a.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.actions a.primary:hover { background: #e64d2c; }
.actions button:disabled { opacity: 0.6; cursor: progress; }

footer { margin-top: 32px; text-align: center; }
footer button {
  font: inherit;
  padding: 10px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.empty { color: var(--muted); }

/* ── Section grouping ───────────────────────────── */
.section { margin-bottom: 32px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title .muted {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

/* ── AI tag chips ───────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 2px;
}
.chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.chip-cat  { background: #fff0ec; color: #c4351b; }
.chip-type { background: #eef4ff; color: #2553ab; }
.chip-mood { background: #f0fbf4; color: #1f7a3f; }

/* ── Memo on card ───────────────────────────────── */
.memo {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  margin: 8px 0 4px;
  background: #fafaf7;
  border: 1px dashed #ddd;
  border-radius: 6px;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  transition: background 0.1s;
}
.memo:hover { background: #f0f0eb; }
.memo .memo-icon { flex-shrink: 0; }
.memo .memo-text { flex: 1; line-height: 1.4; word-break: break-word; }
.memo .memo-by { color: var(--muted); font-size: 11px; margin-left: 4px; }
.memo .memo-add { color: var(--muted); font-style: italic; }
.memo.has-memo {
  background: #fff8e8;
  border-style: solid;
  border-color: #f0d488;
  color: #5a4318;
}

/* ── Transcript panel (inline expand) ──────────── */
.transcript-panel {
  margin-top: 8px;
  padding: 10px;
  background: #f5f8fa;
  border: 1px solid #d9e2e7;
  border-radius: 6px;
  font-size: 12px;
  color: #1a1a1a;
}
.transcript-loading {
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
}
.transcript-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
}
.transcript-lang { text-transform: uppercase; letter-spacing: 0.04em; }
.transcript-copy {
  font: inherit;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.transcript-copy:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.transcript-text {
  line-height: 1.55;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.transcript-error {
  color: #b8493b;
  background: #fff0ee;
  padding: 6px 8px;
  border-radius: 4px;
}

/* ── Modal ──────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
.modal-card h3 { margin: 0 0 12px; font-size: 16px; }
.modal-card textarea {
  width: 100%;
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  outline: none;
}
.modal-card textarea:focus { border-color: var(--accent); }
.modal-card .hint {
  margin: 8px 0;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-card .hint input {
  flex: 1;
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.modal-actions button {
  font: inherit;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.modal-actions button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.modal-actions button:hover { background: #f0f0f0; }
.modal-actions button.primary:hover { background: #e64d2c; }
