/**
 * GLONIN skin for Roundcube 1.6.x
 *
 * Extends the official Elastic skin and keeps its responsive behaviour.
 * Elastic is licensed under CC BY-SA 3.0 by the Roundcube Dev Team.
 */

:root {
  --glonin-ink: #201f1e;
  --glonin-accent: #ffd51a;
  --glonin-accent-hover: #ffdd00;
  --glonin-text: #201f1e;
  --glonin-muted: #696969;
  --glonin-bg: #f7f7f7;
  --glonin-surface: #ffffff;
  --glonin-surface-soft: #fbfbfa;
  --glonin-surface-raised: #ffffff;
  --glonin-rail: #201f1e;
  --glonin-line: rgba(32, 31, 30, 0.16);
  --glonin-line-strong: rgba(32, 31, 30, 0.34);
  --glonin-hover: rgba(32, 31, 30, 0.055);
  --glonin-selected: rgba(255, 213, 26, 0.15);
  --glonin-danger: #b42323;
  --glonin-success: #146c43;
  --glonin-radius: 10px;
  --glonin-radius-lg: 12px;
  --glonin-shadow: 0 12px 34px rgba(32, 31, 30, 0.08);
  --glonin-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* Roundcube 1.7 message hover actions are redundant with GLONIN swipes. */
.task-mail #messagelist-content > .listing-hover-menu {
  display: none !important;
}

/* -------------------------------------------------------------------------
 * GLONIN desktop refresh and unified light/dark application palette
 * ---------------------------------------------------------------------- */

html body:not(.task-login) {
  color: var(--glonin-text);
  background: var(--glonin-bg);
}

html body:not(.task-login) #layout-sidebar,
html body:not(.task-login) #layout-content {
  color: var(--glonin-text);
  background-color: var(--glonin-surface);
  border-color: var(--glonin-line);
}

html body:not(.task-login) #layout-list {
  color: var(--glonin-text);
  background-color: var(--glonin-surface-soft);
  border-color: var(--glonin-line);
}

html body:not(.task-login) #layout > div > .header,
html body:not(.task-login) #layout > div > .footer {
  color: var(--glonin-text);
  background-color: var(--glonin-surface-raised);
  border-color: var(--glonin-line);
}

html body:not(.task-login) #layout > div > .header .header-title {
  min-width: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

html body:not(.task-login) #layout-menu,
html body:not(.task-login) #taskmenu,
html body:not(.task-login) #taskmenu .special-buttons {
  background: var(--glonin-rail) !important;
  border-color: var(--glonin-line);
}

html body:not(.task-login) #taskmenu a {
  color: rgba(255, 255, 255, 0.72);
  transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

html body:not(.task-login) #taskmenu a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

html body:not(.task-login) #taskmenu a.selected,
html body:not(.task-login) #taskmenu a.selected:hover,
html.dark-mode body:not(.task-login) #taskmenu a.selected,
html.dark-mode body:not(.task-login) #taskmenu a.selected:hover {
  color: #ffffff;
  background: rgba(255, 213, 26, 0.12);
  box-shadow: inset 3px 0 0 var(--glonin-accent);
}

html body:not(.task-login) #taskmenu .action-buttons a.compose,
html body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  box-shadow: none;
}

html body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
  background: var(--glonin-accent-hover);
}

html body:not(.task-login) .listing li,
html body:not(.task-login) .listing tr > td,
html body:not(.task-login) .listing tbody > tr > td {
  border-color: var(--glonin-line);
}

html body:not(.task-login) .listing li.selected,
html body:not(.task-login) .listing li.selected > a,
html body:not(.task-login) .listing li.selected > div > a,
html body:not(.task-login) .listing tr.selected > td {
  color: var(--glonin-text);
  background-color: var(--glonin-selected);
}

html body:not(.task-login) .listing li.selected,
html body:not(.task-login) .listing tr.selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--glonin-accent);
}

html body:not(.task-login) .listing li > a:hover,
html body:not(.task-login) .listing tr:hover > td,
html body:not(.task-login) .menu.toolbar a:hover {
  background-color: var(--glonin-hover);
}

html body:not(.task-login) .searchbar,
html body:not(.task-login) input.form-control,
html body:not(.task-login) select.form-control,
html body:not(.task-login) textarea.form-control,
html body:not(.task-login) .custom-select,
html body:not(.task-login) .custom-file-label,
html body:not(.task-login) .input-group-text,
html body:not(.task-login) .recipient-input,
html body:not(.task-login) .multi-input > .content {
  color: var(--glonin-text);
  background-color: var(--glonin-surface-soft);
  border-color: var(--glonin-line);
  border-radius: var(--glonin-radius);
}

html body:not(.task-login) input::placeholder,
html body:not(.task-login) textarea::placeholder {
  color: var(--glonin-muted);
  opacity: 0.78;
}

html body:not(.task-login) input.form-control:focus,
html body:not(.task-login) select.form-control:focus,
html body:not(.task-login) textarea.form-control:focus,
html body:not(.task-login) .custom-select:focus,
html body:not(.task-login) .recipient-input:focus-within,
html body:not(.task-login) button:focus-visible,
html body:not(.task-login) a:focus-visible {
  border-color: var(--glonin-accent);
  box-shadow: 0 0 0 3px rgba(255, 213, 26, 0.24);
  outline: none;
}

html body:not(.task-login) .ui-dialog,
html body:not(.task-login) .popover:not(#layout-menu),
html body:not(.task-login) .popupmenu,
html body:not(.task-login) .select-menu,
html body:not(.task-login) .ui-menu {
  color: var(--glonin-text);
  background: var(--glonin-surface-raised);
  border-color: var(--glonin-line);
  border-radius: var(--glonin-radius-lg);
  box-shadow: var(--glonin-shadow);
}

html body:not(.task-login) .popover-header,
html body:not(.task-login) .ui-dialog .ui-dialog-titlebar {
  color: var(--glonin-text);
  background: var(--glonin-surface-raised);
  border-color: var(--glonin-line);
}

html body:not(.task-login) .btn,
html body:not(.task-login) button,
html body:not(.task-login) .button {
  border-radius: var(--glonin-radius);
}

html body:not(.task-login) .btn.btn-primary,
html body:not(.task-login) button.btn-primary,
html body:not(.task-login) input.btn-primary {
  color: #ffffff;
  background: var(--glonin-ink);
  border-color: var(--glonin-ink);
}

html body:not(.task-login) .btn.btn-primary:hover,
html body:not(.task-login) button.btn-primary:hover,
html body:not(.task-login) input.btn-primary:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent-hover);
  border-color: var(--glonin-accent-hover);
}

html body:not(.task-login) input[type="checkbox"],
html body:not(.task-login) input[type="radio"] {
  accent-color: var(--glonin-accent);
}

html body:not(.task-login) .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--glonin-accent);
  border-color: var(--glonin-accent);
}

html body:not(.task-login) .custom-switch .custom-control-input:checked ~ .custom-control-label::after {
  background-color: var(--glonin-ink);
}

html body:not(.task-login),
html body:not(.task-login) * {
  scrollbar-color: rgba(255, 213, 26, 0.52) transparent;
}

html body:not(.task-login) ::-webkit-scrollbar-thumb {
  background: rgba(255, 213, 26, 0.52);
  border-radius: 999px;
}

/* Desktop account switcher: current mailbox card and one-click account list. */
html body .header-title.username {
  position: relative;
  display: flex;
  min-width: 0;
  margin: 0 !important;
  padding: 0 8px !important;
  align-items: center;
  overflow: visible !important;
  z-index: 100;
  visibility: visible !important;
}

html body.task-mail #layout-sidebar > .header {
  z-index: 1200;
  overflow: visible;
}

html body .header-title.username > .ident-switch-wrapper.ident-switch-desktop {
  display: none !important;
}

html body #glonin-desktop-account-switch {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

html body #glonin-desktop-account-switch .glonin-desktop-account-current {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  align-items: center;
  gap: 9px;
  color: var(--glonin-text);
  font-family: var(--glonin-font);
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  background: var(--glonin-surface-soft);
  border: 1px solid var(--glonin-line);
  border-radius: var(--glonin-radius);
  box-shadow: none;
  cursor: pointer;
}

html body #glonin-desktop-account-switch .glonin-desktop-account-current:hover,
html body #glonin-desktop-account-switch.open .glonin-desktop-account-current {
  background: var(--glonin-hover);
  border-color: var(--glonin-line-strong);
}

html body .glonin-account-avatar {
  display: inline-flex;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  background: var(--glonin-ink);
  border-radius: 50%;
}

html body .glonin-account-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

html body .glonin-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body #glonin-desktop-account-switch .glonin-account-chevron {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.48;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 140ms ease;
}

