:root {
  --radius-sm: 16px;
  --radius-md: 22px;
  --radius-lg: 30px;
  --shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.18);
  --shadow-mid: 0 20px 48px rgba(0, 0, 0, 0.26);
  --shadow-hard: 0 32px 82px rgba(0, 0, 0, 0.42);
  --transition-fast: 0.18s ease;
  --transition-mid: 0.28s ease;
  --bg-dark-1: #071018;
  --bg-dark-2: #0d1722;
  --bg-light-1: #eef6ff;
  --bg-light-2: #f7fbff;
  --text-dark: #eff8ff;
  --text-light: #182433;
  --line-dark: rgba(255, 255, 255, 0.08);
  --line-light: rgba(18, 46, 78, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  transition: background var(--transition-mid), color var(--transition-mid);
  overflow-x: hidden;
}

body.theme-dark {
  background:
    radial-gradient(circle at 15% 18%, rgba(0, 255, 191, 0.08), transparent 24%),
    radial-gradient(circle at 84% 10%, rgba(0, 162, 255, 0.1), transparent 18%),
    radial-gradient(circle at 70% 82%, rgba(120, 92, 255, 0.1), transparent 24%),
    linear-gradient(180deg, var(--bg-dark-1) 0%, #09111a 52%, var(--bg-dark-2) 100%);
  color: var(--text-dark);
}

body.theme-light {
  background:
    radial-gradient(circle at 18% 18%, rgba(0, 132, 255, 0.08), transparent 22%),
    radial-gradient(circle at 84% 12%, rgba(0, 214, 170, 0.08), transparent 20%),
    linear-gradient(180deg, var(--bg-light-1) 0%, var(--bg-light-2) 52%, #edf3fb 100%);
  color: var(--text-light);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast);
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(0, 214, 170, 0.55);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

#appBgFx {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bgOrb {
  position: absolute;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.56;
}

.orb1 {
  width: 260px;
  height: 260px;
  top: 72px;
  left: -30px;
  background: rgba(0, 255, 187, 0.14);
}

.orb2 {
  width: 330px;
  height: 330px;
  top: 140px;
  right: -70px;
  background: rgba(0, 174, 255, 0.14);
}

.orb3 {
  width: 300px;
  height: 300px;
  bottom: 30px;
  left: 36%;
  background: rgba(123, 97, 255, 0.12);
}

.gridGlow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 92%);
}

.authShell,
.appShell {
  position: relative;
  z-index: 1;
}

.authShell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 24px;
}

.authWrap {
  width: 100%;
  max-width: 1280px;
  display: grid;
  grid-template-columns: 1.05fr 0.82fr;
  gap: 30px;
}

.authHero,
.authCard,
.topHeader,
.dashboardHero,
.mainCard,
.sideCard {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}

.authHero,
.authCard,
.topHeader,
.dashboardHero,
.mainCard,
.sideCard {
  position: relative;
}

body.theme-dark .authHero,
body.theme-dark .authCard,
body.theme-dark .topHeader,
body.theme-dark .dashboardHero,
body.theme-dark .mainCard,
body.theme-dark .sideCard {
  background: linear-gradient(180deg, rgba(12, 20, 29, 0.94) 0%, rgba(10, 18, 28, 0.9) 100%);
  border: 1px solid var(--line-dark);
  backdrop-filter: blur(10px);
}

body.theme-light .authHero,
body.theme-light .authCard,
body.theme-light .topHeader,
body.theme-light .dashboardHero,
body.theme-light .mainCard,
body.theme-light .sideCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 251, 255, 0.94) 100%);
  border: 1px solid var(--line-light);
  backdrop-filter: blur(10px);
}

.authHero {
  padding: 38px;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(0, 255, 187, 0.07), transparent 28%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.02), transparent 55%);
}

.authCard {
  padding: 30px;
}

.authCardGlow {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(0, 255, 191, 0.18), transparent 30%, transparent 72%, rgba(0, 194, 255, 0.16));
  pointer-events: none;
}

.heroBadge,
.authMiniBadge,
.miniBadge,
.statusBadge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.heroBadge {
  background: rgba(0, 255, 191, 0.12);
  color: #81ffe0;
  border: 1px solid rgba(0, 255, 191, 0.18);
  margin-bottom: 18px;
}

.authMiniBadge,
.miniBadge {
  background: rgba(0, 162, 255, 0.12);
  color: #91e2ff;
  border: 1px solid rgba(0, 162, 255, 0.18);
}

.statusBadge.working {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.18), rgba(0, 194, 255, 0.16));
  color: #9affdf;
  border: 1px solid rgba(0, 255, 170, 0.24);
  box-shadow: 0 0 18px rgba(0, 255, 170, 0.14);
}

.authHero h1,
.authHeader h2,
.dashboardHeroIntro h4,
.topHeader h2 {
  margin: 0;
  line-height: 1.08;
}

.authHero h1 {
  font-size: clamp(34px, 4vw, 56px);
  max-width: 720px;
}

.authHero p,
.authHeader p,
.dashboardHeroIntro p,
.metaText {
  opacity: 0.82;
  line-height: 1.6;
}

.heroGlowCard {
  margin-top: 28px;
  padding: 20px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}

body.theme-dark .heroGlowCard,
body.theme-dark .heroStatItem,
body.theme-dark .cardList > li,
body.theme-dark .timelineContent,
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .toolbarCard,
body.theme-dark .detailHeroCard,
body.theme-dark .detailChip {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.theme-light .heroGlowCard,
body.theme-light .heroStatItem,
body.theme-light .cardList > li,
body.theme-light .timelineContent,
body.theme-light input,
body.theme-light select,
body.theme-light textarea,
body.theme-light .toolbarCard,
body.theme-light .detailHeroCard,
body.theme-light .detailChip {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.heroGlowLine {
  position: absolute;
  top: 0;
  left: -34%;
  width: 46%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 191, 0.7), transparent);
  animation: heroLineSlide 4.4s linear infinite;
}

@keyframes heroLineSlide {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(280%);
  }
}

.heroStatGrid,
.dashboardRow,
.miniMetricGrid,
.workflowStats,
.sectionGrid,
.compactWorkGrid {
  display: grid;
  gap: 14px;
}

