/* =====================================================
   MarketingAI — Design System 2025
   Inspired by: Linear, Vercel, Raycast, Notion
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Brand */
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;

  /* Neutrals */
  --gray-0:   #ffffff;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #06b6d4;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .08), 0 1px 2px -1px rgb(0 0 0 / .06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .07), 0 2px 4px -2px rgb(0 0 0 / .06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .08), 0 8px 10px -6px rgb(0 0 0 / .04);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;
  --r-full: 9999px;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* =====================================================
   LAYOUT
   ===================================================== */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgb(255 255 255 / .06);
  position: relative;
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgb(255 255 255 / .06);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgb(255 255 255/.1), 0 4px 12px rgb(59 130 246/.4);
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 400;
}

.sidebar-section { padding: 10px 8px 4px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: background .12s, color .12s;
  user-select: none;
  position: relative;
}
.sidebar-item:hover { background: rgb(255 255 255/.06); color: var(--gray-100); }
.sidebar-item.active {
  background: rgb(59 130 246/.15);
  color: #93c5fd;
}
.sidebar-item.active .sidebar-item-icon { color: #60a5fa; }
.sidebar-item-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-item-badge {
  margin-left: auto;
  background: var(--brand-600);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid rgb(255 255 255/.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s;
}
.sidebar-user:hover { background: rgb(255 255 255/.06); }
.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 500; color: var(--gray-300); }
.sidebar-user-role { font-size: 10px; color: var(--gray-600); }

/* =====================================================
   MAIN AREA
   ===================================================== */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* =====================================================
   TOPBAR
   ===================================================== */
.topbar {
  height: var(--topbar-h);
  background: var(--gray-0);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  flex: 1;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  flex: 1;
}
.topbar-breadcrumb .current { color: var(--gray-900); font-weight: 600; }

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

.topbar-search {
  position: relative;
  width: 220px;
}
.topbar-search input {
  width: 100%;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  padding: 6px 12px 6px 32px;
  font-size: 13px;
  color: var(--gray-800);
  outline: none;
  transition: border .15s, background .15s;
}
.topbar-search input::placeholder { color: var(--gray-400); }
.topbar-search input:focus { background: #fff; border-color: var(--brand-500); }
.topbar-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 12px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  border: none;
  background: transparent;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-800); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--danger);
  border-radius: var(--r-full);
  border: 2px solid var(--gray-0);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background .12s;
  border: none;
  background: transparent;
}
.user-btn:hover { background: var(--gray-100); }
.user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--gray-700); }

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}

/* =====================================================
   CARDS & SURFACES
   ===================================================== */
.card {
  background: var(--gray-0);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px; }