html body #glonin-desktop-account-switch.open .glonin-account-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

html body #glonin-desktop-account-switch #ident-switch-badge {
  position: absolute;
  top: 0;
  left: 30px;
  z-index: 2;
  min-width: 18px;
  min-height: 18px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 18px;
}

html body #glonin-desktop-account-list {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 1400;
  display: none;
  min-width: 220px;
  max-height: 240px;
  padding: 6px;
  overflow-y: auto;
  background: var(--glonin-surface-raised);
  border: 1px solid var(--glonin-line);
  border-radius: var(--glonin-radius-lg);
  box-shadow: var(--glonin-shadow);
}

html body #glonin-desktop-account-switch.open #glonin-desktop-account-list {
  display: grid;
  gap: 4px;
}

html body #glonin-desktop-account-list .glonin-account-option {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 9px;
  align-items: center;
  gap: 9px;
  color: var(--glonin-text);
  font-family: var(--glonin-font);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

html body #glonin-desktop-account-list .glonin-account-option:hover {
  background: var(--glonin-hover);
}

html body #glonin-desktop-account-list .glonin-account-option.selected {
  background: var(--glonin-selected);
  box-shadow: inset 3px 0 0 var(--glonin-accent);
}

html body #glonin-desktop-account-list .glonin-account-current {
  display: inline-flex;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  color: var(--glonin-ink);
  font-size: 12px;
  background: var(--glonin-accent);
  border-radius: 50%;
}

/* Corporate dark mode: remove Elastic's blue/teal palette from the chrome. */
html.dark-mode body:not(.task-login),
html.dark-mode body:not(.task-login) #layout {
  color: var(--glonin-text);
  background: var(--glonin-bg);
}

html.dark-mode body:not(.task-login) #layout-sidebar,
html.dark-mode body:not(.task-login) #layout-content,
html.dark-mode body:not(.task-login) #layout-list,
html.dark-mode body:not(.task-login) #layout > div > .header,
html.dark-mode body:not(.task-login) #layout > div > .footer {
  color: var(--glonin-text);
  border-color: var(--glonin-line);
}

html.dark-mode body:not(.task-login) #layout-sidebar,
html.dark-mode body:not(.task-login) #layout-content {
  background: var(--glonin-surface);
}

html.dark-mode body:not(.task-login) #layout-list {
  background: var(--glonin-surface-soft);
}

html.dark-mode body:not(.task-login) #layout > div > .header,
html.dark-mode body:not(.task-login) #layout > div > .footer,
html.dark-mode body:not(.task-login) .toolbar,
html.dark-mode body:not(.task-login) .pagenav {
  background: var(--glonin-surface-raised);
}

html.dark-mode body:not(.task-login) .listing,
html.dark-mode body:not(.task-login) .listing li,
html.dark-mode body:not(.task-login) .listing tr,
html.dark-mode body:not(.task-login) .listing td,
html.dark-mode body:not(.task-login) .listing th,
html.dark-mode body:not(.task-login) .folderlist li {
  color: var(--glonin-text);
  background-color: transparent;
  border-color: var(--glonin-line);
}

html.dark-mode body:not(.task-login) .listing li > a,
html.dark-mode body:not(.task-login) .listing td > a,
html.dark-mode body:not(.task-login) .folderlist li > a,
html.dark-mode body:not(.task-login) .menu.toolbar a,
html.dark-mode body:not(.task-login) .pagenav a {
  color: var(--glonin-text);
}

html.dark-mode body:not(.task-login) .listing li.selected,
html.dark-mode body:not(.task-login) .listing li.selected > a,
html.dark-mode body:not(.task-login) .listing li.selected > div > a,
html.dark-mode body:not(.task-login) .listing tr.selected > td {
  color: var(--glonin-text);
  background-color: var(--glonin-selected);
}

html.dark-mode body:not(.task-login) .listing li:hover,
html.dark-mode body:not(.task-login) .listing li > a:hover,
html.dark-mode body:not(.task-login) .listing tr:hover > td,
html.dark-mode body:not(.task-login) .folderlist li > a:hover,
html.dark-mode body:not(.task-login) .menu.toolbar a:hover {
  color: var(--glonin-text);
  background-color: var(--glonin-hover);
}

html.dark-mode body:not(.task-login) .searchbar,
html.dark-mode body:not(.task-login) input.form-control,
html.dark-mode body:not(.task-login) select.form-control,
html.dark-mode body:not(.task-login) textarea.form-control,
html.dark-mode body:not(.task-login) .custom-select,
html.dark-mode body:not(.task-login) .custom-file-label,
html.dark-mode body:not(.task-login) .input-group-text,
html.dark-mode body:not(.task-login) .recipient-input,
html.dark-mode body:not(.task-login) .multi-input > .content,
html.dark-mode body:not(.task-login) option {
  color: var(--glonin-text);
  background-color: var(--glonin-surface-soft);
  border-color: var(--glonin-line);
}

html.dark-mode body:not(.task-login) .ui-dialog,
html.dark-mode body:not(.task-login) .popover:not(#layout-menu),
html.dark-mode body:not(.task-login) .popupmenu,
html.dark-mode body:not(.task-login) .select-menu,
html.dark-mode body:not(.task-login) .ui-menu,
html.dark-mode body:not(.task-login) .popover-body,
html.dark-mode body:not(.task-login) .popover-header,
html.dark-mode body:not(.task-login) .ui-dialog .ui-dialog-titlebar {
  color: var(--glonin-text);
  background: var(--glonin-surface-raised);
  border-color: var(--glonin-line);
}

html.dark-mode body:not(.task-login) .btn.btn-primary,
html.dark-mode body:not(.task-login) button.btn-primary,
html.dark-mode body:not(.task-login) input.btn-primary,
html.dark-mode body:not(.task-login) .floating-action-buttons a.button {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  border-color: var(--glonin-accent);
}

html.dark-mode body:not(.task-login) .btn.btn-primary:hover,
html.dark-mode body:not(.task-login) button.btn-primary:hover,
html.dark-mode body:not(.task-login) input.btn-primary:hover,
html.dark-mode body:not(.task-login) .floating-action-buttons a.button:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent-hover);
  border-color: var(--glonin-accent-hover);
}

html.dark-mode body:not(.task-login) .tox .tox-editor-header,
html.dark-mode body:not(.task-login) .tox .tox-toolbar,
html.dark-mode body:not(.task-login) .tox .tox-toolbar__primary,
html.dark-mode body:not(.task-login) .tox .tox-menubar,
html.dark-mode body:not(.task-login) .tox .tox-statusbar {
  color: var(--glonin-text);
  background: var(--glonin-surface-raised);
  border-color: var(--glonin-line);
}

html.dark-mode body:not(.task-login) .tox .tox-tbtn,
html.dark-mode body:not(.task-login) .tox .tox-mbtn {
  color: var(--glonin-text);
}

html.dark-mode body:not(.task-login) .tox .tox-tbtn:hover,
html.dark-mode body:not(.task-login) .tox .tox-mbtn:hover,
html.dark-mode body:not(.task-login) .tox .tox-tbtn--enabled {
  color: var(--glonin-text);
  background: var(--glonin-selected);
}

html.dark-mode body:not(.task-login) .glonin-account-avatar {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
}

/*
 * Message preview inside the same-origin iframe. Keep the desktop information
 * hierarchy, but let long subjects, senders and action links reflow on phones.
 */
@media screen and (max-width: 30rem) {
  html.layout-phone body:not(.task-login) .frame-content {
    box-sizing: border-box;
    inline-size: 100%;
    max-inline-size: 100%;
    padding: clamp(0.75rem, 3vi, 1rem);
  }

  html.layout-phone body:not(.task-login) #message-header > .subject {
    margin-block-end: 0.625rem;
    font-size: clamp(1.15rem, 5vi, 1.4rem);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  html.layout-phone body:not(.task-login) #message-header > .header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-inline-size: 0;
  }

  html.layout-phone body:not(.task-login)
    #message-header > .header img.contactphoto {
    flex: 0 0 3rem;
    inline-size: 3rem;
    block-size: 3rem;
    margin: 0;
  }

  html.layout-phone body:not(.task-login) #message-header .header-content {
    flex: 1 1 auto;
    min-inline-size: 0;
    min-block-size: 3rem;
  }

  html.layout-phone body:not(.task-login) #message-header .header-summary {
    overflow-wrap: anywhere;
  }

  html.layout-phone body:not(.task-login) #message-header .header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
  }

  html.layout-phone body:not(.task-login) #message-header .header-links a {
    margin: 0;
  }
}

