/*
 * ═══════════════════════════════════════════════════════════════════════════
 * DIGITAL CARDS PORTAL - FORM / CREATE / EDIT / DETAIL PAGES
 * form.css · LOAD ONLY ON FORM & DETAIL-VIEW PAGES
 * ───────────────────────────────────────────────────────────────────────────
 * Form-specific rules ONLY. Buttons, badges, modals, dropdowns, stat cards,
 * tokens and the shared summary/filter card all come from styles.css.
 *   1. Form shell + title row     8. Fields / inputs
 *   2. Form layouts               9. Password / input actions
 *   3. Shared card foundation    10. Form actions + footnote
 *   4. Guide card + preview      11. Mini cards / stats
 *   5. Form card                 12. Detail view
 *   6. Form-scoped alerts        13. Previews (cert / image / zoom)
 *   7. Form sections             14. Event overview (image + content, 580px)
 *   15. Event/template helpers   16. Sender cards   17. Responsive
 *   18. Message token toolbar
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════
   1. FORM SHELL + TITLE ROW
   ═══════════════════════════════════════════════════════════════ */
.form-page,
.form-shell {
  background: var(--bg);
}

.form-shell > .container {
  width: 100%;
  max-width: 1800px;
  padding-left: 24px;
  padding-right: 24px;
}

.form-section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.form-section-title {
  flex: 1 1 auto;
  min-width: 0;
}

.form-back-btn {
  flex: 0 0 auto;
  margin-top: 4px;
}

.form-title-actions,
.form-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   2. FORM LAYOUTS
   ───────────────────────────────────────────────────────────────
   .form-layout          guide (left) + form (right)
   .form-detail-layout / .event-detail-layout   sticky aside + content
   ═══════════════════════════════════════════════════════════════ */
.form-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.82fr) minmax(0, 1.6fr);
  gap: 22px;
  align-items: start;
}

.form-layout-reverse {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.form-single-layout {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.form-detail-layout,
.event-detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.55fr);
  gap: 24px;
  align-items: start;
}

.event-detail-aside,
.form-detail-aside {
  position: sticky;
  top: 90px;
  min-width: 0;
}

.event-detail-main,
.form-detail-main {
  min-width: 0;
}

/* ═══════════════════════════════════════════════════════════════
   3. SHARED CARD FOUNDATION (form/detail panels)
   ═══════════════════════════════════════════════════════════════ */
.form-guide-card,
.form-card,
.form-mini-card,
.form-section-card,
.form-certificate-preview,
.edit-image-card,
.material-edit-image-card,
.detail-view-item,
.material-detail-item,
.detail-view-text,
.material-detail-text,
.detail-image-card,
.material-detail-image-card {
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════════
   4. GUIDE CARD (left column) + preview
   ═══════════════════════════════════════════════════════════════ */
.form-guide-card {
  position: sticky;
  top: 90px;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--brand-50) 0%, var(--surface) 100%);
  border-color: var(--brand-200);
}

.form-guide-card::after {
  content: "";
  position: absolute;
  top: -54px;
  right: -42px;
  width: 155px;
  height: 155px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.13) 0%, transparent 70%);
  pointer-events: none;
}

.form-guide-card > * {
  position: relative;
  z-index: 1;
}

.form-guide-badge,
.form-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--brand-100);
  border: 1px solid var(--brand-200);
  color: var(--brand-deeper);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.form-guide-card h3 {
  margin: 16px 0 10px;
  color: var(--text-head);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.form-guide-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.form-guide-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.form-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.55;
}

.form-guide-item i {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--green);
}

.form-guide-mini-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  margin-top: 10px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.form-guide-mini-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-100);
  color: var(--brand);
}

.form-guide-mini-card h4 {
  margin: 0 0 3px;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text-head);
  line-height: 1.35;
}

.form-guide-mini-card p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.form-guide-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid var(--brand-200);
  color: var(--brand-deeper);
  font-size: 0.82rem;
  line-height: 1.6;
}

.form-guide-note i {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--brand);
}

/* preview inside guide/aside */
.form-guide-preview,
.event-card-preview-wrap {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.form-guide-preview img,
.event-card-preview {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
  border-radius: var(--r-lg);
  background: var(--n-50);
}

/* ═══════════════════════════════════════════════════════════════
   5. FORM CARD
   ═══════════════════════════════════════════════════════════════ */
.form-card {
  overflow: hidden;
  background: var(--surface);
}

.form-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--n-50) 100%);
}

