/* App-level tweaks; theme tokens live in views/layout.php (includes/theme.php) */
.ec-card .card-body { border-radius: var(--ec-card-radius); }

.ec-pwa-install-fab {
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 1040;
  font-weight: 600;
  border-radius: 999px;
  padding-inline: 0.9rem;
  box-shadow: 0 10px 30px rgba(10, 35, 66, 0.22);
}
@media (max-width: 767.98px) {
  body.ec-has-bottom-nav .ec-pwa-install-fab {
    bottom: calc(76px + max(0.75rem, env(safe-area-inset-bottom)));
  }
}
.ec-pwa-install-card {
  border-radius: 18px;
}
.ec-pwa-ios-svg-wrap {
  aspect-ratio: 320 / 420;
  max-height: min(52vh, 420px);
  margin-inline: auto;
  max-width: 320px;
}
.ec-pwa-ios-svg-wrap object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.ec-wa-hero {
  background: linear-gradient(135deg, #0f3d2e, #165b47 48%, #1d3557);
  color: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 18px 42px rgba(10, 35, 66, 0.18);
}
.ec-wa-hero-main,
.ec-wa-section-head,
.ec-wa-sendbar,
.ec-wa-feed-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.ec-wa-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}
.ec-wa-title {
  margin: 0.25rem 0 0;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  font-weight: 800;
}
.ec-wa-subtitle {
  margin: 0.2rem 0 0;
  color: rgba(255, 255, 255, 0.78);
}
.ec-wa-hero-actions {
  display: flex;
  gap: 0.5rem;
}
.ec-wa-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}
.ec-wa-metrics div {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0.7rem;
}
.ec-wa-metrics span {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
}
.ec-wa-metrics small {
  color: rgba(255, 255, 255, 0.72);
}
.ec-wa-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #eef3f6;
  padding: 0.25rem;
  border-radius: 8px;
}
.ec-wa-tabs button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #475569;
  font-weight: 700;
}
.ec-wa-tabs button.active {
  background: #fff;
  color: #146c43;
  box-shadow: 0 8px 20px rgba(10, 35, 66, 0.08);
}
.ec-wa-panel {
  background: transparent;
}
.ec-wa-grid,
.ec-wa-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 1rem;
}
.ec-wa-composer,
.ec-wa-preview,
.ec-wa-activity-grid > div {
  background: #fff;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(10, 35, 66, 0.07);
}
.ec-wa-section-head h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 800;
}
.ec-wa-section-head p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}
.ec-wa-option-group {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}
.ec-wa-option {
  display: flex;
  gap: 0.7rem;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  padding: 0.8rem;
  cursor: pointer;
}
.ec-wa-option input {
  margin-top: 0.2rem;
}
.ec-wa-option span,
.ec-wa-sendbar div,
.ec-wa-prep-row span {
  min-width: 0;
}
.ec-wa-option strong,
.ec-wa-option small,
.ec-wa-sendbar strong,
.ec-wa-sendbar small,
.ec-wa-prep-row small {
  display: block;
}
.ec-wa-option small,
.ec-wa-sendbar small,
.ec-wa-prep-row small {
  color: #64748b;
}
.ec-wa-sendbar {
  margin-top: 1rem;
  border-top: 1px solid #edf2f7;
  padding-top: 1rem;
  align-items: center;
}
.ec-wa-sendbar .btn {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ec-wa-phone {
  max-width: 360px;
  margin-inline: auto;
  background: #e8f5ee;
  border: 1px solid #cfe8db;
  border-radius: 8px;
  padding: 0.65rem;
}
.ec-wa-phone-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #1f513f;
  font-size: 0.78rem;
  margin-bottom: 0.6rem;
}
.ec-wa-bubble {
  background: #fff;
  border-radius: 8px;
  padding: 0.7rem;
  box-shadow: 0 6px 18px rgba(20, 108, 67, 0.12);
}
.ec-wa-img {
  aspect-ratio: 16 / 9;
  background: #f1f5f9;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  margin-bottom: 0.65rem;
}
.ec-wa-bubble p {
  white-space: pre-wrap;
  margin: 0;
  font-size: 0.9rem;
}
.ec-wa-prep-list {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.45rem;
}
.ec-wa-prep-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.55rem 0.65rem;
  background: #f8fafc;
  border-radius: 8px;
}
.ec-wa-filter {
  display: flex;
  gap: 0.5rem;
}
.ec-wa-list-title {
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0 0 0.7rem;
}
.ec-wa-feed {
  display: grid;
  gap: 0.65rem;
}
.ec-wa-feed-item,
.ec-wa-empty {
  border: 1px solid #e3e9ef;
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem;
}
.ec-wa-feed-meta {
  color: #64748b;
  font-size: 0.78rem;
  margin: 0.1rem 0 0.45rem;
}
.ec-wa-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: capitalize;
}
.ec-wa-badge-sent { background: #e0f2fe; color: #075985; }
.ec-wa-badge-delivered { background: #dcfce7; color: #166534; }
.ec-wa-badge-read { background: #ede9fe; color: #5b21b6; }
.ec-wa-badge-failed { background: #fee2e2; color: #991b1b; }
.ec-wa-badge-reply { background: #fef3c7; color: #92400e; }
.ec-wa-reply-item {
  border-left: 3px solid #25d366;
}
.ec-wa-empty {
  color: #64748b;
  background: #f8fafc;
}
.ec-recipient-picker {
  margin-top: 0.85rem;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  padding: 0.75rem;
  background: #f8fafc;
}
.ec-recipient-selected {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  margin-bottom: 0.55rem;
  max-height: 4.25rem;
  overflow: auto;
}
.ec-recipient-list {
  display: grid;
  gap: 0.45rem;
  max-height: 280px;
  overflow: auto;
  padding-right: 0.15rem;
}
.ec-recipient-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: #fff;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
}
.ec-recipient-row input {
  margin-top: 0.2rem;
}
.ec-recipient-row span {
  min-width: 0;
}
.ec-recipient-row strong,
.ec-recipient-row small {
  display: block;
}
.ec-recipient-row small {
  color: #64748b;
}
.ec-event-actions .btn,
#ecEventsList .btn {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}
#ecEventModal .modal-content {
  border: 0;
}
@media (max-width: 767.98px) {
  .ec-wa-hero {
    padding: 0.9rem;
  }
  .ec-wa-hero-main,
  .ec-wa-section-head,
  .ec-wa-sendbar {
    flex-direction: column;
  }
  .ec-wa-hero-actions,
  .ec-wa-filter,
  .ec-wa-sendbar .d-flex {
    width: 100%;
  }
  .ec-wa-hero-actions .btn,
  .ec-wa-sendbar .btn {
    flex: 1 1 0;
  }
  .ec-wa-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ec-wa-grid,
  .ec-wa-activity-grid {
    grid-template-columns: 1fr;
  }
  .ec-wa-tabs button span {
    font-size: 0.86rem;
  }
}

.ec-card-template-preview {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  background: #f8fafc;
  display: grid;
  place-items: center;
}
.ec-card-template-preview img { max-width: 100%; max-height: 220px; object-fit: contain; }
.ec-template-app { min-height: calc(100vh - 140px); }
.ec-template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.ec-template-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 260px;
  gap: .85rem;
  align-items: stretch;
}
.ec-template-side,
.ec-template-work,
.ec-template-panel { min-width: 0; }
.ec-template-panel,
.ec-template-work {
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(10,35,66,.06);
}
.ec-template-panel { padding: .8rem; margin-bottom: .85rem; }
.ec-template-panel-title {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 700;
  color: #172554;
  margin-bottom: .7rem;
}
.ec-template-list {
  display: grid;
  gap: .55rem;
  max-height: 380px;
  overflow: auto;
}
.ec-template-list button {
  border: 1px solid #e3e8ef;
  background: #f8fafc;
  color: #172554;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: .55rem;
  align-items: center;
  text-align: left;
  border-radius: 8px;
  padding: .45rem;
}
.ec-template-list img {
  width: 52px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}
.ec-template-presets,
.ec-template-color-row,
.ec-template-toolbar,
.ec-template-placeholder-bar,
.ec-template-layer-actions,
.ec-template-format {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.ec-template-presets button,
.ec-template-toolbar button,
.ec-template-placeholder-bar button,
.ec-template-layer-actions button,
.ec-template-format button {
  border: 1px solid #d7dee8;
  background: #fff;
  color: #172554;
  border-radius: 8px;
  min-width: 36px;
  min-height: 36px;
}
.ec-template-presets button,
.ec-template-placeholder-bar button { padding: .35rem .55rem; font-size: .82rem; }
.ec-template-color-row input[type="color"],
.ec-template-format input[type="color"] {
  width: 42px;
  height: 36px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
}
.ec-template-work {
  display: grid;
  grid-template-rows: auto auto minmax(520px, 1fr);
  overflow: hidden;
}
.ec-template-toolbar { padding: .6rem; border-bottom: 1px solid #e3e8ef; }
.ec-template-toolbar span { flex: 1; }
.ec-template-placeholder-bar {
  padding: .55rem .6rem;
  border-bottom: 1px solid #e3e8ef;
  background: #f8fafc;
}
.ec-template-canvas-wrap {
  min-height: 520px;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}
.ec-template-canvas-wrap canvas { box-shadow: 0 16px 42px rgba(15,23,42,.18); }
.ec-template-props label {
  font-size: .72rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: .2rem;
}
.ec-template-layers {
  display: grid;
  gap: .4rem;
  margin-top: .5rem;
  max-height: 300px;
  overflow: auto;
}
.ec-template-layers button {
  border: 1px solid #e3e8ef;
  background: #fff;
  color: #172554;
  text-align: left;
  border-radius: 8px;
  padding: .45rem .55rem;
  font-size: .85rem;
}
.ec-template-layers button.active {
  border-color: var(--ec-secondary);
  background: rgba(201,162,39,.12);
}
@media (max-width: 991.98px) {
  .ec-template-grid { grid-template-columns: 1fr; }
  .ec-template-work { grid-row: 1; }
  .ec-template-canvas-wrap { min-height: 440px; }
}

.ec-template-app {
  width: min(1480px, calc(100vw - 1.5rem));
  margin-left: 50%;
  transform: translateX(-50%);
  min-height: calc(100vh - 112px);
}
.ec-template-topbar,
.ec-template-toolbelt {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(10,35,66,.06);
}
.ec-template-topbar {
  justify-content: space-between;
  padding: .65rem;
  margin-bottom: .6rem;
}
.ec-template-title,
.ec-template-actions,
.ec-template-top-controls,
.ec-template-tool-group {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.ec-template-title h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #172554;
}
.ec-template-name {
  width: clamp(180px, 22vw, 320px);
  height: 38px;
  padding: .45rem .65rem;
}
.ec-template-icon-btn,
.ec-template-toolbelt button,
.ec-template-layer-actions button,
.ec-template-format button,
.ec-template-inspector-actions button {
  border: 1px solid #d7dee8;
  background: #fff;
  color: #172554;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  flex: 0 0 auto;
}
.ec-template-icon-btn:hover,
.ec-template-toolbelt button:hover,
.ec-template-layer-actions button:hover,
.ec-template-format button:hover,
.ec-template-inspector-actions button:hover {
  border-color: var(--ec-secondary);
  background: rgba(201,162,39,.1);
  color: #172554;
}
.ec-template-primary {
  background: var(--ec-primary);
  border-color: var(--ec-primary);
  color: #fff;
}
.ec-template-primary:hover {
  background: var(--ec-primary-light);
  border-color: var(--ec-primary-light);
  color: #fff;
}
.ec-template-segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  background: #eef3f6;
  border-radius: 8px;
  padding: .2rem;
  height: 38px;
}
.ec-template-segmented button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: #475569;
  font-weight: 800;
  font-size: .78rem;
  padding: 0 .55rem;
}
.ec-template-segmented button:hover {
  background: #fff;
  color: #172554;
}
.ec-template-number,
.ec-template-color,
.ec-template-color-wide {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid #d7dee8;
  background: #fff;
  border-radius: 8px;
  height: 38px;
  padding: 0 .45rem;
  color: #64748b;
}
.ec-template-number input {
  width: 64px;
  border: 0;
  outline: 0;
  color: #172554;
  font-weight: 700;
}
.ec-template-color input,
.ec-template-color-wide input {
  width: 28px;
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
}
.ec-template-toolbelt {
  padding: .45rem;
  margin-bottom: .6rem;
  overflow-x: auto;
}
.ec-template-tool-group {
  border-right: 1px solid #e3e8ef;
  padding-right: .55rem;
}
.ec-template-tool-group:last-child {
  border-right: 0;
  padding-right: 0;
}
.ec-template-placeholder-bar {
  padding: 0 .55rem 0 0;
  border: 0;
  background: transparent;
  flex-wrap: nowrap;
}
.ec-template-placeholder-bar button {
  width: auto;
  min-width: 38px;
  padding: 0 .6rem;
  display: inline-flex;
  gap: .35rem;
}
.ec-template-zoom {
  min-width: 48px;
  text-align: center;
  font-size: .78rem;
  font-weight: 800;
  color: #475569;
}
.ec-template-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: .7rem;
}
.ec-template-work {
  display: block;
  overflow: hidden;
}
.ec-template-canvas-wrap {
  min-height: calc(100vh - 246px);
  height: calc(100vh - 246px);
  padding: 1.1rem;
}
.ec-template-side {
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding-right: .15rem;
}
.ec-template-panel {
  margin-bottom: .65rem;
  padding: .75rem;
}
.ec-template-panel-title {
  margin-bottom: .55rem;
}
.ec-template-layer-actions,
.ec-template-format,
.ec-template-inspector-actions,
.ec-template-swatches {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
}
.ec-template-inspector-actions {
  padding-bottom: .55rem;
  margin-bottom: .55rem;
  border-bottom: 1px solid #edf2f7;
}
.ec-template-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  margin-bottom: .55rem;
}
.ec-template-field,
.ec-template-slider,
.ec-template-color-wide,
.ec-template-toggle {
  display: grid;
  gap: .25rem;
  margin-bottom: .55rem;
}
.ec-template-field span,
.ec-template-slider span,
.ec-template-color-wide span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  font-size: .72rem;
  font-weight: 800;
  color: #64748b;
}
.ec-template-field .ec-input {
  height: 36px;
  border-radius: 8px;
  padding: .4rem .55rem;
}
.ec-template-slider input[type="range"] {
  width: 100%;
  accent-color: var(--ec-secondary);
}
.ec-template-slider output {
  color: #172554;
  font-weight: 800;
}
.ec-template-color-wide {
  grid-template-columns: 1fr auto;
  height: auto;
  padding: .35rem .45rem;
}
.ec-template-color-wide span {
  font-size: .72rem;
}
.ec-template-swatches {
  margin: -.2rem 0 .55rem;
}
.ec-template-swatches button {
  width: 26px;
  height: 26px;
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: var(--swatch);
}
.ec-template-swatches button.active {
  outline: 2px solid var(--ec-secondary);
  outline-offset: 2px;
}
.ec-template-toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: #475569;
  font-weight: 700;
}
.ec-template-list {
  max-height: 260px;
}
.ec-template-list button {
  grid-template-columns: 44px minmax(0, 1fr);
}
.ec-template-list img,
.ec-template-thumb {
  width: 44px;
  height: 54px;
  border-radius: 6px;
}
.ec-template-thumb {
  display: grid;
  place-items: center;
  background: #eef3f6;
  color: #94a3b8;
}
.ec-template-layers {
  max-height: 220px;
}
.ec-template-layers button {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 36px;
}
.ec-template-layers button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ec-template-empty {
  display: grid;
  gap: .45rem;
  place-items: center;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #d7dee8;
  border-radius: 8px;
  padding: 1rem;
}
.ec-template-empty i {
  font-size: 1.3rem;
  color: var(--ec-secondary-dark);
}
.ec-template-menu {
  position: fixed;
  z-index: 1060;
  width: 176px;
  padding: .3rem;
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(10,35,66,.18);
}
.ec-template-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #172554;
  display: flex;
  align-items: center;
  gap: .55rem;
  border-radius: 6px;
  padding: .5rem .55rem;
  text-align: left;
  font-weight: 700;
}
.ec-template-menu button:hover {
  background: #f8fafc;
}
.ec-template-menu button.danger {
  color: #b91c1c;
}
@media (max-width: 1199.98px) {
  .ec-template-topbar {
    flex-wrap: wrap;
  }
  .ec-template-actions {
    margin-left: auto;
  }
}
@media (max-width: 991.98px) {
  .ec-template-app {
    width: 100%;
    margin-left: 0;
    transform: none;
  }
  .ec-template-grid {
    grid-template-columns: 1fr;
  }
  .ec-template-side {
    max-height: none;
    overflow: visible;
  }
  .ec-template-canvas-wrap {
    height: 58vh;
    min-height: 420px;
  }
  .ec-template-top-controls {
    flex-wrap: wrap;
    width: 100%;
  }
  .ec-template-name {
    width: 100%;
  }
}
@media (max-width: 575.98px) {
  .ec-template-title .small,
  .ec-template-placeholder-bar span {
    display: none;
  }
  .ec-template-number input {
    width: 54px;
  }
  .ec-template-canvas-wrap {
    min-height: 360px;
  }
}
