/* Message templates (HUB-721, QA #343): the 17 Nov design's assets/css/message-templates.css (v2, WEB-97 comment 820913),
   scoped under .mtt-page (the page and its portals) so it never reaches Snippets or other pages. */
/* =================== MESSAGE TEMPLATES =================== */
.mtt-page {
  --mt-btn-radius: var(--radius-sm);
  --mt-field-radius: var(--radius-sm);
  --mt-z-modal: 1100;
  --mt-z-pop: 1300;
  --mt-z-toast: 1400;
  --mt-row-h: 58px;
}
/* modals / popovers / toasts are moved to <body> by the script so the app
   shell can never clip them; this wrapper only carries the scoped variables */
.mtt-page.mt-portal {
  height: 0;
  min-height: 0;
  /* Sequences SQ-3: the theme's text colour, whatever <body> has (see snippets.css). */
  color: var(--text);
}

/* base.css typo: "text-size-crmjust" is not a CSS property. Correct version: */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.mtt-page .mt-table tbody tr:last-child td {
    border-bottom: 0px;
}
.mtt-page .mt-pager{margin-top:10px;}

/* base.css has the global :focus-visible rule commented out and removes the
   outline everywhere, so links, tabs, selects and custom controls had no
   keyboard focus indicator. Restored here for this page only. */
.mtt-page a:focus-visible,
.mtt-page button:focus-visible,
.mtt-page [tabindex]:focus-visible,
.mtt-page [contenteditable="true"]:focus-visible,
.mtt-page summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.mtt-page .btn-crm:focus-visible,
.mtt-page .icon-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.mtt-page .mt-editor:focus-visible {
  outline: none;
}

/* base.css gives .btn-crm / .input their radius from --radius-sm; this keeps
   the page switchable between square-ish and pill without touching base.css */
.mtt-page .btn-crm {
  border-radius: var(--mt-btn-radius);
}
.mtt-page .input {
  border-radius: var(--mt-field-radius);
  height: 40px;
  font-size: 14px;
}
.mtt-page .input[type="search"]::-webkit-search-cancel-button {
  display: none;
}
.mtt-page textarea.input {
  height: auto;
  padding: 10px 14px;
  line-height: 1.5;resize: none!important;
  resize: vertical;
}

/* screen-reader only */
.mtt-page .mt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.mtt-page .mt-grow {
  flex: 1 1 auto;
  min-width: 0;
}
.mtt-page .mt-noscript {
  padding: var(--sp-6);
  text-align: center;
  color: var(--danger);
}

/* checkbox "mixed" state (base.css .check has no indeterminate look) */
.mtt-page .check input:indeterminate + .check__box {
  background: var(--brand);
  border-color: var(--brand);
}
.mtt-page .check input:indeterminate + .check__box::after {
  width: 10px;
  height: 0;
  border: 0;
  border-top: 2px solid var(--brand-contrast);
  transform: none;
}
.mtt-page .check .check__box {
  flex: none;
}

/* ==========================================================================
   2. PAGE LAYOUT
   ========================================================================== */
.mtt-page .mt-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* top bar */
.mtt-page .mt-topbar {
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid var(--border);
}
.mtt-page .mt-topbar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 72px;
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.mtt-page .mt-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mtt-page .mt-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.mtt-page .mt-count {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-right: var(--sp-1);
}

/* toolbar */
.mtt-page .mt-main {
  border-radius: 0 0 12px 12px;
  background: var(--surface);
  min-height: calc(100vh - var(--header-h, 64px) - 72px);
  padding-bottom: var(--sp-12);
}
.mtt-page .mt-main:focus {
  outline: none;
}
.mtt-page .mt-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) 0;
  flex-wrap: wrap;
}
.mtt-page .mt-search {
  position: relative;
  width: 260px;
  max-width: 100%;
}
.mtt-page .mt-search--block {
  width: 100%;
}
.mtt-page .mt-search .input {
  padding-right: 40px;
}
.mtt-page .mt-search__icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

/* table */
.mtt-page .mt-table-wrap {
  overflow-x: auto;
}
.mtt-page .mt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 640px;
}
.mtt-page .mt-table th,
.mtt-page .mt-table td {
  text-align: left;
  padding: 0 var(--sp-3);
  vertical-align: middle;
}
.mtt-page .mt-table thead th {
  height: 52px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--text);
}
[data-theme="dark"] .mtt-page .mt-table thead th {
  border-bottom-color: var(--border-strong);
}
.mtt-page .mt-col-check {
  width: 48px;
  padding-left: var(--sp-2) !important;
}
.mtt-page .mt-col-owner {
  width: 168px;
}
.mtt-page .mt-col-date {
  width: 152px;
}

.mtt-page .mt-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  line-height: 1.25;
  text-align: left;
  border-radius: 6px;
  padding: 2px 0;
}
.mtt-page .mt-sort:hover,
.mtt-page .mt-sort.is-active {
  color: var(--text);
}
.mtt-page .mt-sort .icon {
  color: var(--text-subtle);
}
.mtt-page .mt-sort.is-active .icon {
  color: var(--text);
}

.mtt-page .mt-table tbody tr {
  height: var(--mt-row-h);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--fast) var(--ease);
}
.mtt-page .mt-table tbody tr:hover,
.mtt-page .mt-table tbody tr.is-menu-open,
.mtt-page .mt-table tbody tr.is-selected {
  background: var(--surface-hover);
}
.mtt-page .mt-table tbody td {
  font-size: 14px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.mtt-page .mt-cell-name {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.mtt-page .mt-name-link {
  min-width: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-ink);
  text-align: left;
  overflow-wrap: anywhere;
  border-radius: 4px;
}
.mtt-page .mt-name-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mtt-page .mt-folder-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mtt-page .mt-cell-owner {
  line-height: 1.35;
  max-width: 130px;
  overflow-wrap: anywhere;
}
.mtt-page .mt-cell-empty {
  height: 160px;
  text-align: center !important;
  color: var(--text-muted);
}

/* bulk bar replaces the heading row while rows are selected */
.mtt-page .mt-bulk-row th {
  height: 52px;
  font-weight: 500;
  color: var(--text-muted);
}
.mtt-page .mt-bulk {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.mtt-page .mt-bulk__count {
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.mtt-page .mt-bulk__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand-ink);
  border-radius: 6px;
  padding: 4px 2px;
}
.mtt-page .mt-bulk__btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* pager */
.mtt-page .mt-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mtt-page .mt-pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.mtt-page .mt-pager__btn:hover:not([disabled]):not(.is-current) {
  background: var(--surface-hover);
}
.mtt-page .mt-pager__btn.is-current {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
  cursor: default;
}
.mtt-page .mt-pager__btn[disabled] {
  color: #b8c0cc;
  cursor: default;
}
.mtt-page .mt-pager__info {
  width: 100%;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-subtle);
  margin-top: var(--sp-2);
}

