/* ==========================================================================
   takealook360 FAST-REPLY COPILOT - STYLESHEET (V3 EVERNOTE/NOTION REDESIGN)
   Theme: Modern Clean Tech, English Interface, Evernote/Notion Inspired
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-thai: 'Prompt', var(--font-sans);

  /* Sidebar Theme (Evernote / Notion Dark Slate) */
  --sb-bg: #090d16;
  --sb-surface: #111827;
  --sb-border: #1f293d;
  --sb-text: #e2e8f0;
  --sb-text-muted: #94a3b8;
  --sb-active-bg: #1e293b;

  /* App Theme */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  /* Brand Accents */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;

  --line-brand: #06c755;
  --line-brand-hover: #05a646;
  --line-bubble-bg: #f0fdf4;
  --line-bubble-border: #bbf7d0;

  --gmail-brand: #ea4335;
  --gmail-brand-hover: #d93025;
  --gmail-box-bg: #fef2f2;
  --gmail-box-border: #fecaca;

  --danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 5px -1px rgba(0, 0, 0, 0.06), 0 1px 3px -1px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 16px -4px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-popover: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* MODERN MINIMALIST CUSTOM SCROLLBARS */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}
.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}
.app-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}
.app-sidebar {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

body {
  font-family: var(--font-thai);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   1. APP SIDEBAR (Evernote / Linear Minimalist Dark)
   ========================================================================== */
.app-sidebar {
  width: 260px;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sb-border);
  min-height: 64px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.hamburger-brand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #111827;
  border: 1px solid var(--sb-border);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.hamburger-brand-btn:hover {
  background: #1f293d;
  color: #38bdf8;
  border-color: #38bdf8;
}

.brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
  display: block;
  line-height: 1.15;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--sb-text-muted);
  display: block;
  white-space: nowrap;
}

.sidebar-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sb-border);
}

.block-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #64748b;
  display: block;
  margin-bottom: 8px;
}

/* CHANNEL SEGMENTED (LINE & GMAIL RED) */
.channel-segmented {
  display: flex;
  background: var(--sb-surface);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--sb-border);
  gap: 3px;
}

.channel-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--sb-text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.channel-tab:hover { color: #ffffff; }

.channel-tab.line-tab.active {
  background: var(--line-brand);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(6, 199, 85, 0.4);
}

.channel-tab.email-tab.active {
  background: var(--gmail-brand);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 67, 53, 0.4);
}

.tab-svg { flex-shrink: 0; }

/* SERVICES & STAGES NAVIGATION */
.services-nav-list,
.stages-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--sb-text);
  font-family: var(--font-thai);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-item-btn.active {
  background: var(--sb-active-bg);
  color: #38bdf8;
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  font-size: 14px;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
}

.nav-badge-count {
  font-size: 11px;
  background: #1e293b;
  color: #94a3b8;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.block-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  height: 22px;
}

.block-header-flex .block-label {
  margin-bottom: 0;
  line-height: 1;
}

.header-action-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-sidebar-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.btn-sidebar-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--sb-border);
  background: #06090e;
}

