/* Shell, components and screens. Values come from tokens.css only;
 * anything chosen rather than measured is marked DERIVED in the code. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.scroller, .sheet, .compose-body { scrollbar-width: none; }
.scroller::-webkit-scrollbar, .sheet::-webkit-scrollbar, .compose-body::-webkit-scrollbar { display: none; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  font: var(--fw-regular) var(--fs-body) / var(--lh-body) var(--font);
  letter-spacing: var(--tracking-tight);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* never let a grid track grow past the viewport */
  grid-template-rows: minmax(0, 1fr) auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
}

#view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  min-height: 0;
  position: relative;
  background: var(--surface);
}
#view[data-route="conversation"] { grid-template-rows: auto minmax(0, 1fr) auto; }
#view[data-route="compose"] { grid-template-rows: auto minmax(0, 1fr); }
#view.pushed { animation: push-in var(--dur-base) var(--ease-ios) both; }

@keyframes push-in {
  from { transform: translateX(12%); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--bar-height);
  padding: var(--sp-2) var(--row-gutter) var(--sp-2) var(--sp-4);
  border-bottom: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
}
.bar-titles { min-width: 0; flex: 1; padding-right: var(--sp-2); }
.bar h1 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  line-height: 22px;
  white-space: nowrap;            /* house rule: text never wraps */
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-sub {
  margin: 0;
  font-size: var(--fs-metadata);
  color: var(--text-subtle);
  white-space: nowrap;
}
.bar-actions { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }

.icon-btn {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-round);
  background: transparent;
  color: var(--brand);
  font-size: var(--fs-title);
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-sunken); }
.icon-btn[disabled] { opacity: .45; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--r-round);
  background: var(--brand);
  color: var(--text-on-brand);
  font-size: var(--fs-metadata);
  font-weight: var(--fw-semibold);
  display: grid;
  place-items: center;
}
.avatar.xl { width: 72px; height: 72px; font-size: var(--fs-title-lg); }
.avatar-btn { min-width: 44px; }

/* ---------- scrollers ---------- */

.scroller {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  background: var(--surface);
}
#view[data-route="conversation"] .scroller,
#view[data-route="compose"] .scroller { display: block; }

.pull {
  height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-subtle);
  font-size: var(--fs-metadata);
}

/* ---------- rows ---------- */

.rows { background: var(--surface); padding-bottom: 72px; min-width: 0; }


.row {
  position: relative;
  touch-action: pan-y;
  content-visibility: auto;
  contain-intrinsic-size: 88px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: var(--sp-4);
  align-items: start;
  height: var(--row-height);
  padding: var(--sp-5) var(--row-inset) var(--sp-5) var(--row-gutter);
  border-bottom: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
}
.row:active { background: var(--surface-sunken); }

.face {
  display: grid;
  place-items: center;
  border-radius: var(--r-round);
  color: #fff;
  font-weight: var(--fw-semibold);
  flex: none;
}
.row .face {
  width: 40px;
  height: 40px;
  border-radius: var(--r-round);
  display: grid;
  place-items: center;
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  color: #fff;
  background: var(--hairline-strong);
  flex: none;
}

.row .text { min-width: 0; overflow: hidden; }
.row.has-event { height: auto; min-height: var(--row-height); }
.row .line1 { display: flex; gap: var(--sp-2); align-items: baseline; }
.row .sender {
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row.unread .sender { font-weight: var(--fw-bold); }
.row .stamp {
  margin-left: auto;
  color: var(--text-muted);     /* was #8a8886 (3.53:1); now 6.19:1 */
  font-size: var(--fs-metadata);
  white-space: nowrap;
  flex: none;
}
.row .flag { color: var(--brand); display: inline-flex; flex: none; }
.row .subject {
  font-size: var(--fs-body);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .preview {
  color: var(--text-muted);
  font-size: var(--fs-metadata);
  line-height: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row.unread .unread-dot {
  position: absolute;
  left: 3px;
  top: calc(var(--sp-5) + 8px);
  width: 7px;
  height: 7px;
  border-radius: var(--r-round);
  background: var(--brand);
}
.row .clip { align-self: center; color: var(--text-subtle); display: inline-flex; }

.row .actions {
  position: absolute;
  inset: 0 0 0 auto;
  display: flex;
  width: 160px;
  transform: translateX(100%);
  background: var(--swipe-archive);
}
.row .actions button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--swipe-archive-ink);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
}
.row .actions .del { background: var(--danger); }

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--text-on-brand);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  display: grid;
  place-items: center;
  align-self: center;
}
.chev { align-self: center; color: var(--text-subtle); font-size: var(--fs-title); padding-left: var(--sp-2); }

