/*
 * CRM V1.2 — Settings | Templates design system (UIV12-126).
 *
 * Shared by Job Templates, Invoice Templates, SMS Templates, Voice Templates
 * and Add Job Templates so every templates surface stays visually identical.
 *
 * Rules: .cursor/rules/crm-v12-page-redesign.mdc, crm-v12-table.mdc,
 * crm-v12-ui.mdc, clickable-focus-styles.mdc
 */

.tmpl-page {
  --tmpl-green: #43b02a;
  --tmpl-green-dark: #2f861f;
  --tmpl-green-deep: #2f7d20;
  --tmpl-green-soft: #edf9e9;
  --tmpl-green-line: #cfedc6;
  --tmpl-ink: #111827;
  --tmpl-muted: #667085;
  --tmpl-line: #e3e9f2;
  --tmpl-soft-line: #e8edf3;
  background: #f6f8fb;
  color: #162033;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: calc(100vh - 64px);
}

/* Modals / filter drawers often sit outside .tmpl-page (or get relocated),
   so re-declare the same tokens there — otherwise var(--tmpl-green) is empty
   and primary buttons render white-on-white. */
.tmpl-modal,
.tmpl-filter-panel {
  --tmpl-green: #43b02a;
  --tmpl-green-dark: #2f861f;
  --tmpl-green-deep: #2f7d20;
  --tmpl-green-soft: #edf9e9;
  --tmpl-green-line: #cfedc6;
  --tmpl-ink: #111827;
  --tmpl-muted: #667085;
  --tmpl-line: #e3e9f2;
  --tmpl-soft-line: #e8edf3;
}

.tmpl-page .container-fluid {
  padding: 18px 22px 28px;
}

/* ------------------------------------------------------------------ Hero */

.tmpl-hero {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--tmpl-line);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(22, 32, 51, 0.06);
  color: var(--tmpl-ink);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 22px 24px;
}

.tmpl-hero-eyebrow {
  color: var(--tmpl-green-deep);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.tmpl-hero h1 {
  color: var(--tmpl-ink);
  font-size: 25px;
  font-weight: 700;
  margin: 0;
}

.tmpl-hero p {
  color: var(--tmpl-muted);
  font-size: 13px;
  margin: 5px 0 0;
  max-width: 620px;
}

.tmpl-hero-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
}

