:root {
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-synthesis:none;
  color-scheme:dark;
  color:var(--ink);
  background:var(--page);
  --ink:#ededed;
  --muted:#ababaf;
  --green:#d2d2d2;
  --page:#181818;
  --surface:#222222;
  --surface-alt:#1e1e1e;
  --surface-raised:#2a2a2d;
  --hover:#29292c;
  --selected:#303034;
  --selected-chip:#444444;
  --line:#363639;
  --border-accent:#4a4a4a;
  --accent:#d4d4d8;
  --success-bg:#253620;
  --success-text:#bbdb9e;
  --success-border:#405c32;
  --success-dot:#a4ce7e;
  --success-ring:#a4ce7e1f;
  --warning-bg:#332b1b;
  --warning-text:#e2c996;
  --warning-strong:#f1dba9;
  --warning-border:#5e4e2e;
  --error-bg:#392620;
  --error-text:#efb7a5;
  --error-border:#744b3e;
  --focus:#bfc9ff;
  --scrollbar:#616161;
  --shadow:#00000020;
}

:root[data-theme="light"] {
  color-scheme:light;
  --ink:#242429;
  --muted:#606069;
  --green:#45454e;
  --page:#f3f4f6;
  --surface:#fff;
  --surface-alt:#fafafa;
  --surface-raised:#f0f0f2;
  --hover:#ededf0;
  --selected:#e8e9ed;
  --selected-chip:#dddfe5;
  --line:#e0e1e6;
  --border-accent:#d5d6dd;
  --accent:#595b68;
  --success-bg:#edf3e7;
  --success-text:#536e43;
  --success-border:#dde8d3;
  --success-dot:#6d9056;
  --success-ring:#6d905613;
  --warning-bg:#fbf7e9;
  --warning-text:#7e6c44;
  --warning-strong:#7d693c;
  --warning-border:#ece2c8;
  --error-bg:#f8eae4;
  --error-text:#8b4b36;
  --error-border:#ecd1c5;
  --focus:#6776b5;
  --scrollbar:#c3c4cb;
  --shadow:#25332003;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  font-size:16px;
  line-height:1.5;
}

button,input,a {
  -webkit-tap-highlight-color:transparent;
}

button,input {
  font:inherit;
}

button,a {
  touch-action:manipulation;
}

button {
  cursor:pointer;
}

a {
  color:inherit;
}

svg {
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
}

button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible {
  outline:3px solid var(--focus);
  outline-offset:4px;
}

