:root {
  color-scheme: light;
  --accent: #1f6c52;
  --accent-strong: #145c44;
  --accent-soft: #e7f2ec;
  --text: #242424;
  --muted: #616161;
  --line: #e7e7e7;
  --surface: #ffffff;
  --soft: #f7f7f7;
  --bottom: calc(72px + env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: #e6ece9; color: var(--text); }
body { min-height: 100dvh; overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

.app {
  position: relative;
  width: min(100vw, 480px);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 52px rgba(30, 55, 45, .18);
}

.view { position: absolute; inset: 0 0 var(--bottom); display: none; background: #fff; overflow: hidden; }
.view.is-active { display: block; }
.hero {
  position: relative;
  color: #fff;
  background-image: linear-gradient(90deg, rgba(10, 51, 38, .11), rgba(10, 51, 38, .02)), url("assets/outlook-hero.svg");
  background-position: center;
  background-size: cover;
}
.mail-hero { height: calc(144px + env(safe-area-inset-top)); padding: calc(14px + env(safe-area-inset-top)) 17px 12px; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 29, 21, .08), rgba(3, 29, 21, .18)); pointer-events: none; }
.hero-topline { position: relative; z-index: 1; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 11px; }
.hero h1 { margin: 0; color: #fff; font-size: clamp(31px, 8.4vw, 40px); font-weight: 650; letter-spacing: -.8px; text-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.brand-button { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: rgba(255, 255, 255, .96); box-shadow: 0 2px 11px rgba(0, 0, 0, .13); }
.microsoft-mark { display: grid; grid-template-columns: repeat(2, 10px); gap: 2px; }
.microsoft-mark i { width: 10px; height: 10px; }
.microsoft-mark i:nth-child(1) { background: #f35325; }
.microsoft-mark i:nth-child(2) { background: #81bc06; }
.microsoft-mark i:nth-child(3) { background: #05a6f0; }
.microsoft-mark i:nth-child(4) { background: #ffba08; }
.microsoft-mark.small { grid-template-columns: repeat(2, 8px); }
.microsoft-mark.small i { width: 8px; height: 8px; }
.hero-actions { display: flex; align-items: center; gap: 3px; }
.hero-icon-button { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; background: rgba(15, 40, 30, .18); backdrop-filter: blur(10px); }
.hero-icon-button img { width: 23px; height: 23px; filter: brightness(0) invert(1); }
.mail-controls { position: absolute; z-index: 2; left: 17px; right: 17px; bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.focus-switch { display: flex; align-items: center; padding: 3px; border-radius: 23px; background: rgba(20, 34, 28, .5); backdrop-filter: blur(15px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.focus-tab { min-width: 76px; padding: 9px 16px; border-radius: 20px; color: rgba(255, 255, 255, .86); font-size: 15px; font-weight: 600; }
.focus-tab.is-active { color: var(--accent); background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .13); }
.filter-button { display: flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 20px; color: #fff; background: rgba(20, 34, 28, .48); backdrop-filter: blur(15px); font-size: 14px; font-weight: 600; }
.filter-button img { width: 18px; height: 18px; filter: brightness(0) invert(1); }

.mail-body { height: calc(100% - 144px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain; background: #fff; padding-bottom: 116px; }
.mail-group-title { padding: 18px 20px 8px; font-size: 18px; font-weight: 650; color: #2f2f2f; }
.message-row { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; min-height: 104px; padding: 13px 17px 12px; background: #fff; }
.message-row::after { content: ""; position: absolute; left: 77px; right: 0; bottom: 0; height: 1px; background: var(--line); }
.message-row:active { background: #f3f5f4; }
.sender-avatar { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.message-main { min-width: 0; padding-top: 1px; }
.sender-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sender-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 640; }
.unread-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.message-subject, .message-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-subject { margin-top: 3px; color: #313131; font-size: 15px; font-weight: 560; }
.message-preview { margin-top: 4px; color: #777; font-size: 14px; }
.message-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 20px; padding-top: 3px; color: #777; font-size: 12px; white-space: nowrap; }
.message-meta img { width: 19px; height: 19px; opacity: .58; }
.empty-state { min-height: calc(100% - 10px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 26px 130px; text-align: center; }
.empty-state img { width: min(58vw, 230px); max-height: 180px; }
.empty-state h2 { margin: 10px 0 4px; font-size: 21px; font-weight: 650; }
.empty-state p { margin: 0; color: #737373; font-size: 15px; }

.calendar-hero { height: calc(133px + env(safe-area-inset-top)); padding: calc(14px + env(safe-area-inset-top)) 17px 10px; }
.calendar-brand img { width: 23px; height: 23px; filter: invert(35%) sepia(18%) saturate(1135%) hue-rotate(107deg) brightness(88%); }
.weekday-row { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(7, 1fr); padding: 8px 0; border-radius: 20px; background: rgba(20, 34, 28, .46); backdrop-filter: blur(15px); }
.weekday-row span { text-align: center; font-size: 13px; font-weight: 650; }
.date-strip { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(7, 1fr); height: 75px; padding: 7px 10px 16px; background: #fff; border-radius: 0 0 22px 22px; box-shadow: 0 5px 14px rgba(28, 58, 45, .09); }
.date-strip button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #424242; }
.date-strip small { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; font-size: 15px; }
.date-strip em { position: absolute; top: 4px; font-size: 9px; color: #777; font-style: normal; }
.date-strip button:has(em) small { margin-top: 8px; }
.date-strip .is-today small { color: #fff; background: var(--accent); font-weight: 700; }
.date-grabber { position: absolute; left: 50%; bottom: 6px; width: 30px; height: 4px; border-radius: 4px; background: #656565; transform: translateX(-50%); opacity: .62; }
.agenda-list { height: calc(100% - 208px - env(safe-area-inset-top)); overflow-y: auto; padding-bottom: 110px; background: #fff; }
.agenda-day { border-bottom: 1px solid var(--line); }
.agenda-day-heading { display: flex; align-items: baseline; gap: 5px; padding: 12px 18px 8px; font-size: 16px; font-weight: 650; }
.agenda-day.is-today .agenda-day-heading { color: var(--accent); background: var(--accent-soft); }
.agenda-day-heading span { color: #686868; font-weight: 500; }
.agenda-day.is-today .agenda-day-heading span { color: var(--accent); }
.agenda-empty { padding: 17px 18px 22px; color: #777; font-size: 14px; }
.agenda-event { display: grid; grid-template-columns: 70px 10px 1fr; gap: 10px; padding: 14px 18px 17px; }
.agenda-time { color: #5f5f5f; font-size: 13px; }
.event-dot { width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: #7655a8; }
.event-copy strong { display: block; font-size: 15px; font-weight: 620; line-height: 1.25; }
.event-copy span { display: block; margin-top: 4px; color: #777; font-size: 13px; }

.floating-actions { position: absolute; z-index: 25; right: 16px; bottom: calc(var(--bottom) + 15px); display: flex; gap: 11px; }
.float-button { display: grid; place-items: center; width: 53px; height: 53px; border-radius: 16px; background: rgba(255, 255, 255, .98); box-shadow: 0 6px 20px rgba(22, 56, 43, .2), inset 0 0 0 1px rgba(0, 0, 0, .04); }
.float-button img { width: 25px; height: 25px; }
.copilot-button img { width: 30px; height: 30px; }
.primary-float img { filter: invert(36%) sepia(18%) saturate(1246%) hue-rotate(107deg) brightness(83%); }

.bottom-nav { position: absolute; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--bottom); display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px 10px env(safe-area-inset-bottom); background: rgba(255, 255, 255, .97); border-top: 1px solid #e2e2e2; backdrop-filter: blur(24px); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #6f6f6f; font-size: 11px; font-weight: 500; }
.nav-item img { width: 24px; height: 24px; opacity: .75; }
.nav-item .filled { display: none; }
.nav-item.is-active { color: var(--accent); font-weight: 650; }
.nav-item.is-active .regular { display: none; }
.nav-item.is-active .filled { display: block; filter: invert(36%) sepia(18%) saturate(1246%) hue-rotate(107deg) brightness(83%); opacity: 1; }

.overlay { position: absolute; z-index: 49; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; transition: opacity .2s ease; }
.overlay.is-open { opacity: 1; }
.account-drawer { position: absolute; z-index: 50; inset: 0 auto 0 0; display: flex; width: min(68%, 330px); background: #fff; box-shadow: 12px 0 30px rgba(0, 0, 0, .18); transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.account-drawer.is-open { transform: translateX(0); }
.account-rail { display: flex; flex: 0 0 56px; flex-direction: column; align-items: center; gap: 13px; padding: calc(18px + env(safe-area-inset-top)) 6px calc(18px + env(safe-area-inset-bottom)); background: #f1f2f3; border-right: 1px solid #e1e1e1; }
.rail-icon, .rail-avatar { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; }
.rail-icon { font-size: 27px; color: #5e5e5e; }
.rail-icon img { width: 24px; height: 24px; opacity: .72; }
.rail-icon.is-selected { background: #fff; box-shadow: 0 0 0 2px var(--accent), 0 3px 10px rgba(0, 0, 0, .08); }
.rail-avatar { color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.rail-avatar.gold { background: #b89448; }
.rail-avatar.blue { background: #3c77ab; }
.rail-avatar.violet { background: #8064a2; }
.rail-spacer { flex: 1; }
.folder-panel { min-width: 0; flex: 1; overflow-y: auto; padding: calc(18px + env(safe-area-inset-top)) 0 25px; }
.account-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 18px 20px; }
.account-heading strong { display: block; font-size: 21px; font-weight: 650; }
.account-heading span { display: block; max-width: 225px; margin-top: 4px; color: #777; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.account-heading button img { width: 23px; height: 23px; opacity: .75; }
.folder-section-title { display: flex; justify-content: space-between; align-items: center; padding: 7px 18px 9px; }
.folder-section-title strong { font-size: 15px; }
.folder-section-title button { color: var(--accent); font-size: 13px; font-weight: 650; }
.folder-list { padding: 0 8px; }
.folder-row { display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 7px 11px; border-radius: 9px; text-align: left; }
.folder-row.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.folder-row img { width: 21px; height: 21px; opacity: .75; }
.folder-row.is-active img { filter: invert(36%) sepia(18%) saturate(1246%) hue-rotate(107deg) brightness(83%); opacity: 1; }
.folder-row span { font-size: 14px; }
.folder-row small { color: #777; font-size: 12px; }
.folder-divider { height: 1px; margin: 13px 17px; background: #e4e4e4; }
.mailbox-label { padding: 5px 19px 9px; color: #606060; font-size: 12px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; }

.dim-overlay { z-index: 69; backdrop-filter: blur(1px); }
.bottom-sheet { position: absolute; z-index: 70; left: 0; right: 0; bottom: 0; border-radius: 25px 25px 0 0; background: #fff; box-shadow: 0 -12px 34px rgba(0, 0, 0, .16); transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.bottom-sheet.is-open { transform: translateY(0); }
.sheet-grabber { position: absolute; top: 9px; left: 50%; width: 42px; height: 5px; border-radius: 5px; background: #555; transform: translateX(-50%); opacity: .75; }
.apps-sheet { height: min(47%, 410px); padding: 42px 20px 74px; }
.reorder-button { position: absolute; top: 25px; right: 22px; color: var(--accent); font-size: 14px; font-weight: 650; }
.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px 10px; padding-top: 18px; }
.app-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; }
.app-icon { display: grid; place-items: center; width: 49px; height: 49px; border: 1px solid #dbdddc; border-radius: 13px; background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .04); }
.app-icon img { width: 26px; height: 26px; opacity: .78; }
.app-grid button[data-app="copilot"] .app-icon img { width: 31px; height: 31px; opacity: 1; }
.sheet-nav { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); height: 66px; border-top: 1px solid #e8e8e8; }
.sheet-nav span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #747474; font-size: 10px; }
.sheet-nav img { width: 23px; height: 23px; opacity: .68; }
.sheet-nav .is-active { color: var(--accent); font-weight: 650; }
.sheet-nav .is-active img { filter: invert(36%) sepia(18%) saturate(1246%) hue-rotate(107deg) brightness(83%); opacity: 1; }
.filter-sheet { padding: 30px 18px calc(20px + env(safe-area-inset-bottom)); }
.filter-sheet h2 { margin: 9px 0 15px; font-size: 20px; }
.filter-option { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 16px; text-align: left; }
.filter-option img { display: none; width: 21px; height: 21px; }
.filter-option.is-active { color: var(--accent); font-weight: 650; }
.filter-option.is-active img { display: block; filter: invert(36%) sepia(18%) saturate(1246%) hue-rotate(107deg) brightness(83%); }

.full-panel { position: absolute; z-index: 80; inset: 0; overflow-y: auto; background: #fff; transform: translateX(102%); transition: transform .23s cubic-bezier(.2, .8, .2, 1); }
.full-panel.is-open { transform: translateX(0); }
.panel-bar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; gap: 9px; min-height: calc(58px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 12px 9px; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line); backdrop-filter: blur(20px); }
.panel-bar > button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; }
.panel-bar > button img { width: 22px; height: 22px; }
.search-field { flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: #f0f2f1; }
.search-field img { width: 20px; height: 20px; opacity: .6; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search-results { padding: 20px; }
.search-results > p { color: #777; text-align: center; }
.search-hit { display: grid; grid-template-columns: 42px 1fr; gap: 11px; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left; }
.search-hit .sender-avatar { width: 40px; height: 40px; }
.search-hit strong, .search-hit span { display: block; }
.search-hit span { margin-top: 3px; color: #777; font-size: 13px; }

.detail-topbar, .compose-topbar, .utility-topbar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; gap: 8px; min-height: calc(58px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 11px 9px; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line); backdrop-filter: blur(20px); }
.detail-topbar button, .compose-topbar button, .utility-topbar button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; }
.detail-topbar img, .compose-topbar img, .utility-topbar img { width: 22px; height: 22px; }
.detail-topbar .bar-spacer, .compose-topbar .bar-spacer, .utility-topbar .bar-spacer { flex: 1; }
.detail-copy { padding: 22px 20px 120px; }
.detail-copy h2 { margin: 0 0 17px; font-size: 24px; line-height: 1.25; }
.detail-sender { display: grid; grid-template-columns: 47px 1fr auto; gap: 11px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-sender .sender-avatar { width: 46px; height: 46px; }
.detail-sender strong, .detail-sender span { display: block; }
.detail-sender span, .detail-sender time { color: #777; font-size: 12px; }
.message-body { padding-top: 19px; font-size: 16px; line-height: 1.55; }
.message-body p { white-space: pre-line; }
.attachment-list { display: grid; gap: 9px; margin-top: 20px; }
.attachment-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #dedede; border-radius: 12px; background: #fbfbfb; }
.attachment-card img { width: 24px; height: 24px; }
.attachment-card strong, .attachment-card small { display: block; }
.attachment-card small { margin-top: 3px; color: #777; }

.compose-topbar strong { font-size: 18px; }
.compose-topbar .send-button { color: var(--accent); font-weight: 700; }
.compose-form { padding: 0 17px 120px; }
.compose-field { display: grid; grid-template-columns: 63px 1fr; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line); }
.compose-field label { color: #6c6c6c; font-size: 15px; }
.compose-field input { width: 100%; border: 0; outline: 0; font-size: 16px; }
.compose-form textarea { width: 100%; min-height: 330px; padding: 17px 0; border: 0; outline: 0; resize: none; font-size: 16px; line-height: 1.55; }
.compose-tools { display: flex; gap: 8px; }
.compose-tools button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #f4f4f4; }
.compose-tools img { width: 21px; height: 21px; }

.utility-copy { padding: 18px 18px 110px; }
.utility-copy h2 { margin: 0 0 4px; font-size: 25px; }
.utility-copy > p { margin-top: 5px; color: #777; }
.utility-list { margin-top: 20px; border-top: 1px solid var(--line); }
.utility-row { display: grid; grid-template-columns: 43px 1fr; gap: 11px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.utility-row .sender-avatar { width: 40px; height: 40px; }
.utility-row strong, .utility-row span { display: block; }
.utility-row span { margin-top: 3px; color: #777; font-size: 13px; }
.profile-card { margin-top: 18px; padding: 18px; border-radius: 16px; background: linear-gradient(135deg, #eef7f2, #f8fbf9); border: 1px solid #dcebe3; }
.profile-card dl { margin: 14px 0 0; }
.profile-card div { padding: 8px 0; border-top: 1px solid #dce7e1; }
.profile-card dt { color: #777; font-size: 12px; }
.profile-card dd { margin: 3px 0 0; font-size: 15px; font-weight: 560; }

.toast { position: absolute; z-index: 100; left: 50%; bottom: calc(var(--bottom) + 18px); max-width: 84%; padding: 10px 15px; border-radius: 10px; color: #fff; background: rgba(31, 31, 31, .92); font-size: 13px; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .focus-tab { min-width: 68px; padding-inline: 12px; }
  .message-row { grid-template-columns: 43px minmax(0, 1fr) auto; gap: 9px; padding-inline: 12px; }
  .sender-avatar { width: 42px; height: 42px; }
  .message-row::after { left: 64px; }
  .app-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 481px) {
  body { display: grid; place-items: center; padding: 18px 0; }
  .app { height: min(900px, calc(100dvh - 36px)); border-radius: 34px; }
  .hero, .bottom-nav, .bottom-sheet, .account-drawer, .full-panel { --safe-top: 0px; }
}

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