:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --line: #dde3ea;
  --text: #1f1f1f;
  --muted: #5f6368;
  --primary: #c2e7ff;
  --primary-text: #0b57d0;
  --soft: #eef3fd;
  --danger: #d93025;
  --shadow: 0 10px 30px rgba(60, 64, 67, 0.08);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
body { min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { text-decoration: none; color: inherit; }
pre { margin: 0; white-space: pre-wrap; }
.hidden { display: none !important; }
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 14px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.logo-title { font-size: 20px; font-weight: 800; }
.logo-subtitle { font-size: 12px; color: var(--muted); }

.compose-btn {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: var(--primary);
  color: #001d35;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  margin: 4px 0 16px;
}

.mail-nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  text-align: left;
}

.nav-link.active {
  background: var(--primary);
  font-weight: 700;
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
}

.content {
  padding: 24px;
}

.list-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.list-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.meta-row {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.mail-list {
  display: grid;
  gap: 10px;
}

.list-mail-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-height: 88px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
  transition: 0.16s ease;
}

.list-mail-item:hover {
  transform: translateY(-1px);
  border-color: #c8d0da;
}

.list-mail-main {
  min-width: 0;
}

.list-mail-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}

.list-mail-subject {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.list-mail-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.list-mail-from,
.list-mail-received {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin-top: 5px;
}

.list-mail-side {
  display: flex;
  align-items: center;
  justify-content: end;
}

.mini-badge {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.mini-badge.star {
  background: #fff8db;
  border-color: #f2d46b;
}

.auth-panel,
.empty-card,
.reader-card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 18px;
}

.auth-form,
.compose-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  color: var(--text);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.notice {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

.btn {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #001d35;
  border: 0;
  font-weight: 700;
}

.btn-soft {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn-danger {
  background: #fce8e6;
  border-color: #f6c7c2;
  color: var(--danger);
}

.wide {
  width: 100%;
}

.empty-state {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.empty-card {
  padding: 24px;
  max-width: 560px;
}

.empty-card.inside {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
}

.empty-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.empty-text {
  color: var(--muted);
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 33, 36, 0.24);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100vw - 24px));
  margin: 4vh auto 0;
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
}

.reader-page {
  min-height: 100vh;
  background: #f6f8fc;
}

.reader-topbar {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 248, 252, 0.96);
  backdrop-filter: blur(10px);
}

.reader-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reader-page-main {
  padding: 24px 32px 40px;
}

.reader-card {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 34px;
  background: #fff;
  border-radius: 24px;
  border: 1px solid #dde3ea;
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.08);
}

.reader-subject {
  margin: 0 0 18px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
}

