/* ==========================================================================
   ENZO WEBMAIL - Modern UI/UX & Mobile-First Theme  (v1.1)
   Based on Elastic2022, refined for Enzo Soluciones
   --------------------------------------------------------------------------
   v1.1 changes:
   - FIX: login selectors (body carries .task-login, so `.task-login body`
     never matched in v1.0).
   - FIX: v1.0 forced the list date to stay visible on hover, which collided
     with Elastic2022's hover delete button. Date is now hidden on hover only
     on devices that really hover; touch devices keep the date visible.
   - FIX: removed global min-height/toolbar sizing that overflowed the 40px
     list header; touch targets are now scoped to lists, menus and popovers.
   - FIX: unread indicator uses an inset shadow (borders on <tr> are not
     reliable across browsers).
   - NEW: real mobile compose FAB (.enzo-fab, see templates/mail.html).
   - NEW: popovers, toasts, settings cards, reading view, compose polish.
   - NEW: dark-mode autofill fix, :focus-visible rings, reduced motion.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body, .ui-widget, input, select, textarea, button, .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
  font-family: var(--enzo-font) !important;
}

/* --------------------------------------------------------------------------
   1. COLOR PALETTE & VARIABLES
   -------------------------------------------------------------------------- */
:root {
  --enzo-primary: #2563eb;
  --enzo-primary-hover: #1d4ed8;
  --enzo-primary-active: #1e40af;
  --enzo-primary-light: #eff6ff;
  --enzo-primary-rgb: 37, 99, 235;

  --enzo-surface: #ffffff;
  --enzo-success: #10b981;
  --enzo-warning: #f59e0b;
  --enzo-danger: #ef4444;

  --enzo-radius-sm: 6px;
  --enzo-radius-md: 10px;
  --enzo-radius-lg: 14px;
  --enzo-radius-full: 9999px;

  --enzo-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --enzo-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --enzo-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --enzo-shadow-fab: 0 10px 20px -3px rgba(37, 99, 235, 0.40), 0 4px 6px -2px rgba(37, 99, 235, 0.25);

  --enzo-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --enzo-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Overrides for Elastic2022 light theme variables */
  --font: #0f172a;
  --font2: #64748b;
  --background: #f8fafc;
  --backgroundhover: #e0e7ff;
  --backgroundhoverlight: #f1f5f9;
  --backgroundtree: #f1f5f9;
  --backgroundbutton: #ffffff;
  --backgroundcompose: #2563eb;
  --backgroundcomposehover: #1d4ed8;
  --bordercolor: #e2e8f0;
}

html.dark-mode {
  --enzo-primary-light: rgba(59, 130, 246, 0.16);
  --enzo-surface: #111827;
  --enzo-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.55);

  /* Overrides for Elastic2022 dark theme variables */
  --font: #f1f5f9;
  --font2: #94a3b8;
  --background: #0b0f19;
  --backgroundhover: #1e293b;
  --backgroundhoverlight: #161e2e;
  --backgroundtree: #0f172a;
  --backgroundbutton: #1e293b;
  --backgroundcompose: #2563eb;
  --backgroundcomposehover: #3b82f6;
  --bordercolor: #1e293b;
}

/* --------------------------------------------------------------------------
   2. BASE, TYPOGRAPHY, ACCESSIBILITY
   -------------------------------------------------------------------------- */
body, html {
  font-family: var(--enzo-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: rgba(var(--enzo-primary-rgb), 0.22);
}

/* Visible focus only for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--enzo-primary) !important;
  outline-offset: 2px !important;
  border-radius: var(--enzo-radius-sm);
}

/* Thin, rounded scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: var(--enzo-radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.6); }

/* Generic form controls */
.form-control,
.custom-select,
input[type="text"].form-control,
input[type="password"].form-control {
  border-radius: var(--enzo-radius-sm) !important;
  border-color: var(--bordercolor);
  transition: border-color 0.15s var(--enzo-ease), box-shadow 0.15s var(--enzo-ease);
}
.form-control:focus,
.custom-select:focus {
  border-color: var(--enzo-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--enzo-primary-rgb), 0.15) !important;
}

/* Primary buttons everywhere (dialogs, settings, compose "Send") */
.btn-primary,
.button.mainaction,
button.mainaction {
  background: var(--enzo-primary) !important;
  border-color: var(--enzo-primary) !important;
  color: #fff !important;
  border-radius: var(--enzo-radius-sm) !important;
  font-weight: 600;
  transition: background-color 0.15s var(--enzo-ease), box-shadow 0.15s var(--enzo-ease);
}
.btn-primary:hover,
.button.mainaction:hover,
button.mainaction:hover {
  background: var(--enzo-primary-hover) !important;
  border-color: var(--enzo-primary-hover) !important;
}

/* Dark mode: kill Chrome/Safari's white/yellow autofill background */
html.dark-mode input:-webkit-autofill,
html.dark-mode input:-webkit-autofill:hover,
html.dark-mode input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--font) !important;
  -webkit-box-shadow: 0 0 0 1000px #111827 inset !important;
  caret-color: var(--font);
  transition: background-color 9999s ease-out 0s;
}

/* --------------------------------------------------------------------------
   3. LOGIN SCREEN
   (body has class "task-login", so we target body.task-login)
   -------------------------------------------------------------------------- */
