/* ==========================================================================
   Multi-Vertical CRM (VRT) module styles
   ========================================================================== */

/* App launcher button + overlay panel
   ------------------------------------------------------------------------ */
.app-launcher-wrap { position: relative; }

.app-launcher-btn {
  width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #dee2e6; border-radius: 8px; background: #fff;
  color: #0056b3;
  margin-right: .25rem;
}
.app-launcher-btn:hover { background: #f1f5fb; border-color: var(--vrt-accent, #0056b3); }
.app-launcher-btn i { font-size: 18px; }

.app-launcher-panel {
  position: absolute; top: 48px; left: 0;
  width: 360px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 12px;
  z-index: 1080;
}
.app-launcher-header { padding: 4px 6px 10px; border-bottom: 1px solid #f1f3f5; margin-bottom: 8px; }
.app-launcher-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #6b7280; padding: 8px 6px 6px;
}
.app-launcher-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px 6px; gap: 8px;
  border-radius: 10px; text-decoration: none; color: #1f2937;
  transition: background .15s ease, transform .15s ease;
  border: 1px solid transparent;
}
.app-tile:hover { background: #f8fafc; color: #1f2937; transform: translateY(-1px); }
.app-tile.active { background: rgba(0,0,0,0.03); border-color: var(--accent, #0056b3); }
.app-tile-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent, #0056b3) 12%, white);
  color: var(--accent, #0056b3); font-size: 18px;
}
.app-tile-name { font-size: 12px; font-weight: 500; text-align: center; }

.header-app-title {
  padding: 6px 10px; border-radius: 8px; background: #f8fafc;
  font-size: 13px; color: #374151;
}

/* VRT page header chip + accent bar
   ------------------------------------------------------------------------ */
.vrt-page-header {
  position: relative;
}
.vrt-page-header::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent, #0056b3); border-radius: 2px;
}
.vrt-app-chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--accent, #0056b3) 10%, white);
  color: var(--accent, #0056b3);
}

/* Status / stage badges
   ------------------------------------------------------------------------ */
.vrt-stage-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: #f1f3f5; color: #495057;
}
.vrt-stage-badge.new       { background: #f1f3f5; color: #495057; }
.vrt-stage-badge.engaged   { background: #e0ecff; color: #1d4ed8; }
.vrt-stage-badge.booked    { background: #dbeafe; color: #0369a1; }
.vrt-stage-badge.completed { background: #fef3c7; color: #92400e; }
.vrt-stage-badge.reserved  { background: #dcfce7; color: #15803d; }

.vrt-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500; background: #f1f5f9; color: #475569;
}

/* Funnel kanban board
   ------------------------------------------------------------------------ */
.vrt-kanban {
  display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px; overflow-x: auto; padding-bottom: 4px;
}
.vrt-kanban-col {
  background: #f8fafc; border-radius: 10px; padding: 10px;
  border: 1px solid #eef2f7; min-height: 320px;
}
.vrt-kanban-col-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding: 4px 4px 8px;
  border-bottom: 2px solid var(--col-color, #cbd5e1);
}
.vrt-kanban-col-header .name { font-size: 13px; font-weight: 600; color: #1f2937; }
.vrt-kanban-col-header .count {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: white; border: 1px solid #e5e7eb; color: #6b7280;
}
.vrt-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 10px; margin-bottom: 8px; cursor: grab;
  transition: box-shadow .12s ease, transform .12s ease;
}
.vrt-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,0.06); transform: translateY(-1px); }
.vrt-card-name  { font-size: 13px; font-weight: 600; color: #111827; margin-bottom: 4px; }
.vrt-card-meta  { font-size: 11px; color: #6b7280; }
.vrt-card-row   { display: flex; justify-content: space-between; gap: 6px; align-items: center; margin-top: 6px; }

/* Stage stepper (used on lead detail)
   ------------------------------------------------------------------------ */
.vrt-stepper {
  display: flex; gap: 0; align-items: center;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
}
.vrt-step {
  flex: 1; min-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
  text-align: center;
}
.vrt-step .dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e5e7eb; color: #6b7280;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.vrt-step.done .dot    { background: #16a34a; color: #fff; }
.vrt-step.current .dot { background: var(--vrt-accent, #0056b3); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--vrt-accent, #0056b3) 20%, white); }
.vrt-step .label { font-size: 11px; color: #4b5563; font-weight: 500; }
.vrt-step.done .label, .vrt-step.current .label { color: #111827; }
.vrt-step + .vrt-step::before {
  content: ""; position: absolute; left: -50%; top: 14px;
  width: 100%; height: 2px; background: #e5e7eb; z-index: 0;
}
.vrt-step.done + .vrt-step::before,
.vrt-step.current::before { background: #16a34a; }

/* Provider availability grid
   ------------------------------------------------------------------------ */
.vrt-availability {
  display: grid; grid-template-columns: 80px repeat(7, 1fr);
  gap: 4px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 12px;
}
.vrt-availability .cell {
  font-size: 11px; padding: 6px 4px; text-align: center;
  border-radius: 6px; background: #f8fafc; color: #6b7280;
}
.vrt-availability .cell.head    { background: transparent; font-weight: 600; color: #1f2937; }
.vrt-availability .cell.on      { background: color-mix(in srgb, var(--vrt-accent, #0056b3) 15%, white); color: var(--vrt-accent, #0056b3); font-weight: 600; }
.vrt-availability .cell.off     { background: #f8fafc; color: #cbd5e1; }
.vrt-availability .cell.label   { background: transparent; text-align: right; padding-right: 8px; color: #1f2937; font-weight: 500; }

/* KPI cards
   ------------------------------------------------------------------------ */
.vrt-kpi {
  background: #fff; border: 1px solid #eef2f7; border-radius: 10px;
  padding: 16px;
}
.vrt-kpi .label { font-size: 12px; color: #6b7280; }
.vrt-kpi .value { font-size: 28px; font-weight: 600; color: #111827; line-height: 1.1; margin: 4px 0; }
.vrt-kpi .delta-up   { color: #16a34a; font-size: 12px; }
.vrt-kpi .delta-down { color: #dc2626; font-size: 12px; }
.vrt-kpi .icon-circle {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--vrt-accent, #0056b3) 12%, white);
  color: var(--vrt-accent, #0056b3);
}

/* Calendar grid (week view)
   ------------------------------------------------------------------------ */
.vrt-cal-week {
  display: grid; grid-template-columns: 80px repeat(7, 1fr);
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden;
}
.vrt-cal-week .cal-cell { border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; padding: 6px; min-height: 60px; }
.vrt-cal-week .cal-cell:last-child { border-right: none; }
.vrt-cal-week .cal-head { font-weight: 600; font-size: 12px; text-align: center; background: #f8fafc; }
.vrt-cal-week .cal-time { font-size: 11px; color: #6b7280; padding-top: 6px; text-align: right; padding-right: 8px; background: #fbfdff; }
.vrt-cal-event {
  display: block; font-size: 11px;
  padding: 4px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--vrt-accent, #0056b3) 18%, white);
  color: var(--vrt-accent, #0056b3); margin-bottom: 2px;
  border-left: 3px solid var(--vrt-accent, #0056b3);
  text-decoration: none;
}
.vrt-cal-event:hover { background: color-mix(in srgb, var(--vrt-accent, #0056b3) 26%, white); }

/* Conditional fields show/hide via body[data-app]
   ------------------------------------------------------------------------ */
.vrt-only-healthcare,
.vrt-only-dental,
.vrt-only-fitness,
.vrt-only-spa,
.vrt-only-weddings { display: none; }
body[data-app="healthcare"] .vrt-only-healthcare { display: block; }
body[data-app="dental"]     .vrt-only-dental     { display: block; }
body[data-app="fitness"]    .vrt-only-fitness    { display: block; }
body[data-app="spa"]        .vrt-only-spa        { display: block; }
body[data-app="weddings"]   .vrt-only-weddings   { display: block; }

/* Tweaks for the existing demo so multi-vertical look is consistent */
body[data-app] .header .btn-outline { border-color: #e5e7eb; }

/* Responsive
   ------------------------------------------------------------------------ */
@media (max-width: 992px) {
  .app-launcher-panel { width: 320px; }
  .vrt-kanban { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}
@media (max-width: 576px) {
  .app-launcher-grid { grid-template-columns: repeat(2, 1fr); }
  .vrt-kanban { grid-template-columns: minmax(220px, 1fr); }
  .vrt-availability, .vrt-cal-week { font-size: 10px; }
}

/* ==========================================================================
   Campaigns + WhatsApp module
   ========================================================================== */

/* Wizard step indicator */
.vrt-wizard {
  display: flex; gap: 0; align-items: center;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px; margin-bottom: 1rem;
}
.vrt-wizard .step {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; color: #6b7280; font-size: 13px; font-weight: 500;
  position: relative;
}
.vrt-wizard .step .num {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e5e7eb; color: #6b7280;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.vrt-wizard .step.done .num    { background: #16a34a; color: #fff; }
.vrt-wizard .step.current .num { background: var(--vrt-accent, #0056b3); color: #fff; }
.vrt-wizard .step.current      { color: #111827; }
.vrt-wizard .step + .step::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 16px; height: 2px; background: #e5e7eb; transform: translate(-100%, -50%);
}

/* Chip filters (audience builder) */
.vrt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
  cursor: pointer; user-select: none;
}
.vrt-chip.active {
  background: color-mix(in srgb, var(--vrt-accent, #0056b3) 15%, white);
  color: var(--vrt-accent, #0056b3);
  border-color: var(--vrt-accent, #0056b3);
}
.vrt-chip .x { font-size: 10px; opacity: .6; }

/* Channel cards (broadcast wizard) */
.vrt-channel-card {
  border: 2px solid #e5e7eb; border-radius: 10px;
  padding: 14px; cursor: pointer; transition: all .15s ease;
  background: #fff; height: 100%;
}
.vrt-channel-card:hover { border-color: #cbd5e1; }
.vrt-channel-card.selected {
  border-color: var(--vrt-accent, #0056b3);
  background: color-mix(in srgb, var(--vrt-accent, #0056b3) 5%, white);
}
.vrt-channel-card .ch-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; font-size: 18px; margin-bottom: 8px;
}
.vrt-channel-card.wa .ch-icon  { background: #dcfce7; color: #16a34a; }
.vrt-channel-card.sms .ch-icon { background: #dbeafe; color: #2563eb; }
.vrt-channel-card.em .ch-icon  { background: #f3e8ff; color: #7c3aed; }
.vrt-channel-recommend {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: #16a34a; color: #fff; margin-left: 6px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Journey builder canvas */
.vrt-journey {
  display: grid; grid-template-columns: 220px 1fr 280px; gap: 12px;
  min-height: 540px;
}
.vrt-journey .panel {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px;
  overflow-y: auto;
}
.vrt-journey .panel-title { font-size: 12px; font-weight: 600; text-transform: uppercase; color: #6b7280; letter-spacing: .06em; margin-bottom: 8px; }
.vrt-journey .canvas {
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 24px; min-height: 540px; position: relative;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 16px 16px;
}
.vrt-flow-node {
  background: #fff; border: 2px solid #e5e7eb; border-radius: 10px;
  padding: 10px 12px; width: 220px; margin: 0 auto 28px;
  position: relative; cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease;
}
.vrt-flow-node:hover { box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.vrt-flow-node.selected { border-color: var(--vrt-accent, #0056b3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--vrt-accent, #0056b3) 15%, transparent); }
.vrt-flow-node .node-type { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; }
.vrt-flow-node .node-title { font-size: 13px; font-weight: 600; color: #111827; margin-top: 2px; }
.vrt-flow-node .node-meta { font-size: 11px; color: #6b7280; margin-top: 4px; }
.vrt-flow-node.trigger  { border-color: #f59e0b; background: #fffbeb; }
.vrt-flow-node.wait     { border-color: #cbd5e1; background: #f8fafc; }
.vrt-flow-node.message  { border-color: #16a34a; background: #f0fdf4; }
.vrt-flow-node.branch   { border-color: #8b5cf6; background: #faf5ff; }
.vrt-flow-node.end      { border-color: #94a3b8; background: #f1f5f9; }
.vrt-flow-connector {
  width: 2px; height: 20px; background: #cbd5e1;
  margin: -16px auto 8px;
}
.vrt-flow-branches {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  position: relative;
}
.vrt-flow-branch-label {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 10px; padding: 2px 8px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 999px; color: #6b7280;
}

/* Drag-icon list in journey left rail */
.vrt-flow-source {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px dashed #cbd5e1; border-radius: 8px;
  background: #fff; margin-bottom: 6px; cursor: grab;
  font-size: 12px;
}
.vrt-flow-source:hover { border-color: var(--vrt-accent, #0056b3); }
.vrt-flow-source i { color: #6b7280; }

/* WhatsApp inbox layout */
.vrt-wa-shell {
  display: grid; grid-template-columns: 320px 1fr 320px; gap: 0;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  height: calc(100vh - 240px); min-height: 520px; overflow: hidden;
}
.vrt-wa-list  { border-right: 1px solid #f1f5f9; overflow-y: auto; }
.vrt-wa-chat  { display: flex; flex-direction: column; background: #f0f2f5; }
.vrt-wa-side  { border-left: 1px solid #f1f5f9; overflow-y: auto; padding: 16px; }

.vrt-wa-list-header { padding: 12px; border-bottom: 1px solid #f1f5f9; }
.vrt-wa-search { background: #f1f5f9; border: none; border-radius: 8px; padding: 6px 12px; font-size: 13px; width: 100%; }
.vrt-wa-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 12px 4px; }

.vrt-wa-conv {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid #f8fafc; cursor: pointer; align-items: flex-start;
  text-decoration: none; color: inherit;
}
.vrt-wa-conv:hover, .vrt-wa-conv.active { background: #f8fafc; }
.vrt-wa-conv .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.vrt-wa-conv .meta   { flex: 1; min-width: 0; }
.vrt-wa-conv .name   { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrt-wa-conv .preview{ font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrt-wa-conv .time   { font-size: 10px; color: #94a3b8; white-space: nowrap; }
.vrt-wa-conv .badge-unread {
  background: var(--vrt-accent, #16a34a); color: #fff;
  border-radius: 999px; padding: 1px 6px; font-size: 10px; font-weight: 600;
}

.vrt-wa-chat-header { background: #fff; padding: 10px 16px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.vrt-wa-msgs { flex: 1; overflow-y: auto; padding: 16px; background: #efeae2 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><circle cx='2' cy='2' r='1' fill='%23d6cfc4'/></svg>"); }
.vrt-wa-msg { max-width: 70%; padding: 6px 10px 4px; border-radius: 10px; margin-bottom: 6px; font-size: 13px; box-shadow: 0 1px 0 rgba(0,0,0,.06); position: relative; }
.vrt-wa-msg.in  { background: #fff; }
.vrt-wa-msg.out { background: #d9fdd3; margin-left: auto; }
.vrt-wa-msg .ts { font-size: 10px; color: #6b7280; margin-left: 8px; }
.vrt-wa-msg.tpl { border-left: 3px solid #16a34a; padding-left: 8px; }
.vrt-wa-msg .tpl-tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: #16a34a; color: #fff; margin-bottom: 4px; }

.vrt-wa-composer { background: #f0f2f5; padding: 12px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; align-items: center; }
.vrt-wa-composer input { flex: 1; border: none; border-radius: 24px; padding: 10px 16px; background: #fff; font-size: 13px; }
.vrt-wa-window-warning {
  background: #fef3c7; border-top: 1px solid #fde68a;
  padding: 8px 16px; font-size: 12px; color: #92400e;
}

/* WA template card */
.vrt-tpl-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px; height: 100%;
  display: flex; flex-direction: column;
}
.vrt-tpl-card .tpl-cat {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; color: #475569; text-transform: uppercase; letter-spacing: .05em;
  align-self: flex-start;
}
.vrt-tpl-card .tpl-cat.marketing { background: #fef3c7; color: #92400e; }
.vrt-tpl-card .tpl-cat.utility   { background: #dbeafe; color: #1d4ed8; }
.vrt-tpl-card .tpl-cat.auth      { background: #f3e8ff; color: #6d28d9; }
.vrt-tpl-card .tpl-preview {
  background: #f8fafc; border: 1px dashed #e5e7eb; border-radius: 8px;
  padding: 10px; font-size: 12px; color: #374151; white-space: pre-wrap;
  margin: 8px 0; flex: 1;
}
.vrt-tpl-card .tpl-var { color: var(--vrt-accent, #0056b3); font-weight: 600; }

/* WA 24h window pill */
.vrt-wa-pill-window {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: #fef3c7; color: #92400e;
}
.vrt-wa-pill-window.open { background: #dcfce7; color: #166534; }
.vrt-wa-pill-window.closed { background: #fee2e2; color: #991b1b; }

@media (max-width: 992px) {
  .vrt-journey { grid-template-columns: 1fr; }
  .vrt-wa-shell { grid-template-columns: 280px 1fr; }
  .vrt-wa-side  { display: none; }
}
@media (max-width: 768px) {
  .vrt-wa-shell { grid-template-columns: 1fr; }
  .vrt-wa-list  { display: none; }
}