/* ==========================================================================
   3. SMALL CONTROLS
   ========================================================================== */
.mtt-page .mt-owner-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.mtt-page .mt-owner-btn:hover {
  background: var(--surface-hover);
}
.mtt-page .mt-owner-btn[aria-expanded="true"] {
  background: var(--surface-3);
}

.mtt-page .mt-actions-btn {
    flex: none;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 33px;
    padding: 0 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--mt-btn-radius);
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}
.mtt-page .mt-table tbody tr:hover .mt-actions-btn,
.mtt-page .mt-table tbody tr:focus-within .mt-actions-btn,
.mtt-page .mt-actions-btn[aria-expanded="true"] {
  opacity: 1;
}
@media (hover: none) {
  .mtt-page .mt-actions-btn {
    opacity: 1;
  }
}

.mtt-page .mt-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 2px;
}
.mtt-page .mt-link-btn:hover {
  color: var(--brand-ink);
}
.mtt-page .mt-link-btn--strong {
  color: var(--brand-ink);
  font-size: 14px;
}
.mtt-page .mt-link-btn--strong:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* small text dropdown trigger used inside the compose box ("No folder v") */
.mtt-page .mt-dd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 4px;
  white-space: nowrap;
}
.mtt-page .mt-dd:hover,
.mtt-page .mt-dd[aria-expanded="true"] {
  background: var(--surface-3);
}
.mtt-page .mt-dd .icon {
  color: var(--text-muted);
}

/* ==========================================================================
   4. POPOVERS, MENUS, LIST BOXES, SELECT
   ========================================================================== */
.mtt-page .mt-layer {
  position: relative;
  z-index: var(--mt-z-pop);
}
.mtt-page .mt-pop {
  --arrow-x: 24px;
  position: fixed;
  z-index: var(--mt-z-pop);
  max-width: calc(100vw - 16px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: mtPopIn 0.14s var(--ease);
  width: auto!important;min-width: auto;
}
.mtt-page .mt-pop::before {
  content: "";
  position: absolute;
  left: var(--arrow-x);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--surface);
  border: 1px solid var(--border);
  transform: rotate(45deg);
}
.mtt-page .mt-pop[data-place="bottom"]::before {
  top: -7px;
  border-right: 0;
  border-bottom: 0;
}
.mtt-page .mt-pop[data-place="top"]::before {
  bottom: -7px;
  border-left: 0;
  border-top: 0;
}
.mtt-page .mt-pop[data-place="right"]::before,
.mtt-page .mt-pop--noarrow::before {
  display: none;
}
@keyframes mtPopIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.mtt-page .mt-pop__pad {
  padding: var(--sp-4);
}

/* menu items */
.mtt-page .mt-menu {
  padding: var(--sp-2);
  min-width: 190px;
}
.mtt-page .mt-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  border-radius: var(--radius-sm);
}
.mtt-page .mt-menu__item:hover,
.mtt-page .mt-menu__item.is-focus {
  background: var(--surface-3);
}
.mtt-page .mt-menu__item[disabled] {
  color: var(--text-subtle);
  cursor: not-allowed;
}
.mtt-page .mt-menu__item--danger {
  color: var(--danger);
}
.mtt-page .mt-menu__item .icon {
  color: var(--text-muted);
}
.mtt-page .mt-menu__item .mt-menu__chev {
  margin-left: auto;
}
.mtt-page .mt-menu__txt {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mtt-page .mt-menu__sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* list box (searchable, grouped) */
.mtt-page .mt-listbox {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-height: 340px;
}
.mtt-page .mt-listbox__search {
  position: relative;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}
.mtt-page .mt-listbox__search .input {
  height: 38px;
  padding-right: 38px;
  border: 2px solid var(--brand);
  border-radius: var(--mt-field-radius);
}
.mtt-page .mt-listbox__search .mt-search__icon {
  right: 26px;
}
.mtt-page .mt-listbox__list {
  overflow-y: auto;
  padding: var(--sp-1) var(--sp-2) var(--sp-2);
  max-height: 260px;
  overscroll-behavior: contain;
}
.mtt-page .mt-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.mtt-page .mt-opt:hover,
.mtt-page .mt-opt.is-focus {
  background: var(--surface-3);
}
.mtt-page .mt-opt[aria-selected="true"] {
  font-weight: 600;
}
.mtt-page .mt-opt[aria-disabled="true"] {
  color: var(--text-subtle);
  cursor: not-allowed;
}
.mtt-page .mt-opt .icon {
  color: var(--text-muted);
}
.mtt-page .mt-opt__txt {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mtt-page .mt-opt__sub {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.mtt-page .mt-opt__title {
  display: block;
}
.mtt-page .mt-group {
  padding: 12px 12px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.mtt-page .mt-empty-opt {
  padding: 14px 12px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.mtt-page .mt-listbox__foot {
  padding: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* custom select button (looks like .input) */
.mtt-page .mt-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--mt-field-radius);
  transition: border-color var(--fast) var(--ease);
}
.mtt-page .mt-select:hover {
  border-color: var(--text-subtle);
}
.mtt-page .mt-select[aria-expanded="true"] {
  border-color: var(--brand);
}
.mtt-page .mt-select[disabled] {
  opacity: 0.55;
  pointer-events: none;
}
.mtt-page .mt-select__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtt-page .mt-select__label.is-placeholder {
  color: var(--text-subtle);
}
.mtt-page .mt-select .icon {
  color: var(--text-muted);
}

/* ==========================================================================
   5. MODALS, DRAWER, ALERTS
   ========================================================================== */
body.mt-lock {
  overflow: hidden;
}
.mtt-page .mt-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--mt-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh var(--sp-4) var(--sp-4);
  overflow-y: auto;
  background: rgba(16, 24, 40, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: mtFade 0.18s var(--ease);
}
[data-theme="dark"] .mtt-page .mt-overlay {
  background: rgba(2, 6, 14, 0.7);
}
@keyframes mtFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.mtt-page .mt-modal {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: mtModalIn 0.2s var(--ease);
}
@keyframes mtModalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.mtt-page .mt-modal--sm {
  max-width: 480px;
}
.mtt-page .mt-modal--md {
  max-width: 520px;
}
.mtt-page .mt-modal--ai {
  max-width: 720px;height: 650px;
    overflow: auto;
}
.mtt-page .mt-modal--video {
  max-width: 560px;
}
.mtt-page .mt-modal--lib {
  max-width: 1080px;
}
.mtt-page .mt-modal--editor {
  max-width: 1280px;
}
.mtt-page .mt-modal--editor.is-solo {
  max-width: 800px;
}
.mtt-page .mt-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-8);
  border-bottom: 1px solid var(--border);
}
.mtt-page .mt-modal__head h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mtt-page .mt-modal__body {
  padding: var(--sp-6) var(--sp-8);
  display: grid;
  gap: var(--sp-4);
}
.mtt-page .mt-modal__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-8) var(--sp-6);
}
.mtt-page .mt-modal__foot--split {
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-8);
  border-top: 1px solid var(--border);
}
.mtt-page .mt-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.mtt-page .mt-text--lg {
  font-size: 15px;
}
.mtt-page .mt-text--sm {
  font-size: 12.5px;
}
.mtt-page .mt-text--muted {
  color: var(--text-muted);
}

