:root {
  --navy-950: #061323;
  --navy-900: #08182c;
  --navy-850: #0b1c33;
  --navy-800: #10243f;
  --navy-700: #183656;
  --blue-600: #2d66f5;
  --blue-500: #3a72ff;
  --blue-100: #e8efff;
  --blue-050: #f3f6ff;
  --ink: #102036;
  --muted: #627087;
  --muted-2: #8290a4;
  --line: #dfe5ed;
  --line-soft: #ebeff4;
  --surface: #ffffff;
  --surface-alt: #f6f8fb;
  --canvas: #eef2f7;
  --success: #19875d;
  --danger: #c9434d;
  --warning: #a76813;
  --shadow-sm: 0 8px 24px rgba(6, 19, 35, 0.08);
  --shadow-lg: 0 28px 70px rgba(6, 19, 35, 0.2);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --topbar-height: 72px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--canvas);
  color: var(--ink);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-600);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.loading-view {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.7);
}

.loading-logo {
  width: 180px;
  color: #fff;
}

.loading-view p {
  margin: 0;
  font-size: 0.9rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue-500);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(460px, 0.95fr) minmax(500px, 1.05fr);
  background: var(--navy-900);
  overflow: auto;
}

.login-card {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 110px);
  color: #fff;
}

.login-brand {
  position: absolute;
  top: 34px;
  left: clamp(48px, 7vw, 110px);
  color: #fff;
}

.login-brand img {
  display: block;
  width: 176px;
}