[hidden] {
  display:none!important;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.skip-link {
  position:fixed;
  top:10px;
  left:10px;
  z-index:10;
  background:var(--ink);
  color:var(--page);
  padding:12px;
  transform:translateY(-150%);
  border-radius:6px;
}

.skip-link:focus {
  transform:none;
}

.connection-status {
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:13px;
  font-weight:500;
  background:transparent;
  border:0;
  padding:6px 2px;
  border-radius:0;
}

.status-dot,.tiny-dot {
  height:6px;
  width:6px;
  border-radius:50%;
  display:inline-block;
  background:var(--accent);
  flex-shrink:0;
}

.status-dot {
  background:var(--warning-text);
}

.connection-status.connected {
  background:transparent;
  color:var(--muted);
  border-color:var(--success-border);
}

.connected .status-dot {
  background:var(--success-dot);
  box-shadow:0 0 0 3px var(--success-ring);
}

.connection-status.offline {
  background:transparent;
  color:var(--warning-text);
  border-color:var(--warning-border);
}

.page-shell {
  max-width:1680px;
  height:100dvh;
  min-height:540px;
  display:flex;
  flex-direction:column;
  margin:auto;
  padding:20px 28px 12px;
}

.inbox-header {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"title actions" "domain actions";
  align-items:center;
  gap:10px 24px;
  flex-shrink:0;
  margin-bottom:16px;
}

.page-title {
  display:flex;
  align-items:center;
  gap:9px;
  grid-area:title;
  margin:0;
  font-size:24px;
  font-weight:700;
  line-height:1.2;
  letter-spacing:-.8px;
}

.brand {
  grid-area:title;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px 14px;
  min-width:0;
}

.brand-subtitle {
  margin:0;
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
}

/* The way into private mailboxes, beside the page controls and styled like them. */
.private-link { display:inline-flex; align-items:center; justify-content:center; gap:7px; height:40px; padding:0 12px;
  border:1px solid var(--line); border-radius:7px; background:var(--surface); color:var(--ink); font-size:14px;
  text-decoration:none; white-space:nowrap; }
.private-link:hover { background:var(--hover); }
.private-link svg { width:16px; height:16px; flex:none; }
@media(max-width:820px) {
  /* Only the lock on phones, like the theme button; the label stays for screen readers. */
  .private-link { width:40px; padding:0; }
  .private-link-label { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
}
@media(max-width:380px) {
  /* Three controls beside the title: keep them clear of it on the narrowest phones. */
  .page-title { font-size:20px; gap:7px; }
  .page-title .brand-icon { width:22px; height:22px; }
  .private-link, .theme-toggle { width:36px; height:36px; }
  .header-actions .language-picker { min-height:36px; padding:0 6px; }
}

.domain-info {
  grid-area:domain;
  min-width:0;
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px 10px;
}

.header-actions {
  grid-area:actions;
  justify-self:end;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.language-picker {
  max-width:100%;
  min-height:40px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--surface);
  color:var(--ink);
  font:inherit;
  font-size:14px;
  cursor:pointer;
}

.language-picker:hover {
  background:var(--hover);
}

.connection-status {
  white-space:nowrap;
}

.theme-toggle {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  height:40px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--surface);
  color:var(--ink);
  font-size:14px;
  white-space:nowrap;
}

.theme-toggle:hover {
  background:var(--hover);
}

.theme-toggle svg {
  width:16px;
  height:16px;
}

.theme-moon,
:root[data-theme="light"] .theme-sun {
  display:none;
}

:root[data-theme="light"] .theme-moon {
  display:block;
}

.domain-label {
  font-size:13px;
  font-weight:500;
  color:var(--muted);
}

.domain-values {
  display:flex;
  flex-wrap:wrap;
  min-width:0;
  max-width:100%;
  gap:6px 8px;
}

.domain-value {
  display:inline-flex;
  min-width:0;
  max-width:100%;
  font:500 12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;
  padding:2px 8px;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--surface-alt);
  overflow-wrap:anywhere;
}

.domain-value>span {
  min-width:0;
}

.domain-value>span:first-child {
  color:var(--muted);
}

.app-error {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  background:var(--error-bg);
  color:var(--error-text);
  border:1px solid var(--error-border);
  border-radius:8px;
  font-size:14px;
  padding:13px 17px;
  margin-bottom:18px;
}

.inbox {
  display:grid;
  grid-template-columns:340px minmax(0,1fr);
  flex:1;
  min-height:0;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 8px 30px var(--shadow);
  overflow:hidden;
}

.mailbox-panel {
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  border-right:1px solid var(--line);
  background:var(--surface-alt);
}

.mailbox-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:18px 18px 12px;
}

.mailbox-heading h2 {
  font-size:16px;
  font-weight:650;
  letter-spacing:-.3px;
  margin:0 0 2px;
}

.message-count {
  font-size:13px;
  color:var(--muted);
}

.icon-button {
  height:40px;
  width:40px;
  border:1px solid transparent;
  border-radius:7px;
  background:transparent;
  color:var(--muted);
  display:grid;
  place-items:center;
  flex-shrink:0;
}

.icon-button svg {
  width:18px;
  height:18px;
}

.icon-button:hover {
  background:var(--hover);
  color:var(--green);
}

.search-form {
  margin:0 18px 6px;
  position:relative;
}

.search-form>svg {
  width:16px;
  height:16px;
  position:absolute;
  left:13px;
  top:14px;
  color:var(--muted);
}

.search-form input {
  width:100%;
  height:44px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  font-size:14px;
  padding:0 40px 0 38px;
  color:var(--ink);
}

.search-form input::placeholder {
  color:var(--muted);
}

.mailbox-filters {
  margin:0 18px 10px;
}

.spam-filter {
  display:inline-flex;
  align-items:center;
  gap:9px;
  min-height:36px;
  font-size:14px;
  line-height:1.5;
  color:var(--muted);
  cursor:pointer;
  user-select:none;
}