/* ---------- segmented control ---------- */

.seg {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--row-inset);
  border-bottom: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
}
.seg button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--fs-metadata);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.seg button[aria-selected="true"] { background: var(--brand); color: var(--text-on-brand); }

/* ---------- fab ---------- */

.fab {
  position: absolute;
  right: var(--row-inset);
  bottom: calc(var(--tab-height) + var(--sp-5));
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: var(--r-round);
  background: var(--brand);
  color: var(--text-on-brand);
  font-size: var(--fs-title);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
}
.fab:active { background: var(--brand-pressed); }

/* ---------- conversation ---------- */

.conv-head {
  display: flex;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-6) var(--row-inset) var(--sp-4);
}
.conv-who { min-width: 0; flex: 1; }
.conv-name { margin: 0; font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); }
.conv-addr { margin: 0; font-size: var(--fs-metadata); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-tools { display: flex; }
.conv-subject {
  margin: 0;
  padding: 0 var(--row-inset) var(--sp-5);
  font-size: var(--fs-title-lg);
  font-weight: var(--fw-bold);
  line-height: 24px;
}

.message {
  margin: var(--sp-5) var(--row-inset);
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  font-size: var(--fs-body-lg);
  max-width: 84%;
}
.message.mine { margin-left: auto; background: #deecf9; }
.message .meta {
  margin-bottom: var(--sp-2);
  color: #5b5a58;                       /* DERIVED: contrast on the grey bubble */
  font-size: var(--fs-metadata);
}
.message .body { white-space: pre-wrap; }
.message .attach {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-metadata);
  width: 100%;
  text-align: left;
}
.message .attach-size { margin-left: auto; color: var(--text-subtle); }

.reply-bar {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  margin: var(--sp-6) var(--row-inset) var(--sp-8);
}
.reply-send {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: var(--r-round);
  background: var(--brand);
  color: var(--text-on-brand);
  font-size: var(--fs-title);
}
.reply-hint {
  flex: 1;
  padding: var(--sp-5) var(--sp-7);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--text-subtle);
  font-size: var(--fs-body-lg);
}

/* ---------- compose ---------- */

.compose { padding: var(--sp-4) var(--row-inset) var(--sp-8); overflow-y: auto; }
.field {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  border-bottom: var(--hairline-w) solid var(--hairline);
  padding: var(--sp-4) 0;
}
.field-label { color: var(--text-subtle); font-size: var(--fs-metadata); width: 48px; flex: none; }
.field-input, .field-body {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: var(--fs-body-lg);
  color: var(--text);
}
.field-body { width: 100%; margin-top: var(--sp-5); resize: none; line-height: 22px; }
.from-field { border-bottom: 0; }
.field-static { color: var(--text-muted); font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs[hidden] { display: none; }
.compose-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-7);
  flex-wrap: wrap;
}
.compose-from { margin-left: auto; color: var(--text-subtle); font-size: var(--fs-caption); }
.send {
  height: 34px;
  padding: 0 var(--sp-7);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--text-on-brand);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}
.send:active { background: var(--brand-pressed); }
.chip {
  height: 32px;
  padding: 0 var(--sp-6);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-metadata);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.chip:active { background: var(--surface-sunken); }

/* ---------- search ---------- */

.search-wrap { padding: var(--sp-4) var(--row-inset); border-bottom: var(--hairline-w) solid var(--hairline); }
.search {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 40px;
  padding: 0 var(--sp-6);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}
.search-glyph { color: var(--text-subtle); }
.search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-body-lg);
  color: var(--text);
  outline: none;
}
.recent { padding: var(--sp-6) var(--row-inset); }
.recent-title { margin: 0 0 var(--sp-4); color: var(--text-subtle); font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .04em; }
.recent .chip { margin: 0 var(--sp-3) var(--sp-3) 0; }

/* ---------- calendar ---------- */

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--hairline-w) solid var(--hairline);
}
.week-day {
  display: grid;
  place-items: center;
  gap: 2px;
  height: 46px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--fs-caption);
}
.week-day.today { background: var(--brand); color: var(--text-on-brand); }
.week-name { text-transform: uppercase; letter-spacing: .04em; }
.week-num { font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); }

