/**
 * Actiefhost webmail theme
 *
 * Loaded after styles.css (Elastic) to give the webmail the look of
 * actiefhost.be: IBM Plex Sans, navy/royal/gold palette, rounded cards.
 */

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Font Awesome 6 (same icon set as actiefhost.be) replaces Elastic's FA5 */
@font-face {
  font-family: Icons;
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url(../fonts/fa6-solid-900.woff2) format('woff2');
}

@font-face {
  font-family: Icons;
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url(../fonts/fa6-regular-400.woff2) format('woff2');
}

:root {
  --ah-navy: #131b5f;
  --ah-navy-2: #1a2785;
  --ah-royal: #2a3bb0;
  --ah-steel: #3d7fd0;
  --ah-gold: #f2b705;
  --ah-gold-2: #ffcf2d;
  --ah-text: #111827;
  --ah-muted: #64748b;
  --ah-bg: #eef2fb;
  --ah-soft: #eef1fb;
  --ah-hover: #f5f7fd;
  --ah-border: #e6eaf2;
  --ah-input-border: #dfe5f5;
  --ah-radius: 16px;
  --ah-shadow: 0 0 0 1px #e6eaf2, 0 10px 26px rgba(15, 23, 42, .05);
  --ah-btn: linear-gradient(135deg, #17236d, #273eab);
  --ah-btn-hover: linear-gradient(135deg, #0f174d, #1d318d);
}

html.dark-mode {
  --ah-bg: #161b1d;
  --ah-border: #374549;
  --ah-shadow: 0 0 0 1px #2c373a, 0 10px 26px rgba(0, 0, 0, .25);
}

body, button, input, select, textarea, .btn, .form-control, .custom-select, .popover, .ui-dialog {
  font-family: "IBM Plex Sans", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- Buttons & form controls ---------- */

.btn {
  border-radius: 10px;
  font-weight: 600;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.btn-primary, .btn.mainaction, button.mainaction {
  color: #fff;
  border: 0;
  background: var(--ah-btn);
  box-shadow: 0 8px 18px rgba(19, 27, 95, .2);
}

.btn-primary:hover, .btn-primary:focus, .btn.mainaction:hover, button.mainaction:hover {
  color: #fff;
  background: var(--ah-btn-hover);
  box-shadow: 0 11px 22px rgba(19, 27, 95, .28);
}

.btn-primary:focus-visible { outline: 3px solid rgba(39, 62, 171, .35); outline-offset: 3px; }

html:not(.dark-mode) .btn-secondary {
  color: var(--ah-navy);
  background: #fff;
  border: 1px solid var(--ah-input-border);
}

html:not(.dark-mode) .btn-secondary:hover, html:not(.dark-mode) .btn-secondary:focus {
  color: var(--ah-royal);
  background: var(--ah-soft);
  border-color: #c7d0ea;
}

.form-control, .custom-select, input.form-control, textarea.form-control {
  border-radius: 10px;
}

html:not(.dark-mode) .form-control, html:not(.dark-mode) .custom-select {
  border-color: var(--ah-input-border);
}

.form-control:focus, .custom-select:focus {
  border-color: var(--ah-royal);
  box-shadow: 0 0 0 4px rgba(42, 59, 176, .12);
}

.input-group > .form-control:not(:first-child), .input-group > .custom-select:not(:first-child) { border-radius: 0 10px 10px 0; }
.input-group > .form-control:not(:last-child), .input-group > .custom-select:not(:last-child) { border-radius: 10px 0 0 10px; }
.input-group > .form-control:not(:first-child):not(:last-child) { border-radius: 0; }

a, .link { color: var(--ah-royal); }
html.dark-mode a, html.dark-mode .link { color: #8fa6ff; }

/* ---------- Task menu (left navy column) ---------- */

#layout-menu {
  background: var(--ah-navy);
}

/* Elastic forces its gray here (and hides links) with !important: override with higher specificity */
html body #layout-menu .popover-header {
  background: transparent !important;
}

html body #layout-menu .popover-header a.ah-home-link {
  display: block !important;
  border-radius: 12px;
  transition: background-color .18s ease;
}

#layout-menu .ah-home-link:hover,
#layout-menu .ah-home-link:focus { background: rgba(255, 255, 255, .08); }

#layout-menu .ah-home-link #logo {
  display: block;
  width: 100%;
  max-width: 44px;
  height: auto;
  margin: 0 auto;
  padding: 0;
  background: transparent;
}

#taskmenu .special-buttons {
  background: var(--ah-navy);
}

/* Desktop: slim icon-only menu, labels shown as tooltips */
@media screen and (min-width: 1025px) {
  #layout-menu { width: 72px; }

  #layout-menu .popover-header { padding: 14px 10px 10px !important; }

  #taskmenu a,
  html.dark-mode #taskmenu a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    height: 50px;
    margin: 4px 10px !important;
    padding: 0 !important;
    border-radius: 14px;
  }

  #taskmenu a:before {
    width: auto !important;
    margin: 0 !important;
    font-size: 1.55rem;
    line-height: 1;
  }

  #taskmenu .action-buttons a.compose { margin: 8px 10px 12px !important; }

  #taskmenu a .inner {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Compose lives in the folder list header when that column is visible */
@media screen and (min-width: 1201px) {
  body.task-mail #taskmenu .action-buttons { display: none; }

  #layout-sidebar > .header.ah-has-compose { padding: 0 6px 0 12px; justify-content: flex-start; }
  #layout-sidebar > .header.ah-has-compose .header-title,
  #layout-sidebar > .header.ah-has-compose a.sidebar-menu { display: none !important; }
  #layout-sidebar > .header.ah-has-compose .ah-compose { margin-right: 6px !important; }
}

#layout-sidebar > .header .ah-compose { display: none; }