@media screen and (min-width: 769px) {
  html body:not(.task-login) #layout > div > .header,
  html body:not(.task-login) #layout > div > .footer {
    padding-right: 10px;
    padding-left: 10px;
  }

  html body:not(.task-login) #layout-list .searchbar {
    min-height: 38px;
    margin: 8px 10px;
    background: var(--glonin-surface);
    border: 1px solid var(--glonin-line);
    border-radius: var(--glonin-radius);
  }

  html body:not(.task-login) #mailboxlist > li > a,
  html body:not(.task-login) .folderlist > li > a {
    min-height: 40px;
    margin: 2px 8px;
    padding-right: 10px;
    border-radius: 8px;
  }

  html body:not(.task-login) #mailboxlist > li.selected > a,
  html body:not(.task-login) .folderlist > li.selected > a {
    background: var(--glonin-selected);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html body:not(.task-login) #messagelist tbody tr > td {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  html body:not(.task-login) .message-partheaders,
  html body:not(.task-login) .attachmentslist,
  html body:not(.task-login) .attachment-list {
    border-color: var(--glonin-line);
    border-radius: var(--glonin-radius-lg);
  }
}

@media screen and (min-width: 1201px) {
  html body:not(.task-login) #layout-sidebar {
    flex: 0 0 clamp(236px, 18vw, 280px);
    max-width: none;
  }

  html body:not(.task-login) #layout-list {
    flex: 0 0 clamp(360px, 29vw, 460px);
    max-width: none;
  }

  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    width: 62px !important;
    margin-right: 8px;
    margin-left: 8px;
    border-radius: var(--glonin-radius);
  }
}

/* Final phone overrides: full wordmark and the same semantic palette as PC. */
@media screen and (max-width: 480px) {
  html.layout-phone body #layout-menu.popover,
  html.layout-phone body #glonin-mobile-account-switch,
  html.layout-phone body #layout-menu #taskmenu {
    color: var(--glonin-text);
    background: var(--glonin-bg) !important;
    border-color: var(--glonin-line);
  }

  html.layout-phone body #layout-menu .popover-header {
    padding: 9px 14px;
    color: var(--glonin-text);
    background: var(--glonin-surface-raised) !important;
    border-bottom-color: var(--glonin-line);
  }

  html.layout-phone body #layout-menu .popover-header img {
    content: normal;
    width: min(148px, calc(100% - 64px));
    height: 40px;
    max-width: none;
    max-height: 40px;
    object-fit: contain;
    object-position: left center;
  }

  html.dark-mode.layout-phone body #layout-menu .popover-header img {
    content: normal;
  }

  html.layout-phone body #layout-menu .popover-header a.cancel {
    color: var(--glonin-text) !important;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-heading {
    color: var(--glonin-muted);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option {
    color: var(--glonin-text);
    background: var(--glonin-surface);
    border-color: var(--glonin-line);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
    border-color: var(--glonin-line-strong);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option.selected {
    color: var(--glonin-text);
    background: var(--glonin-selected);
    border-color: var(--glonin-line-strong);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-avatar {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
    color: #ffffff;
    background: var(--glonin-ink);
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-avatar {
    color: var(--glonin-ink);
    background: var(--glonin-accent);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-current {
    color: var(--glonin-ink);
    background: var(--glonin-accent);
  }

  html.layout-phone body #layout-menu #taskmenu > a,
  html.layout-phone body #layout-menu #taskmenu > span > a {
    color: var(--glonin-muted);
  }

  html.layout-phone body #layout-menu #taskmenu > a:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
  }

  html.layout-phone body #layout-menu #taskmenu > a.selected,
  html.layout-phone body #layout-menu #taskmenu > a.selected:hover,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected:hover {
    color: var(--glonin-text);
    background: var(--glonin-selected);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose.selected,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose:hover {
    color: var(--glonin-ink);
    background: var(--glonin-accent);
    box-shadow: none;
  }

  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose:hover {
    background: var(--glonin-accent-hover);
  }

  html.layout-phone body #glonin-desktop-account-switch {
    display: none !important;
  }
}

/*
 * Mobile form contract.
 *
 * This lives in the skin (not a no-frame plugin stylesheet), so it also
 * reaches Preferences, folders, identities, responses and filter editors
 * rendered inside Roundcube iframes.
 */
@media screen and (max-width: 48rem) {
  html:is(.layout-phone, .touch)
    body:not(.task-login)
    :is(
      input[type="text"],
      input[type="password"],
      input[type="email"],
      input[type="search"],
      input[type="tel"],
      input[type="url"],
      input[type="number"],
      input[type="date"],
      input[type="time"],
      input[type="datetime-local"],
      input[type="file"],
      select,
      textarea,
      [contenteditable="true"]
    ) {
    min-block-size: max(2.75rem, 44px) !important;
    font-size: 16px !important;
    touch-action: manipulation;
  }

  html:is(.layout-phone, .touch)
    body:not(.task-login)
    :is(
      button,
      .button,
      .btn,
      input[type="button"],
      input[type="submit"],
      input[type="reset"]
    ) {
    min-block-size: max(2.75rem, 44px) !important;
    touch-action: manipulation;
  }

  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-control,
  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-control-label {
    min-block-size: max(2.75rem, 44px) !important;
  }

  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-control-label {
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }

  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-control-label::before,
  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-control-label::after {
    inset-block-start: 50% !important;
    transform: translateY(-50%);
  }

  html:is(.layout-phone, .touch)
    body:not(.task-login)
    .custom-switch
    .custom-control-input:checked
    ~ .custom-control-label::after {
    transform: translate(0.75rem, -50%);
  }

  html.iframe:is(.layout-phone, .touch) {
    min-block-size: 100%;
    overflow-block: auto !important;
    overscroll-behavior-block: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.iframe:is(.layout-phone, .touch) body:not(.task-login) {
    block-size: auto !important;
    min-block-size: 100%;
    overflow: visible !important;
    touch-action: pan-y pinch-zoom;
  }

  /*
   * Managesieve renders rule cells as flex columns inside a real table.
   * Without an explicit mobile width contract the table uses the combined
   * min-content width of the operator and target controls and becomes wider
   * than the iframe. Stack those controls and let action buttons wrap.
   */
  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    .compact-table {
    inline-size: 100% !important;
    max-inline-size: 100% !important;
    table-layout: fixed;
  }

  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    .compact-table
    :is(tr, td) {
    min-inline-size: 0 !important;
    inline-size: 100% !important;
    max-inline-size: 100% !important;
  }

  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    :is(.rowactions, .rowtargets)
    > .flexbox {
    min-inline-size: 0 !important;
    inline-size: 100% !important;
    max-inline-size: 100% !important;
    flex-direction: column !important;
    gap: 0.5rem;
  }

  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    :is(.rowactions, .rowtargets)
    > .flexbox
    > *,
  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    :is(.multi-input, .multi-input > .content, .input-group) {
    min-inline-size: 0 !important;
    inline-size: 100% !important;
    max-inline-size: 100% !important;
  }

  html.iframe:is(.layout-phone, .touch)
    body.action-plugin-managesieve-action
    .rowbuttons {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    white-space: normal !important;
  }
}

/* Corporate controls also apply inside framed settings pages. */
html body input[type="checkbox"],
html body input[type="radio"] {
  accent-color: var(--glonin-accent) !important;
}

html body .custom-control-input:checked ~ .custom-control-label::before {
  color: var(--glonin-ink) !important;
  background-color: var(--glonin-accent) !important;
  border-color: var(--glonin-accent) !important;
}

html body .custom-control-input:focus ~ .custom-control-label::before {
  border-color: var(--glonin-accent) !important;
  box-shadow: 0 0 0 0.18rem rgba(255, 213, 26, 0.24) !important;
}

html body
  .custom-switch .custom-control-input:checked ~ .custom-control-label::after,
html body
  .custom-radio .custom-control-input:checked ~ .custom-control-label::after {
  background-color: var(--glonin-ink) !important;
}

html body
  .custom-checkbox .custom-control-input:checked ~ .custom-control-label::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M1.4 4.2 3.2 6 6.7 2' fill='none' stroke='%23201f1e' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3e%3c/svg%3e") !important;
}

html.dark-mode {
  color-scheme: dark;
  --glonin-text: #f7f5ef;
  --glonin-muted: #aba9a4;
  --glonin-bg: #171614;
  --glonin-surface: #201f1e;
  --glonin-surface-soft: #292826;
  --glonin-surface-raised: #302f2c;
  --glonin-rail: #121211;
  --glonin-line: rgba(255, 255, 255, 0.11);
  --glonin-line-strong: rgba(255, 213, 26, 0.38);
  --glonin-hover: rgba(255, 255, 255, 0.065);
  --glonin-selected: rgba(255, 213, 26, 0.14);
  --glonin-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
}

html body {
  font-family: var(--glonin-font);
}

html:not(.dark-mode) body {
  color: var(--glonin-ink);
  background: var(--glonin-bg);
}

html:not(.dark-mode) body #layout-sidebar,
html:not(.dark-mode) body #layout-list,
html:not(.dark-mode) body #layout-content {
  background-color: var(--glonin-surface);
  border-color: var(--glonin-line);
}

