:root {
  --bg-app: #f4f4f4;
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f7f7f7;
  --bg-input: #ffffff;
  --bg-phone: #f1f5f9;

  --border-light: #e5e7eb;
  --border-subtle: #f0f0f0;
  --border-focus: #0f172a;

  --text-main: #0f172a;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --primary-black: #0f172a;
  --primary-hover: #1e293b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-modal: 0 20px 60px -10px rgba(0,0,0,0.18);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── APP LAYOUT ─────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  height: 100vh;
  overflow-y: auto;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--primary-black);
  margin-bottom: 1.1rem;
}

.workspace-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  cursor: pointer;
  background: var(--bg-surface);
}

.workspace-info { display: flex; align-items: center; gap: 9px; }

.workspace-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}

.workspace-text h4 { font-size: 0.8rem; font-weight: 600; line-height: 1.2; }
.workspace-text span { font-size: 0.68rem; color: var(--text-muted); }

.btn-new-automation {
  width: 100%;
  background: var(--primary-black);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.83rem;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer;
  margin-bottom: 1.4rem;
  transition: background 0.18s;
}
.btn-new-automation:hover { background: var(--primary-hover); }

.nav-group { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.855rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.nav-item:hover { color: var(--text-main); background: var(--bg-card-subtle); }
.nav-item.active { color: var(--primary-black); background: var(--bg-card-subtle); font-weight: 600; }

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-light); }
.usage-row { display: flex; justify-content: space-between; font-size: 0.73rem; color: var(--text-muted); font-weight: 500; margin-bottom: 5px; }
.progress-bg { height: 4px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; width: 15%; background: var(--primary-black); border-radius: 99px; }

/* ─── CONTENT AREA ───────────────────────────────── */
.content-area { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ─── TOP BAR ────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem;
  flex-shrink: 0;
}

.trigger-pills {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-light);
  gap: 2px;
}
.trigger-pill {
  border: none; background: transparent;
  padding: 5px 13px;
  border-radius: 7px;
  font-size: 0.785rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer; transition: all 0.18s;
}
.trigger-pill.active { background: #fff; color: var(--primary-black); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

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

.btn-outline {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-outline:hover { background: var(--bg-card-subtle); }

.btn-start {
  background: var(--primary-black);
  color: #fff; border: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.btn-start:hover { background: var(--primary-hover); }

/* ─── BUILDER CANVAS ─────────────────────────────── */
.builder-canvas {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ─── LEFT PHONE PANE ────────────────────────────── */
.phone-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem 1rem;
  background: var(--bg-phone);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
}

.pane-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 1rem;
  align-self: flex-start;
  padding-left: 1rem;
}

/* iPhone Frame */
.phone-frame {
  width: 310px;
  background: #111;
  border-radius: 48px;
  padding: 11px;
  box-shadow: 0 24px 56px -8px rgba(0,0,0,0.32), 0 0 0 1.5px #333;
  flex-shrink: 0;
}
.phone-screen {
  background: #000;
  border-radius: 38px;
  width: 100%;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  color: #fff;
}

.phone-notch {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px; height: 20px;
  background: #000;
  border-radius: 12px;
  z-index: 20;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  position: relative;
  z-index: 10;
}

.status-icons { display: flex; align-items: center; gap: 4px; }

/* IG-style DM header */
.ig-dm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-bottom: 1px solid #1a1a1a;
}
.ig-avatar-wrap {
  position: relative;
}
.ig-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  color: #fff;
}
.ig-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #000;
}
.ig-dm-info { flex: 1; }
.ig-dm-username { font-size: 0.8rem; font-weight: 700; color: #fff; }
.ig-dm-sub { font-size: 0.67rem; color: #888; }
.ig-dm-actions { display: flex; gap: 12px; color: #fff; }
.ig-dm-actions svg { width: 18px; height: 18px; }

/* Chat bubbles */
.chat-messages {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.msg-row { display: flex; align-items: flex-end; gap: 6px; }
.msg-row.me { flex-direction: row-reverse; }

.msg-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700;
  flex-shrink: 0;
}

.bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 20px;
  font-size: 0.76rem;
  line-height: 1.4;
  font-weight: 400;
}
.bubble.them {
  background: #262626;
  color: #fff;
  border-bottom-left-radius: 5px;
}
.bubble.me {
  background: #3797f0;
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* Message action button in DM (like "Following" or "Send me the link") */
.bubble-action-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  width: 100%;
}

.no-msgs {
  text-align: center;
  color: #555;
  font-size: 0.75rem;
  margin: auto;
}

/* DM Input Bar */
.ig-dm-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid #1a1a1a;
}
.ig-input-pill {
  flex: 1;
  background: #1a1a1a;
  border-radius: 22px;
  padding: 7px 14px;
  font-size: 0.73rem;
  color: #555;
  border: 1px solid #2a2a2a;
}
.ig-input-icons { display: flex; gap: 10px; color: #555; }
.ig-input-icons svg { width: 19px; height: 19px; }

/* Story View inside Phone */
.phone-story-view {
  display: flex; flex-direction: column;
  height: 100%;
  background: #111;
  position: relative;
}
.story-bg {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 20px;
}
.story-kw-callout {
  background: rgba(0,0,0,0.6);
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 0.82rem;
}
.story-progress {
  height: 2px;
  background: rgba(255,255,255,0.25);
  margin: 8px 12px 0;
  border-radius: 2px;
  overflow: hidden;
}
.story-progress-fill { width: 55%; height: 100%; background: #fff; }

.story-user-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
}
.story-user-bar .ig-avatar { width: 28px; height: 28px; font-size: 0.65rem; }
.story-user-bar span { font-size: 0.76rem; font-weight: 600; }

.story-reply-row {
  padding: 8px 12px 12px;
  display: flex; align-items: center; gap: 8px;
}
.story-reply-pill {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 22px;
  padding: 7px 14px;
  font-size: 0.73rem;
  color: #aaa;
}

/* Post View inside Phone */
.phone-post-view { display: flex; flex-direction: column; height: 100%; }
.post-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
}
.post-user { display: flex; align-items: center; gap: 8px; font-size: 0.76rem; font-weight: 600; }
.post-img {
  width: 100%;
  height: 260px;
  background: #1e293b;
  overflow: hidden;
}
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-actions {
  display: flex; gap: 14px;
  padding: 8px 12px;
  color: #fff;
}
.post-caption {
  padding: 0 12px 10px;
  font-size: 0.73rem;
  color: #ccc;
  line-height: 1.4;
}

/* Post Bottom Switcher Pills */
.phone-switcher {
  display: flex;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
  margin-top: 10px;
  box-shadow: var(--shadow-card);
}
.phone-sw-btn {
  flex: 1; text-align: center;
  border: none; background: transparent;
  padding: 5px 0;
  border-radius: 99px;
  font-size: 0.77rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer; transition: all 0.18s;
}
.phone-sw-btn.active { background: var(--primary-black); color: #fff; }

/* ─── BUILDER PANE (RIGHT STEPS) ────────────────── */
.builder-pane {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 700px;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-card);
}

.step-hd {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 1.1rem;
}
.step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.76rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: 1px solid var(--border-light);
}
.step-num.done { background: var(--primary-black); color: #fff; border-color: var(--primary-black); }
.step-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.2px; }