@media screen and (min-width: 1201px) {
  #layout-sidebar > .header .ah-compose {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 40px;
    margin: auto 6px auto 0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    color: var(--ah-navy);
    background: linear-gradient(135deg, var(--ah-gold-2), var(--ah-gold));
    box-shadow: 0 6px 14px rgba(242, 183, 5, .28);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  }

  #layout-sidebar > .header .ah-compose:before {
    content: "\f044";
    font-family: Icons;
    font-weight: 900;
    font-size: 14px;
  }

  #layout-sidebar > .header .ah-compose:hover,
  #layout-sidebar > .header .ah-compose:focus {
    color: var(--ah-navy);
    background: linear-gradient(135deg, #ffd84f, #f6c21c);
    box-shadow: 0 9px 18px rgba(242, 183, 5, .34);
    transform: translateY(-1px);
  }
}

@media screen and (min-width: 481px) {
  #layout-menu { position: relative; }
  #taskmenu .special-buttons { right: 0; }

  #taskmenu a {
    color: rgba(255, 255, 255, .72);
    border-radius: 12px;
    margin: 3px 6px;
    font-size: 12px;
    position: relative;
    transition: background-color .18s ease, color .18s ease;
  }

  #taskmenu a:hover, #taskmenu a:focus {
    color: #fff;
    background: rgba(255, 255, 255, .08);
  }

  #taskmenu a.selected, #taskmenu a.selected:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
  }

  #taskmenu a.selected:after {
    content: "";
    position: absolute;
    left: 0;
    top: 24%;
    bottom: 24%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ah-gold-2);
  }

  #taskmenu .action-buttons a.compose {
    color: var(--ah-navy);
    background: linear-gradient(135deg, var(--ah-gold-2), var(--ah-gold));
    box-shadow: 0 6px 14px rgba(242, 183, 5, .28);
    margin-top: 10px;
    margin-bottom: 10px;
  }

  #taskmenu .action-buttons a.compose:hover,
  #taskmenu .action-buttons a.compose:focus,
  #taskmenu .action-buttons a.compose.selected {
    color: var(--ah-navy);
    background: linear-gradient(135deg, #ffd84f, #f6c21c);
  }

  #taskmenu .action-buttons a.compose.selected:after { display: none; }

  html.dark-mode #taskmenu a { width: auto; background: transparent; }
  html.dark-mode #taskmenu a:hover, html.dark-mode #taskmenu a.selected { background: rgba(255, 255, 255, .07); }
  html.dark-mode #taskmenu .action-buttons a.compose { color: var(--ah-navy); }
  html.dark-mode #taskmenu .special-buttons a:not(:hover):not(:focus) { background-color: transparent !important; }

  #taskmenu a.logout { color: #ff9c99; }
  #taskmenu a.logout:hover { color: #ffb4b2; }
}

/* ---------- Layout: panes as rounded cards (desktop) ---------- */

@media screen and (min-width: 1201px) {
  body:not(.iframe):not(.task-login) #layout {
    padding-right: 12px;
    background: var(--ah-bg);
  }

  #layout > #layout-sidebar,
  #layout > #layout-list,
  #layout > #layout-content {
    height: auto;
    margin: 12px 0 12px 12px;
    border: 0 !important;
    border-radius: var(--ah-radius);
    box-shadow: var(--ah-shadow);
    overflow: hidden;
  }

  body.task-login #layout > #layout-content {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Pane headers & footers */

html:not(.dark-mode) #layout > div > .header,
html:not(.dark-mode) #layout > div > .footer {
  background-color: #fff;
}

html:not(.dark-mode) #layout > div > .header {
  border-bottom-color: #eef1f6;
  color: var(--ah-navy);
}

html:not(.dark-mode) #layout > div > .footer {
  border-top-color: #eef1f6;
}

#layout > div > .header .header-title {
  font-weight: 600;
  letter-spacing: -.005em;
}

html:not(.dark-mode) #layout > div > .header a.button,
html:not(.dark-mode) .toolbar a.button {
  color: #475569;
}

html:not(.dark-mode) #layout > div > .header a.button:hover,
html:not(.dark-mode) .toolbar a.button:not(.disabled):hover {
  color: var(--ah-royal);
}

/* ---------- Folder / settings lists ---------- */

@media screen and (min-width: 769px) {
  #layout-sidebar ul.treelist li > a,
  #layout-sidebar .listing li > a,
  #settings-menu li > a {
    border-radius: 12px;
    margin: 2px 10px;
    width: auto;
  }

  #layout-sidebar .scroller > :first-child,
  #layout-sidebar #settings-menu {
    padding-top: 6px;
  }
}

html:not(.dark-mode) ul.treelist li > a:hover,
html:not(.dark-mode) #settings-menu li > a:hover {
  background-color: var(--ah-hover);
}

ul.treelist li.selected > a,
ul.treelist li.selected > div > a,
#settings-menu li.selected,
#settings-menu li.selected > a {
  font-weight: 600;
}

html:not(.dark-mode) ul.treelist li.selected > a,
html:not(.dark-mode) ul.treelist li.selected > div > a,
html:not(.dark-mode) #settings-menu li.selected > a {
  color: var(--ah-royal);
  background-color: var(--ah-soft);
}

html:not(.dark-mode) #settings-menu li.selected,
ul.treelist li.selected,
html.dark-mode ul.treelist li.selected {
  background-color: transparent !important;
}

html.dark-mode ul.treelist li.selected > a,
html.dark-mode ul.treelist li.selected > div > a {
  background-color: #374549;
}

html:not(.dark-mode) ul.treelist li.selected > a:before,
html:not(.dark-mode) #settings-menu li.selected > a:before {
  color: var(--ah-royal);
}

#mailboxlist li.unread > a { font-weight: 700; }

/* Rounded folder pills: no full-width separator lines */
#layout-sidebar ul.treelist li,
#layout-sidebar ul.treelist li > a,
#settings-menu li,
#settings-menu li > a {
  border-top: 0 !important;
  border-bottom: 0 !important;
}

/* ---------- Message & other record lists ---------- */

html:not(.dark-mode) .listing li.selected,
html:not(.dark-mode) .listing tr.selected td {
  color: var(--ah-text);
  background-color: var(--ah-soft);
}

html:not(.dark-mode) table.messagelist tr.selected td:first-child,
html:not(.dark-mode) table.records-table tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--ah-royal);
}

