/* ==========================================================================
   Minduim theme (HB'MAIL) — Phase 2: global tokens
   Loads after Bootstrap + core CSS (module last in CYPHT_MODULES).
   Visual reference: shadcn/ui (zinc palette).
   ========================================================================== */

:root,
[data-bs-theme=light] {
  /* ---- Minduim tokens ---- */
  --mt-font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mt-bg: #F4F4F5;
  --mt-sidebar: #FAFAFA;
  --mt-surface: #FFFFFF;
  --mt-border: #E4E4E7;
  --mt-divider: #F4F4F5;
  --mt-text: #18181B;
  --mt-text-2: #3F3F46;
  --mt-text-3: #52525B;
  --mt-muted: #71717A;
  --mt-primary: #18181B;
  --mt-primary-hover: #27272A;
  --mt-accent: #2563EB;
  --mt-accent-hover: #1D4ED8;
  --mt-accent-soft: #DBEAFE;
  --mt-hover: #F4F4F5;
  --mt-radius-sm: 8px;
  --mt-radius: 10px;
  --mt-radius-lg: 12px;
  --mt-radius-pill: 999px;
  --mt-shadow-active: 0 1px 2px rgba(24, 24, 27, .08);
  --mt-ring: 0 0 0 3px rgba(161, 161, 170, .35);

  /* ---- Bootstrap 5.3 overrides ---- */
  --bs-font-sans-serif: var(--mt-font);
  --bs-body-font-family: var(--mt-font);
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.5;

  --bs-body-color: #18181B;
  --bs-body-color-rgb: 24, 24, 27;
  --bs-body-bg: #FFFFFF;
  --bs-body-bg-rgb: 255, 255, 255;
  --bs-emphasis-color: #09090B;
  --bs-emphasis-color-rgb: 9, 9, 11;
  --bs-secondary-color: #52525B;
  --bs-secondary-color-rgb: 82, 82, 91;
  --bs-secondary-bg: #F4F4F5;
  --bs-secondary-bg-rgb: 244, 244, 245;
  --bs-tertiary-color: #71717A;
  --bs-tertiary-color-rgb: 113, 113, 122;
  --bs-tertiary-bg: #FAFAFA;
  --bs-tertiary-bg-rgb: 250, 250, 250;
  --bs-heading-color: #18181B;

  --bs-primary: #18181B;
  --bs-primary-rgb: 24, 24, 27;
  --bs-primary-text-emphasis: #18181B;
  --bs-primary-bg-subtle: #F4F4F5;
  --bs-primary-border-subtle: #E4E4E7;
  --bs-secondary: #71717A;
  --bs-secondary-rgb: 113, 113, 122;
  --bs-info: #2563EB;
  --bs-info-rgb: 37, 99, 235;

  --bs-link-color: #2563EB;
  --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: #1D4ED8;
  --bs-link-hover-color-rgb: 29, 78, 216;

  --bs-border-color: #E4E4E7;
  --bs-border-color-translucent: rgba(24, 24, 27, .1);
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 12px;
  --bs-border-radius-xl: 12px;
  --bs-border-radius-xxl: 16px;
  --bs-border-radius-pill: 999px;

  --bs-box-shadow-sm: 0 1px 2px rgba(24, 24, 27, .06);
  --bs-box-shadow: 0 4px 12px rgba(24, 24, 27, .08);
  --bs-box-shadow-lg: 0 12px 32px rgba(24, 24, 27, .12);
  --bs-box-shadow-inset: inset 0 1px 2px rgba(24, 24, 27, .06);

  --bs-focus-ring-color: rgba(161, 161, 170, .35);
  --bs-form-valid-color: #15803D;
  --bs-form-invalid-color: #DC2626;
  --bs-form-invalid-border-color: #DC2626;

  /* core uses this for selected text highlight */
  --bs-highlight-bg: #FEF9C3;
}

/* ---- Base ---- */
html,
body {
  font-family: var(--mt-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-size: var(--bs-body-font-size);
  color: var(--mt-text);
}
::selection {
  background: #E4E4E7;
  color: var(--mt-text);
}
* {
  scrollbar-width: thin;
  scrollbar-color: #D4D4D8 transparent;
}
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.01em;
  font-weight: 600;
}

/* ---- Raw form elements (core gives them #ddd / 3px) ---- */
textarea,
select,
input,
button {
  border-color: var(--mt-border);
  border-radius: var(--mt-radius-sm);
  color: var(--mt-text);
}

