/* =====================================================
   QuickMarketer — Design System v2
   Professional · Clean · Non-AI aesthetic
   ===================================================== */

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

:root {
  --sidebar-w: 252px;
  --topbar-h: 52px;

  /* Brand — slate/charcoal, not blue */
  --brand:     #18181b;
  --brand-lt:  #f4f4f5;
  --brand-dk:  #09090b;

  /* Accent — warm amber for highlights */
  --accent:    #f59e0b;
  --accent-lt: #fef3c7;
  --accent-dk: #d97706;

  /* Neutrals — true zinc scale */
  --gray-0:   #ffffff;
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;

  /* Semantic */
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;
  --info:     #2563eb;

  /* Surfaces */
  --surface:       #ffffff;
  --surface-sub:   #fafafa;

  /* Sidebar — dark */
  --sidebar-bg:          #18181b;
  --sidebar-border:      #27272a;
  --sidebar-text:        #a1a1aa;
  --sidebar-hover:       #27272a;
  --sidebar-active-bg:   #3f3f46;
  --sidebar-active-text: #ffffff;

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

  /* Radius — sharp & professional */
  --r-xs:   2px;
  --r-sm:   4px;
  --r-md:   6px;
  --r-lg:   8px;
  --r-xl:   10px;
  --r-2xl:  14px;
  --r-full: 9999px;
}

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

html { font-size: 14px; }

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

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

/* =====================================================
   SIDEBAR — Dark
   ===================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--sidebar-border);
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  background: #ffffff10;
}

.sidebar-logo-img {
  width: 168px;
  height: auto;
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: var(--r-md);
  padding: 6px 10px;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gray-900);
  font-size: 13px;
}

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

.sidebar-section { padding: 18px 8px 4px; }
.sidebar-section-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #71717a;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 2px;
}
.sidebar-group-header { border-radius: var(--r-md); }
.sidebar-group-header:hover { background: var(--sidebar-hover); }
.sidebar-group-header:hover .sidebar-section-label { color: #f4f4f5; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 400;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background .1s, color .1s;
  user-select: none;
}
.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #e4e4e7;
}
.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}
.sidebar-item.active .sidebar-item-icon { color: #fff; }
.sidebar-item-icon {
  width: 18px;
  text-align: center;
  font-size: 14.5px;
  flex-shrink: 0;
  color: #71717a;
}
.sidebar-item-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .1s;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  background: #3f3f46;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4d4d8;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid #52525b;
}
.sidebar-user-name { font-size: 13px; font-weight: 500; color: #d4d4d8; }
.sidebar-user-role { font-size: 11px; color: #71717a; }

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

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

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--gray-400);
  flex: 1;
}
.topbar-breadcrumb .current { color: var(--gray-800); font-weight: 600; }

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

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

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

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  background: var(--danger);
  border-radius: var(--r-full);
  border: 1.5px solid var(--surface);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 7px 4px 4px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background .1s;
  border: none;
  background: transparent;
}
.user-btn:hover { background: var(--gray-100); }
.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--gray-800);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--gray-700); }

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

/* LPビルダー表示中: #content を flex 縦並みにして、エディタ本体(#lp-editor-wrap)を
   親の高さに正確に追従させる。これにより右側プロパティパネルが下に押し出されず
   キャンバスと横並びで表示される。 */
.content-area.lp-editor-active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

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

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

