/* z•mail web — colors and type match the iOS iPad landscape UI (Theme.swift).
   System font stack only; Avenir Next is not bundled. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-raised: #e6e8ee;
  --hairline: #d8dce3;
  --text: #0b0c0e;
  --text-2: #5c6470;
  --brand: #4a90e2;
  --brand-muted: rgba(74, 144, 226, 0.14);
  --dot: #c4453a;
  --danger: #e11d48;
  --warning: #d97706;
  --success: #16a34a;
  --indigo: #4f46e5;
  --security: #dc2626;
  --pdf: #a0675f;
  --image: #7a6e9c;
  --sheet: #5f8566;
  --document: #5a7a9c;
  --other: #74787f;
  --header-h: 52px;
  --footer-h: 56px;
  --list-w: 560px;
  --radius: 14px;
  --radius-sm: 12px;
  --motion: 0.18s;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* On-device Avenir Next if present (same names as the native About); never bundled. */
  --znorx-type: "AvenirNext-Regular", "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --zmail-text-scale: 1;
  /* Code colors: VS Code Light+ (same as the app's CodeSyntax.lightPlus) */
  --zs-fg: #000000; --zs-line-number: #237893; --zs-keyword: #0000FF; --zs-control: #AF00DB; --zs-type: #267F99;
  --zs-string: #A31515; --zs-comment: #008000; --zs-number: #098658; --zs-preprocessor: #AF00DB; --zs-property: #001080;
  --zs-constant: #0000FF; --zs-decorator: #795E26; --zs-function: #795E26;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* Appearance (Crèche 104): System follows the OS; Light/Dark set html[data-theme] (the app's default is Dark). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0e;
    --surface: #14161a;
    --surface-raised: #1c1f26;
    --hairline: #232730;
    --text: #f3f4f6;
    --text-2: #8b929e;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --success: #22c55e;
    --indigo: #6366f1;
    --security: #ef4444;
    --pdf: #c4918a;
    --image: #a79cc4;
    --sheet: #8ab092;
    --document: #87a5c4;
    --other: #9da1a8;
    /* Code colors: VS Code Dark+ (CodeSyntax.darkPlus) */
    --zs-fg: #D4D4D4; --zs-line-number: #858585; --zs-keyword: #569CD6; --zs-control: #C586C0; --zs-type: #4EC9B0;
    --zs-string: #CE9178; --zs-comment: #6A9955; --zs-number: #B5CEA8; --zs-preprocessor: #C586C0; --zs-property: #9CDCFE;
    --zs-constant: #569CD6; --zs-decorator: #DCDCAA; --zs-function: #DCDCAA;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0b0c0e;
    --surface: #14161a;
    --surface-raised: #1c1f26;
    --hairline: #232730;
    --text: #f3f4f6;
    --text-2: #8b929e;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --success: #22c55e;
    --indigo: #6366f1;
    --security: #ef4444;
    --pdf: #c4918a;
    --image: #a79cc4;
    --sheet: #8ab092;
    --document: #87a5c4;
    --other: #9da1a8;
    /* Code colors: VS Code Dark+ (CodeSyntax.darkPlus) */
    --zs-fg: #D4D4D4; --zs-line-number: #858585; --zs-keyword: #569CD6; --zs-control: #C586C0; --zs-type: #4EC9B0;
    --zs-string: #CE9178; --zs-comment: #6A9955; --zs-number: #B5CEA8; --zs-preprocessor: #C586C0; --zs-property: #9CDCFE;
    --zs-constant: #569CD6; --zs-decorator: #DCDCAA; --zs-function: #DCDCAA;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
img { max-width: 100%; }
a { color: var(--brand); }

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

/* —— Header (full width, above both panes) —— */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 8px 16px;
  flex-shrink: 0;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  line-height: 0;
}
.wordmark-z {
  width: 17px;
  height: 17px;
  color: var(--brand);
  display: block;
  overflow: visible;
}
.wordmark-dot {
  width: 7.2px;
  height: 7.2px;
  margin-left: 8.5px;
  border-radius: 50%;
  background: var(--dot);
  flex-shrink: 0;
}
.wordmark-mail {
  margin-left: 6px;
  font-size: 23.5px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  padding-bottom: 1px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border-radius: 50%;
  color: var(--text);
  transition: background-color var(--motion) ease;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.capsule {
  width: auto;
  padding: 6px 10px;
  border-radius: 999px;
}
.icon-btn:hover,
.icon-btn:active {
  background: var(--hairline);
}

/* —— Split —— */
.split {
  display: flex;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--hairline);
}
.pane-left {
  width: var(--list-w);
  min-width: 560px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.pane-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-left: 1px solid var(--hairline);
}
.pane-body { flex: 1; min-height: 0; overflow: auto; }