body.task-login {
  background: radial-gradient(circle at 50% 20%, #dbeafe 0%, #f8fafc 60%) !important;
  min-height: 100vh;
  min-height: 100dvh;
}
html.dark-mode body.task-login {
  background: radial-gradient(circle at 50% 20%, #172554 0%, #0b0f19 65%) !important;
}

body.task-login #layout,
body.task-login #layout-content {
  background: transparent !important;
}

body.task-login #layout-content {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

body.task-login #logo {
  position: static !important;
  top: auto !important;
  margin: 0 0 1.5rem !important;
  max-height: 56px !important;
  max-width: 80vw;
}

body.task-login #login-form {
  position: static !important;
  top: auto !important;
  transform: none !important;           /* v1.0 of Elastic2022 used scale(1.2) on phones -> blurry */
  width: 100% !important;
  max-width: 400px !important;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  border-radius: 18px !important;
  padding: 2rem 1.75rem 1.5rem !important;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04) !important;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-sizing: border-box;
  animation: enzo-rise 0.35s var(--enzo-ease) both;
}
html.dark-mode body.task-login #login-form {
  background: rgba(17, 24, 39, 0.85) !important;
  border-color: rgba(51, 65, 85, 0.6) !important;
  box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.5) !important;
}

/* ui.js turns each row into: hidden label + .input-group(icon + input w/ placeholder).
   We style that group as a single field with a shared focus ring. */
body.task-login #login-form table,
body.task-login #login-form tbody { display: block; width: 100%; }
body.task-login #login-form tr {
  display: block;
  margin: 0 0 0.85rem !important;
}
body.task-login #login-form td.input {
  display: block !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
}

body.task-login #login-form .input-group {
  flex-wrap: nowrap;
  border: 1.5px solid var(--bordercolor);
  border-radius: var(--enzo-radius-md);
  background: var(--backgroundhoverlight);
  overflow: hidden;
  transition: border-color 0.2s var(--enzo-ease), box-shadow 0.2s var(--enzo-ease), background-color 0.2s;
}
body.task-login #login-form .input-group:focus-within {
  border-color: var(--enzo-primary);
  background: var(--enzo-surface);
  box-shadow: 0 0 0 3.5px rgba(var(--enzo-primary-rgb), 0.18);
}
body.task-login #login-form .input-group-text {
  background: transparent !important;
  border: 0 !important;
  color: var(--font2) !important;
  min-width: 44px;
  justify-content: center;
  height: 48px;
}
body.task-login #login-form .input-group:focus-within .input-group-text {
  color: var(--enzo-primary) !important;
}

body.task-login #login-form input[type="text"],
body.task-login #login-form input[type="email"],
body.task-login #login-form input[type="password"],
body.task-login #login-form select {
  height: 48px !important;
  padding: 0.75rem 1rem 0.75rem 0 !important;
  font-size: 16px !important;            /* >=16px prevents iOS zoom-on-focus */
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--font) !important;
  box-shadow: none !important;
  outline: none !important;
}
body.task-login #login-form input::placeholder {
  color: var(--font2);
  opacity: 0.85;
}

/* Fallback when JS hasn't enhanced the form yet (no .input-group) */
body.task-login #login-form td.input > input {
  width: 100% !important;
  border: 1.5px solid var(--bordercolor) !important;
  border-radius: var(--enzo-radius-md) !important;
  background: var(--backgroundhoverlight) !important;
  padding-left: 1rem !important;
}

body.task-login #login-form .formbuttons { margin: 1.25rem 0 0 !important; }

body.task-login #rcmloginsubmit {
  width: 100% !important;
  height: 48px !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: var(--enzo-radius-md) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
  cursor: pointer;
  transition: transform 0.15s var(--enzo-ease), box-shadow 0.15s var(--enzo-ease), filter 0.15s;
}
body.task-login #rcmloginsubmit:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45) !important;
}
body.task-login #rcmloginsubmit:active { transform: scale(0.98); }

body.task-login #login-footer {
  margin-top: 1.25rem !important;
  color: var(--font2) !important;
  font-size: 0.8rem !important;
  text-align: center;
}
body.task-login #login-footer a { color: var(--enzo-primary) !important; font-weight: 500; }

/* Login error/info toasts sit above the card */
body.task-login #messagestack {
  top: calc(1rem + env(safe-area-inset-top, 0px)) !important;
}

@keyframes enzo-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   4. SIDEBAR / FOLDERS
   -------------------------------------------------------------------------- */
#layout-sidebar {
  border-right: 1px solid var(--bordercolor);
  background: var(--background);
}

#layout-sidebar .compose.button div {
  background: linear-gradient(135deg, var(--enzo-primary) 0%, var(--enzo-primary-hover) 100%) !important;
  color: #fff !important;
  border-radius: var(--enzo-radius-md) !important;
  font-weight: 600 !important;
  box-shadow: var(--enzo-shadow-md) !important;
  transition: box-shadow 0.2s var(--enzo-ease), transform 0.2s var(--enzo-ease) !important;
}
#layout-sidebar .compose.button div:hover {
  box-shadow: var(--enzo-shadow-lg) !important;
  transform: translateY(-1px);
}
#layout-sidebar .compose.button .composeicon { color: #fff !important; }