.spam-filter input {
  width:16px;
  height:16px;
  margin:0;
  accent-color:var(--accent);
  cursor:pointer;
}

.message-list {
  overflow-y:auto;
  flex:1;
  min-height:0;
  scrollbar-width:thin;
  scrollbar-color:var(--scrollbar) transparent;
  padding:0 8px 8px;
  overscroll-behavior:contain;
  scroll-padding:8px;
}

.message-list:empty {
  display:none;
}

/* Leave the space below the pinned email to the loading rows. */
.mailbox-panel:has(> .list-loading:not([hidden])) > .message-list {
  flex:0 0 auto;
  padding-bottom:0;
  overflow:hidden;
}

.message-item {
  border:0;
  border-top:0;
  border-left:3px solid transparent;
  background:transparent;
  text-align:left;
  width:100%;
  padding:12px 11px 12px 10px;
  display:block;
  position:relative;
  color:var(--ink);
  border-radius:8px;
  margin-bottom:2px;
}

.message-item:last-child {
  border-bottom:0;
}

.message-item:hover {
  background:var(--hover);
}

.message-item.selected {
  background:var(--selected);
  border-left-color:var(--accent);
}

.message-item-top {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:4px;
}

.list-sender {
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  font-size:13px;
  font-weight:500;
  flex:1;
  min-width:0;
}

.list-time {
  white-space:nowrap;
  font-size:12px;
  color:var(--muted);
}

.list-subject {
  font-size:15px;
  font-weight:600;
  line-height:1.5;
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden;
  margin:0 0 2px;
}

.list-preview {
  font-size:13px;
  line-height:1.5;
  color:var(--muted);
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden;
  margin:0 0 6px;
}

.list-preview.list-body-hidden {
  color:var(--warning-text);
  font-style:italic;
}

.list-item-bottom {
  display:flex;
  gap:6px;
  align-items:center;
}

.list-recipient {
  font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;
  background:transparent;
  color:var(--muted);
  display:inline-block;
  border-radius:4px;
  padding:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:100%;
  min-width:0;
}

.selected .list-recipient {
  background:transparent;
  color:var(--muted);
}

.spam-badge {
  display:inline-flex;
  flex-shrink:0;
  align-items:center;
  border:0;
  border-radius:4px;
  padding:2px 5px;
  color:var(--warning-text);
  background:var(--warning-bg);
  font-size:11px;
  line-height:1.4;
}

.detail-spam-badge {
  margin-bottom:12px;
  padding:3px 7px;
  font-size:14px;
}

.attachment-badge {
  font-size:12px;
  display:flex;
  flex-shrink:0;
  align-items:center;
  gap:4px;
  margin-left:auto;
  color:var(--muted);
}

.attachment-badge svg {
  width:14px;
  height:14px;
}

.hidden-badge {
  display:flex;
  flex-shrink:0;
  color:var(--warning-text);
}

.hidden-badge svg {
  width:14px;
  height:14px;
}

.selected .list-preview.list-body-hidden,.selected .hidden-badge {
  color:var(--ink);
}

.list-footer {
  padding:12px 20px;
  text-align:center;
}

.list-footer:has([hidden]+[hidden]) {
  display:none;
}

.secondary-button {
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--green);
  border-radius:8px;
  padding:9px 14px;
  font-size:14px;
  font-weight:550;
  min-height:40px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.secondary-button:hover {
  background:var(--hover);
}

.secondary-button:disabled {
  cursor:not-allowed;
  opacity:.6;
}

.list-footer p {
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
  margin:0;
}

.mailbox-bottom {
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:7px;
  padding:9px 18px;
  font-size:12px;
  color:var(--muted);
}

.mailbox-bottom .tiny-dot {
  height:4px;
  width:4px;
  background:var(--warning-text);
}

.mailbox-bottom.connected .tiny-dot { background:var(--success-dot); }
.mailbox-bottom.offline { color:var(--warning-text); }

.list-loading,.detail-loading {
  font-size:14px;
  color:var(--muted);
  display:block;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex:1;
  padding:0;
  overflow:hidden;
  min-height:0;
  width:100%;
}

.spinner {
  width:14px;
  height:14px;
  border:2px solid var(--line);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin 1s linear infinite;
}

