/* Shared app chrome, using adm's bruma canvas and prism-lavender header artwork. */
:root {
  --rf-topbar-height: 58px;
  --rf-header-art: url('../images/prism-lavender.jpg');
  --rf-header-filter: blur(1.6px) saturate(1.25) brightness(1.12);
  --rf-header-edge: 28%;
  --rf-header-center: 92%;
  --rf-control-font-size: 14px;
  --rf-control-line-height: 20px;
  --rf-control-height: 36px;
  --rf-control-icon-size: 16px;
}

html.dark-mode {
  --rf-header-filter: blur(1.1px) saturate(1.65) brightness(1.14);
  --rf-header-edge: 18%;
  --rf-header-center: 78%;
}

.rf-app-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--app-art) center / cover no-repeat;
  filter: blur(var(--app-art-blur));
  transform: scale(1.06);
}

html[data-rf-skin="gmail_like"] body.rf-has-topbar {
  padding-top: var(--rf-topbar-height);
  background: var(--app-glow), var(--rf-bg) !important;
}

html[data-rf-skin="gmail_like"] body.rf-has-topbar #layout {
  position: relative;
  z-index: 1;
  height: calc(100dvh - var(--rf-topbar-height)) !important;
  min-height: calc(100dvh - var(--rf-topbar-height)) !important;
  background: transparent !important;
}

html[data-rf-skin="gmail_like"] body.rf-has-topbar.task-mail:is(.action-none, .action-show) #layout-sidebar {
  background: transparent !important;
}

#rf-app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--rf-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  isolation: isolate;
  background: var(--header-surface);
  border-bottom: 1px solid var(--rf-border);
}

.rf-header-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.rf-header-art::before {
  content: "";
  position: absolute;
  inset: -10%;
  background: var(--rf-header-art) center / cover;
  filter: var(--rf-header-filter);
  transform: scale(1.05);
}

.rf-header-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--header-surface) var(--rf-header-edge), transparent),
      color-mix(in srgb, var(--header-surface) var(--rf-header-center), transparent) 18%,
      color-mix(in srgb, var(--header-surface) var(--rf-header-center), transparent) 82%,
      color-mix(in srgb, var(--header-surface) var(--rf-header-edge), transparent)),
    linear-gradient(180deg,
      color-mix(in srgb, var(--header-surface) 36%, transparent),
      color-mix(in srgb, var(--header-surface) 46%, transparent));
}

#rf-app-header a {
  color: var(--rf-text);
  text-decoration: none;
}

.rf-app-heading, .rf-app-brand, .rf-app-actions, .rf-app-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rf-app-brand { font-size: 17px; font-weight: 650; }
.rf-app-heading { gap: 8px; }
#rf-app-header #rf-sidebar-toggle {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  color: var(--rf-text);
}
#rf-app-header #rf-sidebar-toggle:hover { background: var(--rf-accent-soft); }
.rf-icon.sidebar::before { content: "\f0c9"; font-size: 17px; }
.rf-app-brand img { flex: 0 0 36px; }
#rf-app-domain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-app-actions { flex: 0 0 auto; gap: 4px; }
.rf-app-action {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
#rf-mail-admin-link[hidden] { display: none; }
#rf-mail-admin-menu[hidden] { display: none; }
#rf-mail-admin-link[aria-current="page"] {
  background: var(--rf-accent-soft);
  color: var(--rf-accent-strong);
}
.rf-app-action:hover, .rf-app-account:hover { background: var(--rf-accent-soft); }
.rf-app-action:disabled {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rf-muted);
  opacity: .6;
  cursor: default;
}
.rf-app-action:focus-visible, .rf-app-account:focus-visible, .rf-app-brand:focus-visible {
  outline: 2px solid var(--rf-accent-strong);
  outline-offset: 2px;
}
.rf-icon::before, .rf-app-action::before {
  font-family: Icons;
  font-weight: 900;
  font-size: 15px;
}
.rf-icon.theme::before { content: "\f186"; }
html.dark-mode .rf-icon.theme::before { content: "\f185"; }
.rf-icon.admin::before { content: "\f0e8"; }
.rf-app-action.contacts::before { content: "\f2b9"; }
.rf-app-action.settings::before { content: "\f013"; }
.rf-icon.chevron::before { content: "\f107"; font-size: 12px; }
.rf-app-account { margin-left: 8px; padding: 4px 8px; border-radius: 10px; }
.rf-account-avatar,
#rf-account-menu .rf-account-initial {
  display: grid;
  grid-template: 1fr / 1fr;
  place-items: center;
  overflow: hidden;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--rf-accent);
  color: var(--rf-on-accent);
  font-weight: 700;
}
.rf-account-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  font-size: 13px;
}
.rf-account-avatar > *,
#rf-account-menu .rf-account-initial > * {
  grid-area: 1 / 1;
}
.rf-account-avatar img,
#rf-account-menu .rf-account-initial img {
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.rf-account-email { max-width: 230px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }

#rf-account-menu { width: 340px; max-width: calc(100vw - 24px); }
#rf-account-menu a.rf-account-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.4;
  padding: 10px 16px;
  white-space: normal;
}
#rf-account-menu a.rf-account-switch::before { content: none; }
.rf-account-choice-details { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#rf-account-menu a[aria-current="true"] { background: var(--rf-accent-soft); }
#rf-account-menu a[aria-current="true"]::after {
  content: "\f00c";
  font-family: Icons;
  color: var(--rf-accent-strong);
}
.rf-account-choice-name { overflow-wrap: anywhere; color: var(--rf-text); font-size: 14px; }
.rf-account-state { color: var(--rf-muted); font-size: 12px; }
#rf-account-menu .rf-account-add { border-top: 1px solid var(--rf-border); }
#rf-account-menu .rf-account-add a::before { content: "\f067"; }
#rf-account-menu a[aria-disabled="true"] { opacity: .55; cursor: wait; }
.rf-account-progress { margin: 0; padding: 12px 16px; color: var(--rf-muted); font-size: 13px; }
.rf-account-progress[hidden] { display: none; }

.rf-saved-login, .rf-login-back {
  display: block;
  margin: 8px 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rf-accent-strong);
  font-size: 13px;
  cursor: pointer;
}
.rf-saved-login[hidden], #rf-login-feedback[hidden] { display: none; }
.rf-login-back { text-align: center; margin: 18px 0 0; }
#rf-login-feedback { font-size: 13px; color: var(--rf-muted); margin: 12px 0; }
.rf-login-accounts { margin-top: 18px; font-size: 13px; color: var(--rf-muted); }
.rf-login-accounts summary { cursor: pointer; }
.rf-login-accounts a { display: block; padding: 8px 0; overflow-wrap: anywhere; }

/* Folder navigation occupies only the module tools slot. */
#layout-sidebar #rf-compose-wrap { display: block; padding: 18px 12px 12px; margin: 0; }
#layout-sidebar #rf-compose-wrap .rf-compose-primary {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 10px 12px !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: #15803d !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgb(21 128 61 / 14%) !important;
  text-decoration: none;
}
#layout-sidebar #rf-compose-wrap .rf-compose-primary:hover { background: #166534 !important; }
#layout-sidebar #rf-compose-wrap .rf-compose-primary::before {
  content: "\f044";
  display: block !important;
  float: none;
  margin: 0;
  font-family: Icons;
  font-size: 17px;
  font-weight: 900;
  color: inherit;
}
#layout-sidebar #rf-compose-wrap .inner { color: inherit; font-size: var(--rf-control-font-size); font-weight: 650; line-height: var(--rf-control-line-height); }
body.task-mail:is(.action-none, .action-show) #folderlist-content { flex: 0 0 auto; min-height: 0; }
body.task-mail:is(.action-none, .action-show) #mailboxlist { display: flex; flex-direction: column; min-height: 0; padding-bottom: 8px; }
body.task-mail:is(.action-none, .action-show) #mailboxlist > li { flex: 0 0 auto; }
body.task-mail:is(.action-none, .action-show) #mailboxlist > li.inbox { order: -1; margin-bottom: 0; }
html.rf-sidebar-collapsed #layout-sidebar #rf-compose-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 0 8px;
}
html.rf-sidebar-collapsed #layout-sidebar #rf-compose-wrap .rf-compose-primary {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0 !important;
  border-radius: 50% !important;
}
html.rf-sidebar-collapsed #layout-sidebar #rf-compose-wrap .inner { display: none; }

#layout-sidebar .rf-folder-tools {
  flex: 0 0 auto;
  margin: 0 12px;
  padding: 8px 0 12px;
  border-top: 1px solid var(--rf-border);
}
#layout-sidebar .rf-folder-tools ul.menu {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}
#layout-sidebar .rf-folder-tools li { display: block; border: 0; background: transparent; }
#layout-sidebar .rf-folder-tools a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rf-muted);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
}
#layout-sidebar .rf-folder-tools a:hover { background: var(--rf-accent-soft); color: var(--rf-text); }
#layout-sidebar .rf-folder-tools a::before {
  flex: 0 0 18px;
  width: 18px;
  margin: 0;
  float: none;
  font-family: Icons;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}
#layout-sidebar .rf-folder-tools .expunge::before { content: "\f1c6"; color: #9a6700; }
#layout-sidebar .rf-folder-tools .purge::before { content: "\f2ed"; color: #dc4545; }
#layout-sidebar .rf-folder-tools .read::before { content: "\f2b6"; color: #16834a; }
#layout-sidebar .rf-folder-tools .folders::before { content: "\f07c"; color: var(--rf-accent-strong); }
#layout-sidebar .rf-folder-tools a.disabled { opacity: .45; cursor: default; }
#layout-sidebar .rf-folder-tools a:focus-visible { outline: 2px solid var(--rf-accent-strong); outline-offset: -2px; }
html.rf-sidebar-collapsed #layout-sidebar .rf-folder-tools { margin: 0 8px; }
html.rf-sidebar-collapsed #layout-sidebar .rf-folder-tools a { justify-content: center; }
html.rf-sidebar-collapsed #layout-sidebar .rf-folder-tools .inner { display: none; }

