/* Customer Service — Message Templates
 * Management module (.mt-*) + shared compose-picker (.mtp-*).
 * Visual language mirrors the Evri Claims module (soft cards, teal→blue
 * gradient, 1.5px borders, 14–20px radii). Loaded globally so the picker is
 * available on every messaging surface.
 */

:root {
  --mt-primary: #0588b6;
  --mt-primary-d: #03658e;
  --mt-grad: linear-gradient(135deg, #03658e, #0588b6);
  --mt-ink: #0f2740;
  --mt-sub: #5b7183;
  --mt-line: #e6edf5;
  --mt-line-s: #cfdcea;
  --mt-bg: #f5f8fc;
  --mt-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

/* ---------------- Page shell ---------------- */
.mt-page { background: transparent; }
.mt-wrap { max-width: 1180px; margin: 0 auto; padding: 6px 4px 40px; }

.mt-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin: 4px 0 18px;
}
.mt-eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--mt-primary);
}
.mt-title { font-size: 25px; font-weight: 800; color: var(--mt-ink); margin: 4px 0 4px; line-height: 1.15; }
.mt-sub { font-size: 13.5px; color: var(--mt-sub); margin: 0; max-width: 620px; line-height: 1.5; }
.mt-head-actions { display: flex; align-items: center; gap: 10px; }

.mt-btn {
  appearance: none; border: 1.5px solid var(--mt-line-s); background: #fff; color: #21506f;
  font-size: 13px; font-weight: 700; padding: 9px 15px; border-radius: 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s;
}
.mt-btn:hover { border-color: var(--mt-primary); color: var(--mt-primary); }
.mt-btn.primary {
  border: none; color: #fff; background: var(--mt-grad);
  box-shadow: 0 8px 18px rgba(5, 136, 182, .28);
}
.mt-btn.primary:hover { filter: brightness(1.05); color: #fff; }
.mt-btn.danger:hover { border-color: #e2564d; color: #d63c33; }
.mt-btn.icon { padding: 8px 10px; }
.mt-btn:disabled { opacity: .55; cursor: default; }

/* ---------------- Toolbar ---------------- */
.mt-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1.5px solid var(--mt-line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--mt-shadow); margin-bottom: 14px;
}
.mt-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.mt-search input {
  width: 100%; height: 40px; border: 1.5px solid var(--mt-line-s); border-radius: 10px;
  padding: 0 12px 0 36px; font-size: 13.5px; color: var(--mt-ink); background: #fbfdff;
}
.mt-search input:focus { outline: none; border-color: var(--mt-primary); box-shadow: 0 0 0 3px rgba(5, 136, 182, .14); }
.mt-search .mt-search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .5; font-size: 14px; pointer-events: none; }
.mt-select {
  height: 40px; border: 1.5px solid var(--mt-line-s); border-radius: 10px; padding: 0 30px 0 12px;
  font-size: 13px; font-weight: 600; color: #33506a; background: #fff; cursor: pointer;
}
.mt-select:focus { outline: none; border-color: var(--mt-primary); }