.agenda { padding: var(--sp-5) var(--row-inset) var(--sp-8); display: grid; gap: var(--sp-5); }
.event {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: var(--sp-5);
  padding: var(--sp-5);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
}
.event-time { display: grid; gap: 2px; font-size: var(--fs-metadata); font-weight: var(--fw-semibold); }
.event-time span { color: var(--text-subtle); font-weight: var(--fw-regular); }
.event-main { min-width: 0; }
.event h3 { margin: 0; font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-place { margin: 2px 0 var(--sp-4); color: var(--text-muted); font-size: var(--fs-metadata); }
.event-people { display: flex; gap: var(--sp-2); }
.event-people .face { width: 24px; height: 24px; font-size: 10px; }

/* ---------- files ---------- */

.files { padding: var(--sp-4) var(--row-inset) var(--sp-8); display: grid; gap: var(--sp-4); }
.file {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
}
.file-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}
.file-main { min-width: 0; }
.file h3 { margin: 0; font-size: var(--fs-body); font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file p { margin: 2px 0 0; color: var(--text-muted); font-size: var(--fs-metadata); }

/* ---------- people / contact ---------- */

.person-row { height: 64px; align-items: center; }
.person-row .text { align-self: center; }

.contact-head {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--row-inset) var(--sp-6);
  text-align: center;
}
.contact-head .face { width: 72px; height: 72px; font-size: var(--fs-title-lg); }
.contact-actions { display: flex; justify-content: center; gap: var(--sp-4); padding-bottom: var(--sp-6); }
.fields { margin: 0; padding: 0 var(--row-inset); }
.field-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: var(--sp-4);
  padding: var(--sp-5) 0;
  border-bottom: var(--hairline-w) solid var(--hairline);
}
.field-row dt { color: var(--text-subtle); font-size: var(--fs-metadata); }
.field-row dd { margin: 0; font-size: var(--fs-body); overflow-wrap: anywhere; }
.note { color: var(--text-subtle); font-size: var(--fs-caption); padding: 0 var(--row-inset); }
.note.pad { padding: var(--sp-6) var(--row-inset) var(--sp-8); }

/* ---------- mailboxes / settings / account ---------- */

.box-row { height: 56px; align-items: center; grid-template-columns: 28px minmax(0, 1fr) auto auto; }
.box-row .text { align-self: center; }
.box-icon { color: var(--brand); text-align: center; font-size: var(--fs-body-lg); }

.account-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: var(--sp-5);
  align-items: center;
  width: 100%;
  padding: var(--sp-5) var(--row-inset);
  border: 0;
  border-bottom: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
  text-align: left;
}
.account-card .avatar { width: 40px; height: 40px; font-size: var(--fs-body); }
.account-name { margin: var(--sp-3) 0 0; font-size: var(--fs-title); font-weight: var(--fw-bold); }

.setting-group { padding: var(--sp-5) var(--row-inset) var(--sp-2); }
.setting-group h2 {
  margin: 0 0 var(--sp-3);
  color: var(--text-subtle);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) 0;
  border-bottom: var(--hairline-w) solid var(--hairline);
  font-size: var(--fs-body);
}
.setting-value { color: var(--text-subtle); font-size: var(--fs-metadata); text-align: right; }

/* ---------- empty ---------- */

.empty { padding: var(--sp-8) var(--row-inset); text-align: center; color: var(--text-muted); }
.empty-title { margin: 0 0 var(--sp-3); font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); color: var(--text); }
.empty p { margin: 0; font-size: var(--fs-metadata); }

/* ---------- overlay: sheet + toast ---------- */