/* ---- Bootstrap form controls ---- */
.form-control,
.form-select {
  border-radius: var(--mt-radius);
  border-color: var(--mt-border);
  color: var(--mt-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder {
  color: var(--mt-muted);
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #A1A1AA;
  box-shadow: var(--mt-ring);
  outline: 0;
}
/* unchecked boxes visible on white (approved: zinc-500) */
.form-check-input {
  border: 1.5px solid #71717A;
}
.form-check-input:focus {
  border-color: #52525B;
}
.form-check-input:checked {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
}
.form-floating > label {
  color: var(--mt-muted);
}

/* ---- Buttons ---- */
.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-focus-box-shadow: var(--mt-ring);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary {
  --bs-btn-color: #FAFAFA;
  --bs-btn-bg: #18181B;
  --bs-btn-border-color: #18181B;
  --bs-btn-hover-color: #FAFAFA;
  --bs-btn-hover-bg: #27272A;
  --bs-btn-hover-border-color: #27272A;
  --bs-btn-focus-shadow-rgb: 161, 161, 170;
  --bs-btn-active-color: #FAFAFA;
  --bs-btn-active-bg: #3F3F46;
  --bs-btn-active-border-color: #3F3F46;
  --bs-btn-disabled-color: #FAFAFA;
  --bs-btn-disabled-bg: #18181B;
  --bs-btn-disabled-border-color: #18181B;
}
.btn-secondary {
  --bs-btn-color: #18181B;
  --bs-btn-bg: #F4F4F5;
  --bs-btn-border-color: #F4F4F5;
  --bs-btn-hover-color: #18181B;
  --bs-btn-hover-bg: #E4E4E7;
  --bs-btn-hover-border-color: #E4E4E7;
  --bs-btn-active-color: #18181B;
  --bs-btn-active-bg: #D4D4D8;
  --bs-btn-active-border-color: #D4D4D8;
  --bs-btn-disabled-color: #71717A;
  --bs-btn-disabled-bg: #F4F4F5;
  --bs-btn-disabled-border-color: #F4F4F5;
}
.btn-light,
.btn-outline-secondary,
.btn-outline-primary {
  --bs-btn-color: #18181B;
  --bs-btn-bg: #FFFFFF;
  --bs-btn-border-color: #E4E4E7;
  --bs-btn-hover-color: #18181B;
  --bs-btn-hover-bg: #F4F4F5;
  --bs-btn-hover-border-color: #E4E4E7;
  --bs-btn-active-color: #18181B;
  --bs-btn-active-bg: #E4E4E7;
  --bs-btn-active-border-color: #E4E4E7;
  --bs-btn-disabled-color: #A1A1AA;
  --bs-btn-disabled-bg: #FFFFFF;
  --bs-btn-disabled-border-color: #E4E4E7;
}
.btn-danger,
.btn-outline-danger {
  --bs-btn-focus-shadow-rgb: 220, 38, 38;
}
.text-bg-primary {
  color: #FAFAFA !important;
  background-color: #18181B !important;
}

/* core "theming changes" paint these blue with !important — make them neutral */
.allow_image_link .btn-light, .definitive_actions .btn-light,
.content_title .msg_controls .btn-light,
.content_title .msg_controls .btn-secondary,
.msg_actions .btn-outline-secondary {
  color: var(--mt-text) !important;
  border-color: var(--mt-border) !important;
  background: var(--mt-surface);
}
.allow_image_link .btn-light:hover, .definitive_actions .btn-light:hover,
.content_title .msg_controls .btn-light:hover,
.content_title .msg_controls .btn-secondary:hover,
.msg_actions .btn-outline-secondary:hover {
  color: var(--mt-text) !important;
  background: var(--mt-hover);
}

/* ---- Counters / badges ---- */
.badge {
  font-weight: 600;
}
.total_unread_count, .total_unread_count.badge, .unread_count {
  color: #FAFAFA !important;
  background-color: #18181B !important;
  border-radius: var(--mt-radius-pill) !important;
  font-weight: 600;
}

/* ---- Cards, dropdowns, modals, alerts ---- */
.card {
  --bs-card-border-color: var(--mt-border);
  --bs-card-border-radius: var(--mt-radius-lg);
  --bs-card-inner-border-radius: calc(var(--mt-radius-lg) - 1px);
  --bs-card-cap-bg: var(--mt-sidebar);
}
.dropdown-menu {
  --bs-dropdown-border-color: var(--mt-border);
  --bs-dropdown-border-radius: var(--mt-radius);
  --bs-dropdown-box-shadow: var(--bs-box-shadow);
  --bs-dropdown-link-hover-bg: var(--mt-hover);
  --bs-dropdown-link-active-bg: #18181B;
  --bs-dropdown-font-size: 0.875rem;
  padding: 4px;
  box-shadow: var(--bs-box-shadow);
}
.dropdown-item {
  border-radius: 6px;
}
.modal {
  --bs-modal-border-color: var(--mt-border);
  --bs-modal-border-radius: var(--mt-radius-lg);
  --bs-modal-header-border-color: var(--mt-divider);
  --bs-modal-footer-border-color: var(--mt-divider);
}
.alert {
  --bs-alert-border-radius: var(--mt-radius);
}
.sys_messages .alert {
  box-shadow: var(--bs-box-shadow) !important;
}
.popover {
  --bs-popover-border-color: var(--mt-border);
  --bs-popover-header-bg: var(--mt-sidebar);
  --bs-popover-header-color: var(--mt-text);
  --bs-popover-border-radius: var(--mt-radius);
}

/* ---- Layout surfaces ---- */
nav.folder_cell .folder_list {
  background-color: var(--mt-sidebar) !important;
  border-right: 1px solid var(--mt-border);
}
.content_title {
  border-top-color: var(--mt-divider);
  border-bottom-color: var(--mt-divider);
  letter-spacing: -0.01em;
  font-weight: 600;
}
.src_name {
  letter-spacing: normal;
}

/* ---- Message list basics ---- */
.message_table > tbody > tr > td {
  border-bottom-color: var(--mt-divider);
}
div.unseen,
.unseen .subject {
  font-weight: 600;
}
.subject, .msg_date, .from, .source {
  color: var(--mt-text);
}
.subject div,
.s_pre,
.title,
.date {
  color: var(--mt-muted);
}

/* custom checkbox of the list (core uses teal) */
.checkbox_cell label {
  border-width: 1px;
  border-color: #D4D4D8;
  border-radius: 5px;
}
.checkbox_cell label:hover {
  border-color: #A1A1AA;
  background-color: var(--mt-surface);
}
.checkbox_cell input[type="checkbox"]:checked + label {
  background-color: #18181B;
  border-color: #18181B;
}
.checkbox_cell input[type="checkbox"]:checked + label::after {
  color: #FAFAFA;
}

/* ---- Misc core colors ---- */
.server_subtitle {
  color: var(--mt-muted);
}
.subtitle,
.settings_subtitle {
  color: var(--mt-text) !important;
  font-weight: 600;
}
.hr {
  border-top-color: var(--mt-border);
}
[data-title]:after {
  background-color: #18181B;
  color: #FAFAFA;
  border-radius: 6px;
  box-shadow: var(--bs-box-shadow-sm);
  padding: 4px 8px;
}

/* ==========================================================================
   Phase 3.1 — Header (60px): brand · search · user menu
   Only rendered by minduim_header (desktop, theme minduim).
   ========================================================================== */
:root {
  --mt-header-h: 60px;
}
.cypht-layout:has(> .mt-header) {
  grid-template-areas: "head head" "nav main";
  grid-template-rows: var(--mt-header-h) 1fr;
  min-height: 100vh;
}
.cypht-layout:has(> .mt-header) .folder_list {
  top: var(--mt-header-h);
  min-height: 0;
  height: calc(100vh - var(--mt-header-h));
}
.cypht-layout:has(> .mt-header) .content_cell {
  min-height: calc(100vh - var(--mt-header-h));
}
/* logo and search now live in the header */
.cypht-layout:has(> .mt-header) .folder_list a.menu_home,
.cypht-layout:has(> .mt-header) .folder_list .menu_search {
  display: none !important;
}

.mt-header {
  grid-area: head;
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--mt-header-h);
  padding-right: 20px;
  background: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
}

/* brand — same width as the sidebar column */
.mt-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--nav-size) - 40px);
  padding-left: 20px;
  color: var(--mt-text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}
.mt-brand:hover,
.mt-brand:focus {
  color: var(--mt-text);
  text-decoration: none;
}
/* HB'MAIL logo: mark 30px + wordmark (SVG height = cap height, like a 17px font) */
.mt-brand-mark {
  flex: none;
  display: block;
  width: 30px;
  height: 30px;
}
.mt-brand-word {
  flex: none;
  display: block;
  height: 12.5px;
  width: auto;
  aspect-ratio: 529.4 / 75;
  color: #1C1917;
}

/* search */
.mt-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 585px;
  margin: 0;
}
.mt-search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--mt-muted);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}
input.mt-search-input {
  width: 100%;
  height: 38px;
  padding: 0 70px 0 38px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-sidebar);
  color: var(--mt-text);
  font-size: 14px;
  outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input.mt-search-input::placeholder {
  color: var(--mt-muted);
}
input.mt-search-input:hover {
  border-color: #D4D4D8;
}
input.mt-search-input:focus {
  background: var(--mt-surface);
  border-color: #A1A1AA;
  box-shadow: var(--mt-ring);
}
input.mt-search-input:not(:placeholder-shown) {
  padding-right: 12px;
}
.mt-kbd {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--mt-border);
  border-radius: 6px;
  background: var(--mt-surface);
  box-shadow: none;
  color: var(--mt-text-3);
  font-family: var(--mt-font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
  transition: opacity .15s ease;
}
.mt-search-input:focus ~ .mt-kbd,
.mt-search-input:not(:placeholder-shown) ~ .mt-kbd {
  opacity: 0;
}

/* right side actions */
.mt-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.mt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-surface);
  color: var(--mt-text);
  font-size: 17px;
  transition: background-color .15s ease;
}
.mt-icon-btn:hover,
.mt-icon-btn.active {
  background: var(--mt-hover);
  color: var(--mt-text);
  text-decoration: none;
}
.mt-icon-btn:focus-visible,
.mt-avatar:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mt-hover);
  color: var(--mt-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background-color .15s ease;
}
button.mt-avatar:hover,
button.mt-avatar[aria-expanded="true"] {
  background: var(--mt-border);
}
.mt-avatar-sm {
  flex: none;
  width: 34px;
  height: 34px;
  font-size: 12px;
  cursor: default;
}

/* user menu */
.mt-user-menu {
  min-width: 230px;
  margin-top: 6px !important;
}
.mt-user-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.mt-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.mt-user-name {
  overflow: hidden;
  color: var(--mt-text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-user-sub {
  color: var(--mt-muted);
  font-size: 12px;
}
.mt-user-menu .dropdown-divider {
  margin: 4px 0;
  border-color: var(--mt-divider);
  opacity: 1;
}
.mt-user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--mt-text);
}
.mt-user-menu .dropdown-item:hover,
.mt-user-menu .dropdown-item:focus {
  background: var(--mt-hover);
  color: var(--mt-text);
  text-decoration: none;
}
.mt-user-menu .dropdown-item i {
  color: var(--mt-text-3);
  font-size: 15px;
}

/* "unsaved changes" reminder (core, links to ?page=save): header icon button with
   an accent dot, next to the user menu */
body:has(.mt-header) a.unsaved_icon {
  position: fixed;
  top: 11px;
  right: 70px;
  z-index: 1031;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-surface);
  color: var(--mt-text);
  transition: background-color .15s ease;
}
body:has(.mt-header) a.unsaved_icon:hover {
  background: var(--mt-hover);
  text-decoration: none;
}
body:has(.mt-header) a.unsaved_icon:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
body:has(.mt-header) a.unsaved_icon::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mt-primary);
  box-shadow: 0 0 0 2px var(--mt-surface);
}
body:has(.mt-header) .unsaved_icon .unsaved_reminder {
  position: static;
  color: inherit;
  font-size: 16px !important;
  line-height: 1;
}

/* ==========================================================================
   Phase 3.2 — Icon rail (modules) + sidebar (compose · views · accounts)
   Rail: minduim_rail (desktop only). Sidebar markup: minduim_* outputs of
   ajax_hm_folders. Layout rules are scoped to the rail; looks are not.
   ========================================================================== */