.list-feedback {
  padding:12px 18px;
  display:grid;
  gap:8px;
  justify-items:start;
  font-size:14px;
  line-height:1.5;
  color:var(--warning-text);
  background:var(--warning-bg);
}

.list-empty {
  flex:1;
  padding:24px 18px;
  overflow-y:auto;
  text-align:center;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
}

.empty-small-icon {
  display:grid;
  place-items:center;
  height:48px;
  width:48px;
  border-radius:14px;
  background:var(--surface-raised);
  color:var(--muted);
  font-size:20px;
  margin-bottom:10px;
}

.empty-small-icon svg {
  width:24px;
  height:24px;
}

.list-empty h3 {
  font-size:17px;
  font-weight:600;
  margin:10px 0;
}

.list-empty p {
  font-size:14px;
  line-height:1.7;
  color:var(--muted);
  max-width:280px;
  margin:0;
}

.message-panel {
  --message-gutter:32px;
  min-width:0;
  min-height:0;
  overscroll-behavior:contain;
  scroll-padding-top:64px;
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:var(--scrollbar) transparent;
  position:relative;
  display:flex;
  flex-direction:column;
}

.detail-placeholder {
  display:flex;
  flex:1;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:0;
  padding:35px;
}

.mail-placeholder-icon {
  width:48px;
  height:48px;
  flex-shrink:0;
  margin-bottom:12px;
  color:var(--muted);
  stroke-width:1.25;
}

.detail-placeholder h2 {
  font-size:20px;
  line-height:1.35;
  font-weight:600;
  margin:12px 0 8px;
  letter-spacing:-.4px;
}

.detail-placeholder>p {
  font-size:15px;
  line-height:1.7;
  color:var(--muted);
  margin:0;
  max-width:340px;
}

.detail-view {
  flex:1 0 auto;
  min-height:0;
}

#message-content,
#intro-message {
  max-width:920px;
  margin-inline:auto;
}

.detail-toolbar {
  min-height:52px;
  position:sticky;
  top:0;
  z-index:1;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 16px;
  border-bottom:1px solid var(--line);
  background:var(--surface);
}

.download-link {
  text-decoration:none;
  color:var(--green);
  font-size:13px;
  display:flex;
  gap:7px;
  align-items:center;
  min-height:40px;
  margin-left:auto;
  white-space:nowrap;
}

.download-link:hover {
  text-decoration:underline;
}

.text-button {
  border:0;
  padding:0;
  background:none;
  color:inherit;
  text-decoration:underline;
  text-underline-offset:3px;
  font-size:14px;
}

.back-button {
  display:inline-flex;
  min-height:40px;
  white-space:nowrap;
  text-decoration:none;
  align-items:center;
  gap:6px;
  color:var(--green);
  font-size:14px;
}

.message-header {
  padding:26px var(--message-gutter) 22px;
  border-bottom:0;
}

.message-header>h2 {
  font-size:24px;
  font-weight:600;
  letter-spacing:-.5px;
  line-height:1.3;
  margin:0 0 20px;
  overflow-wrap:anywhere;
}