html:not(.dark-mode) body #layout-list {
  background-color: #fbfbfa;
}

html:not(.dark-mode) body #layout > div > .header,
html:not(.dark-mode) body #layout > div > .footer {
  color: var(--glonin-ink);
  background-color: var(--glonin-surface);
  border-color: var(--glonin-line);
}

html body #layout-menu .popover-header,
html body #taskmenu,
html body #taskmenu .special-buttons {
  background: var(--glonin-ink) !important;
}

html body #taskmenu a {
  color: rgba(255, 255, 255, 0.76);
  transition: color 140ms ease, background-color 140ms ease;
}

html body #taskmenu a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

html body #taskmenu a.selected,
html body #taskmenu a.selected:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
}

html body #taskmenu .action-buttons a.compose {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
}

html body #taskmenu .action-buttons a.compose:hover {
  color: #ffffff;
  background: #000000;
}

html:not(.dark-mode) body .listing li.selected,
html:not(.dark-mode) body .listing li.selected > a,
html:not(.dark-mode) body .listing li.selected > div > a,
html:not(.dark-mode) body .listing tr.selected > td {
  color: var(--glonin-ink);
  background-color: rgba(255, 213, 26, 0.18);
}

html:not(.dark-mode) body .listing li > a:hover,
html:not(.dark-mode) body .listing tr:hover > td {
  background-color: rgba(32, 31, 30, 0.045);
}

html body input.form-control,
html body select.form-control,
html body textarea.form-control,
html body .searchbar {
  border-radius: var(--glonin-radius);
}

html body input.form-control:focus,
html body select.form-control:focus,
html body textarea.form-control:focus,
html body button:focus-visible,
html body a:focus-visible {
  border-color: var(--glonin-accent);
  box-shadow: 0 0 0 3px rgba(255, 213, 26, 0.24);
  outline: none;
}

html body .btn.btn-primary,
html body button.btn-primary,
html body input.btn-primary {
  color: #ffffff;
  background: var(--glonin-ink);
  border-color: var(--glonin-ink);
  border-radius: var(--glonin-radius);
}

html body .btn.btn-primary:hover,
html body button.btn-primary:hover,
html body input.btn-primary:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  border-color: var(--glonin-accent);
}

html body .ui-dialog,
html body .popover,
html body .popupmenu {
  border-radius: var(--glonin-radius);
}

html body .header-title.username .ident-switch-wrapper {
  max-width: 19rem;
  gap: 0.4rem;
}

html body .header-title.username .ident-switch-wrapper select {
  font-family: var(--glonin-font);
  font-weight: 600 !important;
}

html body #ident-switch-badge {
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0 0.35rem;
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  border-radius: 999px;
}

html body #contactpic,
html body #contactpic img,
html body .contactphoto,
html body .contactphoto img {
  border-radius: 50%;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #layout-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  padding: 32px 20px;
  overflow-y: auto;
  box-sizing: border-box;
  background: #f7f7f5;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #logo {
  position: static;
  top: auto;
  display: block;
  width: 148px;
  height: 40px;
  max-width: 100%;
  max-height: 40px;
  margin: 0;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form {
  position: static;
  top: auto;
  width: 100%;
  max-width: 340px;
  margin: 0;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form table,
html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form tbody,
html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form tr,
html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form td.input {
  display: block;
  width: 100%;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form tr.form-group {
  margin: 0 0 12px;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form td.input {
  padding: 0;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .input-group-prepend {
  display: none;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .input-group > .form-control,
html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .input-group > .custom-select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--glonin-ink);
  background: #ffffff;
  border: 1px solid rgba(32, 31, 30, 0.2);
  border-radius: 8px !important;
  box-shadow: none;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .form-control::placeholder {
  color: #777777;
  opacity: 1;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .form-control:focus {
  border-color: var(--glonin-ink);
  box-shadow: 0 0 0 3px rgba(255, 213, 26, 0.2);
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .formbuttons {
  margin: 16px 0 0;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #rcmloginsubmit {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-transform: none !important;
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  border: 1px solid var(--glonin-accent);
  border-radius: 8px;
  box-shadow: none;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #rcmloginsubmit:hover {
  color: var(--glonin-ink);
  background: #f0c900;
  border-color: #f0c900;
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #rcmloginsubmit:active {
  transform: translateY(1px);
}

html body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-footer {
  display: none;
}

/*
 * The second-factor action reuses Roundcube's login template under the
 * `twofactor` task. Give that intermediate state its own clear, compact card
 * while retaining exactly the same logo, field and button geometry as login.
 */
html body:is(.task-twofactor, .glonin-twofactor-challenge) #layout-content {
  gap: 22px;
  background:
    radial-gradient(
      circle at 50% 22%,
      rgba(255, 213, 26, 0.16),
      transparent 34rem
    ),
    #f7f7f5;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge) #login-form {
  max-width: 380px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(32, 31, 30, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(32, 31, 30, 0.1);
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-intro {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  margin: 0 0 22px;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  border-radius: 12px;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-icon::before {
  content: "";
  width: 19px;
  height: 19px;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.5 3a6.5 6.5 0 0 0-5.8 9.43L2 19.13V22h2.87l1-1H8v-2h2v-2h2.13l1.44-1.44A6.5 6.5 0 1 0 14.5 3Zm3 6.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z'/%3E%3C/svg%3E");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.5 3a6.5 6.5 0 0 0-5.8 9.43L2 19.13V22h2.87l1-1H8v-2h2v-2h2.13l1.44-1.44A6.5 6.5 0 1 0 14.5 3Zm3 6.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z'/%3E%3C/svg%3E");
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-copy {
  min-width: 0;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-copy h2 {
  margin: 0;
  color: var(--glonin-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-copy p {
  margin: 5px 0 0;
  color: var(--glonin-muted);
  font-size: 13px;
  line-height: 1.4;
}

html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form tr:has(#_persisted_login),
html body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-pwa-login-install {
  display: none !important;
}

html.dark-mode body #taskmenu a.selected,
html.dark-mode body #taskmenu a.selected:hover,
html.dark-mode body .listing li.selected,
html.dark-mode body .listing li.selected > a,
html.dark-mode body .listing tr.selected > td {
  color: var(--glonin-ink);
  background-color: var(--glonin-accent);
}

html.dark-mode body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #layout-content {
  background: #171716;
}

html.dark-mode body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .form-control,
html.dark-mode body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .custom-select {
  color: #f5f5f3;
  background: #242321;
  border-color: rgba(255, 255, 255, 0.18);
}

html.dark-mode body:is(
  .task-login,
  .task-twofactor,
  .glonin-twofactor-challenge
) #login-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

html.dark-mode body:is(.task-twofactor, .glonin-twofactor-challenge)
  #layout-content {
  background:
    radial-gradient(
      circle at 50% 22%,
      rgba(255, 213, 26, 0.11),
      transparent 34rem
    ),
    #171716;
}

html.dark-mode body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form {
  background: rgba(36, 35, 33, 0.96);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

html.dark-mode body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-copy h2 {
  color: #f5f5f3;
}

html.dark-mode body:is(.task-twofactor, .glonin-twofactor-challenge)
  #login-form .glonin-twofactor-copy p {
  color: rgba(255, 255, 255, 0.62);
}

@media screen and (max-width: 480px) {
  html body:is(
    .task-login,
    .task-twofactor,
    .glonin-twofactor-challenge
  ) #layout-content {
    gap: 24px;
    padding: 24px 20px;
  }

  html body:is(
    .task-login,
    .task-twofactor,
    .glonin-twofactor-challenge
  ) #logo {
    width: 130px;
    height: auto;
    max-height: 35px;
  }

  html body:is(.task-twofactor, .glonin-twofactor-challenge) #login-form {
    max-width: 360px;
    padding: 22px 20px;
    border-radius: 14px;
  }

  html body:is(.task-twofactor, .glonin-twofactor-challenge)
    #login-form .glonin-twofactor-intro {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 11px;
    margin-bottom: 18px;
  }

  html body:is(.task-twofactor, .glonin-twofactor-challenge)
    #login-form .glonin-twofactor-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
}

@media screen and (max-height: 560px) {
  html body:is(
    .task-login,
    .task-twofactor,
    .glonin-twofactor-challenge
  ) #layout-content {
    justify-content: flex-start;
    gap: 20px;
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

/* Mobile application menu and one-tap mailbox list. */
@media screen and (max-width: 480px) {
  html.layout-phone body #layout-menu.popover {
    width: min(84vw, 328px) !important;
    max-width: 328px !important;
    min-height: 100%;
    min-height: 100dvh;
    color: var(--glonin-ink);
    background: var(--glonin-bg) !important;
    border: 0;
    border-radius: 0;
    box-shadow: 10px 0 32px rgba(0, 0, 0, 0.16);
  }

  html.layout-phone body #layout-menu .popover-header {
    flex: 0 0 58px;
    color: var(--glonin-ink);
    background: var(--glonin-surface) !important;
    border-bottom: 1px solid var(--glonin-line);
  }

  html.layout-phone body #layout-menu .popover-header a.cancel {
    color: var(--glonin-ink) !important;
  }

  html.layout-phone body #glonin-mobile-account-switch {
    flex: 0 0 auto;
    padding: 12px 10px 8px;
    color: var(--glonin-ink);
    background: var(--glonin-bg);
    border-bottom: 1px solid var(--glonin-line);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-heading {
    display: flex;
    min-height: 18px;
    margin: 0 4px 7px;
    align-items: center;
    color: rgba(32, 31, 30, 0.58);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  html.layout-phone body #glonin-mobile-account-switch .ident-switch-mobile {
    display: none !important;
  }

  html.layout-phone body #glonin-mobile-account-switch #ident-switch-badge {
    position: static;
    margin-left: auto;
    letter-spacing: normal;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-list {
    display: grid;
    max-height: 194px;
    gap: 6px;
    overflow-y: auto;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 11px 0 13px;
    align-items: center;
    gap: 9px;
    color: var(--glonin-ink);
    font-family: var(--glonin-font);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    background: var(--glonin-surface);
    border: 1px solid var(--glonin-line);
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option:hover {
    background: #ffffff;
    border-color: var(--glonin-line-strong);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option.selected {
    font-weight: 700;
    background: rgba(255, 213, 26, 0.14);
    border-color: rgba(229, 187, 0, 0.62);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-current {
    display: inline-flex;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-left: auto;
    align-items: center;
    justify-content: center;
    color: var(--glonin-ink);
    font-size: 13px;
    background: var(--glonin-accent);
    border-radius: 50%;
  }

  html.layout-phone body #layout-menu #taskmenu {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 8px 10px max(14px, env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--glonin-bg) !important;
  }

  html.layout-phone body #layout-menu #taskmenu > a,
  html.layout-phone body #layout-menu #taskmenu > span > a {
    height: 44px;
    line-height: 44px;
    margin: 0 0 2px;
    padding: 0 12px;
    color: rgba(32, 31, 30, 0.72);
    font-size: 16px;
    border: 0 !important;
    border-radius: 8px;
  }

  html.layout-phone body #layout-menu #taskmenu > a:hover {
    color: var(--glonin-ink);
    background: rgba(32, 31, 30, 0.06);
  }

  html.layout-phone body #layout-menu #taskmenu > a.selected,
  html.layout-phone body #layout-menu #taskmenu > a.selected:hover {
    color: var(--glonin-ink);
    font-weight: 650;
    background: var(--glonin-surface);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #layout-menu #taskmenu > .action-buttons {
    display: block;
    margin: 0 0 8px;
  }

  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose.selected,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose:hover {
    height: 42px;
    line-height: 42px;
    margin: 0;
    color: var(--glonin-ink);
    font-weight: 650;
    background: var(--glonin-accent);
    border-radius: 8px;
  }

  html.layout-phone body #layout-menu #taskmenu > .special-buttons {
    display: block;
    margin-top: auto;
    background: transparent !important;
  }

  html.dark-mode.layout-phone body #layout-menu.popover,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch,
  html.dark-mode.layout-phone body #layout-menu #taskmenu {
    color: #ffffff;
    background: var(--glonin-ink) !important;
  }

  html.dark-mode.layout-phone body #layout-menu .popover-header {
    color: #ffffff;
    background: var(--glonin-ink) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  html.dark-mode.layout-phone body #layout-menu .popover-header a.cancel {
    color: #ffffff !important;
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-heading {
    color: rgba(255, 255, 255, 0.56);
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.24);
  }

  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option.selected {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 213, 26, 0.72);
  }

  html.dark-mode.layout-phone body #layout-menu #taskmenu > a,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > span > a {
    color: rgba(255, 255, 255, 0.76);
  }

  html.dark-mode.layout-phone body #layout-menu #taskmenu > a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
  }

  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
  }
}

