@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* jadid. "Cold Archive" palette */
:root {
  --bg: #f7f7f6;
  --fog: #ececea;
  --text: #141414;
  --muted: #5a5a58;
  --line: #dbdbd8;
  --accent: #b8802b;
  --on-accent: #141414;
  --hover: rgba(20, 20, 20, 0.05);
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fog: #1e1e1d;
    --text: #f7f7f6;
    --muted: #a3a39f;
    --line: #30302e;
    --hover: rgba(247, 247, 246, 0.06);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 2px;
}

h1,
h2 {
  letter-spacing: -0.02em;
  line-height: 1.2;
}

code {
  font-size: 0.9em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--fog);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.muted {
  color: var(--muted);
}

.hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.icon {
  flex: none;
  vertical-align: -3px;
}

.count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 19px;
  text-decoration: none;
  white-space: nowrap;
}

.brand-word {
  font-weight: 650;
  letter-spacing: -0.03em;
}

.brand-product {
  color: var(--muted);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

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

.button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.button-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  filter: brightness(1.06);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  color: var(--text);
  background: var(--hover);
}

.button-danger {
  border-color: var(--text);
}

.button-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.button-wide {
  width: 100%;
  min-height: 44px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button-row form,
.message-actions form {
  margin: 0;
}

/* Messages to the reader */
.flash {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fog);
  font-size: 14px;
}

.flash-error {
  border-color: var(--text);
  font-weight: 500;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--fog);
  font-size: 14px;
}

.notice-strong {
  border: 1px solid var(--text);
  font-weight: 500;
}

.empty {
  margin: 0;
  padding: 48px 8px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* Form fields */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.narrow {
  max-width: 400px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 14px;
  font-weight: 500;
}

.field input,
.field select,
.deliver-form select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fog);
  color: var(--text);
  font: inherit;
}

.field input:focus-visible,
.deliver-form select:focus-visible {
  outline-offset: 0;
}

/* Sign in */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-card h1 {
  margin: 40px 0 6px;
  font-size: 30px;
}

.auth-card > .muted {
  margin: 0 0 24px;
}

.auth-card form {
  margin-top: 8px;
}

.signed-in {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.signed-in p {
  margin: 0 0 6px;
}

/* Mail app shell */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'brand' 'accounts' 'compose' 'folders';
  align-content: start;
  gap: 16px;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--fog);
}

.sidebar > .brand {
  grid-area: brand;
  padding: 0 10px;
}

.sidebar > .accounts {
  grid-area: accounts;
}

.sidebar > .compose-button {
  grid-area: compose;
  min-height: 40px;
}

.sidebar > .folders {
  grid-area: folders;
}

.folders {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
}

.folder:hover {
  color: var(--text);
  background: var(--hover);
}

.folder.is-current {
  color: var(--text);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
}

.accounts {
  border-radius: var(--radius);
}

.accounts summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  list-style: none;
  cursor: pointer;
}

.accounts summary::-webkit-details-marker {
  display: none;
}

.accounts summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.accounts[open] summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.accounts summary:hover {
  background: var(--hover);
}

.accounts-current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.accounts-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
}

