/*
#============================================================#
#  COG Mail Workspace CSS                                    #
#============================================================#
#  Company : COG Technology LLC                              #
#  Creator : Donald Mayfield                                 #
#  Purpose : Style the COG Mail Workspace shell with a       #
#            branded top bar, left rail, integrated mail     #
#            pane, and adjustable tool pane.                 #
#============================================================#
*/

:root {
  color-scheme: dark;

  --body-bg: #0f1720;

  --topbar-bg-1: #163a5c;
  --topbar-bg-2: #10283f;
  --topbar-bg-3: #252b33;

  --topbar-text: #f4f7fb;
  --topbar-subtext: #b7c6d6;

  --panel-bg: #111827;
  --panel-border: #31465a;

  --button-bg: #1e2b38;
  --button-border: #3a4c5f;
  --button-text: #f4f7fb;

  --button-hover-bg: #263748;
  --button-hover-border: #5d84a8;

  --button-active-bg: #0f5f9c;
  --button-active-border: #4da3df;
  --button-active-text: #ffffff;

  --rail-bg-1: #102a40;
  --rail-bg-2: #11263a;
  --rail-bg-3: #202c35;

  --handle-bg-1: #21405e;
  --handle-bg-2: #1a2430;
  --handle-hover-1: #2b5d88;
  --handle-hover-2: #253445;
  --handle-border: #36536e;
  --handle-grip: rgba(255, 255, 255, 0.38);

  --topbar-height: 84px;
  --leftrail-width: 86px;
  --splitter-width: 8px;
  --default-tool-width: 42%;
}

body.light-theme {
  color-scheme: light;

  --body-bg: #f5f7fa;

  --topbar-bg-1: #ffffff;
  --topbar-bg-2: #f6f9fc;
  --topbar-bg-3: #e8f1f8;

  --topbar-text: #1f2933;
  --topbar-subtext: #5f6b7a;

  --panel-bg: #ffffff;
  --panel-border: #d9e2ec;

  --button-bg: #ffffff;
  --button-border: #c9d6e2;
  --button-text: #1f2933;

  --button-hover-bg: #eef6ff;
  --button-hover-border: #0f5f9c;

  --button-active-bg: #0f5f9c;
  --button-active-border: #0f5f9c;
  --button-active-text: #ffffff;

  --rail-bg-1: #eaf2fb;
  --rail-bg-2: #dce8f4;
  --rail-bg-3: #d0dde8;

  --handle-bg-1: #e5edf5;
  --handle-bg-2: #d9e7f2;
  --handle-hover-1: #c5ddf2;
  --handle-hover-2: #b7d3ea;
  --handle-border: #abc2d8;
  --handle-grip: rgba(15, 95, 156, 0.50);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--body-bg);
  color: var(--topbar-text);
  overflow: hidden;
}

/*
#============================================================#
#  Section: Page Shell                                       #
#============================================================#
*/

.workspace-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/*
#============================================================#
#  Section: Top Bar                                          #
#============================================================#
*/

.workspace-topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background:
    linear-gradient(135deg, var(--topbar-bg-1) 0%, var(--topbar-bg-2) 46%, var(--topbar-bg-3) 100%);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  z-index: 50;
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 265px;
  flex-shrink: 0;
}

.logo-wrap {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
}

body.light-theme .logo-wrap {
  background: rgba(15, 95, 156, 0.06);
  border-color: rgba(15, 95, 156, 0.18);
}

.logo {
  height: 48px;
  width: auto;
  display: block;
}

.title-block {
  min-width: 150px;
}

.title {
  font-size: 18px;
  font-weight: 900;
  margin: 0;
  color: var(--topbar-text);
  letter-spacing: 0.1px;
}

.subtitle {
  font-size: 12px;
  color: var(--topbar-subtext);
  margin: 2px 0 0 0;
}

.workspace-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-right: 8px;
  margin-right: 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

body.light-theme .toolbar-group {
  border-right-color: rgba(15, 95, 156, 0.16);
}

button,
a.navlink {
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, border-color 0.08s ease, background 0.08s ease;
}

button:hover,
a.navlink:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  transform: translateY(-1px);
}