/* Final cascade layer: keep the refreshed controls above legacy child rules. */
html body:not(.task-login) #layout-menu,
html body:not(.task-login) #taskmenu,
html body:not(.task-login) #taskmenu .special-buttons {
  background: var(--glonin-rail) !important;
}

html body:not(.task-login) #taskmenu a.selected,
html body:not(.task-login) #taskmenu a.selected:hover,
html.dark-mode body:not(.task-login) #taskmenu a.selected,
html.dark-mode body:not(.task-login) #taskmenu a.selected:hover {
  color: #ffffff;
  background: rgba(255, 213, 26, 0.12);
  box-shadow: inset 3px 0 0 var(--glonin-accent);
}

html body:not(.task-login) #taskmenu .action-buttons a.compose,
html body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
  color: var(--glonin-ink);
  background: var(--glonin-accent);
  box-shadow: none;
}

html body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
  background: var(--glonin-accent-hover);
}

html.dark-mode body:not(.task-login) .listing li.selected,
html.dark-mode body:not(.task-login) .listing li.selected > a,
html.dark-mode body:not(.task-login) .listing li.selected > div > a,
html.dark-mode body:not(.task-login) .listing tr.selected > td {
  color: var(--glonin-text);
  background-color: var(--glonin-selected);
}

html body:not(.task-login) .listing tr.focused > td,
html.dark-mode body:not(.task-login) .listing tr.focused > td {
  color: var(--glonin-text);
  background-color: var(--glonin-selected);
  border-left-color: var(--glonin-accent);
  box-shadow: inset 3px 0 0 var(--glonin-accent);
}

@media screen and (min-width: 1201px) {
  html body:not(.task-login) #layout-sidebar {
    flex: 2 1 0;
    max-width: 30%;
  }

  html body:not(.task-login) #layout-list {
    flex: 3 1 0;
    max-width: 30%;
  }
}

@media screen and (max-width: 480px) {
  html.layout-phone body #layout-menu.popover,
  html.layout-phone body #glonin-mobile-account-switch,
  html.layout-phone body #layout-menu #taskmenu,
  html.dark-mode.layout-phone body #layout-menu.popover,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch,
  html.dark-mode.layout-phone body #layout-menu #taskmenu {
    color: var(--glonin-text);
    background: var(--glonin-bg) !important;
    border-color: var(--glonin-line);
  }

  html.layout-phone body #layout-menu .popover-header,
  html.dark-mode.layout-phone body #layout-menu .popover-header {
    padding: 9px 14px;
    color: var(--glonin-text);
    background: var(--glonin-surface-raised) !important;
    border-bottom-color: var(--glonin-line);
  }

  html.layout-phone body #layout-menu .popover-header img {
    content: normal;
    width: min(148px, calc(100% - 64px));
    height: 40px;
    max-width: none;
    max-height: 40px;
    object-fit: contain;
    object-position: left center;
  }

  html.dark-mode.layout-phone body #layout-menu .popover-header img {
    content: normal;
  }

  html.layout-phone body #layout-menu .popover-header a.cancel,
  html.dark-mode.layout-phone body #layout-menu .popover-header a.cancel {
    color: var(--glonin-text) !important;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-heading,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-heading {
    color: var(--glonin-muted);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option {
    color: var(--glonin-text);
    background: var(--glonin-surface);
    border-color: var(--glonin-line);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option:hover,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
    border-color: var(--glonin-line-strong);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-option.selected,
  html.dark-mode.layout-phone body #glonin-mobile-account-switch .glonin-account-option.selected {
    color: var(--glonin-text);
    background: var(--glonin-selected);
    border-color: var(--glonin-line-strong);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #layout-menu #taskmenu > a,
  html.layout-phone body #layout-menu #taskmenu > span > a,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > span > a {
    color: var(--glonin-muted);
  }

  html.layout-phone body #layout-menu #taskmenu > a:hover,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
  }

  html.layout-phone body #layout-menu #taskmenu > a.selected,
  html.layout-phone body #layout-menu #taskmenu > a.selected:hover,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected,
  html.dark-mode.layout-phone body #layout-menu #taskmenu > a.selected:hover {
    color: var(--glonin-text);
    background: var(--glonin-selected);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose.selected,
  html.layout-phone body #layout-menu #taskmenu > .action-buttons > a.compose:hover {
    color: var(--glonin-ink);
    background: var(--glonin-accent);
    box-shadow: none;
  }
}