.mt-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mt-chip {
  border: 1.5px solid var(--mt-line-s); background: #fff; color: #3f5f79;
  font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.mt-chip:hover { border-color: var(--mt-primary); color: var(--mt-primary); }
.mt-chip.active { background: var(--mt-grad); border-color: transparent; color: #fff; }
.mt-chip .mt-chip-n { font-size: 11px; opacity: .8; font-weight: 800; }
.mt-chip.active .mt-chip-n { opacity: .95; }

/* ---------------- Card grid ---------------- */
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.mt-card {
  position: relative; background: #fff; border: 1.5px solid var(--mt-line); border-radius: 16px;
  padding: 15px 16px 12px; box-shadow: var(--mt-shadow); display: flex; flex-direction: column;
  min-height: 168px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.mt-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(15, 23, 42, .10); border-color: #d4e4f2; }
.mt-card.pinned { border-color: #bfe0ef; }
.mt-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mt-card-name { font-size: 15px; font-weight: 800; color: var(--mt-ink); line-height: 1.25; }
.mt-pin { cursor: pointer; font-size: 15px; opacity: .3; transition: .15s; line-height: 1; padding: 2px; }
.mt-pin:hover { opacity: .8; }
.mt-pin.on { opacity: 1; }
.mt-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 9px 0 8px; }
.mt-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #eef5fb; color: #2d6b8f; border: 1px solid #dcecf6;
}
.mt-plat {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #f3f0fb; color: #6b52a6; border: 1px solid #e6dff6; text-transform: capitalize;
}
.mt-plat.all { background: #eefaf1; color: #2f8f52; border-color: #d8f0df; }
.mt-preview {
  font-size: 12.7px; color: #566d84; line-height: 1.5; white-space: pre-wrap;
  flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  margin-bottom: 10px;
}
.mt-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--mt-line); padding-top: 9px; margin-top: auto;
}
.mt-meta { font-size: 11px; color: #90a3b6; display: flex; align-items: center; gap: 8px; }
.mt-actions { display: flex; align-items: center; gap: 2px; }
.mt-ico-btn {
  border: none; background: transparent; cursor: pointer; font-size: 14px; padding: 5px 6px;
  border-radius: 8px; opacity: .62; transition: .15s; line-height: 1;
}
.mt-ico-btn:hover { opacity: 1; background: #eef4fa; }
.mt-ico-btn.danger:hover { background: #fdeceb; }

/* ---------------- Empty / loading ---------------- */
.mt-empty {
  text-align: center; padding: 56px 20px; background: #fff; border: 1.5px dashed var(--mt-line-s);
  border-radius: 18px; color: var(--mt-sub);
}
.mt-empty .mt-empty-emoji { font-size: 40px; }
.mt-empty h3 { margin: 12px 0 4px; color: var(--mt-ink); font-size: 17px; }
.mt-empty p { margin: 0 0 16px; font-size: 13.5px; }
.mt-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.mt-sk-card { height: 168px; border-radius: 16px; background: var(--rms-skel-fill); background-size: 400% 100%; animation: rms-shimmer var(--t-shimmer) var(--e-in-out) infinite; }

/* ---------------- Editor modal ---------------- */
.mt-modal { position: fixed; inset: 0; z-index: 100050; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mt-modal-bg { position: absolute; inset: 0; background: rgba(13, 32, 51, .48); backdrop-filter: blur(2px); animation: rms-fade var(--t-base) var(--e-out); }
.mt-modal-shell {
  position: relative; background: #fff; border-radius: 18px; width: min(880px, 100%);
  max-height: 92vh; overflow: hidden; box-shadow: 0 30px 70px rgba(9, 26, 43, .35);
  display: flex; flex-direction: column; animation: rms-pop var(--t-base) var(--e-out);
}
.mt-modal-head { padding: 16px 20px; border-bottom: 1px solid var(--mt-line); display: flex; align-items: center; justify-content: space-between; }
.mt-modal-head h3 { margin: 0; font-size: 17px; color: var(--mt-ink); font-weight: 800; }
.mt-x { border: none; background: transparent; font-size: 20px; cursor: pointer; color: #8aa0b4; line-height: 1; padding: 4px 6px; border-radius: 8px; }
.mt-x:hover { background: #eef2f6; color: #33506a; }
.mt-modal-body { padding: 18px 20px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.mt-modal-body .mt-col-full { grid-column: 1 / -1; }
.mt-field label { display: block; font-size: 12px; font-weight: 800; color: #45607a; margin: 0 0 6px; letter-spacing: .01em; }
.mt-field input, .mt-field textarea, .mt-field select {
  width: 100%; border: 1.5px solid var(--mt-line-s); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; font-family: inherit; color: var(--mt-ink); background: #fbfdff;
}
.mt-field textarea { min-height: 190px; resize: vertical; line-height: 1.55; }
.mt-field input:focus, .mt-field textarea:focus, .mt-field select:focus { outline: none; border-color: var(--mt-primary); box-shadow: 0 0 0 3px rgba(5, 136, 182, .13); }
.mt-hint { font-size: 11.5px; color: #90a3b6; margin: 6px 0 0; }

.mt-varbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 2px; }
.mt-varbar-label { font-size: 11.5px; font-weight: 700; color: #7c90a4; margin-right: 2px; }
.mt-var {
  font-size: 11.5px; font-weight: 700; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 4px 9px; border-radius: 8px; border: 1px solid #dbe7f2; background: #f2f8fd; color: #2d6b8f; cursor: pointer; transition: .13s;
}
.mt-var:hover { background: var(--mt-primary); color: #fff; border-color: transparent; }

.mt-live { background: #f7fafd; border: 1.5px solid var(--mt-line); border-radius: 12px; padding: 12px 14px; }
.mt-live-h { font-size: 11.5px; font-weight: 800; color: #7c90a4; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.mt-live-body { font-size: 13px; color: #33506a; white-space: pre-wrap; line-height: 1.55; max-height: 220px; overflow-y: auto; }
.mt-modal-foot { padding: 14px 20px; border-top: 1px solid var(--mt-line); display: flex; align-items: center; justify-content: flex-end; gap: 10px; background: #fbfdff; }
.mt-modal-foot .mt-foot-left { margin-right: auto; }

/* ---------------- Toasts ---------------- */
.mt-toast-box { position: fixed; right: 20px; bottom: 20px; z-index: 100060; display: flex; flex-direction: column; gap: 9px; }
.mt-toast {
  background: #10314c; color: #fff; font-size: 13px; font-weight: 600; padding: 11px 16px; border-radius: 11px;
  box-shadow: 0 12px 30px rgba(9, 26, 43, .3); opacity: 0; transform: translateX(20px); transition: .28s;
  max-width: 340px;
}
.mt-toast.show { opacity: 1; transform: none; }
.mt-toast.ok { background: #14795a; }
.mt-toast.err { background: #b23a32; }

/* ================= Shared compose picker ================= */
/* Trigger button injected into every composer toolbar. */
.mt-tpl-btn {
  appearance: none; border: 1.5px solid var(--mt-line-s); background: #fff; color: #21506f;
  font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s; line-height: 1.2;
}
.mt-tpl-btn:hover { border-color: var(--mt-primary); color: var(--mt-primary); background: #f5fbfe; }
.mt-tpl-btn.slim { padding: 5px 10px; font-size: 12px; }
/* Compact round variant for the eBay-style rounded composer. */
.mt-tpl-icon { border: none; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; opacity: .7; transition: .15s; }
.mt-tpl-icon:hover { opacity: 1; }

.mtp-overlay { position: fixed; inset: 0; z-index: 100080; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mtp-bg { position: absolute; inset: 0; background: rgba(13, 32, 51, .5); backdrop-filter: blur(2px); animation: rms-fade var(--t-base) var(--e-out); }
.mtp-shell {
  position: relative; background: #fff; border-radius: 16px; width: min(600px, 100%); max-height: 84vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 70px rgba(9, 26, 43, .4); animation: rms-pop var(--t-base) var(--e-out);
}
.mtp-head { padding: 15px 18px 12px; border-bottom: 1px solid var(--mt-line); }
.mtp-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mtp-title { font-size: 15.5px; font-weight: 800; color: var(--mt-ink); display: flex; align-items: center; gap: 8px; }
.mtp-title .mtp-plat-tag { font-size: 11px; font-weight: 700; color: #2d6b8f; background: #eef5fb; border: 1px solid #dcecf6; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; }
.mtp-search { position: relative; margin-top: 11px; }
.mtp-search input { width: 100%; height: 38px; border: 1.5px solid var(--mt-line-s); border-radius: 10px; padding: 0 12px 0 34px; font-size: 13px; background: #fbfdff; }
.mtp-search input:focus { outline: none; border-color: var(--mt-primary); box-shadow: 0 0 0 3px rgba(5, 136, 182, .13); }
.mtp-search .mtp-s-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .5; font-size: 13px; }
.mtp-list { overflow-y: auto; padding: 8px; flex: 1; }
.mtp-item { border: 1.5px solid transparent; border-radius: 11px; padding: 10px 12px; cursor: pointer; transition: .13s; }
.mtp-item:hover, .mtp-item.kbd { background: #f4f9fd; border-color: #d9e8f4; }
.mtp-item-top { display: flex; align-items: center; gap: 8px; }
.mtp-item-name { font-size: 13.5px; font-weight: 700; color: var(--mt-ink); flex: 1; }
.mtp-item-cat { font-size: 10.5px; font-weight: 700; color: #2d6b8f; background: #eef5fb; padding: 2px 7px; border-radius: 999px; }
.mtp-item-prev { font-size: 12px; color: #6d8298; line-height: 1.45; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mtp-item-warn { font-size: 11px; color: #b7791f; margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.mtp-empty { padding: 34px 18px; text-align: center; color: var(--mt-sub); font-size: 13px; }
.mtp-foot { padding: 10px 16px; border-top: 1px solid var(--mt-line); display: flex; align-items: center; justify-content: space-between; background: #fbfdff; }
.mtp-foot .mtp-hint { font-size: 11.5px; color: #90a3b6; }
.mtp-manage { font-size: 12px; font-weight: 700; color: var(--mt-primary); cursor: pointer; background: none; border: none; }
.mtp-manage:hover { text-decoration: underline; }
.mtp-x { border: none; background: transparent; font-size: 19px; cursor: pointer; color: #8aa0b4; line-height: 1; padding: 2px 5px; border-radius: 8px; }
.mtp-x:hover { background: #eef2f6; color: #33506a; }

@media (max-width: 720px) {
  .mt-modal-body { grid-template-columns: 1fr; }
  .mt-title { font-size: 22px; }
}

/* ---------------- Dark theme ---------------- */
html[data-theme="dark"] .mt-title { color: #e6edf6; }
html[data-theme="dark"] .mt-sub, html[data-theme="dark"] .mt-hint, html[data-theme="dark"] .mt-meta { color: #9fb0c4; }
html[data-theme="dark"] .mt-toolbar,
html[data-theme="dark"] .mt-card,
html[data-theme="dark"] .mt-modal-shell,
html[data-theme="dark"] .mtp-shell {
  background: #162133; border-color: #2a3650; color: #e6edf6;
}
html[data-theme="dark"] .mt-card-name,
html[data-theme="dark"] .mt-modal-head h3,
html[data-theme="dark"] .mtp-title,
html[data-theme="dark"] .mtp-item-name { color: #e6edf6; }
html[data-theme="dark"] .mt-preview,
html[data-theme="dark"] .mt-live-body,
html[data-theme="dark"] .mtp-item-prev { color: #b8c6d8; }
html[data-theme="dark"] .mt-card-foot,
html[data-theme="dark"] .mt-modal-head,
html[data-theme="dark"] .mt-modal-foot,
html[data-theme="dark"] .mtp-head,
html[data-theme="dark"] .mtp-foot,
html[data-theme="dark"] .mt-field textarea,
html[data-theme="dark"] .mt-field input,
html[data-theme="dark"] .mt-field select,
html[data-theme="dark"] .mt-search input,
html[data-theme="dark"] .mtp-search input,
html[data-theme="dark"] .mt-live { border-color: #243049; }
html[data-theme="dark"] .mt-field input,
html[data-theme="dark"] .mt-field textarea,
html[data-theme="dark"] .mt-field select,
html[data-theme="dark"] .mt-search input,
html[data-theme="dark"] .mt-select,
html[data-theme="dark"] .mtp-search input,
html[data-theme="dark"] .mt-live {
  background: #111a2b; color: #e6edf6;
}
html[data-theme="dark"] .mt-btn { background: #1d2941; border-color: #2a3650; color: #cdd9e8; }
html[data-theme="dark"] .mt-btn.primary { color: #fff; }
html[data-theme="dark"] .mt-modal-foot { background: #14203300; }
html[data-theme="dark"] .mtp-item:hover, html[data-theme="dark"] .mtp-item.kbd { background: #1d2941; border-color: #2f3d59; }
html[data-theme="dark"] .mt-ico-btn:hover { background: #24324c; }
html[data-theme="dark"] .mt-chip { background: #1d2941; border-color: #2a3650; color: #b8c6d8; }