@media (hover: hover) {
  html:not(.dark-mode) table.records-table tr:not(.selected):hover td,
  html:not(.dark-mode) .listing:not(.treelist) li:not(.selected):hover {
    background-color: var(--ah-hover);
  }
}

html:not(.dark-mode) table.messagelist tr.unread:not(.flagged) td.subject span.subject a,
html:not(.dark-mode) table.messagelist tr.unread:not(.flagged) td.subject span.fromto {
  color: var(--ah-navy);
}

html:not(.dark-mode) table.messagelist tr.unread:not(.flagged) td.subject span.date {
  color: var(--ah-royal);
}

html:not(.dark-mode) table.messagelist td {
  border-bottom-color: #f0f2f7;
}

/* ---------- Search bars ---------- */

@media screen and (min-width: 769px) {
  #layout .searchbar {
    margin: 10px 10px 6px;
    border: 0;
    border-radius: 10px;
  }

  html:not(.dark-mode) #layout .searchbar {
    background-color: #f4f6fb;
  }

  #layout .searchbar input { background: transparent; }
}

/* ---------- Popups & dialogs ---------- */

.popover {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(19, 27, 95, .06), 0 18px 40px rgba(19, 27, 95, .16);
}

.popover .popover-body { border-radius: 12px; }

.ui-dialog {
  border: 0;
  border-radius: var(--ah-radius) !important;
  box-shadow: 0 24px 50px rgba(19, 27, 95, .3);
  overflow: hidden;
}

html:not(.dark-mode) .ui-dialog .ui-dialog-titlebar {
  color: var(--ah-navy);
}

.ui-dialog .ui-dialog-title { font-weight: 600; }

#rcmdraglayer {
  background: var(--ah-navy);
  border-radius: 10px;
}

/* ---------- Login page ---------- */

.task-login #layout-content {
  display: block;
  padding: 0;
  height: 100%;
  text-align: left;
  background: #f6f8fc;
}

.ah-login {
  display: flex;
  min-height: 100%;
}

/* Left: brand photo */

.ah-login-brand {
  position: relative;
  flex: 0 0 50%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 52px 48px;
  color: #fff;
  background-color: #0e1550;
  background-image:
    linear-gradient(180deg, rgba(14, 21, 80, .88) 0%, rgba(14, 21, 80, .2) 30%, rgba(14, 21, 80, .15) 50%, rgba(14, 21, 80, .92) 78%, #0e1550 100%),
    url(../images/login-yeti.webp);
  background-size: cover, cover;
  background-position: center, 72% center;
  background-repeat: no-repeat;
}

.ah-login-brand-logo { display: inline-block; align-self: flex-start; }
.ah-login-brand-logo img { width: 190px; display: block; }

.ah-login-brand-body { max-width: 520px; }

.ah-login-brand-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.015em;
  color: #fff;
}

.ah-login-brand-text {
  margin: 0 0 22px;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .78);
}

.ah-login-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0;
  padding: 22px 0 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, .9);
}

.ah-login-features li { display: flex; align-items: center; gap: 9px; }

.ah-icon:before {
  font-family: Icons;
  font-style: normal;
  font-weight: 900;
}

.ah-login-features .ah-icon { color: var(--ah-gold-2); font-size: 13px; }
.ah-icon-lock:before { content: "\f023"; }
.ah-icon-calendar:before { content: "\f274"; }
.ah-icon-devices:before { content: "\f3cd"; }

/* Right: form */

.ah-login-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.ah-login-card {
  width: 100%;
  max-width: 420px;
}

.task-login .ah-login-card #logo {
  position: static;
  display: block;
  top: auto;
  width: 180px;
  max-width: 70%;
  max-height: none;
  margin: 0 0 32px;
}

.ah-login-title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ah-navy);
  letter-spacing: -.015em;
}

.ah-login-intro {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--ah-muted);
}

.task-login #login-form {
  top: auto;
  width: 100%;
  max-width: none;
  margin: 0;
}

#login-form .form-group { margin-bottom: 14px; }

#login-form .input-group {
  flex-wrap: nowrap;
  border: 1px solid #d5dcec;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease;
}

#login-form .input-group:hover { border-color: #b9c4de; }

#login-form .input-group:focus-within {
  border-color: var(--ah-royal);
  box-shadow: 0 0 0 4px rgba(42, 59, 176, .12);
}

#login-form .input-group .input-group-text {
  height: 100%;
  min-width: 48px;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8a95ad;
}

#login-form .input-group .form-control,
#login-form .input-group .custom-select {
  height: 52px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  font-size: 16px;
  padding-left: 0;
}

#login-form .formbuttons { margin-top: 22px; }

#rcmloginsubmit {
  height: 52px;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none !important;
  background: var(--ah-btn);
  box-shadow: 0 8px 18px rgba(19, 27, 95, .2);
}

#rcmloginsubmit:after {
  content: "\f061";
  font-family: Icons;
  font-weight: 900;
  font-size: 13px;
  margin-left: 10px;
}

#rcmloginsubmit:hover {
  background: var(--ah-btn-hover);
  box-shadow: 0 11px 22px rgba(19, 27, 95, .28);
  transform: translateY(-1px);
}

.ah-login-help {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--ah-border);
  font-size: 14px;
  color: var(--ah-muted);
}

.ah-login-help a { font-weight: 600; text-decoration: none; }
.ah-login-help a:hover { text-decoration: underline; }

.task-login #login-footer {
  flex: none;
  width: 100%;
  max-width: 420px;
  font-size: 13px;
  color: var(--ah-muted);
}

.task-login #login-footer > div { margin: 0; padding: 0; background: transparent; }

@media screen and (min-width: 992px) {
  .task-login .ah-login-card #logo { display: none; }
}

