:root {
  --ink: #202625;
  --muted: #66706e;
  --muted-2: #8a9492;
  --canvas: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f7f8f8;
  --surface-hover: #eef3f1;
  --line: #dde3e1;
  --line-strong: #cbd4d1;
  --green: #154b44;
  --green-dark: #103d38;
  --green-2: #246b61;
  --green-soft: #dcece8;
  --blue: #256b9f;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --shadow: 0 16px 50px rgba(24, 42, 39, 0.2);
  --app-safe-top: env(safe-area-inset-top, 0px);
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { min-height: 100vh; overflow: hidden; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .42; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid #5ba99c;
  outline-offset: 2px;
}

.ui-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-icon .icon-fill { fill: currentColor; stroke: var(--surface); stroke-width: 1.5; }

.eyebrow {
  margin: 0 0 9px;
  color: var(--green-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: white;
  font: 600 32px Georgia, serif;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  gap: 24px;
  background: var(--green-dark);
}
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(21,75,68,.18);
  border-top-color: var(--green-2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.boot-screen .spinner { border-color: rgba(255,255,255,.2); border-top-color: white; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(340px, .85fr) minmax(430px, 1.15fr);
  background: var(--surface);
}
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(46px, 8vw, 110px);
  background:
    linear-gradient(150deg, rgba(255,255,255,.04), transparent 55%),
    var(--green-dark);
  color: white;
}
.login-brand::after {
  position: absolute;
  right: -210px;
  bottom: -260px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 150px rgba(255,255,255,.018);
  content: "";
}
.login-brand .brand-mark { margin-bottom: 65px; }
.login-brand .eyebrow { color: #9bc8be; }
.login-brand h1 {
  max-width: 650px;
  margin: 0;
  font: 400 clamp(46px, 5vw, 76px)/1.02 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}
.login-intro { max-width: 550px; margin: 26px 0 0; color: rgba(255,255,255,.68); font-size: 17px; line-height: 1.6; }
.secure-note { display: flex; align-items: center; gap: 9px; margin-top: 50px; color: rgba(255,255,255,.74); font-size: 12px; }
.secure-note span { color: #77c4b5; font-size: 8px; }
.login-panel { display: grid; place-items: center; padding: 48px; background: #f7f9f8; }
.login-card {
  display: grid;
  width: min(430px, 100%);
  gap: 22px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(24,42,39,.09);
}
.login-card h2 { margin: 0; font-size: 31px; font-weight: 650; letter-spacing: -.025em; }
.login-card > div > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.login-card label, .body-label { display: grid; gap: 8px; color: #394341; font-size: 12px; font-weight: 650; }
.login-card input, .compose-row input, .compose-row select, .body-label textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
.login-card input { height: 48px; padding: 0 13px; }
.primary { border: 0; background: var(--green-2); color: white; font-weight: 700; }
.primary:hover { background: var(--green); }
.primary.large { height: 49px; border-radius: 5px; }
.privacy-line { margin: 0; color: var(--muted-2); font-size: 10px; text-align: center; }

/* beta.5: Outlook-style owner sign-in */
.login-page {
  position: relative;
  display: grid;
  min-height: 100dvh;
  grid-template: calc(48px + var(--app-safe-top)) minmax(0, 1fr) / 1fr;
  overflow: hidden;
  background: #eef2f1;
}
.login-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  height: calc(48px + var(--app-safe-top));
  align-items: center;
  gap: 10px;
  padding: var(--app-safe-top) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--green-dark);
  color: white;
  box-shadow: 0 1px 0 rgba(0,0,0,.14);
}
.login-launcher { display: grid; width: 32px; height: 32px; margin-left: -8px; place-items: center; }
.login-launcher .ui-icon { width: 18px; height: 18px; }
.login-product-mark {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 5px;
  background: #e7f1ee;
  color: var(--green-dark);
  font: 700 16px Georgia, serif;
}
.login-topbar > strong { font-size: 14px; font-weight: 650; }
.login-secure { display: flex; align-items: center; gap: 6px; margin-left: auto; color: rgba(255,255,255,.72); font-size: 10px; }
.login-secure .ui-icon { width: 15px; height: 15px; }
.login-preview {
  position: absolute;
  z-index: 0;
  inset: calc(48px + var(--app-safe-top)) 0 0;
  display: grid;
  grid-template-columns: 48px 220px 360px 1fr;
  opacity: .4;
  pointer-events: none;
}
.preview-rail {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px 9px;
  border-right: 1px solid #bdc9c6;
  background: #e5ebe9;
}
.preview-rail i { display: block; width: 28px; height: 28px; border-radius: 5px; background: #c4d3cf; }
.preview-rail i:first-child { background: #82aaa1; box-shadow: inset 3px 0 var(--green-2); }
.preview-folders,
.preview-list,
.preview-reader { padding: 31px 18px; border-right: 1px solid #cbd4d1; background: rgba(255,255,255,.68); }
.preview-list { background: rgba(247,249,248,.78); }
.preview-reader { border-right: 0; padding: 55px 8vw; background: rgba(255,255,255,.78); }
.preview-folders b,
.preview-list b,
.preview-reader b,
.preview-folders span,
.preview-list span,
.preview-reader span,
.preview-reader i { display: block; border-radius: 3px; background: #b8c7c3; }
.preview-folders b { width: 62%; height: 12px; margin-bottom: 32px; }
.preview-folders span { width: 72%; height: 9px; margin: 0 0 22px 8px; }
.preview-folders span:nth-of-type(2) { width: 52%; }
.preview-folders span:nth-of-type(3) { width: 64%; }
.preview-list b { width: 34%; height: 12px; margin-bottom: 25px; }
.preview-list span { width: 100%; height: 61px; margin-bottom: 2px; border-radius: 1px; background: #d3ddda; box-shadow: inset 3px 0 #a8bdb8; }
.preview-list span:first-of-type { background: #c7d6d2; box-shadow: inset 3px 0 var(--green-2); }
.preview-reader b { width: 54%; height: 18px; margin-bottom: 28px; }
.preview-reader i { width: 36px; height: 36px; margin-bottom: 29px; border-radius: 50%; background: #a7bdb7; }
.preview-reader span { width: 92%; height: 9px; margin-bottom: 17px; }
.preview-reader span:nth-of-type(2) { width: 78%; }
.preview-reader span:nth-of-type(3) { width: 86%; }
.login-panel {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 48px;
  background: linear-gradient(90deg, rgba(238,242,241,.58), rgba(238,242,241,.9));
  backdrop-filter: blur(3px);
}
.login-card {
  display: grid;
  width: min(410px, 100%);
  gap: 20px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 70px rgba(24,42,39,.18);
}
.login-card-brand { display: flex; align-items: center; gap: 10px; }
.login-card-brand > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 6px;
  background: var(--green-dark);
  color: white;
  font: 700 21px Georgia, serif;
}
.login-card-brand > div { display: grid; gap: 2px; }
.login-card-brand strong { color: var(--green-dark); font-size: 11px; letter-spacing: .14em; }
.login-card-brand small { color: var(--muted); font-size: 8px; letter-spacing: .18em; }
.login-card h1 { margin: 4px 0 0; font-size: 30px; font-weight: 650; letter-spacing: -.025em; }
.login-card > div:nth-child(2) > p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.login-security { display: flex; align-items: center; gap: 7px; padding: 10px; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 10px; }
.login-security .ui-icon { width: 15px; height: 15px; }

.alert { padding: 11px 13px; border-radius: 5px; font-size: 12px; line-height: 1.4; }
.alert.error { border: 1px solid #efc4bd; background: var(--danger-soft); color: #852b21; }
.alert.compact { margin: 0 12px 8px; }
.alert button { float: right; border: 0; background: transparent; color: inherit; font-weight: 750; text-decoration: underline; }

/* Outlook-inspired shell */
.app-shell {
  display: grid;
  width: 100vw;
  height: 100dvh;
  grid-template-rows: calc(48px + var(--app-safe-top)) minmax(0, 1fr);
  overflow: hidden;
  background: var(--canvas);
}
.topbar {
  z-index: 20;
  display: grid;
  height: calc(48px + var(--app-safe-top));
  grid-template-columns: 48px 165px minmax(260px, 620px) minmax(120px, 1fr);
  align-items: center;
  padding: var(--app-safe-top) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--green-dark);
  color: white;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.app-launcher { display: grid; height: 48px; place-items: center; background: rgba(255,255,255,.05); }
.app-launcher .ui-icon { width: 19px; height: 19px; }
.product-name { display: flex; align-items: center; gap: 10px; padding: 0 13px; }
.product-name strong { font-size: 15px; font-weight: 650; }
.product-mark, .owner-avatar {
  display: grid;
  place-items: center;
  border-radius: 5px;
  font-family: Georgia, serif;
  font-weight: 700;
}
.product-mark { width: 27px; height: 27px; background: #e7f1ee; color: var(--green-dark); font-size: 16px; }
.global-search {
  display: grid;
  width: min(100%, 620px);
  height: 34px;
  grid-template-columns: 34px minmax(0,1fr) auto;
  align-items: center;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(255,255,255,.94);
  color: #5c6764;
}
.global-search > span:first-child { display: grid; place-items: center; }
.global-search .ui-icon { width: 16px; height: 16px; }
.global-search input { width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-hint { margin-right: 9px; padding: 2px 6px; border: 1px solid #d9dfdd; border-radius: 4px; color: #87918f; font-size: 9px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 0 10px; }
.topbar-actions button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255,255,255,.8);
}
.topbar-actions button:hover { background: rgba(255,255,255,.1); color: white; }
.owner-avatar { width: 30px; height: 30px; margin-left: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: #276b61; color: white; font-size: 13px; }

.outlook-body { display: grid; min-width: 0; min-height: 0; grid-template-columns: 48px 220px minmax(0, 1fr); }
.app-rail {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 9px 4px;
  border-right: 1px solid var(--line);
  background: #edf1f0;
}
.rail-button {
  position: relative;
  display: grid;
  width: 40px;
  min-height: 42px;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #53605d;
}
.rail-button:hover, .rail-button.active { background: var(--surface); color: var(--green-2); }
.rail-button.active::before { position: absolute; inset: 7px auto 7px -4px; width: 3px; border-radius: 2px; background: var(--green-2); content: ""; }
.rail-button .ui-icon { width: 19px; height: 19px; }
.rail-button span { font-size: 8px; }
.app-rail .rail-button:last-child { margin-top: auto; }

.sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 12px 10px 10px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}
.compose-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  border: 1px solid #b9d4ce;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 750;
}
.compose-button:hover { border-color: #92beb5; background: #cee4df; }
.compose-button .ui-icon { width: 16px; height: 16px; }
.account-picker { display: grid; gap: 6px; margin: 0 5px 17px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.account-picker-control { position: relative; display: grid; min-width: 0; }
.account-picker-avatar { position: absolute; z-index: 1; top: 50%; left: 8px; display: grid; width: 22px; height: 22px; place-items: center; overflow: hidden; transform: translateY(-50%); border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 9px; letter-spacing: 0; pointer-events: none; }
.account-picker select { width: 100%; min-width: 0; padding: 8px 25px 8px 37px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: #34403d; font-size: 11px; text-transform: none; }
.folder-heading { display: flex; align-items: center; min-height: 30px; padding: 0 8px; color: #525e5b; font-size: 11px; font-weight: 700; }
.sidebar nav { display: grid; gap: 1px; }
.folder-button {
  display: grid;
  width: 100%;
  min-height: 37px;
  grid-template-columns: 24px minmax(0,1fr) auto;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #46514f;
  font-size: 12px;
  text-align: left;
}
.folder-button:hover:not(:disabled) { background: #e9efed; }
.folder-button.active { background: #dfeae7; color: var(--green-dark); font-weight: 700; }
.folder-icon { display: grid; place-items: center; color: #687572; }
.folder-icon .ui-icon { width: 16px; height: 16px; }
.folder-button.active .folder-icon { color: var(--green-2); }
.folder-button strong { min-width: 22px; padding: 2px 5px; border-radius: 9px; background: var(--green-2); color: white; font-size: 9px; text-align: center; }
.sidebar-footer { display: grid; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); }
.sidebar-footer .ui-icon { width: 16px; height: 16px; }

.mail-surface { display: grid; min-width: 0; min-height: 0; grid-template-rows: 47px minmax(0,1fr); }
.command-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  scrollbar-width: none;
}
.command-bar::-webkit-scrollbar { display: none; }
.command-bar button {
  display: inline-flex;
  min-height: 34px;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #4d5956;
  font-size: 11px;
  font-weight: 600;
}
.command-bar button:hover:not(:disabled) { background: var(--surface-hover); color: var(--green-dark); }
.command-bar .command-primary { background: var(--green-2); color: white; }
.command-bar .command-primary:hover:not(:disabled) { background: var(--green); color: white; }
.command-bar .ui-icon { width: 16px; height: 16px; }
.command-bar .danger-text { color: var(--danger); }
.command-separator { width: 1px; height: 23px; flex: none; margin: 0 5px; background: var(--line); }

.mail-workspace { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(300px, 380px) minmax(420px, 1fr); background: var(--surface); }
.message-list { display: flex; min-width: 0; min-height: 0; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.message-list.hidden { display: none; }
.list-header { display: flex; min-height: 66px; align-items: center; justify-content: space-between; padding: 12px 16px 8px; }
.list-header > div { min-width: 0; }
.list-header h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.list-header span { display: block; max-width: 250px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.list-header button, .mobile-back {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #53615e;
}
.list-header button:hover { background: var(--surface-hover); }
.list-header .ui-icon { width: 16px; height: 16px; }
.list-meta { display: flex; min-height: 34px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.list-meta span:last-child { color: var(--green-2); font-weight: 650; }
.message-rows { min-height: 0; overflow-y: auto; }
.message-row {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 92px;
  grid-template-columns: 34px minmax(0,1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 13px 13px 12px 12px;
  border: 0;
  border-bottom: 1px solid #e8eceb;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.message-row:hover { background: #f6f9f8; }
.message-row.selected { background: #e8f1ef; }
.message-row.selected::before, .message-row.unread::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--green-2); content: ""; }
.message-row.unread:not(.selected)::before { width: 2px; background: var(--blue); }
.message-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: #e1ebe8; color: var(--green); font-size: 12px; font-weight: 750; }
.message-row.unread .message-avatar { background: #d6e7f2; color: #225e88; }
.message-copy { display: grid; min-width: 0; gap: 4px; }
.message-line { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.message-line strong, .message-subject, .message-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-line strong { font-size: 12px; font-weight: 600; }
.message-line time { flex: none; color: var(--muted-2); font-size: 9px; }
.message-subject { color: #303b38; font-size: 11px; font-weight: 550; }
.message-preview { color: #76807e; font-size: 10px; }
.message-row.unread .message-line strong, .message-row.unread .message-subject { color: #16211f; font-weight: 750; }
.message-markers { display: flex; min-width: 16px; align-items: center; gap: 4px; color: #788380; }
.message-markers > .ui-icon, .paperclip .ui-icon { width: 13px; height: 13px; }
.pagination { display: flex; min-height: 43px; align-items: center; justify-content: space-between; margin-top: auto; padding: 0 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.pagination div { display: flex; gap: 3px; }
.pagination button { display: grid; width: 27px; height: 27px; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--green-2); }
.pagination button:hover:not(:disabled) { background: var(--surface-hover); }
.pagination .ui-icon { width: 14px; height: 14px; }

.reader { min-width: 0; min-height: 0; overflow-y: auto; background: var(--surface); }
.reader-header { display: none; }
.reader-content { width: min(850px, calc(100% - 64px)); margin: 0 auto; padding: 36px 0 80px; }
.reader-content > .eyebrow { color: var(--green-2); }
.reader-content h1 { margin: 0 0 25px; font-size: clamp(24px, 3vw, 34px); font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
.sender-line { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 11px; }
.avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 750; }
.account-avatar { overflow: hidden; }
.account-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.sender-line > div:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.sender-line strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sender-line span, .sender-line time { color: var(--muted); font-size: 10px; }
.recipient-details { margin: 11px 0 28px 51px; color: var(--muted); font-size: 10px; }
.recipient-details summary { cursor: pointer; }
.remote-images { width: 100%; margin-bottom: 18px; padding: 9px 12px; border: 1px solid #d8d4bb; border-radius: 4px; background: #fff9e9; color: #6f5c2e; font-size: 10px; text-align: left; }
.message-body { display: block; width: 100%; min-height: 260px; border: 0; background: white; }
.attachments { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.attachments h3 { margin: 0 0 12px; font-size: 11px; }
.attachments > div { display: flex; flex-wrap: wrap; gap: 8px; }
.attachments a { display: flex; min-width: 200px; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); text-decoration: none; }
.attachments a:hover { background: var(--surface-hover); }
.attachment-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 4px; background: var(--green-soft); color: var(--green); }
.attachments a > span:last-child { display: grid; gap: 2px; }
.attachments strong { max-width: 220px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachments small { color: var(--muted); font-size: 9px; }
.empty-reader, .empty-state { display: grid; place-content: center; justify-items: center; color: var(--muted-2); text-align: center; }
.empty-reader { min-height: 100%; padding: 40px; }
.empty-reader h2, .empty-state h3 { margin: 14px 0 4px; color: #4d5956; font-size: 18px; font-weight: 600; }
.empty-reader p, .empty-state p { max-width: 270px; margin: 0; font-size: 11px; line-height: 1.5; }
.reader-mark, .empty-glyph { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green-2); }
.reader-mark .ui-icon { width: 25px; height: 25px; }
.empty-state { min-height: 300px; padding: 30px; }

/* Floating compose window */
.modal-backdrop {
  position: fixed;
  z-index: 40;
  inset: 48px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 24px 22px;
  pointer-events: none;
}
.compose-sheet {
  display: grid;
  width: min(720px, calc(100vw - 80px));
  height: min(690px, calc(100vh - 90px));
  grid-template-rows: 43px minmax(0,1fr);
  overflow: hidden;
  border: 1px solid #bfc9c6;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.compose-sheet > header { display: flex; align-items: center; justify-content: space-between; padding: 0 13px; background: var(--green-dark); color: white; }
.compose-sheet h2 { margin: 0; font-size: 12px; font-weight: 650; }
.compose-sheet header button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 3px; background: transparent; color: rgba(255,255,255,.85); font-size: 20px; }
.compose-sheet header button:hover { background: rgba(255,255,255,.12); }
#compose-form { display: grid; min-height: 0; grid-template-rows: auto auto auto auto minmax(150px,1fr) auto auto auto; overflow-y: auto; padding: 0 16px; }
.compose-row { display: grid; min-height: 43px; grid-template-columns: 62px minmax(0,1fr); align-items: center; border-bottom: 1px solid var(--line); }
.compose-row label { color: var(--muted); font-size: 10px; font-weight: 650; }
.compose-row input, .compose-row select { height: 34px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 11px; }
.copy-fields { border-bottom: 1px solid var(--line); }
.copy-fields summary { padding: 8px 0; color: var(--green-2); font-size: 9px; cursor: pointer; }
.copy-fields .compose-row:last-child { border-bottom: 0; }
.body-label { min-height: 0; padding-top: 12px; }
.body-label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.body-label textarea { min-height: 180px; resize: none; padding: 10px 0; border: 0; outline: 0; line-height: 1.55; }
.compose-options { display: flex; min-height: 38px; align-items: center; gap: 11px; border-top: 1px solid var(--line); color: var(--muted); }
.file-picker { position: relative; display: inline-flex; align-items: center; gap: 5px; color: var(--green-2); font-size: 10px; font-weight: 700; cursor: pointer; }
.file-picker .ui-icon { width: 14px; height: 14px; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#file-summary { font-size: 9px; }
.signature-toggle { display: flex; min-height: 32px; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
#compose-form footer { display: flex; min-height: 52px; align-items: center; gap: 8px; margin: 0 -16px; padding: 8px 16px; border-top: 1px solid var(--line); background: #fafbfb; }
#compose-form footer button { display: inline-flex; min-width: 88px; height: 34px; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 4px; font-size: 10px; font-weight: 700; }
#compose-form footer .send-button { color: white; }
#compose-form footer .send-button .ui-icon { width: 14px; height: 14px; }
#compose-form footer #save-draft { background: transparent; color: #4f5b58; }
#compose-form footer #save-draft:hover { background: var(--surface-hover); }

.settings-page { min-width: 0; min-height: 0; grid-column: 1 / -1; overflow-y: auto; padding: 38px clamp(24px, 6vw, 74px) 70px; background: var(--canvas); }
.settings-page > header h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.03em; }
.settings-page > header > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(250px,1fr)); gap: 14px; margin-top: 28px; }
.settings-card { padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.settings-title { display: flex; align-items: center; gap: 11px; }
.settings-title h2 { margin: 0 0 3px; font-size: 14px; }
.settings-title p { margin: 0; color: var(--muted); font-size: 10px; }
.signature-settings-card { min-width: 0; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; padding: 12px 0; border-block: 1px solid var(--line); }
.status-row span { color: #586461; font-size: 9px; }
.status-row i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #2f9a76; }
.status-row button { border: 0; background: transparent; color: var(--green-2); font-size: 9px; font-weight: 800; }
.notification-icon { display: grid; width: 40px; height: 40px; flex: none; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.notification-icon .ui-icon { width: 19px; height: 19px; }
.notification-status { margin-bottom: 10px; }
.notification-status i { background: #9aa4a1; }
.notification-status i.enabled { background: #2f9a76; box-shadow: 0 0 0 3px rgba(47,154,118,.12); }
.notification-status .notification-toggle { min-width: 72px; height: 30px; padding: 0 11px; border: 1px solid var(--green-2); border-radius: 999px; background: transparent; color: var(--green-2); }
.notification-status .notification-toggle:not(:disabled):hover { background: var(--green-soft); }
.notification-help { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.notification-card .alert { margin-top: 12px; }
.signature-editor { display: grid; gap: 15px; }
.signature-text-field { display: grid; gap: 7px; }
.signature-text-field > span, .signature-alt-field > span { color: #42504d; font-size: 10px; font-weight: 750; }
.signature-text-field textarea { width: 100%; min-height: 112px; resize: vertical; padding: 10px 11px; border: 1px solid #cbd3d1; border-radius: 5px; outline: 0; background: #fbfcfc; color: var(--text); font: inherit; font-size: 11px; line-height: 1.5; }
.signature-text-field textarea:focus, .signature-alt-field input:focus { border-color: var(--green-2); box-shadow: 0 0 0 2px rgba(18,104,94,.11); }
.signature-text-field > small { color: var(--muted); font-size: 8px; line-height: 1.45; }
.signature-image-controls { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 12px; align-items: start; }
.signature-image-preview { display: grid; width: 92px; height: 76px; place-items: center; overflow: hidden; border: 1px dashed #bdc9c6; border-radius: 6px; background: #f4f7f6; }
.signature-image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.signature-image-preview > span { display: grid; place-items: center; gap: 4px; color: #84908d; }
.signature-image-preview .ui-icon { width: 19px; height: 19px; }
.signature-image-preview small { font-size: 8px; }
.signature-image-fields { display: grid; min-width: 0; gap: 7px; }
.signature-image-picker { position: relative; display: inline-flex; width: max-content; align-items: center; gap: 5px; color: var(--green-2); font-size: 9px; font-weight: 800; cursor: pointer; }
.signature-image-picker .ui-icon { width: 14px; height: 14px; }
.signature-image-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.signature-image-fields > small { overflow: hidden; color: var(--muted-2); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.signature-alt-field { display: grid; gap: 4px; }
.signature-alt-field input { width: 100%; height: 31px; padding: 0 8px; border: 1px solid #d1d8d6; border-radius: 4px; outline: 0; font-size: 9px; }
.remove-signature-image { width: max-content; padding: 0; border: 0; background: transparent; color: var(--danger); font-size: 8px; font-weight: 750; }
.signature-preview { padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfb; color: #4f5a57; font-size: 10px; line-height: 1.5; }
.signature-preview small { display: block; margin-bottom: 8px; color: var(--muted-2); font-size: 8px; text-transform: uppercase; }
.signature-preview a { color: var(--green-2); }
.signature-preview-content { display: grid; justify-items: start; gap: 9px; overflow-wrap: anywhere; }
.signature-preview-content > img { width: auto; max-width: 180px; max-height: 92px; object-fit: contain; }
.signature-empty { color: var(--muted-2); font-style: italic; }
.signature-actions { display: flex; min-height: 34px; align-items: center; gap: 10px; }
.signature-actions button { height: 32px; padding: 0 13px; border: 0; border-radius: 4px; font-size: 9px; font-weight: 800; }
.signature-actions span { color: var(--danger); font-size: 8px; line-height: 1.35; }
.security-panel { display: flex; align-items: flex-start; gap: 11px; margin-top: 14px; padding: 16px; border: 1px solid #bfd7d1; border-radius: 6px; background: #e8f2ef; }
.security-panel > .ui-icon { width: 20px; height: 20px; color: var(--green-2); }
.security-panel strong { font-size: 11px; }
.security-panel p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }

.toast { position: fixed; z-index: 60; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 15px; border-radius: 5px; background: var(--green-dark); color: white; box-shadow: var(--shadow); font-size: 11px; }
.toast.error { background: #8d3027; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 48px 135px minmax(240px, 500px) 1fr; }
  .outlook-body { grid-template-columns: 46px 190px minmax(0,1fr); }
  .mail-workspace { grid-template-columns: minmax(285px, 340px) minmax(360px,1fr); }
  .reader-content { width: calc(100% - 42px); }
  .command-bar button { padding-inline: 7px; }
}

@media (max-width: 880px) {
  .login-page { grid-template-columns: 1fr; overflow-y: auto; }
  .login-brand { min-height: 38vh; padding: 38px 30px; }
  .login-brand .brand-mark { width: 50px; height: 50px; margin-bottom: 28px; font-size: 25px; }
  .login-brand h1 { font-size: clamp(36px, 9vw, 56px); }
  .login-intro { margin-top: 18px; font-size: 14px; }
  .secure-note { margin-top: 25px; }
  .login-panel { padding: 42px 20px; }
  .outlook-body { grid-template-columns: 46px minmax(0,1fr); }
  .sidebar { display: none; }
  .mail-workspace { grid-template-columns: minmax(285px, 330px) minmax(340px,1fr); }
  .topbar { grid-template-columns: 48px 110px minmax(210px, 1fr) auto; }
  .topbar-actions button:first-child { display: none; }
  .command-bar button span { display: none; }
  .command-bar button { width: 34px; justify-content: center; padding: 0; }
  .command-bar .command-primary { width: auto; padding: 0 9px; }
  .command-bar .command-primary span { display: inline; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  body { overflow: hidden; }
  .login-page { grid-template-rows: calc(48px + var(--app-safe-top)) minmax(0,1fr); }
  .login-preview { grid-template-columns: 44px 150px 1fr; opacity: .27; }
  .preview-reader { display: none; }
  .login-panel { padding: 22px 14px; }
  .login-card { gap: 18px; padding: 26px 22px; }
  .login-secure { font-size: 0; }
  .login-secure .ui-icon { display: block; }
  .app-shell { grid-template-rows: calc(48px + var(--app-safe-top)) minmax(0,1fr); }
  .topbar { grid-template-columns: 44px minmax(0,1fr) auto; }
  .product-name { display: none; }
  .global-search { height: 34px; }
  .search-hint, .topbar-actions button { display: none; }
  .topbar-actions { padding-inline: 8px; }
  .owner-avatar { width: 29px; height: 29px; }
  .outlook-body { display: block; min-height: 0; }
  .app-rail {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(2,1fr);
    padding: 4px max(8px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: #edf1f0;
  }
  .rail-button { width: 100%; min-height: 47px; grid-template-columns: 1fr; }
  .rail-button.active::before { inset: auto 25% -4px; width: 50%; height: 3px; }
  .app-rail .rail-button:last-child { margin: 0; }
  .mail-surface { height: calc(100dvh - 106px - var(--app-safe-top) - env(safe-area-inset-bottom, 0px)); grid-template-rows: 48px minmax(0,1fr); }
  .command-bar { padding-inline: 8px; }
  .command-bar > *:not(.command-primary) { display: none; }
  .command-bar .command-primary { width: auto; min-width: 104px; padding-inline: 12px; }
  .mail-workspace { display: block; }
  .message-list { width: 100%; height: 100%; border-right: 0; }
  .reader { display: none; height: 100%; }
  .app-shell.show-reader .message-list { display: none; }
  .app-shell.show-reader .reader { display: block; }
  .reader-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.96);
  }
  .reader-actions { display: flex; min-width: 0; align-items: center; gap: 1px; }
  .reader-actions button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 4px; background: transparent; color: #50605c; }
  .reader-actions button span { display: none; }
  .reader-actions .danger-text { color: var(--danger); }
  .reader-actions .ui-icon { width: 16px; height: 16px; }
  .mobile-back { display: grid; }
  .reader-content { width: calc(100% - 28px); padding: 27px 0 60px; }
  .reader-content h1 { margin-bottom: 20px; font-size: 24px; }
  .sender-line { grid-template-columns: 36px minmax(0,1fr); }
  .sender-line .avatar { width: 36px; height: 36px; }
  .sender-line time { grid-column: 2; }
  .recipient-details { margin-left: 47px; }
  .settings-page { height: 100%; padding: 27px 15px 55px; }
  .settings-page > header h1 { font-size: 26px; }
  .notification-card { grid-column: 1 / -1; }
  .signature-image-controls { grid-template-columns: 78px minmax(0,1fr); }
  .signature-image-preview { width: 78px; height: 70px; }
  .modal-backdrop { inset: 0; padding: 0; }
  .compose-sheet {
    width: 100%;
    height: 100dvh;
    grid-template-rows: calc(43px + var(--app-safe-top)) minmax(0,1fr);
    border: 0;
    border-radius: 0;
  }
  .compose-sheet > header {
    padding: var(--app-safe-top) max(13px, env(safe-area-inset-right, 0px)) 0 max(13px, env(safe-area-inset-left, 0px));
  }
  #compose-form { padding-inline: 13px; }
  #compose-form footer {
    position: sticky;
    bottom: 0;
    min-height: calc(52px + env(safe-area-inset-bottom, 0px));
    margin-inline: -13px;
    padding: 8px max(13px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(13px, env(safe-area-inset-left, 0px));
  }
  .compose-row { grid-template-columns: 52px minmax(0,1fr); }
  .toast { right: 12px; bottom: 70px; left: 12px; max-width: none; }
}

@media (max-width: 650px) and (display-mode: standalone) {
  :root {
    --app-safe-top: max(28px, calc(env(safe-area-inset-top, 0px) + 8px));
  }
}

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