button.active {
  background: var(--button-active-bg);
  border-color: var(--button-active-border);
  color: var(--button-active-text);
  box-shadow: 0 0 0 1px rgba(77, 163, 223, 0.25);
}

/*
#============================================================#
#  Section: Workspace Body                                   #
#============================================================#
*/

.workspace-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--leftrail-width) minmax(0, 1fr);
  overflow: hidden;
}

/*
#============================================================#
#  Section: Left Rail                                        #
#============================================================#
*/

.workspace-left-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 10px 14px 10px;
  background: linear-gradient(180deg, var(--rail-bg-1) 0%, var(--rail-bg-2) 55%, var(--rail-bg-3) 100%);
  border-right: 1px solid var(--panel-border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
  overflow-y: auto;
}

.rail-spacer {
  flex: 1;
}

.workspace-rail-button {
  width: 62px;
  min-height: 70px;
  border: 1px solid rgba(130, 171, 205, 0.30);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.16) 100%);
  color: #ffffff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  cursor: pointer;
  transition: 0.18s ease;
  text-align: center;
}

.workspace-rail-button:hover {
  transform: translateY(-1px);
  border-color: #8bc3f0;
  background: linear-gradient(180deg, rgba(45, 143, 227, 0.26) 0%, rgba(29, 116, 192, 0.34) 100%);
}

.workspace-rail-button.active {
  border-color: #8bc3f0;
  background: linear-gradient(180deg, rgba(45, 143, 227, 0.36) 0%, rgba(29, 116, 192, 0.44) 100%);
  box-shadow: 0 0 0 1px rgba(139, 195, 240, 0.22) inset;
}

.workspace-rail-button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.workspace-rail-button span {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

body.light-theme .workspace-rail-button {
  color: #12314a;
  border-color: #a9bfd4;
  background: linear-gradient(180deg, #ffffff 0%, #e7eff7 100%);
}

body.light-theme .workspace-rail-button:hover,
body.light-theme .workspace-rail-button.active {
  color: #ffffff;
  background: linear-gradient(180deg, #2d8fe3 0%, #1d74c0 100%);
  border-color: #2d8fe3;
}

/*
#============================================================#
#  Section: Main Workspace Area                              #
#============================================================#
*/

.workspace-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-bg);
}

.mail-pane {
  flex: 1 1 auto;
  min-width: 420px;
  height: 100%;
  overflow: hidden;
  background: var(--panel-bg);
}

.tool-pane {
  width: var(--default-tool-width);
  min-width: 340px;
  max-width: 80%;
  height: 100%;
  border-left: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
}

.tool-pane.hidden {
  display: none;
}

.workspace-splitter {
  width: var(--splitter-width);
  min-width: var(--splitter-width);
  cursor: col-resize;
  background: linear-gradient(to bottom, var(--handle-bg-1), var(--handle-bg-2));
  border-left: 1px solid var(--handle-border);
  border-right: 1px solid var(--handle-border);
  position: relative;
}

.workspace-splitter.hidden {
  display: none;
}

.workspace-splitter:hover,
.workspace-splitter.dragging {
  background: linear-gradient(to bottom, var(--handle-hover-1), var(--handle-hover-2));
}

.workspace-splitter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 66px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: var(--handle-grip);
}

.tool-pane-header {
  height: 48px;
  border-bottom: 1px solid var(--panel-border);
  background:
    linear-gradient(135deg, rgba(15, 95, 156, 0.22), rgba(17, 24, 39, 0.85));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
}

body.light-theme .tool-pane-header {
  background: #f8fbff;
}

.tool-pane-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--topbar-text);
}

.tool-pane-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-btn {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 8px;
  min-height: 30px;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
  display: block;
}

.tool-frame {
  height: calc(100% - 48px);
}

.resizing-blocker {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  cursor: col-resize;
  background: transparent;
}

.resizing-blocker.active {
  display: block;
}