@media screen and (max-width: 991px) {
  .ah-login-brand { display: none; }
  .ah-login-main { background: #fff; }
}

@media screen and (max-width: 480px) {
  .ah-login-main { justify-content: flex-start; padding: 36px 20px 24px; }
  .ah-login-title { font-size: 24px; }
}

/* Login page – dark mode */

html.dark-mode .task-login #layout-content,
html.dark-mode .ah-login-main { background: #161b1d; }

html.dark-mode .ah-login-title { color: #fff; }
html.dark-mode .ah-login-intro, html.dark-mode .ah-login-help { color: #8ba3a7; }
html.dark-mode .ah-login-help { border-top-color: #2c373a; }

html.dark-mode .task-login .ah-login-card #logo { content: url(../images/logo-white.svg); }

html.dark-mode #login-form .input-group {
  background: #21292c;
  border-color: #374549;
}

/* ---------- Calendar & tasks (Kolab plugins) ---------- */

.fc .btn-group .btn.active,
.fc .btn-group .btn:active {
  color: #fff !important;
  background: var(--ah-royal) !important;
  border-color: var(--ah-royal) !important;
  box-shadow: none;
}

html:not(.dark-mode) .fc .btn-group .btn:not(.active) {
  color: var(--ah-navy);
  background: #fff;
  border-color: var(--ah-input-border);
}

html:not(.dark-mode) .fc .fc-day.fc-today { background: #f3f6ff !important; }
html.dark-mode .fc .fc-day.fc-today { background: rgba(143, 166, 255, .08) !important; }

body .fc .fc-now-indicator { border-color: var(--ah-gold); }
.fc-ltr .fc-time-grid .fc-now-indicator-arrow { border-left-color: var(--ah-gold); }

body.task-calendar .ui-datepicker-inline .ui-datepicker-week-col { color: var(--ah-muted); }

/* ---------- Folder tree: expand arrow on the right, inside the pill ---------- */

#mailboxlist li div.treetoggle,
#mailboxlist li li div.treetoggle,
#mailboxlist li li li div.treetoggle,
#mailboxlist li li li li div.treetoggle {
  left: auto !important;
  right: 14px;
  top: 6px;
  width: 24px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--ah-muted);
  z-index: 2;
}

#mailboxlist li div.treetoggle:before {
  float: none;
  margin: 0;
  width: auto;
  font-size: 13px;
  content: "\f078";
  transform: rotate(-90deg);
  transition: transform .18s ease;
}

#mailboxlist li div.treetoggle.expanded:before { content: "\f078"; transform: none; }
#mailboxlist li div.treetoggle:hover { background: rgba(42, 59, 176, .08); color: var(--ah-royal); }

/* keep the unread badge clear of the arrow */
#mailboxlist li:has(> div.treetoggle) > a .unreadcount { right: 26px; }
#mailboxlist li:has(> div.treetoggle) > a { padding-right: 4.5rem; }

/* ---------- Compose (Gmail / Outlook style) ---------- */

.ah-compose-page > .header { justify-content: flex-start; padding: 0 12px 0 22px; }

.ah-compose-page > .header .header-title {
  flex: none;
  margin: 0 !important;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  color: var(--ah-navy);
}

html.dark-mode .ah-compose-page > .header .header-title { color: #fff; }

.ah-compose-page > .header #messagetoolbar { margin-left: auto; }

.ah-compose-page #compose-content { padding: 0; }

.ah-compose-page #compose-content > form.formcontent {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.ah-compose-page #compose-headers { margin: 0; }

.ah-compose-page .compose-headers .form-group.row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 48px;
  margin: 0;
  padding: 0 22px;
  border-bottom: 1px solid #eef1f6;
}

html.dark-mode .ah-compose-page .compose-headers .form-group.row { border-bottom-color: #2c373a; }

.ah-compose-page .compose-headers .form-group.row > label {
  flex: 0 0 84px;
  max-width: 84px;
  padding: 0;
  font-size: 14px;
  color: var(--ah-muted);
}

.ah-compose-page .compose-headers .form-group.row > .col-10 {
  flex: 1;
  max-width: none;
  padding: 0;
}

.ah-compose-page .compose-headers .input-group { flex-wrap: nowrap; align-items: center; }

.ah-compose-page .compose-headers .form-control,
.ah-compose-page .compose-headers .custom-select,
.ah-compose-page .compose-headers .recipient-input {
  min-height: 46px;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  padding-left: 0;
  font-size: 15px;
}

.ah-compose-page .compose-headers #compose-subject { font-weight: 600; }

.ah-compose-page .compose-headers .input-group-append { align-items: center; }

.ah-compose-page .compose-headers .input-group-text {
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: var(--ah-muted);
}

.ah-compose-page .compose-headers .input-group-text:hover { color: var(--ah-royal); background: var(--ah-hover) !important; }

/* Cc / Bcc links like Gmail */
.ah-hdr-links { gap: 2px; }

.ah-hdr-link, .ah-hdr-more {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ah-muted) !important;
  text-decoration: none !important;
}

.ah-hdr-link:not(.active) { display: none; }
.ah-hdr-link:hover, .ah-hdr-more:hover { color: var(--ah-royal) !important; background: var(--ah-hover); }

.ah-hdr-more .inner { display: none; }
.ah-hdr-more:before { content: "\f141"; font-family: Icons; font-weight: 900; }

/* message body */
.ah-compose-page #composebodycontainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  margin: 0;
  padding: 0;
}

.ah-compose-page #composebody {
  flex: 1;
  min-height: 340px;
  padding: 18px 22px;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  font-size: 15px;
  line-height: 1.6;
  resize: none;
}

.ah-compose-page .tox.tox-tinymce {
  flex: 1;
  border: 0 !important;
  border-radius: 0 !important;
}

.ah-compose-page .tox .tox-editor-header {
  padding: 4px 14px;
  border-bottom: 1px solid #eef1f6 !important;
  box-shadow: none !important;
  background: #fafbfe;
}

.ah-compose-page .tox .tox-toolbar,
.ah-compose-page .tox .tox-toolbar__primary,
.ah-compose-page .tox .tox-toolbar__overflow { background: transparent !important; border: 0 !important; }