.heroStatGrid,
.dashboardRow {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workflowStats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.heroStatItem {
  padding: 16px 18px;
  border-radius: 18px;
}

.heroStatItem span,
.infoCardTitle {
  display: block;
  font-size: 12px;
  opacity: 0.74;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.authForm label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.fieldWrap {
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  color: inherit;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 214, 170, 0.28);
  box-shadow: 0 0 0 4px rgba(0, 214, 170, 0.08), 0 0 18px rgba(0, 214, 170, 0.1);
}

.authButtons,
.statusStack {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.authButtons {
  margin-top: 18px;
}

.authButtons button {
  flex: 1;
  min-width: 160px;
}

.authError {
  min-height: 20px;
  margin-top: 14px;
  color: #ff879b;
  font-weight: 700;
}

.primaryBtn,
.secondaryBtn,
.ghostBtn,
.dangerBtn,
.logoutBtnModern,
.navBtn {
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 800;
}

.primaryBtn {
  background: linear-gradient(135deg, #00d47d, #10b981);
  color: #04130c;
  box-shadow: 0 0 0 1px rgba(0, 255, 170, 0.12), 0 0 18px rgba(0, 255, 170, 0.22);
}

.ghostBtn,
.navBtn {
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondaryBtn {
  background: linear-gradient(135deg, #2979ff, #00b7ff);
  color: #f7fbff;
  box-shadow: 0 0 0 1px rgba(65, 160, 255, 0.12), 0 0 18px rgba(0, 162, 255, 0.18);
}

.dangerBtn {
  background: linear-gradient(135deg, #ff5c79, #ff7a18);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 92, 121, 0.12), 0 0 18px rgba(255, 92, 121, 0.18);
}

body.theme-light .ghostBtn,
body.theme-light .navBtn {
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(18, 46, 78, 0.08);
}

.logoutBtnModern {
  background: linear-gradient(135deg, #00d9ff, #00ffb2);
  color: #04131a;
  box-shadow: 0 0 18px rgba(0, 255, 170, 0.24);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.theme-dark .sidebar {
  background: rgba(8, 15, 24, 0.84);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

body.theme-light .sidebar {
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid rgba(18, 46, 78, 0.08);
  backdrop-filter: blur(12px);
}

.sidebarGlow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 255, 170, 0.05), transparent 40%, transparent 65%, rgba(0, 194, 255, 0.05));
}

.sidebarBrand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.brandLogo {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 22px;
  font-weight: 900;
  color: #04131a;
  background: linear-gradient(135deg, #00ffa3, #00c2ff);
  box-shadow: 0 0 24px rgba(0, 255, 170, 0.24);
}

.brandTitle {
  font-weight: 900;
  font-size: 18px;
}

.brandSub {
  font-size: 12px;
  opacity: 0.72;
  margin-top: 4px;
}

.sidebarNav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.navBtn {
  text-align: left;
}

body.theme-dark .navBtn.active {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.16), rgba(0, 194, 255, 0.12));
  border-color: rgba(0, 255, 170, 0.22);
  color: #c8fff0;
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.06);
}

body.theme-light .navBtn.active {
  color: #1067c7;
  background: linear-gradient(135deg, rgba(0, 160, 130, 0.09), rgba(0, 125, 255, 0.08));
  border-color: rgba(0, 125, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 125, 255, 0.05);
}

.sidebarFooter {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.mobileFooterBar {
  display: none;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topHeader,
.dashboardHero,
.mainCard,
.sideCard {
  padding: 20px;
}

.topHeader {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.dashboardHero {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 18px;
  margin-bottom: 18px;
  background-image: linear-gradient(135deg, rgba(0, 255, 170, 0.03), transparent 45%, rgba(0, 194, 255, 0.03));
}

.dashboardHeroIntro h4 {
  font-size: 24px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.miniMetricGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.miniMetricCard,
.infoCard {
  min-width: 0;
  border-radius: 20px;
  padding: 16px 18px;
}

body.theme-dark .miniMetricCard,
body.theme-dark .infoCard {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.theme-light .miniMetricCard,
body.theme-light .infoCard {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(18, 46, 78, 0.08);
}

.miniMetricCard b,
.infoCardValue {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.tone-green {
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.12), 0 0 22px rgba(0, 255, 170, 0.08);
}

.tone-blue {
  box-shadow: inset 0 0 0 1px rgba(0, 162, 255, 0.12), 0 0 22px rgba(0, 162, 255, 0.08);
}

.tone-purple {
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.12), 0 0 22px rgba(168, 85, 247, 0.08);
}

.tone-cyan {
  box-shadow: inset 0 0 0 1px rgba(0, 214, 170, 0.12), 0 0 22px rgba(0, 214, 170, 0.08);
}

.tone-amber {
  box-shadow: inset 0 0 0 1px rgba(255, 179, 0, 0.14), 0 0 22px rgba(255, 179, 0, 0.08);
}

.tone-red {
  box-shadow: inset 0 0 0 1px rgba(255, 92, 121, 0.14), 0 0 22px rgba(255, 92, 121, 0.08);
}

.miniMetricCard small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.78;
}

.dashboardRow {
  margin-bottom: 18px;
}

.sectionGrid,
.sectionSingle,
.compactWorkGrid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.9fr);
  align-items: start;
}

.sectionSingle {
  grid-template-columns: minmax(0, 1fr);
}

.contentDivider {
  display: none;
}

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

.sectionHead h3 {
  margin: 0;
}

.cardList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.cardList > li {
  padding: 16px;
  border-radius: 18px;
  min-width: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.cardList > li:hover {
  transform: translateY(-1px);
}

.mailboxBtn,
.messageBtn {
  width: 100%;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0;
}

.mailboxBtn:hover,
.messageBtn:hover {
  transform: none;
}

.mailboxBtn {
  display: grid;
  gap: 6px;
}

.richCard {
  display: grid;
  gap: 12px;
}

.richCardHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.chipRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.statsGrid {
  display: grid;
  gap: 10px;
}

.statsGrid.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.statTile {
  border-radius: 16px;
  padding: 12px 14px;
}

body.theme-dark .statTile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.theme-light .statTile {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.statTile span {
  display: block;
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 6px;
}

.statTile b {
  display: block;
  font-size: 16px;
  line-height: 1.3;
}

.cardChip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.cardChip.is-good {
  color: #9affdf;
  background: rgba(0, 255, 170, 0.12);
  border-color: rgba(0, 255, 170, 0.2);
}

.cardChip.is-muted {
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.cardChip.is-cyan {
  color: #8de7ff;
  background: rgba(0, 162, 255, 0.12);
  border-color: rgba(0, 162, 255, 0.18);
}

.cardChip.is-purple {
  color: #dab4ff;
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.18);
}

.cardChip.is-amber {
  color: #ffd97c;
  background: rgba(255, 179, 0, 0.12);
  border-color: rgba(255, 179, 0, 0.18);
}

.mailboxBtn.active,
.messageBtn.active {
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.14), 0 10px 24px rgba(0, 255, 170, 0.06);
}

.mailboxBtn .richCard,
.messageBtn {
  border-radius: 16px;
  padding: 2px;
}

body.theme-dark .mailboxBtn.active,
body.theme-dark .messageBtn.active {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.08), rgba(0, 194, 255, 0.08));
  border-color: rgba(0, 255, 170, 0.18);
}

body.theme-light .mailboxBtn.active,
body.theme-light .messageBtn.active {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.08), rgba(0, 125, 255, 0.08));
  border-color: rgba(0, 125, 255, 0.14);
}

.cardTitle {
  font-weight: 800;
  margin-bottom: 6px;
}

.cardMeta,
.cardStats {
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.55;
}

.timelineList {
  display: grid;
  gap: 12px;
}

.timelineItem {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.timelineDot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 8px;
  box-shadow: 0 0 18px rgba(0, 255, 220, 0.2);
}

.timelineDot.work {
  background: #00d48a;
}

.timelineDot.warning {
  background: #ffb300;
}

.timelineDot.danger {
  background: #ff6178;
}

.timelineContent {
  border-radius: 16px;
  padding: 12px 14px;
}

.timelineTitle {
  font-weight: 800;
}

.timelineMeta {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.74;
}

.timelineText {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.86;
}

.detailCard,
.detailHeroCard,
.detailPreview,
.emptyStateCard {
  border-radius: 18px;
  padding: 14px 16px;
}

body.theme-dark .detailCard,
body.theme-dark .detailHeroCard,
body.theme-dark .detailPreview,
body.theme-dark .emptyStateCard {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.theme-light .detailCard,
body.theme-light .detailHeroCard,
body.theme-light .detailPreview,
body.theme-light .emptyStateCard {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.detailPreview {
  margin-top: 14px;
  line-height: 1.55;
  opacity: 0.9;
  min-height: 140px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

#employeeMailboxClaimPanel {
  margin-bottom: 14px;
}

.employeeMailboxHint {
  margin-bottom: 14px;
}

.employeeMailboxHint .cardMeta b {
  color: inherit;
}

#mailboxListSummary + #mailboxList,
#mailboxListSummary + .listPaginationBar + #mailboxList,
#mailboxMessageList + .detailPreview {
  margin-top: 12px;
}

#mailboxMessageList {
  margin-top: 12px;
}

.mailboxActionCard + .mailboxActionCard {
  margin-top: 12px;
}

.previewHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.previewBody {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.messagePreviewLine {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.76;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compactCardList > li {
  padding: 12px;
}

.toolbarCard {
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.compactToolbar {
  margin-bottom: 12px;
}

.toolbarGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.toolbarGrid.singleRow {
  grid-template-columns: minmax(0, 1fr);
}

.fieldLabel {
  display: block;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.84;
}

.toolbarPills,
.detailBadgeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbarPills {
  margin-top: 12px;
}

.filterChip,
.detailChip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: inherit;
}

.filterChip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex: 0 1 auto;
  min-width: 132px;
  white-space: normal;
  text-align: center;
}

body.theme-light .filterChip {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(18, 46, 78, 0.08);
}

.filterChip.active {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.18), rgba(0, 194, 255, 0.16));
  border-color: rgba(0, 255, 170, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.08), 0 10px 22px rgba(0, 255, 170, 0.06);
}

.detailBadgeRow {
  margin-top: 14px;
}

.detailChip.is-good {
  color: #9affdf;
  border-color: rgba(0, 255, 170, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.06);
}

.detailChip.is-muted {
  opacity: 0.82;
}

.listSummaryBar {
  margin-bottom: 12px;
  font-size: 13px;
  opacity: 0.78;
}

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

.paginationActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topGapSmall {
  margin-top: 14px;
}

.stickyCard {
  position: sticky;
  top: 20px;
}

#mailboxList,
#employeeList,
#assignmentList,
#aliasList,
#telegramList,
#linkMapList,
#workflowQueue,
#inboxList {
  min-width: 0;
}