.cypht-layout:has(> .mt-rail) {
  --mt-rail-w: 64px;
  --mt-side-open: 260px;
  --mt-side-w: var(--mt-side-open);
  grid-template-areas: "head head head" "rail nav main";
  grid-template-columns: var(--mt-rail-w) var(--mt-side-w) minmax(0, 1fr);
}
/* sidebar hidden: toggled by the user, or modules with their own full-width page */
.cypht-layout:has(> .mt-rail):has(> nav.collapsed),
.cypht-layout:has(> .mt-rail[data-section="calendar"]),
.cypht-layout:has(> .mt-rail[data-section="contacts"]),
.cypht-layout:has(> .mt-rail[data-section="history"]) {
  --mt-side-w: 0px;
}
.cypht-layout:has(> .mt-rail):has(> nav.collapsed) > .folder_cell,
.cypht-layout:has(> .mt-rail[data-section="calendar"]) > .folder_cell,
.cypht-layout:has(> .mt-rail[data-section="contacts"]) > .folder_cell,
.cypht-layout:has(> .mt-rail[data-section="history"]) > .folder_cell {
  display: none;
}
.cypht-layout:has(> .mt-rail) .folder_list {
  position: sticky;
  top: var(--mt-header-h);
  width: auto;
  height: calc(100vh - var(--mt-header-h));
  min-height: 0;
  padding: 14px 12px 24px;
  overflow-x: hidden;
  overflow-y: auto;
}
/* brand spans rail + sidebar, mark centred over the rail icons; fixed width so
   the search box does not move when the sidebar is hidden */
.cypht-layout:has(> .mt-rail) .mt-brand {
  width: calc(var(--mt-rail-w) + var(--mt-side-open));
  padding-left: calc((var(--mt-rail-w) - 30px) / 2);
}

/* ---- Rail ---- */
.mt-rail {
  grid-area: rail;
  position: sticky;
  top: var(--mt-header-h);
  z-index: 1020;
  align-self: start;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100vh - var(--mt-header-h));
  padding: 12px 0;
  background: var(--mt-surface);
  border-right: 1px solid var(--mt-border);
}
.mt-rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.mt-rail-item,
.mt-rail .menu-toggle {
  position: relative;
  top: auto;
  right: auto;
  z-index: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--mt-radius);
  background: transparent;
  color: var(--mt-text-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.mt-rail-item i.bi,
.mt-rail .menu-toggle i.bi {
  color: inherit;
  font-size: inherit;
}
.mt-rail-item:hover,
.mt-rail-item:focus {
  background: var(--mt-hover);
  color: var(--mt-text);
  text-decoration: none;
}
.mt-rail-item:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-rail-item.active {
  background: var(--mt-hover);
  color: var(--mt-text);
}
.mt-rail-item.active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mt-text);
}
/* tooltip */
.mt-rail-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  z-index: 1040;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--mt-primary);
  color: #FAFAFA;
  font-family: var(--mt-font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition: opacity .12s ease, transform .12s ease;
}
.mt-rail-item[data-tip]:hover::after,
.mt-rail-item[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}
.mt-rail[data-section="calendar"] .menu-toggle,
.mt-rail[data-section="contacts"] .menu-toggle,
.mt-rail[data-section="history"] .menu-toggle {
  display: none;
}

/* ---- Sidebar: sections shown per rail item ---- */
.cypht-layout:has(> .mt-rail[data-section="email"]) .folder_list > [data-bs-target=".settings"],
.cypht-layout:has(> .mt-rail[data-section="email"]) .folder_list > .settings,
.cypht-layout:has(> .mt-rail[data-section="email"]) .folder_list > [data-bs-target=".feeds_folders"],
.cypht-layout:has(> .mt-rail[data-section="email"]) .folder_list > .feeds_folders {
  display: none !important;
}
.cypht-layout:has(> .mt-rail[data-section="settings"]) .folder_list > :not([data-bs-target=".settings"]):not(.settings),
.cypht-layout:has(> .mt-rail[data-section="feeds"]) .folder_list > :not([data-bs-target=".feeds_folders"]):not(.feeds_folders) {
  display: none !important;
}
.cypht-layout:has(> .mt-rail[data-section="settings"]) .folder_list > .settings,
.cypht-layout:has(> .mt-rail[data-section="feeds"]) .folder_list > .feeds_folders {
  display: block !important;
  height: auto !important;
}
/* the block header becomes the sidebar title */
.cypht-layout:has(> .mt-rail[data-section="settings"]) .folder_list > [data-bs-target=".settings"],
.cypht-layout:has(> .mt-rail[data-section="feeds"]) .folder_list > [data-bs-target=".feeds_folders"] {
  margin: 2px 0 10px;
  padding: 4px 10px !important;
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  pointer-events: none;
}
.cypht-layout:has(> .mt-rail[data-section="settings"]) .folder_list > [data-bs-target=".settings"] > i,
.cypht-layout:has(> .mt-rail[data-section="feeds"]) .folder_list > [data-bs-target=".feeds_folders"] > i {
  display: none;
}

/* ---- Sidebar: compose ---- */
.mt-side-top {
  padding: 0 0 12px;
}
.mt-compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  border-radius: var(--mt-radius-sm);
  background: var(--mt-primary);
  color: #FAFAFA;
  font-size: 14px;
  font-weight: 600;
  transition: background-color .15s ease;
}
.mt-compose-btn:hover,
.mt-compose-btn:focus {
  background: var(--mt-primary-hover);
  color: #FAFAFA;
  text-decoration: none;
}
.mt-compose-btn:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}

