/* Mail-first layout: compact message rows and familiar navigation, using UniGlobe branding. */
:root {
  font-family: Arial, 'Segoe UI', sans-serif;
  --bg: #f6f8fc;
  --panel: #fff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #e7ebf0;
  --accent: #0b57d0;
  --soft: #d3e3fd;
  --hover: #e8edf5;
}
.dark {
  --bg: #17191e;
  --panel: #202124;
  --ink: #e3e3e3;
  --muted: #a9acb3;
  --line: #34373d;
  --accent: #a8c7fa;
  --soft: #294567;
  --hover: #343942;
}
.shell {
  grid-template-columns: 256px 1fr;
  grid-template-rows: 64px 1fr;
  padding: 0 16px 16px 0;
}
.topbar {
  height: 64px;
  padding: 8px 16px;
  gap: 12px;
}
.topbar .brand {
  width: 172px;
  font-size: 25px;
  letter-spacing: -0.7px;
  gap: 8px;
}
.brand small {
  display: none;
}
.brand img {
  width: 32px;
  height: 32px;
}
.topbar .mobile-only {
  display: inline-flex;
}
.search {
  height: 48px;
  max-width: 760px;
  border-radius: 26px;
  background: #eaf1fb;
  padding: 0 12px 0 18px;
  color: #444746;
}
.search input {
  font-size: 16px;
  padding: 12px;
}
.search .icon-button {
  border-radius: 50%;
}
.dark .search {
  background: #30343b;
  color: var(--ink);
}
.topbar > .spacer {
  min-width: 10px;
}
.icon-button {
  border-radius: 50%;
  padding: 9px;
}
.avatar {
  background: #8147ad;
  color: #fff;
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hover);
  color: var(--ink);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sender {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hover);
  color: var(--ink);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-bimi {
  background: #ffffff !important;
  border: 1px solid var(--line);
  padding: 2px;
  object-fit: contain !important;
}
.sidebar {
  padding: 16px 12px 12px 0;
}
.compose-button {
  background: #c2e7ff !important;
  color: #001d35 !important;
  border-radius: 16px;
  padding: 19px 23px !important;
  font-size: 14px;
  font-weight: 500 !important;
  box-shadow: none;
  margin: 0 0 18px 14px;
  align-self: flex-start;
  gap: 16px;
  height: 56px;
}
.compose-button:hover {
  box-shadow: 0 2px 6px #3c404330;
}
.dark .compose-button {
  background: #294567 !important;
  color: #d3e3fd !important;
}
.nav-item {
  color: var(--ink);
  height: 34px;
  border-radius: 0 20px 20px 0;
  margin: 0;
  padding: 7px 18px 7px 27px;
  gap: 18px;
  font-size: 14px;
  font-weight: 400;
}
.nav-item .icon {
  color: var(--muted);
}
.nav-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 700;
}
.nav-item.active .icon {
  color: #001d35;
}
.dark .nav-item.active {
  background: #294567;
  color: #d3e3fd;
}
.dark .nav-item.active .icon {
  color: #d3e3fd;
}
.nav-item .count {
  font-size: 11px;
  font-weight: 400;
}
.nav-caption {
  padding: 20px 18px 8px 28px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
}
.nav-caption button {
  padding: 3px 7px;
  font-size: 20px;
}
.storage {
  padding: 20px 26px 0;
  font-size: 11px;
}
.storage > .icon {
  display: none;
}
.meter {
  height: 4px;
  margin: 9px 0;
}
.main {
  border: 0;
  border-radius: 16px;
  background: var(--panel);
}
.mail-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 17px 20px 10px;
  min-height: 63px;
  overflow-x: auto;
  white-space: nowrap;
}
.filter-chip {
  border: 1px solid #80868b;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 400;
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  gap: 14px;
  align-items: center;
  height: 35px;
  flex-shrink: 0;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-chip.active {
  background: var(--soft);
  border-color: var(--soft);
  color: var(--accent);
}
select.filter-chip {
  width: auto;
  min-width: 102px;
  box-shadow: none;
  padding-right: 6px;
}
.advanced-link {
  color: var(--accent);
  font-size: 13px;
  padding: 8px;
  white-space: nowrap;
}
.local-banner {
  font-size: 10px;
  padding: 6px 22px;
  color: var(--muted);
  background: transparent;
  border: 0;
  letter-spacing: 0.05px;
}
.toolbar {
  height: 48px;
  min-height: 48px;
  padding: 4px 16px;
  gap: 5px;
  border-bottom: 0;
}
.toolbar > input {
  margin: 0 4px 0 0;
}
.toolbar .icon-button {
  padding: 8px;
}
.toolbar .range {
  font-size: 11px;
  padding: 0 8px;
}
.toolbar select {
  border: 0;
  background: transparent;
  font-size: 11px !important;
}
.mail-row {
  grid-template-columns: 18px 23px 185px minmax(100px, 1fr) 64px;
  gap: 10px;
  padding: 0 18px;
  height: 44px;
  min-height: 44px;
  font-size: 13px;
  border: 0;
  border-bottom: 1px solid #e7ebf0;
  background: #f2f6fc;
}
.mail-row.unread {
  background: var(--panel);
}
.mail-row:hover {
  position: relative;
  z-index: 1;
  box-shadow:
    inset 1px 0 #dadce0,
    inset -1px 0 #dadce0,
    0 1px 2px #3c40434d;
  background: #eaf1fb;
}
.mail-row.selected {
  background: #c2dbff;
}
.mail-row .sender {
  font-size: 13px;
}
.mail-row .preview {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.mail-row .subject {
  display: inline;
  margin: 0;
  flex-shrink: 0;
  max-width: 80%;
  font-size: 13px;
  text-overflow: ellipsis;
  overflow: hidden;
}
.mail-row .snippet {
  display: inline;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 400;
  flex: 1;
  min-width: 20px;
}
.mail-row .date {
  font-size: 11px;
  color: var(--ink);
}
.mail-row.unread .date {
  font-weight: 700;
}
.mail-row .star {
  color: #8e969e;
}
.mail-row .star.on {
  color: #e6a117;
}
.mail-row .pill {
  font-size: 9px;
  padding: 2px 5px;
}
.dark .mail-row {
  background: #292d34;
  border-bottom-color: #353940;
}
.dark .mail-row.unread {
  background: #202124;
}
.dark .mail-row:hover {
  background: #343b45;
  box-shadow: none;
}
.dark .mail-row.selected {
  background: #314d70;
}
.empty {
  margin: 75px auto;
}
.empty .empty-icon {
  background: transparent;
  color: var(--muted);
}
.empty h2 {
  font-size: 18px;
  font-weight: 500;
}
.empty p {
  font-size: 13px;
}
.main-heading h1 {
  font-size: 22px;
  font-weight: 500;
}
.pill {
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
}
.compose-overlay {
  background: transparent;
  backdrop-filter: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 32px;
  pointer-events: none;
}
.compose-overlay .modal {
  pointer-events: auto;
  width: 580px;
  max-height: calc(100dvh - 90px);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 8px 35px #20212440;
  border: 1px solid var(--line);
}
.compose-overlay .modal header {
  padding: 10px 16px;
  background: #f2f6fc;
  border: 0;
  min-height: 43px;
}
.dark .compose-overlay .modal header {
  background: #30343b;
}
.compose-overlay .modal header h2 {
  font-size: 13px;
  font-weight: 600;
}
.compose-overlay .modal section {
  padding: 0 16px 8px;
}
.compose-overlay .modal footer {
  padding: 12px 16px 16px;
  border: 0;
}
.compose-overlay .modal footer .primary {
  border-radius: 24px;
  padding: 10px 22px;
  background: #0b57d0;
  font-size: 13px;
}
.compose-fields input,
.compose-fields select {
  padding: 10px 0;
  font-size: 13px;
}
.compose-fields label span {
  width: 43px;
  font-size: 13px;
}
.editor {
  min-height: 260px;
  font-size: 13px;
}
.formatbar {
  display: inline-flex;
  box-shadow: 0 1px 3px #0002;
  border-radius: 4px;
}
.formatbar button {
  padding: 5px 12px;
}
.message-head h1 {
  font-size: 23px;
  font-weight: 400;
}
.message-head .avatar {
  background: #d3e3fd;
  color: #314d70;
}
.message-body {
  font-size: 14px;
}
.shell.nav-collapsed {
  grid-template-columns: 72px 1fr;
}
.nav-collapsed .sidebar {
  padding-right: 4px;
}
.nav-collapsed .nav-item {
  font-size: 0;
  padding-left: 25px;
  gap: 0;
}
.nav-collapsed .count,
.nav-collapsed .nav-caption,
.nav-collapsed .storage,
.nav-collapsed [data-label] {
  display: none;
}
.nav-collapsed .compose-button {
  font-size: 0;
  padding: 16px !important;
  margin-left: 8px;
  gap: 0;
}
.nav-collapsed .compose-button .icon {
  width: 20px;
}
.auth {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  padding: 30px;
  min-height: 100dvh;
}
.auth-art {
  display: none;
}
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px 42px;
  max-width: 480px;
  width: 100%;
}
.auth-panel:before {
  display: none;
}
.auth-form:before {
  content: '';
  display: block;
  width: 200px;
  height: 74px;
  background: white url('/uniglobe-logo.png') center/contain no-repeat;
  border-radius: 8px;
  margin-bottom: 22px;
}
.auth-form h2 {
  font-size: 25px;
  font-weight: 400;
}
.auth-form p {
  font-size: 13px;
}
.auth-form .primary {
  border-radius: 24px;
  font-size: 14px;
}
.notice {
  background: var(--bg);
  font-size: 12px;
  border-radius: 8px;
}
@media (min-width: 1600px) {
  .mail-row {
    grid-template-columns: 18px 23px 220px minmax(100px, 1fr) 76px;
    height: 42px;
  }
  .mail-row .sender,
  .mail-row .subject,
  .mail-row .snippet {
    font-size: 14px;
  }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .shell {
    grid-template-columns: 224px 1fr;
  }
  .topbar .brand {
    width: 140px;
  }
  .mail-row {
    grid-template-columns: 18px 23px 140px minmax(80px, 1fr) 60px;
  }
  .mail-filters {
    gap: 6px;
    padding-left: 16px;
  }
  .filter-chip {
    padding: 7px 10px;
  }
}
@media (max-width: 760px) {
  .shell {
    display: flex;
    padding: 0;
  }
  .topbar {
    height: 64px;
    padding: 8px 12px;
    gap: 6px;
  }
  .topbar .brand {
    display: none;
  }
  .topbar .search {
    height: 46px;
    flex: 1;
  }
  .search input {
    font-size: 15px;
  }
  .topbar #settings {
    display: none;
  }
  .topbar > .spacer {
    display: none;
  }
  .sidebar {
    top: 64px;
    width: 256px;
    padding-top: 16px;
  }
  .main {
    border-radius: 0;
    border-top: 1px solid var(--line);
  }
  .mail-filters {
    padding: 12px 12px 5px;
    min-height: 55px;
    gap: 7px;
  }
  .filter-chip {
    height: 32px;
    font-size: 12px;
  }
  .local-banner {
    padding: 7px 14px;
    font-size: 9px;
    line-height: 1.5;
  }
  .toolbar {
    padding: 4px 12px;
    height: auto;
    min-height: 46px;
    flex-wrap: nowrap;
  }
  .toolbar .icon-button {
    padding: 7px;
  }
  .toolbar #sort {
    display: none;
  }
  .toolbar #bulk-more {
    width: 90px !important;
  }
  .toolbar .range {
    display: none;
  }
  .mail-row {
    grid-template-columns: 18px minmax(100px, 1fr) 50px;
    grid-template-rows: 20px 32px;
    gap: 3px 12px;
    padding: 12px 14px;
    height: 84px;
    min-height: 84px;
    position: relative;
  }
  .mail-row input {
    grid-column: 1;
    grid-row: 1/3;
  }
  .mail-row .sender {
    grid-column: 2;
    grid-row: 1;
    font-size: 13px;
  }
  .mail-row .date {
    grid-column: 3;
    grid-row: 1;
    font-size: 10px;
    align-self: start;
  }
  .mail-row .preview {
    grid-column: 2/4;
    grid-row: 2;
    display: block;
    padding-right: 25px;
  }
  .mail-row .subject {
    display: block;
    max-width: 100%;
    font-size: 12px;
    line-height: 18px;
  }
  .mail-row .snippet {
    display: block;
    font-size: 11px;
    line-height: 16px;
  }
  .mail-row .star {
    position: absolute;
    right: 14px;
    bottom: 12px;
  }
  .compose-overlay {
    padding: 0;
    background: var(--panel);
  }
  .compose-overlay .modal {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
  }
  .compose-overlay .modal section {
    flex: 1;
    overflow: auto;
  }
  .compose-overlay .editor {
    min-height: 260px;
  }
  .main-heading {
    padding: 23px 18px 8px;
  }
  .auth {
    padding: 18px;
  }
  .auth-panel {
    padding: 28px 22px;
  }
  .auth-form:before {
    width: 175px;
    height: 65px;
  }
  .auth-form h2 {
    font-size: 23px;
  }
}