.form-card-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand);
  border: 1px solid var(--brand-200);
  font-size: 1.1rem;
}

.form-card-header h3 {
  margin: 8px 0 5px;
  color: var(--text-head);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.25;
}

.form-card-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.form-body {
  padding: 26px;
}

/* ═══════════════════════════════════════════════════════════════
   6. FORM-SCOPED ALERTS
   Clean inset feedback banners for form and page cards
   ═══════════════════════════════════════════════════════════════ */

.form-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;

  margin: 18px 26px 22px;
  padding: 13px 16px;

  border: 1px solid transparent;
  border-radius: 12px;

  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.55;

  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 5px 14px rgba(15, 23, 42, 0.035);

  overflow: hidden;
}

/* Small emphasis strip on the left */
.form-alert::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: currentColor;
  opacity: 0.7;
}

/* Remove inset margins where required */
.form-alert.mx-0,
.form-alert.no-card-margin {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Icon container */
.form-alert-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin-top: 1px;
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.72);
  border: 1px solid currentColor;

  font-size: 0.85rem;
  line-height: 1;
}

.form-alert-icon i {
  margin: 0;
  flex-shrink: 0;
}

/* Alert content */
.form-alert-content {
  min-width: 0;
  flex: 1;
  padding-top: 2px;
}

.form-alert-title {
  display: block;
  margin: 0 0 2px;

  color: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
}

.form-alert-message {
  margin: 0;
  color: inherit;
  opacity: 0.94;
}

/* Validation error list */
.form-alert ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.form-alert li {
  margin-bottom: 3px;
}

.form-alert li:last-child {
  margin-bottom: 0;
}

/* Success */
.form-alert-success {
  /* PHASE 3: dropped mismatched fallback hex values (e.g. #047857 here
     never matched the actual --green-text token, #065f46) - the tokens
     are always defined by styles.css, which loads before this file, so
     the fallbacks were unreachable and misleading. Same for danger/
     warning/info below. */
  color: var(--green-text);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.98), rgba(240, 253, 250, 0.96));
  border-color: rgba(16, 185, 129, 0.28);
}

/* Danger */
.form-alert-danger {
  color: var(--red-text);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.98), rgba(255, 247, 247, 0.96));
  border-color: rgba(239, 68, 68, 0.28);
}

.form-alert-danger .form-alert-message {
  color: var(--red-text) !important;
}

/* Warning */
.form-alert-warning,
.form-message-warning {
  color: var(--amber-text);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.96));
  border-color: rgba(245, 158, 11, 0.3);
}

/* Information */
.form-alert-info {
  color: var(--brand-deeper);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(240, 249, 255, 0.96));
  border-color: var(--brand-200, #bae6fd);
}

/* Optional compact variation */
.form-alert.form-alert-compact {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Mobile */
@media (max-width: 767.98px) {
  .form-alert {
    gap: 10px;
    margin: 0 16px 16px;
    padding: 12px 13px;
    border-radius: 10px;
    font-size: 0.83rem;
  }

  .form-alert-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    border-radius: 7px;
    font-size: 0.78rem;
  }

  .form-alert-title {
    font-size: 0.84rem;
  }
}