/* ---- Sidebar: lists (views, settings, feeds, tags) ---- */
.folder_list .folders {
  margin: 0 !important;
  padding: 0;
}
.folder_list .folders > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 1px 0;
  padding: 0;
  border-radius: var(--mt-radius-sm);
  white-space: nowrap;
}
.folder_list .folders > li > a {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--mt-radius-sm);
  color: var(--mt-text-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.folder_list .folders > li > a:hover {
  background: var(--mt-hover);
  color: var(--mt-text);
}
.folder_list .folders > li > a .menu-icon,
.folder_list .folders > li > a > i.bi:first-child {
  flex: none;
  width: 18px;
  margin: 0;
  color: var(--mt-text-3);
  font-size: 16px;
  text-align: center;
}
.folder_list .nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* links of other modules now live in the rail */
.mt-main .folders > li:not(.mt-nav):not(.menu_recover_settings) {
  display: none !important;
}
/* active item: white card on the grey sidebar */
.folder_list li.selected_menu {
  background: transparent;
}
.folder_list .folders > li.selected_menu > a,
.folder_list .inner_list li.selected_menu {
  background: var(--mt-surface);
  box-shadow: var(--mt-shadow-active), inset 0 0 0 1px var(--mt-border);
}
.folder_list .folders li.selected_menu a,
.folder_list .folders li.selected_menu a:hover,
.folder_list .folders li.selected_menu a i.bi {
  color: var(--mt-text) !important;
}
/* "Todas as caixas" counter: dark pill */
.folder_list .total_unread_count,
.folder_list .mt-count {
  flex: none;
  min-width: 22px;
  margin-left: auto;
  padding: 1px 5px !important;
  border-radius: var(--mt-radius-pill) !important;
  background: var(--mt-primary) !important;
  color: #FAFAFA !important;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  vertical-align: baseline;
}
.folder_list .total_unread_count:empty {
  display: none;
}
/* section headers: "Contas", other sources (Feeds, Etiquetas) */
.mt-side-title,
.folder_list .src_name {
  margin: 18px 0 6px;
  padding: 4px 10px !important;
  border: 0;
  color: var(--mt-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.4;
  text-transform: uppercase;
}
.folder_list .src_name {
  align-items: center;
  border-radius: var(--mt-radius-sm);
}
.folder_list .src_name:hover {
  color: var(--mt-text);
}
.folder_list .src_name > i {
  font-size: 11px;
}

/* ---- Sidebar: accounts ---- */
.mt-c0 { --mt-acc: #2563EB; --mt-acc-tag: #1D4ED8; --mt-acc-tag-bg: #DBEAFE; }
.mt-c1 { --mt-acc: #18181B; --mt-acc-tag: #27272A; --mt-acc-tag-bg: #F4F4F5; }
.mt-c2 { --mt-acc: #0F766E; --mt-acc-tag: #0F766E; --mt-acc-tag-bg: #CCFBF1; }
.mt-c3 { --mt-acc: #C2410C; --mt-acc-tag: #C2410C; --mt-acc-tag-bg: #FFEDD5; }
.mt-c4 { --mt-acc: #7C3AED; --mt-acc-tag: #6D28D9; --mt-acc-tag-bg: #EDE9FE; }
.mt-c5 { --mt-acc: #BE185D; --mt-acc-tag: #BE185D; --mt-acc-tag-bg: #FCE7F3; }

.mt-account-link,
.folder_list .folders > li > a.mt-account-link,
.email_folders .imap_folder_link.mt-account-link,
.mt-add-account {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 10px;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  overflow: visible;
  border-radius: var(--mt-radius-sm);
  color: var(--mt-text);
  text-decoration: none;
  vertical-align: baseline;
  white-space: nowrap;
}
.mt-account-link:hover,
.mt-add-account:hover {
  background: var(--mt-hover);
  color: var(--mt-text);
  text-decoration: none;
}
.mt-account-link.disabled_link {
  opacity: .6;
  cursor: progress;
}
.mt-acc-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--mt-acc, var(--mt-primary));
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1;
}
.mt-acc-avatar[data-initials]::before {
  content: attr(data-initials);
}
.mt-acc-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.mt-acc-name,
.mt-acc-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-acc-name {
  color: var(--mt-text);
  font-size: 13px;
  font-weight: 600;
}
.mt-acc-email {
  color: var(--mt-muted);
  font-size: 12px;
}
.mt-account-link .unread_count {
  flex: none;
  margin-left: auto;
  padding: 0 !important;
  background: transparent !important;
  color: var(--mt-text-3) !important;
  font-size: 12px;
  font-weight: 600;
}
.mt-add-account {
  color: var(--mt-text-3);
}
.mt-add-account .mt-acc-name {
  color: inherit;
  font-weight: 500;
}
.mt-acc-add {
  background: transparent;
  border: 1px dashed #A1A1AA;
  color: var(--mt-text-3);
  font-size: 16px;
}

/* folders of an expanded account */
.folder_list .inner_list {
  flex: 0 0 calc(100% - 22px);
  box-sizing: border-box;
  max-width: calc(100% - 22px);
  min-width: 0;
  margin: 2px 0 8px 22px !important;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--mt-border);
  list-style: none;
}
.folder_list .inner_list .inner_list {
  flex-basis: calc(100% - 8px);
  max-width: calc(100% - 8px);
  margin: 0 0 2px 8px !important;
}
/* expand/collapse: chevron instead of the filled +/- circle */
.folder_list .inner_list .expand_link .bi-plus-circle-fill::before {
  content: "\f285";
}
.folder_list .inner_list .expand_link .bi-dash-circle-fill::before {
  content: "\f282";
}
.folder_list .inner_list .expand_link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  color: var(--mt-muted) !important;
}
.folder_list .inner_list .expand_link i {
  font-size: 11px;
  -webkit-text-stroke: .3px;
}
/* storage quota of the account */
.folder_list .inner_list .quota_info {
  display: block;
  margin-top: 6px;
  padding: 0 8px 4px;
  color: var(--mt-muted);
  font-size: 11px;
  white-space: normal;
}
.folder_list .inner_list .quota_info .progress {
  height: 4px;
  margin-bottom: 6px;
  border: 0 !important;
  border-radius: var(--mt-radius-pill);
  background: #E4E4E7 !important;
  overflow: hidden;
}
.folder_list .inner_list .quota_info .progress-bar {
  border-radius: var(--mt-radius-pill);
  background: #71717A !important;
}
.folder_list .inner_list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  margin: 1px 0;
  padding: 0 8px;
  border-radius: var(--mt-radius-sm);
  color: var(--mt-text-3);
  font-size: 13px;
  white-space: nowrap;
}
.folder_list .inner_list li > i,
.folder_list .inner_list .expand_link i {
  margin: 0;
  color: var(--mt-muted);
  font-size: 13px;
}
.folder_list .inner_list .m-has-children-wrapper {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.folder_list .inner_list a {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 0;
  overflow: hidden;
  color: var(--mt-text-2);
  font-size: 13px;
  text-overflow: ellipsis;
}
.folder_list .inner_list a:hover {
  color: var(--mt-text);
  text-decoration: none;
}
.folder_list .inner_list a.expand_link {
  flex: none;
  padding: 0;
}
.folder_list .inner_list .unread_count {
  flex: none;
  margin-left: auto;
  padding: 0 !important;
  background: transparent !important;
  color: var(--mt-text-2) !important;
  font-size: 12px;
  font-weight: 600;
}

/* ---- Sidebar: footer (logout lives in the user menu, toggle in the rail) ---- */
.folder_list .sidebar-footer {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 10px 0;
  border-top: 1px solid var(--mt-border);
  font-size: 13px;
}
.folder_list .sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mt-muted);
}
.folder_list .sidebar-footer a:hover {
  color: var(--mt-text);
  text-decoration: none;
}
.folder_list .sidebar-footer .menu-icon {
  margin: 0;
}
.cypht-layout:has(> .mt-rail) .folder_list .sidebar-footer .logout_link,
.cypht-layout:has(> .mt-rail) .folder_list .sidebar-footer .menu-toggle {
  display: none !important;
}

/* ==========================================================================
   Chrome "Areia": header + icon rail read as one L-shaped piece (no divider
   between them). The content area starts with a curved corner and a subtle line,
   drawn by pseudo-elements of the sticky header/rail so it stays put on scroll.
   ========================================================================== */
:root {
  --mt-chrome: #F5F5F4;
  --mt-chrome-line: #E7E5E4;
  --mt-chrome-line-hover: #D6D3D1;
  --mt-chrome-hover: #ECEBE9;
  --mt-chrome-icon: #78716C;
  --mt-chrome-text: #1C1917;
  --mt-chrome-mark: #44403C;
  --mt-curve: 16px;
}

/* ---- Header ---- */
.mt-header {
  background: var(--mt-chrome);
  border-bottom-color: var(--mt-chrome-line);
}
.cypht-layout:has(> .mt-rail) > .mt-header {
  border-bottom: 0;
}
/* top edge of the content area, starting after the curve */
.cypht-layout:has(> .mt-rail) > .mt-header::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(var(--mt-rail-w) + var(--mt-curve));
  right: 0;
  height: 1px;
  background: var(--mt-chrome-line);
  pointer-events: none;
}
input.mt-search-input {
  background: var(--mt-surface);
  border-color: var(--mt-chrome-line);
}
input.mt-search-input:hover {
  border-color: var(--mt-chrome-line-hover);
}
.mt-kbd {
  border-color: var(--mt-chrome-line);
  background: #FAFAF9;
}
.mt-icon-btn,
body:has(.mt-header) a.unsaved_icon {
  border-color: var(--mt-chrome-line);
  background: var(--mt-surface);
}
.mt-icon-btn:hover,
.mt-icon-btn.active,
body:has(.mt-header) a.unsaved_icon:hover {
  background: #FAFAF9;
}
.mt-header button.mt-avatar {
  background: var(--mt-chrome-mark);
  color: #FAFAF9;
}
.mt-header button.mt-avatar:hover,
.mt-header button.mt-avatar[aria-expanded="true"] {
  background: #57534E;
}

/* ---- Rail ---- */
.cypht-layout:has(> .mt-rail) > .mt-rail {
  background: var(--mt-chrome);
  border-right: 0;
}
/* curved corner: chrome outside the arc, 1px line on it */
.cypht-layout:has(> .mt-rail) > .mt-rail::before {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: var(--mt-curve);
  height: var(--mt-curve);
  background: radial-gradient(circle at 100% 100%,
    transparent calc(var(--mt-curve) - 1.6px),
    var(--mt-chrome-line) calc(var(--mt-curve) - 1.1px),
    var(--mt-chrome-line) calc(var(--mt-curve) - .5px),
    var(--mt-chrome) var(--mt-curve));
  pointer-events: none;
}
/* left edge of the content area, below the curve */
.cypht-layout:has(> .mt-rail) > .mt-rail::after {
  content: "";
  position: absolute;
  top: var(--mt-curve);
  bottom: 0;
  left: 100%;
  width: 1px;
  background: var(--mt-chrome-line);
  pointer-events: none;
}
.mt-rail-item,
.mt-rail .menu-toggle {
  color: var(--mt-chrome-icon);
}
.mt-rail-item:hover,
.mt-rail-item:focus,
.mt-rail .menu-toggle:hover {
  background: var(--mt-chrome-hover);
  color: var(--mt-chrome-text);
}
.mt-rail-item.active {
  background: var(--mt-surface);
  color: var(--mt-chrome-text);
  box-shadow: var(--mt-shadow-active);
}
.mt-rail-item.active:focus-visible {
  box-shadow: var(--mt-shadow-active), var(--mt-ring);
}
.mt-rail-item.active::before {
  background: var(--mt-chrome-text);
}

/* ==========================================================================
   Phase 3.3 — Message list (approved model)
   Heading: title + unread count, tools, filter chips.
   Rows (tr.mt-row, built by minduim_format_rows): grid of
     dot  | sender            | icons | time
          | subject + preview line
          | account tag (combined lists)
   ========================================================================== */

/* ---- Heading ---- */
.mt-list .content_title.mt-list-head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px 12px;
  border-top: 0;
  border-bottom: 1px solid var(--mt-divider);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
}
.mt-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.mt-list-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.mt-list-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--mt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-list-sub {
  font-size: 13px;
  color: var(--mt-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-list-sub:empty {
  display: none;
}

/* tools: refresh, sources, settings (+ IMAP folder controls) */
.mt-list-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.mt-list-tools > a,
.mt-list-tools > span,
.mt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--mt-radius-sm);
  color: var(--mt-text-3);
  font-size: 16px;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.mt-list-tools > a:hover,
.mt-list-tools > span:hover,
.mt-icon-btn:hover {
  background: var(--mt-hover);
  color: var(--mt-text);
}
.mt-list-tools > a:focus-visible,
.mt-icon-btn:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-list-tools i,
.mt-list-tools .refresh_list {
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: inherit;
}
.mt-list-head #imap_filter_form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 auto;
}
/* the chips replace the filter select; the keyword box only shows when in use */
.mt-list-head .imap_filter {
  display: none !important;
}
.mt-list-head .imap_keyword:placeholder-shown {
  display: none;
}
.mt-list-head .imap_keyword,
.mt-list-head .imap_sort {
  width: auto;
  height: 30px;
  min-height: 30px;
  border-radius: var(--mt-radius-sm);
  font-size: 12px;
  color: var(--mt-text-2);
}
.mt-list-head .imap_keyword {
  width: 160px;
}
.mt-list-head .imap_sort {
  max-width: 160px;
  padding: 0 28px 0 10px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2371717A' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
}

