/* Xbrook 2.3.1: consistent outline icons and grouped inbox controls.
   Skin only: original commands, disabled state, labels and focus remain native. */
body.xb-inbox-controls {
  --xbi-tint: color-mix(in srgb, var(--xb-accent-strong) 9%, var(--xb-surface));
  --xbi-edge: color-mix(in srgb, var(--xb-line) 68%, var(--xb-surface));
}
/* 2.4.5: full-width Inbox keeps related controls together. Visual order follows
   DOM/tab order; the same native controls retain their menu/command handlers. */
@media (min-width: 1025px) {
  body.xb-inbox-controls.xb-pane-off #layout-list > .xb-inbox-heading {
    padding: 10px 16px;
  }
  body.xb-inbox-controls.xb-pane-off #layout-list .xb-inbox-tabs {
    min-height: 0;
    padding: 3px;
  }
  body.xb-inbox-controls.xb-pane-off #layout-list .xb-inbox-tabs button {
    min-height: 36px;
  }
  body.xb-inbox-controls.xb-pane-off #messagelist-header > .toolbar {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    /* Elastic adds .popupmenu below 1201px, whose 100% height would stretch
       each toolbar to the entire header and clip the selected action row. */
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    background: transparent !important;
    box-shadow: none;
    border-radius: 0;
  }
  body.xb-inbox-controls.xb-pane-off #messagelist-header > a.refresh {
    flex: 0 0 auto;
    width: auto;
  }
  body.xb-inbox-controls.xb-pane-off #messagelist-header > a.refresh .inner {
    display: inline;
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    clip-path: none;
    overflow: visible;
  }
  /* Selection reveals its own action row instead of squeezing both toolbars
     onto one line. Nothing jumps between visual and keyboard navigation order. */
  body.xb-inbox-controls.xb-pane-off:not(.xb-no-selection) #messagelist-header > .xb-mailtoolbar {
    flex: 1 0 100%;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid var(--xbi-edge);
  }
  body.xb-inbox-controls.xb-pane-off #layout-list .xbo-organize {
    padding: 8px 18px 10px;
  }
  body.xb-inbox-controls.xb-pane-off .xbi-label-tools {
    flex: 0 1 auto;
    gap: 10px;
  }
  body.xb-inbox-controls.xb-pane-off .xbi-label-tools > .xf-field-label {
    flex: 0 0 auto;
  }
  body.xb-inbox-controls.xb-pane-off .xbo-organize .xf-field-label > #xbo-label-filter.xf-control {
    flex: 0 0 210px;
    width: 210px;
  }
}
body.xb-inbox-controls #messagelist-header :is(a, button),
body.xb-inbox-controls .xbo-organize button {
  -webkit-tap-highlight-color: transparent;
}
body.xb-inbox-controls #messagelist-header :is(a.select, a.threads, a.options, a.refresh, a.toolbar-menu-button, a.toolbar-list-button, a.task-menu-button, a.back-sidebar-button, .xbw-view-button):before,
body.xb-inbox-controls .xbo-organize button:before,
body.xb-inbox-controls .xb-inbox-tabs span:before {
  content: '' !important;
  display: inline-block;
  flex: 0 0 19px;
  width: 19px !important;
  height: 19px !important;
  margin: 0 !important;
  background: currentColor;
  mask: var(--xbi-icon) center / contain no-repeat;
  -webkit-mask: var(--xbi-icon) center / contain no-repeat;
  vertical-align: middle;
}
/* Paths below are a small, local 24px outline icon set. */
body.xb-inbox-controls #messagelist-header a.select,
body.xb-inbox-controls .xbo-mobile-select { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%224%22%20y%3D%224%22%20width%3D%2216%22%20height%3D%2216%22%20rx%3D%223%22%2F%3E%3Cpath%20d%3D%22m8%2012%203%203%205-6%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.threads { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M15%2015H7l-4%204V5a2%202%200%200%201%202-2h10a2%202%200%200%201%202%202v8a2%202%200%200%201-2%202Z%22%2F%3E%3Cpath%20d%3D%22M8%2018h9l4%203V10a2%202%200%200%200-2-2%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.options { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h7m4%200h5M4%2017h3m4%200h9%22%2F%3E%3Ccircle%20cx%3D%2213%22%20cy%3D%227%22%20r%3D%222%22%2F%3E%3Ccircle%20cx%3D%229%22%20cy%3D%2217%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.refresh { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%207v5h-5M4%2017v-5h5M5%208a8%208%200%200%201%2013-3l2%202M4%2017l2%202a8%208%200%200%200%2013-3%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header .xbw-view-button { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%224%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%223%22%2F%3E%3Cpath%20d%3D%22M9%204v16M3%209h6%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.toolbar-menu-button,
body.xb-inbox-controls #messagelist-header a.toolbar-list-button { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%225%22%20r%3D%221%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%221%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2219%22%20r%3D%221%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.task-menu-button { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%206h16M4%2012h16M4%2018h16%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #messagelist-header a.back-sidebar-button { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%207V5a2%202%200%200%201%202-2h5l2%203h7a2%202%200%200%201%202%202v11a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2Z%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls .xb-tab-inbox { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m3%2012%203-8h12l3%208v7a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2v-7Z%22%2F%3E%3Cpath%20d%3D%22M3%2012h5l2%204h4l2-4h5%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls .xb-tab-unread { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2214%22%20rx%3D%223%22%2F%3E%3Cpath%20d%3D%22m3%207%209%206%209-6%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls .xb-tab-star { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m12%203%202.8%205.7%206.2.9-4.5%204.4%201.1%206.2L12%2017.3l-5.6%202.9%201.1-6.2L3%209.6l6.2-.9Z%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #xbo-labels { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m20%2012-8-8H5v7l8%208a2%202%200%200%200%203%200l4-4a2%202%200%200%200%200-3Z%22%2F%3E%3Cpath%20d%3D%22M2%208v6l7%207%22%2F%3E%3Ccircle%20cx%3D%228%22%20cy%3D%227%22%20r%3D%221%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls .xbo-manage { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%2013%2011%204H4v7l9%209a2%202%200%200%200%203%200l4-4a2%202%200%200%200%200-3Z%22%2F%3E%3Ccircle%20cx%3D%227.5%22%20cy%3D%227.5%22%20r%3D%221%22%2F%3E%3C%2Fsvg%3E"); }
body.xb-inbox-controls #xbo-pin { --xbi-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m16%203%205%205-4%202-3%205%201%203-1%201-9-9%201-1%203%201%205-3%202-4ZM8%2016l-5%205%22%2F%3E%3C%2Fsvg%3E"); }

body.xb-inbox-controls #layout-list .xb-inbox-tabs {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--xbi-edge);
  border-radius: 12px;
  background: var(--xb-soft);
}
body.xb-inbox-controls #layout-list .xb-inbox-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  color: var(--xb-text-2);
}
body.xb-inbox-controls #layout-list .xb-inbox-tabs span[aria-hidden] {
  display: inline-flex;
}
body.xb-inbox-controls #layout-list .xb-inbox-tabs button[aria-pressed='true'],
body.xb-inbox-controls #layout-list .xb-inbox-tabs button[aria-pressed='true']:is(:hover, :focus, :active) {
  color: var(--xb-accent-strong);
  background: var(--xb-surface) !important;
  box-shadow: 0 1px 3px rgb(0 0 0 / 7%), inset 0 0 0 1px var(--xb-accent-strong);
  font-weight: 600;
}
body.xb-inbox-controls #layout-list .xbo-organize {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px 12px;
  margin: 0;
  border: 0;
  background: var(--xb-surface);
}
body.xb-inbox-controls .xbi-selection-tools,
body.xb-inbox-controls .xbi-label-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
body.xb-inbox-controls.xb-no-selection .xbi-selection-tools {
  display: none;
}
body.xb-inbox-controls .xbi-label-tools { flex: 1; }
body.xb-inbox-controls .xbi-label-tools > .xf-field-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}
body.xb-inbox-controls .xbo-organize .xf-field-label > .xbi-label-caption {
  position: static !important;
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  clip: auto !important;
  clip-path: none !important;
  overflow: visible !important;
  font: 500 12px/1.5 var(--xb-font);
  color: var(--xb-text-2);
}
body.xb-inbox-controls .xbo-organize .xf-field-label > #xbo-label-filter.xf-control {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 210px;
  height: 40px !important;
  min-height: 40px !important;
  font-size: 14px !important;
  background: var(--xb-soft) !important;
}
body.xb-inbox-controls #layout-list .xbo-organize .xbo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  min-width: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--xbi-edge);
  border-radius: 9px;
  background: var(--xb-surface);
  color: var(--xb-text);
  font: 500 13px/1 var(--xb-font);
  text-decoration: none;
}
body.xb-inbox-controls #layout-list .xbo-organize .xbo-button:not(:disabled):hover {
  border-color: var(--xb-accent-strong);
  background: var(--xbi-tint);
  color: var(--xb-accent-strong);
}
body.xb-inbox-controls.xb-no-selection #layout-list .xbo-organize #xbo-labels,
body.xb-inbox-controls.xb-no-selection #layout-list .xbo-organize #xbo-pin {
  display: none;
}
body.xb-inbox-controls #layout-list .xbo-organize .xbo-mobile-select { display: none; }
body.xb-inbox-controls #layout-list .xbo-organize .xbo-manage { color: var(--xb-accent-strong); }
body.xb-inbox-controls #layout-list .xbo-organize #xbo-selection {
  flex: 0 0 auto;
  color: var(--xb-accent-strong);
  font-size: 12px;
}
@media (min-width: 1025px) {
  body.xb-inbox-controls #layout-list > .xb-inbox-heading {
    padding: 16px 16px 12px;
    gap: 12px;
  }
  body.xb-inbox-controls #layout-list > #messagelist-header {
    margin: 0 12px;
    padding: 6px;
    gap: 4px;
    min-height: 50px;
    border: 1px solid var(--xbi-edge);
    border-radius: 11px;
    background: var(--xb-soft) !important;
  }
  body.xb-inbox-controls #messagelist-header :is(a, .xbw-view-button) {
    min-height: 36px;
    border-radius: 7px;
    color: var(--xb-text) !important;
  }
  body.xb-inbox-controls #messagelist-header > .xbw-view-button {
    margin-left: auto;
    border: 1px solid var(--xbi-edge);
    background: var(--xb-surface) !important;
    box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
  }
  body.xb-inbox-controls #messagelist-header > .xbw-view-button:after { display: none; }
  body.xb-inbox-controls #messagelist-header > .toolbar:not(.xb-mailtoolbar) {
    flex: 0 0 auto;
    width: auto;
  }
  body.xb-inbox-controls #messagelist-header > a.refresh {
    flex: 0 0 36px;
    width: 36px;
    margin: 0;
  }
  body.xb-inbox-controls #messagelist-header a.disabled { opacity: .6 !important; }
  body.xb-inbox-controls #messagelist-header a:not(.disabled):hover {
    background: var(--xb-surface) !important;
    color: var(--xb-accent-strong) !important;
  }
  @container xb-list (max-width: 580px) {
    body.xb-inbox-controls #layout-list .xbo-organize .xbo-button.xbo-manage {
      width: 40px;
      padding: 0;
      gap: 0;
      font-size: 0;
    }
    body.xb-inbox-controls:not(.xb-no-selection) #layout-list .xbo-organize .xbi-label-caption { display: none !important; }
  }
}
@media (max-width: 1024px) {
  body.xb-inbox-controls #layout-list .xbo-organize { padding: 10px 12px; gap: 8px; }
  body.xb-inbox-controls.xb-no-selection .xbi-selection-tools { display: flex; }
  body.xb-inbox-controls #layout-list .xbo-organize .xbo-mobile-select { display: inline-flex; }
  body.xb-inbox-controls .xbi-selection-tools { flex-wrap: wrap; }
  body.xb-inbox-controls.xb-no-selection .xbi-selection-tools #xbo-selection { display: none; }
  body.xb-inbox-controls #layout-list .xbo-organize .xbo-button {
    height: 44px;
    min-width: 44px;
  }
  body.xb-inbox-controls #layout-list .xbo-organize .xbo-manage {
    width: 44px;
    padding: 0;
    gap: 0;
    font-size: 0;
  }
  body.xb-inbox-controls .xbi-label-tools > .xf-field-label { gap: 5px; flex-direction: column; align-items: stretch; }
  body.xb-inbox-controls .xbo-organize .xf-field-label > .xbi-label-caption { font-size: 11px; line-height: 12px; }
  body.xb-inbox-controls .xbi-label-tools { align-items: flex-end; }
  body.xb-inbox-controls .xbo-organize .xf-field-label > #xbo-label-filter.xf-control {
    height: 44px !important;
    min-height: 44px !important;
    max-width: none;
    font-size: 16px !important;
  }
  body.xb-inbox-controls .xbi-selection-tools { align-self: flex-end; }
  body.xb-inbox-controls:not(.xb-no-selection) .xbo-organize .xbi-selection-tools { flex-basis: 100%; }
  body.xb-inbox-controls:not(.xb-no-selection) .xbo-organize #xbo-selection {
    position: static;
    width: auto;
    height: auto;
    margin: 0 auto 0 0;
    clip: auto;
    clip-path: none;
    overflow: visible;
  }
}
@media (max-width: 480px) {
  /* One contextual overflow button: inbox tools normally, message actions
     while selected. Both menus and their original command handlers are kept. */
  body.xb-inbox-controls.xb-no-selection #messagelist-header > .toolbar-menu-button,
  body.xb-inbox-controls:not(.xb-no-selection) #messagelist-header > .toolbar-list-button {
    display: none !important;
  }
  body.xb-inbox-controls #layout-list > #messagelist-header {
    gap: 0;
    padding-inline: 8px;
  }
  body.xb-inbox-controls #layout-list > #messagelist-header > .button.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  body.xb-inbox-controls #messagelist-header > .button.icon:before {
    float: none;
    line-height: 1;
  }
  body.xb-inbox-controls #messagelist-header > .xbw-view-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 9px;
    background: transparent !important;
    color: var(--xb-text) !important;
    font-size: 0;
  }
  body.xb-inbox-controls #messagelist-header > .xbw-view-button:after { display: none; }
  body.xb-inbox-controls #layout-list .xb-inbox-tabs {
    margin: 0 12px 2px;
    padding: 4px;
    border-radius: 12px;
  }
  body.xb-inbox-controls #layout-list .xb-inbox-tabs button {
    min-width: 0;
    min-height: 44px;
    padding: 0 5px;
    gap: 6px;
    font-size: 13px;
  }
  body.xb-inbox-controls #layout-list > .searchbar { margin: 12px 12px 10px; }
}