@media (max-width: 575.98px) {
  .form-alert {
    margin-left: 12px;
    margin-right: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   7. FORM SECTIONS
   ═══════════════════════════════════════════════════════════════ */
.form-section-card {
  padding: 20px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.form-section-card + .form-section-card {
  margin-top: 14px;
}

.form-section-header {
  margin-bottom: 16px;
}

.form-section-header h4 {
  margin: 0 0 4px;
  color: var(--text-head);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.form-section-header h4 span {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.form-section-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   8. FIELDS / INPUTS
   ═══════════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-grid-full {
  grid-column: 1 / -1;
}

.form-field {
  min-width: 0;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-head);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.form-label span,
.form-label .required-star {
  color: var(--red);
}

.form-input-wrap,
.form-file-wrap {
  position: relative;
}

.form-input-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
  pointer-events: none;
}

.form-input-wrap.has-right-icon .form-control-custom {
  padding-right: 48px;
}

.form-control-custom,
.form-textarea,
.form-file-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-head);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--t-base),
    box-shadow var(--t-base),
    background var(--t-base);
}

.form-control-custom {
  min-height: 46px;
  padding: 0 14px 0 42px;
  display: flex;
  align-items: center;
}

.form-control-custom.no-icon,
.no-icon {
  padding-left: 14px !important;
}

select.form-control-custom {
  padding-right: 38px;
  cursor: pointer;
}

.form-textarea {
  min-height: 150px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.65;
}

.form-file-input {
  min-height: 46px;
  padding: 10px 12px;
}

.form-control-custom::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-control-custom:focus,
.form-textarea:focus,
.form-file-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-control-custom:disabled,
.form-textarea:disabled,
.form-file-input:disabled,
.form-control-custom[readonly],
.form-textarea[readonly] {
  background: var(--n-50);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-control-custom.is-invalid,
.form-textarea.is-invalid,
.form-file-input.is-invalid {
  border-color: rgba(239, 68, 68, 0.55);
}

.form-control-custom.is-invalid:focus,
.form-textarea.is-invalid:focus,
.form-file-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.form-field-error {
  display: none;
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--red-dark);
  font-weight: 600;
  line-height: 1.45;
}

.form-field-error.show,
.form-server-error {
  display: block;
}

.form-server-error {
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--red-dark);
  font-weight: 600;
  line-height: 1.45;
}

.form-input-help {
  display: block;
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* textarea with icon wrapper */
.form-textarea-wrap {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 130px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color var(--t-base),
    box-shadow var(--t-base);
  box-shadow: var(--shadow-xs);
}

.form-textarea-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-textarea-wrap > i {
  padding: 15px 0 0 14px;
  color: var(--text-faint);
  font-size: 0.9rem;
  flex-shrink: 0;
  pointer-events: none;
}

.form-textarea-wrap .form-control-custom,
.form-textarea-wrap .form-textarea,
.form-textarea-wrap textarea {
  flex: 1 1 auto;
  min-height: 130px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  outline: none;
  background: transparent;
  resize: vertical;
  color: var(--text-head);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.65;
  box-shadow: none;
}

.form-textarea-wrap.is-invalid-wrap {
  border-color: rgba(239, 68, 68, 0.55);
}

.form-textarea-wrap.is-invalid-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.form-textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.form-char-counter {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   9. PASSWORD / INPUT ACTIONS
   ═══════════════════════════════════════════════════════════════ */
.form-password-wrap .form-control-custom {
  padding-right: 48px;
}

.form-password-toggle,
.form-input-action {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-deeper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--t-fast),
    color var(--t-fast);
}

.form-password-toggle:hover,
.form-input-action:hover {
  background: var(--brand-100);
  color: var(--brand-dark);
}

/* ═══════════════════════════════════════════════════════════════
   10. FORM ACTIONS + FOOTNOTE
   (button appearance itself lives in styles.css)
   ═══════════════════════════════════════════════════════════════ */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.form-actions-end {
  justify-content: flex-end;
}

.form-actions-between {
  justify-content: space-between;
}

.form-footnote {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--brand-deeper);
  font-size: 0.82rem;
  line-height: 1.6;
}

.form-footnote i {
  flex-shrink: 0;
  margin-top: 2px;
}

/* message delivery summary (send-message form) */
.form-message-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
}

.form-message-summary > div {
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.form-message-summary span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.form-message-summary strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-head);
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   11. MINI CARDS / STATS
   ═══════════════════════════════════════════════════════════════ */
.form-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.form-mini-grid.mb-4 {
  margin-top: 0;
}

.form-mini-card {
  padding: 20px;
  background: var(--surface);
}

.form-mini-card-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand);
  border: 1px solid var(--brand-200);
}

/* Larger variant for a page's main empty-state icon (e.g. cards/all.blade.php's
   "no cards generated" state) - same component, bigger presentation. */
.form-mini-card-icon--lg {
  width: 64px;
  height: 64px;
  font-size: 1.6rem;
}

.form-mini-card h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-head);
}

.form-mini-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.form-mini-card-value {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-head);
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   12. DETAIL VIEW
   ═══════════════════════════════════════════════════════════════ */