/*
#============================================================#
#  Section: Responsive                                       #
#============================================================#
*/

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .workspace-page {
    height: auto;
    min-height: 100vh;
  }

  .workspace-topbar {
    height: auto;
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-body {
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 100vh;
  }

  .workspace-left-rail {
    padding: 14px 6px 12px 6px;
  }

  .workspace-rail-button {
    width: 52px;
    min-height: 62px;
  }

  .workspace-rail-button span {
    font-size: 10px;
  }

  .workspace-main {
    display: block;
  }

  .mail-pane {
    height: 70vh;
    min-width: 0;
  }

  .workspace-splitter {
    display: none !important;
  }

  .tool-pane {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    height: 70vh;
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }
}

/*
#============================================================#
#  Section: Top Bar Utility Layout                           #
#  Purpose : Keep top bar focused on utility controls only.  #
#============================================================#
*/

.workspace-toolbar {
  justify-content: flex-end;
}

.utility-group {
  margin-left: auto;
  border-right: 0;
  padding-right: 0;
}


/*
#============================================================#
#  Section: Mobile Workspace Layout                          #
#  Purpose : Improve workspace behavior on phones/tablets.   #
#============================================================#
*/

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .workspace-page {
    height: 100vh;
    overflow: hidden;
  }

  .workspace-topbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .workspace-brand {
    min-width: 0;
    width: 100%;
    justify-content: center;
  }

  .logo-wrap {
    min-width: 0;
  }

  .logo {
    height: 40px;
  }

  .title-block {
    display: none;
  }

  .workspace-toolbar {
    width: 100%;
    justify-content: center;
  }

  .toolbar-group {
    justify-content: center;
    border-right: 0;
    padding-right: 0;
    margin-right: 0;
  }

  .toolbar-group button {
    font-size: 12px;
    padding: 8px 10px;
    min-height: 34px;
  }

  #mailNewTabBtn {
    display: none;
  }

  .workspace-body {
    display: flex;
    flex-direction: column-reverse;
    height: calc(100vh - var(--topbar-height));
    min-height: 0;
  }

  .workspace-left-rail {
    height: 82px;
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    gap: 10px;
    border-right: 0;
    border-top: 1px solid var(--panel-border);
  }

  .workspace-rail-button {
    width: 62px;
    min-width: 62px;
    min-height: 62px;
    padding: 6px 5px;
  }

  .workspace-rail-button img {
    width: 24px;
    height: 24px;
  }

  .workspace-rail-button span {
    font-size: 10px;
  }

  .rail-spacer {
    display: none;
  }

  .workspace-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .mail-pane {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
    height: auto;
  }

  .workspace-splitter {
    display: none !important;
  }

  .tool-pane {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    height: 45%;
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .tool-pane.hidden {
    display: none;
  }

  .tool-pane-header {
    height: 42px;
  }

  .tool-frame {
    height: calc(100% - 42px);
  }
}

/*
#============================================================#
#  Section: Icon-Only Workspace Rail                         #
#  Purpose : Hide rail text labels and show them on hover.   #
#============================================================#
*/

.workspace-left-rail {
  width: 86px;
  min-width: 86px;
  align-items: center;
}

.workspace-rail-button {
  position: relative;
  width: 66px;
  min-width: 66px;
  min-height: 66px;
  padding: 8px;
  justify-content: center;
}

.workspace-rail-button img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.workspace-rail-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
#============================================================#
#  Section: Workspace Rail Tooltip                           #
#  Purpose : Show button label when hovering with mouse.     #
#============================================================#
*/

.workspace-rail-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;

  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(120, 170, 255, 0.35);
  background: rgba(10, 18, 30, 0.96);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);

  transition: opacity 0.16s ease, transform 0.16s ease;
}

.workspace-rail-button::before {
  content: "";
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  z-index: 9998;

  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 7px solid rgba(10, 18, 30, 0.96);

  transition: opacity 0.16s ease;
}

.workspace-rail-button:hover::after,
.workspace-rail-button:hover::before,
.workspace-rail-button:focus-visible::after,
.workspace-rail-button:focus-visible::before {
  opacity: 1;
}

.workspace-rail-button:hover::after,
.workspace-rail-button:focus-visible::after {
  transform: translateY(-50%) translateX(0);
}

/*
#============================================================#
#  Section: Mobile Rail Label Recovery                       #
#  Purpose : Hide hover tooltips on touch/mobile layouts.    #
#============================================================#
*/