#overlay { position: fixed; inset: 0; pointer-events: none; }
.sheet-wrap { position: fixed; inset: 0; display: grid; align-items: end; pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity var(--dur-fast) ease; }
.sheet-wrap.in .scrim { opacity: 1; }
.sheet {
  position: relative;
  transform: translateY(100%);
  transition: transform var(--dur-base) var(--ease-ios);
  background: var(--surface);
  border-radius: var(--r-md) var(--r-md) 0 0;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-8) + env(safe-area-inset-bottom));
  max-height: 72vh;
  overflow-y: auto;
}
.sheet-wrap.in .sheet { transform: translateY(0); }
.grabber { width: 36px; height: 4px; margin: 0 auto var(--sp-5); border-radius: var(--r-pill); background: var(--hairline); }
.sheet-title { margin: 0 0 var(--sp-4); padding: 0 var(--sp-4); font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); }
.sheet-item {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
  font-size: var(--fs-body-lg);
}
.sheet-item:active { background: var(--surface-sunken); }
.sheet-item.danger { color: var(--danger); }
.sheet-icon { width: 24px; color: var(--text-subtle); text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-height) + var(--sp-8));
  transform: translate(-50%, 12px);
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--r-pill);
  background: rgba(28, 28, 28, .92);
  color: #fff;
  font-size: var(--fs-metadata);
  opacity: 0;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-ios);
  pointer-events: none;
  white-space: nowrap;
}
.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tab bar ---------- */

.tabs {
  display: flex;
  border-top: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
}
.tabs button {
  flex: 1;
  height: var(--tab-height);
  border: 0;
  background: transparent;
  color: var(--text-muted);      /* 7.5:1 on white; #8a8886 gave only 3.5:1 */
  font-size: 10px;
  font-weight: var(--fw-semibold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-top: var(--sp-1);
}
.tabs button span { line-height: 1; }
.tabs button[aria-current="true"] { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  #view.pushed { animation: none; }
  .sheet, .sheet-wrap.in .sheet, .toast { transition: none; }
}

/* ============================================================
   Outlook chrome, matched to the published app screenshots
   (reference/shot01, shot06, shot08). Appended so it wins.
   ============================================================ */

.bar-blue {
  min-width: 0;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
}
.bar-blue .row1 {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: 40px;
}
.bar-blue h1 {
  color: var(--header-text);
  font-size: 22px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
}
.bar-blue .bar-sub { color: var(--header-sub); }
.bar-blue .icon-btn { color: var(--header-text); }
.bar-blue .avatar {
  background: rgba(255, 255, 255, .24);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .5);
}
.bar-blue .row2 {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Focused / Other pill inside the header */
.seg-inline {
  display: flex;
  flex: 1;
  padding: 3px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--seg-track);
  gap: 2px;
}
.seg-inline button {
  flex: 1;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  padding: 0 var(--sp-5);
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  background: transparent;
  color: var(--header-text);
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.seg-inline button[aria-selected="true"] {
  background: var(--seg-active);
  color: var(--seg-active-text);
  border-radius: var(--r-pill);
}
.seg-inline button:not([aria-selected="true"]) { border-radius: var(--r-pill); }

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  height: 34px;
  padding: 0 var(--sp-6);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--pill-track);
  color: var(--header-text);
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

/* date dividers + Other Emails summary row */
.section-head {
  padding: var(--sp-4) var(--row-inset) var(--sp-2);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-metadata);
  font-weight: var(--fw-semibold);
  letter-spacing: .01em;
}
.other-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: var(--sp-4);
  align-items: center;
  width: 100%;
  text-align: left;
  padding: var(--sp-3) var(--row-inset) var(--sp-3) var(--row-gutter);
  border-bottom: var(--hairline-w) solid var(--hairline);
  background: var(--surface);
}
.other-row .env {
  width: 34px; height: 34px;
  font-size: 18px;
  display: grid; place-items: center;
  color: var(--text-subtle);
}
.other-row .title { font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); }
.other-row .preview { font-size: var(--fs-metadata); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-row .count {
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill);
  background: #e6f2fb; color: var(--brand);
  font-size: var(--fs-metadata); font-weight: var(--fw-bold);
  display: grid; place-items: center;
}