.tmpl-hero-meta {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tmpl-result-count {
  background: var(--tmpl-green-soft);
  border: 1px solid var(--tmpl-green-line);
  border-radius: 999px;
  color: #378620;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  padding: 7px 12px;
  text-align: center;
  white-space: nowrap;
}

.tmpl-result-count strong {
  color: #24651f;
  font-size: 12px;
  font-weight: 800;
}

/* --------------------------------------------------------------- Buttons */

.tmpl-filter-toggle {
  align-items: center;
  background: var(--tmpl-green-soft);
  border: 1px solid var(--tmpl-green-line);
  border-radius: 999px;
  color: var(--tmpl-green-deep);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.tmpl-filter-toggle:hover,
.tmpl-filter-toggle:focus,
.tmpl-filter-toggle:focus-visible,
.tmpl-filter-toggle:active,
.tmpl-filter-toggle.is-active {
  background: #dff3d8;
  border-color: #bfe6b5;
  box-shadow: none;
  color: var(--tmpl-green-deep);
  outline: none;
}

.tmpl-add-btn {
  align-items: center;
  background: var(--tmpl-green);
  border: 1px solid var(--tmpl-green);
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  transition: background-color .16s ease, border-color .16s ease;
  white-space: nowrap;
}

.tmpl-add-btn:hover,
.tmpl-add-btn:focus,
.tmpl-add-btn:focus-visible,
.tmpl-add-btn:active {
  background: var(--tmpl-green-dark);
  border-color: var(--tmpl-green-dark);
  box-shadow: none;
  color: #ffffff;
  outline: none;
  text-decoration: none;
}

/* ----------------------------------------------------------- Table shell */

.tmpl-table-card {
  background: #ffffff;
  border: 1px solid var(--tmpl-line);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(22, 32, 51, 0.06);
  overflow: hidden;
}

.tmpl-table-card > .card-body {
  padding: 20px;
}

.tmpl-table-heading {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tmpl-table-heading h2 {
  color: var(--tmpl-ink);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.tmpl-table-heading p {
  color: var(--tmpl-muted);
  font-size: 13px;
  margin: 3px 0 0;
}

.tmpl-active-filter {
  background: var(--tmpl-green-soft);
  border: 1px solid var(--tmpl-green-line);
  border-radius: 999px;
  color: var(--tmpl-green-deep);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
  white-space: nowrap;
}

.tmpl-table-area.wepro-v12-dt-area {
  min-width: 0;
  padding-bottom: 0;
}

.tmpl-table-area .wepro-v12-dt-scroll-main,
.tmpl-table-area .wepro-v12-dt-scroll {
  scrollbar-color: #b7c4d4 #f1f5f9;
  scrollbar-width: thin;
}

.tmpl-table-area .wepro-v12-dt-scroll-main::-webkit-scrollbar,
.tmpl-table-area .wepro-v12-dt-scroll::-webkit-scrollbar {
  height: 12px;
}

.tmpl-table-area .wepro-v12-dt-scroll-main::-webkit-scrollbar-track,
.tmpl-table-area .wepro-v12-dt-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
  margin: 0 4px;
}

.tmpl-table-area .wepro-v12-dt-scroll-main::-webkit-scrollbar-thumb,
.tmpl-table-area .wepro-v12-dt-scroll::-webkit-scrollbar-thumb {
  background: #b7c4d4;
  border: 3px solid #f1f5f9;
  border-radius: 999px;
  min-width: 48px;
}

.tmpl-table-area .wepro-v12-dt-scroll-main::-webkit-scrollbar-thumb:hover,
.tmpl-table-area .wepro-v12-dt-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.tmpl-table {
  margin-bottom: 0 !important;
  min-width: 980px;
}

.tmpl-table thead th {
  background: #f1f5f9;
  border-bottom: 1px solid #edf1f7 !important;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  padding: 10px 12px !important;
  text-transform: uppercase;
  white-space: nowrap;
}

.tmpl-table tbody td {
  border-top: 1px solid #edf1f7;
  color: #243244;
  font-size: 13px;
  padding: 13px 12px !important;
  vertical-align: middle;
}

.tmpl-table tbody tr:hover {
  background: #f8fbff;
}

.tmpl-table th:first-child,
.tmpl-table td:first-child {
  white-space: nowrap;
}

/* ---------------------------------------------------------- Table cells */

.tmpl-action-cell {
  white-space: nowrap;
}

.tmpl-action-btns {
  align-items: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.tmpl-action-btn {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cfd9e8;
  border-radius: 10px;
  color: var(--tmpl-ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  text-decoration: none;
  white-space: nowrap;
}

.tmpl-action-btn i {
  color: var(--tmpl-green);
  font-size: 12px;
}

.tmpl-action-btn.is-danger {
  color: #b42318;
}

.tmpl-action-btn.is-danger i {
  color: #b42318;
}

.tmpl-action-btn:hover,
.tmpl-action-btn:focus,
.tmpl-action-btn:focus-visible,
.tmpl-action-btn:active {
  background: #f8fafc;
  border-color: #cfd9e8;
  box-shadow: none;
  color: var(--tmpl-ink);
  outline: none;
  text-decoration: none;
}

.tmpl-action-btn.is-danger:hover,
.tmpl-action-btn.is-danger:focus,
.tmpl-action-btn.is-danger:focus-visible,
.tmpl-action-btn.is-danger:active {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.tmpl-action-empty {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
}

.tmpl-strong-cell {
  color: var(--tmpl-ink);
  font-weight: 700;
}

.tmpl-muted-cell {
  color: #94a3b8;
}

.tmpl-snippet {
  color: #334155;
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.tmpl-snippet code {
  background: #eef5ec;
  border-radius: 5px;
  color: #2f7d20;
  font-size: 11.5px;
  padding: 1px 4px;
}

.tmpl-datetime {
  color: #475569;
  white-space: nowrap;
}

.tmpl-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  white-space: nowrap;
}

.tmpl-badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

.tmpl-badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.tmpl-badge-success {
  background: #dcfce7;
  color: #166534;
}

.tmpl-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.tmpl-audio {
  height: 32px;
  max-width: 260px;
  vertical-align: middle;
}

/* ---------------------------------------------------- File dropzone V12 */

.tmpl-file-dropzone {
  align-items: center;
  background: #f8fafc;
  border: 1.5px dashed #cfd9e8;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 132px;
  padding: 22px 18px;
  text-align: center;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.tmpl-file-dropzone:hover,
.tmpl-file-dropzone.is-dragover {
  background: #edf8e9;
  border-color: #43b02a;
}

.tmpl-file-dropzone:focus,
.tmpl-file-dropzone:focus-visible,
.tmpl-file-dropzone:active {
  border-color: #cfd9e8;
  box-shadow: none;
  outline: none;
}

.tmpl-file-dropzone.is-dragover:focus,
.tmpl-file-dropzone.is-dragover:focus-visible {
  border-color: #43b02a;
}

.tmpl-file-drop-icon {
  align-items: center;
  background: #edf8e9;
  border-radius: 999px;
  color: #43b02a;
  display: inline-flex;
  font-size: 20px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.tmpl-file-drop-title {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.tmpl-file-drop-sub {
  color: #667085;
  font-size: 12px;
  margin: 0;
}

.tmpl-file-drop-input {
  display: none;
}

.tmpl-file-selected {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  display: none;
  gap: 10px;
  margin-top: 10px;
  min-height: 44px;
  padding: 10px 12px;
}

.tmpl-file-selected.is-visible {
  display: flex;
}

.tmpl-file-selected-name {
  color: #111827;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmpl-file-selected-clear {
  background: transparent;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.tmpl-file-selected-clear:hover,
.tmpl-file-selected-clear:focus,
.tmpl-file-selected-clear:focus-visible,
.tmpl-file-selected-clear:active {
  box-shadow: none;
  color: #475569;
  outline: none;
}

.tmpl-file-hint {
  color: #667085;
  display: block;
  font-size: 12px;
  margin-top: 8px;
}

.tmpl-current-audio {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
}

.tmpl-current-audio.is-visible {
  display: flex;
}

.tmpl-current-audio-label {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.tmpl-current-audio .tmpl-audio {
  flex: 1 1 180px;
  max-width: 100%;
  min-width: 160px;
}

/* --------------------------------------------------- Filter side drawer */

.tmpl-filter-panel {
  background: #ffffff;
  border: 0;
  border-left: 1px solid var(--tmpl-line);
  bottom: 0;
  box-shadow: -16px 0 48px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1), opacity .24s ease, visibility .32s ease;
  visibility: hidden;
  width: 360px;
  z-index: 1045;
}

.tmpl-filter-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
}

body.tmpl-filter-panel-open {
  overflow-x: hidden;
}

.tmpl-filter-panel-header {
  align-items: flex-start;
  border-bottom: 1px solid #edf1f7;
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  justify-content: space-between;
  padding: 18px 18px 14px;
}

.tmpl-filter-panel-header h3 {
  color: var(--tmpl-ink);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.tmpl-filter-panel-header p {
  color: #64748b;
  font-size: 13px;
  margin: 4px 0 0;
}

.tmpl-filter-panel-close {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.tmpl-filter-panel-close:hover,
.tmpl-filter-panel-close:focus,
.tmpl-filter-panel-close:focus-visible,
.tmpl-filter-panel-close:active {
  border-color: #e2e8f0;
  box-shadow: none;
  outline: none;
}

.tmpl-filter-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 18px;
}

.tmpl-filter-section-label {
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  margin: 6px 0 10px;
}

.tmpl-filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.tmpl-field label {
  color: #475569;
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tmpl-field .form-control {
  background: #ffffff;
  border: 1px solid #cfd9e8;
  border-radius: 12px;
  color: #1f2937;
  font-size: 14px;
  min-height: 44px;
}

.tmpl-field .form-control:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.tmpl-field .form-control:focus,
.tmpl-field .form-control:focus-visible,
.tmpl-field .wepro-v12-search-select__trigger:focus,
.tmpl-field .wepro-v12-search-select__trigger:focus-visible,
.tmpl-field .wepro-v12-search-select__trigger:active,
.tmpl-field .wepro-v12-search-select.is-open .wepro-v12-search-select__trigger,
.tmpl-field .wepro-v12-multi-select__trigger:focus,
.tmpl-field .wepro-v12-multi-select__trigger:focus-visible,
.tmpl-field .wepro-v12-multi-select__trigger:active,
.tmpl-field .wepro-v12-multi-select.is-open .wepro-v12-multi-select__trigger {
  border-color: #cfd9e8;
  box-shadow: none !important;
  outline: none !important;
}

.tmpl-filter-panel-footer {
  border-top: 1px solid #edf1f7;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 18px;
}

.tmpl-filter-panel-footer .btn {
  align-items: center;
  border-radius: 12px;
  display: inline-flex;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  width: 100%;
}

.tmpl-filter-panel-footer .btn-primary {
  background: var(--tmpl-green);
  border-color: var(--tmpl-green);
  color: #ffffff;
}

.tmpl-filter-panel-footer .btn-primary:hover,
.tmpl-filter-panel-footer .btn-primary:focus,
.tmpl-filter-panel-footer .btn-primary:focus-visible,
.tmpl-filter-panel-footer .btn-primary:active {
  background: var(--tmpl-green-dark);
  border-color: var(--tmpl-green-dark);
  box-shadow: none;
  color: #ffffff;
  outline: none;
}

.tmpl-filter-panel-footer .btn-outline-secondary {
  background: #ffffff;
  border-color: #cfd9e8;
  color: var(--tmpl-ink);
}

.tmpl-filter-panel-footer .btn-outline-secondary:hover,
.tmpl-filter-panel-footer .btn-outline-secondary:focus,
.tmpl-filter-panel-footer .btn-outline-secondary:focus-visible,
.tmpl-filter-panel-footer .btn-outline-secondary:active {
  background: #f8fafc;
  border-color: #b8c5d6;
  box-shadow: none;
  color: var(--tmpl-ink);
  outline: none;
}

/* -------------------------------------------------- Add / Edit modal V12 */

.tmpl-modal .modal-dialog {
  margin: 24px auto;
  max-width: min(80vw, 1180px) !important;
  width: 80vw;
}

.tmpl-modal.tmpl-modal-compact .modal-dialog {
  max-width: min(80vw, 840px) !important;
}

.tmpl-modal .modal-content {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

.tmpl-modal .modal-header {
  align-items: flex-start;
  background: #f8fafc;
  border-bottom: 1px solid #e3e9f2;
  border-bottom-color: var(--tmpl-line, #e3e9f2);
  flex: 0 0 auto;
  padding: 16px 20px;
}

.tmpl-modal .modal-header .modal-title,
.tmpl-modal .modal-title {
  color: #111827 !important;
  font-size: 20px;
  font-weight: 750;
  margin: 0;
}

.tmpl-modal .modal-header .modal-subtitle,
.tmpl-modal .modal-subtitle {
  color: #111827 !important;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  margin: 3px 0 0;
  opacity: 1;
}

.tmpl-modal .close {
  color: #64748b;
  text-shadow: none;
}

.tmpl-modal .close:hover,
.tmpl-modal .close:focus,
.tmpl-modal .close:focus-visible {
  box-shadow: none;
  color: var(--tmpl-ink);
  outline: none;
}

.tmpl-modal .modal-body {
  background: #f4f7fb;
  height: auto !important;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 20px;
}

.tmpl-modal-section {
  background: #ffffff;
  border: 1px solid var(--tmpl-soft-line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 16px;
  padding: 18px 18px 6px;
}

.tmpl-modal-section:last-child {
  margin-bottom: 0;
}

.tmpl-modal-section h5 {
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.tmpl-modal-section-hint {
  color: #667085;
  color: var(--tmpl-muted, #667085);
  font-size: 12px;
  line-height: 1.45;
  margin: 8px 0 12px;
}

/* Hints that sit under a label (before controls) stay tight to the label. */
.tmpl-modal label + .tmpl-modal-section-hint {
  margin-top: 0;
}

/* Hints under inputs/textareas need clear separation so they don't overlap. */
.tmpl-modal .form-control + .tmpl-modal-section-hint,
.tmpl-modal textarea.form-control + .tmpl-modal-section-hint {
  margin-top: 10px;
}

.tmpl-modal .form-group {
  margin-bottom: 14px;
}

.tmpl-modal label {
  color: #334155;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.tmpl-required {
  color: #dc2626;
  font-weight: 700;
  margin-left: 2px;
}

.tmpl-modal .form-control {
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  color: var(--tmpl-ink);
  min-height: 40px;
}

.tmpl-modal .form-control:focus,
.tmpl-modal .form-control:focus-visible {
  border-color: #d9e2ef;
  box-shadow: none;
  outline: none;
}

.tmpl-modal textarea.form-control {
  line-height: 1.55;
  min-height: 120px;
}

.tmpl-modal .wepro-v12-search-select .wepro-v12-search-select__trigger,
.tmpl-modal .wepro-v12-multi-select .wepro-v12-multi-select__trigger {
  min-height: 40px;
}

.tmpl-modal .wepro-v12-search-select .wepro-v12-search-select__trigger:focus,
.tmpl-modal .wepro-v12-search-select .wepro-v12-search-select__trigger:focus-visible,
.tmpl-modal .wepro-v12-search-select .wepro-v12-search-select__trigger:active,
.tmpl-modal .wepro-v12-search-select.is-open .wepro-v12-search-select__trigger,
.tmpl-modal .wepro-v12-multi-select .wepro-v12-multi-select__trigger:focus,
.tmpl-modal .wepro-v12-multi-select .wepro-v12-multi-select__trigger:focus-visible,
.tmpl-modal .wepro-v12-multi-select .wepro-v12-multi-select__trigger:active,
.tmpl-modal .wepro-v12-multi-select.is-open .wepro-v12-multi-select__trigger {
  border-color: #d9e2ef;
  box-shadow: none;
  outline: none;
}

.tmpl-field-error {
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}

.tmpl-has-error .form-control,
.tmpl-has-error .wepro-v12-search-select__trigger,
.tmpl-has-error .wepro-v12-multi-select__trigger,
.tmpl-has-error .note-editor.note-frame {
  border-color: #fca5a5 !important;
}

/* Placeholder token chips (replaces the legacy dark blue #template-options list). */

.tmpl-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tmpl-token {
  align-items: center;
  background: #eef5ec;
  border: 1px solid #d5e8cf;
  border-radius: 999px;
  color: #2f7d20;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  line-height: 1;
  padding: 7px 11px;
  transition: background-color .14s ease, border-color .14s ease;
  user-select: none;
}

.tmpl-token:hover,
.tmpl-token:focus,
.tmpl-token:focus-visible,
.tmpl-token:active {
  background: #dff3d8;
  border-color: #bfe6b5;
  box-shadow: none;
  color: #24651f;
  outline: none;
}

.tmpl-token i {
  font-size: 9px;
  opacity: .7;
}

.tmpl-counter {
  align-items: center;
  color: var(--tmpl-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  gap: 12px;
  margin-top: 8px;
}

.tmpl-counter span {
  align-items: center;
  background: #f1f5f9;
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  padding: 5px 10px;
}

.tmpl-modal .modal-footer {
  align-items: center;
  background: #f8fafc;
  border-top: 1px solid var(--tmpl-line);
  flex: 0 0 auto;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 20px;
}

.tmpl-feedback {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  text-align: left;
}

.tmpl-btn {
  align-items: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 750;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  min-width: 132px;
  padding: 10px 16px;
  white-space: nowrap;
}

.tmpl-btn-primary,
.tmpl-modal .tmpl-btn-primary,
.tmpl-modal .modal-footer .tmpl-btn-primary {
  background: #43b02a !important;
  background-color: #43b02a !important;
  background-image: none !important;
  border: 1px solid #43b02a !important;
  color: #ffffff !important;
  text-shadow: none !important;
}

.tmpl-btn-primary:hover,
.tmpl-btn-primary:focus,
.tmpl-btn-primary:focus-visible,
.tmpl-btn-primary:active,
.tmpl-modal .tmpl-btn-primary:hover,
.tmpl-modal .tmpl-btn-primary:focus,
.tmpl-modal .tmpl-btn-primary:focus-visible,
.tmpl-modal .tmpl-btn-primary:active,
.tmpl-modal .modal-footer .tmpl-btn-primary:hover,
.tmpl-modal .modal-footer .tmpl-btn-primary:focus,
.tmpl-modal .modal-footer .tmpl-btn-primary:focus-visible,
.tmpl-modal .modal-footer .tmpl-btn-primary:active {
  background: #2f861f !important;
  background-color: #2f861f !important;
  background-image: none !important;
  border-color: #2f861f !important;
  box-shadow: none !important;
  color: #ffffff !important;
  outline: none !important;
}

.tmpl-btn-primary:disabled {
  background: #94a3b8 !important;
  border-color: #94a3b8 !important;
  cursor: not-allowed;
}

.tmpl-btn-secondary {
  background: #eef2f7 !important;
  border: 1px solid #eef2f7 !important;
  color: #1f2937 !important;
}

.tmpl-btn-secondary:hover,
.tmpl-btn-secondary:focus,
.tmpl-btn-secondary:focus-visible,
.tmpl-btn-secondary:active {
  background: #e2e8f0 !important;
  border-color: #e2e8f0 !important;
  box-shadow: none !important;
  color: #1f2937 !important;
  outline: none !important;
}

/* --------------------------------------------------------------- Mobile */

@media (max-width: 767px) {
  .tmpl-page .container-fluid {
    padding: 14px;
  }

  .tmpl-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .tmpl-hero-actions,
  .tmpl-hero-meta {
    align-items: stretch;
    width: 100%;
  }

  .tmpl-add-btn,
  .tmpl-filter-toggle {
    justify-content: center;
    width: 100%;
  }

  .tmpl-table-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tmpl-filter-panel {
    width: 100%;
  }

  .tmpl-modal .modal-dialog {
    margin: 10px auto;
    max-width: 96vw !important;
    width: 96vw;
  }

  .tmpl-modal .modal-body {
    max-height: calc(100vh - 190px);
    padding: 14px;
  }

  .tmpl-modal .modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .tmpl-btn {
    width: 100%;
  }
}