.sync-widget {
  background: #111827;
  border: 1px solid var(--sb-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sync-widget.has-warning {
  border-color: rgba(239, 68, 68, 0.6);
  background: #181216;
}

.sync-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.sync-dot.synced {
  background: #10b981;
  box-shadow: 0 0 5px #10b981;
}
.sync-dot.syncing {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  animation: pulse-sync-dot 0.7s infinite alternate;
}
.sync-dot.warning {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: pulse-sync-dot 0.8s infinite alternate;
}

@keyframes pulse-sync-dot {
  0% { opacity: 0.35; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.15); }
}

.sync-status {
  font-size: 11px;
  color: #10b981;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-status.synced { color: #10b981; }
.sync-status.syncing { color: #38bdf8; }
.sync-status.warning { color: #fca5a5; font-weight: 600; }

/* PROMINENT WARNING BADGE */
.sync-warning-badge {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: pulse-sync-border 2s infinite;
}

@keyframes pulse-sync-border {
  0% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { border-color: #f87171; box-shadow: 0 0 6px 1px rgba(239, 68, 68, 0.3); }
  100% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
}

.warning-badge-content {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fca5a5;
  line-height: 1.2;
}
.warning-badge-icon {
  font-size: 12px;
}
.warning-badge-text {
  font-size: 11px;
  letter-spacing: -0.1px;
}

.sync-retry-btn {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.sync-retry-btn:hover {
  background: #b91c1c;
  transform: scale(1.02);
}
.sync-retry-btn:active {
  transform: scale(0.98);
}

.sync-refresh-btn {
  width: 100%;
  font-size: 11px;
  padding: 4px 8px;
}

.user-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--sb-text-muted);
}

.user-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1e293b;
  color: #fca5a5;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-logout:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* ==========================================================================
   2. MAIN CONTENT AREA
   ========================================================================== */
.app-main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
  height: 100vh;
  overflow-y: auto;
}

/* TOP APP BAR */
.main-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.hamburger-btn { display: none; font-size: 18px; }

.topbar-search {
  flex-grow: 1;
  position: relative;
  max-width: 540px;
}

.search-svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding: 8px 36px 8px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-family: var(--font-thai);
  font-size: 13.5px;
  background: #f8fafc;
  outline: none;
  transition: all 0.2s;
}

.topbar-search input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #e2e8f0;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-card {
  margin-left: auto;
  white-space: nowrap;
}

/* FILTER CHIPS (STAGES HORIZONTAL BAR) */
.filter-chips-container {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.filter-chips-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.filter-chips-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 5px 14px;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-thai);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.filter-chip:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.filter-chip.active {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
}

/* ==========================================================================
   3. WEBPAGE-STYLE SECTIONS WITH FULL-WIDTH DIVIDERS
   ========================================================================== */
.cards-feed-wrapper {
  padding: 20px 28px;
  flex-grow: 1;
}

.feed-hero-bar {
  margin-bottom: 20px;
}

.feed-main-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-thai);
}

.feed-count-tag {
  font-size: 12px;
  color: var(--text-muted);
}

/* STAGE SECTION BLOCK */
.stage-section-block {
  margin-bottom: 32px;
  border-radius: var(--radius-lg);
  padding: 8px 0;
  transition: background-color 0.2s;
}

.stage-section-block.drag-over-section {
  background: #e0f2fe;
  outline: 2px dashed #0284c7;
}

/* FULL-WIDTH DIVIDER (LIKE WEBPAGE HTML SECTION) */
.stage-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stage-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.stage-badge-icon {
  font-size: 14px;
}

.stage-title-text {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.2px;
}

.stage-count-pill {
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.stage-rule-line {
  flex-grow: 1;
  height: 1px;
  background: #cbd5e1;
}

.stage-quick-add-btn {
  font-size: 11.5px;
  color: var(--primary);
  background: transparent;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: all 0.15s;
}
.stage-quick-add-btn:hover { background: var(--primary); color: #fff; }

/* STAGE CARDS GRID */
.stage-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

@media (max-width: 768px) {
  .stage-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   4. TEMPLATE CARD COMPONENT
   ========================================================================== */
.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  position: relative;
  cursor: pointer;
}

.template-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.06);
}

.template-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-category-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #475569;
}

.card-header-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.35;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.tag-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-weight: 500;
}

/* LINE BUBBLES */
.card-bubbles-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.message-bubble-item {
  background: var(--line-bubble-bg);
  border: 1px solid var(--line-bubble-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.bubble-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.bubble-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--line-brand);
}