.panelForm {
  display: grid;
  gap: 10px;
}

.panelForm input,
.panelForm select,
.panelForm textarea,
.authForm input {
  width: 100%;
}

.panelForm label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.86;
}

.formStatus {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.9;
}

.formStatus.success {
  color: #8affd7;
  text-shadow: 0 0 12px rgba(0, 255, 170, 0.16);
}

.formStatus.error {
  color: #ff9aac;
  text-shadow: 0 0 12px rgba(255, 92, 121, 0.16);
}

.actionRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.summaryMiniGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summaryMiniCard {
  border-radius: 18px;
  padding: 14px 16px;
}

body.theme-dark .summaryMiniCard {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.theme-light .summaryMiniCard {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.summaryMiniCard span,
.summaryMiniCard small {
  display: block;
}

.summaryMiniCard span {
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.summaryMiniCard b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.summaryMiniCard small {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.76;
  line-height: 1.45;
}

.topHeader::before,
.mainCard::before,
.sideCard::before,
.dashboardHero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.035), transparent 36%, transparent 72%, rgba(0, 194, 255, 0.04));
}

#mailboxSection .mainCard,
#mailboxSection .sideCard,
#teamSection .mainCard,
#teamSection .sideCard {
  display: flex;
  flex-direction: column;
}

#mailboxSection .sideCard > .detailHeroCard,
#mailboxSection .sideCard > .toolbarCard,
#mailboxSection .sideCard > .detailPreview,
#mailboxSection .sideCard > .detailCard,
#mailboxSection .sideCard > .panelForm,
#mailboxSection .sideCard > .formStatus {
  flex: 0 0 auto;
}

.role-employee #statusCards,
.role-employee .employeeSimplifyHide,
.role-employee #workflowSection,
.role-employee [data-target="overviewSection"],
.role-employee [data-target="workflowSection"] {
  display: none !important;
}

.role-employee #mailboxSection {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.role-employee #mailboxSection .mainCard,
.role-employee #mailboxSection .sideCard {
  border-radius: 26px;
}

.role-employee #mailboxSection .mainCard::before,
.role-employee #mailboxSection .sideCard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.05), transparent 35%, transparent 72%, rgba(0, 194, 255, 0.05));
}

.role-employee #mailboxListSummary {
  margin-top: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

body.theme-dark.role-employee #mailboxListSummary {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.theme-light.role-employee #mailboxListSummary {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.role-employee #mailboxList {
  gap: 14px;
}

.role-employee #mailboxList > li,
.role-employee #mailboxMessageList > li {
  padding: 0;
  background: transparent !important;
  border: none !important;
}

.role-employee .mailboxBtn .richCard,
.role-employee .messageBtn {
  padding: 14px;
  border-radius: 18px;
}

body.theme-dark.role-employee .mailboxBtn .richCard,
body.theme-dark.role-employee .messageBtn {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.theme-light.role-employee .mailboxBtn .richCard,
body.theme-light.role-employee .messageBtn {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(19, 38, 66, 0.08);
}

.role-employee .mailboxBtn.active,
.role-employee .messageBtn.active {
  box-shadow: 0 14px 30px rgba(0, 255, 170, 0.08);
}

.role-employee .mailboxBtn.active .richCard,
.role-employee .messageBtn.active {
  box-shadow: inset 0 0 0 1px rgba(0, 255, 170, 0.18), 0 0 0 1px rgba(0, 194, 255, 0.1);
}

.role-employee #mailboxMessageList {
  gap: 10px;
}

.role-employee #mailboxPreview {
  margin-top: 16px;
  min-height: 180px;
}

.role-employee #inboxList,
.role-employee #activityList {
  gap: 14px;
}

.role-employee .employeeMessageSearch {
  display: none;
}

.role-employee #mailboxDetailBadges {
  margin-top: 12px;
}

.role-employee .topHeader {
  margin-bottom: 16px;
}

.muted {
  opacity: 0.82;
}

.cardTitle,
.cardMeta,
.cardStats,
.detailPreview,
.previewBody,
.detailChip,
.listSummaryBar,
.miniMetricCard,
.infoCardValue,
.timelineTitle,
.timelineText,
.navBtn {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1280px) {
  .authWrap,
  .dashboardHero,
  .sectionGrid,
  .sectionSingle,
  .compactWorkGrid {
    grid-template-columns: 1fr;
  }

  .role-employee #mailboxSection {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .appShell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 14px;
  }

  .stickyCard {
    position: static;
    top: auto;
  }

  .heroStatGrid,
  .dashboardRow,
  .toolbarGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebarNav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .navBtn {
    text-align: center;
    padding: 11px 12px;
  }

  .content {
    padding: 16px 16px 108px;
  }

  .sidebarFooter {
    display: none;
  }

  .mobileFooterBar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
    backdrop-filter: blur(14px);
  }

  body.theme-dark .mobileFooterBar {
    background: rgba(8, 15, 24, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
  }

  body.theme-light .mobileFooterBar {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(18, 46, 78, 0.08);
    box-shadow: 0 18px 36px rgba(18, 46, 78, 0.12);
  }

  .mobileFooterBar .ghostBtn,
  .mobileFooterBar .logoutBtnModern {
    min-height: 48px;
  }
}