.treelist.folderlist li a {
  border-radius: var(--enzo-radius-md) !important;
  margin: 1px 0.5rem !important;
  font-weight: 500 !important;
  color: var(--font) !important;
  transition: background-color 0.15s var(--enzo-ease), color 0.15s var(--enzo-ease) !important;
}
.treelist.folderlist li a:hover {
  background-color: var(--backgroundhoverlight) !important;
}
.treelist.folderlist li.selected > a,
.treelist.folderlist li.selected > div > a {
  background-color: var(--enzo-primary-light) !important;
  color: var(--enzo-primary) !important;
  font-weight: 600 !important;
}
.treelist.folderlist li.unread > a,
.treelist.folderlist li.unread > div > a {
  font-weight: 700 !important;
}
.treelist.folderlist li .unreadcount {
  background: var(--enzo-primary) !important;
  color: #fff !important;
  border-radius: var(--enzo-radius-full) !important;
  padding: 0 0.5rem !important;
  min-width: 1.5rem;
  text-align: center;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  line-height: 1.35rem !important;
}

/* Quota widget as a slim progress bar */
#quotadisplay .count {
  font-size: 0.75rem;
  color: var(--font2);
}

/* --------------------------------------------------------------------------
   5. MESSAGE LIST
   -------------------------------------------------------------------------- */
#layout-list { background: var(--background) !important; }

.messagelist tr.message {
  transition: background-color 0.12s var(--enzo-ease);
}
.messagelist tr.message:hover {
  background-color: var(--backgroundhoverlight) !important;
}
.messagelist tr.message.selected,
.messagelist tr.message.focused.selected {
  background-color: var(--enzo-primary-light) !important;
}

/* Unread: accent bar + stronger sender */
.messagelist tr.message.unread > td:first-child {
  box-shadow: inset 3px 0 0 var(--enzo-primary);
}
.messagelist tr.unread td.subject span.fromto {
  font-weight: 700 !important;
  color: var(--font) !important;
}
.messagelist tr:not(.unread) td.subject span.subject a {
  color: var(--font2);
}
.messagelist tr.unread td.subject span.date {
  color: var(--enzo-primary) !important;
  font-weight: 600;
}

.messagelist span.flagged:before,
.messagelist tr.flagged span.flag {
  color: var(--enzo-warning) !important;
}

/* Hover delete icon (Elastic2022) gets a proper hit area & danger color */
.messagelist .insummary.deleteicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--enzo-radius-full);
  cursor: pointer;
}
.messagelist .insummary.deleteicon:hover {
  color: var(--enzo-danger) !important;
  background: rgba(239, 68, 68, 0.1);
}

/* Touch devices have no hover: keep date visible and the delete icon hidden.
   (Elastic2022 swaps date <-> delete on :hover, which sticks after a tap.) */
@media (hover: none) {
  .messagelist tr:hover span.date { display: inline !important; }
  .messagelist tr:hover span.size,
  .message:hover .size { left: -500px !important; position: absolute !important; }
}

/* Empty list / search placeholder */
.listing-info,
.messagelist .listing-info td {
  color: var(--font2) !important;
  font-style: normal;
}

/* --------------------------------------------------------------------------
   6. READING VIEW
   -------------------------------------------------------------------------- */
#message-header .subject {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
#message-header .header-headers .header-title {
  color: var(--font2);
}

/* Attachments as chips */
.attachmentslist li {
  border: 1px solid var(--bordercolor) !important;
  border-radius: var(--enzo-radius-md) !important;
  background: var(--enzo-surface) !important;
  transition: border-color 0.15s var(--enzo-ease), box-shadow 0.15s var(--enzo-ease);
}
.attachmentslist li:hover {
  border-color: rgba(var(--enzo-primary-rgb), 0.5) !important;
  box-shadow: var(--enzo-shadow-sm);
}

/* Remote-content / info boxes */
.boxinformation,
.boxwarning,
.boxerror,
.boxconfirmation {
  border-radius: var(--enzo-radius-md) !important;
  border: 0 !important;
}
.boxinformation { background-color: rgba(var(--enzo-primary-rgb), 0.10) !important; }

/* --------------------------------------------------------------------------
   7. POPOVERS, DROPDOWNS, USER MENU, DIALOGS
   -------------------------------------------------------------------------- */
.popover {
  border: 1px solid var(--bordercolor) !important;
  border-radius: var(--enzo-radius-lg) !important;
  box-shadow: var(--enzo-shadow-lg) !important;
  overflow: hidden;
}
.popover .menu li a,
.popover .listing li a {
  min-height: 40px;
  display: flex !important;
  align-items: center;
  border-radius: var(--enzo-radius-sm);
  transition: background-color 0.12s var(--enzo-ease);
}
.popover .menu li a:not(.disabled):hover,
.popover .listing li a:not(.disabled):hover {
  background-color: var(--backgroundhoverlight) !important;
}

.hovermenu {
  border-radius: var(--enzo-radius-lg) !important;
  border: 1px solid var(--bordercolor) !important;
  box-shadow: var(--enzo-shadow-lg) !important;
  background: var(--backgroundbutton) !important;
  padding: 0.35rem !important;
  overflow: hidden;
}
.hovermenu .menuopt {
  min-height: 40px;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--enzo-radius-sm);
  color: var(--font) !important;
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: background-color 0.12s var(--enzo-ease), color 0.12s;
}
.hovermenu .menuopt:hover {
  background-color: var(--backgroundhoverlight) !important;
  color: var(--enzo-primary) !important;
}