/* bar: select-all, bulk actions, chips, sort */
.mt-list-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
}
.mt-list-bar .toggle_link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: -6px;
  border-radius: var(--mt-radius-sm);
  transition: background-color .15s ease;
}
/* select all: empty box like the row checkboxes, filled while rows are selected */
.mt-list-bar .toggle_link i {
  display: none;
}
.mt-list-bar .toggle_link::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1px solid #D4D4D8;
  border-radius: 5px;
  background: var(--mt-surface) center / 12px 12px no-repeat;
  transition: border-color .15s ease, background-color .15s ease;
}
.mt-list-bar .toggle_link:hover {
  background: var(--mt-hover);
}
.mt-list-bar .toggle_link:hover::before {
  border-color: #A1A1AA;
}
.mt-list:has(td.checkbox_cell input:checked) .mt-list-bar .toggle_link::before {
  border-color: #18181B;
  background-color: #18181B;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23FAFAFA' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3e%3c/svg%3e");
}
.mt-list-bar .msg_controls {
  flex-wrap: wrap;
}
.mt-list-bar .msg_controls .btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--mt-radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.mt-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.mt-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-pill);
  background: var(--mt-surface);
  color: var(--mt-text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.mt-chip:hover {
  background: var(--mt-hover);
  color: var(--mt-text);
}
.mt-chip.active,
.mt-chip.active:hover {
  background: #18181B;
  border-color: #18181B;
  color: #FAFAFA;
}
.mt-chip:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-list-bar .combined_sort {
  width: auto !important;
  height: 30px;
  min-height: 30px;
  margin-left: auto !important;
  padding-top: 0;
  padding-bottom: 0;
  border-radius: var(--mt-radius-sm);
  font-size: 12px;
  color: var(--mt-text-2);
  cursor: pointer;
}
/* while messages are selected, the bulk actions take the place of the filters */
.mt-list-bar:has(.msg_controls.d-flex) .mt-chips,
.mt-list-bar:has(.msg_controls.d-flex) .combined_sort,
.mt-list-bar:has(.msg_controls.d-flex) #imap_filter_form {
  display: none;
}
.mt-list .list_meta {
  display: none !important;
}
.mt-list-head .list_sources {
  top: calc(100% - 4px);
  right: 12px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-lg);
  box-shadow: var(--bs-box-shadow);
}

/* ---- Table → list of cards ---- */
.mt-list > .p-3 {
  padding: 8px !important;
}
.mt-list .message_table:has(> tbody > tr.mt-row) {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}
.mt-list .message_table:has(> tbody > tr.mt-row) > thead,
.mt-list .message_table:has(> tbody > tr.mt-row) > colgroup {
  display: none;
}
.mt-list .message_table:has(> tbody > tr.mt-row) > tbody {
  display: block;
}

.mt-list .message_table > tbody > tr.mt-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "dot from icon date"
    ".   subj subj subj"
    ".   tag  tag  tag";
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--mt-radius);
  cursor: pointer;
  transition: background-color .12s ease;
}
.mt-list .message_table > tbody > tr.mt-row + tr.mt-row {
  margin-top: 2px;
}
.mt-list .message_table > tbody > tr.mt-row:hover {
  background: #FAFAFA;
}
.mt-list .message_table > tbody > tr.mt-row.hl {
  background: #F4F4F5;
  box-shadow: inset 0 0 0 1px #E4E4E7;
}
.mt-list .message_table > tbody > tr.mt-row:has(td.subject a:focus-visible) {
  box-shadow: var(--mt-ring);
}
.mt-list .message_table > tbody > tr.mt-row > td {
  display: block;
  width: auto;
  min-width: 0;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.mt-list .message_table > tbody > tr.mt-row > td.source,
.mt-list .message_table > tbody > tr.mt-row > td.dates {
  display: none !important;
}

/* unread dot; becomes the checkbox on hover or while selecting */
.mt-list .message_table > tbody > tr.mt-row > td.checkbox_cell {
  grid-area: dot;
  display: flex;
  align-items: center;
  height: 20px;
}
.mt-list .message_table > tbody > tr.mt-row > td.checkbox_cell::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-left: 5px;
  border-radius: 50%;
  background: transparent;
}
.mt-list .message_table > tbody > tr.mt-row.unseen > td.checkbox_cell::before {
  background: #18181B;
}
.mt-list .message_table > tbody > tr.mt-row > td.checkbox_cell label {
  display: none;
}
.mt-list .message_table > tbody > tr.mt-row:hover > td.checkbox_cell::before,
.mt-list .message_table:has(td.checkbox_cell input:checked) > tbody > tr.mt-row > td.checkbox_cell::before {
  display: none;
}
.mt-list .message_table > tbody > tr.mt-row:hover > td.checkbox_cell label,
.mt-list .message_table:has(td.checkbox_cell input:checked) > tbody > tr.mt-row > td.checkbox_cell label {
  display: flex;
}

/* sender */
.mt-list .message_table > tbody > tr.mt-row > td.from {
  grid-area: from;
  padding-right: 8px !important;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #52525B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-list .message_table > tbody > tr.mt-row.unseen > td.from {
  font-weight: 700;
  color: #09090B;
}

/* icons (attachment, flag, answered) next to the time */
.mt-list .message_table > tbody > tr.mt-row > td.icon {
  grid-area: icon;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 20px;
  color: #A1A1AA;
}
.mt-list .message_table > tbody > tr.mt-row > td.icon:not(:empty) {
  padding-right: 8px !important;
}

/* time */
.mt-list .message_table > tbody > tr.mt-row > td.msg_date {
  grid-area: date;
  font-size: 12px;
  line-height: 20px;
  color: #71717A;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mt-list .message_table > tbody > tr.mt-row.unseen > td.msg_date {
  font-weight: 600;
  color: #18181B;
}
.mt-list .message_table > tbody > tr.mt-row > td.msg_date .badge {
  margin-right: 4px;
}