/* A light interface keeps the desktop task rail light as well. */
@media (min-width: 481px) {
  html:not(.dark-mode) body:not(.task-login) #layout-menu,
  html:not(.dark-mode) body:not(.task-login) #taskmenu,
  html:not(.dark-mode) body:not(.task-login) #taskmenu .special-buttons {
    background: var(--glonin-surface) !important;
    border-color: var(--glonin-line);
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a {
    color: #5f5d59;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a:hover {
    color: var(--glonin-ink);
    background: var(--glonin-hover);
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected,
  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected:hover {
    color: var(--glonin-ink);
    background: var(--glonin-selected);
    box-shadow: inset 3px 0 0 var(--glonin-accent);
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu .action-buttons a.compose,
  html:not(.dark-mode) body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
    color: var(--glonin-ink);
    background: var(--glonin-accent);
    box-shadow: none;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
    background: var(--glonin-accent-hover);
  }
}

/* -------------------------------------------------------------------------
 * Final desktop application rail
 * One flat navigation language replaces the older overlapping rail rules.
 * Mobile keeps its full-width menu and mailbox list above.
 * ---------------------------------------------------------------------- */

@media screen and (min-width: 481px) {
  html body:not(.task-login) #layout-menu {
    box-sizing: border-box;
    border-right: 1px solid var(--glonin-line);
  }

  html:not(.dark-mode) body:not(.task-login) #layout-menu,
  html:not(.dark-mode) body:not(.task-login) #layout-menu .popover-header,
  html:not(.dark-mode) body:not(.task-login) #taskmenu,
  html:not(.dark-mode) body:not(.task-login) #taskmenu .special-buttons {
    color: var(--glonin-ink);
    background: var(--glonin-surface) !important;
    border-color: var(--glonin-line);
  }

  html.dark-mode body:not(.task-login) #layout-menu,
  html.dark-mode body:not(.task-login) #layout-menu .popover-header,
  html.dark-mode body:not(.task-login) #taskmenu,
  html.dark-mode body:not(.task-login) #taskmenu .special-buttons {
    color: var(--glonin-text);
    background: var(--glonin-rail) !important;
    border-color: var(--glonin-line);
  }

  html body:not(.task-login) #layout-menu .popover-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--glonin-line);
    box-shadow: none;
  }

  html body:not(.task-login) #layout-menu .popover-header img {
    content: normal;
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    padding: 0;
    object-fit: contain;
  }

  html.dark-mode body:not(.task-login) #layout-menu .popover-header img {
    content: normal;
  }

  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    position: relative;
    box-sizing: border-box;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a {
    color: #5f5d59;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a:hover {
    color: var(--glonin-ink);
    background: #f3f2ef !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected,
  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected:hover {
    color: var(--glonin-ink);
    background: #fff3b8 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html.dark-mode body:not(.task-login) #taskmenu a.selected,
  html.dark-mode body:not(.task-login) #taskmenu a.selected:hover {
    color: var(--glonin-text);
    background: #393425 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html body:not(.task-login) #taskmenu .action-buttons a.compose,
  html body:not(.task-login) #taskmenu .action-buttons a.compose.selected {
    color: var(--glonin-ink);
    background: var(--glonin-accent) !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html body:not(.task-login) #taskmenu .action-buttons a.compose:hover {
    color: var(--glonin-ink);
    background: #f0c900 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html body:not(.task-login) #taskmenu > a:focus-visible,
  html body:not(.task-login) #taskmenu > span > a:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 2px currentColor !important;
  }
}

/* Compact icon rail is reserved for the tablet range only. */
@media screen and (min-width: 481px) and (max-width: 768px) {
  html body:not(.task-login) #layout-menu .popover-header img {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
  }

  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    display: flex;
    width: 38px !important;
    height: 42px;
    margin: 6px auto 0 !important;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px !important;
  }

  html body:not(.task-login) #taskmenu > a::before,
  html body:not(.task-login) #taskmenu > span > a::before {
    float: none !important;
    width: auto;
    height: auto;
    margin: 0 !important;
    line-height: 42px;
  }

  html body:not(.task-login) #taskmenu > a > .inner,
  html body:not(.task-login) #taskmenu > span > a > .inner {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
}

/* Phone menu: keep the same flat selection language as desktop. */
@media screen and (max-width: 480px) {
  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected,
  html:not(.dark-mode) body:not(.task-login) #taskmenu a.selected:hover {
    color: var(--glonin-ink);
    background: #fff3b8 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html.dark-mode body:not(.task-login) #taskmenu a.selected,
  html.dark-mode body:not(.task-login) #taskmenu a.selected:hover {
    color: var(--glonin-text);
    background: #393425 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  html body:not(.task-login) #taskmenu .action-buttons a.compose,
  html body:not(.task-login) #taskmenu .action-buttons a.compose.selected {
    color: var(--glonin-ink);
    background: var(--glonin-accent) !important;
    background-image: none !important;
    box-shadow: none !important;
  }
}

/* Desktop: readable labels and the compact transparent GLONIN mark. */
@media screen and (min-width: 769px) {
  html body:not(.task-login) #layout-menu {
    width: 112px !important;
    min-width: 112px;
  }

  html:not(.dark-mode) body:not(.task-login) #layout-menu .popover-header img {
    content: normal;
  }

  html.dark-mode body:not(.task-login) #layout-menu .popover-header img {
    content: normal;
  }

  html body:not(.task-login) #layout-menu .popover-header img {
    width: 46px;
    height: 46px;
    max-width: 46px;
    max-height: 46px;
  }

  html body:not(.task-login) #taskmenu > .special-buttons {
    left: 0;
    right: auto;
    width: 111px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    background: transparent !important;
  }

  html:not(.dark-mode) body:not(.task-login) #taskmenu > .special-buttons,
  html.dark-mode body:not(.task-login) #taskmenu > .special-buttons {
    background: transparent !important;
  }

  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    display: block;
    width: 96px !important;
    height: 56px;
    margin: 4px auto 0 !important;
    padding: 5px 4px !important;
    border-radius: 8px !important;
    overflow: hidden;
    text-align: center;
  }

  html body:not(.task-login) #taskmenu > .action-buttons > a.compose {
    margin-top: 16px !important;
  }

  html body:not(.task-login) #taskmenu > a::before,
  html body:not(.task-login) #taskmenu > span > a::before {
    display: block;
    float: none !important;
    width: auto;
    height: 25px;
    margin: 0 !important;
    line-height: 25px;
  }

  html body:not(.task-login) #taskmenu > a > .inner,
  html body:not(.task-login) #taskmenu > span > a > .inner {
    display: block;
    overflow: hidden;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
  }

}

/* Flat folder/message selection: no stacked left stripes or flag-column bar. */
html body:not(.task-login) #mailboxlist > li.selected,
html body:not(.task-login) #mailboxlist > li.selected > a,
html body:not(.task-login) .folderlist > li.selected,
html body:not(.task-login) .folderlist > li.selected > a {
  box-shadow: none !important;
}

html body:not(.task-login) #messagelist tbody > tr.focused > td,
html body:not(.task-login) #messagelist tbody > tr.selected > td {
  border-left: 0 !important;
  box-shadow: none !important;
}

/* Unlimited mailboxes have no meaningful percentage: show infinity, not 0%. */
#quotadisplay[title="без ограничений"],
#quotadisplay[title="unlimited"],
#quotadisplay .count[title="без ограничений"],
#quotadisplay .count[title="unlimited"] {
  color: transparent !important;
  position: relative;
}

#quotadisplay[title="без ограничений"]::after,
#quotadisplay[title="unlimited"]::after,
#quotadisplay .count[title="без ограничений"]::after,
#quotadisplay .count[title="unlimited"]::after {
  content: "∞";
  color: var(--glonin-muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  position: absolute;
  inset: 50% 0 auto;
  text-align: center;
  transform: translateY(-50%);
}

/* -------------------------------------------------------------------------
 * GLONIN application rail v2
 * Square navigation, compact mailbox switcher and a quieter bottom cluster.
 * ---------------------------------------------------------------------- */

html body:not(.task-login) #taskmenu a.about {
  display: none !important;
}