/* STAT CARD */
.stat-card {
  background: var(--gray-0);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
  cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 14px;
}
.stat-icon-wrap.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon-wrap.purple { background: #f5f3ff; color: #8b5cf6; }
.stat-icon-wrap.green  { background: #ecfdf5; color: #10b981; }
.stat-icon-wrap.amber  { background: #fffbeb; color: #f59e0b; }
.stat-icon-wrap.pink   { background: #fdf2f8; color: #ec4899; }
.stat-icon-wrap.cyan   { background: #ecfeff; color: #06b6d4; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.stat-delta.up   { background: #ecfdf5; color: #059669; }
.stat-delta.down { background: #fef2f2; color: #dc2626; }
.stat-delta.flat { background: var(--gray-100); color: var(--gray-500); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  outline: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}
.btn-primary:hover { background: var(--gray-800); }

.btn-brand {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 3px rgb(59 130 246/.3), 0 0 0 1px rgb(99 102 241/.2) inset;
}
.btn-brand:hover { filter: brightness(1.06); box-shadow: 0 4px 12px rgb(59 130 246/.35); }

.btn-secondary {
  background: var(--gray-0);
  color: var(--gray-700);
  border-color: var(--gray-200);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}
.btn-success:hover { background: #d1fae5; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--r-sm); }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-full);
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-blue    { background: #eff6ff; color: #2563eb; }
.badge-green   { background: #ecfdf5; color: #059669; }
.badge-yellow  { background: #fffbeb; color: #b45309; }
.badge-red     { background: #fef2f2; color: #dc2626; }
.badge-purple  { background: #f5f3ff; color: #7c3aed; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-cyan    { background: #ecfeff; color: #0891b2; }
.badge-line    { background: #dcfce7; color: #16a34a; }
.badge-dot { width: 6px; height: 6px; border-radius: var(--r-full); flex-shrink: 0; }
.badge-dot.green  { background: #10b981; }
.badge-dot.yellow { background: #f59e0b; }
.badge-dot.red    { background: #ef4444; }
.badge-dot.gray   { background: var(--gray-400); }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrap {
  background: var(--gray-0);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 16px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background .1s;
}
.data-table tbody tr:hover td { background: var(--gray-50); }

/* Checkbox column */
.data-table th.col-check,
.data-table td.col-check {
  width: 40px;
  padding-left: 16px;
  padding-right: 0;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: .01em;
}
.form-label .req { color: var(--danger); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--gray-0);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--gray-900);
  outline: none;
  transition: border .15s, box-shadow .15s;
  font-family: inherit;
  line-height: 1.5;
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--gray-300); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgb(59 130 246 / .12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-position: right 10px center; background-repeat: no-repeat; background-size: 16px; padding-right: 32px; cursor: pointer; }

.input-wrap { position: relative; }
.input-icon-l { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 12px; pointer-events: none; }
.input-icon-l + .form-input { padding-left: 32px; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / .6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: overlayIn .15s ease-out;
}

.modal {
  background: var(--gray-0);
  border-radius: var(--r-2xl);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25), 0 0 0 1px var(--gray-200);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s cubic-bezier(.16, 1, .3, 1);
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  flex-shrink: 0;
}
.modal-head-title { font-size: 15px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; }
.modal-head-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  background: transparent;
  font-size: 13px;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 20px;
}
.modal-divider { height: 1px; background: var(--gray-100); margin: 16px 0; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2px;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--gray-900); border-bottom-color: var(--gray-900); }

/* Pill tabs */
.tabs-pill {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--r-lg);
}
.tab-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tab-pill:hover { color: var(--gray-700); }
.tab-pill.active { background: var(--gray-0); color: var(--gray-900); box-shadow: var(--shadow-xs); font-weight: 600; }

/* =====================================================
   SEARCH & FILTER BAR
   ===================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--gray-400);
  gap: 12px;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--gray-100);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--gray-400);
  margin-bottom: 4px;
}
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.empty-state-desc { font-size: 12px; color: var(--gray-400); max-width: 280px; }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
  background: transparent;
  padding: 0 4px;
}
.page-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.page-btn.active { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* =====================================================
   TOAST
   ===================================================== */
#toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--gray-900);
  color: #fff;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0/.2);
  animation: toastIn .25s cubic-bezier(.16,1,.3,1);
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
  border: 1px solid rgb(255 255 255/.08);
}
.toast.success .toast-icon { color: #34d399; }
.toast.error   .toast-icon { color: #f87171; }
.toast.warning .toast-icon { color: #fbbf24; }
.toast.info    .toast-icon { color: #60a5fa; }
.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-close { color: rgb(255 255 255/.4); font-size: 11px; cursor: pointer; flex-shrink: 0; }
.toast-close:hover { color: #fff; }

/* =====================================================
   AVATAR
   ===================================================== */
.avatar {
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* =====================================================
   PROGRESS BAR
   ===================================================== */
.progress-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width .5s ease-out;
}

/* =====================================================
   METRIC ROW (open rate, CTR etc)
   ===================================================== */
.metric-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.metric-label { color: var(--gray-500); min-width: 60px; }
.metric-val   { font-weight: 700; color: var(--gray-900); }

/* =====================================================
   FLOW STEP (Automation)
   ===================================================== */
.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-700);
  white-space: nowrap;
}
.flow-step-icon { font-size: 11px; }
.flow-arrow { color: var(--gray-300); font-size: 10px; }

/* =====================================================
   CHANNEL PILL
   ===================================================== */
.ch-line   { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.ch-email  { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.ch-api    { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.ch-multi  { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }

/* =====================================================
   SKELETON LOADING
   ===================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}

/* =====================================================
   TOOLTIP
   ===================================================== */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* =====================================================
   CHECKBOX
   ===================================================== */
.checkbox {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--gray-300);
  appearance: none;
  cursor: pointer;
  transition: all .12s;
  position: relative;
}
.checkbox:checked {
  background: var(--gray-900);
  border-color: var(--gray-900);
}
.checkbox:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: url("data:image/svg+xml,%3csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e") center / contain no-repeat;
}

/* =====================================================
   DIVIDER
   ===================================================== */
.divider { height: 1px; background: var(--gray-100); }
.divider-v { width: 1px; background: var(--gray-200); align-self: stretch; }

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.fade-up { animation: fadeUp .25s ease-out; }

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* =====================================================
   MISC UTILITIES
   ===================================================== */
.text-muted   { color: var(--gray-400); }
.text-subtle  { color: var(--gray-500); }
.text-base    { color: var(--gray-700); }
.text-strong  { color: var(--gray-900); font-weight: 600; }
.font-mono    { font-family: 'SFMono-Regular', Consolas, monospace; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-col { display: flex; flex-direction: column; gap: 4px; }

/* =====================================================
   SEGMENT BUILDER — 条件ビルダー
   ===================================================== */
.seg-cond-row {
  transition: border-color .15s, background .15s;
}
.seg-cond-row:hover {
  border-color: var(--gray-300) !important;
  background: white !important;
}

/* =====================================================
   AUTOMATION — フロービルダー
   ===================================================== */
.auto-card:hover {
  box-shadow: 0 4px 24px rgba(99,102,241,.10);
}

.flow-node {
  transition: box-shadow .15s;
}
.flow-node:hover {
  box-shadow: 0 2px 12px rgba(99,102,241,.12);
}

/* トリガーオプション選択アニメーション */
.trigger-option {
  transition: border-color .15s, background .15s, transform .1s;
}
.trigger-option:hover {
  transform: translateX(2px);
}
.trigger-option.selected {
  transform: translateX(2px);
}

/* フロービルダーキャンバス */
#flow-canvas {
  min-height: 200px;
}

/* ステップノードのドラッグ感 */
.flow-node {
  cursor: default;
  user-select: none;
}

/* モーダル2カラムレイアウト対応 */
.modal[style*="max-width:860px"] .modal-body {
  padding: 0;
}

/* セグメントカード */
.seg-card:hover {
  box-shadow: 0 8px 32px rgba(99,102,241,.12) !important;
}

/* =====================================================
   MANUAL PAGE — 操作マニュアル
   ===================================================== */

/* 2カラムレイアウト */
.manual-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) {
  .manual-layout { grid-template-columns: 1fr; }
  .manual-toc { display: flex; flex-wrap: wrap; gap: 6px; }
}

/* 左：目次 */
.manual-toc {
  position: sticky;
  top: 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}
.manual-toc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 6px;
}
.manual-toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background .12s, color .12s, transform .1s;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}
.manual-toc-item:hover {
  background: var(--gray-50);
  color: var(--gray-900);
  transform: translateX(2px);
}
.manual-toc-item.active {
  font-weight: 700;
}

/* 右：コンテンツ */
.manual-content {
  transition: opacity .15s;
  min-height: 500px;
}

/* 見出し */
.manual-h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -.02em;
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--gray-100);
}
.manual-h3:first-of-type {
  margin-top: 0;
}

/* コードブロック */
.manual-code {
  background: var(--gray-900);
  color: #86efac;
  font-size: 11.5px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 10px 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  line-height: 1.6;
  white-space: pre;
}

/* FAQ アコーディオン */
.faq-arrow {
  flex-shrink: 0;
}