/* jQuery-UI dialogs */
.ui-dialog {
  border-radius: var(--enzo-radius-lg) !important;
  overflow: hidden;
  box-shadow: var(--enzo-shadow-lg) !important;
  border: 1px solid var(--bordercolor) !important;
}
.ui-dialog .ui-dialog-titlebar {
  border-bottom: 1px solid var(--bordercolor) !important;
}

/* Toast notifications */
#messagestack div {
  border-radius: var(--enzo-radius-md) !important;
  box-shadow: var(--enzo-shadow-lg) !important;
  border: 0 !important;
}

/* --------------------------------------------------------------------------
   8. SETTINGS
   -------------------------------------------------------------------------- */
.formcontent fieldset {
  background: var(--enzo-surface);
  border: 1px solid var(--bordercolor) !important;
  border-radius: var(--enzo-radius-lg) !important;
  padding: 1rem 1.25rem 0.5rem !important;
  margin-bottom: 1rem !important;
}
.formcontent fieldset > legend {
  font-weight: 700 !important;
  font-size: 1rem !important;
  color: var(--font) !important;
  padding: 0 0.35rem !important;
  width: auto !important;
}

/* Skin chooser: cards with clear selected state */
.skinselection {
  border: 1.5px solid var(--bordercolor);
  border-radius: var(--enzo-radius-md);
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s var(--enzo-ease), background-color 0.15s;
  cursor: pointer;
}
.skinselection:hover { border-color: rgba(var(--enzo-primary-rgb), 0.5); }
.skinselection:has(input:checked) {
  border-color: var(--enzo-primary);
  background: var(--enzo-primary-light);
}
.skinselection .skinthumbnail { border-radius: var(--enzo-radius-sm); }

/* --------------------------------------------------------------------------
   9. COMPOSE
   -------------------------------------------------------------------------- */
.compose-headers td.title,
.compose-headers td:nth-child(1) {
  font-weight: 600;
  color: var(--font2);
}
.compose-headers input[type="text"],
.compose-headers textarea,
.compose-headers .recipient-input {
  border-radius: var(--enzo-radius-sm) !important;
}
.compose-headers .recipient-input:focus-within,
.compose-headers input[type="text"]:focus,
.compose-headers textarea:focus {
  border-color: var(--enzo-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--enzo-primary-rgb), 0.15) !important;
}
/* Recipient tokens as pills */
.recipient-input .recipient {
  border-radius: var(--enzo-radius-full) !important;
  background: var(--enzo-primary-light) !important;
  border: 1px solid rgba(var(--enzo-primary-rgb), 0.25) !important;
  padding: 0 0.6rem !important;
}

/* --------------------------------------------------------------------------
   10. MOBILE COMPOSE FAB  (markup lives in templates/mail.html)
   -------------------------------------------------------------------------- */
.enzo-fab { display: none; }

@media screen and (max-width: 768px) {
#layout-list { position: relative; }
  .enzo-fab {
    display: flex;
    position: absolute;
    right: 18px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    border-radius: 18px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--enzo-primary) 0%, var(--enzo-primary-hover) 100%);
    color: #fff !important;
    box-shadow: var(--enzo-shadow-fab);
    z-index: 1040;
    text-decoration: none !important;
    transition: transform 0.15s var(--enzo-ease), box-shadow 0.15s var(--enzo-ease);
    animation: enzo-pop 0.25s var(--enzo-ease) both;
  }
  .enzo-fab:active { transform: scale(0.92); }
  .enzo-fab .sebicon { font-size: 1.35rem; color: #fff !important; margin: 0 !important; }

  /* keep the last messages reachable above the FAB */
  #messagelist-content {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@keyframes enzo-pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   11. MOBILE (<= 768px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  /* Comfortable touch targets, scoped to lists and menus only */
  .treelist.folderlist li a { min-height: 44px; display: flex !important; align-items: center; }
  .listing li a, .popover .menu li a { min-height: 44px; }

  /* Bottom bar in the sidebar drawer: app-like, notch-aware */
  .menu_bottom {
    height: auto !important;
    min-height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    background: var(--background) !important;
  }
  .menu_bottom a {
    float: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px;
    height: 52px !important;
    padding: 0.25rem 0.75rem !important;
    font-size: 0.72rem !important;
    line-height: 1.1 !important;
    color: var(--font2) !important;
    border-radius: var(--enzo-radius-md) !important;
  }
  .menu_bottom a::before { margin: 0 !important; font-size: 1.3em !important; }
  .menu_bottom a.selected {
    color: var(--enzo-primary) !important;
    background-color: var(--enzo-primary-light) !important;
    font-weight: 600 !important;
  }

  /* Popovers become bottom-sheet-ish: larger radius, full-width options */
  .popover { border-radius: 16px !important; }

  /* Toasts above the home indicator */
  #messagestack {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Inputs >=16px so iOS doesn't zoom when focusing */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], select, textarea {
    font-size: 16px !important;
  }

  body.task-login #login-form { padding: 1.5rem 1.25rem 1.25rem !important; }
}

/* --------------------------------------------------------------------------
   12. LARGE SCREENS
   -------------------------------------------------------------------------- */
@media screen and (min-width: 1200px) {
  /* Comfortable reading width for the message pane header */
  #message-header { max-width: 1100px; }
}