@media (min-width: 761px) {
  .topbar .search {
    flex: 0 1 760px;
  }
  .mail-row .sender,
  .mail-row .subject,
  .mail-row .snippet {
    font-size: 14px;
  }
}

/* Profile Popover */
.profile-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.avatar {
  cursor: pointer;
  border: 0;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.profile-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 18px;
  z-index: 100;
  display: none;
  animation: popoverIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.profile-popover.open {
  display: block;
}
@keyframes popoverIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.popover-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.popover-avatar {
  width: 48px !important;
  height: 48px !important;
  font-size: 18px;
  flex-shrink: 0;
}
.popover-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.popover-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popover-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popover-role {
  margin-top: 4px;
  align-self: flex-start;
  font-size: 10px;
  padding: 2px 7px;
}
.popover-storage {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.popover-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
}
.popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.popover-item:hover {
  background: var(--hover);
}
.popover-item.danger {
  color: var(--danger);
}
.popover-item.danger:hover {
  background: #fdf2f2;
}
.dark .popover-item.danger:hover {
  background: #3b1c1c;
}
.popover-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}

/* Folder Banners */
.folder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
  gap: 12px;
  flex-wrap: wrap;
}
.folder-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
}
.folder-banner-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  transition: all 0.15s ease;
}
.folder-banner-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Toolbar Text Button */
.toolbar-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.toolbar-text-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}
.toolbar-text-btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}
.toolbar-text-btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 7;
  backdrop-filter: blur(2px);
  animation: overlayIn 0.2s ease forwards;
}
.sidebar-backdrop.open {
  display: block;
}