@media (max-width: 760px) {
  .workspace-rail-button::after,
  .workspace-rail-button::before {
    display: none;
  }

  .workspace-rail-button img {
    width: 34px;
    height: 34px;
  }
}


/*
#============================================================#
#  Section: Workspace Rail Tooltip Overflow Fix              #
#  Purpose : Prevent hover labels from being clipped.        #
#============================================================#
*/

@media (min-width: 761px) {
  .workspace-body {
    overflow: visible;
  }

  .workspace-main {
    overflow: hidden;
  }

  .workspace-left-rail {
    position: relative;
    overflow: visible !important;
    z-index: 5000;
  }

  .workspace-rail-button {
    overflow: visible;
    z-index: 5001;
  }

  .workspace-rail-button::after {
    min-width: max-content;
    max-width: none;
    left: calc(100% + 16px);
    z-index: 10000;
    font-weight: 700;
    line-height: 1.15;
  }

  .workspace-rail-button::before {
    z-index: 9999;
  }
}

/*
#============================================================#
#  Section: Mobile Rail Overflow Recovery                    #
#  Purpose : Keep mobile bottom rail scroll behavior intact. #
#============================================================#
*/

@media (max-width: 760px) {
  .workspace-body {
    overflow: hidden;
  }

  .workspace-left-rail {
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
}


/*
#============================================================#
#  Section: Mobile Hamburger Workspace Menu                  #
#  Purpose : Use slide-out navigation on small screens.      #
#============================================================#
*/

.mobile-menu-btn {
  display: none;
}

.mobile-menu-overlay {
  display: none;
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .workspace-page {
    height: 100vh;
    overflow: hidden;
  }

  .workspace-topbar {
    position: relative;
    height: 64px;
    min-height: 64px;
    padding: 8px 10px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .mobile-menu-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--button-border);
    background: var(--button-bg);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 9002;
  }

  .mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: var(--button-text);
  }

  .workspace-brand {
    flex: 1;
    width: auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .logo-wrap {
    min-width: 0;
    padding: 3px 6px;
  }

  .logo {
    height: 38px;
  }

  .title-block {
    display: block;
    min-width: 0;
  }

  .title {
    font-size: 16px;
    white-space: nowrap;
  }

  .subtitle {
    display: none;
  }

  .workspace-toolbar {
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .toolbar-group {
    border-right: 0;
    padding-right: 0;
    margin-right: 0;
    gap: 6px;
  }

  #mailNewTabBtn,
  #fullscreenBtn {
    display: none;
  }

  #logoutBtn,
  #themeBtn {
    font-size: 12px;
    min-height: 34px;
    padding: 8px 9px;
    border-radius: 9px;
  }

  .workspace-body {
    display: block;
    height: calc(100vh - 64px);
    min-height: 0;
    overflow: hidden;
  }

  .workspace-main {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .mail-pane {
    width: 100%;
    min-width: 0;
    height: 100%;
    flex: 1 1 auto;
  }

  .tool-pane {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    height: 45%;
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .workspace-splitter {
    display: none !important;
  }

  /*
  #============================================================#
  #  Section: Mobile Slide-Out Rail                            #
  #  Purpose : Replace bottom rail with hamburger drawer.      #
  #============================================================#
  */

  .workspace-left-rail {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 92px;
    min-width: 92px;
    height: calc(100vh - 64px);
    z-index: 9001;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    padding: 12px 8px;
    gap: 12px;

    transform: translateX(-110%);
    transition: transform 0.18s ease;

    overflow-y: auto !important;
    overflow-x: visible !important;

    border-top: 0;
    border-right: 1px solid var(--panel-border);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.28);
  }

  body.mobile-menu-open .workspace-left-rail {
    transform: translateX(0);
  }

  .mobile-menu-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.42);
  }

  body.mobile-menu-open .mobile-menu-overlay {
    display: block;
  }

  .workspace-rail-button {
    width: 66px;
    min-width: 66px;
    min-height: 66px;
    padding: 8px;
  }

  .workspace-rail-button img {
    width: 42px;
    height: 42px;
  }

  .workspace-rail-button::after,
  .workspace-rail-button::before {
    display: none !important;
  }

  .workspace-rail-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .rail-spacer {
    display: block;
    flex: 1;
  }
}