/* STAT CARD */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: 14px;
}
.stat-icon-wrap.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon-wrap.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-wrap.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon-wrap.amber  { background: #fffbeb; color: #d97706; }
.stat-icon-wrap.pink   { background: #fdf2f8; color: #db2777; }
.stat-icon-wrap.cyan   { background: #f0f9ff; color: #0284c7; }
.stat-icon-wrap.slate  { background: var(--gray-100); color: var(--gray-600); }
.stat-icon-wrap.indigo { background: #eef2ff; color: #4f46e5; }
.stat-icon-wrap.red    { background: #fef2f2; color: #dc2626; }

.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: 5px; font-weight: 500; }
.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.stat-delta.up   { background: #f0fdf4; color: #16a34a; }
.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: 5px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  outline: none;
  line-height: 1.4;
}
.btn:disabled { opacity: .4; pointer-events: none; }

/* Primary — dark charcoal */
.btn-primary {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}
.btn-primary:hover { background: var(--gray-700); border-color: var(--gray-700); }

/* Brand = same as primary */
.btn-brand {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}
.btn-brand:hover { background: var(--gray-700); border-color: var(--gray-700); }

/* Secondary — outlined light */
.btn-secondary {
  background: var(--surface);
  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); color: var(--gray-900); }

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

/* Danger */
.btn-danger {
  background: #fff;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }

/* Success */
.btn-success {
  background: #fff;
  color: #16a34a;
  border-color: #bbf7d0;
}
.btn-success:hover { background: #f0fdf4; }

/* Accent — amber */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-xs { padding: 2px 7px;  font-size: 11px; border-radius: var(--r-xs); }
.btn-lg { padding: 9px 20px; font-size: 14px; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-green  { background: #f0fdf4; color: #15803d; }
.badge-yellow { background: #fefce8; color: #a16207; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-purple { background: #faf5ff; color: #6d28d9; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.badge-cyan   { background: #f0f9ff; color: #0369a1; }
.badge-line   { background: #f0fdf4; color: #15803d; }
.badge-slate  { background: var(--gray-800); color: #fff; }
.badge-dot { width: 6px; height: 6px; border-radius: var(--r-full); flex-shrink: 0; }
.badge-dot.green  { background: #16a34a; }
.badge-dot.yellow { background: #d97706; }
.badge-dot.red    { background: #dc2626; }
.badge-dot.gray   { background: var(--gray-400); }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrap {
  background: var(--surface);
  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: 9px 14px;
  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: 11px 14px;
  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:hover td { background: var(--gray-50); }

.data-table th.col-check,
.data-table td.col-check { width: 40px; padding-left: 14px; padding-right: 0; }

.cs-checkbox { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary, #6366f1); }
.data-table tbody tr.row-selected td { background: #eef2ff; }
.data-table tbody tr.row-selected:hover td { background: #e0e7ff; }

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

.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(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  padding: 7px 11px;
  font-size: 13px;
  color: var(--gray-900);
  outline: none;
  transition: border .12s, box-shadow .12s;
  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(--gray-500);
  box-shadow: 0 0 0 3px rgb(24 24 27 / .06);
}
.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='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 9px center;
  background-repeat: no-repeat;
  background-size: 15px;
  padding-right: 30px;
  cursor: pointer;
}

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

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

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 20px 40px rgb(0 0 0 / .15), 0 0 0 1px var(--gray-200);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s cubic-bezier(.16, 1, .3, 1);
}
.modal-lg { max-width: 740px; }
.modal-xl { max-width: 940px; }

/* modal-head / modal-header 両方対応 */
.modal-head, .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--gray-100);
}
.modal-head-title, .modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}
.modal-head-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

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

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

/* modal-foot / modal-footer 両方対応 */
.modal-foot, .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}

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

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

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

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 20px;
  text-align: center;
  gap: 10px;
}
.empty-state-icon {
  width: 44px;
  height: 44px;
  background: var(--gray-100);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--gray-400);
  margin-bottom: 2px;
}
.empty-state-title { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.empty-state-desc { font-size: 12px; color: var(--gray-400); max-width: 260px; line-height: 1.6; }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination { display: flex; align-items: center; gap: 3px; }
.page-btn {
  min-width: 28px;
  height: 28px;
  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 .1s;
  background: transparent;
  padding: 0 3px;
}
.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: .35; pointer-events: none; }

/* =====================================================
   TOAST
   ===================================================== */
#toast-root {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  background: var(--gray-900);
  color: #fff;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgb(0 0 0 / .25);
  animation: toastIn .2s cubic-bezier(.16,1,.3,1);
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  border: 1px solid rgb(255 255 255 / .06);
}
.toast.success .toast-icon { color: #4ade80; }
.toast.error   .toast-icon { color: #f87171; }
.toast.warning .toast-icon { color: #fbbf24; }
.toast.info    .toast-icon { color: #93c5fd; }
.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-close { color: rgb(255 255 255 / .35); 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: 600;
  flex-shrink: 0;
  background: var(--gray-700);
  color: #fff;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-md { width: 34px; height: 34px; font-size: 12px; }
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }

/* =====================================================
   PROGRESS BAR
   ===================================================== */
.progress-bar {
  height: 5px;
  background: var(--gray-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--gray-800);
  transition: width .4s ease-out;
}

/* =====================================================
   METRIC ROW
   ===================================================== */
.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: 600; color: var(--gray-900); }

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

/* =====================================================
   CHANNEL PILL
   ===================================================== */
.ch-line   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.ch-email  { background: #f8fafc; color: #334155; border: 1px solid #e2e8f0; }
.ch-api    { background: #faf5ff; color: #6d28d9; border: 1px solid #e9d5ff; }
.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% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* =====================================================
   CHECKBOX
   ===================================================== */
.checkbox {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--gray-300);
  appearance: none;
  cursor: pointer;
  transition: all .1s;
  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: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  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(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

.fade-up { animation: fadeUp .2s 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); }

/* =====================================================
   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 .12s, background .12s; }
.seg-cond-row:hover { border-color: var(--gray-300) !important; background: white !important; }

/* =====================================================
   AUTOMATION
   ===================================================== */
.flow-node { transition: box-shadow .12s; }
.flow-node:hover { box-shadow: 0 2px 8px rgb(0 0 0 / .08); }

.trigger-option { transition: border-color .12s, background .12s; }

#flow-canvas { min-height: 200px; }

.modal[style*="max-width:860px"] .modal-body { padding: 0; }

/* =====================================================
   BANNER EDIT MODAL (レスポンシブ対応)
   PC(1080px想定)では左設定パネル+右400pxプレビューの2カラム構成だが、
   スマホ幅で開くと右パネルの固定400pxが画面を圧迫し左が潰れて操作不能になるため、
   一定幅以下では縦積み(1カラム)に切り替える。
   ===================================================== */
@media (max-width: 860px) {
  .bn-modal-body {
    overflow-y: auto !important;
  }
  .bn-modal-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto;
    height: auto !important;
    max-height: none;
  }
  .bn-modal-left {
    border-right: none !important;
    border-bottom: 1px solid var(--gray-200);
    overflow-y: visible !important;
  }
  .bn-modal-right {
    min-height: 360px;
  }
}

/* =====================================================
   MANUAL PAGE
   ===================================================== */
.manual-layout {
  display: grid;
  grid-template-columns: 196px 1fr;
  gap: 18px;
  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: 10px;
  box-shadow: var(--shadow-xs);
}
.manual-toc-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 8px 9px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 4px;
}
.manual-toc-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background .1s, color .1s;
  margin-bottom: 1px;
}
.manual-toc-item:hover { background: var(--gray-50); color: var(--gray-900); }
.manual-toc-item.active { font-weight: 600; color: var(--gray-900); }

.manual-content { transition: opacity .12s; min-height: 500px; }

.manual-h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -.01em;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px 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: 12px 14px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 8px 0;
  font-family: 'SFMono-Regular', Consolas, monospace;
  line-height: 1.6;
  white-space: pre;
}

.faq-arrow { flex-shrink: 0; }