/* —— Footer (56px, aligned across both panes) —— */
.footer {
  height: var(--footer-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
  border-radius: 12px;
  color: var(--text-2);
}
.tab svg { width: 16px; height: 16px; }
.tab span { font-size: 10px; font-weight: 600; }
.tab.active { color: var(--text); background: var(--surface-raised); }
.compose-btn {
  margin-left: auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border-radius: 50%;
  color: var(--text);
}
.compose-btn svg { width: 18px; height: 18px; }

.reader-actions { width: 100%; display: flex; }
.bar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text);
  padding: 6px 0;
}
.bar-btn svg { width: 16px; height: 16px; }
.bar-btn span { font-size: 9px; font-weight: 500; }
.bar-btn:hover { color: var(--brand); }

/* Crèche 120: Select-mode footer swaps Inbox/Sent for bulk actions. */
.footer-bulk { gap: 4px; }
.footer-bulk .bulk-count {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  padding: 0 8px;
}
.footer-bulk .bulk-actions { flex: 1; min-width: 0; }
.footer-bulk .bulk-tip { flex: 1; display: flex; min-width: 0; }
.footer-bulk .bulk-tip .bar-btn { flex: 1; width: 100%; }
.footer-bulk .bar-btn span { white-space: nowrap; }
.footer-bulk .bar-btn:disabled:hover,
.footer-bulk .bar-btn[aria-disabled="true"]:hover { color: var(--text); }

/* —— List and reader toolbars (Crèche 116): one shared bar, same height and chip size. —— */
.pane-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  flex-shrink: 0;
  min-height: 44px;
  box-sizing: border-box;
}
.list-toolbar { flex-wrap: nowrap; }
.list-toolbar .spacer { flex: 1; min-width: 8px; }
.toolbar-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
/* Keep old class names harmless if anything still uses them. */
.action-strip { display: flex; align-items: center; gap: 8px; padding: 8px 16px; flex-shrink: 0; min-height: 44px; }
.pill { font-size: 15px; font-weight: 500; white-space: nowrap; }

/* —— Search —— */
.search-wrap { padding: 0 16px 8px; flex-shrink: 0; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 10px;
}
.search-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
}
.search-bar svg { width: 14px; height: 14px; color: var(--text-2); flex-shrink: 0; }
.search-meta {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-muted);
  padding: 3px 8px;
  border-radius: 999px;
}

/* —— Folder control (sits in the list toolbar) —— */
.folder-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  flex-shrink: 0;
}
.folder-title svg { width: 11px; height: 11px; }
.count-badge {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  padding: 2px 7px;
  border-radius: 999px;
}
.folder-menu {
  position: relative;
}
.folder-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.folder-pop button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.folder-pop button:hover, .folder-pop button.active { background: var(--surface-raised); }

/* —— Demo / account hint —— */
.hint-card {
  margin: 0 16px 8px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 10px;
  align-items: center;
}
.hint-card h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.hint-card p { margin: 0; font-size: 12px; color: var(--text-2); }

/* —— Digest banner (compact, left pane) —— */
.digest-banner {
  margin: 0 16px 10px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  text-align: left;
  width: calc(100% - 32px);
  cursor: pointer;
}
.digest-banner .row { display: flex; align-items: center; gap: 8px; }
.kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text-2);
  text-transform: none;
}
.producer {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-muted);
  padding: 3px 8px;
  border-radius: 999px;
}
.digest-banner .banner-text {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.count-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.count-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}
.count-pill.warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.count-pill.indigo { color: var(--indigo); background: color-mix(in srgb, var(--indigo) 14%, transparent); }
.count-pill.muted { color: var(--text-2); background: color-mix(in srgb, var(--text-2) 14%, transparent); }