@media screen and (min-width: 769px) {
  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    width: 96px !important;
    height: 96px;
    margin: 6px auto 0 !important;
    padding: 12px 4px !important;
    border-radius: 14px !important;
  }

  html body:not(.task-login) #taskmenu > .action-buttons > a.compose {
    margin-top: 12px !important;
  }

  html body:not(.task-login) #taskmenu > a::before,
  html body:not(.task-login) #taskmenu > span > a::before {
    height: 36px;
    line-height: 36px;
  }

  html body:not(.task-login) #taskmenu > a > .inner,
  html body:not(.task-login) #taskmenu > span > a > .inner {
    font-size: 11px;
    line-height: 18px;
  }

  html body:not(.task-login) #taskmenu > .special-buttons > a.theme > .inner {
    height: 24px;
    font-size: 10px;
    line-height: 12px;
    letter-spacing: -0.01em;
    white-space: normal;
  }

  html body:not(.task-login) #taskmenu > .special-buttons {
    gap: 0;
  }

  html body:not(.task-login) #glonin-account-rail {
    display: flex;
    width: 100%;
    margin: 0 0 4px;
    align-items: center;
    flex-direction: row;
    gap: 2px;
    justify-content: center;
  }

  html body:not(.task-login) #glonin-account-rail-list {
    display: flex;
    width: auto;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
    justify-content: center;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-rail-option,
  html body:not(.task-login) #glonin-account-rail .glonin-account-add {
    position: relative;
    display: inline-flex;
    box-sizing: border-box;
    width: 35px;
    height: 35px;
    min-width: 35px;
    min-height: 35px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: var(--glonin-text);
    background: transparent;
    border: 1px solid var(--glonin-line);
    border-radius: 50% !important;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-rail-option:hover,
  html body:not(.task-login) #glonin-account-rail .glonin-account-add:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
    border-color: var(--glonin-line-strong);
    transform: translateY(-1px);
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-rail-option.selected {
    border-color: var(--glonin-accent);
    box-shadow: 0 0 0 2px rgba(255, 213, 26, 0.42);
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-avatar {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-add {
    margin-top: 0;
    color: var(--glonin-muted);
    border-style: dashed;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-add-icon {
    display: block;
    margin-top: -2px;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
  }
}

@media screen and (min-width: 769px) and (max-height: 800px) {
  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    width: 72px !important;
    height: 72px;
    margin-top: 4px !important;
    padding: 8px 4px !important;
    border-radius: 12px !important;
  }

  html body:not(.task-login) #taskmenu > .action-buttons > a.compose {
    margin-top: 8px !important;
  }

  html body:not(.task-login) #taskmenu > a::before,
  html body:not(.task-login) #taskmenu > span > a::before {
    height: 30px;
    line-height: 30px;
  }

  html body:not(.task-login) #taskmenu > a > .inner,
  html body:not(.task-login) #taskmenu > span > a > .inner {
    font-size: 11px;
    line-height: 18px;
  }

  html body:not(.task-login) #glonin-account-rail-list {
    width: auto;
    gap: 2px;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-rail-option,
  html body:not(.task-login) #glonin-account-rail .glonin-account-add {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-avatar {
    flex-basis: 29px;
    width: 29px;
    height: 29px;
  }
}

@media screen and (min-width: 769px) and (min-height: 801px) {
  html body:not(.task-login) #taskmenu > .special-buttons > a.theme > .inner {
    height: 18px;
    line-height: 18px;
    white-space: nowrap;
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  html body:not(.task-login) #taskmenu > a,
  html body:not(.task-login) #taskmenu > span > a {
    width: 42px !important;
    height: 42px;
  }

  html body:not(.task-login) #glonin-account-rail {
    display: flex;
    width: 100%;
    margin-bottom: 4px;
    justify-content: center;
  }

  html body:not(.task-login) #glonin-account-rail-list {
    display: flex;
    width: 30px;
    flex-direction: column;
    gap: 4px;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-rail-option,
  html body:not(.task-login) #glonin-account-rail .glonin-account-add {
    display: inline-flex;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: var(--glonin-text);
    background: transparent;
    border: 1px solid var(--glonin-line);
    border-radius: 50% !important;
    text-decoration: none;
  }

  html body:not(.task-login) #glonin-account-rail .glonin-account-avatar {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
  }
}

@media screen and (max-width: 480px) {
  html body:not(.task-login) #glonin-account-rail {
    display: none !important;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-add-row {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    align-items: center;
    gap: 9px;
    color: var(--glonin-muted);
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: 1px dashed var(--glonin-line);
    border-radius: 8px;
    text-decoration: none;
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-add-row:hover {
    color: var(--glonin-text);
    background: var(--glonin-hover);
    border-color: var(--glonin-line-strong);
  }

  html.layout-phone body #glonin-mobile-account-switch .glonin-account-add-icon {
    display: inline-flex;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
    border: 1px solid currentColor;
    border-radius: 50%;
  }
}

/* Responsive received-message canvas.
 *
 * Sender HTML commonly arrives with a fixed pixel width. Constrain that
 * canvas to the current preview pane, scale media proportionally, and leave
 * genuinely unbreakable table content to Roundcube's inner scroll fallback.
 */
@media screen {
  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart {
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart .rcmBody {
    box-sizing: border-box !important;
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    margin-inline: 0 !important;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart :is(img, svg, video, canvas) {
    max-inline-size: 100% !important;
    block-size: auto !important;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart table {
    max-inline-size: 100% !important;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart
    :is(.rcmBody > table, .rcmBody > center > table) {
    inline-size: 100% !important;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart :is(td, th, p, li, a) {
    overflow-wrap: anywhere;
  }

  html body.task-mail:is(.action-preview, .action-show)
    #messagebody .message-htmlpart pre {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word;
  }
}

/* -------------------------------------------------------------------------
 * Modern action notifications — authoritative final layer
 *
 * The same neutral card is used for every state. Meaning is carried by the
 * icon tile, native alert semantics and text instead of a fully coloured
 * rectangle. This block also covers login and two-factor messages, where the
 * sidebar plugin is not loaded.
 * ---------------------------------------------------------------------- */

html body #messagestack {
  --glonin-toast-bottom: 16px;
  --glonin-toast-paint-y: 16px;
  position: fixed !important;
  z-index: 12050 !important;
  inset:
    auto 0
    calc(var(--glonin-toast-bottom) - var(--glonin-toast-paint-y))
    auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  width: min(412px, 100vw) !important;
  height: auto !important;
  max-height:
    calc(100vh - var(--glonin-toast-bottom) + var(--glonin-toast-paint-y))
    !important;
  max-height:
    calc(100dvh - var(--glonin-toast-bottom) + var(--glonin-toast-paint-y))
    !important;
  margin: 0 !important;
  padding: var(--glonin-toast-paint-y) 16px !important;
  overflow: auto !important;
  pointer-events: none;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

html body #messagestack > .ui.alert:not(.voice) {
  --glonin-toast-state: #0969da;
  --glonin-toast-tint: #eaf3ff;
  position: relative !important;
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 12px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 64px !important;
  margin: 0 !important;
  padding: 12px 14px !important;
  overflow: visible !important;
  color: var(--glonin-text, #201f1e) !important;
  background: var(--glonin-surface-raised, #ffffff) !important;
  border: 1px solid var(--glonin-line, rgba(32, 31, 30, 0.16)) !important;
  border-radius: 14px !important;
  box-shadow:
    0 16px 38px rgba(32, 31, 30, 0.16),
    0 3px 10px rgba(32, 31, 30, 0.08) !important;
  opacity: 1;
  pointer-events: auto;
  isolation: isolate;
  font-family: var(
    --glonin-font,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif
  ) !important;
  font-size: 14px !important;
  font-weight: 550 !important;
  line-height: 1.38 !important;
  animation: glonin-toast-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

html body #messagestack > .ui.alert:not(.voice) > i.icon {
  display: grid !important;
  flex: 0 0 36px !important;
  place-items: center !important;
  float: none !important;
  box-sizing: border-box !important;
  width: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  color: var(--glonin-toast-state) !important;
  background: var(--glonin-toast-tint) !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-size: 16px !important;
  line-height: 1 !important;
}

html body #messagestack > .ui.alert:not(.voice) > i.icon::before {
  float: none !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  color: currentColor !important;
  line-height: 1 !important;
  text-align: center !important;
}

html body #messagestack > .ui.alert:not(.voice) > span {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  color: inherit !important;
  overflow-wrap: anywhere;
}

html body #messagestack > .ui.alert:not(.voice) :is(h3, p) {
  margin: 0 !important;
  color: inherit !important;
}

html body #messagestack > .ui.alert:not(.voice)
  :is(a:not(.btn), .button-link) {
  border-radius: 4px;
  color: var(--glonin-toast-state) !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
}

html body #messagestack > .ui.alert:not(.voice) .boxbuttons {
  display: flex !important;
  flex: 0 1 auto !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 0 0 auto !important;
  white-space: normal !important;
}

html body #messagestack > .ui.alert:not(.voice)
  :is(.btn, button, input[type="button"], input[type="submit"]) {
  box-sizing: border-box !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 7px 10px !important;
  overflow: hidden !important;
  color: var(--glonin-text, #201f1e) !important;
  background: var(--glonin-surface-soft, #fbfbfa) !important;
  border: 1px solid var(--glonin-line-strong, rgba(32, 31, 30, 0.34)) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  font: inherit !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body #messagestack > .ui.alert:not(.voice)
  :is(a, .btn, button, input[type="button"], input[type="submit"]):focus-visible {
  outline: 2px solid var(--glonin-toast-state) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

@media (hover: hover) and (pointer: fine) {
  html body #messagestack > .ui.alert:not(.voice)
    :is(.btn, button, input[type="button"], input[type="submit"]):hover {
    color: var(--glonin-text, #201f1e) !important;
    background: var(--glonin-hover, rgba(32, 31, 30, 0.055)) !important;
    border-color: var(--glonin-toast-state) !important;
  }
}

html body #messagestack > .ui.alert:is(
    .alert-info,
    .notice,
    .information,
    .boxinformation
  ):not(.voice) {
  --glonin-toast-state: #0969da;
  --glonin-toast-tint: #eaf3ff;
}

html body #messagestack > .ui.alert:is(
    .alert-success,
    .confirmation,
    .boxconfirmation
  ):not(.voice) {
  --glonin-toast-state: #146c43;
  --glonin-toast-tint: #e8f6ee;
}

html body #messagestack > .ui.alert:is(
    .alert-warning,
    .warning,
    .boxwarning
  ):not(.voice) {
  --glonin-toast-state: #8a5700;
  --glonin-toast-tint: #fff4d1;
}

html body #messagestack > .ui.alert:is(
    .alert-danger,
    .error,
    .boxerror
  ):not(.voice) {
  --glonin-toast-state: #b42323;
  --glonin-toast-tint: #fdeaea;
}

html body #messagestack > .ui.alert.loading:not(.voice) {
  --glonin-toast-state: #5d6470;
  --glonin-toast-tint: #eff1f3;
}

html.dark-mode body #messagestack > .ui.alert:not(.voice) {
  color: var(--glonin-text, #f2f1ec) !important;
  background: var(--glonin-surface-raised, #222320) !important;
  border-color: var(--glonin-line, rgba(255, 255, 255, 0.1)) !important;
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.44),
    0 4px 12px rgba(0, 0, 0, 0.22) !important;
}

html.dark-mode body #messagestack > .ui.alert:is(
    .alert-info,
    .notice,
    .information,
    .boxinformation
  ):not(.voice) {
  --glonin-toast-state: #7ab8ff;
  --glonin-toast-tint: #19334f;
}