.detail-view-grid,
.material-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-view-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-view-item,
.material-detail-item {
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.detail-view-item--full,
.material-detail-full {
  grid-column: 1 / -1;
}

.detail-view-item span,
.material-detail-item span {
  display: block;
  margin-bottom: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.detail-view-item strong,
.material-detail-item strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--text-head);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.detail-view-text,
.material-detail-text {
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  line-height: 1.75;
  font-weight: 500;
  color: var(--text-head);
  overflow-wrap: anywhere;
}

.form-message-preview-clean {
  display: block;
  white-space: pre-wrap;
  line-height: 1.75;
  font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════════════
   13. PREVIEWS (certificate / file / image + zoom)
   ═══════════════════════════════════════════════════════════════ */
.form-client-section {
  display: none;
}

.form-client-section.visible {
  display: block;
}

.form-certificate-preview {
  margin: 0 26px 26px;
  padding: 20px;
  background: var(--surface);
}

.form-cert-preview-frame {
  width: 100%;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.form-cert-img {
  max-height: 500px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
}

.edit-image-grid,
.material-edit-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.edit-image-card,
.material-edit-image-card {
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--surface);
}

.edit-image-card img,
.material-edit-image-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
}

.edit-image-body,
.material-edit-image-body {
  padding: 12px;
}

.delete-image-check,
.material-delete-image-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--red-50);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red-text);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}

.delete-image-check input,
.material-delete-image-check input {
  width: 15px;
  height: 15px;
}

.detail-image-grid,
.material-detail-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.detail-image-card,
.material-detail-image-card {
  display: block;
  padding: 0;
  background: var(--surface);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-lg);
  cursor: zoom-in;
}

.detail-image-card img,
.material-detail-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}

.detail-image-card:hover img,
.material-detail-image-card:hover img {
  transform: scale(1.06);
}

/* zoom lightbox (detail galleries) */
.image-zoom-modal,
.material-image-modal-content {
  position: relative;
  border: 0;
  border-radius: var(--r-2xl);
  overflow: hidden;
  background: #000;
}

.image-zoom-modal img,
.material-image-modal-content img {
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
}

.image-zoom-close,
.material-image-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-head);
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   14. EVENT OVERVIEW  (card image LEFT ≤580px + content RIGHT)
   Reusable on any view that shows a card image beside details.
   <div class="event-overview-card">
     <div class="event-overview-preview"><img ...></div>
     <div class="event-overview-content"> ... </div>
   </div>
   ═══════════════════════════════════════════════════════════════ */
.event-overview-card {
  display: grid;
  grid-template-columns: 580px minmax(0, 1fr);
  gap: 26px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.event-overview-preview {
  min-height: 460px;
  border-radius: var(--r-xl);
  background: var(--n-50);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.event-overview-preview img {
  width: 100%;
  height: auto;
  max-height: 760px;
  object-fit: contain;
  display: block;
  border-radius: var(--r-lg);
}

.event-overview-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.event-overview-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.event-overview-top h3 {
  margin: 0 0 5px;
  color: var(--text-head);
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-display);
  overflow-wrap: anywhere;
}

.event-overview-top p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.event-message-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
}

.event-message-box span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-deeper);
}

.event-message-box p {
  margin: 0;
  color: var(--text-head);
  font-size: 0.875rem;
  line-height: 1.7;
  font-weight: 600;
  white-space: pre-wrap;
}

.event-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.event-overview-no-template {
  text-align: center;
  padding: 24px;
}

.event-overview-no-template i {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: var(--r-xl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand);
  border: 1px solid var(--brand-200);
  font-size: 1.5rem;
}

.event-overview-no-template h4 {
  margin: 0 0 8px;
  color: var(--text-head);
  font-size: 1rem;
  font-weight: 800;
}

.event-overview-no-template p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════════
   15. EVENT / TEMPLATE PREVIEW HELPERS  (template setup aside)
   ═══════════════════════════════════════════════════════════════ */
.event-template-aside {
  display: flex;
  flex-direction: column;
}

.event-template-preview {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
}

.event-template-preview img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border-radius: var(--r-lg);
}

.event-template-meta {
  margin-top: 18px;
}