.mtt-page .mt-alert {
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.mtt-page .mt-alert strong {
  display: block;
  margin-bottom: 4px;
}
.mtt-page .mt-alert p {
  font-size: 14px;
  line-height: 1.5;
}
.mtt-page .mt-alert--warning {
  background: var(--warning-bg);
  border-color: var(--warning);
}

/* drawer */
.mtt-page .mt-overlay--drawer {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  overflow: hidden;
}
.mtt-page .mt-drawer {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: mtDrawerIn 0.24s var(--ease);
}
@keyframes mtDrawerIn {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.mtt-page .mt-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-8);
}
.mtt-page .mt-drawer .mt-modal__foot {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   6. RADIO, TABS, FOLDER LIST
   ========================================================================== */
.mtt-page .mt-radio-group {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.mtt-page .mt-radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  cursor: pointer;
  width: fit-content;
}
.mtt-page .mt-radio input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}
.mtt-page .mt-radio__dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color var(--fast) var(--ease);
}
.mtt-page .mt-radio__dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  transform: scale(0);
  transition: transform var(--fast) var(--ease);
}
.mtt-page .mt-radio:hover .mt-radio__dot {
  border-color: var(--brand);
}
.mtt-page .mt-radio input:checked + .mt-radio__dot {
  border-color: var(--brand);
}
.mtt-page .mt-radio input:checked + .mt-radio__dot::after {
  transform: scale(1);
}
.mtt-page .mt-radio input:focus-visible + .mt-radio__dot {
  box-shadow: var(--focus-ring);
}
.mtt-page .mt-radio .mt-tip {
  display: inline-flex;
  color: var(--text-muted);
}

/* css tooltip: <span class="mt-tip" data-mt-tip="..."> */
.mtt-page .mt-tip {
  position: relative;
}
.mtt-page .mt-tip::after {
  content: attr(data-mt-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--bg);
  background: var(--text);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fast) var(--ease);
  z-index: 5;
}
.mtt-page .mt-tip:hover::after,
.mtt-page .mt-tip:focus-visible::after {
  opacity: 1;
}

.mtt-page .mt-tabs {
  display: flex;
  gap: var(--sp-6);
  margin: var(--sp-6) 0 var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.mtt-page .mt-tab {
  position: relative;
  padding: 10px 6px 12px;
  font-size: 14px;
  color: var(--text-muted);
}
.mtt-page .mt-tab[aria-selected="true"] {
  font-weight: 600;
  color: var(--text);
}
.mtt-page .mt-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--text);
}
.mtt-page .mt-checklist {
  display: grid;
  gap: var(--sp-1);
  max-height:300px;
  overflow-y: auto;
  padding: 2px;
}
.mtt-page .mt-checklist .check {
  padding: 8px 6px;
  font-size: 14.5px;
  color: var(--text);
  border-radius: var(--radius-sm);
}
.mtt-page .mt-checklist .check:hover {
  background: var(--surface-hover);
}

.mtt-page .mt-folder-list {
  display: grid;
  gap: 2px;
  max-height: 46vh;
  overflow-y: auto;
  margin: 0 calc(var(--sp-2) * -1);
  padding: 2px var(--sp-2);
}
.mtt-page .mt-folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  font-size: 14.5px;
  text-align: left;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.mtt-page .mt-folder-item:hover {
  background: var(--surface-hover);
}
.mtt-page .mt-folder-item[aria-selected="true"] {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}
.mtt-page .mt-folder-item .icon {
  color: var(--text-muted);
}
.mtt-page .mt-folder-item[aria-selected="true"] .icon {
  color: inherit;
}

/* ==========================================================================
   7. TEMPLATE EDITOR
   ========================================================================== */
.mtt-page .mt-ed {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-8) var(--sp-4);
}
.mtt-page .mt-modal--editor.is-solo .mt-ed {
  grid-template-columns: minmax(0, 1fr);
}
.mtt-page .mt-modal--editor.is-solo .mt-ed__previewcol {
  display: none;
}
.mtt-page .mt-ed__col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}
.mtt-page .mt-ed__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 34px;
}
.mtt-page .mt-ed__head h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}
.mtt-page .mt-ed__showprev {
  display: none;
}
.mtt-page .mt-modal--editor.is-solo .mt-ed__showprev {
  display: inline-flex;
}

/* compose box */
.mtt-page .mt-compose {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 540px;
}
[data-theme="dark"] .mtt-page .mt-compose {
  border-color: var(--border-strong);
}
.mtt-page .mt-compose:focus-within {
  border-color: var(--brand);
}
.mtt-page .mt-compose__row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 42px;
  padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--border-strong);
}
.mtt-page .mt-compose__row.is-invalid {
  box-shadow: inset 0 0 0 2px var(--danger);
}
.mtt-page .mt-compose__meta {
  gap: var(--sp-5);
  flex-wrap: wrap;
  padding-top: 4px;
  padding-bottom: 4px;
}
.mtt-page .mt-compose__owner {
  font-size: 13.5px;
  color: var(--text);
}
.mtt-page .mt-compose__lbl {
  flex: none;
  font-size: 13.5px;
  font-weight: 600;
}
.mtt-page .mt-compose__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  padding: 0 4px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: 0;
}
.mtt-page .mt-compose__input::placeholder {
  color: var(--text-subtle);
}
.mtt-page .mt-compose__input:focus {
  outline: none;
}