html.dark-mode body #messagestack > .ui.alert:is(
    .alert-success,
    .confirmation,
    .boxconfirmation
  ):not(.voice) {
  --glonin-toast-state: #7bdca8;
  --glonin-toast-tint: #183b2a;
}

html.dark-mode body #messagestack > .ui.alert:is(
    .alert-warning,
    .warning,
    .boxwarning
  ):not(.voice) {
  --glonin-toast-state: #ffd86b;
  --glonin-toast-tint: #493c16;
}

html.dark-mode body #messagestack > .ui.alert:is(
    .alert-danger,
    .error,
    .boxerror
  ):not(.voice) {
  --glonin-toast-state: #ff9b92;
  --glonin-toast-tint: #4a2424;
}

html.dark-mode body #messagestack > .ui.alert.loading:not(.voice) {
  --glonin-toast-state: #d5d8dc;
  --glonin-toast-tint: #34363a;
}

@keyframes glonin-toast-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media screen and (max-width: 48rem) {
  html body #messagestack {
    --glonin-toast-bottom: max(12px, env(safe-area-inset-bottom));
    --glonin-toast-paint-y: 12px;
    max-height:
      calc(100vh - var(--glonin-toast-bottom) + var(--glonin-toast-paint-y))
      !important;
    max-height:
      calc(100dvh - var(--glonin-toast-bottom) + var(--glonin-toast-paint-y))
      !important;
    gap: 8px !important;
  }

  html.layout-small body:is(
      .task-mail:not(.action-compose),
      .task-addressbook
    ) #messagestack {
    --glonin-toast-bottom: calc(
      52px + max(12px, env(safe-area-inset-bottom))
    );
  }

  html.layout-small body.task-mail.action-compose #messagestack {
    --glonin-toast-bottom: calc(
      58px + max(12px, env(safe-area-inset-bottom))
    );
  }

  html.layout-phone body.glonin-mobile-app-nav-active #messagestack {
    --glonin-toast-bottom: calc(
      var(--glonin-mobile-tabbar-size, 3.75rem) + 12px
    );
  }

  html.layout-phone body.glonin-mobile-app-nav-active:is(
      .task-mail:not(.action-compose),
      .task-addressbook
    ) #messagestack {
    --glonin-toast-bottom: calc(
      var(--glonin-mobile-tabbar-size, 3.75rem) + 52px + 12px
    );
  }

  html.layout-phone
    body.glonin-mobile-app-nav-active.task-mail.action-compose
    #messagestack {
    --glonin-toast-bottom: calc(
      var(--glonin-mobile-tabbar-size, 3.75rem) + 58px + 12px
    );
  }

  html body #messagestack > .ui.alert:not(.voice) {
    min-height: 58px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    box-shadow:
      0 12px 30px rgba(32, 31, 30, 0.16),
      0 2px 8px rgba(32, 31, 30, 0.08) !important;
  }

  html body #messagestack > .ui.alert:not(.voice) > i.icon {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
    font-size: 15px !important;
  }

  html body #messagestack > .ui.alert:not(.voice) .boxbuttons {
    flex-basis: 100% !important;
  }

  html body #messagestack > .ui.alert:not(.voice)
    :is(.btn, button, input[type="button"], input[type="submit"]) {
    min-height: 44px !important;
  }
}

@media screen and (max-width: 30rem) {
  html body #messagestack {
    inset:
      auto 0
      calc(var(--glonin-toast-bottom) - var(--glonin-toast-paint-y))
      0 !important;
    width: auto !important;
    padding:
      var(--glonin-toast-paint-y)
      max(12px, env(safe-area-inset-right))
      var(--glonin-toast-paint-y)
      max(12px, env(safe-area-inset-left)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body #messagestack > .ui.alert:not(.voice) {
    animation: none !important;
  }
}

@media (forced-colors: active) {
  html body #messagestack > .ui.alert:not(.voice) {
    color: CanvasText !important;
    background: Canvas !important;
    border-color: CanvasText !important;
    box-shadow: none !important;
  }

  html body #messagestack > .ui.alert:not(.voice) > i.icon {
    color: CanvasText !important;
    background: Canvas !important;
    border: 1px solid CanvasText !important;
  }
}

/*
 * Folder selector popover alignment — authoritative final layer.
 *
 * The shared desktop folder rule adds horizontal margins to every .folderlist
 * link while Elastic keeps popup links at width: 100%. In move/copy popovers
 * that combination makes each row overflow the panel on the right. Keep the
 * generated padding-left value (it carries folder depth), but give the popup
 * its own inset row geometry and stable icon/text columns.
 */
@media screen and (min-width: 769px) {
  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone).popupmenu {
    box-sizing: border-box;
    min-width: 200px;
    max-width: min(260px, calc(100vw - 24px));
    height: auto;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu {
    box-sizing: border-box;
    margin: 0;
    padding: 6px;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li {
    position: relative;
    box-sizing: border-box;
    height: 40px !important;
    min-height: 40px;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    + li::after {
    position: absolute;
    inset: 0 6px auto;
    height: 1px;
    content: "";
    background: var(--glonin-line);
    pointer-events: none;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    > a.icon {
    box-sizing: border-box;
    display: flex !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px;
    margin: 0 6px;
    padding-top: 0 !important;
    padding-right: 10px !important;
    padding-bottom: 0 !important;
    align-items: center;
    overflow: hidden;
    color: var(--glonin-text);
    line-height: 20px !important;
    border: 0 !important;
    border-radius: 8px;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    > a.icon::before {
    display: block !important;
    float: none !important;
    flex: 0 0 20px;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    margin: 0 10px 0 0 !important;
    font-size: 16px;
    line-height: 20px !important;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    > a.icon
    > span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    > a.active:hover {
    color: var(--glonin-text) !important;
    background: var(--glonin-hover) !important;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li
    > a:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 2px var(--glonin-accent) !important;
  }

  html:not(.layout-phone):not(.layout-small)
    body:not(.task-login)
    :is(#folder-selector, #folder-selector-clone)
    > ul.toolbarmenu.menu
    > li.selected
    > a.icon {
    background: var(--glonin-selected) !important;
    box-shadow: none !important;
  }
}