.sender-row {
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.sender-avatar {
  width:36px;
  height:36px;
  border-radius:50%;
  background:var(--surface-raised);
  color:var(--green);
  font-size:12px;
  font-weight:650;
  display:grid;
  place-items:center;
  flex-shrink:0;
}

.sender-info {
  min-width:0;
  flex:1;
}

.sender-info p {
  font-size:14px;
  font-weight:500;
  line-height:1.5;
  margin:0 0 2px;
  overflow-wrap:anywhere;
}

.sender-info time {
  display:block;
  font-size:13px;
  line-height:1.6;
  color:var(--muted);
}

.message-meta {
  display:flex;
  flex-wrap:wrap;
  gap:6px 10px;
  margin:8px 0 0;
  align-items:baseline;
  font-size:13px;
  line-height:1.6;
}

.message-meta dt {
  color:var(--muted);
}

.message-meta dd {
  margin:0;
  min-width:0;
  color:var(--green);
}

.recipient-list {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.recipient-chip {
  border:0;
  border-radius:4px;
  background:var(--surface-raised);
  max-width:100%;
  padding:2px 6px;
  overflow-wrap:anywhere;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:12px;
}

.header-details {
  font-size:13px;
  color:var(--muted);
  margin-top:12px;
  padding-top:0;
  border-top:0;
}

.header-details summary {
  cursor:pointer;
  width:fit-content;
  padding:4px 0;
  line-height:1.6;
}

.header-values {
  display:grid;
  grid-template-columns:80px minmax(0,1fr);
  gap:8px 12px;
  margin:12px 0 4px;
  line-height:1.6;
}

.header-values dt {
  color:var(--muted);
}

.header-values dd {
  margin:0;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  color:var(--muted);
}

.message-view-toolbar {
  padding:0 var(--message-gutter) 20px;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
  background:transparent;
}

.message-view-toggle {
  display:flex;
  flex-shrink:0;
  gap:3px;
  padding:3px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--page);
}

.message-view-toggle button {
  padding:6px 12px;
  border:0;
  border-radius:4px;
  background:transparent;
  color:var(--muted);
  font-size:13px;
  font-weight:550;
  line-height:1.5;
  min-height:34px;
}

.message-view-toggle button:hover {
  color:var(--ink);
  background:var(--hover);
}

.message-view-toggle button[aria-pressed="true"] {
  color:var(--ink);
  background:var(--selected);
}


.message-html {
  padding:0 var(--message-gutter) 36px;
}

.message-html-frame {
  display:block;
  width:100%;
  height:clamp(280px,65vh,640px);
  border:1px solid var(--line);
  border-radius:7px;
  color-scheme:light;
  background:#fff;
}

.message-body {
  padding:4px var(--message-gutter) 36px;
  font-size:16px;
  color:var(--ink);
  line-height:1.75;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  tab-size:4;
}

.message-body.empty-body {
  color:var(--muted);
  font-style:italic;
}

.attachments-section {
  border-top:1px solid var(--line);
  margin:0 var(--message-gutter);
  padding:28px 0 32px;
}

.attachments-section h3 {
  font-size:16px;
  font-weight:600;
  margin:0 0 8px;
}

.attachments-note {
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
  margin:0 0 16px;
}

.attachment-list {
  list-style:none;
  padding:0;
  margin:0;
  display:grid;
  flex-wrap:wrap;
  gap:12px;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));
  align-items:start;
}

.attachment-list li {
  max-width:100%;
  min-width:0;
}

.image-attachment {
  width:auto;
  min-width:0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-raised);
  align-self:flex-start;
}

.attachment-preview {
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:100%;
  min-width:0;
  min-height:0;
  object-fit:scale-down;
}

.attachment-preview-button {
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:210px;
  padding:16px;
  border:0;
  background:#fff;
  color:var(--ink);
  cursor:zoom-in;
}