/* —— Message list —— */
.msg-list { padding-bottom: 8px; }
.msg-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px;
  position: relative;
  background: var(--bg);
  border: 0;
  cursor: pointer;
}
.msg-row.selected { background: var(--surface); }
.msg-row .top, .msg-row .mid, .msg-row .snipo {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.sender {
  font-size: calc(15px * var(--zmail-text-scale, 1));
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-row.unread .sender, .msg-row.unread .subject { font-weight: 600; }
.paperclip { width: 11px; height: 11px; color: var(--text-2); flex-shrink: 0; }
.digest-tag {
  font-size: calc(9px * var(--zmail-text-scale, 1));
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--brand);
  background: var(--brand-muted);
  padding: 2px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.when {
  margin-left: auto;
  font-size: calc(12px * var(--zmail-text-scale, 1));
  font-weight: 500;
  color: var(--text-2);
  flex-shrink: 0;
}
.subject {
  font-size: calc(13.5px * var(--zmail-text-scale, 1));
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.snipo {
  margin-top: 2px;
  font-size: calc(13px * var(--zmail-text-scale, 1));
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.unread-dot {
  position: absolute;
  left: 13px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}
.msg-row .inner { padding-left: 12px; }
.msg-row + .msg-row .inner, .msg-row .rule {
  /* hairline is drawn under each row, inset like iOS */
}
.msg-row .rule {
  height: 1px;
  background: var(--hairline);
  margin: 9px 0 -9px 12px;
}
.check {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  flex-shrink: 0;
  color: var(--text-2);
  align-self: center;
}
.check svg { width: 18px; height: 18px; display: block; }
/* Keep the sender line from growing when the check appears (Crèche 123). */
.msg-row:has(.check) .top { align-items: center; }
.msg-row.picked .check { color: var(--brand); }
.msg-row.selecting .top-line { display: flex; }

.load-older {
  display: block;
  margin: 12px auto 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 8px 14px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px 0;
  color: var(--text-2);
}
.empty-state h3 { margin: 10px 0 6px; font-size: 17px; font-weight: 600; color: var(--text); }
.empty-state p { margin: 0; font-size: 14px; }
.sync-line {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  padding: 4px 16px 8px;
}

/* —— Right pane: digest expanded —— */
.digest-pane { display: flex; flex-direction: column; height: 100%; }
.digest-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 6px;
  flex-shrink: 0;
}
.digest-chrome .kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; }
.digest-scroll { flex: 1; overflow: auto; padding: 8px 16px 36px; }

.digest-header {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.digest-header .row { display: flex; align-items: center; gap: 8px; }
.digest-header h2 {
  margin: 10px 0 0;
  font-size: calc(17px * var(--zmail-text-scale, 1));
  font-weight: 600;
}
.digest-header .summary {
  margin: 8px 0 0;
  font-size: calc(15px * var(--zmail-text-scale, 1));
  color: var(--text);
}
.high-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--security);
  background: color-mix(in srgb, var(--security) 16%, transparent);
  padding: 4px 8px;
  border-radius: 999px;
}

.section-label {
  margin: 16px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  color: var(--text-2);
  text-transform: uppercase;
}

.item-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--motion) ease, border-color var(--motion) ease;
}
.item-card.highlight {
  background: color-mix(in srgb, var(--indigo) 10%, transparent);
  border-color: color-mix(in srgb, var(--indigo) 45%, transparent);
}
.item-card h3 {
  margin: 0;
  font-size: calc(15px * var(--zmail-text-scale, 1));
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.item-card h3 .grow { flex: 1; min-width: 0; }
.amount {
  font-size: calc(12px * var(--zmail-text-scale, 1));
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.item-meta {
  margin-top: 8px;
  font-size: calc(12px * var(--zmail-text-scale, 1));
  font-weight: 500;
  color: var(--text-2);
}
.body-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  min-height: 1.5em;
}
.body-status-quiet { padding: 12px 0; min-height: 1.5em; }
.body-status-title {
  margin: 0;
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.body-status .item-meta { margin: 0; }
.body-spinner {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid var(--hairline);
  border-top-color: var(--text-2);
  border-radius: 50%;
  flex-shrink: 0;
  animation: body-spin 0.7s linear infinite;
}
@keyframes body-spin { to { transform: rotate(360deg); } }
.item-summary {
  margin-top: 8px;
  font-size: calc(13.5px * var(--zmail-text-scale, 1));
  color: var(--text-2);
}
.next-step {
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  font-size: calc(13px * var(--zmail-text-scale, 1));
  font-weight: 500;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.next-step svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }
.ref-chip, .link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-muted);
  padding: 5px 8px;
  border-radius: 999px;
  max-width: 100%;
}
.ref-chip svg, .link-chip svg { width: 14px; height: 14px; }
.ref-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card .link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 500; }

.cleanup-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-raised);
  padding: 6px 9px;
  border-radius: 999px;
  margin: 0 8px 8px 0;
}

/* —— Reader —— */
.reader { display: flex; flex-direction: column; height: 100%; }
.reader:focus { outline: none; }
.reader:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.reader-toolbar { /* height and padding come from .pane-toolbar */ }
.nav-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  background: var(--surface-raised);
  padding: 0 12px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-chip svg { width: 12px; height: 12px; flex-shrink: 0; }