.login-card h1 {
  margin: 0;
  max-width: 610px;
  font-size: clamp(2.8rem, 5vw, 5.9rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.login-copy {
  max-width: 600px;
  margin: 28px 0 34px;
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.7;
}

.login-assurance {
  max-width: 560px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.83rem;
  line-height: 1.55;
}

.login-panel {
  display: flex;
  min-height: 100vh;
  align-items: flex-end;
  padding: clamp(30px, 4vw, 64px);
  background: var(--navy-900);
  color: #fff;
  border-left: 1px solid rgba(255, 255, 255, 0.11);
}

.login-panel-content {
  width: 100%;
  padding: clamp(32px, 4.5vw, 70px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38d69a;
  box-shadow: 0 0 0 5px rgba(56, 214, 154, 0.1);
}

.login-panel blockquote {
  margin: clamp(36px, 5vw, 90px) 0 clamp(38px, 4vw, 70px);
  font-size: clamp(2rem, 3.5vw, 4.3rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.benefit-grid div {
  display: grid;
  gap: 8px;
}

.benefit-grid strong {
  font-size: 0.9rem;
}

.benefit-grid span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.79rem;
  line-height: 1.5;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

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

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-primary {
  background: var(--blue-600);
  color: #fff;
  box-shadow: 0 8px 18px rgba(45, 102, 245, 0.22);
}

.button-primary:hover {
  background: #245be2;
  box-shadow: 0 11px 24px rgba(45, 102, 245, 0.28);
}

.button-secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button-secondary:hover,
.button-quiet:hover {
  border-color: #cfd7e2;
  background: var(--surface-alt);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.button-large {
  align-self: flex-start;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 10px;
  font-size: 0.94rem;
}

.google-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  background: #fff;
  color: #4285f4;
  font-family: Arial, sans-serif;
  font-size: 0.93rem;
  font-weight: 800;
}

.alert {
  max-width: 560px;
  margin-top: 20px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 130, 139, 0.4);
  border-radius: 10px;
  background: rgba(201, 67, 77, 0.16);
  color: #ffd9dc;
  font-size: 0.86rem;
  line-height: 1.5;
}

.mail-app {
  width: 100vw;
  height: 100vh;
  background: var(--canvas);
}

.topbar {
  position: relative;
  z-index: 40;
  display: grid;
  height: var(--topbar-height);
  grid-template-columns: 280px minmax(300px, 760px) 1fr;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--navy-900);
  color: #fff;
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.topbar-actions {
  position: relative;
  justify-content: flex-end;
  gap: 9px;
}

.app-brand {
  display: flex;
  align-items: center;
  color: #fff;
}

.app-brand img {
  width: 142px;
}

.product-name {
  margin-left: 2px;
  padding-left: 13px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.86rem;
  font-weight: 650;
}

.search-box {
  display: flex;
  height: 44px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  transition: background 150ms ease, border-color 150ms ease;
}

.search-box:focus-within {
  border-color: rgba(92, 135, 255, 0.85);
  background: rgba(255, 255, 255, 0.11);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: rgba(255, 255, 255, 0.58);
  stroke-width: 1.8;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 0.9rem;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.search-box kbd {
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.36);
  font-family: inherit;
  font-size: 0.65rem;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface-alt);
}

.topbar .icon-button {
  color: rgba(255, 255, 255, 0.72);
}

.topbar .icon-button:hover {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.account-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-menu {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 80;
  display: grid;
  width: 260px;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}

.account-menu strong {
  font-size: 0.9rem;
}

.account-menu > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
}

.account-menu hr {
  width: 100%;
  margin: 10px 0 5px;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.account-menu button {
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.account-menu button:hover {
  background: var(--surface-alt);
}

.danger-text {
  color: var(--danger) !important;
}

.workspace {
  display: grid;
  height: calc(100vh - var(--topbar-height));
  grid-template-columns: 238px minmax(320px, 390px) minmax(0, 1fr);
  padding: 14px;
  gap: 12px;
  background: var(--canvas);
}

.sidebar,
.thread-column,
.reader {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.compose-button {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(45, 102, 245, 0.2);
  transition: background 150ms ease, transform 150ms ease;
}

.compose-button:hover {
  background: #245be2;
  transform: translateY(-1px);
}

.compose-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.mail-nav {
  display: grid;
  gap: 4px;
  margin-top: 20px;
}

.nav-item {
  display: grid;
  min-height: 42px;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.nav-item.active {
  background: var(--blue-100);
  color: var(--blue-600);
  font-weight: 800;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item b {
  font-size: 0.73rem;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 15px 8px 4px;
  border-top: 1px solid var(--line-soft);
}

.gmail-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 650;
}

.gmail-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.sidebar-footer a {
  color: var(--muted-2);
  font-size: 0.69rem;
  text-decoration: none;
}

.thread-column {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.column-heading {
  display: flex;
  min-height: 88px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.column-heading h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: -0.025em;
}

.result-count {
  color: var(--muted-2);
  font-size: 0.72rem;
}

.thread-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.thread-item {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 14px 14px 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.thread-item:hover {
  background: #f9fbfd;
}

.thread-item.selected {
  background: var(--blue-050);
}

.thread-item.selected::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--blue-600);
  content: "";
}

.thread-item.unread .thread-sender,
.thread-item.unread .thread-subject {
  font-weight: 820;
}

.sender-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: #edf1f6;
  color: var(--navy-700);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.thread-item.unread .sender-avatar {
  background: var(--navy-900);
  color: #fff;
}

.thread-copy {
  min-width: 0;
}

.thread-topline {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.thread-sender,
.thread-subject,
.thread-snippet {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.thread-sender {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 670;
}

.thread-time {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 0.65rem;
}

.thread-subject-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.thread-subject {
  color: #27384d;
  font-size: 0.78rem;
  font-weight: 680;
}

.thread-count {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 0.65rem;
}

.thread-snippet {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.thread-flags {
  display: flex;
  align-items: center;
}

.thread-star {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #aab3c0;
  cursor: pointer;
}

.thread-star.active {
  color: #e29a18;
}

.thread-star svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
}

.thread-loading {
  position: absolute;
  inset: 88px 0 auto;
  z-index: 3;
  display: flex;
  height: 4px;
  overflow: hidden;
  background: var(--blue-100);
}

.thread-loading span {
  width: 33.333%;
  height: 100%;
  background: var(--blue-600);
  animation: loadingBar 1.1s ease-in-out infinite;
}

.thread-loading span:nth-child(2) { animation-delay: 120ms; }
.thread-loading span:nth-child(3) { animation-delay: 240ms; }

@keyframes loadingBar {
  0%, 100% { transform: scaleX(0.15); opacity: 0.35; }
  50% { transform: scaleX(1); opacity: 1; }
}

.empty-state {
  display: grid;
  flex: 1;
  place-items: center;
  align-content: center;
  padding: 40px 25px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--blue-050);
  color: var(--blue-600);
}

.empty-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.empty-state h2 {
  margin: 18px 0 6px;
  font-size: 1rem;
}

.empty-state p {
  max-width: 270px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.load-more {
  min-height: 42px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: #fff;
  color: var(--blue-600);
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.reader {
  position: relative;
  overflow: hidden;
}

.reader-empty,
.reader-loading {
  position: absolute;
  inset: 0;
}

.reader-empty {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 50px;
  text-align: center;
}

.reader-empty-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface-alt);
  color: var(--navy-800);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.reader-empty-mark span {
  color: var(--blue-600);
}

.reader-empty h2 {
  margin: 20px 0 6px;
  font-size: 1.12rem;
}

.reader-empty p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.reader-loading {
  padding: 42px;
  background: #fff;
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #edf1f5 25%, #f8fafc 50%, #edf1f5 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
}

.skeleton-title { width: 62%; height: 34px; }
.skeleton-meta { width: 35%; height: 15px; margin-top: 22px; }
.skeleton-body { width: 100%; height: 320px; margin-top: 34px; }

@keyframes skeleton {
  to { background-position-x: -200%; }
}

.reader-content {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.reader-actions {
  display: flex;
  gap: 3px;
  margin-left: auto;
}

.reader-actions .icon-button {
  color: var(--muted);
}

.reader-actions .icon-button.starred {
  color: #e29a18;
}

.reader-actions .icon-button.starred svg {
  fill: currentColor;
}

.reader-heading {
  padding: 28px 34px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.reader-heading h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.reader-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.label-chip {
  padding: 5px 8px;
  border-radius: 5px;
  background: #eff2f6;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 750;
  text-transform: capitalize;
}

.message-stack {
  padding: 0 34px;
}

.message-card {
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.message-meta {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.message-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--navy-900);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
}

.message-sender {
  min-width: 0;
}

.message-sender strong,
.message-sender span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-sender strong {
  font-size: 0.85rem;
}

.message-sender span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.69rem;
}

.message-date {
  color: var(--muted-2);
  font-size: 0.68rem;
  text-align: right;
}

.email-frame,
.email-text {
  width: 100%;
  margin-top: 20px;
  border: 0;
  background: #fff;
  color: var(--ink);
}

.email-frame {
  min-height: 360px;
}

.email-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.7;
}

.remote-image-note {
  display: inline-flex;
  margin-top: 14px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #f4f6f9;
  color: var(--muted);
  font-size: 0.66rem;
}

.attachment-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.attachment-link {
  display: inline-flex;
  max-width: 280px;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.attachment-link:hover {
  background: var(--surface-alt);
}

.attachment-link svg {
  width: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue-600);
  stroke-width: 1.8;
}

.attachment-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar {
  display: flex;
  gap: 9px;
  padding: 24px 34px 38px;
}

.compose-dialog {
  width: min(720px, calc(100vw - 30px));
  max-height: min(830px, calc(100vh - 30px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.compose-dialog::backdrop {
  background: rgba(6, 19, 35, 0.52);
  backdrop-filter: blur(3px);
}

.compose-form {
  display: flex;
  max-height: min(830px, calc(100vh - 30px));
  flex-direction: column;
  background: #fff;
}

.compose-heading {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.compose-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.compose-field {
  display: grid;
  min-height: 48px;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
}

.compose-field span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.compose-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 0.83rem;
}

.optional-recipients {
  display: grid;
}

.compose-recipient-toggle {
  align-self: flex-start;
  margin: 5px 22px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--blue-600);
  font-size: 0.68rem;
  font-weight: 750;
  cursor: pointer;
}

.compose-form textarea {
  min-height: 280px;
  flex: 1;
  resize: vertical;
  padding: 20px 22px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.7;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 22px;
}

.compose-attachment-chip {
  display: flex;
  max-width: 260px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-alt);
  font-size: 0.67rem;
}

.compose-attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-attachment-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.compose-footer {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--line-soft);
}

.compose-tools,
.compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.attachment-button {
  position: relative;
  color: var(--muted);
}

.attachment-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.attachment-limit {
  color: var(--muted-2);
  font-size: 0.65rem;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 19, 35, 0.55);
  backdrop-filter: blur(3px);
}

.confirm-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.confirm-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.confirm-card > p:not(.eyebrow) {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 300;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--navy-900);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 650;
}

.toast.error {
  background: #8f2730;
}

.mobile-only,
.mobile-reader-back,
.sidebar-backdrop {
  display: none;
}

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

  .topbar {
    grid-template-columns: 242px minmax(280px, 1fr) auto;
  }

  .reader-heading,
  .message-stack,
  .reply-bar {
    padding-left: 26px;
    padding-right: 26px;
  }
}

@media (max-width: 980px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-card {
    min-height: auto;
    padding-top: 130px;
    padding-bottom: 70px;
  }

  .login-panel {
    min-height: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
    border-left: 0;
  }

  .login-panel blockquote {
    font-size: clamp(2rem, 7vw, 4rem);
  }

  .topbar {
    grid-template-columns: 210px 1fr auto;
    gap: 12px;
  }

  .workspace {
    grid-template-columns: 74px 330px minmax(0, 1fr);
  }

  .sidebar {
    padding: 10px;
  }

  .compose-button {
    width: 48px;
    padding: 0;
    align-self: center;
    font-size: 0;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0;
  }

  .nav-item span,
  .nav-item b,
  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 64px;
  }

  body {
    overflow: hidden;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
  }

  .mobile-only {
    display: inline-grid;
  }

  .app-brand img {
    width: 122px;
  }

  .product-name,
  .search-box kbd,
  #refreshButton {
    display: none;
  }

  .search-box {
    height: 40px;
    padding: 0 10px;
  }

  .workspace {
    display: block;
    height: calc(100vh - var(--topbar-height));
    padding: 8px;
  }

  .sidebar {
    position: fixed;
    inset: var(--topbar-height) auto 0 0;
    z-index: 70;
    width: min(290px, 86vw);
    border-radius: 0 14px 14px 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow-lg);
  }

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

  .sidebar .compose-button {
    width: 100%;
    padding: 0 16px;
    align-self: stretch;
    font-size: 0.86rem;
  }

  .sidebar .nav-item {
    grid-template-columns: 22px 1fr auto;
    justify-items: initial;
    padding: 0 11px;
  }

  .sidebar .nav-item span,
  .sidebar .nav-item b,
  .sidebar .sidebar-footer {
    display: grid;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: var(--topbar-height) 0 0;
    z-index: 60;
    display: block;
    border: 0;
    background: rgba(6, 19, 35, 0.48);
  }

  .thread-column,
  .reader {
    width: 100%;
    height: 100%;
  }

  .thread-column.reader-open {
    display: none;
  }

  .reader {
    display: none;
  }

  .reader.mobile-open {
    display: block;
  }

  .mobile-reader-back {
    display: inline-grid;
  }

  .reader-toolbar {
    padding: 0 12px;
  }

  .reader-heading,
  .message-stack,
  .reply-bar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .message-meta {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .message-date {
    grid-column: 2;
    text-align: left;
  }

  .compose-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .compose-form {
    height: 100dvh;
    max-height: none;
  }

  .compose-footer {
    align-items: flex-end;
  }

  .attachment-limit,
  .button-quiet {
    display: none;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 620px) {
  .login-card {
    padding: 120px 24px 54px;
  }

  .login-brand {
    top: 28px;
    left: 24px;
  }

  .login-card h1 {
    font-size: clamp(2.7rem, 14vw, 4.4rem);
  }

  .login-panel {
    padding: 18px;
  }

  .login-panel-content {
    padding: 28px 22px;
  }

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

  .topbar-left {
    gap: 7px;
  }

  .app-brand img {
    width: 104px;
  }

  .search-box {
    min-width: 0;
  }

  .search-box input {
    font-size: 0.8rem;
  }

  .account-button {
    width: 34px;
    height: 34px;
  }

  .column-heading {
    min-height: 80px;
  }

  .thread-item {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    padding-left: 12px;
  }

  .sender-avatar {
    width: 33px;
    height: 33px;
  }

  .reader-actions .icon-button {
    width: 34px;
  }

  .reply-bar {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