/* --------------------------------------------------------------------------
   13. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Hide the inline delete icon on mobile so it doesn't get accidentally tapped */
@media screen and (max-width: 768px) {
  .deleteicon.insummary {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   12. MESSAGE VIEW (READING)
   -------------------------------------------------------------------------- */
#message-header {
  padding: 1.5rem 2rem 1rem !important;
  border-bottom: 1px solid var(--bordercolor) !important;
  background: var(--background) !important;
}

#message-header > .subject {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.015em;
  color: var(--font) !important;
  margin-bottom: 1.25rem !important;
  line-height: 1.2 !important;
}

#message-header > .header {
  align-items: center !important;
}

#message-header .header-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#message-header .header-content .header-title {
  font-weight: 600 !important;
  color: var(--font) !important;
  font-size: 0.95rem !important;
}

#message-header .header-content .date {
  color: var(--font2) !important;
  font-size: 0.85rem !important;
}

/* Mail Body Padding */
#message-content, #message-htmlpart1 {
  padding: 1.5rem 2rem !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  color: var(--font) !important;
}

@media screen and (max-width: 768px) {
  #message-header { padding: 1.25rem 1rem 1rem !important; }
  #message-header > .subject { font-size: 1.25rem !important; }
  #message-content, #message-htmlpart1 { padding: 1.25rem 1rem !important; }
}


/* --------------------------------------------------------------------------
   13. MESSAGE LIST (INBOX)
   -------------------------------------------------------------------------- */
#messagelist tr {
  transition: background-color 0.15s var(--enzo-ease) !important;
  border-bottom: 1px solid var(--bordercolor) !important;
}
#messagelist tr:hover {
  background-color: var(--backgroundhoverlight) !important;
}
#messagelist tr.unread td,
#messagelist tr.unread .subject a {
  font-weight: 700 !important;
  color: var(--font) !important;
}
#messagelist tr.unread td:first-child {
  box-shadow: inset 4px 0 0 0 var(--enzo-primary) !important;
}
#messagelist tr.selected td {
  background-color: var(--enzo-primary-light) !important;
}
#messagelist .selection .sel_circle {
  transition: transform 0.2s var(--enzo-ease) !important;
}
#messagelist tr:active .selection .sel_circle {
  transform: scale(0.9);
}

/* Standard buttons */
.btn-secondary,
.button:not(.mainaction):not(.icon):not(.compose),
button:not(.mainaction):not(.icon) {
  border-radius: var(--enzo-radius-sm) !important;
  transition: all 0.15s var(--enzo-ease) !important;
}
.btn-secondary:hover,
.button:not(.mainaction):not(.icon):not(.compose):hover,
button:not(.mainaction):not(.icon):hover {
  background-color: var(--backgroundhoverlight) !important;
}

/* --------------------------------------------------------------------------
   14. MODERN UI/UX IMPROVEMENTS (v1.2)
   -------------------------------------------------------------------------- */

/* Smoother splitters */
.splitter {
  width: 4px !important;
  background: var(--backgroundhoverlight) !important;
  transition: background-color 0.15s ease !important;
  border: 0 !important;
}
.splitter:hover, .splitter.ui-draggable-dragging {
  background: var(--enzo-primary-light) !important;
}

/* Rounded content area (macOS style app layout) */
html.layout-widescreen #layout {
  padding: 12px;
  box-sizing: border-box;
  background: var(--bordercolor); /* Use border color as subtle backdrop */
}
html.layout-widescreen #layout-sidebar,
html.layout-widescreen #layout-list,
html.layout-widescreen #layout-content {
  border-radius: var(--enzo-radius-lg);
  border: 1px solid var(--bordercolor) !important;
  margin-right: 4px;
  background: var(--background) !important;
  overflow: hidden;
  box-shadow: var(--enzo-shadow-sm);
}
html.layout-widescreen #layout-content {
  margin-right: 0;
}
html.layout-widescreen .splitter {
  background: transparent !important;
}

/* Sidebar clean up */
#layout-sidebar .header {
  padding: 1.25rem 1rem 0.5rem !important;
}
.treelist.folderlist li a {
  margin: 2px 0.75rem !important;
}

/* Inputs & Form fields globally */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], select, textarea {
  border-radius: var(--enzo-radius-sm) !important;
  transition: border-color 0.2s var(--enzo-ease), box-shadow 0.2s var(--enzo-ease) !important;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="search"]:focus, select:focus, textarea:focus {
  border-color: var(--enzo-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--enzo-primary-rgb), 0.15) !important;
  outline: none !important;
}

/* Settings menus & generic lists */
#settings-elements .listbox .listitem,
#settings-sections .listbox .listitem,
#settings-sections .treelist li a,
.preferenceslist .listitem {
  border-radius: var(--enzo-radius-md) !important;
  margin: 2px 0.5rem !important;
  padding-left: 0.75rem !important;
}
#settings-elements .listbox .listitem.selected,
#settings-sections .listbox .listitem.selected,
#settings-sections .treelist li.selected > a,
.preferenceslist .listitem.selected {
  background-color: var(--enzo-primary-light) !important;
  color: var(--enzo-primary) !important;
  font-weight: 600 !important;
}

/* Dark mode tweaks for the new layout */
html.dark-mode.layout-widescreen #layout {
  background: #000;
}
html.dark-mode.layout-widescreen #layout-sidebar,
html.dark-mode.layout-widescreen #layout-list,
html.dark-mode.layout-widescreen #layout-content {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