.nav-chip.active {
  background: var(--text);
  color: var(--bg);
}
.nav-chip.active svg { color: currentColor; }
.toolbar-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.step-btns { display: flex; gap: 6px; }
.reader-scroll { flex: 1; overflow: auto; padding: 0 16px 24px; }
.reader-zoom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 16px 8px;
}
.reader-zoom-bar .zoom-level {
  min-width: 3.2em;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.reader-zoom-bar .zoom-chip[disabled] { opacity: 0.4; }
.reader-zoom { min-width: 0; }

.header-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.header-card h1 {
  margin: 0 0 8px;
  font-size: calc(20px * var(--zmail-text-scale, 1));
  font-weight: 600;
}
.kv { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; font-size: calc(13px * var(--zmail-text-scale, 1)); }
.kv .k { width: 36px; flex-shrink: 0; font-size: calc(12px * var(--zmail-text-scale, 1)); font-weight: 600; color: var(--text-2); }

.attach-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  margin: -8px 0 8px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 280px;
}
.attach-chip .name { overflow: hidden; text-overflow: ellipsis; }
.attach-chip .size { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 400; }
.attach-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.attach-chip.pdf { color: var(--pdf); background: color-mix(in srgb, var(--pdf) 8%, var(--surface-raised)); }
.attach-chip.image { color: var(--image); background: color-mix(in srgb, var(--image) 8%, var(--surface-raised)); }
.attach-chip.sheet { color: var(--sheet); background: color-mix(in srgb, var(--sheet) 8%, var(--surface-raised)); }
.attach-chip.document { color: var(--document); background: color-mix(in srgb, var(--document) 8%, var(--surface-raised)); }
.attach-chip.other { color: var(--other); background: color-mix(in srgb, var(--other) 8%, var(--surface-raised)); }
.attach-chip .name, .attach-chip .size { color: var(--text); }

.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
}
.thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
  cursor: pointer;
}
.thumb-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  align-self: center;
  margin-left: 4px;
}

.show-images {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-raised);
  padding: 6px 10px;
  border-radius: 999px;
}

.mail-frame {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 120px;
  overflow: hidden;
}
/* Crèche 106: mail with its own backgrounds (or "View in light") on a light paper card. */
.mail-frame.paper {
  background: #FFFFFF;
  border-radius: 12px;
}
.light-view-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}
.light-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--surface-raised);
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 0.15s ease-out;
}
.light-view-btn:hover { background: var(--border, var(--surface-raised)); }
.light-view-btn svg { width: 14px; height: 14px; }
.plain-body {
  font-size: calc(16px * var(--zmail-text-scale, 1));
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.seg {
  display: flex;
  gap: 0;
  margin: 0 16px 8px;
  background: var(--surface-raised);
  border-radius: 9px;
  padding: 2px;
}
.seg button {
  flex: 1;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 7px;
}
.seg button.on { background: var(--surface); color: var(--text); }

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.lightbox-bar .title { flex: 1; font-size: 14px; font-weight: 600; }
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: grab;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-nav:disabled { opacity: 0.3; }

/* —— Compose / settings / sign-in overlays —— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(11, 12, 14, 0.46);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade var(--motion) ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: min(720px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  animation: pop var(--motion) ease;
}
@keyframes pop {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; text-align: center; }
.sheet-body { padding: 8px 16px 20px; }
.field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}
.field label {
  width: 52px;
  flex-shrink: 0;
  padding-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.field .control { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-raised);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
}
.chip button { color: var(--text-2); display: inline-flex; }
.chip-input {
  flex: 1;
  min-width: 140px;
  border: 0;
  background: transparent;
  outline: none;
  padding: 6px 0;
  font-size: 14px;
}
.subject-input, .body-input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  padding: 6px 0;
  font-size: 15px;
  resize: vertical;
}
.body-input { min-height: 220px; line-height: 1.45; }
.send-btn {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  padding: 6px 14px;
  border-radius: 999px;
}
.cancel-btn { font-size: 15px; font-weight: 500; color: var(--brand); }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.settings-row h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.settings-row p { margin: 0; font-size: 13px; color: var(--text-2); }
.danger-btn { color: var(--danger); font-weight: 600; font-size: 15px; }

.toggle {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  position: relative;
  flex-shrink: 0;
}
.toggle.on { background: var(--brand); border-color: var(--brand); }
.toggle i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--motion) ease;
}
.toggle.on i { transform: translateX(18px); }

/* Sign-in */
.signin {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.signin-card {
  width: min(420px, calc(100% - 32px));
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  text-align: center;
}
.signin-card .wordmark { justify-content: center; margin-bottom: 18px; }
.signin-card p { color: var(--text-2); font-size: 14px; line-height: 1.45; }
.demo-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}
.err { color: var(--danger); font-size: 13px; margin-top: 10px; }

.error-banner {
  margin: 0 16px 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.error-banner button { font-size: 12px; font-weight: 600; color: var(--brand); margin-left: auto; }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 800px) {
  .pane-left { width: 100%; max-width: none; min-width: 0; flex: 1; }
  .pane-right { display: none; }
  .app.reading .pane-left { display: none; }
  .app.reading .pane-right { display: flex; border-left: 0; }
  .list-toolbar { flex-wrap: wrap; row-gap: 8px; }
}

.signin-form { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 8px; }
.signin-form input[type=password] {
  appearance: none; border: 1px solid var(--hairline); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.settings-note { color: var(--text-2); font-size: 13px; line-height: 1.45; margin: 12px 0 0; }

.settings-section { padding: 8px 0 0; border-bottom: 1px solid var(--hairline); }
.settings-section > .section-label { margin: 8px 0 0; }
.settings-block { padding: 12px 0 16px; }
.settings-block h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.choice-list {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
}
.choice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  text-align: left;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
}
.choice-row:last-child { border-bottom: 0; }
.choice-row .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.choice-row .muted { color: var(--text-2); }
.choice-row.selected { background: var(--surface-raised); }
.choice-row svg { width: 15px; height: 15px; color: var(--brand); flex-shrink: 0; }

.trust-card {
  margin: 8px 0 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--hairline));
  border-radius: 14px;
}
.trust-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.trust-name { font-size: 14px; font-weight: 500; }
.trust-addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; margin: 2px 0 8px; }
.trust-card p { margin: 0 0 12px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.trust-actions { display: flex; gap: 10px; }
.trust-actions button {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  background: var(--surface-raised);
  color: var(--text);
}
.trust-actions .trust-yes { background: var(--brand); color: #fff; }

.about-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
}
.about-link strong { display: block; font-size: 15px; font-weight: 600; }
.about-link-meta { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--text-2); }
.about-link svg { flex-shrink: 0; color: var(--text-2); }