/* subject + preview */
.mt-list .message_table > tbody > tr.mt-row > td.subject {
  grid-area: subj;
  margin-top: 2px;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject > div {
  min-width: 0;
  font-weight: 400;
  color: inherit;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject a {
  display: block;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: #52525B;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-list .message_table > tbody > tr.mt-row.unseen > td.subject a {
  font-weight: 600;
  color: #18181B;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject a:focus-visible {
  outline: 0;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject .s_pre {
  color: inherit;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject p {
  margin: 1px 0 0;
  font-size: 13px;
  font-weight: 400 !important;
  line-height: 1.45;
  color: #71717A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-list .message_table > tbody > tr.mt-row > td.subject p:empty {
  display: none;
}

/* account tag */
.mt-list .message_table > tbody > tr.mt-row > td.mt-tag-cell {
  grid-area: tag;
  padding-top: 6px !important;
  line-height: 0;
}
.mt-tag {
  display: inline-block;
  max-width: 100%;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--mt-radius-pill);
  background: var(--mt-acc-tag-bg, #F4F4F5);
  color: var(--mt-acc-tag, #27272A);
  font-size: 11px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

/* filter chips on combined lists (client side) */
.mt-list[data-mt-filter="unseen"] .message_table > tbody > tr.mt-row:not(.unseen):not(.hl),
.mt-list[data-mt-filter="flagged"] .message_table > tbody > tr.mt-row:not(.flagged):not(.hl) {
  display: none;
}

/* message opened below the row (inline style "below") */
.mt-list .message_table > tbody > tr.inline_msg {
  display: block;
}
.mt-list .message_table > tbody > tr.inline_msg > td {
  display: block;
  padding: 8px 0 !important;
  border: 0 !important;
}

/* pagination of IMAP folders (core markup: round Bootstrap buttons) */
.mt-list .pagination {
  justify-content: flex-end;
  gap: 6px !important;
  margin: 0 !important;
  padding: 4px 4px 8px;
  color: var(--mt-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.mt-list .message_table + .pagination {
  padding: 8px 4px 4px;
}
.mt-list .pagination .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--mt-border) !important;
  border-radius: var(--mt-radius-sm) !important;
  background: var(--mt-surface) !important;
  color: var(--mt-text-2) !important;
  font-size: 12px;
}
.mt-list .pagination .btn:hover:not(:disabled) {
  background: var(--mt-hover) !important;
  color: var(--mt-text) !important;
}
.mt-list .pagination .btn:disabled {
  opacity: .45;
}
.mt-list .pagination .current {
  color: var(--mt-text);
  font-weight: 600;
}

/* empty list */
.mt-list .empty_list,
.minduim .empty_list {
  padding: 56px 16px;
  color: var(--mt-muted) !important;
  font-family: inherit;
  font-size: 14px !important;
  font-style: normal !important;
  text-align: center;
}

/* ==========================================================================
   Phase 3.4 — Reading pane (approved mockup)
   List | message side by side (inline style "right"); the same markup is
   used by the full message page. Built by minduim_message_headers and
   minduim_message_struct:
     .mt-read-top   action bar (+ "⋯" row of other actions)
     .mt-read-head  account tag · subject · avatar + sender · date
     .msg_text_inner (core body) · .mt-attachments · .mt-quick · details
   ========================================================================== */

/* ---- Pane layout: list column + reading column ----
   .mt-split = inline style "right": the columns exist before any message opens */
.mt-list.mt-split,
.mt-list:has(> .inline_right) {
  display: grid;
  grid-template-columns: clamp(340px, 36%, 460px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: start;
  margin-right: 0;
  padding-bottom: 0;
}
.mt-list.mt-split > :not(.inline_right):not(.mt-read-empty),
.mt-list:has(> .inline_right) > :not(.inline_right):not(.mt-read-empty) {
  grid-column: 1;
  min-width: 0;
}
.mt-list:has(> .inline_right) > .inline_right,
.mt-list > .mt-read-empty {
  grid-column: 2;
  grid-row: 1 / span 2;
  float: none;
  width: auto !important;
  max-width: none !important;
  min-height: 0;
  height: calc(100vh - var(--mt-header-h));
  margin: 0;
  padding: 0;
  position: sticky;
  top: var(--mt-header-h);
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid var(--mt-border);
  background: var(--mt-surface) !important;
}

/* empty reading pane (approved: soft gray) */
.mt-list > .mt-read-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--mt-sidebar) !important;
}
.mt-list:has(> .inline_right) > .mt-read-empty {
  display: none;
}
.mt-read-empty-in {
  max-width: 280px;
  padding: 24px;
  text-align: center;
}
.mt-read-empty-in > .bi {
  color: #A1A1AA;
  font-size: 28px;
  line-height: 1;
}
.mt-read-empty-title {
  margin: 12px 0 4px;
  color: var(--mt-text-3);
  font-size: 15px;
  font-weight: 600;
}
.mt-read-empty-sub {
  margin: 0;
  color: var(--mt-muted);
  font-size: 13px;
  line-height: 1.5;
}
.mt-list .message_table {
  width: 100% !important;
}

/* reading block (inline pane and full message page) */
.msg_text:has(> .mt-read-top) {
  margin: 0;
  padding: 0;
  min-height: 0;
  color: var(--mt-text) !important;
}
.msg_text:not(.inline_right):has(> .mt-read-top) {
  /* full message page: card inside the content area (never wider than it) */
  width: auto !important;
  min-width: 0;
  max-width: calc(100% - 40px);
  margin: 16px 20px 40px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-lg);
}
.msg_text:not(.inline_right) > .mt-read-top {
  top: var(--mt-header-h);
  border-radius: var(--mt-radius-lg) var(--mt-radius-lg) 0 0;
}

/* core pieces replaced by our controls */
.msg_text tr.prev,
.msg_text tr.next,
.msg_text .close_inline_msg,
.mt-read-top:not(.open) .mt-read-more {
  display: none !important;
}
.msg_text .hide {
  display: none;
}

/* ---- Action bar ---- */
.mt-read-top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
}
.mt-read-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
}
.mt-read-actions,
.mt-read-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mt-read-nav {
  flex: 0 0 auto;
}
.mt-btn,
.mt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-sm);
  background: var(--mt-surface);
  color: var(--mt-text-2) !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.mt-icon {
  width: 34px;
  padding: 0;
  font-size: 15px;
}
.mt-btn > i {
  font-size: 15px;
}
.mt-btn:hover,
.mt-icon:hover,
.mt-read-top.open .mt-read-more-toggle {
  background: var(--mt-hover);
  color: var(--mt-text) !important;
}
.mt-btn:focus-visible,
.mt-icon:focus-visible,
.mt-more-btn:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-btn-dark {
  border-color: var(--mt-primary);
  background: var(--mt-primary);
  color: #fff !important;
}
.mt-btn-dark:hover {
  border-color: var(--mt-primary-hover);
  background: var(--mt-primary-hover);
  color: #fff !important;
}
.mt-icon.mt-disabled,
.mt-icon:disabled {
  opacity: .4;
  cursor: default;
}
.mt-icon:disabled:hover {
  background: var(--mt-surface);
  color: var(--mt-text-2) !important;
}
.mt-read-pos {
  margin-right: 4px;
  color: var(--mt-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mt-read-pos:empty {
  display: none;
}

/* ---- Other actions ("⋯") ---- */
.mt-read-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 24px 12px;
}
.mt-read-more .mt-more-btn,
.mt-read-more .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--mt-border) !important;
  border-radius: var(--mt-radius-sm) !important;
  background: var(--mt-surface) !important;
  color: var(--mt-text-2) !important;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: none !important;
  cursor: pointer;
}
.mt-read-more .mt-more-btn:hover,
.mt-read-more .btn:hover,
.mt-read-more .show > .btn {
  background: var(--mt-hover) !important;
  color: var(--mt-text) !important;
}
.mt-read-more .btn-outline-danger {
  color: #B91C1C !important;
}
.mt-read-more .mt-more-btn.hide,
.mt-read-more .small_headers {
  display: none;
}
/* jQuery .show()/.toggle() set display:inline */
.mt-read-more .mt-more-btn[style*="display: inline"] {
  display: inline-flex !important;
}
.mt-read-more .disabled_link {
  opacity: .45;
  pointer-events: none;
}
.mt-read-more .dropdown-menu {
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  box-shadow: var(--bs-box-shadow);
}