/* Fix mobile padding overriding macOS layout */
@media screen and (max-width: 768px) {
  html.layout-widescreen #layout,
  html.layout-normal #layout {
    padding: 0 !important;
    background: var(--background) !important;
  }
  html.layout-widescreen #layout-sidebar,
  html.layout-widescreen #layout-list,
  html.layout-widescreen #layout-content,
  html.layout-normal #layout-sidebar,
  html.layout-normal #layout-list,
  html.layout-normal #layout-content {
    border-radius: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }
}
/* 
 * ENZO DESKTOP REFINEMENTS
 * Loaded at the end of enzo.css
 */

/* 1. Global Backgrounds & Layout */
body { background: #ffffff !important; }
#layout-sidebar {
    background: #f8fafc !important; /* Soft slate 50 */
    border-right: 1px solid #e2e8f0 !important;
}
#layout-list {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}
#layout-content {
    background: #ffffff !important;
}

/* Remove the floating gaps from earlier - go for unified clean look */
html.layout-widescreen #layout {
    padding: 0 !important;
    background: #ffffff !important;
}
html.layout-widescreen #layout-sidebar,
html.layout-widescreen #layout-list,
html.layout-widescreen #layout-content {
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    box-shadow: none !important;
}
html.layout-widescreen #layout-sidebar { border-right: 1px solid #e2e8f0 !important; }
html.layout-widescreen #layout-list { border-right: 1px solid #e2e8f0 !important; }

/* 2. Sidebar Refinements */
#layout-sidebar .header {
    padding: 1.5rem 1rem 1rem !important;
}
#layout-sidebar .compose.button div {
    background: var(--enzo-primary) !important;
    border-radius: 12px !important;
    padding: 10px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2), 0 2px 4px -2px rgba(37, 99, 235, 0.1) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease !important;
}
#layout-sidebar .compose.button div:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.25) !important;
    background: var(--enzo-primary-hover) !important;
}
#layout-sidebar .compose.button .composeicon { margin: 0 !important; float: none !important; }

.treelist.folderlist li a {
    margin: 4px 12px !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    display: flex !important;
    align-items: center;
}
.treelist.folderlist li a:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.treelist.folderlist li.selected > a,
.treelist.folderlist li.selected > div > a {
    background: #eff6ff !important;
    color: var(--enzo-primary) !important;
    font-weight: 600 !important;
}

/* Badges (Unread Count) */
.treelist.folderlist li .unreadcount {
    background: #e2e8f0 !important;
    color: #475569 !important;
    border-radius: 20px !important;
    padding: 2px 8px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    min-width: auto !important;
    height: auto !important;
    line-height: normal !important;
    float: right;
    margin-top: 0 !important;
    box-shadow: none !important;
}
/* Unread folders badge */
.treelist.folderlist li.unread > a .unreadcount,
.treelist.folderlist li.unread > div > a .unreadcount {
    background: var(--enzo-primary) !important;
    color: #ffffff !important;
}

/* 3. Message List Refinements */
#messagelist-header {
    background: #ffffff !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    height: auto !important;
    min-height: auto !important;
}
#messagelist-header .toolbar {
    padding: 0 !important;
}

/* Search Bar */
.searchbar {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 0 12px !important;
    transition: all 0.2s ease;
}
.searchbar:focus-within {
    background: #ffffff !important;
    border-color: var(--enzo-primary) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
}
.searchbar input {
    background: transparent !important;
}

#messagelist tr {
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.15s ease !important;
}
#messagelist tr td {
    padding: 12px 8px !important;
}
#messagelist tr.unread td:first-child {
    box-shadow: inset 3px 0 0 0 var(--enzo-primary) !important;
}
#messagelist tr.unread .subject a {
    font-weight: 700 !important;
    color: #0f172a !important;
}
#messagelist tr.selected td {
    background-color: #eff6ff !important;
}

/* 4. Message View Refinements */
#message-header {
    padding: 24px 32px 16px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
}
#message-header > .subject {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin-bottom: 20px !important;
    letter-spacing: -0.02em;
}

/* Header Table (Remitente, Destinatario) */
.header-headers {
    width: 100%;
    border-collapse: collapse;
}
.header-headers td.title {
    color: #64748b !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600 !important;
    padding: 4px 16px 4px 0 !important;
    vertical-align: top;
    width: 90px;
}
.header-headers td.header {
    color: #0f172a !important;
    font-size: 0.9rem !important;
    padding: 4px 0 !important;
}

/* Attachments */
.attachmentslist li {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    margin: 4px 8px 4px 0 !important;
    display: inline-flex !important;
    align-items: center;
    transition: all 0.2s ease;
}
.attachmentslist li:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