.about-sheet { max-width: 420px; }
.about-body { text-align: center; padding-bottom: 28px; }
.about-body .wordmark { justify-content: center; margin: 8px 0 12px; }
.about-body h3 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.about-version { margin: 0 0 24px; font-size: 13px; color: var(--text-2); }
.about-znorx {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.znorx-mark { width: min(280px, 100%); height: auto; display: block; color: var(--text); }
.about-znorx-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.about-body .wordmark-mail,
.about-znorx {
  font-family: var(--znorx-type);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.about-znorx-name { font-size: 18px; font-weight: 400; letter-spacing: 0.18em; }
.about-znorx-tag { font-size: 12px; font-weight: 400; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-2); }
.about-znorx-domain { display: inline-flex; align-items: center; gap: 0; font-size: 13px; letter-spacing: 0.16em; color: var(--text); }
.about-znorx-domain .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 5px;
  border-radius: 50%;
  background: #C4453A;
  letter-spacing: 0;
}

/* Text size slider — mirrors the native General > Text size control. */
.text-size-block { padding-top: 4px; }
.text-size-preview {
  position: relative;
  margin: 0 0 12px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
}
.text-size-preview .msg-row { pointer-events: none; cursor: default; }
.text-size-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}
.text-size-min, .text-size-max {
  font-weight: 600;
  color: var(--text-2);
  line-height: 1;
  flex-shrink: 0;
}
.text-size-min { font-size: 12px; }
.text-size-max { font-size: 22px; }
.text-size-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

/* —— zmail.znorx.com sign-in and Login security (Crèche 098, 099) —— */
.zauth .signin-form input, .zsec-form input, .zsec-form textarea {
  appearance: none; border: 1px solid var(--hairline); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px; width: 100%;
}
.zsec-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; resize: vertical; }
.primary-btn, .secondary-btn {
  border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity var(--motion) ease, background var(--motion) ease;
}
.primary-btn { background: var(--brand); color: #fff; border: 0; }
.secondary-btn { background: var(--surface); color: var(--brand); border: 1px solid var(--hairline); }
.primary-btn:disabled, .secondary-btn:disabled { opacity: 0.5; cursor: default; }
.zauth-alt { display: flex; flex-direction: column; gap: 10px; }
.zauth-or { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; margin: 10px 0 12px; }
.zauth-or::before, .zauth-or::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.zauth-note { margin: 0; }
#zauth-sk-note { font-size: 12px; color: var(--text-2); margin: 2px 0 6px; }
.zsec-item span.zsec-badge { display: inline-block; align-self: flex-start; font-size: 12px; padding: 1px 8px; border-radius: 999px; color: var(--text-2); background: color-mix(in srgb, var(--text-2) 12%, transparent); }
.zsec-item span.zsec-badge.warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.zsec-item span.zsec-badge.ok { color: var(--text-2); }
.zsec-form { display: flex; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; }
.zsec-form input { flex: 1 1 180px; width: auto; }
.zsec-form.column { flex-direction: column; }
.zsec-form.column input { width: 100%; flex: none; }
.zsec-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; margin: 0 0 8px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px;
}
.zsec-item > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zsec-item strong { font-size: 15px; }
.zsec-item span { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.zsec-item .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.danger-btn.small { font-size: 13px; padding: 6px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); }
.zsec-ok { color: var(--success); font-size: 13px; margin-top: 10px; }
.zsec .settings-block h3 { margin-top: 16px; }
.settings-link { font-size: 15px; font-weight: 600; color: var(--brand); }