/*
#============================================================#
#  Section: iPhone Mobile Menu Safe Placement                #
#  Purpose : Keep hamburger menu reachable with Safari URL   #
#            bar at top or bottom.                           #
#============================================================#
*/

@media (max-width: 760px) {
  .mobile-menu-btn {
    position: fixed !important;
    left: max(14px, env(safe-area-inset-left));
    bottom: calc(92px + env(safe-area-inset-bottom));
    top: auto !important;

    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;

    border-radius: 18px;
    z-index: 12000;

    background: rgba(15, 42, 64, 0.96);
    border: 1px solid rgba(120, 170, 255, 0.55);
    box-shadow:
      0 12px 28px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  body.light-theme .mobile-menu-btn {
    background: rgba(245, 249, 253, 0.96);
    border-color: rgba(15, 95, 156, 0.45);
  }

  .mobile-menu-btn span {
    width: 28px;
    height: 4px;
  }

  /*
  #============================================================#
  #  Section: Mobile Header Cleanup                           #
  #  Purpose : Prevent top controls from sitting under Safari. #
  #============================================================#
  */

  .workspace-topbar {
    padding-top: calc(10px + env(safe-area-inset-top));
    height: calc(70px + env(safe-area-inset-top));
    min-height: calc(70px + env(safe-area-inset-top));
  }

  .workspace-body {
    height: calc(100vh - 70px - env(safe-area-inset-top));
  }

  /*
  #============================================================#
  #  Section: Mobile Drawer Safe Area                          #
  #  Purpose : Make drawer start below the actual top bar.     #
  #============================================================#
  */

  .workspace-left-rail {
    top: calc(70px + env(safe-area-inset-top));
    height: calc(100vh - 70px - env(safe-area-inset-top));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .mobile-menu-overlay {
    top: calc(70px + env(safe-area-inset-top));
  }

  /*
  #============================================================#
  #  Section: Mobile Content Safe Area                         #
  #  Purpose : Keep iframe content clear of floating button.   #
  #============================================================#
  */

  .mail-pane {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}


/*
#============================================================#
#  Section: Mobile Drawer Final Override                     #
#  Purpose : Force all rail buttons to appear in hamburger   #
#            drawer instead of old bottom-rail layout.       #
#============================================================#
*/

@media (max-width: 760px) {
  .workspace-left-rail {
    position: fixed !important;

    top: calc(70px + env(safe-area-inset-top)) !important;
    bottom: 0 !important;
    left: 0 !important;

    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;

    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;

    gap: 12px !important;
    padding: 14px 8px calc(24px + env(safe-area-inset-bottom)) 8px !important;

    overflow-y: auto !important;
    overflow-x: visible !important;
    -webkit-overflow-scrolling: touch;

    z-index: 12001 !important;

    transform: translateX(-112%) !important;
    transition: transform 0.18s ease !important;

    border-top: 0 !important;
    border-right: 1px solid var(--panel-border) !important;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.32) !important;
  }

  body.mobile-menu-open .workspace-left-rail {
    transform: translateX(0) !important;
  }

  .workspace-left-rail .workspace-rail-button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;

    position: relative !important;

    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;

    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;

    flex: 0 0 68px !important;

    padding: 8px !important;
    margin: 0 !important;

    align-items: center !important;
    justify-content: center !important;
  }

  .workspace-left-rail .workspace-rail-button img {
    display: block !important;
    width: 44px !important;
    height: 44px !important;
    object-fit: contain !important;
  }

  .workspace-left-rail .workspace-rail-button span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }

  .workspace-left-rail .workspace-rail-button::after,
  .workspace-left-rail .workspace-rail-button::before {
    display: none !important;
  }

  .workspace-left-rail .rail-spacer {
    display: none !important;
    flex: 0 0 0 !important;
    height: 0 !important;
    min-height: 0 !important;
  }

  .mobile-menu-overlay {
    position: fixed !important;
    top: calc(70px + env(safe-area-inset-top)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 12000 !important;
    background: rgba(0, 0, 0, 0.42) !important;
  }

  body.mobile-menu-open .mobile-menu-overlay {
    display: block !important;
  }
}