/* Bottom Menu Refinements (Correo, Contactos) */
.menu_bottom {
    background: transparent !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 8px 0 !important;
    justify-content: space-evenly !important;
}
.menu_bottom a {
    color: #64748b !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}
.menu_bottom a:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.menu_bottom a.selected {
    background: #eff6ff !important;
    color: var(--enzo-primary) !important;
}

/* Remove dark triple dots from folder list, keep it clean */
.sidebar-menu { opacity: 0.4 !important; transition: opacity 0.2s; }
.sidebar-menu:hover { opacity: 1 !important; }

/* Fix folder list link flex layout preventing floats */
.treelist.folderlist li a,
.treelist.folderlist li div > a {
    display: block !important;
    position: relative;
    padding: 8px 12px 8px 36px !important; /* Leave space for icon */
    margin: 4px 12px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    text-decoration: none !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Position the unread badge properly */
.treelist.folderlist li .unreadcount {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0 !important;
    color: #475569 !important;
    border-radius: 12px !important;
    padding: 2px 6px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    float: none !important;
    margin: 0 !important;
}
.treelist.folderlist li.unread > a .unreadcount,
.treelist.folderlist li.unread > div > a .unreadcount {
    background: var(--enzo-primary) !important;
    color: #ffffff !important;
}

/* Fix massive Redactar button wrapper if it has default styles */
#layout-sidebar a.compose.button {
    display: block !important;
    margin: 0 12px 16px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
#layout-sidebar a.compose.button div {
    background: var(--enzo-primary) !important;
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Remove ugly blue outline on selected row in message list */
#messagelist tr, #messagelist tr td, #messagelist tr a {
    outline: none !important;
}
#messagelist tr.selected {
    outline: none !important;
    box-shadow: none !important;
}
#messagelist tr.selected td {
    background-color: #eff6ff !important;
    border-color: #eff6ff !important;
}
/* Reduce the unread left border from 3px to a dot or subtle 2px */
#messagelist tr.unread td:first-child {
    box-shadow: inset 2px 0 0 0 var(--enzo-primary) !important;
}

/* Tone down the Message View Subject further */
#message-header > .subject {
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    margin-bottom: 12px !important;
}

/* Hide "Remitente" / "Destinatario" labels completely for a super clean look */
.header-headers td.title {
    display: none !important;
}
.header-headers td.header {
    font-size: 0.85rem !important;
    color: #475569 !important;
    padding: 2px 0 !important;
}
.header-headers tr:first-child td.header {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
}

/* Make attachments look more like modern tags/cards */
.attachmentslist li {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}
/* ==========================================================================
   ENZO V2 REDESIGN - THE APPLE MAIL / LINEAR AESTHETIC
   ========================================================================== */

/* 1. Typography & Global */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
body, .ui-widget, input, select, textarea, button, 
#message-content, #message-htmlpart1 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}
body {
    background-color: #ffffff !important;
}

/* 2. Seamless Layout (No borders between panes, just subtle shadows or pure lines) */
html.layout-widescreen #layout {
    padding: 0 !important;
    background: #ffffff !important;
}
html.layout-widescreen #layout-sidebar {
    background: #f8fafc !important; /* Extremely light slate */
    border-right: 1px solid #e2e8f0 !important;
}
html.layout-widescreen #layout-list {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}
html.layout-widescreen #layout-content {
    background: #ffffff !important;
}

/* 3. The "Redactar" Button (Compose) - Make it gorgeous */
#layout-sidebar .header {
    padding: 20px 16px 12px !important;
    border: none !important;
    background: transparent !important;
}
#layout-sidebar a.compose.button {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}
#layout-sidebar a.compose.button div {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    padding: 10px 0 !important;
    text-align: center;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(37,99,235,0.2), inset 0 1px 0 rgba(255,255,255,0.2) !important;
    border: 1px solid #1d4ed8 !important;
    transition: all 0.2s ease !important;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}
#layout-sidebar a.compose.button div:hover {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important;
    box-shadow: 0 4px 8px rgba(37,99,235,0.3), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}
#layout-sidebar a.compose.button .composeicon {
    margin: 0 !important;
    float: none !important;
}

/* 4. Folders List */
.treelist.folderlist {
    padding: 0 8px !important;
}
.treelist.folderlist li {
    margin-bottom: 2px !important;
}
.treelist.folderlist li > a,
.treelist.folderlist li > div > a {
    padding: 8px 12px 8px 36px !important;
    border-radius: 8px !important;
    color: #475569 !important;
    font-weight: 500 !important;
    transition: background 0.15s ease, color 0.15s ease !important;
    border: none !important;
}
.treelist.folderlist li > a:hover,
.treelist.folderlist li > div > a:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
/* Selected Folder */
.treelist.folderlist li.selected > a,
.treelist.folderlist li.selected > div > a {
    background: #e0e7ff !important; /* Soft indigo/blue */
    color: #3730a3 !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}
/* Unread Folder */
.treelist.folderlist li.unread > a,
.treelist.folderlist li.unread > div > a {
    font-weight: 700 !important;
    color: #0f172a !important;
}

/* 5. Message List */
#messagelist-header {
    background: #ffffff !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
.searchbar {
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02) !important;
}
.searchbar:focus-within {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
}

/* Message List Rows */
#messagelist tr td {
    padding: 12px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}
/* Selected Message */
#messagelist tr.selected td {
    background: #eff6ff !important;
}
#messagelist tr.selected {
    outline: none !important;
}
/* Unread Indicator */
#messagelist tr.unread td:first-child {
    box-shadow: inset 3px 0 0 0 #2563eb !important;
}
#messagelist tr.unread .subject a {
    font-weight: 700 !important;
    color: #0f172a !important;
}
#messagelist tr .subject a {
    font-weight: 500 !important;
    color: #334155 !important;
    font-size: 0.95rem !important;
}
#messagelist tr .msgfrom {
    font-weight: 600 !important;
    color: #0f172a !important;
}