.reader-header-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.sender-avatar {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #d3e3fd;
  color: #0b57d0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}

.reader-header-main {
  min-width: 0;
}

.reader-from-line {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sender-subline {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.reader-date {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.reader-topline {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.reader-meta {
  display: none;
}

.reader-attachments {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.attachment-chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.reader-html-block {
  line-height: 1.75;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.reader-html-block img {
  max-width: 100%;
  border-radius: 18px;
}

.reader-html-block table {
  max-width: 100%;
}

.reader-text-block {
  margin-top: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.reader-text-block:not(.hidden) {
  padding: 0;
  border: 0;
  background: transparent;
}

@media (max-width: 940px) {
  .reader-page-main {
    padding: 14px;
  }

  .reader-card {
    padding: 18px;
    border-radius: 18px;
  }

  .reader-subject {
    font-size: 24px;
  }

  .reader-header-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .reader-date {
    grid-column: 2;
    white-space: normal;
  }

  .sender-avatar {
    width: 48px;
    height: 48px;
    font-size: 16px;
  }

  .reader-topbar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }
}


.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 248, 252, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  align-items: center;
  gap: 10px;
}

.mobile-topbar-title {
  font-weight: 800;
  font-size: 18px;
}

.mobile-menu-btn {
  width: 44px;
  height: 44px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(4px);
}

.list-header-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.search-wrap {
  margin-top: 16px;
  position: relative;
}

.search-wrap-reader {
  margin-top: 0;
  width: min(560px, 100%);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 50px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 16px 0 46px;
  outline: none;
  color: var(--text);
}

.search-input:focus {
  border-color: #b8c6d8;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.08);
}

.reader-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reader-topbar-search {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

@media (max-width: 940px) {
  .mobile-topbar.auth-only {
    display: flex !important;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 86vw);
    background: var(--bg);
    border-right: 1px solid var(--line);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .content {
    padding: 14px;
  }

  .list-header {
    margin-bottom: 14px;
  }

  .search-input {
    min-height: 46px;
  }

  .reader-topbar {
    gap: 10px;
  }

  .reader-topbar-search {
    width: 100%;
    justify-content: stretch;
  }

  .reader-top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .reader-top-actions .btn {
    flex: 1 1 0;
  }
}

.refresh-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: #e8f0fe;
  border: 1px solid #c6dafc;
  box-shadow: 0 10px 26px rgba(66, 133, 244, 0.12);
}

.refresh-notice-text {
  font-weight: 600;
  color: #0b57d0;
}

@media (max-width: 940px) {
  .refresh-notice {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-notice .btn {
    width: 100%;
  }
}






/* mail list row redesign - reference style */
:root {
  --mail-row-hover: #f7f9fc;
  --mail-row-border: #e6ebf2;
  --mail-row-muted: #6b7280;
  --mail-row-text: #222b38;
}

.mail-list {
  display: block;
  background: #ffffff;
  border: 1px solid var(--mail-row-border);
  border-radius: 22px;
  overflow: hidden;
}

.list-mail-item {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 14px 18px;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--mail-row-border);
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
  transition: background .16s ease;
}

.list-mail-item:last-child {
  border-bottom: 0;
}

.list-mail-item:hover {
  background: var(--mail-row-hover);
  transform: none;
}

.list-mail-sender {
  min-width: 0;
  color: var(--mail-row-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.list-mail-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row-box-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid #d9e0e8;
  color: #5f6977;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.list-mail-subject {
  min-width: 0;
  color: var(--mail-row-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-meta-line {
  min-width: 0;
}

.list-mail-secondary {
  display: block;
  min-width: 0;
  color: var(--mail-row-muted);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: max-content;
  padding-left: 8px;
}

.list-mail-date {
  color: #6f7784;
  font-size: 12px;
  white-space: nowrap;
}

.mini-badge {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #ead78d;
  background: #fff7d8;
  color: #6a5500;
}

.mini-badge .material-symbols-rounded {
  font-size: 15px;
}

@media (max-width: 1100px) {
  .list-mail-item {
    grid-template-columns: 170px minmax(0, 1fr) auto;
  }
}

@media (max-width: 900px) {
  .mail-list {
    border-radius: 18px;
  }

  .list-mail-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
  }

  .list-mail-sender,
  .list-mail-subject,
  .list-mail-secondary {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .list-mail-right {
    justify-content: space-between;
    padding-left: 0;
  }

  .list-mail-line {
    flex-wrap: wrap;
  }
}


/* scroll hotfix final */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden !important;
  }

  body {
    min-height: 100vh;
  }

  .layout {
    height: 100vh !important;
    min-height: 100vh !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-self: start !important;
  }

  .content {
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .mail-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding-right: 6px !important;
  }

  .list-header,
  .page-header,
  .toolbar,
  .mail-toolbar,
  .mail-header {
    flex: 0 0 auto !important;
  }

  .empty-state {
    min-height: 0 !important;
  }
}

@media (max-width: 900px) {
  html,
  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
  }

  .layout,
  .sidebar,
  .content,
  .mail-list {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}


/* ios-like scrollbars */
.mail-list,
.sidebar,
.reader-page-main {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.mail-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.reader-page-main::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.mail-list::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.reader-page-main::-webkit-scrollbar-track {
  background: transparent;
}

.mail-list::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.reader-page-main::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
  transition: background-color .18s ease, border-color .18s ease;
}

.mail-list.is-scrolling,
.sidebar.is-scrolling,
.reader-page-main.is-scrolling {
  scrollbar-color: rgba(128, 138, 150, 0.48) transparent;
}

.mail-list.is-scrolling::-webkit-scrollbar-thumb,
.sidebar.is-scrolling::-webkit-scrollbar-thumb,
.reader-page-main.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(128, 138, 150, 0.48);
  border: 2px solid rgba(255, 255, 255, 0.88);
  background-clip: padding-box;
}

.mail-list.is-scrolling:hover::-webkit-scrollbar-thumb,
.sidebar.is-scrolling:hover::-webkit-scrollbar-thumb,
.reader-page-main.is-scrolling:hover::-webkit-scrollbar-thumb {
  background: rgba(108, 118, 130, 0.62);
}

@media (max-width: 900px) {
  .mail-list::-webkit-scrollbar,
  .sidebar::-webkit-scrollbar,
  .reader-page-main::-webkit-scrollbar {
    width: 7px;
    height: 7px;
  }
}


/* checks and row menu */
.list-mail-side {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex: 0 0 auto;
}

.mini-badge.receipt {
  border: 1px solid #b8ddc3;
  background: #eefbf1;
  color: #215d32;
}

.mail-row-menu {
  position: relative;
  z-index: 5;
}

.mail-row-menu-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.mail-row-menu-btn:hover {
  background: #f2f4f7;
  color: var(--text);
}

.mail-row-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  padding: 8px;
  display: none;
}

.mail-row-menu.open .mail-row-menu-dropdown {
  display: grid;
  gap: 4px;
}

.mail-row-action {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 0 10px;
  color: var(--text);
}

.mail-row-action:hover {
  background: #f5f7fb;
}

.mail-row-action.danger {
  color: #b42318;
}

.mail-row-action .material-symbols-rounded {
  font-size: 18px;
}

@media (max-width: 900px) {
  .mail-row-menu-dropdown {
    right: 0;
    left: auto;
    min-width: 210px;
  }
}


/* row layout + menu overlay fix */
.list-mail-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid var(--mail-row-border, #e6ebf2);
  position: relative;
  overflow: visible;
}

.list-mail-item:last-child {
  border-bottom: 0;
}

.list-mail-link {
  min-width: 0;
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 14px 18px;
}

.list-mail-link:hover {
  background: #f7f9fc;
}

.list-mail-main {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.list-mail-topline {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.list-mail-sender-name {
  flex: 0 1 auto;
  font-size: 15px;
  font-weight: 700;
  color: #202938;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-subject-inline {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  color: #2f3a4b;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-bottomline {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #748091;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
}

.list-mail-recipient,
.list-mail-sent-at {
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-dot {
  flex: 0 0 auto;
  color: #a5afbd;
}

.list-mail-side {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 0;
  position: relative;
  z-index: 3;
}

.mail-row-menu {
  position: relative;
  z-index: 40;
}

.mail-row-menu-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #7b8794);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

.mail-row-menu-btn:hover {
  background: #eef2f7;
  color: var(--text, #1f2937);
}


.mail-row-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--line, #e6ebf2);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  padding: 8px;
  display: none;
  z-index: 60;
}

.mail-row-menu.open .mail-row-menu-dropdown {
  display: grid;
  gap: 4px;
}

.mail-row-action {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 0 12px;
  color: var(--text, #1f2937);
}

.mail-row-action:hover {
  background: #f5f7fb;
}

.mail-row-action.danger {
  color: #b42318;
}

.mail-row-action .material-symbols-rounded {
  font-size: 18px;
}

@media (max-width: 900px) {
  .list-mail-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .list-mail-link {
    padding: 14px;
  }

  .list-mail-topline,
  .list-mail-bottomline {
    white-space: normal;
    flex-wrap: wrap;
  }

  .list-mail-dot {
    display: none;
  }

  .mail-row-menu-dropdown {
    right: 0;
    min-width: 210px;
  }
}


/* menu z-index stacking fix */
.mail-list {
  position: relative;
  isolation: isolate;
}

.list-mail-item {
  position: relative;
  z-index: 1;
}

.list-mail-item:hover {
  z-index: 2;
}

.list-mail-item:has(.mail-row-menu.open) {
  z-index: 80;
}

.list-mail-side {
  position: relative;
  z-index: 3;
}

.mail-row-menu {
  position: relative;
  z-index: 20;
}

.mail-row-menu-btn {
  position: relative;
  z-index: 21;
}

.mail-row-menu-dropdown {
  position: absolute;
  z-index: 200;
}

@supports not selector(:has(*)) {
  .mail-row-menu.open {
    z-index: 80;
  }

  .mail-row-menu.open .mail-row-menu-dropdown {
    z-index: 200;
  }
}


/* remove hover link status ui fix */
.list-mail-link {
  cursor: pointer;
}

.list-mail-link:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: -2px;
  border-radius: 12px;
}


/* unread mail highlight */
.list-mail-item.is-unread {
  background: #e9ffff;
}

.list-mail-item.is-unread .list-mail-link {
  background: transparent;
}

.list-mail-item.is-unread:hover,
.list-mail-item.is-unread .list-mail-link:hover {
  background: #defcfc;
}

.list-mail-item.is-unread .list-mail-sender-name,
.list-mail-item.is-unread .list-mail-subject-inline {
  font-weight: 800;
  color: #16363a;
}

.list-mail-item.is-unread .list-mail-bottomline {
  color: #42656a;
}

.list-mail-item.is-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: #97f0f0;
}


/* unread badge visual tweak */
.list-mail-topline {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.list-mail-sender-name {
  flex: 0 1 auto;
  font-size: 15px;
  font-weight: 700;
  color: #202938;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-subject-inline {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  color: #2f3a4b;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-mail-item.is-unread .list-mail-sender-name {
  font-weight: 800;
  color: #16363a;
}

.list-mail-item.is-unread .list-mail-subject-inline {
  font-weight: 500;
  color: #2f3a4b;
}

.mini-badge.unread {
  flex: 0 0 auto;
  border: 1px solid #b9ecec;
  background: #eefdfd;
  color: #1f6b73;
}

.mini-badge.unread .material-symbols-rounded {
  font-size: 15px;
}

@media (max-width: 900px) {
  .list-mail-topline {
    flex-wrap: wrap;
    white-space: normal;
  }
}


/* realtime nav unread badges */
#syncBtn {
  display: none !important;
}

.nav-link {
  position: relative;
  gap: 10px;
}

.nav-count-badge {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eefdfd;
  border: 1px solid #b9ecec;
  color: #1f6b73;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.nav-count-badge.hidden {
  display: none !important;
}


/* mobile sidebar full width fix */
#syncBtn {
  display: none !important;
}

@media (max-width: 940px) {
  .sidebar {
    width: min(380px, 92vw) !important;
    max-width: 92vw !important;
    left: 0 !important;
    right: auto !important;
    transform: translateX(-102%) !important;
    padding: 18px 14px 24px !important;
  }

  .sidebar.sidebar-open {
    transform: translateX(0) !important;
  }

  .sidebar-backdrop {
    z-index: 45 !important;
  }

  .sidebar {
    z-index: 50 !important;
  }

  .content {
    width: 100%;
    min-width: 0;
  }

  .layout {
    overflow-x: hidden;
  }
}


/* mobile sidebar full height fix */
@media (max-width: 940px) {
  html,
  body {
    min-height: 100dvh;
  }

  .layout {
    min-height: 100dvh;
  }

  .sidebar-backdrop {
    position: fixed !important;
    inset: 0 !important;
    height: 100dvh !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    width: min(380px, 92vw) !important;
    max-width: 92vw !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sidebar-inner,
  .sidebar-content,
  .sidebar-scroll,
  .mail-sidebar-inner {
    min-height: 0 !important;
    height: 100% !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .mail-nav,
  .sidebar nav {
    flex: 0 0 auto !important;
  }

  .sidebar-bottom {
    margin-top: auto !important;
    padding-top: 14px !important;
    flex: 0 0 auto !important;
  }
}


/* pwa notifications sidebar button */
.sidebar-pwa-actions {
  display: grid;
  gap: 10px;
}

.sidebar-pwa-actions .btn.hidden {
  display: none !important;
}


/* compose modal small screen scroll fix */
.compose-modal,
.compose-overlay,
.modal-overlay,
.dialog-overlay {
  overscroll-behavior: contain;
}

.compose-modal,
.modal-card,
.compose-card,
.dialog-card {
  max-height: min(92dvh, 92vh) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.compose-modal-content,
.compose-body,
.compose-form,
.modal-body,
.dialog-body {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}

.compose-modal-header,
.compose-header,
.modal-header,
.dialog-header,
.compose-modal-footer,
.compose-footer,
.modal-footer,
.dialog-footer {
  flex: 0 0 auto !important;
}

@media (max-width: 940px), (max-height: 820px) {
  .compose-modal,
  .modal-card,
  .compose-card,
  .dialog-card {
    width: min(96vw, 720px) !important;
    max-width: 96vw !important;
    max-height: min(94dvh, 94vh) !important;
    margin: 3dvh auto !important;
    border-radius: 18px !important;
  }
}

@media (max-width: 640px), (max-height: 720px) {
  .compose-modal,
  .modal-card,
  .compose-card,
  .dialog-card {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .compose-modal-content,
  .compose-body,
  .compose-form,
  .modal-body,
  .dialog-body {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
  }
}


/* pwa install button */
.sidebar-pwa-actions {
  display: grid;
  gap: 10px;
}

.sidebar-pwa-actions .btn.hidden {
  display: none !important;
}