.accounts-menu {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.accounts-menu form {
  margin: 0;
}

.accounts-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.accounts-item:hover {
  color: var(--text);
  background: var(--hover);
}

.main {
  min-width: 0;
  padding: 28px 36px 64px;
}

/* Message list */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.list-header h1 {
  margin: 0;
  font-size: 26px;
}

.search input {
  width: 300px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fog);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.folder-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.folder-note p {
  margin: 0;
}

.message-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.message-row {
  border-bottom: 1px solid var(--line);
}

.message-link {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 20px;
  padding: 13px 12px 13px 22px;
  color: var(--muted);
  text-decoration: none;
}

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

.row-from,
.row-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-from,
.row-subject {
  color: var(--text);
}

.row-snippet::before {
  content: ' — ';
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-clip {
  display: inline-flex;
}

.is-unread .row-from,
.is-unread .row-subject {
  font-weight: 650;
}

.is-unread .row-meta {
  color: var(--text);
}

.is-unread .message-link::before {
  content: '';
  position: absolute;
  top: 21px;
  left: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
}

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

/* One message */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.message {
  max-width: 920px;
}

.message-subject,
.page-title {
  margin: 12px 0 16px;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.message-meta {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.message-meta div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
}

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

.message-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fog);
  font-size: 14px;
  text-decoration: none;
}

.attachment:hover {
  border-color: var(--muted);
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-body {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

/* Compose */
.compose {
  display: flex;
  flex-direction: column;
  max-width: 920px;
}

.compose-title {
  margin: 0 0 16px;
  font-size: 26px;
}

.field-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.field-row:focus-within {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.field-label {
  color: var(--muted);
  font-size: 14px;
}

.field-static {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.field-input {
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.field-input:focus-visible {
  outline: none;
}

.cc-bcc summary {
  padding: 11px 0 11px 84px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.cc-bcc summary:hover {
  color: var(--text);
}

.compose-body {
  width: 100%;
  min-height: 300px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.forwarded {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.forwarded legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.check {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}

.attach {
  margin-top: 16px;
  font-size: 14px;
}

.attach label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

.compose-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.compose-actions .button-primary {
  min-width: 110px;
  min-height: 40px;
}

.settings h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.settings > .muted {
  margin: 0 0 24px;
}

/* Admin */
.admin {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.admin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-header form {
  margin: 0 0 0 auto;
}

.tag {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin > .flash {
  margin-top: 16px;
}

.panel {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 19px;
}

.panel > .muted {
  margin: -8px 0 16px;
  font-size: 14px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.status {
  display: grid;
  grid-template-columns: 20px 90px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
}

.status-mark {
  font-weight: 700;
  text-align: center;
}

.status-ok .status-mark,
.status-idle .status-mark {
  color: var(--muted);
}

.status-label {
  font-weight: 500;
}

.status-bad .status-detail {
  font-weight: 500;
}

.create-mailbox {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 16px 20px;
}

.create-actions {
  grid-column: 1 / -1;
}

.address-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fog);
}

.address-input:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.field .address-input input {
  min-width: 0;
  border: 0;
  background: transparent;
}

.field .address-input input:focus-visible {
  outline: none;
}

.address-domain {
  padding-right: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data .actions {
  text-align: right;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.inline-form .field {
  flex: 1 1 280px;
  max-width: 420px;
}

.deliver-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deliver-form select {
  width: auto;
  height: 36px;
}

.admin .message-meta {
  margin-top: 8px;
}

.admin .button-row {
  margin-bottom: 16px;
}

/* Phones and narrow windows */
@media (max-width: 860px) {
  .app {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'brand compose' 'accounts accounts' 'folders folders';
    gap: 10px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar > .brand {
    align-self: center;
    padding: 0;
  }

  .sidebar > .compose-button {
    min-height: 36px;
  }

  .accounts summary {
    padding: 6px 0;
  }

  .accounts-item {
    padding: 9px 0;
  }

  .folders {
    flex-direction: row;
    gap: 6px;
    margin: 0 -16px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .folders::-webkit-scrollbar {
    display: none;
  }

  .folder {
    flex: none;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .folder.is-current {
    border-color: var(--text);
    box-shadow: none;
  }

  .main {
    padding: 16px 16px 48px;
  }

  .list-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .search,
  .search input {
    width: 100%;
  }

  .folder-note {
    flex-wrap: wrap;
  }

  .message-list {
    margin: 0 -16px;
  }

  .message-link {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'from meta' 'text text';
    gap: 2px 12px;
    padding: 12px 16px 12px 28px;
  }

  .is-unread .message-link::before {
    top: 20px;
    left: 12px;
  }

  .row-from {
    grid-area: from;
  }

  .row-meta {
    grid-area: meta;
  }

  .row-text {
    grid-area: text;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
  }

  .row-subject {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .row-snippet::before {
    content: '';
  }

  .message-subject,
  .page-title,
  .list-header h1,
  .compose-title {
    font-size: 22px;
  }

  .message-body {
    margin: 0 -16px;
    width: calc(100% + 32px);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .message-meta div {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .field-row {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .cc-bcc summary {
    padding-left: 72px;
  }

  .admin {
    padding: 16px 16px 64px;
  }

  .create-mailbox {
    grid-template-columns: minmax(0, 1fr);
  }

  .status {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .status-detail {
    grid-column: 2;
  }

  .deliver-form {
    flex-wrap: wrap;
  }
}

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