.mtt-page .mt-editor {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: 46vh;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}
.mtt-page .mt-editor:empty::before {
  content: attr(data-mt-placeholder);
  color: var(--text-subtle);
  pointer-events: none;
}
.mtt-page .mt-editor p,
.mtt-page .mt-editor div {
  margin: 0 0 14px;
}
.mtt-page .mt-editor ul,
.mtt-page .mt-editor ol {
  margin: 0 0 14px;
  padding-left: 28px;
}
.mtt-page .mt-editor ul {
  list-style: disc;
}
.mtt-page .mt-editor ol {
  list-style: decimal;
}
/* List markers follow the text color selected in the rich-text editor. */
.mtt-page .mt-editor li::marker {
  color: var(--mt-list-marker-color, currentColor);
}
.mtt-page .mt-editor a {
  color: var(--brand-ink);
  text-decoration: underline;
}
.mtt-page .mt-editor img {
  display: inline-block;
  max-width: 100%;
  height: auto;
}
.mtt-page .mt-editor .mt-doc-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* personalization token chip */
.mtt-page .mt-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  margin: 0 1px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--text-muted);
  border-radius: 6px;
  vertical-align: baseline;
  cursor: pointer;
  user-select: all;
}
.mtt-page .mt-token .icon {
  color: var(--text-muted);
}
.mtt-page .mt-token:hover {
  background: var(--surface-hover);
}
.mtt-page .mt-token.is-selected,
.mtt-page .mt-token:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand);
}
.mtt-page .mt-lib__preview .mt-token,
.mtt-page .mt-mail .mt-token {
  cursor: default;
}

.mtt-page .mt-compose__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.mtt-page .mt-sig {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mtt-page .mt-sig .link {
  font-size: 13px;
}
.mtt-page .mt-suggest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 2px 4px;
}
.mtt-page .mt-suggest:hover {
  color: var(--text);
}
.mtt-page .mt-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--bg);
  background: var(--success);
  border-radius: var(--radius-pill);
}
.mtt-page .mt-badge.is-zero {
  background: var(--text-subtle);
}

.mtt-page .mt-fmt {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 4px var(--sp-3) var(--sp-3);
}
.mtt-page .mt-fmt__btn,
.mtt-page .mt-fmt__txt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  min-width: 30px;
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
}
.mtt-page .mt-fmt__btn:hover,
.mtt-page .mt-fmt__txt:hover,
.mtt-page .mt-fmt__txt[aria-expanded="true"],
.mtt-page .mt-fmt__btn.is-on {
  background: var(--surface-3);
  color: var(--text);
}
.mtt-page .mt-fmt__txt {
  color: var(--text);
}
.mtt-page .mt-fmt__ai {
  margin-left: auto;
}

/* more-formatting popover */
.mtt-page .mt-moretools {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
}
.mtt-page .mt-moretools .mt-fmt__txt {
  min-width: 0;
}
.mtt-page .mt-moretools__sep {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--border);
}
.mtt-page .mt-swatches {
  display: grid;
  grid-template-columns: repeat(6, 26px);
  gap: 6px;
  padding: var(--sp-3);
}
.mtt-page .mt-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
}
.mtt-page .mt-swatch:hover {
  transform: scale(1.08);
}

/* insert menu + panels */
.mtt-page .mt-insert {
  width: 360px;
  max-width: calc(100vw - 24px);
}
.mtt-page .mt-panel__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}
.mtt-page .mt-panel__back {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
}
.mtt-page .mt-panel__back:hover {
  background: var(--surface-3);
  color: var(--text);
}
.mtt-page .mt-panel__sep {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}
.mtt-page .mt-panel__title {
  font-size: 13.5px;
  font-weight: 700;
}
.mtt-page .mt-panel__right {
  margin-left: auto;
  display: flex;
  gap: var(--sp-2);
}
.mtt-page .mt-panel__body {
  display: grid;
  gap: var(--sp-3);
  padding: 0 var(--sp-4) var(--sp-4);
}
.mtt-page .mt-panel__body .field__label {
  font-size: 13.5px;
}
.mtt-page .mt-panel__actions {
  display: flex;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
}
.mtt-page .mt-panel__list {
  max-height: 280px;
  overflow-y: auto;
  padding: 0 var(--sp-2) var(--sp-3);
}
.mtt-page .mt-snippet {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: var(--radius-sm);
}
.mtt-page .mt-snippet:hover {
  background: var(--surface-3);
}
.mtt-page .mt-snippet__name {
  font-size: 14px;
  font-weight: 600;
}
.mtt-page .mt-snippet__text {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtt-page .mt-panel__search {
  position: relative;
  padding: 0 var(--sp-4) var(--sp-2);
}
.mtt-page .mt-panel__search .input {
  height: 38px;
  padding-right: 38px;
}
.mtt-page .mt-panel__search .mt-search__icon {
  right: 28px;
}
.mtt-page .mt-checks {
  display: grid;
  gap: 2px;
}
.mtt-page .mt-checks .check {
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  border-radius: var(--radius-sm);
}
.mtt-page .mt-checks .check:hover {
  background: var(--surface-3);
}
.mtt-page .mt-radio-block {
  display: grid;
  gap: var(--sp-2);
}
.mtt-page .mt-radio-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.mtt-page .mt-radio-row .link {
  font-size: 13px;
}
.mtt-page .mt-suggest-list {
  display: grid;
  gap: var(--sp-3);
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: var(--sp-4);
}
.mtt-page .mt-suggest-list li {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}
.mtt-page .mt-suggest-list .icon {
  margin-top: 2px;
  color: var(--warning);
}
.mtt-page .mt-suggest-list .is-ok .icon {
  color: var(--success);
}

/* ==========================================================================
   8. PREVIEW PANE
   ========================================================================== */
.mtt-page .mt-preview-pick {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.mtt-page .mt-preview {
    flex: 1 1 auto;
    min-height: 480px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: auto;
}
.mtt-page .mt-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: var(--sp-4);
    min-height: 100%;
    padding: var(--sp-8);
    text-align: center;
    font-size: 14px;
    color: var(--text);
}
.mtt-page .mt-empty__art {
  width: 170px;
  height: auto;
}
.mtt-page .mt-mail {
  padding: var(--sp-5);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.mtt-page .mt-mail__meta {
  display: grid;
  gap: 6px;
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.mtt-page .mt-mail__meta dt {
  display: inline;
  font-weight: 700;
  color: var(--text-muted);
}
.mtt-page .mt-mail__meta dd {
  display: inline;
  margin: 0 0 0 6px;
}
.mtt-page .mt-mail p {
  margin: 0 0 14px;
}
.mtt-page .mt-mail ul,
.mtt-page .mt-mail ol {
  margin: 0 0 14px;
  padding-left: 28px;
}
.mtt-page .mt-mail ul {
  list-style: disc;
}
.mtt-page .mt-mail ol {
  list-style: decimal;
}
.mtt-page .mt-mail a {
  color: var(--brand-ink);
  text-decoration: underline;
}
.mtt-page .mt-mail__sig {
  margin-top: var(--sp-5);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border-strong);
  font-size: 13px;
  color: var(--text-muted);
}
.mtt-page .mt-mail__sig strong {
  display: block;
  color: var(--text);
}

/* ==========================================================================
   9. LIBRARY, AI MODAL, VIDEO MODAL
   ========================================================================== */
.mtt-page .mt-lib {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: min(560px, 62vh);
  border-bottom: 0;
}
.mtt-page .mt-lib__list {
  overflow-y: auto;
  padding: 0 var(--sp-6) var(--sp-4) var(--sp-6);
}
.mtt-page .mt-lib__cat {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--sp-4) 0 var(--sp-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface);
  border-bottom: 1px solid var(--text);
}
[data-theme="dark"] .mtt-page .mt-lib__cat {
  border-bottom-color: var(--border-strong);
}
.mtt-page .mt-lib__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  width: 100%;
  padding: 14px 8px;
  text-align: left;
  border-radius: 0;
  cursor: pointer;
}
.mtt-page .mt-lib__item:hover,
.mtt-page .mt-lib__item.is-active {
  background: var(--surface-hover);
}
.mtt-page .mt-lib__item .check {
  margin-top: 1px;
}
.mtt-page .mt-lib__name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.mtt-page .mt-lib__desc {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.mtt-page .mt-lib__preview {
  overflow-y: auto;
  padding: var(--sp-8) var(--sp-8);
  background: var(--surface-3);
  font-size: 14px;
}
.mtt-page .mt-lib__preview .mt-lib__row {
  margin-bottom: var(--sp-4);
  font-size: 13.5px;
}
.mtt-page .mt-lib__preview .mt-lib__row strong {
  margin-right: 10px;
}
.mtt-page .mt-lib__preview .mt-mail {
  padding: 0;
}
.mtt-page .mt-lib__count {
  font-size: 14px;
  color: var(--text);
}

.mtt-page .mt-ai {
  gap: var(--sp-5);
}
.mtt-page .mt-ai__badge {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-3);
  border-radius: 6px;
}
.mtt-page .mt-ai .field__label {
  font-size: 13.5px;
}
.mtt-page .mt-tones {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-3);
}
.mtt-page .mt-tones__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-5);
}
.mtt-page .mt-tones .check {
  color: var(--text);
  font-size: 14.5px;
}