.opt-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 0.6rem;
}
.opt-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.opt-label { font-size: 0.875rem; font-weight: 600; color: var(--text-main); }
.opt-desc { font-size: 0.765rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

.or-sep {
  text-align: center;
  font-size: 0.68rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px;
  margin: 0.55rem 0;
}

/* Toggle (monochrome) */
.sw {
  position: relative;
  display: inline-block;
  width: 42px; height: 23px;
  flex-shrink: 0;
}
.sw input { opacity: 0; width: 0; height: 0; }
.sw-track {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db;
  border-radius: 23px; transition: 0.22s;
}
.sw-track:before {
  position: absolute; content: "";
  height: 17px; width: 17px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.22s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.sw input:checked + .sw-track { background: var(--primary-black); }
.sw input:checked + .sw-track:before { transform: translateX(19px); }

/* ─── TAG KEYWORD INPUT ─────────────────────────── */
.tag-input-wrap {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  cursor: text;
  background: #fff;
  margin-top: 10px;
  transition: border-color 0.18s;
  min-height: 46px;
  align-items: center;
}
.tag-input-wrap:focus-within { border-color: var(--border-focus); }

.kw-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 3px 10px 3px 11px;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-main);
}
.kw-tag-x {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; line-height: 1;
  display: flex; align-items: center; padding: 0;
}
.kw-tag-x:hover { color: #ef4444; }

.tag-text-input {
  border: none; outline: none;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-main);
  background: transparent;
  min-width: 100px;
  flex: 1;
}
.tag-text-input::placeholder { color: var(--text-muted); }

.suggested-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.suggested-label { font-size: 0.73rem; color: var(--text-muted); font-weight: 500; margin-top: 8px; }