@media (max-width: 760px) {
  .authWrap {
    gap: 18px;
  }

  .sidebar {
    gap: 14px;
  }

  .sidebarBrand {
    padding: 12px;
  }

  .miniMetricGrid,
  .workflowStats,
  .heroStatGrid,
  .dashboardRow {
    grid-template-columns: 1fr;
  }

  .topHeader {
    flex-direction: column;
  }

  .previewHead {
    flex-direction: column;
  }

  .richCardHead {
    flex-direction: column;
  }

  .sidebarNav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .summaryMiniGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actionRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbarPills {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .role-employee #mailboxSection .sectionHead {
    align-items: flex-start;
  }

  .actionRow > * {
    width: 100%;
  }

  .listPaginationBar,
  .paginationActions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cardList > li,
  .compactCardList > li {
    padding: 12px;
  }

  .previewBody {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .authShell {
    padding: 14px;
  }

  .authHero,
  .authCard,
  .topHeader,
  .dashboardHero,
  .mainCard,
  .sideCard {
    padding: 14px;
    border-radius: 22px;
  }

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

  .mobileFooterBar {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

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

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

  .role-employee #mailboxListSummary {
    padding: 10px 12px;
  }

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

  .heroStatItem,
  .miniMetricCard,
  .infoCard,
  .statTile {
    padding: 12px 14px;
  }

  .dashboardHeroIntro h4,
  .topHeader h2,
  .authHeader h2 {
    font-size: 22px;
  }

  .authHero h1 {
    font-size: 30px;
  }

  .brandLogo {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .cardChip,
  .detailChip,
  .filterChip,
  .miniBadge,
  .statusBadge {
    justify-content: flex-start;
  }

  .detailPreview {
    min-height: 120px;
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 12px 12px 104px;
  }

  .sidebar {
    padding: 12px;
  }

  .topHeader,
  .dashboardHero,
  .mainCard,
  .sideCard,
  .authHero,
  .authCard {
    padding: 12px;
  }

  .heroStatGrid,
  .miniMetricGrid,
  .workflowStats,
  .dashboardRow,
  .toolbarGrid {
    grid-template-columns: 1fr;
  }

  .heroBadge,
  .authMiniBadge,
  .miniBadge,
  .statusBadge {
    min-height: 32px;
    padding: 7px 11px;
    font-size: 11px;
  }

  .mobileFooterBar {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
    gap: 8px;
  }
}

/* CRM-like compact polish for the mail service. */
body {
  background:
    radial-gradient(circle at 14% 12%, rgba(58, 126, 255, 0.18), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(23, 209, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #07111f 0%, #0b1424 46%, #0e1729 100%);
}

body.theme-light {
  background:
    radial-gradient(circle at 12% 10%, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(6, 182, 212, 0.12), transparent 26%),
    linear-gradient(135deg, #f5f8ff 0%, #eef4ff 48%, #f8fbff 100%);
}

.authShell {
  min-height: 100vh;
  align-items: center;
}

.authWrap {
  max-width: 1040px;
}

.authHero,
.authCard,
.topHeader,
.dashboardHero,
.mainCard,
.sideCard,
.detailCard,
.richCard,
.toolbarCard {
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.authHero,
.authCard {
  padding: 26px;
}

.authHero h1 {
  max-width: 680px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.authHero p,
.authHeader p {
  max-width: 560px;
  line-height: 1.55;
}

.authButtons {
  gap: 10px;
}

.authButtons .primaryBtn,
.authButtons .ghostBtn {
  min-height: 44px;
}

.sidebar,
.content {
  backdrop-filter: blur(20px);
}

.topHeader {
  align-items: center;
  padding: 18px 20px;
}

.dashboardHero {
  padding: 20px;
}

.dashboardHeroIntro p {
  max-width: 680px;
}

.mainCard,
.sideCard {
  padding: 18px;
}

.richCardHead {
  align-items: flex-start;
  gap: 12px;
}

.messageRecipientLine {
  margin-top: 5px;
  color: var(--text-muted);
}

.messageCodeBadge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(78, 203, 255, 0.42);
  border-radius: 999px;
  background: rgba(78, 203, 255, 0.13);
  color: #bdecff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.theme-light .messageCodeBadge {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.messageCodeHero {
  display: inline-flex;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(78, 203, 255, 0.45);
  border-radius: 16px;
  background: rgba(78, 203, 255, 0.12);
  color: #e5f8ff;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.theme-light .messageCodeHero {
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a8a;
}

@media (max-width: 900px) {
  .authWrap {
    grid-template-columns: 1fr;
  }

  .authHero {
    min-height: auto;
  }
}

/* Compact login screen closer to the main CRM layout. */
.authShell {
  padding: clamp(18px, 4vw, 42px);
}

.authWrap {
  max-width: 1120px;
  min-height: min(640px, calc(100vh - 84px));
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: center;
  gap: 18px;
}

.authHero {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 52px);
}

.authCard {
  width: 100%;
  align-self: center;
  padding: 24px;
  border-radius: 26px;
}

.authHero h1 {
  max-width: 560px;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.92;
}

.authHero p {
  max-width: 440px;
  margin-top: 16px;
  font-size: 15px;
}

.heroGlowCard {
  max-width: 560px;
  margin-top: 28px;
}

.heroStatGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.heroStatItem {
  min-height: 92px;
}

.authHeader {
  margin-bottom: 18px;
}

.authHeader h2 {
  font-size: 30px;
}

.authHeader p {
  margin-top: 8px;
  font-size: 13px;
}

.fieldWrap {
  margin-bottom: 12px;
}

.authButtons {
  grid-template-columns: 1fr auto;
}

.authButtons .ghostBtn {
  min-width: 84px;
}

body.theme-light .heroBadge,
body.theme-light .authMiniBadge,
body.theme-light .miniBadge,
body.theme-light .statusBadge {
  background: rgba(14, 116, 144, 0.1);
  border-color: rgba(14, 116, 144, 0.22);
  color: #0f4f68;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

body.theme-light .authHero h1,
body.theme-light .authHeader h2,
body.theme-light .brandTitle,
body.theme-light .cardTitle {
  color: #0f172a;
}

body.theme-light .authHero p,
body.theme-light .authHeader p,
body.theme-light .cardMeta,
body.theme-light .metaText {
  color: #334155;
  opacity: 1;
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

body.theme-light label {
  color: #24344d;
}

body.theme-light .ghostBtn,
body.theme-light .navBtn {
  color: #18324f;
}

@media (max-width: 900px) {
  .authWrap {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .authHero {
    min-height: auto;
    padding: 24px;
  }

  .authCard {
    padding: 20px;
  }
}

@media (max-width: 560px) {
  .authShell {
    padding: 12px;
  }

  .authHero h1 {
    font-size: 34px;
  }

  .heroStatGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

/* CRM 2.0 visual pass: cleaner panels, stronger light theme, compact density. */
:root {
  --crm-panel-dark: rgba(9, 16, 28, 0.92);
  --crm-panel-dark-2: rgba(12, 22, 38, 0.88);
  --crm-line-dark: rgba(126, 169, 255, 0.16);
  --crm-panel-light: rgba(255, 255, 255, 0.94);
  --crm-line-light: rgba(24, 45, 76, 0.14);
  --crm-blue: #4aa3ff;
  --crm-cyan: #20d6ff;
}

body.theme-dark {
  --text: #edf6ff;
  --text-muted: #9fb2cc;
}

body.theme-light {
  --text: #102033;
  --text-muted: #52657f;
}

body.theme-dark .authHero,
body.theme-dark .authCard,
body.theme-dark .topHeader,
body.theme-dark .dashboardHero,
body.theme-dark .mainCard,
body.theme-dark .sideCard,
body.theme-dark .detailCard,
body.theme-dark .richCard,
body.theme-dark .toolbarCard,
body.theme-dark .detailHeroCard,
body.theme-dark .miniMetricCard,
body.theme-dark .infoCard,
body.theme-dark .statTile,
body.theme-dark .summaryMiniCard,
body.theme-dark .timelineContent,
body.theme-dark .emptyStateCard {
  background:
    linear-gradient(180deg, rgba(17, 30, 50, 0.9), rgba(8, 15, 27, 0.92)),
    var(--crm-panel-dark);
  border: 1px solid var(--crm-line-dark);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-light .authHero,
body.theme-light .authCard,
body.theme-light .topHeader,
body.theme-light .dashboardHero,
body.theme-light .mainCard,
body.theme-light .sideCard,
body.theme-light .detailCard,
body.theme-light .richCard,
body.theme-light .toolbarCard,
body.theme-light .detailHeroCard,
body.theme-light .miniMetricCard,
body.theme-light .infoCard,
body.theme-light .statTile,
body.theme-light .summaryMiniCard,
body.theme-light .timelineContent,
body.theme-light .emptyStateCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.96));
  border: 1px solid var(--crm-line-light);
  box-shadow: 0 14px 34px rgba(25, 45, 80, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.appShell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 14px;
  gap: 14px;
}

body.theme-dark .sidebar {
  background:
    linear-gradient(180deg, rgba(9, 17, 31, 0.97), rgba(7, 13, 24, 0.97)),
    rgba(8, 14, 24, 0.96);
  border-right: 1px solid rgba(126, 169, 255, 0.14);
}

body.theme-light .sidebar {
  background: rgba(248, 251, 255, 0.96);
  border-right: 1px solid rgba(24, 45, 76, 0.12);
}

.sidebarBrand {
  padding: 10px;
  border-radius: 18px;
}

.brandLogo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f80ff, #19d2ff);
  color: white;
  box-shadow: 0 12px 24px rgba(47, 128, 255, 0.26);
}

.sidebarNav {
  gap: 8px;
}

.navBtn {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 14px;
  justify-content: flex-start;
  font-size: 13px;
}

.navBtn.active,
body.theme-light .navBtn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #246cff, #17c6ef);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 24px rgba(36, 108, 255, 0.24);
}

.content {
  padding: 18px;
}

.topHeader {
  min-height: 78px;
  margin-bottom: 16px;
  border-radius: 24px;
}

.topHeader h2 {
  font-size: 26px;
}

.metaText {
  color: var(--text-muted);
  opacity: 1;
}

.dashboardHero,
.mainCard,
.sideCard {
  border-radius: 24px;
}

.dashboardHero {
  padding: 18px;
}

.dashboardHeroIntro h4 {
  font-size: 24px;
}

.mainCard,
.sideCard {
  padding: 16px;
}

.sectionGrid,
.compactWorkGrid {
  gap: 16px;
}

.sectionHead {
  margin-bottom: 12px;
}

.sectionHead h3 {
  font-size: 18px;
}

.miniMetricGrid,
.dashboardRow,
.workflowStats,
.summaryMiniGrid,
.heroStatGrid {
  gap: 10px;
}

.miniMetricCard,
.statTile,
.heroStatItem,
.infoCard,
.summaryMiniCard {
  min-height: auto;
  padding: 12px 14px;
  border-radius: 18px;
}

.miniMetricCard b,
.statTile b,
.heroStatItem b {
  font-size: 24px;
}

.cardList {
  gap: 10px;
}

.richCard,
.cardList > li {
  border-radius: 18px;
}

.richCard {
  padding: 12px;
}

.cardTitle {
  color: var(--text);
}

.cardMeta,
.cardStats,
.messagePreviewLine,
.timelineText {
  color: var(--text-muted);
}

.heroBadge,
.authMiniBadge,
.miniBadge,
.statusBadge,
.filterChip,
.cardChip,
.detailChip {
  min-height: 28px;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 999px;
}

body.theme-dark .heroBadge,
body.theme-dark .authMiniBadge,
body.theme-dark .miniBadge,
body.theme-dark .statusBadge {
  background: rgba(43, 132, 255, 0.14);
  color: #b9dcff;
  border-color: rgba(78, 163, 255, 0.26);
}

input,
select,
textarea {
  min-height: 42px;
  padding: 11px 13px;
  border-radius: 14px;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: rgba(5, 12, 22, 0.68);
  border-color: rgba(126, 169, 255, 0.16);
}

.primaryBtn,
.secondaryBtn,
.ghostBtn,
.dangerBtn,
.logoutBtnModern,
.navBtn {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 14px;
}

.primaryBtn {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.secondaryBtn {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  color: #ffffff;
}

.ghostBtn,
body.theme-light .ghostBtn {
  border-color: rgba(64, 93, 132, 0.18);
}

.authWrap {
  gap: 16px;
}

.authHero,
.authCard {
  border-radius: 28px;
}

.authHero {
  background-image:
    linear-gradient(90deg, rgba(74, 163, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(74, 163, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 12% 12%, rgba(32, 214, 255, 0.18), transparent 32%);
  background-size: 34px 34px, 34px 34px, auto;
}

body.theme-light .authHero {
  background-image:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 12% 12%, rgba(37, 99, 235, 0.13), transparent 34%);
}

.authCardGlow {
  opacity: 0.45;
}

@media (max-width: 1180px) {
  .appShell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .content {
    padding: 14px;
  }
}

@media (max-width: 900px) {
  .appShell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }
}

/* Main CRM color correction: graphite + deep blue, no turquoise bias. */
body {
  background:
    radial-gradient(circle at 18% 12%, rgba(61, 90, 180, 0.16), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(92, 105, 142, 0.12), transparent 28%),
    linear-gradient(135deg, #070b13 0%, #0c1320 46%, #101827 100%);
}

body.theme-light {
  background:
    radial-gradient(circle at 14% 10%, rgba(44, 76, 145, 0.1), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(100, 116, 139, 0.1), transparent 26%),
    linear-gradient(135deg, #f6f8fc 0%, #eef2f8 48%, #f9fbff 100%);
}

.primaryBtn,
.secondaryBtn,
.logoutBtnModern,
.navBtn.active,
body.theme-light .navBtn.active,
.brandLogo {
  background: linear-gradient(135deg, #2f5fd5, #1e3f91);
  color: #ffffff;
}

.primaryBtn,
.secondaryBtn,
.logoutBtnModern,
.navBtn.active,
body.theme-light .navBtn.active {
  box-shadow: 0 12px 24px rgba(47, 95, 213, 0.22);
}

.heroBadge {
  background: rgba(70, 96, 154, 0.16);
  color: #cbd9ff;
  border-color: rgba(122, 145, 205, 0.22);
}

.authMiniBadge,
.miniBadge,
.statusBadge {
  background: rgba(68, 88, 132, 0.16);
  color: #c6d4f4;
  border-color: rgba(125, 145, 190, 0.22);
}

body.theme-light .heroBadge,
body.theme-light .authMiniBadge,
body.theme-light .miniBadge,
body.theme-light .statusBadge {
  background: rgba(47, 95, 213, 0.08);
  border-color: rgba(47, 95, 213, 0.18);
  color: #24427f;
}

body.theme-dark .heroBadge,
body.theme-dark .authMiniBadge,
body.theme-dark .miniBadge,
body.theme-dark .statusBadge {
  background: rgba(70, 96, 154, 0.16);
  color: #cbd9ff;
  border-color: rgba(122, 145, 205, 0.22);
}

.authHero {
  background-image:
    linear-gradient(90deg, rgba(90, 111, 164, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(90, 111, 164, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 12% 12%, rgba(47, 95, 213, 0.14), transparent 34%);
}

body.theme-light .authHero {
  background-image:
    linear-gradient(90deg, rgba(47, 95, 213, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(47, 95, 213, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 12% 12%, rgba(47, 95, 213, 0.1), transparent 34%);
}

.authCardGlow,
.heroGlowLine {
  background: linear-gradient(90deg, transparent, rgba(122, 145, 205, 0.5), transparent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(90, 111, 164, 0.36);
  box-shadow: 0 0 0 4px rgba(47, 95, 213, 0.08), 0 0 18px rgba(47, 95, 213, 0.08);
}

/* Force visible main-CRM layout after cache-busting. */
#appBgFx .bgOrb {
  opacity: 0.26;
  filter: blur(74px);
}

#appBgFx .orb1,
#appBgFx .orb2,
#appBgFx .orb3 {
  background: rgba(47, 71, 124, 0.2);
}

.gridGlow {
  background-image:
    linear-gradient(rgba(132, 151, 190, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 151, 190, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

.authShell {
  justify-content: center;
}

.authWrap {
  position: relative;
  max-width: 1060px;
  min-height: 580px;
  padding: 12px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(132, 151, 190, 0.13);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

body.theme-light .authWrap {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(24, 45, 76, 0.12);
}

.authHero {
  min-height: 556px;
  border-radius: 26px;
  background:
    linear-gradient(90deg, rgba(132, 151, 190, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(132, 151, 190, 0.055) 1px, transparent 1px),
    linear-gradient(145deg, rgba(14, 22, 38, 0.96), rgba(8, 13, 23, 0.96));
  background-size: 26px 26px, 26px 26px, auto;
}

body.theme-light .authHero {
  background:
    linear-gradient(90deg, rgba(47, 71, 124, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(47, 71, 124, 0.055) 1px, transparent 1px),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 251, 0.96));
  background-size: 26px 26px, 26px 26px, auto;
}

.authCard {
  max-width: 390px;
  margin-left: auto;
  border-radius: 26px;
}

body.theme-dark .authCard {
  background: linear-gradient(180deg, rgba(17, 25, 42, 0.98), rgba(10, 16, 28, 0.98));
  border-color: rgba(132, 151, 190, 0.18);
}

body.theme-light .authCard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 253, 0.98));
  border-color: rgba(24, 45, 76, 0.16);
}

.authHero h1 {
  max-width: 520px;
  color: var(--text);
  text-shadow: none;
}

.heroGlowCard {
  border: 1px solid rgba(132, 151, 190, 0.15);
  background: rgba(255, 255, 255, 0.035);
}

body.theme-light .heroGlowCard {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(24, 45, 76, 0.12);
}

.heroGlowLine,
.authCardGlow {
  display: none;
}

/* Evrey Mail Desk redesign: final visual layer, 2026-05-07 */
body.theme-dark {
  --bg: #070b12;
  --bg-soft: #0b1220;
  --panel: rgba(11, 18, 32, 0.86);
  --panel-strong: rgba(14, 23, 40, 0.96);
  --panel-muted: rgba(255, 255, 255, 0.045);
  --text: #edf5ff;
  --muted: #8fa1bb;
  --muted-strong: #bac8dc;
  --line: rgba(139, 170, 255, 0.18);
  --line-strong: rgba(139, 170, 255, 0.34);
  --accent: #5da8ff;
  --accent-2: #72f0d4;
  --accent-3: #ffcf6a;
  --danger: #ff6b7d;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.46);
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.32);
}

body.theme-light {
  --bg: #eef3f9;
  --bg-soft: #f8fbff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --panel-muted: rgba(25, 52, 92, 0.045);
  --text: #172033;
  --muted: #65748c;
  --muted-strong: #34435a;
  --line: rgba(31, 61, 105, 0.13);
  --line-strong: rgba(37, 83, 150, 0.28);
  --accent: #1b74e8;
  --accent-2: #0aa789;
  --accent-3: #b47700;
  --danger: #d92f4c;
  --shadow: 0 28px 80px rgba(40, 58, 94, 0.16);
  --shadow-soft: 0 16px 40px rgba(40, 58, 94, 0.12);
}

html {
  background: var(--bg);
}

body {
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 13% 7%, rgba(93, 168, 255, 0.22), transparent 31rem),
    radial-gradient(circle at 88% 14%, rgba(114, 240, 212, 0.14), transparent 27rem),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  letter-spacing: -0.01em;
}

body.theme-light {
  background:
    radial-gradient(circle at 8% 4%, rgba(27, 116, 232, 0.12), transparent 30rem),
    radial-gradient(circle at 92% 10%, rgba(10, 167, 137, 0.12), transparent 26rem),
    linear-gradient(135deg, #eef3f9, #ffffff 46%, #edf5ff);
}

#appBgFx {
  opacity: 1;
}

.gridGlow {
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(139, 170, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 170, 255, 0.05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 72%);
}

body.theme-light .gridGlow {
  background-image:
    linear-gradient(rgba(31, 61, 105, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 61, 105, 0.045) 1px, transparent 1px);
}

.bgOrb {
  filter: blur(10px);
  opacity: 0.42;
}

.orb1 {
  background: radial-gradient(circle, rgba(93, 168, 255, 0.52), transparent 64%);
}

.orb2 {
  background: radial-gradient(circle, rgba(114, 240, 212, 0.36), transparent 66%);
}

.orb3 {
  background: radial-gradient(circle, rgba(255, 207, 106, 0.18), transparent 68%);
}

.authShell {
  min-height: 100vh;
  padding: 28px;
}

.authWrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 18px;
  width: min(1160px, 100%);
  max-width: 1160px;
  min-height: 610px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 45%),
    rgba(6, 10, 18, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

body.theme-light .authWrap {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), transparent 44%),
    rgba(255, 255, 255, 0.72);
}

.authHero {
  position: relative;
  min-height: 582px;
  padding: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(110deg, rgba(93, 168, 255, 0.22), transparent 38%),
    radial-gradient(circle at 76% 20%, rgba(114, 240, 212, 0.17), transparent 24rem),
    linear-gradient(145deg, rgba(11, 18, 32, 0.98), rgba(7, 11, 18, 0.96));
}

body.theme-light .authHero {
  background:
    linear-gradient(110deg, rgba(27, 116, 232, 0.13), transparent 42%),
    radial-gradient(circle at 76% 20%, rgba(10, 167, 137, 0.12), transparent 24rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 245, 252, 0.96));
}

.authHero::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.theme-light .authHero::before {
  border-color: rgba(27, 55, 96, 0.08);
}

.authHero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 330px;
  height: 330px;
  border-radius: 48px;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(93, 168, 255, 0.3) 42% 45%, transparent 45%),
    linear-gradient(45deg, transparent 0 53%, rgba(114, 240, 212, 0.2) 53% 56%, transparent 56%);
  transform: rotate(-12deg);
  opacity: 0.82;
}

.heroBadge,
.authMiniBadge,
.heroMiniLabel,
.miniBadge {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: linear-gradient(135deg, rgba(93, 168, 255, 0.12), rgba(114, 240, 212, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.theme-light .heroBadge,
body.theme-light .authMiniBadge,
body.theme-light .heroMiniLabel,
body.theme-light .miniBadge {
  color: #24415f;
  background: linear-gradient(135deg, rgba(27, 116, 232, 0.08), rgba(10, 167, 137, 0.06));
}

.authHero h1 {
  max-width: 560px;
  margin-top: 26px;
  color: var(--text);
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.authHero p {
  max-width: 540px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.heroGlowCard {
  position: relative;
  z-index: 1;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: var(--shadow-soft);
}

body.theme-light .heroGlowCard {
  background: rgba(255, 255, 255, 0.72);
}

.heroStatGrid,
.miniMetricGrid,
.summaryMiniGrid {
  gap: 10px;
}

.heroStatItem,
.miniMetricCard,
.summaryMiniCard,
.workflowStats > *,
.dashboardRow > * {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.065);
}

body.theme-light .heroStatItem,
body.theme-light .miniMetricCard,
body.theme-light .summaryMiniCard,
body.theme-light .workflowStats > *,
body.theme-light .dashboardRow > * {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 254, 0.82));
  box-shadow: 0 10px 24px rgba(36, 63, 105, 0.07);
}

.heroStatItem b,
.miniMetricCard b,
.summaryMiniCard b {
  color: var(--text);
}

.authCard,
.sidebar,
.topHeader,
.dashboardHero,
.mainCard,
.sideCard,
.toolbarCard,
.detailHeroCard,
.detailCard,
.detailPreview,
.timelineContent,
.cardList > li {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.072), rgba(255, 255, 255, 0.028)),
    var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

body.theme-light .authCard,
body.theme-light .sidebar,
body.theme-light .topHeader,
body.theme-light .dashboardHero,
body.theme-light .mainCard,
body.theme-light .sideCard,
body.theme-light .toolbarCard,
body.theme-light .detailHeroCard,
body.theme-light .detailCard,
body.theme-light .detailPreview,
body.theme-light .timelineContent,
body.theme-light .cardList > li {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.9)),
    var(--panel);
  color: var(--text);
}

.authCard {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: none;
  margin: 0;
  padding: 34px;
  border-radius: 26px;
}

.authHeader h2,
.sectionHead h3,
.topHeader h2,
.dashboardHeroIntro h4,
.cardTitle,
.brandTitle {
  color: var(--text);
  letter-spacing: -0.035em;
}

.authHeader p,
.metaText,
.dashboardHeroIntro p,
.cardMeta,
.cardStats,
.brandSub,
.listSummaryBar,
.fieldLabel,
label {
  color: var(--muted);
}

.fieldWrap input,
.panelForm input,
.panelForm select,
.panelForm textarea,
.toolbarCard input,
.toolbarCard select,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

body.theme-light .fieldWrap input,
body.theme-light .panelForm input,
body.theme-light .panelForm select,
body.theme-light .panelForm textarea,
body.theme-light .toolbarCard input,
body.theme-light .toolbarCard select,
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  color: #172033;
  background: rgba(255, 255, 255, 0.86);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(93, 168, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primaryBtn,
.secondaryBtn,
.ghostBtn,
.dangerBtn,
.logoutBtnModern,
.filterChip,
.navBtn {
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.primaryBtn {
  border: 0;
  color: #06111f;
  background: linear-gradient(135deg, #72f0d4, #5da8ff 56%, #9ec8ff);
  box-shadow: 0 16px 34px rgba(93, 168, 255, 0.24);
}

.primaryBtn:hover,
.secondaryBtn:hover,
.ghostBtn:hover,
.logoutBtnModern:hover,
.navBtn:hover,
.filterChip:hover {
  transform: translateY(-1px);
}

.secondaryBtn,
.ghostBtn,
.filterChip {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

body.theme-light .secondaryBtn,
body.theme-light .ghostBtn,
body.theme-light .filterChip {
  background: rgba(255, 255, 255, 0.72);
  color: #1b2b43;
}

.dangerBtn {
  border: 1px solid rgba(255, 107, 125, 0.38);
  color: #fff;
  background: linear-gradient(135deg, #ff6b7d, #c42648);
}

.logoutBtnModern {
  border: 1px solid rgba(255, 107, 125, 0.28);
  color: var(--danger);
  background: rgba(255, 107, 125, 0.08);
}

.appShell {
  grid-template-columns: 274px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: hidden auto;
  border-radius: 28px;
}

.sidebarBrand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brandLogo {
  color: #06111f;
  background: linear-gradient(135deg, #72f0d4, #5da8ff);
  box-shadow: 0 12px 28px rgba(93, 168, 255, 0.24);
}

.navBtn {
  border: 1px solid transparent;
  color: var(--muted-strong);
  background: transparent;
}

.navBtn.active,
.navBtn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(93, 168, 255, 0.18), rgba(114, 240, 212, 0.08));
  box-shadow: inset 3px 0 0 var(--accent);
}

body.theme-light .navBtn.active,
body.theme-light .navBtn:hover {
  color: #123156;
  background:
    linear-gradient(90deg, rgba(27, 116, 232, 0.12), rgba(10, 167, 137, 0.06));
}

.content {
  gap: 16px;
}

.topHeader,
.dashboardHero,
.mainCard,
.sideCard {
  border-radius: 26px;
}

.dashboardHero {
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(93, 168, 255, 0.18), transparent 42%),
    radial-gradient(circle at 86% 10%, rgba(114, 240, 212, 0.13), transparent 22rem),
    var(--panel);
}

body.theme-light .dashboardHero {
  background:
    linear-gradient(115deg, rgba(27, 116, 232, 0.1), transparent 42%),
    radial-gradient(circle at 86% 10%, rgba(10, 167, 137, 0.1), transparent 22rem),
    rgba(255, 255, 255, 0.92);
}

.cardList > li {
  margin-bottom: 10px;
  border-radius: 18px;
}

.cardList > li:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.statusBadge.working {
  border: 1px solid rgba(114, 240, 212, 0.32);
  color: var(--accent-2);
  background: rgba(114, 240, 212, 0.08);
}

.formStatus,
.authError {
  color: var(--muted-strong);
}

.messageCodeHero,
.messageCodeBadge {
  border: 1px solid rgba(114, 240, 212, 0.28);
  background:
    linear-gradient(135deg, rgba(114, 240, 212, 0.13), rgba(93, 168, 255, 0.08));
}

body.theme-light .messageCodeHero,
body.theme-light .messageCodeBadge {
  background:
    linear-gradient(135deg, rgba(10, 167, 137, 0.09), rgba(27, 116, 232, 0.07));
}

.contentDivider {
  opacity: 0.45;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.mobileFooterBar {
  border-top: 1px solid var(--line);
  background: rgba(8, 13, 23, 0.88);
  backdrop-filter: blur(18px);
}

body.theme-light .mobileFooterBar {
  background: rgba(255, 255, 255, 0.88);
}

@media (max-width: 980px) {
  .authShell {
    padding: 14px;
  }

  .authWrap {
    grid-template-columns: 1fr;
    min-height: auto;
    border-radius: 26px;
  }

  .authHero {
    min-height: auto;
    padding: 28px;
  }

  .authHero h1 {
    font-size: clamp(2.25rem, 12vw, 4rem);
  }

  .authCard {
    padding: 26px;
  }

  .appShell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 88px;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    border-radius: 24px;
  }

  .sidebarNav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .topHeader,
  .dashboardHero,
  .mainCard,
  .sideCard {
    border-radius: 22px;
  }
}

@media (max-width: 620px) {
  .authWrap {
    padding: 8px;
  }

  .authHero,
  .authCard {
    padding: 22px;
    border-radius: 22px;
  }

  .heroStatGrid,
  .miniMetricGrid,
  .summaryMiniGrid,
  .sidebarNav {
    grid-template-columns: 1fr;
  }

  .authButtons,
  .actionRow,
  .paginationActions {
    flex-direction: column;
  }

  .authButtons > *,
  .actionRow > *,
  .paginationActions > * {
    width: 100%;
  }
}

/* Mobile stability pass: keep the mail panel usable on 360-430px phones. */
@media (max-width: 820px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background-attachment: scroll;
  }

  .appShell {
    display: block;
    width: 100%;
    min-height: 100vh;
    padding: 10px;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    max-height: none;
    margin: 0 0 10px;
    padding: 12px;
    border-radius: 22px;
    overflow: visible;
  }

  .sidebarBrand {
    padding: 8px 8px 12px;
  }

  .brandLogo {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .brandTitle {
    font-size: 1rem;
  }

  .brandSub {
    font-size: 0.78rem;
  }

  .sidebarNav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .navBtn {
    min-height: 44px;
    padding: 10px 11px;
    justify-content: center;
    text-align: center;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.15;
  }

  .sidebarFooter {
    display: none;
  }

  .content {
    width: 100%;
    min-width: 0;
    padding: 0;
    gap: 10px;
  }

  .topHeader {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
  }

  .topHeader h2 {
    font-size: 1.42rem;
  }

  .statusStack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .dashboardHero,
  .mainCard,
  .sideCard,
  .toolbarCard,
  .detailHeroCard,
  .detailCard,
  .detailPreview {
    width: 100%;
    min-width: 0;
    padding: 16px;
    border-radius: 20px;
  }

  .dashboardHero {
    gap: 14px;
  }

  .dashboardHeroIntro h4 {
    font-size: 1.42rem;
  }

  .dashboardHeroIntro p,
  .metaText,
  .cardMeta,
  .cardStats {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .sectionGrid,
  .sectionSingle,
  .compactWorkGrid,
  .toolbarGrid,
  .toolbarGrid.singleRow,
  .miniMetricGrid,
  .summaryMiniGrid,
  .heroStatGrid,
  .workflowStats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .sectionHead {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .sectionHead h3 {
    font-size: 1.06rem;
  }

  .cardList {
    display: grid;
    gap: 9px;
    width: 100%;
    min-width: 0;
  }

  .cardList > li,
  .compactCardList > li,
  .timelineContent {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border-radius: 16px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .detailBadgeRow,
  .toolbarPills,
  .actionRow,
  .paginationActions,
  .authButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .panelForm,
  .authForm {
    gap: 10px;
  }

  input,
  select,
  textarea,
  .primaryBtn,
  .secondaryBtn,
  .ghostBtn,
  .dangerBtn,
  .logoutBtnModern,
  .filterChip {
    min-height: 46px;
    max-width: 100%;
    font-size: 16px;
  }

  .primaryBtn,
  .secondaryBtn,
  .ghostBtn,
  .dangerBtn,
  .logoutBtnModern {
    justify-content: center;
  }

  .listPaginationBar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .detailPreview {
    max-height: 260px;
    overflow: auto;
  }

  .mobileFooterBar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
  }

  .mobileTabBtn {
    min-height: 46px;
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.055);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.1;
  }

  .mobileTabBtn.active {
    color: var(--text);
    border-color: var(--line-strong);
    background: linear-gradient(135deg, rgba(93, 168, 255, 0.18), rgba(114, 240, 212, 0.1));
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  body.theme-light .mobileTabBtn {
    background: rgba(255, 255, 255, 0.78);
    color: #34435a;
  }

  body.theme-light .mobileTabBtn.active {
    color: #123156;
    background: linear-gradient(135deg, rgba(27, 116, 232, 0.12), rgba(10, 167, 137, 0.08));
  }

  .mobileFooterBar .ghostBtn,
  .mobileFooterBar .logoutBtnModern {
    min-height: 46px;
    padding: 8px 6px;
    border-radius: 14px;
    font-size: 0.78rem;
  }

  .mailboxListItem .statsGrid,
  .messageListItem .cardStats,
  .inboxListItem .cardStats {
    display: none;
  }

  .mobileCardLine {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }

  .mobileCardLine span {
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.045);
    font-size: 0.76rem;
  }

  .richCardHead {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .chipRow {
    gap: 6px;
  }

  .messagePreviewLine {
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 430px) {
  .appShell {
    padding: 8px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .authShell {
    padding: 8px;
  }

  .authWrap {
    width: 100%;
    padding: 6px;
    border-radius: 22px;
  }

  .authHero,
  .authCard {
    padding: 18px;
    border-radius: 18px;
  }

  .authHero h1 {
    font-size: clamp(2rem, 15vw, 3.2rem);
    line-height: 0.96;
  }

  .authHero p {
    font-size: 0.96rem;
  }

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

  .navBtn {
    min-height: 42px;
    padding: 9px 8px;
    font-size: 0.82rem;
  }

  .topHeader,
  .dashboardHero,
  .mainCard,
  .sideCard,
  .toolbarCard,
  .detailHeroCard,
  .detailCard,
  .detailPreview {
    padding: 14px;
    border-radius: 18px;
  }

  .miniBadge,
  .heroBadge,
  .authMiniBadge,
  .heroMiniLabel,
  .detailChip,
  .filterChip {
    max-width: 100%;
    white-space: normal;
  }

  .cardTitle {
    font-size: 1rem;
  }

  .mobileFooterBar {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 6px;
  }

  .mobileTabBtn,
  .mobileFooterBar .ghostBtn,
  .mobileFooterBar .logoutBtnModern {
    min-height: 42px;
    padding: 7px 4px;
    font-size: 0.68rem;
  }
}