.event-template-meta h4 {
  margin: 0 0 4px;
  color: var(--text-head);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.event-template-meta p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════
   16. SENDER CARDS  (WhatsApp / SMS sender grid)
   ═══════════════════════════════════════════════════════════════ */
.sender-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.sender-card {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
  transition: 0.25s ease;
}

.sender-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.1);
}

.sender-card.is-active {
  border-color: rgba(22, 163, 74, 0.35);
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.08), #fff 42%);
}

.sender-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sender-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(80, 197, 255, 0.14);
  color: #414042;
  font-size: 1.25rem;
}

.sender-card.is-active .sender-icon {
  background: rgba(22, 163, 74, 0.14);
  color: #16a34a;
}

.sender-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--n-100);
  color: var(--text-muted);
  white-space: nowrap;
}

.sender-status.active {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.sender-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  /* PHASE 3: was a raw Tailwind-gray hex (#111827) instead of the app's
     own heading token; same value-class fix applied to #6b7280 below
     (-> --text-muted) throughout this sender-card block. */
  color: var(--text-head);
  letter-spacing: 0.02em;
}

.sender-card p {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.55;
}

.sender-meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(15, 23, 42, 0.14);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.sender-actions {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sender-actions form {
  width: 100%;
}

.sender-actions .form-btn {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.sender-actions .form-btn-danger {
  background: #fff5f5;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.sender-actions .form-btn-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.sender-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 55px 20px;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  border-radius: 22px;
  background: var(--n-50);
}

.sender-empty i {
  font-size: 2.6rem;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.sender-empty h4 {
  font-weight: 800;
  color: var(--text-head);
}

.sender-empty p {
  color: var(--text-muted);
  margin: 0;
}

.sender-edit-modal .modal-dialog {
  max-width: 620px;
}

.sender-edit-modal .modal-content {
  border: 0;
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.22);
}

.sender-edit-header {
  padding: 24px 28px;
  background: linear-gradient(135deg, #414042, #50c5ff);
  color: #fff;
}

.sender-edit-header h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
}

.sender-edit-header p {
  margin: 0.35rem 0 0;
  opacity: 0.9;
}

.sender-edit-body {
  padding: 28px;
}

.sender-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px 28px;
  border-top: 1px solid #eef2f7;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   17. RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Small laptops / large tablets */
@media (max-width: 1399.98px) {
  .event-overview-card {
    grid-template-columns: 460px minmax(0, 1fr);
  }
}

@media (max-width: 1199.98px) {
  .form-shell > .container {
    max-width: 100%;
    padding-left: 28px;
    padding-right: 28px;
  }

  .form-layout {
    grid-template-columns: minmax(270px, 0.85fr) minmax(0, 1.5fr);
    gap: 18px;
  }

  .form-layout-reverse {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  }

  .form-detail-layout,
  .event-detail-layout {
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.45fr);
    gap: 20px;
  }

  .form-guide-card,
  .event-detail-aside,
  .form-detail-aside {
    top: 84px;
  }

  .event-overview-card {
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 20px;
  }

  .event-overview-preview {
    min-height: 400px;
  }
}

/* Tablet */
@media (max-width: 991.98px) {
  .form-layout,
  .form-layout-reverse,
  .form-detail-layout,
  .event-detail-layout {
    grid-template-columns: 1fr;
  }

  .form-guide-card,
  .event-detail-aside,
  .form-detail-aside {
    position: relative;
    top: auto;
  }

  .form-section-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-title-actions,
  .form-section-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-back-btn {
    margin-top: 0;
  }

  /* event overview stacks: image on top, centered */
  .event-overview-card {
    grid-template-columns: 1fr;
  }

  .event-overview-preview {
    min-height: auto;
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
  }

  .event-overview-preview img {
    max-height: 620px;
  }

  .event-template-preview,
  .event-template-meta {
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .sender-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile landscape / small tablet */
@media (max-width: 767.98px) {
  .form-card-header,
  .form-body {
    padding: 18px;
  }

  .form-card-header {
    flex-direction: column;
  }

  .form-grid,
  .form-grid-3,
  .detail-view-grid,
  .detail-view-grid-3,
  .material-detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-view-item--full,
  .material-detail-full,
  .form-grid-full {
    grid-column: auto;
  }

  .form-mini-grid {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .event-overview-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .form-btn,
  .event-overview-actions .form-btn,
  .form-title-actions .form-btn,
  .form-section-actions .form-btn,
  .form-title-actions form,
  .form-section-actions form {
    width: 100%;
  }

  .form-alert {
    margin-left: 18px;
    margin-right: 18px;
  }

  .form-message-summary {
    grid-template-columns: 1fr;
  }

  .form-textarea-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .event-overview-top {
    flex-direction: column;
  }
}

/* Small mobile */
@media (max-width: 575.98px) {
  .form-shell > .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .form-section-title-row {
    gap: 14px;
    margin-bottom: 18px;
  }

  .form-guide-card,
  .form-card,
  .form-mini-card,
  .form-section-card,
  .event-overview-card {
    border-radius: var(--r-xl);
  }

  .form-guide-card,
  .form-mini-card {
    padding: 18px;
  }

  .form-card-header,
  .form-body {
    padding: 16px;
  }

  .form-card-icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .form-card-header h3,
  .form-guide-card h3 {
    font-size: 1.18rem;
  }

  .form-section-card {
    padding: 14px;
    border-radius: var(--r-lg);
  }

  .form-control-custom,
  .form-file-input {
    min-height: 44px;
  }

  .edit-image-grid,
  .material-edit-image-grid,
  .detail-image-grid,
  .material-detail-image-grid {
    grid-template-columns: 1fr;
  }

  .form-certificate-preview {
    margin: 0 16px 16px;
    padding: 14px;
  }

  .form-cert-preview-frame {
    min-height: 360px;
  }

  .event-overview-card {
    padding: 16px;
    gap: 18px;
  }

  .event-overview-preview {
    max-width: 100%;
    padding: 10px;
  }

  .event-overview-top h3 {
    font-size: 1.25rem;
  }

  .event-overview-actions .form-btn {
    width: 100%;
  }

  .event-template-preview {
    padding: 10px;
    border-radius: var(--r-lg);
  }

  .event-template-preview img {
    max-height: 520px;
  }

  .sender-grid {
    grid-template-columns: 1fr;
  }

  .sender-actions {
    grid-template-columns: 1fr;
  }

  .sender-actions .form-btn,
  .sender-edit-footer .form-btn {
    width: 100%;
  }

  .sender-edit-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

.form-token-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.form-token-toolbar-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.form-token-toolbar-label i {
  color: var(--brand-dark);
  font-size: 0.85rem;
}

.form-token-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-head);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast),
    transform var(--t-fast),
    box-shadow var(--t-fast);
}

.form-token-btn i {
  font-size: 0.82rem;
  color: var(--brand-dark);
  transition: color var(--t-fast);
}

.form-token-btn:hover {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand-deeper);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.form-token-btn:hover i {
  color: var(--brand-deeper);
}

.form-token-btn:active {
  transform: translateY(0);
  background: var(--brand-100);
}

.form-token-btn:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

/* Brief highlight on the field a token was just inserted into - visible
   confirmation even if you weren't watching the cursor. Toggled by JS
   via classList.add/remove after each insert; see the updated script
   block in each page. */
@keyframes formTokenFlash {
  0% {
    background-color: var(--brand-soft);
  }

  100% {
    background-color: transparent;
  }
}

.form-token-flash {
  animation: formTokenFlash 0.7s var(--ease) 1;
}

@media (max-width: 575.98px) {
  .form-token-toolbar {
    gap: 6px;
  }

  .form-token-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 0.74rem;
  }
}
/* ═══════════════════════════════════════════════════════════════
   GREETING FIELD PREVIEW
   Migrated from components/greeting-field.blade.php's embedded
   <style> block - a live character-count preview shown under the
   greeting input on SMS/WhatsApp send forms.
   ═══════════════════════════════════════════════════════════════ */
.gp-help code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--brand-deeper);
  font-size: 0.74rem;
  font-weight: 700;
}

.gp-preview {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--n-50);
  overflow: hidden;
}

.gp-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gp-count {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--text-faint);
}

.gp-count.gp-over {
  color: var(--red-dark);
}

.gp-preview-body {
  max-height: 132px;
  overflow-y: auto;
  padding: 10px 12px;
  white-space: pre-line;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-head);
}