/* 6. Action Bar (When selecting messages) */
.listbox .header .toolbar {
    background: #ffffff !important;
}
/* Make the top action bar look like a clean toolbar, not a weird grey box */
#messagelist-header.selection {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    border-bottom: 1px solid #c7d2fe !important;
}
#messagelist-header.selection .count {
    font-weight: 600 !important;
}

/* 7. Message View (Right Pane) */
#message-header {
    padding: 24px 32px 20px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
/* Subject */
#message-header > .subject {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin-bottom: 16px !important;
    line-height: 1.3 !important;
    letter-spacing: -0.02em !important;
}
/* Metadata Table (Sender, Date, To) */
#message-header .headers-table {
    margin-top: 12px !important;
}
#message-header .headers-table td.title {
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    padding-right: 16px !important;
    padding-bottom: 4px !important;
    vertical-align: middle !important;
    width: auto !important;
}
#message-header .headers-table td.header {
    font-size: 0.9rem !important;
    color: #334155 !important;
    padding-bottom: 4px !important;
}
#message-header .headers-table tr:first-child td.header {
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
}

/* Move the ugly 'Extwin' button */
#message-header a.extwin {
    float: right;
    margin-top: -40px;
    opacity: 0.5;
    transition: opacity 0.2s;
}
#message-header a.extwin:hover {
    opacity: 1;
}

/* Email Body */
#message-content, #message-htmlpart1 {
    padding: 32px !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: #1e293b !important;
}
/* Iframe font overrides for plain text emails */
iframe#messagecontframe {
    background: #ffffff !important;
}

/* 8. Bottom Menu */
.menu_bottom {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 8px 16px !important;
}
.menu_bottom a {
    border-radius: 8px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-bottom: 2px !important;
    padding: 8px 12px !important;
}
.menu_bottom a:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.menu_bottom a.selected {
    background: #e0e7ff !important;
    color: #3730a3 !important;
}

/* ENZO V3 POLISH - FIXING C.PNG */

/* Hide the ugly Extwin (expand) button that floats awkwardly */
#message-content a.extwin,
#message-htmlpart1 a.extwin,
a.extwin {
    display: none !important;
}

/* Redactar Button - Modern Gradient Pill */
#layout-sidebar a.compose.button div {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    padding: 12px 0 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(37,99,235,0.25) !important;
    border: none !important;
    text-align: center;
}
#layout-sidebar a.compose.button div:hover {
    box-shadow: 0 6px 16px rgba(37,99,235,0.35) !important;
    transform: translateY(-1px);
}

/* Sidebar Folders - Clean and borderless */
.treelist.folderlist li > a,
.treelist.folderlist li > div > a {
    border-left: none !important; /* Remove the blue left border from active state */
    padding-left: 12px !important;
}
.treelist.folderlist li.selected > a,
.treelist.folderlist li.selected > div > a {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Header Metadata (Remitente, Destinatario) - Clean them up */
#message-header .header-title {
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    padding-right: 16px !important;
    padding-bottom: 4px !important;
    vertical-align: top !important;
    width: 90px !important;
}
#message-header .header-links {
    margin-top: 12px !important;
}

/* Action Toolbar (when messages are selected) */
#messagelist-header.selection {
    background: #1e293b !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    margin: 8px !important;
    width: calc(100% - 16px) !important;
    box-sizing: border-box !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1) !important;
    border: none !important;
}
#messagelist-header.selection a.button {
    color: #ffffff !important;
}
#messagelist-header.selection .count {
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Message List Rows */
#messagelist tr td {
    padding: 14px 16px !important;
}
#messagelist tr.selected td {
    background: #eff6ff !important;
    border-color: #eff6ff !important;
}
#messagelist tr.selected .subject a,
#messagelist tr.selected .msgfrom {
    color: #1e3a8a !important;
}


#messagelist-header.selection {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    z-index: 100 !important;
}
/* Enzo Mobile FAB overide for native FAB */
.floating-action-buttons {
    position: absolute !important;
    right: 18px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1000 !important;
}
.floating-action-buttons .button {
    display: flex !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 18px !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, var(--enzo-primary) 0%, var(--enzo-primary-hover) 100%) !important;
    box-shadow: 0 10px 20px -3px rgba(37,99,235,0.4), 0 4px 6px -2px rgba(37,99,235,0.25) !important;
    color: #fff !important;
    text-decoration: none !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.floating-action-buttons .button:active {
    transform: scale(0.92) !important;
}
.floating-action-buttons .button .inner {
    display: none !important;
}
.floating-action-buttons .button:before {
    content: "\f040" !important;
    font-family: "Icons" !important;
    font-style: normal;
    font-weight: 900;
    font-size: 1.35rem;
    color: #fff !important;
}
.floating-action-buttons .button:before {
    content: "\f304" !important;
    font-family: "Icons" !important;
    font-weight: 900;
    font-size: 1.25rem !important;
    color: #fff !important;
    margin: 0 !important;
}

/* FIX INVISIBLE MOBILE SHIELD BUG */
body.task-login #messagestack {
    bottom: auto !important; /* Prevents it from stretching from top to bottom on mobile! */
    height: auto !important;
    pointer-events: none !important; /* Let clicks pass through the container */
}
body.task-login #messagestack > div {
    pointer-events: auto !important; /* But let the actual toasts be clickable if needed */
}
