/* MoreArom Mail v0.17.2 — optional modern webmail theme.
   All rules are scoped to data-ui-theme="modern" so Classic remains untouched. */
html[data-ui-theme="modern"]{
  --modern-bg:#f6f8fc;
  --modern-panel:#ffffff;
  --modern-border:#e7ebf1;
  --modern-text:#202124;
  --modern-muted:#6f7782;
  --modern-hover:#f1f4f9;
  --modern-selected:#dbe8fb;
  --modern-primary:#0b57d0;
  --modern-sidebar:#f6f8fc;
  --modern-chip:#eef2f7;
}
html[data-ui-theme="modern"][data-bs-theme="dark"]{
  --modern-bg:#11151b;
  --modern-panel:#171b21;
  --modern-border:#2b313a;
  --modern-text:#e8eaed;
  --modern-muted:#9aa0a6;
  --modern-hover:#232830;
  --modern-selected:#203a5f;
  --modern-primary:#8ab4f8;
  --modern-sidebar:#11151b;
  --modern-chip:#252b34;
}
html[data-ui-theme="modern"] body{background:var(--modern-bg);color:var(--modern-text)}
html[data-ui-theme="modern"] .topbar{height:64px;padding:8px 18px;gap:12px;background:var(--modern-bg);border-bottom:0;box-shadow:none}
html[data-ui-theme="modern"] .topbar .brand{width:226px;gap:6px}
html[data-ui-theme="modern"] .topbar .brand img{width:150px;max-height:42px}
html[data-ui-theme="modern"] .topbar .brand span{font-size:12px;color:#4e9f37}
html[data-ui-theme="modern"] .search{height:48px;max-width:720px;border-radius:24px;background:#eaf0f7;padding:0 18px;box-shadow:none}
html[data-ui-theme="modern"][data-bs-theme="dark"] .search{background:#252a31}
html[data-ui-theme="modern"] .search input{font-size:15px;color:var(--modern-text)}
html[data-ui-theme="modern"] .search i{font-size:18px;color:#4f5967}
html[data-ui-theme="modern"] .icon-btn{border-radius:50%;width:38px;height:38px;padding:0;display:inline-grid;place-items:center}
html[data-ui-theme="modern"] .employee-menu{border-radius:24px;padding:3px 8px 3px 4px;gap:8px}
html[data-ui-theme="modern"] .employee-menu:hover{background:var(--modern-hover)}
html[data-ui-theme="modern"] .topbar .avatar{width:38px;height:38px;font-size:14px}
html[data-ui-theme="modern"] .mail-shell{height:calc(100vh - 64px);background:var(--modern-bg);grid-template-columns:246px var(--mail-list-width,500px) minmax(470px,1fr);gap:0}
html[data-ui-theme="modern"] .sidebar{background:var(--modern-sidebar);border-right:0;padding:12px 10px 14px}
html[data-ui-theme="modern"] .compose{width:auto;min-width:142px;height:48px;border:0;border-radius:16px;margin:0 8px 10px;padding:0 18px;background:#fff;color:#2b2f34;box-shadow:0 1px 3px rgba(60,64,67,.22),0 1px 2px rgba(60,64,67,.12);font-weight:600}
html[data-ui-theme="modern"][data-bs-theme="dark"] .compose{background:#252a31;color:#e8eaed}
html[data-ui-theme="modern"] .compose:hover{background:#f8fbff;color:#174ea6;box-shadow:0 2px 6px rgba(60,64,67,.24)}
html[data-ui-theme="modern"] .sidebar nav a{min-height:34px;padding:6px 12px;border-radius:0 18px 18px 0;margin:0;font-size:14px;gap:12px}
html[data-ui-theme="modern"] .sidebar nav a:hover{background:var(--modern-hover)}
html[data-ui-theme="modern"] .sidebar nav a.active{background:#d3e3fd;color:#174ea6;font-weight:650}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a.active{background:#29415f;color:#d2e3fc}
html[data-ui-theme="modern"] .sidebar nav a i{font-size:16px;width:20px;text-align:center}
html[data-ui-theme="modern"] .sidebar nav a b{font-size:11px;background:transparent;padding:0;font-weight:650;color:inherit}
html[data-ui-theme="modern"] .section-title{font-size:11px;margin:18px 12px 6px;color:#687386;letter-spacing:.02em}
html[data-ui-theme="modern"] .labels-nav .label-filter{border-radius:0 18px 18px 0}
html[data-ui-theme="modern"] .labels-nav .label-filter.active{background:#d3e3fd;color:#174ea6}
html[data-ui-theme="modern"] .labels-nav .label-count{background:transparent!important;color:inherit!important;font-weight:600}
html[data-ui-theme="modern"] .client-version{padding-left:12px;color:#8b929c}
html[data-ui-theme="modern"] .list-pane{background:var(--modern-panel);border:1px solid var(--modern-border);border-top-left-radius:14px;border-top-right-radius:14px;overflow:auto}
html[data-ui-theme="modern"] .pane-title{height:66px;padding:10px 16px;background:var(--modern-panel);border-bottom:1px solid var(--modern-border);position:sticky;top:0;z-index:4}
html[data-ui-theme="modern"] .pane-title h4{font-size:20px;font-weight:700}
html[data-ui-theme="modern"] .pane-title span{font-size:12px;color:var(--modern-muted)}
html[data-ui-theme="modern"] .message{min-height:64px;padding:8px 12px;border-bottom:1px solid #eef1f4;grid-template-columns:18px 1fr auto;gap:8px;background:var(--modern-panel)}
html[data-ui-theme="modern"] .message:hover{background:#f3f6fa;box-shadow:inset 0 1px 0 #e9edf2,inset 0 -1px 0 #e9edf2}
html[data-ui-theme="modern"] .message.active{background:#eaf2ff}
html[data-ui-theme="modern"][data-bs-theme="dark"] .message:hover{background:#22272e}html[data-ui-theme="modern"][data-bs-theme="dark"] .message.active{background:#223753}
html[data-ui-theme="modern"] .message .sender{font-size:13px;font-weight:650}
html[data-ui-theme="modern"] .message .subject{font-size:13px;font-weight:600;line-height:1.25}
html[data-ui-theme="modern"] .message .preview,html[data-ui-theme="modern"] .message time{font-size:11.5px;color:var(--modern-muted)}
html[data-ui-theme="modern"] .message .unread{width:7px;height:7px;margin-top:5px;background:#1a73e8}
html[data-ui-theme="modern"] .label-badge,html[data-ui-theme="modern"] .message-label-chip{font-size:9px;padding:2px 6px;border-radius:4px}
html[data-ui-theme="modern"] .bulk-toolbar{min-height:42px;background:#edf4ff;border-bottom:1px solid #dfe7f2;padding:5px 8px;gap:4px}
html[data-ui-theme="modern"] .bulk-icon,html[data-ui-theme="modern"] .bulk-label-trigger,html[data-ui-theme="modern"] .bulk-spam-action{width:31px;height:31px;border-radius:50%;background:transparent;border-color:transparent}
html[data-ui-theme="modern"] .bulk-icon:hover,html[data-ui-theme="modern"] .bulk-label-trigger:hover{background:#dfe9f7}
html[data-ui-theme="modern"] .reader{background:var(--modern-panel);margin-left:10px;border:1px solid var(--modern-border);border-top-left-radius:14px;border-top-right-radius:14px}
html[data-ui-theme="modern"] .reader-tools{height:54px;padding:7px 12px;background:var(--modern-panel);border-bottom:1px solid var(--modern-border);gap:5px}
html[data-ui-theme="modern"] .reader-tools .btn{border:0;background:transparent;border-radius:18px;font-size:12px;padding:7px 11px}
html[data-ui-theme="modern"] .reader-tools .btn:hover{background:var(--modern-hover)}
html[data-ui-theme="modern"] .reader-action-icon{border:0;background:transparent;border-radius:50%;width:34px;height:34px}
html[data-ui-theme="modern"] .reader-action-icon:hover:not(:disabled){background:var(--modern-hover)}
html[data-ui-theme="modern"] .reader-message-head{padding:18px 22px 14px;border-bottom:1px solid var(--modern-border);background:var(--modern-panel)}
html[data-ui-theme="modern"] .reader-title-row h2,html[data-ui-theme="modern"] .reader-message-head h2,html[data-ui-theme="modern"] .reader h2{font-size:22px;font-weight:700;letter-spacing:-.01em}
html[data-ui-theme="modern"] .reader-message-head .sender-card{margin:12px 0 0;gap:9px}
html[data-ui-theme="modern"] .sender-avatar{width:38px;height:38px;font-size:13px}
html[data-ui-theme="modern"] .reader-message-body{padding:22px 24px;max-width:980px}
html[data-ui-theme="modern"] .body-copy{font-size:14px;line-height:1.55}
html[data-ui-theme="modern"] .reader-date{color:var(--modern-muted)}
html[data-ui-theme="modern"] .attachment{border-color:var(--modern-border);border-radius:12px;background:#fbfcfe}
html[data-ui-theme="modern"][data-bs-theme="dark"] .attachment{background:#1d2229}
html[data-ui-theme="modern"] .mail-status.error{border-radius:12px}
/* Keep desktop resize aligned to the narrower modern sidebar. */
@media (min-width:1280px) and (pointer:fine){
  html[data-ui-theme="modern"] .mail-shell{--mail-list-width:500px;grid-template-columns:246px var(--mail-list-width) minmax(470px,1fr)}
  html[data-ui-theme="modern"] .list-pane-resizer{left:calc(246px + var(--mail-list-width) - 4px)}
}
@media (min-width:821px) and (pointer:coarse) and (max-width:1366px){
  html[data-ui-theme="modern"] .topbar{height:60px;padding:6px 10px}
  html[data-ui-theme="modern"] .mail-shell{height:calc(100vh - 60px);grid-template-columns:minmax(330px,38vw) minmax(0,1fr)}
  html[data-ui-theme="modern"] .sidebar{background:var(--modern-sidebar)}
  html[data-ui-theme="modern"] .reader{margin-left:0;border-radius:0;border-top:0;border-bottom:0;border-right:0}
  html[data-ui-theme="modern"] .list-pane{border-radius:0;border-left:0;border-bottom:0}
}

/* v0.17.1 — layout hardening for the optional Modern theme.
   Keep the visual language modern, but preserve the proven structural model
   of the Classic theme so visual overrides cannot corrupt mail geometry. */
html[data-ui-theme="modern"] .mail-shell,
html[data-ui-theme="modern"] .topbar,
html[data-ui-theme="modern"] .sidebar,
html[data-ui-theme="modern"] .list-pane,
html[data-ui-theme="modern"] .reader,
html[data-ui-theme="modern"] .pane-title,
html[data-ui-theme="modern"] .bulk-toolbar,
html[data-ui-theme="modern"] .message,
html[data-ui-theme="modern"] .reader-tools,
html[data-ui-theme="modern"] .reader-message-head,
html[data-ui-theme="modern"] .reader-message-body{box-sizing:border-box}

/* Desktop geometry: all three columns remain independent and resizable. */
@media (min-width:1280px) and (pointer:fine){
  html[data-ui-theme="modern"] .mail-shell{
    grid-template-columns:246px var(--mail-list-width,500px) minmax(480px,1fr);
    min-width:0;
  }
  html[data-ui-theme="modern"] .sidebar,
  html[data-ui-theme="modern"] .list-pane,
  html[data-ui-theme="modern"] .reader{min-width:0}
}

/* Header and list header stay compact without changing document flow. */
html[data-ui-theme="modern"] .topbar{min-width:0}
html[data-ui-theme="modern"] .topbar .search{min-width:180px}
html[data-ui-theme="modern"] .pane-title{
  min-height:66px;
  height:66px;
  gap:10px;
}
html[data-ui-theme="modern"] .pane-title>div:first-child{min-width:0}
html[data-ui-theme="modern"] .pane-title h4{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
html[data-ui-theme="modern"] .pane-title span{display:block;overflow:hidden;text-overflow:ellipsis}

/* IMPORTANT: message DOM has four direct children:
   checkbox / unread dot / content / time. Never collapse it to 3 columns. */
html[data-ui-theme="modern"] .message{
  display:grid;
  grid-template-columns:24px 10px minmax(0,1fr) auto;
  align-items:start;
  column-gap:8px;
  row-gap:2px;
  min-width:0;
}
html[data-ui-theme="modern"] .message>.message-select{grid-column:1;grid-row:1;margin-top:3px}
html[data-ui-theme="modern"] .message>.unread{grid-column:2;grid-row:1;margin-top:6px;align-self:start}
html[data-ui-theme="modern"] .message>div{grid-column:3;grid-row:1;min-width:0}
html[data-ui-theme="modern"] .message>time{
  grid-column:4;
  grid-row:1;
  align-self:start;
  justify-self:end;
  margin:0;
  padding-top:1px;
  white-space:nowrap;
}
html[data-ui-theme="modern"] .message .sender,
html[data-ui-theme="modern"] .message .subject,
html[data-ui-theme="modern"] .message .preview,
html[data-ui-theme="modern"] .message-source{
  max-width:100%;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
html[data-ui-theme="modern"] .message .sender,
html[data-ui-theme="modern"] .message .subject,
html[data-ui-theme="modern"] .message .preview{white-space:nowrap}
html[data-ui-theme="modern"] .message-source span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Sticky bulk bar follows the 66 px modern list header exactly. */
html[data-ui-theme="modern"] .bulk-toolbar{
  top:66px;
  min-width:0;
  flex-wrap:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:none;
}
html[data-ui-theme="modern"] .bulk-toolbar::-webkit-scrollbar{display:none}
html[data-ui-theme="modern"] .bulk-toolbar>*{flex:none}
html[data-ui-theme="modern"] .bulk-toolbar .bulk-action-status{min-width:0;overflow:hidden;text-overflow:ellipsis}

/* Reader: stable toolbar and compact content shell. */
html[data-ui-theme="modern"] .reader{
  margin-left:0;
  border-left:0;
  border-radius:0;
  min-width:0;
  overflow:auto;
}
html[data-ui-theme="modern"] .reader-tools{
  min-height:54px;
  height:54px;
  flex-wrap:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:none;
}
html[data-ui-theme="modern"] .reader-tools::-webkit-scrollbar{display:none}
html[data-ui-theme="modern"] .reader-tools>*{flex:none}
html[data-ui-theme="modern"] .reader-tools .ms-auto{margin-left:auto!important}
html[data-ui-theme="modern"] .reader-message-head{min-width:0}
html[data-ui-theme="modern"] .reader-title-row{min-width:0;gap:18px}
html[data-ui-theme="modern"] .reader-title-row h2{min-width:0;overflow-wrap:anywhere}
html[data-ui-theme="modern"] .sender-card{min-width:0}
html[data-ui-theme="modern"] .sender-meta{min-width:0}
html[data-ui-theme="modern"] .sender-name-line{min-width:0;flex-wrap:wrap}
html[data-ui-theme="modern"] .reader-message-body{width:100%;max-width:none}
html[data-ui-theme="modern"] .body-copy{overflow-wrap:anywhere;word-break:normal}
html[data-ui-theme="modern"] .attachment-row{min-width:0}
html[data-ui-theme="modern"] .attachment{min-width:min(260px,100%);max-width:100%}

/* Menus/modals opened from mail keep the modern visual language but do not
   alter Bootstrap geometry. */
html[data-ui-theme="modern"] .mail-context-menu,
html[data-ui-theme="modern"] .label-menu,
html[data-ui-theme="modern"] .bulk-label-menu{border-color:var(--modern-border);box-shadow:0 10px 30px rgba(32,42,56,.14)}
html[data-ui-theme="modern"] .compose-modal{border-radius:16px;overflow:hidden;border-color:var(--modern-border)}
html[data-ui-theme="modern"] .compose-modal .modal-header,
html[data-ui-theme="modern"] .compose-modal .modal-footer{background:#fbfcfe;border-color:var(--modern-border)}
html[data-ui-theme="modern"][data-bs-theme="dark"] .compose-modal .modal-header,
html[data-ui-theme="modern"][data-bs-theme="dark"] .compose-modal .modal-footer{background:#171b21}

/* Tablet: preserve the app's drawer navigation and two-pane layout. */
@media (min-width:821px) and (pointer:coarse) and (max-width:1366px){
  html[data-ui-theme="modern"] .mail-shell{
    grid-template-columns:minmax(340px,43vw) minmax(0,1fr);
    gap:0;
  }
  html[data-ui-theme="modern"] .message{
    grid-template-columns:22px 9px minmax(0,1fr) auto;
    padding:10px 12px;
  }
  html[data-ui-theme="modern"] .pane-title{height:64px;min-height:64px;padding:9px 13px}
  html[data-ui-theme="modern"] .bulk-toolbar{top:64px}
  html[data-ui-theme="modern"] .reader-tools{height:52px;min-height:52px;padding:6px 8px}
  html[data-ui-theme="modern"] .reader-message-head{padding:14px 16px 12px}
  html[data-ui-theme="modern"] .reader-message-body{padding:16px}
  html[data-ui-theme="modern"] .reader-title-row h2,
  html[data-ui-theme="modern"] .reader-message-head h2,
  html[data-ui-theme="modern"] .reader h2{font-size:19px}
}

/* Phone/narrow split view: keep one-pane behavior and the same 4-cell row. */
@media (max-width:820px){
  html[data-ui-theme="modern"] .mail-shell{display:block}
  html[data-ui-theme="modern"] .message{
    grid-template-columns:22px 8px minmax(0,1fr) auto;
    padding:9px 10px;
    min-height:58px;
  }
  html[data-ui-theme="modern"] .pane-title{height:60px;min-height:60px;padding:8px 11px}
  html[data-ui-theme="modern"] .bulk-toolbar{top:60px}
  html[data-ui-theme="modern"] .reader-tools{height:50px;min-height:50px;padding:5px 7px}
  html[data-ui-theme="modern"] .reader-message-head{padding:12px 13px 10px}
  html[data-ui-theme="modern"] .reader-message-body{padding:14px 13px}
}


/* v0.17.2 — modern theme correctness and breakpoint audit */
html[data-ui-theme="modern"] .message:not(.is-unread) .unread{background:transparent!important}
html[data-ui-theme="modern"] .message:not(.is-unread) .sender,
html[data-ui-theme="modern"] .message:not(.is-unread) .subject{font-weight:500}
html[data-ui-theme="modern"] .message.is-unread .unread{background:#1a73e8!important}
html[data-ui-theme="modern"] .message.is-unread .sender{font-weight:700}
html[data-ui-theme="modern"] .message.is-unread .subject{font-weight:650}

html[data-ui-theme="modern"] .mobile-nav-toggle{display:none!important}
@media(max-width:820px), (min-width:821px) and (pointer:coarse) and (max-width:1366px){
  html[data-ui-theme="modern"] .mobile-nav-toggle{display:inline-flex!important}
}

/* A fine-pointer desktop keeps all three columns even when the browser is a
   little narrower; only touch tablets use the drawer/two-pane geometry. */
@media (min-width:821px) and (max-width:1279px) and (pointer:fine){
  html[data-ui-theme="modern"] .topbar{height:62px;padding:7px 12px}
  html[data-ui-theme="modern"] .mail-shell{height:calc(100vh - 62px);grid-template-columns:210px minmax(360px,40vw) minmax(390px,1fr)}
  html[data-ui-theme="modern"] .topbar .brand{width:190px}
  html[data-ui-theme="modern"] .topbar .brand img{width:135px}
  html[data-ui-theme="modern"] .sidebar{display:flex;position:relative;transform:none;width:auto;inset:auto;padding:10px 8px 12px}
  html[data-ui-theme="modern"] .mobile-sidebar-head,html[data-ui-theme="modern"] .mobile-sidebar-backdrop{display:none!important}
  html[data-ui-theme="modern"] .reader{margin-left:6px}
}


/* v0.18 — comprehensive dark theme pass for the main Mail screen.
   Goal: the dark theme toggle must restyle the full modern webmail shell,
   including the logo, left counters, reader toolbar buttons and reader panel. */
html[data-ui-theme="modern"][data-bs-theme="dark"] .topbar{
  background:#101720;
  border-bottom:1px solid rgba(63,84,109,.35);
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .topbar .brand img,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mobile-sidebar-brand img{
  filter:brightness(0) invert(1);
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .topbar .brand span,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mobile-sidebar-brand span{
  color:#8dd56b;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .search{
  background:#182230;
  border:1px solid #26364b;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .search:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .search:focus-within{
  background:#1b2939;
  border-color:#355273;
  box-shadow:0 0 0 3px rgba(79,140,255,.12);
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .search i,
html[data-ui-theme="modern"][data-bs-theme="dark"] .search input::placeholder{
  color:#8796aa;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .topbar>.icon-btn,
html[data-ui-theme="modern"][data-bs-theme="dark"] #mobileSidebarClose,
html[data-ui-theme="modern"][data-bs-theme="dark"] .list-controls .icon-btn,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mobile-back{
  background:#182230;
  border:1px solid #2a3b53;
  color:#dbe7f6;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .topbar>.icon-btn:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] #mobileSidebarClose:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .list-controls .icon-btn:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mobile-back:hover{
  background:#1d2b3c;
  border-color:#3a5373;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .employee-menu{
  background:#141d28;
  border:1px solid #233348;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .employee-menu:hover{
  background:#1a2532;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .employee-name strong{color:#ecf3ff}
html[data-ui-theme="modern"][data-bs-theme="dark"] .employee-name small{color:#8da1ba}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar{
  background:linear-gradient(180deg,#0f1724 0%,#111d2d 100%);
  border-right:1px solid #223248;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .compose{
  background:#2d6cdf;
  color:#fff;
  box-shadow:0 10px 24px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.08);
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .compose:hover{
  background:#3978eb;
  color:#fff;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .section-title,
html[data-ui-theme="modern"][data-bs-theme="dark"] .client-version{
  color:#90a1b7;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a,
html[data-ui-theme="modern"][data-bs-theme="dark"] .labels-nav .label-filter{
  color:#dbe7f6;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .labels-nav .label-filter:hover{
  background:#182638;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a.active,
html[data-ui-theme="modern"][data-bs-theme="dark"] .labels-nav .label-filter.active{
  background:#214166;
  color:#eef5ff;
  box-shadow:inset 3px 0 0 #76a8ff;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a b,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mailbox b,
html[data-ui-theme="modern"][data-bs-theme="dark"] .label-count{
  background:#1e2b3a;
  color:#d2deee !important;
  border:1px solid #304357;
  border-radius:999px;
  padding:3px 9px;
  min-width:30px;
  line-height:1.2;
  text-align:center;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .labels-nav .label-count{
  min-width:22px;
  padding:2px 7px;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .sidebar nav a.active b,
html[data-ui-theme="modern"][data-bs-theme="dark"] .labels-nav .label-filter.active .label-count{
  background:#2d4d73;
  color:#ffffff !important;
  border-color:#4e79a9;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .disabled-link{
  color:#76879a !important;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .list-pane,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader{
  background:#121c28;
  border-color:#243649;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .pane-title,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-tools,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-head{
  background:#121c28;
  border-color:#243649;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .pane-title h4,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-title-row h2,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-head h2{
  color:#f2f6fc;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .pane-title span,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-date,
html[data-ui-theme="modern"][data-bs-theme="dark"] .sender-meta .muted,
html[data-ui-theme="modern"][data-bs-theme="dark"] .preview,
html[data-ui-theme="modern"][data-bs-theme="dark"] .message time,
html[data-ui-theme="modern"][data-bs-theme="dark"] .message-source{
  color:#90a1b7;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .message{
  background:#121c28;
  border-bottom:1px solid #203244;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .message:hover{
  background:#162435;
  box-shadow:inset 0 1px 0 #213447,inset 0 -1px 0 #213447;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .message.active{
  background:#1b3450;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .message.is-selected{
  background:#1a3047;
  box-shadow:inset 3px 0 0 #6fa7ff;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-toolbar{
  background:#142132;
  border-bottom:1px solid #22364a;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-icon,
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-label-trigger{
  color:#dbe7f6;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-icon:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-label-trigger:hover{
  background:#1d2d42;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-tools .btn.btn-light,
html[data-ui-theme="modern"][data-bs-theme="dark"] #messageLabelsBtn{
  background:#182536;
  border:1px solid #2b3f58;
  color:#e8f0fb;
  box-shadow:none;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-tools .btn.btn-light:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] #messageLabelsBtn:hover{
  background:#1f3045;
  border-color:#3b5577;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-tool-separator{background:#26384d}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-action-icon{
  background:#182536;
  border-color:#2b3f58;
  color:#dbe7f6;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-action-icon:hover:not(:disabled){
  background:#1f3045;
  border-color:#3b5577;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body{
  background:#121c28;
  color:#ebf2fb;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .body-copy,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body p,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body div,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body span,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body td,
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body li{
  color:#ebf2fb;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-message-body a{color:#8ab4ff}
html[data-ui-theme="modern"][data-bs-theme="dark"] .attachment{
  background:#172332;
  border-color:#294055;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .attachment small{color:#94a8c0}
html[data-ui-theme="modern"][data-bs-theme="dark"] .mail-status.error{
  background:#31181d;
  color:#ffb7b7;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .dropdown-menu,
html[data-ui-theme="modern"][data-bs-theme="dark"] .label-menu,
html[data-ui-theme="modern"][data-bs-theme="dark"] .bulk-label-menu,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mail-context-menu,
html[data-ui-theme="modern"][data-bs-theme="dark"] .ctx-sub{
  background:#172230;
  border-color:#2a3b53;
  color:#e8f0fb;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .dropdown-item,
html[data-ui-theme="modern"][data-bs-theme="dark"] .ctx-btn,
html[data-ui-theme="modern"][data-bs-theme="dark"] .label-menu-item{
  color:#e8f0fb;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .dropdown-item:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .ctx-btn:hover,
html[data-ui-theme="modern"][data-bs-theme="dark"] .label-menu-item:hover{
  background:#203145;
}
html[data-ui-theme="modern"][data-bs-theme="dark"] .reader-empty,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mail-empty,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mail-loading,
html[data-ui-theme="modern"][data-bs-theme="dark"] .mail-error{
  color:#8fa3bc;
}
@media (max-width:820px){
  html[data-ui-theme="modern"][data-bs-theme="dark"] .mobile-sidebar-head{
    background:#101720;
    border-bottom-color:#223248;
  }
}


/* v0.18.1 — dark theme correction pass after live UI review.
   Tighten the selectors and add !important where the browser still kept
   light defaults for the logo, sidebar counters and main reader buttons. */
html[data-bs-theme="dark"] .topbar .brand img,
html[data-bs-theme="dark"] .mobile-sidebar-brand img{
  filter: brightness(0) invert(1) grayscale(1) !important;
}
html[data-bs-theme="dark"] .topbar .brand,
html[data-bs-theme="dark"] .mobile-sidebar-brand{
  color:#ffffff !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a b,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox b,
html[data-bs-theme="dark"] .mail-shell .sidebar .label-count,
html[data-bs-theme="dark"] .mail-shell .sidebar [data-folder-count],
html[data-bs-theme="dark"] .mail-shell .sidebar [data-mailbox-unseen]{
  background:#223142 !important;
  border:1px solid #31495f !important;
  color:#dce7f5 !important;
  border-radius:999px !important;
  padding:3px 9px !important;
  min-width:30px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1.15 !important;
  box-shadow:none !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a.active b,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox.active b,
html[data-bs-theme="dark"] .mail-shell .sidebar .label-filter.active .label-count{
  background:#2f4f72 !important;
  border-color:#4a75a7 !important;
  color:#ffffff !important;
}
html[data-bs-theme="dark"] .reader-tools .btn,
html[data-bs-theme="dark"] .reader-tools .btn.btn-light,
html[data-bs-theme="dark"] .reader-tools #replyBtn,
html[data-bs-theme="dark"] .reader-tools #replyAllBtn,
html[data-bs-theme="dark"] .reader-tools #forwardBtn,
html[data-bs-theme="dark"] .reader-tools #messageLabelsBtn{
  background:#273140 !important;
  border:1px solid #36485f !important;
  color:#eef4fb !important;
  box-shadow:none !important;
}
html[data-bs-theme="dark"] .reader-tools .btn:hover:not(:disabled),
html[data-bs-theme="dark"] .reader-tools .btn.btn-light:hover:not(:disabled),
html[data-bs-theme="dark"] .reader-tools #replyBtn:hover:not(:disabled),
html[data-bs-theme="dark"] .reader-tools #replyAllBtn:hover:not(:disabled),
html[data-bs-theme="dark"] .reader-tools #forwardBtn:hover:not(:disabled),
html[data-bs-theme="dark"] .reader-tools #messageLabelsBtn:hover:not(:disabled){
  background:#303c4d !important;
  border-color:#4a607a !important;
  color:#ffffff !important;
}
html[data-bs-theme="dark"] .reader-tools .btn:disabled,
html[data-bs-theme="dark"] .reader-tools #replyBtn:disabled,
html[data-bs-theme="dark"] .reader-tools #replyAllBtn:disabled,
html[data-bs-theme="dark"] .reader-tools #forwardBtn:disabled,
html[data-bs-theme="dark"] .reader-tools #messageLabelsBtn:disabled{
  background:#202937 !important;
  border-color:#2b394c !important;
  color:#8ea0b6 !important;
  opacity:1 !important;
}
html[data-bs-theme="dark"] .reader-tools .dropdown-toggle::after{
  border-top-color:#cfdced !important;
}


/* v0.18.2 — universal dark-theme polish for both Classic and Modern layouts.
   These selectors intentionally do not depend on data-ui-theme so the visible
   Mail screen receives the same dark treatment whichever layout is selected. */

/* Sidebar: softer text instead of hard white. */
html[data-bs-theme="dark"] .mail-shell .sidebar nav a:not(.active),
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox:not(.active),
html[data-bs-theme="dark"] .mail-shell .sidebar .label-filter:not(.active){
  color:#c3cedb !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a:not(.active) i,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox:not(.active) i{
  color:#afbdcd !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar .section-title,
html[data-bs-theme="dark"] .mail-shell .sidebar .client-version{
  color:#7f91a6 !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar .disabled-link{
  color:#697889 !important;
}

/* Active Inbox / mailbox / label: dark selection rather than a light pill. */
html[data-bs-theme="dark"] .mail-shell .sidebar nav a.active,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox.active,
html[data-bs-theme="dark"] .mail-shell .sidebar .label-filter.active{
  background:#203650 !important;
  color:#dbe9fb !important;
  box-shadow:inset 3px 0 0 #5c91d8 !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a.active:hover,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox.active:hover,
html[data-bs-theme="dark"] .mail-shell .sidebar .label-filter.active:hover{
  background:#25415f !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a.active i,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox.active i{
  color:#9fc4ff !important;
}
html[data-bs-theme="dark"] .mail-shell .sidebar nav a.active b,
html[data-bs-theme="dark"] .mail-shell .sidebar .mailbox.active b,
html[data-bs-theme="dark"] .mail-shell .sidebar .label-filter.active .label-count{
  background:#31506f !important;
  border-color:#456986 !important;
  color:#eaf3ff !important;
}

/* Read mail is intentionally quieter so unread mail becomes the visual focus. */
html[data-bs-theme="dark"] .message:not(.is-unread) .sender{
  color:#b7c2cf !important;
  font-weight:500 !important;
}
html[data-bs-theme="dark"] .message:not(.is-unread) .subject{
  color:#aeb9c6 !important;
  font-weight:500 !important;
}
html[data-bs-theme="dark"] .message:not(.is-unread) .preview,
html[data-bs-theme="dark"] .message:not(.is-unread) .message-source,
html[data-bs-theme="dark"] .message:not(.is-unread) time{
  color:#71849b !important;
}

/* Unread mail remains brighter and slightly heavier. */
html[data-bs-theme="dark"] .message.is-unread .sender{
  color:#edf4fc !important;
  font-weight:700 !important;
}
html[data-bs-theme="dark"] .message.is-unread .subject{
  color:#e6eef8 !important;
  font-weight:650 !important;
}
html[data-bs-theme="dark"] .message.is-unread .preview,
html[data-bs-theme="dark"] .message.is-unread .message-source,
html[data-bs-theme="dark"] .message.is-unread time{
  color:#8ea3bc !important;
}
html[data-bs-theme="dark"] .message.is-unread .unread{
  background:#3f8cff !important;
  box-shadow:0 0 0 2px rgba(63,140,255,.09);
}

/* Keep the selected/open message legible without making read mail white again. */
html[data-bs-theme="dark"] .message.active:not(.is-unread) .sender,
html[data-bs-theme="dark"] .message.active:not(.is-unread) .subject{
  color:#c9d5e3 !important;
}

/* v0.18.19 — Compose controls and legible 14pt reader subjects.
   Styles intentionally support Classic/Modern plus light/dark. */
#composeModal .compose-recipient-field[data-recipient-role="to"]{
  padding-right:44px;
}
#composeModal .compose-to-contacts{
  position:absolute;right:1px;top:50%;transform:translateY(-50%);
  z-index:2;display:inline-grid;place-items:center;flex:none;
  width:34px;height:34px;padding:0;border:1px solid var(--border);
  background:var(--bs-body-bg);color:var(--muted);border-radius:8px;
  cursor:pointer;transition:background .15s,color .15s,border-color .15s;
}
#composeModal .compose-to-contacts:hover{
  background:var(--selected);border-color:var(--accent);color:var(--accent);
}
#composeModal .compose-to-contacts:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px;
}
[data-bs-theme="dark"] #composeModal .compose-to-contacts{
  background:#1a2839;border-color:#34485f;color:#dce7f6;
}
[data-bs-theme="dark"] #composeModal .compose-to-contacts:hover{
  background:#293e55;border-color:#628bc0;color:#fff;
}
#composeModal .compose-attachment-shortcut{
  width:37px;min-width:37px;height:37px;padding:0;
  font-size:16px;line-height:1;
}
#composeModal .compose-attachment-shortcut:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px;
}
/* 19px ~= 14pt at the CSS reference pixel density. Only subject headings. */
.mail-shell .reader .reader-message-head .reader-title-row > h2{
  font-size:19px!important;line-height:1.36;
}
@media(max-width:820px){
  .mail-shell .reader .reader-message-head .reader-title-row > h2{
    font-size:17px!important;line-height:1.38;
  }
  #composeModal .compose-to-contacts{width:32px;height:32px;}
  #composeModal .compose-recipient-field[data-recipient-role="to"]{padding-right:40px;}
}

/* v0.18.21: keep the Trash action prominent in Modern and dark Modern. */
html[data-ui-theme="modern"] .empty-trash-btn{border-radius:18px}
html[data-ui-theme="modern"] .pane-title:has(.empty-trash-btn:not([hidden])){min-height:68px;height:auto}


/* v0.26.3 — keep reader toolbar scrollable and expose the scrollbar in Modern UI. */
html[data-ui-theme="modern"] .reader-tools{
  overflow-x:auto!important;
  overflow-y:hidden!important;
  scrollbar-width:thin!important;
  scrollbar-color:color-mix(in srgb,var(--modern-muted) 50%,transparent) transparent!important;
}
html[data-ui-theme="modern"] .reader-tools::-webkit-scrollbar{
  display:block!important;
  height:6px;
}
html[data-ui-theme="modern"] .reader-tools::-webkit-scrollbar-track{background:transparent}
html[data-ui-theme="modern"] .reader-tools::-webkit-scrollbar-thumb{
  background:color-mix(in srgb,var(--modern-muted) 42%,transparent);
  border-radius:999px;
}
html[data-ui-theme="modern"] .reader-tools::-webkit-scrollbar-thumb:hover{
  background:color-mix(in srgb,var(--modern-muted) 68%,transparent);
}
@media (min-width:821px){
  html[data-ui-theme="modern"] .reader-tools{
    min-height:60px!important;
    height:60px!important;
    padding-bottom:3px!important;
  }
}