.mtt-page .mt-vid {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mtt-page .mt-vid__logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mtt-page .mt-vid__mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: inset 0 0 0 6px var(--teal-bg);
}
.mtt-page .mt-vid__word {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.mtt-page .mt-vid__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mtt-page .mt-vid__text {
  max-width: 340px;
  font-size: 14px;
  color: var(--text-muted);
}
.mtt-page .mt-vid__alt {
  font-size: 14px;
  color: var(--text-muted);
}

/* ==========================================================================
   10. TOASTS
   ========================================================================== */
.mtt-page .mt-toasts {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  transform: translateX(-50%);
  z-index: var(--mt-z-toast);
  display: grid;
  gap: var(--sp-2);
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.mtt-page .mt-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--bg);
  background: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--slow) var(--ease),
    transform var(--slow) var(--ease);
}
.mtt-page .mt-toast.is-in {
  opacity: 1;
  transform: none;
}
.mtt-page .mt-toast--error .icon {
  color: var(--danger);
}
.mtt-page .mt-toast--success .icon {
  color: var(--success);
}
.mtt-page .mt-toast--info .icon {
  color: var(--info);
}
[data-theme="dark"] .mtt-page .mt-toast {
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}

.mtt-page {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

/* ==========================================================================
   11. RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .mtt-page .mt-ed {
    grid-template-columns: minmax(0, 1fr);overflow: auto;height: 500px;
  }
  .mtt-page .mt-preview,
  .mtt-page .mt-empty {
    min-height: 320px;
  }
  .mtt-page .mt-compose {
    min-height: 460px;
  }
  .mtt-page .mt-modal--editor {
    max-width: 760px;
  }
}
@media (max-width: 860px) {
  .mtt-page .mt-col-date,
  .mtt-page .mt-table td.mt-cell-date,
  .mtt-page .mt-table th.mt-col-date {
    display: none;
  }
  .mtt-page .mt-table {
    min-width: 0;
  }
  .mtt-page .mt-col-owner {
    width: 130px;
  }
  .mtt-page .mt-lib {
    grid-template-columns: minmax(0, 1fr);
    height: 70vh;
  }
  .mtt-page .mt-lib__preview {
    display: block;
  }
}
@media (max-width: 640px) {
  .mtt-page .mt-container {
    padding: 0 var(--sp-4);
  }
  .mtt-page .mt-topbar__in {
    align-items: flex-start;
  }
  .mtt-page .mt-count {
    width: 100%;
  }
  .mtt-page .mt-overlay {
    padding: var(--sp-2);
  }
  .mtt-page .mt-modal__head,
  .mtt-page .mt-modal__body,
  .mtt-page .mt-modal__foot,
  .mtt-page .mt-ed,
  .mtt-page .mt-drawer__body {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
  .mtt-page .mt-modal__foot--split {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
  .mtt-page .mt-col-owner {
    display: none;
  }
  .mtt-page .mt-table td.mt-cell-owner {
    display: none;
  }
  .mtt-page .mt-folder-tag {
    display: none;
  }
}


/* Clone template dialog - additive styles */
.mtt-page .mt-clone-modal .mt-modal__body { padding: 24px; }
.mtt-page .mt-clone-modal .field { margin: 0 0 22px; }
.mtt-page .mt-clone-modal .field:last-child { margin-bottom: 0; }
.mtt-page .mt-clone-modal .field__label { display:block; margin:0 0 14px; font-size:14px; font-weight:600; color:var(--text); }
.mtt-page .mt-clone-modal .input { height:46px; border-radius:8px; font-size:15px; }
.mtt-page .mt-clone-folder { position:relative; }
.mtt-page .mt-clone-folder-trigger { width:100%; display:flex; align-items:center; justify-content:space-between; text-align:left; border:1px solid var(--brand); background:var(--surface); color:var(--text); padding:0 14px; cursor:pointer; }
.mtt-page .mt-clone-folder-trigger .icon { flex:none; color:var(--text-muted); }
.mtt-page .mt-clone-folder-menu { position:absolute; z-index:var(--mt-z-pop); top:calc(100% + 6px); left:0; right:0; padding:10px; background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-lg); }
.mtt-page .mt-clone-folder-menu[hidden] { display:none!important; }
.mtt-page .mt-clone-folder-menu .mt-search { width:100%; margin:0 0 8px; }
.mtt-page .mt-clone-folder-menu .input { height:44px; }
.mtt-page .mt-clone-folder-menu ul { list-style:none; padding:0; margin:0; max-height:170px; overflow-y:auto; }
.mtt-page .mt-clone-folder-option { display:block; width:100%; padding:10px 8px; border:0; border-radius:6px; background:transparent; color:var(--text); text-align:left; font:inherit; cursor:pointer; }
.mtt-page .mt-clone-folder-option:hover,.mtt-page .mt-clone-folder-option[aria-selected="true"] { background:var(--surface-3); }
.mtt-page .mt-clone-folder-empty { padding:10px 8px; color:var(--text-muted); font-size:13px; }
.mtt-page .mt-clone-modal .mt-modal__foot { justify-content:flex-start; gap:12px; padding:0 24px 16px; }
.mtt-page .mt-clone-modal .mt-modal__foot .btn-crm { min-width:72px; min-height:42px; border-radius:8px; }
@media(max-width:600px) {
 .mtt-page .mt-clone-modal .mt-modal__body { padding:20px 16px; }
 .mtt-page .mt-clone-modal .mt-modal__foot { padding:0 16px 16px; }
}