.copy-bubble-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--line-brand);
  color: var(--line-brand);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.copy-bubble-btn:hover { background: var(--line-brand); color: #ffffff; }

.bubble-text {
  font-size: 13px;
  color: #1e293b;
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
}

/* EMAIL SUBJECT & BODY */
.email-subject-box {
  background: var(--gmail-box-bg);
  border: 1px solid var(--gmail-box-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.email-subject-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #991b1b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-body-preview {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.55;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.email-body-preview h1 { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; color: #0f172a; }
.email-body-preview h2 { font-size: 13.5px; font-weight: 600; margin-top: 10px; margin-bottom: 4px; color: var(--primary); }
.email-body-preview ul {
  padding-left: 28px;
  margin: 8px 0;
  list-style-position: outside;
}
.email-body-preview small { font-size: 11px; color: #64748b; }

/* CARD BOTTOM BAR */
.card-bottom-bar {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.btn-copy-full {
  width: 100%;
  padding: 8px 12px;
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-thai);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-copy-full:hover { background: #1e293b; }

.btn-copy-full.email-copy {
  background: var(--gmail-brand);
}
.btn-copy-full.email-copy:hover { background: var(--gmail-brand-hover); }

/* ==========================================================================
   5. COMPACT FLOATING POPOVER MENU (REPLACING GIANT MODAL)
   ========================================================================== */
.floating-popover {
  position: absolute;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 6px;
  min-width: 190px;
  z-index: 500;
  font-family: var(--font-sans);
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-main);
  border-radius: var(--radius-xs);
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s;
}
.popover-menu-item:hover { background: #f1f5f9; }

.popover-menu-item.danger-item { color: var(--danger); }
.popover-menu-item.danger-item:hover { background: #fef2f2; }

.popover-divider {
  border: none;
  border-top: 1px solid #f1f5f9;
  margin: 4px 0;
}

/* POP OVER SUBMENU */
.popover-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 6px;
  min-width: 170px;
  max-height: 220px;
  overflow-y: auto;
}
.popover-menu-item.has-sub:hover .popover-submenu { display: block; }

.submenu-item {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-main);
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
}
.submenu-item:hover { background: #f1f5f9; color: var(--primary); }

/* ==========================================================================
   6. EDIT CARD MODAL & ENHANCED TOOLBAR
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card.modal-sm { max-width: 420px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 600; font-family: var(--font-sans); }
.modal-close { border: none; background: transparent; font-size: 24px; color: var(--text-light); cursor: pointer; }

.modal-body { padding: 18px 20px; overflow-y: auto; flex-grow: 1; }
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
}
.footer-actions { display: flex; gap: 8px; margin-left: auto; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.form-row { display: flex; gap: 12px; }
.form-row .col { flex: 1; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-thai);
  font-size: 13px;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; margin-bottom: 10px; }

/* LINE BUBBLE EDIT CARD WITH BOLD/ITALIC MINI-TOOLBAR */
.bubble-edit-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 10px;
}
.bubble-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.bubble-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.bubble-tool-btn {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.bubble-tool-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.bubble-textarea {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-thai);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease;
}
.bubble-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ENHANCED RICH TEXT TOOLBAR FOR EMAIL */
.rich-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
  border-bottom: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tb-label { font-size: 11.5px; font-weight: 600; color: #475569; font-family: var(--font-sans); }

.toolbar-select {
  padding: 4px 10px;
  font-size: 12.5px;
  font-family: var(--font-thai);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
  outline: none;
  cursor: pointer;
}

.tool-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
}
.tool-btn:hover { background: #e2e8f0; }

.toolbar-color-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
}

.color-tool-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* COHESIVE COLOR PICKER BAR */
.hex-picker-combo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.native-color-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 1px;
  background: #fff;
}

.hex-input {
  width: 84px;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  text-transform: uppercase;
  background: #fff;
}

.swatches-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-swatch:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px var(--primary);
}

/* RICH EDITOR AREA & BULLET OFFSET FIX (OFFSETTED TO THE RIGHT) */
.rich-editor-area {
  min-height: 220px;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  background: #ffffff;
}

.rich-editor-area:focus { border-color: var(--primary); }

.rich-editor-area ul,
.email-body-preview ul {
  padding-left: 36px;
  margin: 10px 0;
  list-style-position: outside;
}

.rich-editor-area li,
.email-body-preview li {
  margin-bottom: 6px;
  padding-left: 4px;
}

/* BUTTONS & TOAST */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.btn-primary { background: var(--primary); color: #ffffff; padding: 8px 16px; font-size: 13px; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #e2e8f0; color: var(--text-main); padding: 8px 16px; font-size: 13px; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); padding: 5px 10px; font-size: 12px; }
.btn-outline:hover { background: #f1f5f9; }

.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 8px 16px; font-size: 13px; }
.btn-danger-outline:hover { background: #fef2f2; }

.btn-xs { padding: 3px 8px; font-size: 11px; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: #e2e8f0; color: var(--text-main); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
  z-index: 2000;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* UNAUTHENTICATED HERO */
.unauth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: #090d16;
}
.unauth-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.unauth-card .lock-icon { font-size: 48px; margin-bottom: 16px; line-height: 1; }
.unauth-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: #0f172a; font-family: var(--font-sans); }
.unauth-card p { font-size: 13px; color: #64748b; margin-bottom: 24px; line-height: 1.5; }
.google-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 20px;
}
#googleSignInBtn {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}
#googleSignInBtn > div {
  margin: 0 auto !important;
}
.auth-divider { position: relative; text-align: center; margin: 20px 0; width: 100%; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: #e2e8f0; }
.auth-divider span { position: relative; background: #fff; padding: 0 10px; font-size: 10px; color: var(--text-light); font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.5px; }
.dev-login-box { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; width: 100%; }
.dev-input { padding: 10px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: 13px; text-align: center; }
.btn-dev { background: #0284c7; color: #fff; padding: 10px 16px; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); border: none; cursor: pointer; transition: background 0.15s ease; }
.btn-dev:hover { background: #0369a1; }
.auth-note { font-size: 11px; color: #94a3b8; }

/* MOBILE RESPONSIVENESS */
.mobile-only { display: none; }

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
    z-index: 250;
  }
  .app-sidebar.open { transform: translateX(0); }
  .hamburger-btn { display: inline-flex; }
  .mobile-only { display: inline-flex; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 240;
  }
  .sidebar-overlay.show { display: block; }
}

/* ==========================================================================
   7. GOOGLE KEEP STYLE COLLAPSIBLE RAIL SIDEBAR (PC DESKTOP)
   ========================================================================== */
@media (min-width: 901px) {
  .mobile-only {
    display: none !important;
  }

  .app-sidebar {
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* COLLAPSED RAIL STATE (Minimalist Icons-Only Sidebar) */
  .app-sidebar.collapsed-rail {
    width: 64px;
    overflow-x: hidden;
  }

  .app-sidebar.collapsed-rail .brand-text,
  .app-sidebar.collapsed-rail .block-label,
  .app-sidebar.collapsed-rail .header-action-group,
  .app-sidebar.collapsed-rail .btn-sidebar-action,
  .app-sidebar.collapsed-rail .tab-label,
  .app-sidebar.collapsed-rail .nav-text,
  .app-sidebar.collapsed-rail .nav-badge-count,
  .app-sidebar.collapsed-rail .sync-meta-row,
  .app-sidebar.collapsed-rail .user-meta-left,
  .app-sidebar.collapsed-rail .btn-logout span {
    display: none !important;
  }

  .app-sidebar.collapsed-rail .sidebar-header {
    padding: 14px 0;
    justify-content: center;
    min-height: 64px;
  }

  .app-sidebar.collapsed-rail .brand-badge {
    gap: 0;
    justify-content: center;
    width: 100%;
  }

  .app-sidebar.collapsed-rail .brand-text {
    display: none !important;
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .app-sidebar.collapsed-rail .hamburger-brand-btn {
    margin: 0 auto;
    width: 38px;
    height: 38px;
  }

  .app-sidebar.collapsed-rail .sidebar-block {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .app-sidebar.collapsed-rail .block-header-flex {
    display: none !important;
  }

  /* CHANNEL SWITCHER (Single Current Status Indicator) */
  .app-sidebar.collapsed-rail .channel-block {
    padding: 12px 0;
  }

  .app-sidebar.collapsed-rail .channel-segmented {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 0;
  }

  .app-sidebar.collapsed-rail .channel-tab:not(.active) {
    display: none !important;
  }

  .app-sidebar.collapsed-rail .channel-tab.active {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    padding: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .app-sidebar.collapsed-rail .channel-tab.active:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  }

  .app-sidebar.collapsed-rail .channel-tab.active .tab-svg {
    width: 20px;
    height: 20px;
    margin: 0;
  }

  /* SERVICES & SECTIONS NAV LISTS IN RAIL */
  .app-sidebar.collapsed-rail .services-nav-list,
  .app-sidebar.collapsed-rail .stages-nav-list {
    width: 100%;
    align-items: center;
    gap: 4px;
    padding: 0;
  }

  .app-sidebar.collapsed-rail .nav-item-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0 auto;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
  }

  .app-sidebar.collapsed-rail .nav-item-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }

  .app-sidebar.collapsed-rail .nav-item-btn.active {
    background: var(--sb-active-bg);
    color: #38bdf8;
    box-shadow: inset 0 0 0 1.5px rgba(56, 189, 248, 0.5);
  }

  .app-sidebar.collapsed-rail .nav-item-left {
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 100%;
    margin: 0;
  }

  .app-sidebar.collapsed-rail .nav-icon {
    font-size: 16px;
    width: 20px;
    height: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
  }

  .app-sidebar.collapsed-rail .nav-icon svg {
    width: 18px;
    height: 18px;
  }

  /* SIDEBAR FOOTER IN RAIL */
  .app-sidebar.collapsed-rail .sidebar-footer {
    padding: 12px 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .app-sidebar.collapsed-rail .sync-widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0 auto;
    width: 40px;
    display: flex;
    justify-content: center;
  }

  .app-sidebar.collapsed-rail .sync-refresh-btn {
    width: 38px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    cursor: pointer;
  }

  .app-sidebar.collapsed-rail .sync-refresh-btn:hover {
    background: #1e293b;
    border-color: var(--primary);
  }

  .app-sidebar.collapsed-rail .sync-refresh-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
  }

  .app-sidebar.collapsed-rail .user-meta-bar {
    justify-content: center;
    padding: 0;
    width: 100%;
  }

  .app-sidebar.collapsed-rail .btn-logout {
    width: 38px;
    height: 36px;
    padding: 0;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-sm);
    margin: 0 auto;
  }

  .app-sidebar.collapsed-rail .btn-logout svg {
    width: 16px;
    height: 16px;
  }
}

/* ==========================================================================
   8. DRAG & DROP INSERTION INDICATORS (GAP & GLOWING BLUE BEAM)
   ========================================================================== */
.template-card {
  position: relative;
  transition: margin 0.15s cubic-bezier(0.2, 0, 0, 1), transform 0.15s ease, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}

.template-card.dragging {
  opacity: 0.35;
  transform: scale(0.96);
  box-shadow: var(--shadow-modal);
}

.template-card.drag-target-before {
  margin-left: 16px !important;
}
.template-card.drag-target-before::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.9), 0 0 3px #38bdf8;
  pointer-events: none;
  z-index: 50;
}

.template-card.drag-target-after {
  margin-right: 16px !important;
}
.template-card.drag-target-after::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.9), 0 0 3px #38bdf8;
  pointer-events: none;
  z-index: 50;
}

.template-card.touch-holding {
  transform: scale(1.03);
  box-shadow: 0 12px 24px -6px rgba(2, 132, 199, 0.4);
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .template-card.drag-target-before {
    margin-left: 0 !important;
    margin-top: 14px !important;
  }
  .template-card.drag-target-before::before {
    left: 4px;
    right: 4px;
    top: -8px;
    bottom: auto;
    width: auto;
    height: 4px;
  }
  .template-card.drag-target-after {
    margin-right: 0 !important;
    margin-bottom: 14px !important;
  }
  .template-card.drag-target-after::after {
    left: 4px;
    right: 4px;
    bottom: -8px;
    top: auto;
    width: auto;
    height: 4px;
  }
}


/* HORIZONTAL INSERTION INDICATOR (FILTER CHIPS) */
.filter-chip {
  position: relative;
  transition: margin 0.15s cubic-bezier(0.2, 0, 0, 1), transform 0.15s ease;
}

.filter-chip.section-chip-dragging {
  opacity: 0.35;
  transform: scale(0.95);
}

.filter-chip.drop-insert-before {
  margin-left: 14px !important;
}
.filter-chip.drop-insert-before::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 2px;
  bottom: 2px;
  width: 3px;
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.9), 0 0 2px #38bdf8;
  pointer-events: none;
  z-index: 100;
}