.attachment-preview-button:hover { box-shadow:inset 0 0 0 2px #b8b8be; }
.attachment-preview-button:focus-visible { outline-offset:-3px; }
.attachment-preview-button:disabled { cursor:default; }

.image-viewer {
  width:min(1200px,calc(100% - 32px));
  height:min(860px,calc(100dvh - 32px));
  max-width:none;
  max-height:calc(100dvh - 32px);
  padding:0;
  border:1px solid #4a4a50;
  border-radius:14px;
  background:#222225;
  color:#f5f5f5;
  box-shadow:0 24px 80px #0006;
  overflow:hidden;
}

.image-viewer[open] { display:grid; grid-template-rows:auto minmax(0,1fr); }
.image-viewer::backdrop { background:#000d; }
.image-viewer-toolbar { display:flex; align-items:center; gap:12px; padding:16px 20px; border-bottom:1px solid #4a4a50; background:#222225; }
.image-viewer-toolbar h2 { flex:1; min-width:0; margin:0; font-size:15px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-viewer-toolbar a { flex-shrink:0; }
.image-viewer-toolbar .secondary-button,.image-viewer-toolbar .icon-button { background:#333338; color:#fff; border:1px solid #606067; }
.image-viewer-toolbar .secondary-button:hover,.image-viewer-toolbar .icon-button:hover { background:#47474f; }
.image-viewer-toolbar .icon-button[aria-pressed="true"] { background:#55555e; }
.image-viewer-stage { position:relative; min-width:0; min-height:0; overflow:hidden; background:#fff; color:#333; }
.image-viewer-stage img { position:absolute; inset:16px; display:block; width:auto; height:auto; max-width:calc(100% - 32px); max-height:calc(100% - 32px); margin:auto; object-fit:scale-down; }
.image-viewer-stage p { padding:24px; margin:0; font-size:14px; color:inherit; }
.image-viewer[data-image-background="dark"] .image-viewer-stage { background:#18181b; color:#f5f5f5; }
body:has(.image-viewer[open]) { overflow:hidden; }

.attachment-download { font-size:20px; color:var(--muted); }
#refresh-button[aria-busy="true"] svg { animation:spin 1s linear infinite; }

.image-attachment .attachment-link {
  border:0;
  border-top:1px solid var(--line);
  border-radius:0;
}

.attachment-preview-unavailable {
  margin:0;
  padding:16px;
  font-size:14px;
  line-height:1.5;
  color:var(--muted);
}

.attachment-link {
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:10px;
  text-decoration:none;
  background:var(--surface-raised);
  max-width:100%;
  color:var(--green);
  min-height:70px;
}

.attachment-link:hover {
  background:var(--hover);
}

.attachment-link>svg {
  width:16px;
  height:16px;
  flex-shrink:0;
}

.attachment-info {
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
}

.attachment-name {
  font-size:14px;
  color:var(--green);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:100%;
}

.attachment-size {
  font-size:12px;
  color:var(--muted);
}

.detail-error {
  padding:60px 32px;
  text-align:center;
}

.detail-error h2 {
  font-size:19px;
  font-weight:500;
}

.detail-error p {
  font-size:14px;
  line-height:1.8;
  color:var(--muted);
  max-width:340px;
  margin:12px auto 22px;
}

.site-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  white-space:nowrap;
  overflow-x:auto;
  font-size:12px;
  color:var(--muted);
  padding:10px 2px 0;
  flex-shrink:0;
  scrollbar-width:thin;
  line-height:1.7;
}

.site-footer>span {
  flex-shrink:0;
}

.footer-credit {
  font-size:12px;
}

.footer-credit a {
  text-underline-offset:3px;
}

.footer-credit a:hover {
  color:var(--ink);
}

.noscript {
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  background:var(--warning-bg);
  padding:20px;
  text-align:center;
  font-size:14px;
  color:var(--warning-text);
  z-index:5;
}

@keyframes spin {
  to {
    transform:rotate(360deg);
  }
}

/* Loading placeholders preserve the layout without exposing fake messages. */
.skeleton-list { width:100%; padding:0 22px 8px; }
.skeleton-row { display:grid; gap:10px; padding:12px 0 14px; }
.skeleton { display:block; height:12px; border-radius:4px; background:var(--surface-raised); animation:skeleton-pulse 1.5s ease-in-out infinite alternate; }
.skeleton-short { width:38%; }
.skeleton-medium { width:72%; }
.skeleton-heading { width:80%; height:28px; margin-bottom:18px; }
.skeleton-message { padding:36px var(--message-gutter); display:grid; gap:14px; }
.skeleton-body { display:grid; gap:18px; margin-top:32px; }
@keyframes skeleton-pulse { to { opacity:.35; } }

button,a,input,select,textarea,summary {
  transition:background-color .15s ease,border-color .15s ease,color .15s ease;
}

/* The inbox owns the available screen height; only its two panes scroll. */
@media(max-width:1100px) {
  .page-shell { padding:16px 20px 10px; }
  .inbox { grid-template-columns:300px minmax(0,1fr); }
  .message-panel { --message-gutter:24px; }
  .theme-toggle { width:40px; padding:0; }
  .theme-label { display:none; }
  .footer-delivery { display:none; }
}

@media(max-width:820px) {
  .page-shell { padding:14px 12px 8px; min-height:600px; }
  .inbox-header { grid-template-areas:"title actions" "domain domain"; gap:10px; margin-bottom:12px; }
  .brand { display:block; }
  .page-title { font-size:22px; }
  .brand-subtitle { font-size:11px; margin-top:3px; }
  .header-actions { gap:8px; flex-wrap:nowrap; }
  .header-actions .connection-status { display:none; }
  .language-picker { padding:0 8px; font-size:13px; }
  .domain-label { font-size:12px; }
  .domain-info { gap:6px 10px; }
  .domain-values { gap:6px; }
  .domain-value { padding:2px 6px; }
  .inbox { display:block; border-radius:10px; }
  .mailbox-panel { height:100%; border-right:0; }
  .mailbox-heading { padding:14px 16px 10px; }
  .search-form { margin:0 16px 4px; }
  .search-form input { font-size:16px; }
  .mailbox-filters { margin:0 16px 6px; }
  .message-panel { --message-gutter:20px; display:none; height:100%; }
  .inbox.show-detail .mailbox-panel { display:none; }
  .inbox.show-detail .message-panel { display:flex; }
  .detail-toolbar { padding:6px 12px; gap:8px; }
  .message-header { padding-top:22px; }
  .message-header>h2 { font-size:22px; }
  .header-values { grid-template-columns:60px minmax(0,1fr); }
  .site-footer { gap:20px; font-size:11px; }
  .footer-credit { font-size:11px; }
  /* Keep language and theme available while giving the message the screen. */
  body:has(.inbox.show-detail) .page-shell { padding:10px 0 0; min-height:0; }
  body:has(.inbox.show-detail) .inbox-header { margin:0 14px 10px; grid-template-areas:"title actions"; }
  body:has(.inbox.show-detail) :is(.brand-subtitle,.domain-info,.site-footer) { display:none; }
  .inbox.show-detail { border-width:1px 0 0; border-radius:0; }
  .image-viewer { width:calc(100% - 24px); height:calc(100dvh - 24px); max-height:calc(100dvh - 24px); border-radius:10px; }
  .image-viewer-toolbar { gap:8px; padding:12px; flex-wrap:wrap; }
  .image-viewer-toolbar h2 { flex-basis:100%; }
  .image-viewer-toolbar #image-viewer-background { margin-left:auto; }
  .image-viewer-stage img { inset:12px; max-width:calc(100% - 24px); max-height:calc(100% - 24px); }
}

@media(max-width:380px) {
  .page-shell { padding-left:10px; padding-right:10px; }
  .inbox-header { grid-template-columns:minmax(0,1fr) auto; }
  .brand-subtitle { max-width:140px; }
  .domain-label { flex-basis:100%; }
  .header-actions { gap:6px; }
  .detail-toolbar { padding-inline:8px; gap:4px; }
  .detail-toolbar .icon-button { width:36px; }
  .download-link { font-size:12px; gap:4px; }
}

/* Shared text roles remain readable in both themes. */
.message-count,.list-time,.list-preview,.mailbox-bottom,.list-empty p,.detail-placeholder>p,.sender-info time,.message-meta dt,.header-details,.header-values dt,.attachments-note,.attachment-size,.detail-error p,.site-footer {
  color:var(--muted);
}

.domain-label,.download-link,.message-meta dd,.header-values dd,.attachment-name {
  color:var(--green);
}

.search-form input::placeholder {
  color:var(--muted);
}

.list-recipient {
  color:var(--green);
}

.selected .list-recipient {
  color:var(--green);
}

.recipient-chip {
  color:var(--green);
}

.list-footer p,.message-body.empty-body {
  color:var(--muted);
}

.retention-note {
  color:var(--warning-text);
}

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

.replies-section { border-top:1px solid var(--line); margin:0 var(--message-gutter); padding:28px 0 36px; }
.replies-section h3 { margin:0 0 18px; font-size:16px; }
.reply-note,.reply-meta,.reply-recipient { color:var(--muted); font-size:14px; line-height:1.7; overflow-wrap:anywhere; }
.reply-note:empty { display:none; }
.public-reply { padding:16px 0; border-bottom:1px solid var(--line); }
.reply-meta { margin:0 0 6px; }
.reply-address { font-size:14px; overflow-wrap:anywhere; }
.reply-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.7; font-size:16px; }
#reply-form label { display:block; font-size:14px; margin:16px 0 7px; }
#reply-form>label:first-child { margin-top:0; }
#reply-form input,#reply-form select,#reply-form textarea { width:100%; box-sizing:border-box; border:1px solid var(--line); border-radius:6px; padding:10px; color:var(--ink); background:var(--surface); font:inherit; }
#reply-form textarea { resize:vertical; min-height:130px; }
#reply-form { margin-top:18px; padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--surface-alt); }
.reply-actions { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin-top:12px; }
#reply-send { background:var(--ink); color:var(--page); border-color:var(--ink); }
#reply-send:hover:not(:disabled) { opacity:.85; }
#reply-close { min-height:40px; text-decoration:none; color:var(--muted); }
#reply-close:hover { color:var(--ink); }
#reply-character-count { margin:4px 0 0; text-align:right; font-size:12px; color:var(--muted); }
#reply-history:not(:empty) { margin-bottom:20px; }
.public-reply { border:1px solid var(--line); border-left:3px solid var(--border-accent); border-radius:8px; margin-top:12px; padding:16px 18px; background:var(--surface-alt); }
.reply-meta { font-size:12px; }
.reply-address { margin:8px 0; }
.replies-section h3 { margin-bottom:12px; }

.search-form input::-webkit-search-cancel-button { -webkit-appearance:none; }
#clear-search { position:absolute; right:3px; top:3px; width:38px; height:38px; }
#reset-filters { margin-top:18px; }
.message-navigation { display:flex; align-items:center; gap:2px; }
.message-navigation .icon-button:disabled { opacity:.3; cursor:default; }
.message-navigation .icon-button:disabled:hover { background:transparent; color:var(--muted); }
.back-button svg { width:17px; height:17px; }
.message-view-toolbar:has(#message-view-toggle[hidden]) { display:none; }
@media(forced-colors:active) {
  .message-item.selected { outline:2px solid Highlight; outline-offset:-2px; }
  .status-dot,.tiny-dot { background:CanvasText; }
}

.reply-badge { display:inline-flex; align-items:center; gap:4px; margin-left:auto; flex-shrink:0; color:var(--muted); font-size:12px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.reply-badge svg { width:14px; height:14px; flex-shrink:0; }
.reply-badge + .attachment-badge { margin-left:4px; }

.report-dialog { width:min(480px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); box-sizing:border-box; overflow:auto; padding:24px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.report-dialog::backdrop { background:rgba(0,0,0,.65); }
.report-dialog h2 { margin:0; font-size:20px; }
#report-subject { color:var(--muted); font-size:14px; overflow-wrap:anywhere; }
.report-dialog label { display:block; font-size:14px; margin:18px 0 6px; }
.report-dialog input,.report-dialog textarea { width:100%; box-sizing:border-box; padding:10px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:var(--page); font:inherit; font-size:16px; }
.report-dialog textarea { resize:vertical; }
#report-result { font-size:14px; }
#report-result:empty { display:none; }
.message-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.message-actions #download-raw { margin-left:0; }
#share-message { flex-shrink:0; }
#share-message .share-check-icon, #share-message.copied .share-link-icon { display:none; }
#share-message.copied .share-check-icon { display:block; }
@media(max-width:420px) {
  .back-button { min-width:36px; justify-content:center; }
  .back-button span { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
}

.captcha { margin:16px 0; min-width:0; }
.captcha p { margin:8px 0; color:var(--muted); font-size:13px; }
.captcha p:empty { display:none; }

.intro-body { padding:0 var(--message-gutter) 32px; font-size:15px; line-height:1.75; overflow-wrap:anywhere; }
.intro-body p { margin:0 0 20px; }
.intro-body p:last-child { margin-bottom:0; }
#retention-note { color:var(--muted); font-size:13px; }
#retention-note:empty { display:none; }

.brand-icon { width:26px; height:26px; flex-shrink:0; color:var(--ink); }
.pinned-label { display:inline-flex; align-items:center; gap:5px; }
.pinned-label svg { width:14px; height:14px; flex-shrink:0; }
@media(max-width:820px) {
  .brand-icon { width:24px; height:24px; }
}

.view-badge { display:inline-flex; align-items:center; gap:4px; margin-left:auto; flex-shrink:0; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.view-badge svg { width:14px; height:14px; }
.view-badge ~ .reply-badge, .view-badge ~ .attachment-badge { margin-left:0; }

#intro-custom-body { white-space:pre-wrap; margin-bottom:20px; }
#intro-default-body { margin-bottom:20px; }