#messagelist-header > :is(.refresh, .toolbar-list-button) {
  align-items: center;
  justify-content: center;
  width: var(--rf-control-height);
  height: var(--rf-control-height);
  padding: 0;
  border-radius: 8px;
}
#messagelist-header > :is(.refresh, .toolbar-list-button)::before {
  margin: 0;
  float: none;
  font-size: var(--rf-control-icon-size);
  line-height: var(--rf-control-line-height);
}

@media (max-width: 900px) {
  .rf-app-account .rf-account-email { display: none; }
}

@media (max-width: 600px) {
  #rf-app-header { gap: 8px; padding: 0 8px; }
  .rf-app-brand { gap: 4px; font-size: 14px; }
  .rf-app-action { width: 32px; }
  .rf-app-account { margin-left: 0; padding: 4px; gap: 3px; }
  .rf-app-brand img { width: 30px; flex-basis: 30px; }
}

@media (max-width: 767px) {
  #messagelist-header > :is(.refresh, .toolbar-list-button) { display: inline-flex; }
  html.rf-sidebar-mobile-open #layout-sidebar #rf-compose-wrap {
    display: block;
    padding: 18px 12px 12px;
  }
  html.rf-sidebar-mobile-open #layout-sidebar #rf-compose-wrap .rf-compose-primary {
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 46px;
    padding: 10px 12px !important;
    border-radius: 12px !important;
  }
  html.rf-sidebar-mobile-open #layout-sidebar #rf-compose-wrap .inner { display: inline; }
  html.rf-sidebar-mobile-open #layout-sidebar .rf-folder-tools a { justify-content: flex-start; }
  html.rf-sidebar-mobile-open #layout-sidebar .rf-folder-tools .inner { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .rf-app-background { filter: blur(calc(var(--app-art-blur) * .5)); transform: none; }
  .rf-header-art::before { filter: saturate(1.1) brightness(1); transform: none; inset: 0; }
}

html[data-rf-skin="gmail_like"] #messagestack {
  position: fixed;
  top: calc(var(--rf-topbar-height, 12px) + 12px);
  right: 16px;
  left: auto;
  bottom: auto;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 80px);
  overflow: auto;
}
html[data-rf-skin="gmail_like"] body:not(.rf-has-topbar) #messagestack { top: 16px; }
html[data-rf-skin="gmail_like"] #messagestack > div {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--rf-border);
  border-radius: 12px;
  background: var(--rf-surface);
  color: var(--rf-text);
  box-shadow: var(--rf-shadow-md);
  font-family: var(--rf-ui-font);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
html[data-rf-skin="gmail_like"] #messagestack > div > i.icon {
  flex: 0 0 18px;
  margin: 1px 0 0;
  font-size: 16px !important;
  line-height: 18px;
  color: var(--rf-accent-strong);
}
html[data-rf-skin="gmail_like"] #messagestack .alert-danger {
  background: color-mix(in srgb, #bf3548 12%, var(--rf-surface));
  border-color: color-mix(in srgb, #bf3548 32%, var(--rf-border));
}
html[data-rf-skin="gmail_like"] #messagestack .alert-danger > i.icon { color: #bf3548; }
html[data-rf-skin="gmail_like"] #messagestack .alert-success {
  background: color-mix(in srgb, #17824f 12%, var(--rf-surface));
  border-color: color-mix(in srgb, #17824f 32%, var(--rf-border));
}
html[data-rf-skin="gmail_like"] #messagestack .alert-success > i.icon { color: #17824f; }
html[data-rf-skin="gmail_like"] #messagestack .alert-warning {
  background: color-mix(in srgb, #a56500 12%, var(--rf-surface));
  border-color: color-mix(in srgb, #a56500 32%, var(--rf-border));
}
html[data-rf-skin="gmail_like"] #messagestack .alert-warning > i.icon { color: #a56500; }
html[data-rf-skin="gmail_like"] #messagestack .alert-info,
html[data-rf-skin="gmail_like"] #messagestack .loading {
  background: var(--rf-surface);
}
html.dark-mode[data-rf-skin="gmail_like"] #messagestack .alert-danger > i.icon { color: #ff8697; }
html.dark-mode[data-rf-skin="gmail_like"] #messagestack .alert-success > i.icon { color: #6ed8a4; }
html.dark-mode[data-rf-skin="gmail_like"] #messagestack .alert-warning > i.icon { color: #f3c16d; }