.filter-chip.drop-insert-after {
  margin-right: 14px !important;
}
.filter-chip.drop-insert-after::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 2px;
  bottom: 2px;
  width: 3px;
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.9), 0 0 2px #38bdf8;
  pointer-events: none;
  z-index: 100;
}

/* VERTICAL INSERTION INDICATOR (SIDEBAR & MANAGE LISTS) */
.nav-item-btn,
.manage-row {
  position: relative;
  transition: margin 0.15s cubic-bezier(0.2, 0, 0, 1), transform 0.15s ease;
}

.nav-item-btn.section-nav-dragging,
.manage-row.row-dragging {
  opacity: 0.35;
  transform: scale(0.97);
}

.nav-item-btn.drop-insert-before,
.manage-row.drop-insert-before {
  margin-top: 12px !important;
}
.nav-item-btn.drop-insert-before::before,
.manage-row.drop-insert-before::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 4px;
  right: 4px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.9), 0 0 2px #38bdf8;
  pointer-events: none;
  z-index: 100;
}

.nav-item-btn.drop-insert-after,
.manage-row.drop-insert-after {
  margin-bottom: 12px !important;
}
.nav-item-btn.drop-insert-after::after,
.manage-row.drop-insert-after::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 4px;
  right: 4px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.9), 0 0 2px #38bdf8;
  pointer-events: none;
  z-index: 100;
}