/* Remote-image banner (Crèche 100): visible whenever offsite images are blocked. */
.remote-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 8px 10px; border-radius: 12px;
  background: var(--surface-raised); color: var(--text-2); font-size: 13px;
}
.remote-banner span { flex: 1 1 180px; }
.remote-banner .show-images { margin: 0; background: var(--brand); color: #fff; padding: 6px 12px; }

/* —— Code coloring (Crèche 101): port of the app's CodeSyntax / CodeLinesView —— */
.zs-code { color: var(--zs-fg); font-family: var(--mono); tab-size: 4; -moz-tab-size: 4; }
.zs-plain, .zs-punctuation { color: var(--zs-fg); }
.zs-keyword { color: var(--zs-keyword); }
.zs-control { color: var(--zs-control); }
.zs-type { color: var(--zs-type); }
.zs-string { color: var(--zs-string); }
.zs-comment { color: var(--zs-comment); }
.zs-number { color: var(--zs-number); }
.zs-preprocessor { color: var(--zs-preprocessor); }
.zs-property { color: var(--zs-property); }
.zs-constant { color: var(--zs-constant); }
.zs-decorator { color: var(--zs-decorator); }
.zs-function { color: var(--zs-function); }

.plain-body .code-block {
  margin: 6px 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.plain-body .code-lang {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--zs-line-number);
  padding: 6px 10px 0;
}
.plain-body pre.zs-code {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: calc(13px * var(--zmail-text-scale, 1));
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Code / text attachment viewer: app background (as in the app), palette text colors. */
html.cv-open, html.cv-open body { overflow: hidden; }
.codeview {
  position: fixed; inset: 0; z-index: 85;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  animation: cv-in 0.15s ease-out;
}
@keyframes cv-in { from { opacity: 0; } to { opacity: 1; } }
.cv-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  flex-shrink: 0;
}
.cv-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-tools { display: flex; gap: 6px; }
.cv-font { min-width: 34px; justify-content: center; }
.cv-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px; font-size: 11px; color: var(--zs-line-number); flex-shrink: 0; }
.cv-badge { font-weight: 600; }
.cv-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px 0 24px; }
.cv-status { padding: 32px 20px; text-align: center; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.cv-lines { font-size: var(--cv-font, 13px); line-height: 1.4; padding-left: 6px; padding-right: 10px; }
.cv-row { display: grid; grid-template-columns: var(--cv-gutter, 4ch) 1fr; }
.cv-ln { color: var(--zs-line-number); text-align: right; padding-right: 2ch; user-select: none; -webkit-user-select: none; }
.cv-code { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 420px) {
  .cv-download { padding-left: 10px; padding-right: 10px; }
}

/* —— Preview lines (Crèche 104): None / 1 / 2, as in the app —— */
:root[data-preview="0"] .snipo { display: none; }
:root[data-preview="1"] .snipo { -webkit-line-clamp: 1; line-clamp: 1; }
:root[data-preview="2"] .snipo { -webkit-line-clamp: 2; line-clamp: 2; }

/* —— Swipe left (touch only): the row slides to show a visible Trash button —— */
.row-wrap { position: relative; overflow: hidden; }
.row-wrap .msg-row { touch-action: pan-y; transition: transform 0.16s ease; will-change: transform; }
.row-wrap.dragging .msg-row { transition: none; }
.row-wrap.swiped .msg-row { transform: translateX(-88px); }
.row-swipe-trash {
  position: absolute; top: 0; right: 0; bottom: 0; width: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 600;
  visibility: hidden;
}
.row-swipe-trash svg { width: 18px; height: 18px; }
.row-wrap.swiped .row-swipe-trash, .row-wrap.dragging .row-swipe-trash { visibility: visible; }

/* —— Settings (Crèche 104): the app's inset grouped lists, as a normal web sheet —— */
.zset .sheet { width: min(560px, 100%); display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.zset.still, .zset.still .sheet { animation: none; }
.zset .sheet-head { border-bottom: 0; padding: 12px 14px 6px; }
.zset .sheet-head h2 { font-size: 17px; }
.zhead-side { width: 64px; display: flex; align-items: center; }
.zhead-side.right { justify-content: flex-end; }
.zdone { font-weight: 600; color: var(--brand); }
.zback {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-raised); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.zback svg { width: 15px; height: 15px; }
.sheet-scroll { overflow-y: auto; padding: 4px 16px 24px; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.zpage.slide-in { animation: zslide-in 0.16s ease-out; }
.zpage.slide-back { animation: zslide-back 0.16s ease-out; }
@keyframes zslide-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes zslide-back { from { transform: translateX(-24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .zpage.slide-in, .zpage.slide-back, .row-wrap .msg-row { animation: none; transition: none; } }
.zhead {
  margin: 22px 16px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.zgroup { background: var(--surface); border-radius: 12px; overflow: hidden; }
.sheet-scroll > .zgroup:first-child { margin-top: 12px; }
.zfoot { margin: 6px 16px 0; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.zrow {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px;
  padding: 10px 16px; text-align: left; font-size: 16px; color: var(--text);
  background: transparent; position: relative;
}
.zrow + .zrow::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hairline);
}
button.zrow:active { background: var(--surface-raised); }
.zlabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zlabel.mono, .zvalue.mono { font-family: var(--mono); font-size: 14px; }
.zvalue { color: var(--text-2); font-size: 15px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zchev { color: var(--text-2); display: inline-flex; opacity: 0.7; }
.zchev svg { width: 13px; height: 13px; }
.zicon { color: var(--brand); display: inline-flex; }
.zicon svg { width: 20px; height: 20px; }
.zrow-link { min-height: 50px; }
.zcheck { color: var(--brand); display: inline-flex; }
.zcheck svg { width: 15px; height: 15px; }
.zrow-danger { justify-content: center; color: var(--danger); font-weight: 600; }
.zrow-seg { flex-wrap: wrap; }
.zrow-seg .zlabel { flex: 1 1 auto; }
.zseg {
  display: inline-flex; padding: 2px; border-radius: 9px; background: var(--surface-raised); gap: 2px; flex: 0 0 auto;
}
.zseg button {
  min-width: 62px; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease;
}
.zseg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.18); }
.zrow-stack { flex-direction: column; align-items: stretch; gap: 8px; }
.zrow-stack .text-size-preview { margin: 0; }
.zset .about-body { padding-top: 24px; }
@media (max-width: 800px) {
  .zset { padding: 0; align-items: stretch; }
  .zset .sheet { width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; }
  .zseg button { min-width: 54px; padding: 6px 10px; }
}
.zrow-link .zlabel { flex: 0 1 auto; }
.zrow-link .zvalue { flex: 1 1 0; text-align: right; max-width: none; min-width: 0; }
.zrow-link .zicon + .zlabel { flex: 1 1 auto; }

/* Raw Email in the code viewer (Crèche 109): no line numbers, Decoded / As stored switch. */
.cv-lines.cv-no-ln .cv-row { grid-template-columns: 1fr; }
.cv-lines.cv-no-ln { padding-left: 12px; }
.codeview .cv-switch { margin: 8px 12px 0; flex-shrink: 0; }

/* Latest Digest card, about twice the app's compact height (Crèche 110). */
.digest-banner .banner-text { -webkit-line-clamp: 3; line-clamp: 3; line-height: 1.35; }
.digest-peek { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.digest-peek li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; line-height: 1.35; color: var(--text); }
.digest-peek .peek-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text-2); }
.digest-peek li.warn .peek-dot { background: var(--warning); }
.digest-peek li.indigo .peek-dot { background: var(--indigo); }
.digest-peek .peek-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-peek .peek-more { font-size: 12px; color: var(--text-2); padding-left: 14px; }

/* Preview lines (Crèche 111): the row's flex layout overrode the clamp, so the setting did nothing.
   The snippet is a clamped block box: None hides it, 1 or 2 clamp to that many lines. */
.msg-row .snipo { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; line-height: 1.35; -webkit-line-clamp: 1; line-clamp: 1; }
:root[data-preview="2"] .msg-row .snipo { -webkit-line-clamp: 2; line-clamp: 2; }
:root[data-preview="0"] .msg-row .snipo { display: none; }


/* Keyboard control (Crèche 114): roving list highlight, shortcuts sheet, undo toast. Motion 0.15s. */
.msg-list { outline: none; }
.msg-row.selected {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.msg-row.selected:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.shortcuts-overlay, .shortcuts-sheet { animation-duration: 0.15s; }
.shortcuts-sheet { width: min(520px, 100%); }
.shortcuts-body { padding-bottom: 24px; }
.shortcuts-h {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}
.shortcuts-h.current { color: var(--brand); }
.shortcuts-h:first-child { margin-top: 4px; }
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table th, .shortcuts-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  vertical-align: middle;
}
.shortcuts-table th { width: 46%; white-space: nowrap; }
.shortcuts-table kbd {
  display: inline-block;
  min-width: 1.6em;
  margin: 0 2px 0 0;
  padding: 2px 7px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-raised);
  font: 600 12px var(--mono);
  color: var(--text);
  text-align: center;
}
.shortcuts-note {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  font-size: 14px;
  animation: fade 0.15s ease;
}
.undo-toast button {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}
@media (prefers-reduced-motion: reduce) {
  .shortcuts-overlay, .shortcuts-sheet, .undo-toast { animation: none; }
}
#reader-scroll:focus, #reader-scroll:focus-visible { outline: none; }

/* Crèche 119: Spam and Trash. A note on top of each list with the auto-empty rule and a visible
   "Empty now"; a confirmation sheet for anything that deletes for good. */
.purge-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 12px; padding: 10px 12px;
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); font-size: 13px; line-height: 1.35;
}
.purge-note > span { flex: 1 1 220px; min-width: 0; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.nav-chip.danger { color: var(--danger); }
.nav-chip.danger.solid { background: var(--danger); color: #fff; }
.nav-chip.danger:disabled, .nav-chip:disabled { opacity: 0.5; cursor: default; }
.bar-btn.danger { color: var(--danger); }
.bar-btn.danger:hover { color: var(--danger); filter: brightness(1.15); }
.confirm-overlay, .confirm-sheet { animation-duration: 0.15s; }
.confirm-sheet { width: min(420px, 100%); padding: 20px 20px 16px; }
.confirm-sheet h2 { margin: 0 0 8px; font-size: 17px; }
.confirm-sheet p { margin: 0 0 12px; color: var(--text-2); font-size: 14px; line-height: 1.4; }
.confirm-sheet .err { color: var(--danger); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.zseg[aria-labelledby="seg-set-retention-trash"] button,
.zseg[aria-labelledby="seg-set-retention-spam"] button { min-width: 0; padding-left: 8px; padding-right: 8px; }

/* Crèche 136: drag a row (or the picks) to Spam or Trash. The strip overlays the folder row, so the
   list never moves; 0.15s fade and slide. */
.pane-left { position: relative; }
.row-wrap[draggable="true"] { -webkit-user-drag: element; }
.row-wrap.drag-src { opacity: 0.45; transition: opacity 0.15s ease; }
.drop-strip {
  position: absolute; z-index: 30; top: 0; left: 0; right: 0; height: var(--header-h);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--hairline);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  opacity: 0; transform: translateY(-6px); pointer-events: none; visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
.drop-strip.on { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s; }
.drop-label { color: var(--text-2); font-size: 13px; margin-right: 4px; }
.drop-target {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px;
  border: 1.5px dashed var(--brand); border-radius: var(--radius-sm); color: var(--brand);
  font-size: 14px; font-weight: 600; background: var(--brand-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.drop-target[data-drop="spam"] { border-color: var(--warning); color: var(--warning); background: rgba(217, 119, 6, 0.1); }
.drop-target.over { border-style: solid; transform: scale(1.02); color: #fff; background: var(--brand); }
.drop-target[data-drop="spam"].over { background: var(--warning); color: #fff; }
.drop-target * { pointer-events: none; }
.drag-ghost {
  position: fixed; top: -100px; left: -100px; padding: 6px 10px; border-radius: 10px;
  background: var(--brand); color: #fff; font: 600 13px var(--font);
}
@media (prefers-reduced-motion: reduce) { .drop-strip, .drop-target, .row-wrap.drag-src { transition: none; } }

/* Crèche 137: why a message is in Spam, and the Blocked / Safe senders pages. */
.spam-why {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 12px 0; padding: 8px 12px;
  border-radius: var(--radius-sm); background: rgba(217, 119, 6, 0.1); color: var(--text); font-size: 13px; line-height: 1.35;
}
.spam-why > svg { color: var(--warning); flex: 0 0 auto; }
.spam-why > span { flex: 1 1 200px; min-width: 0; }
.spam-why.safe { background: rgba(22, 163, 74, 0.1); }
.spam-why.safe > svg { color: var(--success); }
.pill-btn {
  border: 1px solid var(--hairline); background: var(--surface); color: var(--brand); border-radius: 999px;
  padding: 6px 14px; font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
}
.pill-btn.danger { color: var(--danger); }
.pill-btn:disabled { opacity: 0.45; cursor: default; }
.senders-intro { margin-top: 4px; }
.senders-add .zrow { gap: 8px; }
.sender-add-input, .sender-search {
  flex: 1; min-width: 0; font: 15px var(--font); color: var(--text); background: var(--bg);
  border: 1px solid var(--hairline); border-radius: 10px; padding: 8px 10px;
}
.senders-bar { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.senders-count { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.senders-note { margin: 8px 4px; color: var(--success); font-size: 13px; }
.sender-row { cursor: pointer; align-items: flex-start; }
.sender-row[hidden] { display: none; }
.sender-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 auto; }
.sender-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.sender-addr { font-size: 14px; overflow-wrap: anywhere; }
.sender-meta { color: var(--text-2); font-size: 12px; }
.senders-actions { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0; }
.senders-nomatch[hidden] { display: none; }