/* ---- Head: tag, subject, sender ---- */
.mt-read-head {
  padding: 24px 32px 0;
}
.mt-read-head > .mt-tag {
  margin-bottom: 12px;
}
.mt-read-subject {
  margin: 0 0 20px;
}
.msg_text .mt-read-subject .js-header_subject {
  display: block;
  color: var(--mt-text) !important;
  font-size: 26px !important;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.mt-read-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--mt-border);
}
.mt-avatar {
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--mt-av-bg, #F4F4F5);
  color: var(--mt-av-fg, #3F3F46);
  font-size: 16px;
  font-weight: 600;
}
.mt-av0 { --mt-av-bg: #FEF3C7; --mt-av-fg: #92400E; }
.mt-av1 { --mt-av-bg: #CCFBF1; --mt-av-fg: #0F766E; }
.mt-av2 { --mt-av-bg: #FCE7F3; --mt-av-fg: #BE185D; }
.mt-av3 { --mt-av-bg: #EDE9FE; --mt-av-fg: #6D28D9; }
.mt-av4 { --mt-av-bg: #ECFCCB; --mt-av-fg: #4D7C0F; }
.mt-av5 { --mt-av-bg: #F4F4F5; --mt-av-fg: #3F3F46; }
.mt-read-who {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
}
.mt-from #contact_info {
  display: inline;
  color: var(--mt-text) !important;
  font-size: 14px;
  text-decoration: none;
}
.mt-from #contact_info::after {
  display: none;
}
.mt-from #contact_info:hover .mt-from-name {
  text-decoration: underline;
}
.mt-from-name {
  font-weight: 600;
}
.mt-from-email {
  color: var(--mt-muted);
  font-weight: 400;
}
.mt-from .dropdown-menu {
  min-width: 260px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  box-shadow: var(--bs-box-shadow);
  font-size: 13px;
}
.mt-read-line {
  margin-top: 2px;
  color: var(--mt-text-3);
  font-size: 13px;
  line-height: 1.5;
}
.mt-read-label {
  color: var(--mt-muted);
}
.mt-read-date {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--mt-muted);
  font-size: 13px;
  white-space: nowrap;
}

/* all headers (toggled by "Todos os cabeçalhos") */
.mt-read-long {
  flex-direction: column;
  gap: 2px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-sidebar);
  font-size: 12px;
}
.mt-read-long.long_header[style*="display: block"],
.mt-read-long.long_header[style*="display: flex"] {
  display: flex !important;
}
.mt-long-row {
  display: flex;
  gap: 12px;
  min-width: 0;
}
.mt-long-name {
  flex: 0 0 160px;
  color: var(--mt-muted);
}
.mt-long-value {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--mt-text-2);
}
.mt-read-long .mt-long-list {
  display: flex;
  padding-top: 6px;
}

/* ---- Body. Phase 3.5: HTML emails live in a shadow DOM (.mt-mail-host, built
   by site.js) with their own CSS; text emails keep the rules below ---- */
.msg_text:has(> .mt-read-top) .msg_text_inner,
.inline_right:has(> .mt-read-top) .msg_text_inner {
  min-height: 0;
  padding: 24px 32px;
  color: var(--mt-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
}
.msg_text:has(> .mt-read-top) .msg_text_inner.mt-body {
  padding: 16px 0 0;
  overflow: visible;
  line-height: normal;
}
.mt-body > .imap_envelope {
  margin: 20px 32px 0;
}
/* the core's ".msg_text *" would be inherited by the email (squeezes its tables) */
.msg_text .mt-mail-host {
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}
/* core notice of external images: replaced by .mt-bar-images */
.msg_text:has(> .mt-read-top) #externalNoticesAccordion {
  display: none !important;
}

/* ---- Bars above the body: images blocked, unsubscribe ---- */
.mt-read-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 32px 0;
}
.mt-read-bars:empty {
  display: none;
}
.mt-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 44px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-sidebar);
  color: var(--mt-text-2);
  font-size: 13px;
  line-height: 1.4;
}
.mt-bar > .bi {
  flex: 0 0 auto;
  color: var(--mt-muted);
  font-size: 16px;
}
.mt-bar-text {
  flex: 1 1 200px;
  min-width: 0;
}
.mt-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.mt-bar-actions:empty {
  display: none;
}
.mt-bar .mt-bar-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-sm);
  background: var(--mt-surface);
  color: var(--mt-text) !important;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .12s ease;
}
.mt-bar .mt-bar-btn:hover {
  background: var(--mt-hover);
}
.mt-bar .mt-bar-btn:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}

/* ---- Attachments (top of the message): cards; PDF/images also have Abrir / Baixar ---- */
.mt-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 32px 0;
}
.mt-att {
  position: relative;
  display: flex;
  min-width: 200px;
  max-width: 320px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-surface);
  transition: background-color .12s ease;
}
.msg_text .mt-att.download_link {
  width: auto;
  max-width: 320px;
}
.mt-att:hover,
.mt-att.open {
  background: var(--mt-hover);
}
.mt-att-main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: var(--mt-radius);
  color: var(--mt-text) !important;
  text-decoration: none !important;
}
.mt-att-main:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-att-badge {
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--mt-radius-sm);
  background: #F4F4F5;
  color: #3F3F46;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}
.mt-att:hover .mt-att-badge:not(.mt-att-pdf) {
  background: #E4E4E7;
}
.mt-att-badge.mt-att-pdf {
  background: #FEE2E2;
  color: #B91C1C;
}
.mt-att-info {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}
.mt-att-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap !important;
  text-overflow: ellipsis;
}
.mt-att-size {
  color: var(--mt-muted);
  font-size: 12px;
}
.mt-att-dl {
  flex: 0 0 auto;
  color: var(--mt-muted);
  font-size: 15px;
}
.mt-att .mt-att-menu-btn {
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--mt-border);
  border-radius: 0 calc(var(--mt-radius) - 1px) calc(var(--mt-radius) - 1px) 0;
  background: transparent;
  color: var(--mt-muted);
  font-size: 13px;
  cursor: pointer;
}
.mt-att .mt-att-menu-btn:hover,
.mt-att.open .mt-att-menu-btn {
  background: #E4E4E7;
  color: var(--mt-text);
}
.mt-att .mt-att-menu-btn:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
.mt-att-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  display: none;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  background: var(--mt-surface);
  box-shadow: var(--bs-box-shadow);
}
.mt-att.open > .mt-att-menu {
  display: block;
}
.mt-att-menu .download_link {
  display: block;
}
.mt-att-menu .mt-att-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--mt-text) !important;
  font-size: 13px;
  text-decoration: none !important;
  white-space: nowrap !important;
}
.mt-att-menu .mt-att-item:hover {
  background: var(--mt-hover);
}
.mt-att-item > .bi {
  color: var(--mt-muted);
  font-size: 14px;
}

/* ---- Message parts (opened from the "⋯" menu) ---- */
.mt-read-parts {
  margin: 16px 32px 0;
  color: var(--mt-muted);
  font-size: 12px;
}
.mt-read-parts[hidden] {
  display: none;
}
.mt-read-parts-title {
  margin-bottom: 8px;
  color: var(--mt-text-2);
  font-weight: 600;
}
.mt-read-parts .msg_parts {
  width: 100%;
  margin: 0;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 12px;
}
.mt-read-parts .msg_parts td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--mt-divider);
}
.mt-read-parts .msg_parts tr:last-child td {
  border-bottom: 0;
}

/* ---- Quick reply ---- */
.mt-quick {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 24px 32px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-lg);
  background: var(--mt-sidebar);
}
.mt-quick:focus-within {
  border-color: #A1A1AA;
  box-shadow: var(--mt-ring);
}
.mt-quick-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 34px;
  max-height: 240px;
  padding: 7px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--mt-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
}
.mt-quick-input::placeholder {
  color: var(--mt-muted);
}
.mt-quick-send {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--mt-radius-sm);
  background: var(--mt-primary);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.mt-quick-send:hover {
  background: var(--mt-primary-hover);
}
.mt-quick-send:focus-visible {
  outline: 0;
  box-shadow: var(--mt-ring);
}
/* drafts have no reply */
.msg_text:not(:has(.reply_link)) .mt-quick {
  display: none;
}