/* ==========================================================================
   9. CUSTOM 3-BUTTON UNSAVED CHANGES MODAL
   ========================================================================== */
.unsaved-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-success-action {
  background: #16a34a;
  color: #ffffff;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn-success-action:hover { background: #15803d; }

.btn-danger-action {
  background: #ea4335;
  color: #ffffff;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn-danger-action:hover { background: #d93025; }

/* ==========================================================================
   10. SECTION & SERVICE ACTIONS (RENAME / DELETE)
   ========================================================================== */
.stage-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.stage-action-icon {
  background: transparent;
  border: none;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}
.stage-action-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.stage-action-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.stage-action-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.stage-action-icon.danger-hover:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* MANAGE MODALS (SERVICES & SECTIONS) */
.modal-title-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-sans);
}
.modal-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 2px;
}

.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease;
}
.manage-row:hover {
  background: #f1f5f9;
}

.manage-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  overflow: hidden;
}

.manage-row-icon {
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.manage-row-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-rename-input {
  font-size: 13px;
  padding: 3px 8px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: #ffffff;
  outline: none;
  width: 100%;
  max-width: 220px;
}

.manage-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

.manage-count-badge {
  font-size: 11px;
  background: #e2e8f0;
  color: #475569;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.action-svg-btn {
  background: transparent;
  border: none;
  color: #64748b;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.action-svg-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.action-svg-btn.danger-hover:hover {
  background: #fee2e2;
  color: #ef4444;
}

.manage-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}
.manage-add-row input {
  flex-grow: 1;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.manage-add-row input:focus {
  border-color: var(--primary);
}

/* MANAGE MODALS: REORDERING CONTROLS (ARROWS & DRAG HANDLE) */
.manage-drag-handle {
  cursor: grab;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 28px;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}
.manage-drag-handle:hover {
  opacity: 1;
  color: var(--primary);
}
.manage-drag-handle:active {
  cursor: grabbing;
}

.manage-reorder-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 4px;
  flex-shrink: 0;
}