/* inline meeting card inside a row (reference: shot01) */
.event-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  font-size: var(--fs-metadata);
}
.event-card .cal { color: var(--accent-purple, #7719aa); }
.event-card .rsvp {
  margin-left: auto;
  padding: 0 var(--sp-5);
  min-height: 32px;
  min-width: 56px;
  border: 0;
  border-radius: var(--r-pill);
  background: #e6f2fb;
  color: var(--brand);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}

/* two floating buttons, bottom right (reference: shot01/08) */
.fabs {
  position: absolute;
  right: var(--sp-5);
  bottom: calc(var(--tab-height) + var(--sp-3));
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.fab2 {
  width: 48px; height: 48px;
  border: 0; border-radius: var(--r-round);
  background: var(--surface);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.fab2.primary { background: var(--brand); color: #fff; }

/* three-tab bar: Mail, Calendar (with date), Apps */
.tabs { border-top: var(--hairline-w) solid var(--hairline); }
.tabs button { position: relative; }
.tabs .tab-date {
  position: absolute;
  top: 4px;
  font-size: 9px;
  font-weight: var(--fw-bold);
  line-height: 1;
}

/* flat thread, not chat bubbles (reference: shot03) */
.thread { padding: 0 0 var(--sp-8); }
.thread-item { border-bottom: var(--hairline-w) solid var(--hairline); padding: var(--sp-6) var(--row-inset) var(--sp-5); }
.thread-item .who { display: flex; align-items: center; gap: var(--sp-4); }
.thread-item .who .face { width: 36px; height: 36px; font-size: var(--fs-body); }
.thread-item .who .name { font-size: var(--fs-body-lg); font-weight: var(--fw-bold); }
.thread-item .who .at { margin-left: auto; color: var(--text-subtle); font-size: var(--fs-metadata); }
.thread-item .to-line { margin: var(--sp-2) 0 0 46px; color: var(--text-subtle); font-size: var(--fs-metadata); }
.thread-item .body { margin: var(--sp-4) 0 0 46px; white-space: pre-wrap; font-size: var(--fs-body-lg); line-height: 22px; }
.thread-subject {
  margin: 0;
  padding: var(--sp-5) var(--row-inset) var(--sp-4);
  font-size: var(--fs-title-lg);
  font-weight: var(--fw-bold);
  border-bottom: var(--hairline-w) solid var(--hairline);
}

/* compose, reference shot05 */
.compose-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--row-inset); border-bottom: var(--hairline-w) solid var(--hairline); }
.compose-head .from { min-width: 0; }
.compose-head .from .name { font-size: var(--fs-body-lg); font-weight: var(--fw-bold); }
.compose-head .from .addr { font-size: var(--fs-metadata); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-to {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 4px var(--sp-5);
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  font-size: var(--fs-body);
}

/* calendar day view, reference shot08 */
.cal-head { background: var(--header-bg); color: #fff; padding: var(--sp-2) var(--sp-5) var(--sp-3); min-width: 0; }
.cal-head .row1 { min-width: 0; }
.cal-head .row1 { display: flex; align-items: center; gap: var(--sp-4); }
.cal-head h1 { color: #fff; font-size: 22px; font-weight: var(--fw-bold); }
.cal-head .icon-btn { color: #fff; }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--header-bg); padding: 0 var(--sp-4) var(--sp-5); }
.weekstrip .d { display: grid; justify-items: center; gap: 3px; color: rgba(255,255,255,.85); font-size: 10px; }
.weekstrip .d .n {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r-round); font-size: var(--fs-body); color: #fff;
}
.weekstrip .d.today .n { background: #fff; color: var(--brand); font-weight: var(--fw-bold); }
.daygrid { padding: var(--sp-4) 0 var(--sp-8); }
.hour { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--sp-3); min-height: 46px; padding: 0 var(--sp-4); }
.hour .t { color: var(--text-subtle); font-size: var(--fs-caption); padding-top: 2px; }
.hour .slot { border-top: var(--hairline-w) solid var(--hairline); }
.evblock {
  display: block;
  width: 100%;
  margin: 2px 0;
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  border-left: 3px solid var(--bar-purple);
  border-radius: var(--r-sm);
  background: var(--tint-purple);
  text-align: left;
  font-size: var(--fs-metadata);
  line-height: 17px;
}
.evblock.title { font-weight: var(--fw-semibold); }
.evblock.peach { background: var(--tint-peach); border-left-color: var(--bar-peach); }
.evblock.green { background: var(--tint-green); border-left-color: var(--bar-green); }
.evblock .place { color: var(--text-muted); font-size: var(--fs-caption); }
.nowline { position: relative; height: 0; border-top: 1.5px solid #d13438; }
.nowline::before { content: ''; position: absolute; left: 42px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #d13438; }

/* apps hub */
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); padding: var(--sp-7) var(--row-inset); }
.app-tile {
  display: grid; justify-items: center; gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-metadata);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.app-tile .glyph { font-size: 24px; color: var(--brand); }