/* Clone dialog: keep the folder picker in the modal's normal flow so the
   complete option list and action buttons remain visible (desktop + mobile). */
.mtt-page .mt-overlay#mClone {
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}
.mtt-page .mt-clone-modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mtt-page .mt-clone-modal .mt-modal__head {
  min-height: 72px;
  padding: 18px 32px;
}
.mtt-page .mt-clone-modal .mt-modal__body {
  display: block;
  padding: 24px 32px 12px;
}
.mtt-page .mt-clone-modal .field {
  margin: 0 0 20px;
}
.mtt-page .mt-clone-modal .field:last-child {
  margin-bottom: 0;
}
.mtt-page .mt-clone-modal .field__label {
  margin: 0 0 12px;
  line-height: 1.35;
}
.mtt-page .mt-clone-modal .input,
.mtt-page .mt-clone-folder-trigger {
  height: 40px;
  min-height: 40px;
  font-size: 14px;
}
.mtt-page .mt-clone-folder-trigger {
  border-color: var(--brand);
}
.mtt-page .mt-clone-folder-menu {
  position: static;
  inset: auto;
  width: 100%;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.mtt-page .mt-clone-folder-menu .mt-search {
  width: 100%;
  margin: 0;
}
.mtt-page .mt-clone-folder-menu .input {
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0 14px;
}
.mtt-page .mt-clone-folder-menu ul {
  max-height: 224px;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.mtt-page .mt-clone-folder-option {
  min-height: 26px;
  padding: 3px 0;
  border-radius: 0;
  line-height: 1.45;
  font-size: 14px;
}
.mtt-page .mt-clone-folder-option:hover,
.mtt-page .mt-clone-folder-option[aria-selected="true"] {
  background: var(--surface-3);
}
.mtt-page .mt-clone-modal .mt-modal__foot {
  padding: 16px 32px 24px;
  gap: 12px;
}
.mtt-page .mt-clone-modal .mt-modal__foot .btn-crm {
  min-width: 72px;
  min-height: 42px;
  border-radius: 8px;
}
@media (max-width: 600px) {
  .mtt-page .mt-overlay#mClone { padding: 8px; }
  .mtt-page .mt-clone-modal { max-height: calc(100vh - 16px); }
  .mtt-page .mt-clone-modal .mt-modal__head { min-height: 64px; padding: 16px 20px; }
  .mtt-page .mt-clone-modal .mt-modal__body { padding: 20px 20px 8px; }
  .mtt-page .mt-clone-modal .mt-modal__foot { padding: 12px 20px 20px; }
  .mtt-page .mt-clone-folder-menu ul { max-height: min(224px, 30vh); }
}

/* Clone template popup — match the supplied compact reference (open folder state).
   The folder menu intentionally overlays the modal footer instead of increasing
   the dialog height. All rules are scoped to #mClone. */
.mtt-page .mt-overlay#mClone {
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal {
  position: relative;
  width: 100%;
  max-width: 450px;
  max-height: none;
  overflow: visible;
  border-radius: 13px;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__head {
  min-height: 58px;
  padding: 14px 24px;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__head h2 {
  font-size: 18px;
  line-height: 1.35;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__body {
  display: block;
  padding: 24px 24px 18px;
  overflow: visible;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .field {
  margin: 0 0 24px;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .field:last-child {
  margin-bottom: 0;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .field__label {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.35;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .input,
.mtt-page .mt-overlay#mClone .mt-clone-folder-trigger {
  height: 46px;
  min-height: 46px;
  font-size: 15px;
  border-radius: 8px;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-trigger {
  border: 1px solid var(--border-strong);
  padding: 0 14px;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-menu {
  position: absolute;
  z-index: calc(var(--mt-z-pop) + 2);
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-menu[hidden] { display: none !important; }
.mtt-page .mt-overlay#mClone .mt-clone-folder-menu .mt-search {
  margin: 0 0 8px;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-menu .input {
  height: 46px;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 14px;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-menu ul {
  max-height: 48px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-option {
  min-height: 48px;
  padding: 10px 8px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.4;
}
.mtt-page .mt-overlay#mClone .mt-clone-folder-option:hover,
.mtt-page .mt-overlay#mClone .mt-clone-folder-option[aria-selected="true"] {
  background: var(--surface-3);
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__foot {
  position: relative;
  padding: 0 24px 24px;
  gap: 12px;
}
.mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__foot .btn-crm {
  min-height: 42px;
  border-radius: 8px;
}
@media (max-width: 600px) {
  .mtt-page .mt-pager{gap:4px 0;}
  .mtt-page{padding-top: 15px;}
  .mtt-page .mt-overlay#mClone { padding: 16px; }
  .mtt-page .mt-topbar__actions{padding-bottom: 15px;}
  .mtt-page .mt-name-link{font-size: 13px;}
  .mtt-page .mt-overlay#mClone .mt-clone-modal { max-width: 450px; }
  .mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__head { padding: 14px 24px; }
  .mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__body { padding: 24px 24px 18px; }
  .mtt-page .mt-overlay#mClone .mt-clone-modal .mt-modal__foot { padding: 0 24px 24px; }
}


/* Newly-created folder rows in the Message Templates table */
.mtt-page .mt-folder-row .mt-folder-row__name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 500;
}
.mtt-page .mt-folder-row .mt-folder-row__name > .icon {
  flex: 0 0 auto;
  color: var(--brand);display: none;
}
.mtt-page .mt-folder-row .mt-folder-row__name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtt-page .mt-folder-row .mt-folder-name-link {
  color: var(--brand-ink);
  font-weight: 600;
}

.mtt-page .mt-folder-row .mt-folder-actions-btn { margin-left: auto; }
.mtt-page .mt-folder-row:hover .mt-folder-actions-btn,
.mtt-page .mt-folder-row:focus-within .mt-folder-actions-btn,
.mtt-page .mt-folder-row.is-menu-open .mt-folder-actions-btn,
.mtt-page .mt-folder-row .mt-folder-actions-btn[aria-expanded="true"] { opacity: 1; }
@media (hover: none) {
  .mtt-page .mt-folder-row .mt-folder-actions-btn { opacity: 1; }
}

/* Compact pagination separators */
.mtt-page .mt-pager__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 32px;
  color: var(--text-subtle);
  user-select: none;
}
.mtt-page .mt-pager__btn svg {
  flex: 0 0 auto;
}


/* ==========================================================================
   MESSAGE TEMPLATES — NARROW CONTENT AREA FIX
   The CRM sidebar reduces the table's available width even on iPad/tablet
   viewports. Hide date columns before the viewport reaches the old 860px
   breakpoint so the name column retains usable space.
   ========================================================================== */
@media (max-width: 1100px) {

  .mtt-page .mt-overlay{align-items: start!important}
  .mtt-page .mt-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .mtt-page .mt-table th.mt-col-date,
  .mtt-page .mt-table td.mt-cell-date,
  .mtt-page .mt-table .mt-col-date {
    display: none !important;
  }

  .mtt-page .mt-table .mt-col-check {
    width: 48px;
  }

  .mtt-page .mt-table .mt-col-owner {
    width: 130px;
  }

  .mtt-page .mt-table .mt-col-name {
    width: auto;
    min-width: 0;
  }

  .mtt-page .mt-table .mt-cell-name {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    gap: 10px;
  }

  .mtt-page .mt-table .mt-name-link {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
  }

  .mtt-page .mt-table .mt-actions-btn {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .mtt-page .mt-table .mt-col-owner,
  .mtt-page .mt-table td.mt-cell-owner,
  .mtt-page .mt-table th.mt-col-owner {
    display: none !important;
  }

  .mtt-page .mt-table .mt-col-name {
    width: auto;
  }

  .mtt-page .mt-table .mt-cell-name {
    gap: 8px;
  }
}


/* TABLET WIDTH ALLOCATION CORRECTION
   Use content-aware table sizing when the CRM sidebar leaves a narrow
   content area. The checkbox column stays fixed; the name column receives
   the remaining width instead of being squeezed by the owner column. */
@media (max-width: 1100px) {
  .mtt-page .mt-table-wrap {
    width: 100%;
    min-width: 0;
  }

  .mtt-page .mt-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  .mtt-page .mt-table th.mt-col-check,
  .mtt-page .mt-table td.mt-col-check {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
  }

  .mtt-page .mt-table th.mt-col-name,
  .mtt-page .mt-table td.mt-col-name {
    width: auto !important;
    min-width: 180px !important;
  }

  .mtt-page .mt-table th.mt-col-owner,
  .mtt-page .mt-table td.mt-cell-owner {
    width: 140px !important;
    min-width: 120px !important;
  }

  .mtt-page .mt-table td.mt-col-name .mt-cell-name {
    width: 100%;
    min-width: 0;
  }

  .mtt-page .mt-table td.mt-col-name .mt-name-link {
    flex: 1 1 0%;
    width: 1%;
    min-width: 0;
    width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
  }
}

@media (max-width: 640px) {
  .mtt-page .mt-panel__body, .mtt-page .mt-radio-row{display: block;}
  .mtt-page .mt-listbox{width: 100%!important}
  .mtt-page .mt-select{font-size: 12px;}
  .mtt-page .mt-radio{font-size: 14px;}
  .mtt-page .mt-bulk{gap:3px;}
  .mtt-page .mt-toolbar{padding: 15px 0px 0px 0px;}
  .mtt-page .mt-table th.mt-col-name,
  .mtt-page .mt-table td.mt-col-name {
    min-width: 0 !important;
  }
}


/* Reference table + pagination treatment */
.mtt-page .mt-table-wrap {
  border: 1px solid var(--border, #dfe3ea);
  border-radius: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 490px;
  background: var(--surface, #fff);
}
.mtt-page .mt-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.mtt-page .mt-table thead th {
  height: 46px;
  padding: 0 14px;
  background: #f8f9fb;
  color: var(--text, #182230);
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 1px solid #d5dbe4;
  white-space: nowrap;
}
.mtt-page .mt-table tbody tr {
  height: 48px;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e1e5eb);
}
.mtt-page .mt-table tbody tr:last-child {
  border-bottom: 0;
}
.mtt-page .mt-table tbody td {
  height: 48px;
  padding: 8px 14px;
  color: var(--text, #182230);
  font-size: 14px;
  border-bottom: 1px solid var(--border, #e1e5eb);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mtt-page .mt-table thead th.mt-col-check,
.mtt-page .mt-table tbody td.mt-col-check {
  padding-left: 14px !important;
  padding-right: 8px;
}
.mtt-page .mt-table tbody tr:hover,
.mtt-page .mt-table tbody tr.is-menu-open,
.mtt-page .mt-table tbody tr.is-selected {
  background: #f1f3f6;
}
.mtt-page .mt-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 10px 14px;
  border: 0;
  font-size: 13px;
}
.mtt-page .mt-pager__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  gap: 4px;
  color: #8995a8;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
}
.mtt-page .mt-pager__btn.is-current {
  min-width: 32px;
  color: #172033;
  background: #fff;
  border: 1px solid #53647c;
  border-radius: 8px;
}
.mtt-page .mt-pager__btn[disabled] {
  color: #9aa5b5;
  opacity: 1;
}
@media (max-width: 575.98px) {
  .mtt-page .mt-pager {
    justify-content: center;
    gap: 5px;
    padding-left: 4px;
    padding-right: 4px;
  }
}


/* ==========================================================================
   MESSAGE TEMPLATES — DARK MODE COLOR OVERRIDES ONLY
   Appended overrides: existing layout, sizing, spacing and behavior unchanged.
   ========================================================================== */
[data-theme="dark"] .mtt-page,
.mtt-page[data-theme="dark"] {
  color: var(--text);
}

/* Table header */
[data-theme="dark"] .mtt-page .mt-table thead th,
.mtt-page[data-theme="dark"] .mt-table thead th {
  background: #1b2433;
  color: #e5eaf2;
  border-bottom-color: #303b4d;
}

[data-theme="dark"] .mtt-page .mt-table thead th.mt-col-name,
[data-theme="dark"] .mtt-page .mt-table tbody td.mt-col-name,
.mtt-page[data-theme="dark"] .mt-table thead th.mt-col-name,
.mtt-page[data-theme="dark"] .mt-table tbody td.mt-col-name {
  border-right-color: #303b4d;
}

/* Table rows and readable cell text */
[data-theme="dark"] .mtt-page .mt-table tbody tr,
.mtt-page[data-theme="dark"] .mt-table tbody tr {
  background: #111827;
}

[data-theme="dark"] .mtt-page .mt-table tbody td,
.mtt-page[data-theme="dark"] .mt-table tbody td {
  color: #e5eaf2;
  border-bottom-color: #283448;
}

[data-theme="dark"] .mtt-page .mt-table tbody tr:hover,
[data-theme="dark"] .mtt-page .mt-table tbody tr.is-menu-open,
[data-theme="dark"] .mtt-page .mt-table tbody tr.is-selected,
.mtt-page[data-theme="dark"] .mt-table tbody tr:hover,
.mtt-page[data-theme="dark"] .mt-table tbody tr.is-menu-open,
.mtt-page[data-theme="dark"] .mt-table tbody tr.is-selected {
  background: #202b3d;
}

/* Keep template names and folder names on the existing brand color */
[data-theme="dark"] .mtt-page .mt-name-link,
[data-theme="dark"] .mtt-page .mt-folder-name-link,
.mtt-page[data-theme="dark"] .mt-name-link,
.mtt-page[data-theme="dark"] .mt-folder-name-link {
  color: var(--brand-ink);
}

/* Pagination */
[data-theme="dark"] .mtt-page .mt-pager__btn,
.mtt-page[data-theme="dark"] .mt-pager__btn {
  color: #aab6c8;
}

[data-theme="dark"] .mtt-page .mt-pager__btn.is-current,
.mtt-page[data-theme="dark"] .mt-pager__btn.is-current {
  color: #172033;
  background: #f4f6fa;
  border-color: #718096;
}

[data-theme="dark"] .mtt-page .mt-pager__btn[disabled],
.mtt-page[data-theme="dark"] .mt-pager__btn[disabled] {
  color: #77849a;
}

[data-theme="dark"] .mtt-page .mt-pager__info,
.mtt-page[data-theme="dark"] .mt-pager__info {
  color: #9aa8bc;
}

/* Table empty state and sort indicators */
[data-theme="dark"] .mtt-page .mt-cell-empty,
[data-theme="dark"] .mtt-page .mt-sort .icon,
.mtt-page[data-theme="dark"] .mt-cell-empty,
.mtt-page[data-theme="dark"] .mt-sort .icon {
  color: #aab6c8;
}

[data-theme="dark"] .mtt-page .mt-sort:hover,
[data-theme="dark"] .mtt-page .mt-sort.is-active,
[data-theme="dark"] .mtt-page .mt-sort.is-active .icon,
.mtt-page[data-theme="dark"] .mt-sort:hover,
.mtt-page[data-theme="dark"] .mt-sort.is-active,
.mtt-page[data-theme="dark"] .mt-sort.is-active .icon {
  color: #f1f5f9;
}


/* ==========================================================================
   MESSAGE TEMPLATES — RESPONSIVE TABLE: SCROLL, DON'T HIDE COLUMNS
   Keeps every column (Name, Owner, Date created, Date modified) at all
   widths. When the content area is narrower than the table, the table
   wrapper scrolls horizontally; the toolbar and pager stay in place.
   Must stay last so it overrides the earlier column-hiding breakpoints.
   ========================================================================== */
.mtt-page .mt-main,
.mtt-page .mt-container {
  min-width: 0;
  max-width: 100%;
}

.mtt-page .mt-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.mtt-page .mt-table {
  width: 100% !important;
  min-width: 760px !important;
  table-layout: fixed !important;
}

/* bring back the columns the older breakpoints hide */
.mtt-page .mt-table th.mt-col-date,
.mtt-page .mt-table td.mt-cell-date,
.mtt-page .mt-table .mt-col-date,
.mtt-page .mt-table th.mt-col-owner,
.mtt-page .mt-table td.mt-cell-owner,
.mtt-page .mt-table .mt-col-owner {
  display: table-cell !important;
}

.mtt-page .mt-table th.mt-col-check,
.mtt-page .mt-table td.mt-col-check {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
}

.mtt-page .mt-table th.mt-col-name,
.mtt-page .mt-table td.mt-col-name {
  width: auto !important;
  min-width: 240px !important;
}

.mtt-page .mt-table th.mt-col-owner,
.mtt-page .mt-table td.mt-cell-owner {
  width: 168px !important;
  min-width: 168px !important;
}

.mtt-page .mt-table th.mt-col-date,
.mtt-page .mt-table td.mt-cell-date {
  width: 152px !important;
  min-width: 152px !important;
}

/* cells stay on one line; long names ellipsize instead of wrapping */
.mtt-page .mt-table td,
.mtt-page .mt-table th {
  white-space: nowrap;
}

.mtt-page .mt-table td.mt-col-name .mt-cell-name {
  width: 100%;
  min-width: 0;
}

/* bulk-action bar scrolls with the table instead of wrapping and squeezing */
.mtt-page .mt-bulk {
  flex-wrap: nowrap;
  white-space: nowrap;
}

@media (max-width: 640px) {
    .mtt-page .mt-ed__head {flex-direction: column;align-items: flex-start;gap: var(--sp-2);}
  .mtt-page .mt-table {
    min-width: 720px !important;
  }
}

/* HUB-721 additions (not in the design file): controls with nothing behind them yet
   ("Coming soon") read as disabled. */
.mtt-page .mt-bulk__btn:disabled,
.mtt-page .mt-fmt__txt:disabled,
.mtt-page .mt-suggest:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mtt-page .mt-bulk__btn:disabled:hover,
.mtt-page .mt-suggest:disabled:hover {
  background: transparent;
}
/* The v2 table keeps every column and scrolls: in its narrow name column the folder tag would
   squeeze the template name to nothing, so below 860px only the name shows (the design already
   drops the tag on phones). */
.mtt-page .mt-table td.mt-col-name .mt-cell-name .mt-name-link {
  min-width: 96px;
}
@media (max-width: 860px) {
  .mtt-page .mt-table td.mt-col-name .mt-cell-name .mt-folder-tag {
    display: none;
  }
}

/* HUB-721: a long name ends in "…" on narrow screens, as the design (the name is a button here). */
.mtt-page .mt-table td.mt-col-name .mt-cell-name > .mt-name-link {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