.reorder-arrow-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: #64748b;
  font-size: 8px;
  line-height: 1;
  width: 20px;
  height: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.12s ease;
}
.reorder-arrow-btn:hover:not(:disabled) {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #0284c7;
}
.reorder-arrow-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: transparent;
  background: transparent;
}

/* SERVICE ROW ICON BUTTON & QUICK ADD ICON SELECTOR */
.service-row-icon-btn,
.selected-icon-preview-btn {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.service-row-icon-btn:hover,
.selected-icon-preview-btn:hover {
  background: #e0f2fe;
  border-color: var(--primary);
  transform: scale(1.06);
}

.quick-icon-select-box {
  position: relative;
  flex-shrink: 0;
}

/* BLUE THEME ICON PICKER DROPDOWN */
.service-icon-picker-dropdown {
  position: absolute;
  bottom: 45px;
  left: 0;
  width: 310px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 12px;
  z-index: 1400;
}

.icon-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.icon-picker-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
}
.icon-picker-close:hover {
  color: #0f172a;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 2px;
}

.icon-picker-item {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-picker-item:hover {
  background: #e0f2fe;
  border-color: var(--primary);
  transform: scale(1.08);
}
.icon-picker-item.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}
.icon-picker-item svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   11. LINE TEXT LIVE FORMATTING (BOLD, ITALIC, STRIKE)
   ========================================================================== */
.line-bold {
  font-weight: 700;
  color: #0f172a;
}
.line-italic {
  font-style: italic;
}
.line-strike {
  text-decoration: line-through;
  opacity: 0.75;
}
