@font-face {
  font-family: Inter;
  src: url('/fonts/InterVariable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
}

:root {
  color-scheme: light;
  font-family: var(--font-sans), sans-serif;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  color: var(--color-text);
  background: var(--color-surface-subtle);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  min-height: 32px;
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--text-sm);
  line-height: 16px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
button:hover { background: var(--color-surface-subtle); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 3px; }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-base);
  line-height: 18px;
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--color-ink); box-shadow: 0 0 0 3px #11111114; }
input:disabled, input:read-only { background: var(--color-surface-subtle); }
textarea { height: auto; padding: 12px; resize: vertical; line-height: var(--leading-snug); }
label { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); line-height: 16px; font-weight: var(--font-weight-medium); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-tight); }
h1, h2 { font-size: var(--text-lg); line-height: 24px; }
p { color: var(--color-text-secondary); }
a { color: var(--color-text); text-underline-offset: 3px; }
.icon, [data-icon] { display: inline-flex; width: 16px; height: 16px; flex: 0 0 16px; align-items: center; justify-content: center; }
.icon { vertical-align: middle; }
.icon-button { padding: 7px; width: 32px; height: 32px; flex: 0 0 32px; border-color: transparent; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-secondary); }
.primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-foreground); }
.primary:hover { background: var(--color-slate); border-color: var(--color-slate); }
.muted { color: var(--color-text-muted); font-weight: var(--font-weight-regular); }
.section-label { font-size: var(--text-xs); font-weight: var(--font-weight-medium); color: var(--color-text-muted); line-height: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: var(--text-md); font-weight: var(--font-weight-semibold); letter-spacing: var(--tracking-tight); line-height: 20px; white-space: nowrap; }
.brand-secondary { font-weight: var(--font-weight-regular); color: var(--color-text-secondary); }
.brand-mark, .brand-mark .icon { width: 24px; height: 24px; flex-basis: 24px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--color-sand-100); color: var(--color-ink); font-size: var(--text-xs); line-height: 16px; font-weight: var(--font-weight-medium); }
#app { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; gap: 24px; padding: 20px 12px; border-right: 1px solid var(--color-border); background: var(--color-surface-subtle); min-height: 0; overflow-y: auto; }
.sidebar > .brand { padding: 8px 10px 0; }
.mailbox-switcher { padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }
.mailbox-switcher select { height: 32px; font-size: var(--text-sm); padding-left: 10px; text-overflow: ellipsis; }
.sidebar nav, .sidebar-bottom { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav button, .sidebar-bottom > button { justify-content: flex-start; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); color: var(--color-text-secondary); text-align: left; font-weight: var(--font-weight-regular); }
.sidebar nav button .icon, .sidebar-bottom > button .icon { color: var(--color-text-muted); }
.sidebar nav button:hover, .sidebar-bottom > button:hover { background: var(--color-sand-100); }
.sidebar nav button[aria-current] { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 2px #0000000f; font-weight: var(--font-weight-medium); }
.sidebar nav button[aria-current] .icon { color: var(--color-ink); }
.sidebar-bottom { margin-top: auto; }
.sidebar-bottom > .section-label { padding: 0 10px 8px; }
#delete-inbox:hover { color: var(--color-danger); background: var(--color-danger-soft); }
.account-menu { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.account-menu .avatar { height: 28px; width: 28px; flex-basis: 28px; font-size: 10px; font-weight: var(--font-weight-semibold); }
.account-copy { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: 16px; }
.account-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--font-weight-medium); }
.account { font-size: var(--text-xs); line-height: 16px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 64px; flex: 0 0 64px; padding: 0 32px; }
.page-heading, .topbar-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading h1 { white-space: nowrap; }
.search { display: flex; flex-direction: row-reverse; align-items: center; gap: 8px; width: 260px; height: 40px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-surface); }
.search:focus-within { border-color: var(--color-ink); box-shadow: 0 0 0 3px #11111114; }
.search input { padding: 0; height: 36px; border: 0; background: transparent; font-size: var(--text-base); }
.search input:focus { box-shadow: none; }
.search button { border: 0; background: transparent; min-height: 24px; padding: 0; color: var(--color-text-muted); }
.workspace-content { flex: 1; min-height: 0; padding: 8px 32px 32px; }
.mail-workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow: hidden; }
.mail-list { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--color-border); }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--color-border); }
.list-header > div { min-width: 0; }
.list-header h2 { display: flex; align-items: center; gap: 8px; font-size: var(--text-base); line-height: 22px; letter-spacing: 0; }
.list-header p { margin-top: 4px; color: var(--color-text-muted); font-size: var(--text-xs); line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; background: var(--color-surface-subtle); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-weight-medium); color: var(--color-text-secondary); }
.threads { flex: 1; min-height: 0; overflow: auto; }
.thread { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 20px 16px; border: 0; border-bottom: 1px solid var(--color-border); border-radius: 0; text-align: left; background: var(--color-surface); font-weight: var(--font-weight-regular); }
.thread.selected { background: var(--color-surface-subtle); }
.thread:focus-visible { outline-offset: -3px; }
.thread-copy { flex: 1; min-width: 0; }
.thread-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--font-weight-medium); }
.thread.unread .sender, .thread.unread .subject { font-weight: var(--font-weight-semibold); }
.time { display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); white-space: nowrap; font-size: var(--text-xs); font-weight: var(--font-weight-regular); }
.unread-dot { height: 6px; width: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--color-ink); }
.subject { margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 18px; }
.preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--color-text-muted); font-size: var(--text-sm); line-height: var(--leading-tight); }
.reader { min-width: 0; min-height: 0; overflow: auto; outline: 0; }
.conversation { min-height: 100%; display: flex; flex-direction: column; }
.reader-header { padding: 24px; border-bottom: 1px solid var(--color-border); }
.reader-heading { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.eyebrow { color: var(--color-text-muted); font-size: var(--text-xs); line-height: 16px; }
.reader-header h2 { margin-bottom: 16px; overflow-wrap: anywhere; }
.reader-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.reader-tools button { padding: 7px 12px; }
.message { padding: 24px; border-bottom: 1px solid var(--color-border); }
.message-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-size: var(--text-sm); line-height: 18px; }
.message-sender { flex: 1; min-width: 0; }
.message-head strong { display: block; font-weight: var(--font-weight-medium); overflow-wrap: anywhere; }
.message-head p { color: var(--color-text-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.message-head time { color: var(--color-text-muted); font-size: var(--text-xs); white-space: nowrap; align-self: flex-start; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-base); line-height: var(--leading-normal); }
.message-details { margin-top: 20px; font-size: var(--text-sm); }
.message-details summary { color: var(--color-text-secondary); cursor: pointer; }
.message-details pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: var(--radius-sm); background: var(--color-surface-subtle); font-size: var(--text-xs); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.reply-button { align-self: flex-start; margin: 24px; }
.empty-wrap { flex: 1; min-height: 260px; display: grid; place-items: center; padding: 24px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 24px; text-align: center; border: 1px dashed var(--color-border); border-radius: var(--radius-md); width: 100%; max-width: 384px; }
.empty > .icon { height: 32px; width: 32px; flex-basis: 32px; color: var(--color-text-muted); margin-bottom: 4px; }
.empty h2 { font-size: var(--text-base); line-height: 18px; font-weight: var(--font-weight-medium); letter-spacing: 0; }
.empty p { color: var(--color-text-muted); font-size: var(--text-sm); line-height: var(--leading-tight); }
.empty button { margin-top: 8px; }
.threads > .empty-wrap { min-height: 260px; padding: 20px 16px; }
.load-more { align-self: center; margin: 16px; }
.badge { display: inline-flex; padding: 3px 10px; border-radius: var(--radius-full); background: var(--color-surface-subtle); color: var(--color-text-secondary); font-size: var(--text-xs); line-height: 16px; font-weight: var(--font-weight-medium); white-space: nowrap; }
.badge[data-status=active], .badge[data-status=verified] { color: var(--color-success); background: var(--color-success-soft); }
.badge[data-status=pending] { color: var(--color-warning); background: var(--color-warning-soft); }
.badge[data-status=disabled], .badge[data-status=failed] { color: var(--color-danger); background: var(--color-danger-soft); }
.warning { background: var(--color-warning-soft); color: var(--color-warning); padding: 12px 16px; border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: 16px; }
.error { color: var(--color-danger); font-size: var(--text-sm); line-height: var(--leading-tight); white-space: pre-wrap; }
.error:empty { display: none; }
#notice { position: fixed; z-index: 50; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--radius-md); background: var(--color-ink); color: var(--color-white); box-shadow: 0 8px 24px #00000029; font-size: var(--text-sm); line-height: 18px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--color-background); }
.login-card { width: 100%; max-width: 440px; padding: 32px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.login-card .brand { margin-bottom: 32px; }
.login-intro { margin-bottom: 24px; }
.login-intro h1 { font-size: var(--text-xl); line-height: var(--leading-relaxed); margin-bottom: 8px; }
.login-intro p { font-size: var(--text-base); line-height: var(--leading-snug); }
.login-card .primary { width: 100%; height: 40px; font-size: var(--text-base); margin-top: 20px; }
.login-card .error { margin-top: 16px; }
#access-login a { display: block; margin-top: 16px; }
dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text); box-shadow: 0 24px 48px #00000024; }
dialog::backdrop { background: #11111140; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-description { margin: 6px 0 24px; font-size: var(--text-base); line-height: var(--leading-snug); overflow-wrap: anywhere; }
dialog label { margin: 16px 0; }
dialog footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 24px; }
dialog footer button { font-size: var(--text-base); line-height: 18px; min-height: 40px; padding: 10px 16px; }
dialog .error { margin-top: 12px; }
#compose-dialog { width: min(600px, calc(100vw - 32px)); }
#compose-from { font-size: var(--text-sm); }
.attachment-label > span { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.attachment-label input { font-size: var(--text-sm); padding: 7px 8px; height: auto; }
input::file-selector-button { font: inherit; padding: 4px 8px; margin-right: 8px; border: 0; border-radius: var(--radius-full); background: var(--color-surface-subtle); color: var(--color-text-secondary); cursor: pointer; }
.wide-dialog { width: min(760px, calc(100vw - 32px)); }
.domain-form { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.domain-form label { flex: 1; margin: 0; }
.domain-form button { height: 40px; }
.domain-card { padding: 16px 0; border-top: 1px solid var(--color-border); }
.domain-card header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: var(--text-sm); }
.domain-card header strong { flex: 1; overflow-wrap: anywhere; font-weight: var(--font-weight-medium); }
.table-scroll { width: 100%; overflow-x: auto; }
.domain-card table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: var(--text-xs); line-height: 18px; margin-top: 16px; }
.domain-card th, .domain-card td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }
.domain-card th { background: var(--color-surface-subtle); color: var(--color-text-muted); font-weight: var(--font-weight-medium); }
.domain-card th:first-child { width: 12%; }
.domain-card th:last-child { width: 18%; }
.mobile-only, .reader-back { display: none; }
@media (max-width: 1024px) {
  .topbar { padding-inline: 24px; }
  .workspace-content { padding: 8px 24px 24px; }
  .mail-workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .search { width: 220px; }
  .message-head { flex-wrap: wrap; }
  .message-head time { width: 100%; padding-left: 44px; }
  .reader-tools { gap: 4px; }
  .reader-tools button { padding-inline: 8px; }
}
@media (max-width: 1023px) {
  .reader-back { display: inline-flex; }
  .mail-workspace { grid-template-columns: minmax(0, 1fr); }
  .mail-list { border-right: 0; }
  .reader { display: none; }
  .mail-workspace.reading .mail-list { display: none; }
  .mail-workspace.reading .reader { display: block; }
}
@media (max-width: 767px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 31; visibility: hidden; transform: translateX(-100%); }
  #app.menu-open .sidebar { visibility: visible; transform: translateX(0); }
  #close-menu { margin-left: auto; }
  #sidebar-backdrop { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #11111140; z-index: 30; }
  .topbar { padding: 16px; height: auto; flex: 0 0 auto; min-height: 112px; flex-wrap: wrap; gap: 12px; }
  .page-heading { width: 100%; }
  .topbar-actions { width: 100%; }
  .search { width: auto; flex: 1; }
  .topbar-actions > .primary { min-height: 40px; }
  .workspace-content { padding: 0 16px 16px; }
  .reader-header, .message { padding: 20px; }
  .reader-tools { gap: 8px; }
  .reply-button { margin: 20px; }
  .thread { padding: 20px 16px; }
  dialog { max-height: calc(100dvh - 32px); padding: 24px; }
  .domain-form { flex-wrap: wrap; }
  .domain-form label { flex-basis: 100%; }
  .domain-form button { margin-left: auto; }
  .login-card { padding: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms ease, color 120ms ease; }
}