.ah-compose-page .tox .tox-tbtn { border-radius: 8px !important; color: #334155 !important; }
.ah-compose-page .tox .tox-tbtn svg { fill: #334155 !important; }
.ah-compose-page .tox .tox-tbtn:hover { background: #eef1fb !important; }
.ah-compose-page .tox .tox-tbtn--enabled,
.ah-compose-page .tox .tox-tbtn--enabled:hover { background: #e4e9fb !important; }
.ah-compose-page .tox .tox-tbtn--enabled svg { fill: var(--ah-royal) !important; }
.ah-compose-page .tox .tox-toolbar__group { padding: 0 4px !important; border-color: #e6eaf2 !important; }

html.dark-mode .ah-compose-page .tox .tox-editor-header { background: #1f272a; border-bottom-color: #2c373a !important; }
html.dark-mode .ah-compose-page .tox .tox-tbtn,
html.dark-mode .ah-compose-page .tox .tox-tbtn svg { color: #c5d1d3 !important; fill: #c5d1d3 !important; }
html.dark-mode .ah-compose-page .tox .tox-tbtn:hover { background: #2c373a !important; }

/* attachments as chips under the body */
.ah-compose-page .ah-attachments { padding: 0 22px; }
.ah-compose-page .ah-attachments #attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.ah-compose-page .ah-attachments #attachment-list:not(:empty) { padding: 12px 0 4px; }

.ah-compose-page .ah-attachments #attachment-list li {
  display: inline-flex;
  align-items: center;
  max-width: 280px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--ah-input-border);
  border-radius: 12px;
  background: #f8f9fc;
  font-size: 13px;
}

html.dark-mode .ah-compose-page .ah-attachments #attachment-list li { background: #21292c; border-color: #374549; }

/* drag & drop anywhere on the message */
#compose-content.active, #compose-content.hover {
  outline: 2px dashed var(--ah-royal);
  outline-offset: -8px;
  border-radius: var(--ah-radius);
}

/* bottom action bar */
.ah-compose-page .ah-compose-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid #eef1f6;
}

html.dark-mode .ah-compose-page .ah-compose-actions { border-top-color: #2c373a; }

.ah-compose-page .ah-compose-actions .btn.send {
  height: 44px;
  margin: 0 8px 0 0;
  padding: 0 26px 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

.ah-compose-page .ah-compose-actions .ah-spacer { flex: 1; }

.ah-compose-page .ah-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #475569 !important;
  text-decoration: none !important;
  transition: background-color .15s ease, color .15s ease;
}

.ah-compose-page .ah-action:hover,
.ah-compose-page .ah-action:focus { background: #f1f4f9; color: var(--ah-royal) !important; }
html.dark-mode .ah-compose-page .ah-action { color: #c5d1d3 !important; }
html.dark-mode .ah-compose-page .ah-action:hover { background: #2c373a; }

.ah-compose-page .ah-action:before { font-family: Icons; font-weight: 900; font-size: 18px; line-height: 1; }
.ah-compose-page .ah-action.attach:before { content: "\f0c6"; }
.ah-compose-page .ah-action.options:before { content: "\f1de"; }
.ah-compose-page .ah-action.extwin:before { content: "\f35d"; font-size: 16px; }
.ah-compose-page .ah-action.disabled { opacity: .4; pointer-events: none; }

/* message options popup */
.ah-compose-options { width: 360px; max-width: 92vw; padding: 14px 16px 4px; }
.ah-compose-options .form-group { margin-bottom: 10px; align-items: center; }
.ah-compose-options .col-form-label { font-size: 14px; }

/* compose takes the full width (no options sidebar) */
@media screen and (min-width: 1201px) {
  body.action-compose #layout > #layout-content { margin-right: 0; }
}

/* compose: title on the left, toolbar on the right, editor fills the card */
.ah-compose-page > .header .header-title { display: block !important; }
.ah-compose-page > .header #messagetoolbar { flex: none; justify-content: flex-end; }
.ah-compose-page .ah-action .inner { display: none; }

.ah-compose-page #compose-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ah-compose-page #compose-content > form.formcontent { flex: 1; min-height: 0; overflow-y: auto; }

.ah-compose-page #composebodycontainer .tox.tox-tinymce { height: auto !important; min-height: 340px; }

.ah-compose-page .ah-attachments,
.ah-compose-page .ah-attachments.file-upload { border: 0 !important; background: transparent !important; min-height: 0; margin: 0; }

/* options popup: room for the selects (Bootstrap caps popovers at 276px) */
.popover:has(#compose-options-menu) { max-width: 400px; }
#compose-options-menu.ah-compose-options { width: 380px; }
#compose-options-menu .custom-select { width: 100%; }

/* attachment chip: keep the menu/delete icons tidy */
.ah-compose-page #attachment-list li a.delete,
.ah-compose-page #attachment-list li a.cancelupload { margin-left: 6px; color: var(--ah-muted); }
.ah-compose-page #attachment-list li a.delete:hover { color: #dc3545; }

/* folder arrow: center the glyph in its own box */
#mailboxlist li div.treetoggle,
#mailboxlist li div.treetoggle:before { line-height: 1 !important; }

/* editor toolbar: TinyMCE's extra wrapper also paints a background */
.ah-compose-page .tox .tox-toolbar-overlord { background: transparent !important; }
html.dark-mode .ah-compose-page .tox .tox-edit-area__iframe { background: #21292c !important; }
html.dark-mode .ah-compose-page .tox .tox-toolbar__group { border-color: #374549 !important; }
html.dark-mode .ah-compose-page .tox .tox-tbtn--select .tox-tbtn__select-label { color: #c5d1d3 !important; }

/* ---------- Reading view (like the Actiefhost Mail app) ---------- */
/* sender card (initials, name, address, time, flag, details), subject under it,
   Reply / Reply all / Forward as a bar - fixed at the bottom on phones */

body.action-preview .frame-content,
body.action-show #layout-content > .content { padding: 0; }

#message-header {
  display: flex;
  flex-direction: column;
  padding: 18px 24px 4px;
  border: 0;
  background: transparent;
}

#message-header > .header.ah-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #f7f9fd;
}

html.dark-mode #message-header > .header.ah-card { background: #1b2124; }

#message-header .header-content { flex: 1; min-width: 0; padding: 0; }
#message-header .header-content .header-summary { display: none !important; }

.ah-card-top { display: flex; align-items: flex-start; gap: 10px; }
.ah-card-meta { flex: 1; min-width: 0; line-height: 1.4; }

.ah-from-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.ah-from-name a { font-weight: 600; color: #111827 !important; text-decoration: none !important; }
html.dark-mode .ah-from-name a { color: #f1f5f9 !important; }
.ah-from-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ah-muted); }

.ah-card-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ah-card-side .ah-date { font-size: 12.5px; font-weight: 600; color: var(--ah-muted); white-space: nowrap; }
.ah-card-buttons { display: flex; gap: 2px; }

.ah-flag, .ah-details-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--ah-muted) !important;
  text-decoration: none !important;
}

.ah-flag:hover, .ah-details-toggle:hover { background: var(--ah-hover); color: var(--ah-royal) !important; }
html.dark-mode .ah-flag:hover, html.dark-mode .ah-details-toggle:hover { background: #2c373a; }
.ah-flag:before { content: "\f024"; font-family: Icons; font-weight: 400; font-size: 16px; }
.ah-flag.active:before { font-weight: 900; color: var(--ah-gold); }
.ah-details-toggle:before { content: "\f078"; font-family: Icons; font-weight: 900; font-size: 12px; }
.header-content.details-view .ah-details-toggle:before { content: "\f077"; }

/* details (From / To / Date) inside the card, only when opened */
#message-header .header-content .header-headers { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--ah-border); font-size: 13px; }
#message-header .header-links a.headers-details,
#message-header .header-links a.headers-summary { display: none; }
#message-header .header-links { margin-top: 4px; font-size: 12px; }
#message-header .header-content:not(.details-view) .header-links { display: none; }
#message-header .header-links a { color: var(--ah-muted); }

/* the subject under the card */
#message-header > h2.subject {
  margin: 16px 4px 4px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: #111827;
}

html.dark-mode #message-header > h2.subject { color: #f1f5f9; }
body.status-flagged #message-header > h2.subject:before { display: none; }

/* initials (also used in the mail list on phones) */
.ah-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--ah-av, #2a3bb0) 13%, transparent);
  color: var(--ah-av, #2a3bb0);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 1;
}

.ah-avatar.ah-avatar-lg { width: 46px; height: 46px; border-radius: 14px; font-size: 16.5px; }
html.dark-mode .ah-avatar {
  background: color-mix(in srgb, var(--ah-av, #2a3bb0) 32%, transparent);
  color: color-mix(in srgb, var(--ah-av, #2a3bb0) 45%, #fff);
}

/* body */
#message-content { padding: 6px 28px 8px; }
#message-content .rightcol { padding: 0; }
#messagebody { font-size: 14px; line-height: 1.6; }

#messagebody div.message-part pre,
#messagebody div.pre {
  font-family: "IBM Plex Sans", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* attachments as cards under the text */
#message-content { display: flex; flex-direction: column; }
#message-content .rightcol { order: 1; }
#message-content .leftcol { order: 2; width: auto; max-width: none; padding: 0; border: 0; }
#message-content .leftcol #attachment-list:not(:empty) { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid #eef1f6; }

#message-content .leftcol #attachment-list li {
  width: 220px;
  margin: 0;
  border: 1px solid var(--ah-input-border);
  border-radius: 12px;
  background: #fff;
}

html.dark-mode #message-content .leftcol #attachment-list:not(:empty) { border-top-color: #2c373a; }
html.dark-mode #message-content .leftcol #attachment-list li { background: #21292c; border-color: #374549; }

/* Reply / Reply all / Forward: icon above the label, like the app */
.ah-reply-bar {
  display: flex;
  gap: 4px;
  max-width: 520px;      /* wide screens: the three actions stay together */
  margin: 18px 24px 24px;
  padding: 4px;
  border-top: 1px solid var(--ah-border);
}

.ah-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #111827 !important;
  text-decoration: none !important;
}

.ah-action:hover { background: var(--ah-hover); }
html.dark-mode .ah-action { color: #e2e7e9 !important; }
html.dark-mode .ah-action:hover { background: #2c373a; }
.ah-action:before { font-family: Icons; font-weight: 900; font-size: 19px; color: var(--ah-royal); }
html.dark-mode .ah-action:before { color: #8fa6ff; }
.ah-act-reply:before { content: "\f3e5"; }
.ah-act-replyall:before { content: "\f122"; }
.ah-act-forward:before { content: "\f064"; }
.ah-action-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

@media screen and (max-width: 768px) {
  #message-header { padding: 10px 14px 4px; }
  #message-content { padding: 6px 18px 8px; }
}

/* phones: the reply bar is fixed at the bottom of the screen (like the app); the text ends above it */
html:is(.layout-phone, .layout-small.touch) .ah-reply-bar {
  max-width: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  margin: 0;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -1px 0 var(--ah-border);
  border-top: 0;
}

html.dark-mode:is(.layout-phone, .layout-small.touch) .ah-reply-bar { background: #161b1d; }
html:is(.layout-phone, .layout-small.touch) body.ah-reader #message-content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ---------- Flags in the message list (gold, like the app) ---------- */

.messagelist tr.flagged td,
.messagelist tr.flagged span.size,
.messagelist tr.flagged td.subject span.date,
.messagelist tr.flagged td.subject span.fromto,
.messagelist tr.flagged td.subject span.subject a { color: inherit !important; }

html:not(.dark-mode) table.messagelist tr.unread.flagged td.subject span.subject a,
html:not(.dark-mode) table.messagelist tr.unread.flagged td.subject span.fromto { color: var(--ah-navy) !important; }

.messagelist td.flags span.flag:before { content: none !important; }

.messagelist span.flagged:before,
.messagelist span.unflagged:before {
  content: "\f024" !important;
  font-family: Icons;
  font-size: 14px;
}

.messagelist span.flagged:before { font-weight: 900; color: var(--ah-gold) !important; }
.messagelist span.unflagged:before { font-weight: 400; color: #b6bfcc !important; }
.messagelist tr:hover span.unflagged:before { color: #7a8597 !important; }

/* hover quick-actions menu: flag */
.listing-hover-menu a.flag:before,
.listing-hover-menu a.unflag:before { content: "\f024" !important; }
.listing-hover-menu a.flag:before { font-weight: 400; }
.listing-hover-menu a.unflag:before { font-weight: 900; color: var(--ah-gold); }

html.dark-mode #messagebody .message-htmlpart { padding: 18px 20px; border-radius: 12px; }

/* the initials and short dates are only for the phone list (see the end of this file) */
.messagelist td.subject .ah-avatar,
.messagelist td.subject .ah-date-short { display: none; }

/* ---------- Gmail-style mail toolbars (desktop): icons only ---------- */
/* Elastic turns the toolbars into ul > li > a; buttons meant for small screens
   (.hidden / .hidden-big / .hidden-large) must stay hidden */

@media screen and (min-width: 1025px) {
  /* reply / reply all / forward are in the message header and under the message */
  #toolbar-menu > li:has(> a.reply),
  #toolbar-menu > li:has(> .dropbutton),
  #toolbar-menu > li.spacer:first-of-type,
  #toolbar-menu > li:has(> a.hidden),
  #toolbar-menu > li:has(> a.hidden-big),
  #toolbar-menu > li:has(> a.hidden-large) { display: none !important; }

  #layout-content > .header:has(#toolbar-menu) { justify-content: flex-start; }

  #layout-content > .header #toolbar-menu,
  #messagelist-header .toolbar,
  #messagelist-header .toolbar > ul {
    justify-content: flex-start;
    gap: 2px;
  }

  #layout-content > .header #toolbar-menu { margin-left: 14px; }

  #toolbar-menu > li > a,
  #messagelist-header .toolbar a:not(.hidden):not(.hidden-big):not(.hidden-large),
  #messagelist-header > a.refresh {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50%;
    line-height: 1 !important;
  }

  #toolbar-menu > li > a:before,
  #messagelist-header .toolbar a:before,
  #messagelist-header > a.refresh:before {
    float: none !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    font-size: 17px !important;
    line-height: 1 !important;
  }

  #toolbar-menu > li > a .inner,
  #messagelist-header .toolbar a .inner,
  #messagelist-header > a.refresh .inner {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  html:not(.dark-mode) #toolbar-menu > li > a:not(.disabled):hover,
  html:not(.dark-mode) #messagelist-header .toolbar a:not(.disabled):hover,
  html:not(.dark-mode) #messagelist-header > a.refresh:hover { background: var(--ah-hover); }

  html.dark-mode #toolbar-menu > li > a:not(.disabled):hover,
  html.dark-mode #messagelist-header .toolbar a:not(.disabled):hover { background: #2c373a; }
}

/* extra toolbar buttons */
#toolbar-menu a.ah-tb-unread:before { content: "\f2b6"; font-family: Icons; font-weight: 900; }
#toolbar-menu a.ah-tb-move:before { content: "\f07b"; font-family: Icons; font-weight: 900; }
#toolbar-menu a.ah-tb-unread.disabled,
#toolbar-menu a.ah-tb-move.disabled { opacity: .4; pointer-events: none; }

@media screen and (max-width: 1024px) {
  #toolbar-menu > li:has(> a.ah-tb-unread),
  #toolbar-menu > li:has(> a.ah-tb-move) { display: none; }
}

/* "Flagged" entry in the folder list */
#mailboxlist li.ah-flagged > a:before { content: "\f024"; font-family: Icons; font-weight: 900; color: var(--ah-gold); }

/* toolbar alignment: icons vertically centered, aligned left with the content below */
@media screen and (min-width: 1025px) {
  #messagelist-header,
  #layout-content > .header:has(#toolbar-menu) {
    justify-content: flex-start !important;
    align-items: center;
    padding-left: 6px !important;
  }

  #messagelist-header .toolbar,
  #layout-content > .header #toolbar-menu {
    display: flex;
    align-items: center;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #toolbar-menu > li,
  #messagelist-header .toolbar > li {
    display: flex;
    align-items: center;
    margin: 0;
  }

  #messagelist-header > a.refresh { margin-left: 2px !important; }

  /* the swipe plugin's settings button is only useful on touch screens */
  #messagelist-header a.swipe,
  #messagelist-header .toolbar > li:has(> a.swipe) { display: none !important; }
}

@media screen and (min-width: 1025px) {
  /* spacer left over from the hidden reply group */
  #toolbar-menu > li.spacer { display: none !important; }

  /* refresh sits outside the list toolbar: same box model as its neighbours */
  #messagelist-header > a.refresh { align-self: center; margin-top: 0 !important; margin-bottom: 0 !important; transform: translateY(-1px); }
}

/* ==========================================================================================
   Phones (portrait and landscape, not tablets): the mail list of the Actiefhost Mail app
   "Inbox ▾" opens the folders, search behind the icon, filter pills Unread / Flagged,
   airy rows with initials, the gold unread dot and short dates. (Added 2026-11-15.)
   Phone = Elastic's html.layout-phone (<= 480px) or html.layout-small.touch (481-767px, touch).
   ========================================================================================== */

.ah-pills { display: none; }

html:is(.layout-phone, .layout-small.touch) #layout-list { background: #fff; }
html.dark-mode:is(.layout-phone, .layout-small.touch) #layout-list { background: #161b1d; }

/* header: "Inbox ▾" on the left, search on the right */
html:is(.layout-phone, .layout-small.touch) #messagelist-header { height: 64px; padding: 0 6px; border-bottom: 1px solid var(--ah-border); }
html:is(.layout-phone, .layout-small.touch) #messagelist-header a.back-sidebar-button { display: none; }

html:is(.layout-phone, .layout-small.touch) #messagelist-header .header-title.ah-folder-switch {
  flex: 1;
  margin: 0 !important;
  padding: 0 6px !important;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ah-navy);
  cursor: pointer;
}

html.dark-mode:is(.layout-phone, .layout-small.touch) #messagelist-header .header-title.ah-folder-switch { color: #f1f5f9; }
html:is(.layout-phone, .layout-small.touch) .header-title.ah-folder-switch:after {
  content: "\f078";
  margin-left: 6px;
  font-family: Icons;
  font-weight: 900;
  font-size: 14px;
  vertical-align: 3px;
}

html:is(.layout-phone, .layout-small.touch) .ah-search-toggle:before { content: "\f002"; }
.ah-search-toggle { display: none; }
html:is(.layout-phone, .layout-small.touch) .ah-search-toggle { display: inline-block; }

/* search bar only after tapping the search icon */
html:is(.layout-phone, .layout-small.touch) #layout-list:not(.ah-searching) .searchbar { display: none; }

/* filter pills (hidden while searching, like the app) */
html:is(.layout-phone, .layout-small.touch) .ah-pills { display: flex; gap: 8px; padding: 14px 20px 6px; }
html:is(.layout-phone, .layout-small.touch) #layout-list.ah-searching .ah-pills { display: none; }

.ah-pill-filter {
  padding: 6px 16px;
  border: 1px solid #d5dbe8;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  color: #111827 !important;
  text-decoration: none !important;
}

.ah-pill-filter.active { border-color: var(--ah-navy); background: var(--ah-navy); color: #fff !important; }
html.dark-mode .ah-pill-filter { border-color: #374549; color: #e2e7e9 !important; }
html.dark-mode .ah-pill-filter.active { border-color: #26306b; background: #26306b; }

/* rows: initials | name + time | subject + flag / clip / gold dot */
html:is(.layout-phone, .layout-small.touch) table.messagelist tr { position: relative; }
html:is(.layout-phone, .layout-small.touch) table.messagelist tr td { border: 0 !important; }
html:is(.layout-phone, .layout-small.touch) table.messagelist td.selection { display: none; }
html:is(.layout-phone, .layout-small.touch) table.messagelist.withselection td.selection { display: table-cell; }

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject {
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "av from date" "av subj marks";
  column-gap: 16px;
  row-gap: 3px;
  align-items: center;
  padding: 12px 20px !important;
}

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject .ah-avatar { display: inline-flex; grid-area: av; align-self: start; }

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.fromto {
  grid-area: from;
  padding: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 400;
  color: #111827;
}

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.fromto * { font-weight: inherit; color: inherit; }

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.date,
html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject .ah-date-short {
  grid-area: date;
  position: static !important;
  float: none !important;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--ah-muted) !important;
}

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject .ah-date-short { display: block; }
html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject:has(.ah-date-short) span.date,
html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.size { display: none; }

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.subject {
  grid-area: subj;
  display: flex;
  align-items: center;
  padding: 0 !important;
  overflow: hidden;
  font-size: 14.5px;
}

html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.subject a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  color: #111827 !important;
}

/* status icon only for replied / forwarded (no bullets) */
html:is(.layout-phone, .layout-small.touch) table.messagelist span.msgicon.status { display: none; }
html:is(.layout-phone, .layout-small.touch) table.messagelist span.msgicon.status.replied,
html:is(.layout-phone, .layout-small.touch) table.messagelist span.msgicon.status.forwarded,
html:is(.layout-phone, .layout-small.touch) table.messagelist span.msgicon.status.replied.forwarded {
  display: inline-block;
  flex: none;
  width: auto;
  margin: 0 5px 0 0;
  font-size: 13px;
  color: var(--ah-muted);
}

/* unread: name bold, subject a bit stronger, gold dot at the end of the subject line */
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.unread td.subject span.fromto { font-weight: 600; }
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.unread td.subject span.subject a { font-weight: 500; }

/* flag / clip / gold dot: part of the row (td.flags itself is hidden on phones) */
html:is(.layout-phone, .layout-small.touch) table.messagelist td.flags { display: none !important; }
html:is(.layout-phone, .layout-small.touch) table.messagelist td.subject .ah-marks { grid-area: marks; display: flex; align-items: center; gap: 8px; }
.ah-marks { display: none; }
.ah-marks > span { display: none; }
.ah-m-flag:before { content: "\f024"; font-family: Icons; font-weight: 900; font-size: 13px; color: var(--ah-gold); }
.ah-m-clip:before { content: "\f0c6"; font-family: Icons; font-weight: 900; font-size: 14px; color: var(--ah-muted); }
.ah-m-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ah-gold); }
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.flagged .ah-m-flag,
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.ah-has-attachment .ah-m-clip { display: inline-block; }
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.unread .ah-m-dot { display: block; }

html.dark-mode:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.fromto,
html.dark-mode:is(.layout-phone, .layout-small.touch) table.messagelist td.subject span.subject a { color: #e2e7e9 !important; }

/* selected / opened row: soft navy */
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.focused:not(.selected) td { background: transparent !important; }
html:is(.layout-phone, .layout-small.touch) table.messagelist tr.selected td { background: #eef1fb !important; }
html.dark-mode:is(.layout-phone, .layout-small.touch) table.messagelist tr.selected td { background: #232b2f !important; }

/* compose: gold, like the app's compose button */
html:is(.layout-phone, .layout-small.touch) .floating-action-buttons a {
  width: 58px;
  height: 52px;
  border-radius: 18px;
  background: var(--ah-gold) !important;
  box-shadow: 0 6px 16px rgba(242, 183, 5, .35);
  color: var(--ah-navy) !important;
}

html:is(.layout-phone, .layout-small.touch) .floating-action-buttons a:before { color: var(--ah-navy) !important; }

/* the Flagged folder entry: the pill does that on phones */
html:is(.layout-phone, .layout-small.touch) #mailboxlist li.ah-flagged { display: none; }

/* endless list: no paging bar; a small spinner while the next mails load */
html:is(.layout-phone, .layout-small.touch) #layout-list > .footer { display: none; }
html:is(.layout-phone, .layout-small.touch) #messagelist-content.ah-loading-more:after {
  content: "\f110";
  display: block;
  padding: 14px 0 22px;
  font-family: Icons;
  font-weight: 900;
  font-size: 18px;
  text-align: center;
  color: var(--ah-muted);
  animation: ah-spin 1s linear infinite;
}
@keyframes ah-spin { to { transform: rotate(360deg); } }
