:root {
  color-scheme: light;
  --navy-950: #031127;
  --navy-900: #071b3c;
  --navy-800: #102b56;
  --blue-700: #0754d8;
  --blue-600: #1267e9;
  --blue-500: #157af6;
  --cyan-400: #21cfe7;
  --surface: #ffffff;
  --surface-soft: #f6f8fc;
  --surface-muted: #eef3fa;
  --line: #e3e9f2;
  --line-strong: #d5dfec;
  --text: #10213d;
  --text-soft: #52657f;
  --text-muted: #7b8ba1;
  --danger: #d92d45;
  --success: #0a9f6e;
  --shadow-sm: 0 4px 18px rgba(15, 37, 68, 0.07);
  --shadow-lg: 0 24px 80px rgba(3, 17, 39, 0.18);
  --sidebar-width: 248px;
  --topbar-height: 72px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0d1b31;
  --surface-soft: #071426;
  --surface-muted: #12243e;
  --line: #1b3150;
  --line-strong: #274362;
  --text: #eff5ff;
  --text-soft: #a8b8cd;
  --text-muted: #778ba5;
  --navy-900: #f1f6ff;
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--text); background: var(--surface-soft); overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(21, 122, 246, 0.28); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--text-soft); }
.eyebrow { margin: 0; color: var(--blue-600); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
[data-icon] { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; }
[data-icon] svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Login */
.login-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 44px 32px 74px; overflow: hidden; background: linear-gradient(145deg, #eef5ff 0%, #f8fbff 44%, #eef8fb 100%); }
.login-page::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(18,103,233,.09) 1px, transparent 1px); background-size: 30px 30px; mask-image: linear-gradient(90deg, #000, transparent 56%); }
.login-ambient { position: absolute; border-radius: 999px; filter: blur(3px); pointer-events: none; }
.login-ambient-one { width: 560px; height: 560px; top: -290px; left: -200px; background: rgba(18, 103, 233, .12); }
.login-ambient-two { width: 460px; height: 460px; bottom: -280px; right: -140px; background: rgba(33, 207, 231, .15); }
.login-shell { position: relative; z-index: 1; width: min(1120px, 100%); min-height: 620px; display: grid; grid-template-columns: 1.13fr .87fr; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 30px; box-shadow: var(--shadow-lg); background: rgba(255,255,255,.78); backdrop-filter: blur(18px); }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 70px 76px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #041531 0%, #092958 62%, #0754d8 145%); }
.login-story::after { content: ""; position: absolute; width: 360px; height: 360px; right: -190px; bottom: -170px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.035), 0 0 0 112px rgba(255,255,255,.025); }
.login-logo { position: absolute; top: 38px; left: 52px; width: 188px; }
.login-story .eyebrow { color: #5ce2f1; }
.login-story h1 { margin: 18px 0; font-size: clamp(44px, 5vw, 70px); line-height: .98; letter-spacing: -.055em; }
.login-story h1 span { color: #38d6e8; }
.login-intro { max-width: 520px; margin: 5px 0 37px; color: #b8c9df; font-size: 18px; line-height: 1.65; }
.trust-list { display: grid; gap: 14px; }
.trust-list > div { display: grid; grid-template-columns: 42px 1fr; align-items: center; column-gap: 14px; }
.trust-list [data-icon] { grid-row: 1 / 3; width: 42px; height: 42px; padding: 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 13px; color: #5ce2f1; background: rgba(255,255,255,.07); }
.trust-list strong { font-size: 14px; }
.trust-list small { margin-top: 3px; color: #9fb2ca; font-size: 12px; }
.login-card { align-self: center; padding: 54px 58px; }
.mobile-login-brand { display: none; }
.login-card-kicker { margin: 0 0 8px; color: var(--blue-600); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.login-card h2 { margin: 0; color: #071b3c; font-size: 30px; letter-spacing: -.03em; }
.login-card > .muted { margin: 9px 0 35px; font-size: 14px; }
.login-card label:not(.check-label) { display: block; margin: 18px 0 8px; color: #263b5a; font-size: 13px; font-weight: 700; }
.field-wrap { display: flex; align-items: center; height: 50px; padding: 0 14px; border: 1px solid #dce5f0; border-radius: 13px; color: #75869b; background: #f9fbfe; transition: .2s ease; }
.field-wrap:focus-within { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(21,122,246,.11); background: #fff; }
.field-wrap > [data-icon] { width: 19px; }
.field-wrap input { width: 100%; height: 100%; margin-left: 10px; border: 0; outline: 0; color: #10213d; background: transparent; }
.password-toggle { display: inline-flex; padding: 6px; border: 0; color: #71839a; background: transparent; cursor: pointer; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: 18px 0; font-size: 12px; }
.login-row a { color: var(--blue-600); font-weight: 700; text-decoration: none; }
.check-label { display: inline-flex; align-items: center; gap: 8px; color: #52657f; cursor: pointer; }
.check-label input { accent-color: var(--blue-600); }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; height: 44px; padding: 0 20px; border: 0; border-radius: 12px; color: #fff; font-weight: 750; background: linear-gradient(135deg, var(--blue-600), #0c7fe9); box-shadow: 0 10px 24px rgba(18,103,233,.22); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, opacity .16s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(18,103,233,.28); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.login-button { width: 100%; height: 50px; }
.form-error { min-height: 18px; margin: -7px 0 8px; color: var(--danger); font-size: 12px; }
.demo-button { width: 100%; height: 42px; margin-top: 10px; border: 1px solid #d9e4f1; border-radius: 11px; color: #315074; font-weight: 700; background: #fff; cursor: pointer; }
.login-footnote { margin: 22px 0 0; color: #8795a8; font-size: 10px; line-height: 1.5; text-align: center; }
.login-footer { position: absolute; z-index: 1; bottom: 24px; display: flex; gap: 28px; color: #708199; font-size: 11px; }

/* Application shell */
.mail-app { min-height: 100vh; background: var(--surface-soft); }
.topbar { position: fixed; z-index: 50; inset: 0 0 auto 0; height: var(--topbar-height); display: flex; align-items: center; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(16px); }
.brand { display: inline-flex; width: 190px; align-items: center; }
.brand img { width: 145px; }
[data-theme="dark"] .brand img { filter: brightness(0) invert(1); }
.menu-button { display: none !important; }
.icon-button, .mini-icon { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; color: var(--text-soft); background: transparent; cursor: pointer; }
.icon-button { width: 40px; height: 40px; }
.mini-icon { width: 34px; height: 34px; }
.icon-button:hover, .mini-icon:hover { color: var(--blue-600); background: var(--surface-muted); }
.search-box { position: relative; width: min(650px, 48vw); height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid transparent; border-radius: 13px; color: var(--text-muted); background: var(--surface-muted); transition: .2s ease; }
.search-box:focus-within { border-color: color-mix(in srgb, var(--blue-500) 55%, transparent); background: var(--surface); box-shadow: var(--shadow-sm); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-box kbd { padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text-muted); font-size: 11px; background: var(--surface); }
.search-clear { display: inline-flex; padding: 0; border: 0; color: var(--text-muted); background: none; cursor: pointer; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.sync-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 7px; color: var(--text-muted); font-size: 11px; font-weight: 650; }
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 12%, transparent); }
.sync-status.syncing i { background: #f4a62a; animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.account-button { display: flex; align-items: center; gap: 9px; margin-left: 7px; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; }
.avatar, .sender-avatar { display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; font-weight: 800; background: linear-gradient(145deg, #0754d8, #1ccbdc); }
.avatar { width: 33px; height: 33px; border-radius: 10px; font-size: 11px; }
.avatar-large { width: 44px; height: 44px; border-radius: 13px; }
.account-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.account-copy strong { max-width: 120px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.account-button > [data-icon] { width: 15px; }
.account-menu { position: fixed; z-index: 100; top: 64px; right: 18px; width: 280px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); }
.account-menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 8px 16px; border-bottom: 1px solid var(--line); }
.account-menu-head div { min-width: 0; display: flex; flex-direction: column; }
.account-menu-head span:not(.avatar) { overflow: hidden; color: var(--text-muted); font-size: 11px; text-overflow: ellipsis; }
.account-menu a, .account-menu button { width: 100%; height: 40px; display: flex; align-items: center; gap: 10px; margin-top: 3px; padding: 0 10px; border: 0; border-radius: 9px; color: var(--text-soft); font-size: 12px; text-decoration: none; background: transparent; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover { color: var(--blue-600); background: var(--surface-muted); }
.account-menu button:last-child { color: var(--danger); }

.sidebar { position: fixed; z-index: 30; top: var(--topbar-height); bottom: 0; left: 0; width: var(--sidebar-width); padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.compose-main { width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; border: 0; border-radius: 14px; color: #fff; font-weight: 780; background: linear-gradient(135deg, var(--blue-600), #087fdc); box-shadow: 0 10px 22px rgba(18,103,233,.2); cursor: pointer; }
.mail-nav { display: grid; gap: 3px; }
.nav-item, .label-item { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; color: var(--text-soft); background: transparent; cursor: pointer; }
.nav-item { height: 41px; padding: 0 12px; border-radius: 10px; font-size: 12px; font-weight: 620; }
.nav-item:hover, .label-item:hover { color: var(--blue-600); background: var(--surface-muted); }
.nav-item.active { color: var(--blue-600); background: color-mix(in srgb, var(--blue-500) 10%, var(--surface)); font-weight: 780; }
.nav-item b { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 10px; color: #fff; font-size: 9px; text-align: center; background: var(--blue-600); }
.sidebar-section { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-title { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 8px 12px; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.label-item { height: 34px; padding: 0 13px; border-radius: 9px; font-size: 11px; }
.label-dot { width: 7px; height: 7px; border-radius: 50%; }
.label-blue { background: #4385f5; }.label-cyan { background: #22c4cc; }.label-violet { background: #865cf3; }
.storage-card { margin-top: 24px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.storage-head { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 10px; }
.storage-head [data-icon] { width: 15px; }
.storage-head span:last-child { margin-left: auto; color: var(--text-muted); }
.progress { height: 5px; margin: 10px 0 7px; overflow: hidden; border-radius: 10px; background: var(--line); }
.progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-600), var(--cyan-400)); transition: width .4s ease; }
.storage-card small { color: var(--text-muted); font-size: 9px; }

.mail-workspace { position: fixed; inset: var(--topbar-height) 0 0 var(--sidebar-width); display: grid; grid-template-columns: minmax(360px, 42%) 1fr; background: var(--surface-soft); }
.message-column { position: relative; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.list-header { min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 13px; border-bottom: 1px solid var(--line); }
.list-header h1 { margin: 6px 0 0; font-size: 19px; letter-spacing: -.025em; }
.segmented { display: flex; padding: 3px; border-radius: 9px; background: var(--surface-muted); }
.segmented button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--text-muted); font-size: 10px; font-weight: 700; background: transparent; cursor: pointer; }
.segmented button.active { color: var(--text); background: var(--surface); box-shadow: 0 2px 8px rgba(22,45,74,.08); }
.bulkbar { min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.select-all { display: inline-flex; margin-right: 4px; cursor: pointer; }
.select-all input, .message-check input { position: absolute; opacity: 0; }
.select-all span, .message-check span { width: 16px; height: 16px; display: block; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.select-all input:checked + span, .message-check input:checked + span { border-color: var(--blue-600); background: var(--blue-600); box-shadow: inset 0 0 0 3px var(--surface); }
.message-count { margin-left: auto; color: var(--text-muted); font-size: 10px; }
.message-list { flex: 1; min-height: 0; overflow-y: auto; }
.message-item { position: relative; display: grid; grid-template-columns: 20px 40px minmax(0, 1fr) 26px; column-gap: 10px; min-height: 94px; padding: 15px 13px 13px 17px; border-bottom: 1px solid var(--line); cursor: pointer; transition: .14s ease; }
.message-item:hover { background: var(--surface-soft); }
.message-item.active { background: color-mix(in srgb, var(--blue-500) 7%, var(--surface)); box-shadow: inset 3px 0 var(--blue-600); }
.message-item.unread { background: color-mix(in srgb, var(--blue-500) 4%, var(--surface)); }
.message-item.unread .sender-name, .message-item.unread .message-subject { color: var(--text); font-weight: 800; }
.message-check { align-self: start; margin-top: 12px; cursor: pointer; }
.message-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #fff; font-size: 11px; font-weight: 850; background: var(--avatar-color, #3e7be8); }
.message-copy { min-width: 0; }
.message-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sender-name { flex: 1; overflow: hidden; color: var(--text-soft); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.message-time { flex: none; color: var(--text-muted); font-size: 9px; }
.message-subject { display: block; margin-top: 7px; overflow: hidden; color: var(--text-soft); font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.message-preview { display: block; margin-top: 5px; overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-meta { display: flex; gap: 8px; margin-top: 8px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 3px; color: var(--text-muted); font-size: 9px; }
.attachment-chip [data-icon] { width: 12px; height: 12px; }
.star-button { display: inline-flex; width: 30px; height: 30px; padding: 6px; border: 0; border-radius: 8px; color: #a3afbd; background: transparent; cursor: pointer; }
.star-button:hover, .star-button.active { color: #f0a51b; }
.star-button.active svg { fill: currentColor; }
.list-empty { position: absolute; inset: 139px 0 0; display: grid; place-content: center; justify-items: center; color: var(--text-muted); text-align: center; }
.list-empty [data-icon] { width: 42px; height: 42px; color: var(--line-strong); }
.list-empty h3 { margin: 14px 0 4px; color: var(--text-soft); font-size: 15px; }
.list-empty p { margin: 0; font-size: 11px; }
.list-skeleton { position: absolute; inset: 139px 0 0; padding: 18px; background: var(--surface); }
.list-skeleton i { display: block; height: 70px; margin-bottom: 18px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-muted), var(--surface-soft), var(--surface-muted)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.reader-column { min-width: 0; position: relative; background: var(--surface-soft); }
.reader-empty { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-illustration { width: 84px; height: 84px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 25px; color: var(--blue-600); background: var(--surface); box-shadow: var(--shadow-sm); transform: rotate(-4deg); }
.empty-illustration [data-icon] { width: 38px; height: 38px; transform: rotate(4deg); }
.reader-empty h2 { margin: 23px 0 6px; font-size: 18px; }
.reader-empty p { margin: 0; color: var(--text-muted); font-size: 12px; }
.shortcut-hint { display: flex; align-items: center; gap: 6px; margin-top: 22px; color: var(--text-muted); font-size: 10px; }
.shortcut-hint kbd { display: inline-grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); box-shadow: 0 2px 0 var(--line-strong); }
.message-reader { height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.reader-toolbar { min-height: 49px; display: flex; align-items: center; gap: 3px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.toolbar-button { height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 9px; color: var(--text-soft); font-size: 10px; font-weight: 700; background: transparent; cursor: pointer; }
.toolbar-button:hover { color: var(--blue-600); background: var(--surface-muted); }
.toolbar-button.danger:hover, .danger { color: var(--danger); }
.toolbar-button [data-icon] { width: 16px; }
.toolbar-spacer { flex: 1; }
.mobile-back { display: none; }
.reader-scroll { min-height: 0; padding: 28px clamp(22px, 4vw, 54px) 50px; overflow-y: auto; }
.message-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.subject-row { display: flex; align-items: flex-start; gap: 12px; }
.subject-row h2 { flex: 1; margin: 0; font-size: clamp(22px, 2.3vw, 31px); line-height: 1.25; letter-spacing: -.035em; }
.sender-row { display: flex; align-items: center; gap: 12px; margin-top: 25px; }
.sender-avatar { width: 42px; height: 42px; border-radius: 13px; font-size: 12px; }
.sender-copy { min-width: 0; flex: 1; }
.sender-copy > div { display: flex; align-items: baseline; gap: 7px; }
.sender-copy strong { font-size: 12px; }
.sender-copy > div span { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.recipient-line { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; color: var(--text-muted); font-size: 9px; background: none; cursor: pointer; }
.recipient-line [data-icon] { width: 12px; }
.sender-row time { color: var(--text-muted); font-size: 9px; }
.recipient-details { margin: 10px 0 0 54px; padding: 10px; border-radius: 8px; color: var(--text-muted); font-size: 10px; line-height: 1.6; background: var(--surface-soft); }
.blocked-images { display: flex; align-items: center; gap: 9px; margin: 16px 0; padding: 10px 12px; border: 1px solid #f2d6a3; border-radius: 9px; color: #8c5d0a; font-size: 10px; background: #fff8e8; }
.message-content { padding: 31px 2px; color: var(--text); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.message-content iframe { width: 100%; min-height: 380px; border: 0; background: #fff; }
.message-content pre { white-space: pre-wrap; font-family: inherit; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 10px; }
.attachment-card { min-width: 190px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--text-soft); text-decoration: none; background: var(--surface-soft); }
.attachment-card:hover { border-color: var(--blue-500); color: var(--blue-600); }
.attachment-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; color: var(--blue-600); background: color-mix(in srgb, var(--blue-500) 10%, var(--surface)); }
.attachment-card div { min-width: 0; display: flex; flex-direction: column; }
.attachment-card strong { max-width: 180px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card small { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.reader-actions { display: flex; gap: 9px; margin-top: 32px; }
.outline-button { height: 39px; display: inline-flex; align-items: center; gap: 8px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text-soft); font-size: 11px; font-weight: 700; background: var(--surface); cursor: pointer; }
.outline-button:hover { border-color: var(--blue-500); color: var(--blue-600); }

/* Compose */
.compose-panel { position: fixed; z-index: 90; right: 28px; bottom: 0; width: min(590px, calc(100vw - 40px)); overflow: hidden; border: 1px solid var(--line); border-bottom: 0; border-radius: 15px 15px 0 0; background: var(--surface); box-shadow: var(--shadow-lg); }
.compose-panel.minimized form { display: none; }
.compose-panel header { height: 45px; display: flex; align-items: center; justify-content: space-between; padding: 0 9px 0 14px; color: #fff; background: var(--navy-900); }
.compose-panel header > div { display: flex; align-items: center; gap: 8px; }
.compose-panel header .mini-icon { color: rgba(255,255,255,.75); }
.compose-panel header .mini-icon:hover { color: #fff; background: rgba(255,255,255,.1); }
.compose-panel header strong { font-size: 11px; }
.compose-panel form { display: flex; flex-direction: column; }
.compose-field { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.compose-field label { color: var(--text-muted); font-size: 11px; }
.compose-field input { min-width: 0; flex: 1; height: 41px; border: 0; outline: 0; color: var(--text); background: transparent; }
.compose-field button { border: 0; color: var(--text-muted); font-size: 10px; background: transparent; cursor: pointer; }
.compose-panel textarea { width: 100%; min-height: 265px; padding: 18px; border: 0; outline: 0; resize: vertical; color: var(--text); line-height: 1.6; background: var(--surface); }
.compose-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.compose-file { display: inline-flex; align-items: center; gap: 5px; max-width: 180px; padding: 6px 8px; border-radius: 8px; color: var(--text-soft); font-size: 9px; background: var(--surface-muted); }
.compose-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-file button { padding: 0; border: 0; color: var(--text-muted); background: none; cursor: pointer; }
.compose-panel footer { height: 57px; display: flex; align-items: center; gap: 5px; padding: 0 12px; border-top: 1px solid var(--line); }
.compose-panel footer .primary-button { height: 37px; border-radius: 9px; font-size: 11px; }
.file-button input { display: none; }
.scrim { position: fixed; z-index: 70; inset: var(--topbar-height) 0 0 0; background: rgba(3,17,39,.32); backdrop-filter: blur(2px); }
.toast-region { position: fixed; z-index: 200; right: 22px; bottom: 24px; display: grid; gap: 8px; }
.toast { min-width: 260px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); font-size: 11px; background: var(--surface); box-shadow: var(--shadow-lg); animation: toast-in .22s ease-out; }
.toast.success [data-icon] { color: var(--success); }.toast.error [data-icon] { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1080px) {
  :root { --sidebar-width: 210px; }
  .brand { width: 150px; }
  .account-copy, .sync-status span { display: none; }
  .mail-workspace { grid-template-columns: minmax(335px, 45%) 1fr; }
  .toolbar-button span:not([data-icon]) { display: none; }
}

@media (max-width: 800px) {
  :root { --topbar-height: 64px; }
  .login-page { padding: 20px; }
  .login-shell { min-height: auto; grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-card { padding: 35px 28px; }
  .mobile-login-brand { display: block; margin-bottom: 28px; }
  .mobile-login-brand img { width: 150px; }
  .login-footer { display: none; }
  .menu-button { display: inline-flex !important; }
  .brand { width: 118px; }
  .brand img { width: 112px; }
  .topbar { gap: 9px; padding: 0 12px; }
  .search-box { flex: 1; width: auto; }
  .search-box kbd, .top-actions > .icon-button, .sync-status { display: none; }
  .account-button { border: 0; padding: 0; }
  .account-button > [data-icon] { display: none; }
  .sidebar { z-index: 80; top: var(--topbar-height); width: 265px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .mail-workspace { inset: var(--topbar-height) 0 0 0; grid-template-columns: 1fr; }
  .reader-column { position: absolute; z-index: 20; inset: 0; transform: translateX(101%); transition: transform .22s ease; }
  .reader-column.open { transform: translateX(0); }
  .mobile-back { display: inline-flex; }
  .message-item { min-height: 88px; }
  .compose-panel { right: 0; width: 100%; border-radius: 15px 15px 0 0; }
  .compose-panel textarea { min-height: 220px; }
}

@media (max-width: 520px) {
  .brand { display: none; }
  .search-box { height: 40px; }
  .list-header { min-height: 86px; padding-inline: 16px; }
  .list-header h1 { font-size: 17px; }
  .segmented button { padding: 0 8px; }
  .reader-scroll { padding: 22px 18px 42px; }
  .sender-row time { display: none; }
  .reader-toolbar { padding-inline: 8px; }
  .compose-panel { max-width: 100vw; }
}

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