.kw-sug {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 3px 11px;
  font-size: 0.775rem; font-weight: 500;
  color: var(--text-main);
  cursor: pointer; transition: all 0.15s;
}
.kw-sug:hover { background: var(--primary-black); color: #fff; border-color: var(--primary-black); }

.counter-tiny { font-size: 0.7rem; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* ─── PUBLIC REPLY VARIATIONS ───────────────────── */
.pub-reply-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.pub-reply-title {
  font-size: 0.85rem; font-weight: 700; color: var(--text-secondary);
}
.btn-templates {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.76rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-templates svg { width: 13px; height: 13px; }
.btn-templates:hover { background: var(--bg-card-subtle); }

.variation-hint {
  font-size: 0.74rem; color: var(--text-muted);
  margin-bottom: 10px; line-height: 1.4;
}

.variation-list { display: flex; flex-direction: column; gap: 8px; }

.variation-item {
  display: flex; align-items: center;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 10px 0 14px;
  gap: 8px;
}
.variation-item input {
  flex: 1;
  border: none; outline: none;
  font-size: 0.85rem; font-family: var(--font);
  padding: 12px 0;
  color: var(--text-main);
  background: transparent;
}
.variation-item button {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  font-size: 1.2rem; line-height: 1;
}
.variation-item button:hover { color: #ef4444; }

.btn-add-variation {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px;
  color: var(--text-main);
}
.btn-add-variation:hover { background: var(--bg-card-subtle); }

/* ─── INLINE EXPANDABLE FIELDS (Step 3) ──────────── */
.expand-fields {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.field-label {
  font-size: 0.775rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field-sub { font-size: 0.72rem; color: var(--text-muted); text-align: right; margin-top: 3px; }

.clean-textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem; font-family: var(--font);
  outline: none; resize: vertical;
  color: var(--text-main);
  transition: border-color 0.18s;
  min-height: 80px;
}
.clean-textarea:focus { border-color: var(--border-focus); }

.clean-input {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.85rem; font-family: var(--font);
  outline: none;
  color: var(--text-main);
  transition: border-color 0.18s;
}
.clean-input:focus { border-color: var(--border-focus); }

/* ─── ADD LINK & DM STEP ─────────────────────────── */
.msg-wrapper {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
  transition: border-color 0.18s;
}
.msg-wrapper:focus-within { border-color: var(--border-focus); }
.msg-textarea {
  width: 100%; border: none; outline: none;
  font-size: 0.875rem; font-family: var(--font);
  resize: vertical; min-height: 88px;
  color: var(--text-main);
}
.msg-footer { display: flex; justify-content: flex-end; margin-top: 6px; }

.btn-add-link {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-light);
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.83rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 10px; color: var(--text-main);
}
.btn-add-link:hover { background: var(--bg-card-subtle); }

.link-drawer {
  display: none;
  margin-top: 10px;
  background: var(--bg-card-subtle);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  gap: 10px;
  flex-direction: column;
}
.link-drawer.open { display: flex; }

.template-row { display: flex; justify-content: flex-start; margin-bottom: 8px; }
.btn-tmpl {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-tmpl:hover { background: var(--bg-card-subtle); }

/* Advanced Settings */
.accordion-trigger {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.9rem;
  font-size: 0.875rem; font-weight: 700;
}
.accordion-body { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; display: none; }
.accordion-body.open { display: flex; }

.lang-pills { display: flex; gap: 7px; margin-top: 7px; }
.lang-pill {
  flex: 1; text-align: center;
  padding: 7px 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.79rem; font-weight: 600; cursor: pointer;
}
.lang-pill.active { background: var(--primary-black); color: #fff; border-color: var(--primary-black); }

/* ─── FULL PAGE VIEWS ────────────────────────────── */
.full-page { display: none; padding: 2rem 2.5rem; overflow-y: auto; height: calc(100vh - 56px); }
.full-page.active { display: block; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-title { font-size: 1.25rem; font-weight: 700; }
.page-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

/* Table */
.tbl-wrap { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.835rem; text-align: left; }
.data-table th { background: #f9fafb; color: var(--text-muted); padding: 11px 16px; font-weight: 600; border-bottom: 1px solid var(--border-light); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.4px; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-main); }
.data-table tr:hover { background: #f9fafb; }
.data-table tr:last-child td { border-bottom: none; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 0.71rem; font-weight: 600; background: #f1f5f9; border: 1px solid var(--border-light); color: var(--text-main); }

/* ─── NEW AUTOMATION MODAL ────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  width: 580px;
  max-width: 95vw;
  box-shadow: var(--shadow-modal);
  position: relative;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none;
  font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--text-muted);
}
.modal-close:hover { color: var(--text-main); }

.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.modal-sub { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.trigger-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.25rem; }

.trigger-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  cursor: pointer;
  transition: all 0.18s;
  background: #fff;
}
.trigger-card:hover { border-color: #9ca3af; box-shadow: 0 4px 14px rgba(0,0,0,0.07); transform: translateY(-1px); }

.trigger-card-icon {
  width: 100%;
  height: 90px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.trigger-card-icon.comments-bg { background: #f0fdf4; }
.trigger-card-icon.stories-bg  { background: #eff6ff; }
.trigger-card-icon.keywords-bg { background: #fdf2f8; }

/* Tiny icon illustrations inside cards */
.card-illus {
  width: 70px; height: 55px;
  background: rgba(255,255,255,0.9);
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  display: flex; flex-direction: column;
  padding: 6px 7px; gap: 4px;
}
.illus-line { height: 6px; border-radius: 3px; background: #d1d5db; }
.illus-line.short { width: 55%; }
.illus-line.shorter { width: 35%; }

.card-category {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.card-name { font-size: 0.9rem; font-weight: 700; color: var(--text-main); margin-bottom: 3px; }
.card-desc { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 10px; }
.card-start {
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-main);
  display: flex; align-items: center; gap: 4px;
}
.card-start svg { width: 13px; height: 13px; }

.modal-browse {
  text-align: center;
  font-size: 0.8rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}
.modal-browse:hover { color: var(--text-main); }

/* ─── MEDIA STRIP IN STEP 1 ─────────────────────── */
.media-strip {
  display: flex; gap: 10px; margin-top: 10px;
  overflow-x: auto; padding-bottom: 6px;
}
.media-strip-item {
  width: 96px; height: 130px;
  border-radius: 8px;
  border: 2px solid transparent;
  position: relative; overflow: hidden;
  cursor: pointer; flex-shrink: 0;
  background: #e2e8f0;
  transition: all 0.18s;
}
.media-strip-item img { width: 100%; height: 100%; object-fit: cover; }
.media-strip-item.selected { border-color: var(--primary-black); }
.media-strip-item.selected::after {
  content: '✓';
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px;
  border-radius: 50%; background: var(--primary-black);
  color: #fff; font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.strip-stats {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.82));
  color: #fff; font-size: 0.62rem;
  padding: 3px 5px;
  display: flex; justify-content: space-between;
}
.btn-show-more {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 7px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; margin-top: 9px;
}
.btn-show-more:hover { background: var(--bg-card-subtle); }

/* Settings Form */
.settings-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 1.25rem; margin-bottom: 1rem; }
.settings-card label { font-size: 0.82rem; font-weight: 600; display: block; margin-bottom: 5px; }
.settings-card .field-hint { font-size: 0.73rem; color: var(--text-muted); margin-top: 4px; }

/* ─── MINI MODALS (Templates / Add Link) ─────────── */
.mini-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.mini-modal-overlay.open { display: flex; }

.mini-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.22s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes modalPop {
  from { transform: scale(0.88) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.mini-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.mini-modal-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text-main);
}
.mini-modal-close {
  background: var(--bg-card-subtle); border: none; border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer;
  font-size: 1rem; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.mini-modal-close:hover { background: #e5e7eb; }

.mini-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Template cards inside the modal */
.template-card {
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.template-card:hover {
  border-color: var(--primary-black);
  background: var(--bg-card-subtle);
}
.template-name {
  font-size: 0.82rem; font-weight: 700;
  color: var(--text-main); margin-bottom: 4px;
}
.template-preview {
  font-size: 0.78rem; color: var(--text-secondary);
  line-height: 1.5;
}

/* Link preview pill shown below the Add Link button */
.link-preview-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 5px 10px 5px 9px;
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-secondary);
  margin-top: 8px;
}
.link-preview-pill button {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.9rem; line-height: 1;
  padding: 0 1px;
}
.link-preview-pill button:hover { color: #ef4444; }

/* Follow gate info note */
.follow-gate-note {
  display: flex; gap: 7px; align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.75rem; color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 10px;
}
.follow-gate-note svg { flex-shrink: 0; margin-top: 2px; color: var(--text-muted); }
.follow-gate-note em { font-style: italic; color: var(--text-main); }

/* Primary small button (used in modals) */
.btn-primary-sm {
  background: var(--primary-black); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 0.83rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-primary-sm:hover { background: var(--primary-hover); }

/* Outline button (cancel in modals) */
.btn-outline {
  background: #fff; color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 18px; font-size: 0.83rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s;
}
.btn-outline:hover { border-color: var(--primary-black); }