/* ---- Narrow screens: pane under the list heading (full responsive in Phase 4) ---- */
@media (max-width: 991.98px) {
  .mt-list.mt-split,
  .mt-list:has(> .inline_right) {
    display: block;
  }
  .mt-list > .mt-read-empty {
    display: none;
  }
  .mt-list:has(> .inline_right) > .inline_right {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--mt-border);
    border-bottom: 1px solid var(--mt-border);
  }
  .mt-read-bar,
  .mt-read-more {
    padding-left: 16px;
    padding-right: 16px;
  }
  .mt-read-head {
    padding: 20px 16px 0;
  }
  .msg_text:has(> .mt-read-top) .msg_text_inner {
    padding: 20px 16px;
  }
  .mt-body > .imap_envelope {
    margin: 16px 16px 0;
  }
  .mt-read-bars,
  .mt-attachments {
    padding: 12px 16px 0;
  }
  .mt-att,
  .msg_text .mt-att.download_link {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }
  .mt-read-parts {
    margin: 12px 16px 0;
  }
  .mt-quick {
    margin: 20px 16px;
  }
  .mt-btn > span {
    display: none;
  }
  .mt-btn {
    width: 34px;
    padding: 0;
  }
}

/* ==========================================================================
   Login — "cartão central" (approved mockup "Login 2"). Areia palette:
   page #F5F5F4, white card, fine borders, dark button. No account list.
   ========================================================================== */
body:has(.mt-login) {
  background: #F5F5F4;
}
.login_form:has(> .mt-login) {
  position: absolute;
  inset: 0;
}
.mt-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 16px;
  background: #F5F5F4;
  color: #1C1917;
}
.mt-login-box {
  width: 100%;
  max-width: 392px;
}
.mt-login-card {
  padding: 36px 32px 32px;
  background: #FFFFFF;
  border: 1px solid #E7E5E4;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(28, 25, 23, .04);
}

/* logo: mark 36px + wordmark (cap height 15px ≈ 20px type) */
.mt-login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 28px;
}
.mt-login-mark {
  flex: none;
  display: block;
  width: 36px;
  height: 36px;
}
.mt-login-word {
  flex: none;
  display: block;
  height: 15px;
  width: auto;
  aspect-ratio: 529.4 / 75;
  color: #1C1917;
}

.mt-login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-align: center;
  color: #1C1917;
}
.mt-login-sub {
  margin: 6px 0 24px;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  color: #78716C;
}

/* messages (wrong password, session expired...) inside the card */
.mt-login-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.mt-login-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #44403C;
  background: #FAFAF9;
  border: 1px solid #E7E5E4;
  border-radius: 10px;
}
.mt-login-alert .mt-ico {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}
.mt-login-alert-error {
  color: #B91C1C;
  background: #FEF2F2;
  border-color: #FECACA;
}

/* fields */
.mt-login-field {
  margin-bottom: 16px;
}
.mt-login-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #44403C;
}
.mt-login-input {
  position: relative;
}
.mt-login-input > .mt-ico {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: #A8A29E;
  pointer-events: none;
  transition: color .15s ease;
}
.mt-login-input:focus-within > .mt-ico {
  color: #1C1917;
}
.mt-login-input input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  font: inherit;
  font-size: 14.5px;
  color: #1C1917;
  background: #FFFFFF;
  border: 1px solid #E7E5E4;
  border-radius: 10px;
  outline: 0;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.mt-login-input input::placeholder {
  color: #A8A29E;
  opacity: 1;
}
.mt-login-input input:hover {
  border-color: #D6D3D1;
}
.mt-login-input input:focus {
  border-color: #1C1917;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, .35);
}
.mt-login-input input.mt-login-pass {
  padding-right: 46px;
}
/* browser autofill keeps the white field */
.mt-login-input input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px #FFFFFF inset;
  -webkit-text-fill-color: #1C1917;
}
.mt-login-input input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 40px #FFFFFF inset, 0 0 0 3px rgba(168, 162, 158, .35);
}

/* show / hide password */
.mt-login-eye {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #78716C;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.mt-login-eye:hover {
  color: #1C1917;
  background: #F5F5F4;
}
.mt-login-eye:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px #1C1917;
}
.mt-login-eye .mt-ico {
  width: 17px;
  height: 17px;
}
.mt-login-eye .mt-ico-eye-off,
.mt-login-eye[aria-pressed=true] .mt-ico-eye {
  display: none;
}
.mt-login-eye[aria-pressed=true] .mt-ico-eye-off {
  display: block;
}

.mt-login-caps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 12.5px;
  color: #B45309;
}
.mt-login-caps[hidden] {
  display: none;
}
.mt-login-caps .mt-ico {
  width: 14px;
  height: 14px;
}

/* "Manter conectado" (only when ALLOW_LONG_SESSION=true) */
.mt-login-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -2px 0 18px;
  font-size: 13px;
  color: #44403C;
  cursor: pointer;
}
.mt-login-check .form-check-input {
  margin: 0;
  width: 16px;
  height: 16px;
  border-color: #D6D3D1;
}
.mt-login-check .form-check-input:checked {
  background-color: #1C1917;
  border-color: #1C1917;
}
.mt-login-check .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(168, 162, 158, .35);
}

/* button */
.mt-login-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin-top: 22px;
  padding: 0 16px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: #FAFAF9;
  background: #1C1917;
  border: 1px solid #1C1917;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .15s ease;
}
.mt-login-btn:hover {
  background: #292524;
}
.mt-login-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, .55);
}
.mt-login-btn .mt-ico {
  width: 17px;
  height: 17px;
  transition: transform .15s ease;
}
.mt-login-btn:hover .mt-ico {
  transform: translateX(2px);
}
.mt-login-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(250, 250, 249, .35);
  border-top-color: #FAFAF9;
  border-radius: 50%;
  animation: mt-login-spin .7s linear infinite;
}
.mt-login-btn.is-loading {
  cursor: progress;
  background: #292524;
}
.mt-login-btn.is-loading .mt-ico {
  display: none;
}
.mt-login-btn.is-loading .mt-login-spinner {
  display: block;
}
@keyframes mt-login-spin {
  to { transform: rotate(360deg); }
}

.mt-login-foot {
  margin: 20px 0 0;
  font-size: 12px;
  text-align: center;
  color: #A8A29E;
}
.mt-login-foot:empty {
  display: none;
}

/* "Esqueceu a senha?" — link beside the label, reset views (recovery.php) */
.mt-login-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.mt-login-label-row .mt-login-label {
  margin-bottom: 0;
}
.mt-login-link,
.mt-login-note a {
  font-size: 12.5px;
  font-weight: 500;
  color: #57534E;
  text-decoration: underline;
  text-decoration-color: #D6D3D1;
  text-underline-offset: 3px;
  border-radius: 4px;
}
.mt-login-link:hover,
.mt-login-note a:hover {
  color: #1C1917;
  text-decoration-color: currentColor;
}
.mt-login-link:focus-visible,
.mt-login-note a:focus-visible,
.mt-login-back:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, .55);
}
.mt-login-note {
  margin: 0 0 4px;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  color: #78716C;
}
.mt-login-note a {
  font-size: inherit;
}
.mt-login-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: #1C1917;
  background: #F5F5F4;
  border: 1px solid #E7E5E4;
  border-radius: 50%;
}
.mt-login-status .mt-ico {
  width: 22px;
  height: 22px;
}
.mt-login-status.is-error {
  color: #B91C1C;
  background: #FEF2F2;
  border-color: #FECACA;
}
a.mt-login-btn,
a.mt-login-btn:hover {
  color: #FAFAF9;
  text-decoration: none;
}
.mt-login-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #57534E;
  text-decoration: none;
  border-radius: 10px;
}
.mt-login-back:hover {
  color: #1C1917;
}
.mt-login-back .mt-ico {
  width: 15px;
  height: 15px;
}
.mt-login-hidden-user {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* "Recuperação de senha" section on the change_password page */
.mt-recovery {
  margin-top: 28px;
}
.mt-recovery-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #57534E;
}
.mt-recovery-status.is-on {
  color: #1C1917;
}
.mt-recovery-help,
.mt-recovery-note {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: #78716C;
}
.mt-recovery-note {
  margin: 12px 0 0;
  font-size: 12.5px;
}

/* core toasts are shown inside the card instead */
body:has(.mt-login) .sys_messages {
  display: none !important;
}

@media (max-width: 480px) {
  .mt-login {
    align-items: flex-start;
    padding-top: 48px;
  }
  .mt-login-card {
    padding: 28px 20px 24px;
  }
}
