/* HyperiaMail dashboard: its own look, over the sheet it shares with the
   webmail (hyperiamail-ui/style.css), as the webmail has webmail.css.

   The same family as the webmail and the design kit, in the webmail's grey
   (its colour without a choice; the design kit's violet turned to grey by
   the webmail's tools/accents.py): a near-black side bar with the mark, the
   name and the wave of light at its foot; a soft grey page; white rounded
   cards with hairlines and small shadows; grey for the main actions, the
   selection and links. The polish of 30 November
   2026 holds here too: sentence case, no weight above 600, faint glows,
   motion only where something changes. */

/* ---- Colours and measures ------------------------------------------------ */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system,
    "Helvetica Neue", Roboto, Arial, sans-serif;

  --bg: #eef3fd;
  --surface: #ffffff;
  --text: #0b0f15;
  --muted: #5a6068;
  --border: #e1e7f1;
  --border-strong: #d0d5df;
  --hover: #eef3fc;
  --hover-strong: #e3e9f2;
  --line: #eaf0f9;
  --head: #f7faff;

  --accent: #5d626a;
  --accent-from: #656b73;
  --accent-text: #ffffff;
  --accent-soft: #e5eaf4;
  --accent-ink: #565d64;
  --ring: 0 0 0 3px rgba(93, 98, 106, 0.2);
  --accent-glow: rgba(95, 100, 108, 0.16);

  --shadow-sm: 0 1px 2px rgba(24, 29, 35, 0.05), 0 1px 3px rgba(24, 29, 35, 0.04);
  --shadow-md: 0 8px 24px rgba(24, 29, 35, 0.08);
  --shadow-lg: 0 20px 56px rgba(24, 29, 35, 0.2);

  --danger: #c4262e;
  --danger-soft: #fdecec;
  --danger-line: #f3c6c8;
  --ok: #18794e;
  --ok-soft: #e2f5ea;
  --warn: #8a5300;
  --warn-soft: #fff3dc;

  --side: #181d23;
  --side-glow: radial-gradient(260px 220px at 0 0, rgba(90, 96, 103, 0.55), transparent 70%);
  --side-ink: #ffffff;
  --side-soft: rgba(255, 255, 255, 0.82);
  --side-muted: rgba(255, 255, 255, 0.56);
  --side-hover: rgba(255, 255, 255, 0.07);
  --side-active: linear-gradient(90deg, #454a51 0%, #40454c 60%, #3c4148 100%);
  --side-edge: rgba(255, 255, 255, 0.07);

  --radius: 10px;
  --radius-lg: 16px;
  --sidebar: 248px;
  --topbar: 60px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
}
a {
  color: var(--accent-ink);
}

/* The mark's definitions take no room, and stay out of sight. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---- Frame: side bar, top bar, page ------------------------------------- */

.app-body {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  height: 100vh;
  min-height: 0;
  padding: 18px 14px 28px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  border-right: 0;
  background: var(--side-glow), var(--side);
  color: var(--side-ink);
  isolation: isolate;
}
.sidebar-art {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: -1;
  width: 100%;
  height: auto;
  aspect-ratio: 304 / 941;
  pointer-events: none;
  /* The navigation is long, so the wave passes behind it: kept faint
     enough for the links to read on it. */
  opacity: 0.5;
  /* Drawn in violet and blue: turned to grey, as the webmail's grey does. */
  filter: grayscale(1);
  -webkit-mask-image: linear-gradient(180deg, transparent 55%, #000 85%);
  mask-image: linear-gradient(180deg, transparent 55%, #000 85%);
}
.side-brand {
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
  padding: 2px 10px 14px;
  color: var(--side-ink);
  font-size: 19px;
  font-weight: 600;
  text-decoration: none;
}
.side-mark {
  flex: none;
  width: 30px;
  height: 32px;
  /* The mark is drawn in violet: grey here, as in the webmail's grey. */
  filter: grayscale(1);
}
.side-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--side-soft);
  font-size: 11.5px;
  font-weight: 500;
}

.nav {
  gap: 2px;
}
.nav-heading {
  margin: 18px 10px 6px;
  color: var(--side-muted);
  font-size: 12px;
  font-weight: 500;
}
.nav-link {
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--side-soft);
  font-size: 14px;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}
.nav-link .icon {
  flex: none;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}
.nav-link:hover {
  background: var(--side-hover);
  color: var(--side-ink);
}
.nav-link.active {
  background: var(--side-active);
  box-shadow: inset 0 0 0 1px var(--side-edge);
  color: var(--side-ink);
  font-weight: 500;
}
.nav-link.active .icon {
  opacity: 1;
}
.nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 1px;
}

.app-column {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  top: 0;
  height: var(--topbar);
  gap: 10px;
  padding: 0 32px;
  border-bottom: 1px solid transparent;
  background: rgba(238, 243, 253, 0.82);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}
/* The side bar carries the name on a computer. */
.topbar .brand {
  display: none;
}
.topbar-user {
  color: var(--muted);
  font-size: 13.5px;
}
.main {
  width: 100%;
  max-width: 1280px;
  padding: 8px 32px 48px;
}
.page-head {
  margin-bottom: 20px;
}
.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---- Cards -------------------------------------------------------------- */

.card {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card + .card,
.card + form,
form + .card,
.notice + .card {
  margin-top: 16px;
}
.card-head {
  margin-bottom: 12px;
}
/* Notes under a card, set apart from it. */
.card + p,
.card + .muted {
  margin-top: 16px;
}
.card-head h2,
.card-head h3 {
  font-size: 16px;
  font-weight: 600;
}
.card-flush {
  padding: 0;
  overflow: hidden;
}
.card-flush > .card-head {
  margin: 0;
  padding: 16px 20px 12px;
}
.empty {
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
}

/* ---- Tables ------------------------------------------------------------- */

.table th,
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.table th {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--head);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom-color: var(--border);
}
.table th:first-child,
.table td:first-child {
  padding-left: 20px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}
.table tbody tr {
  transition: background-color 140ms ease;
}
.table tbody tr:hover {
  background: var(--hover);
}
.card:not(.card-flush) .table {
  margin: 4px -22px -20px;
  width: calc(100% + 44px);
}
.card:not(.card-flush) .scroll-x .table {
  margin: 4px 0 0;
  width: 100%;
}
.card:not(.card-flush) .scroll-x {
  margin: 0 -22px -20px;
  overflow-y: hidden;
}

/* A header that sorts its column: the arrow shows how. */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}
.th-sort:hover {
  background: var(--hover-strong);
  color: var(--text);
}
.th-sort:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}
.th-sort .icon {
  width: 14px;
  height: 14px;
  opacity: 0.35;
}
th[aria-sort] .th-sort {
  color: var(--text);
}
th[aria-sort] .th-sort .icon {
  opacity: 1;
  color: var(--accent);
}

/* ---- Badges ------------------------------------------------------------- */

.badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: #eaeff8;
  color: #484e55;
  font-size: 12px;
  font-weight: 500;
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* ---- Buttons and fields ------------------------------------------------- */

.btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(24, 29, 35, 0.04);
  color: var(--text);
  font-weight: 500;
}
.btn:hover {
  border-color: #bfc4cd;
  background: var(--hover);
}
.btn-small {
  min-height: 30px;
  padding: 4px 11px;
  border-radius: 8px;
  font-size: 13px;
}
.btn-primary {
  border-color: #5d626a;
  background: linear-gradient(180deg, var(--accent-from), #595f66);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 4px 14px var(--accent-glow);
  color: var(--accent-text);
}
.btn-primary:hover {
  border-color: #565d64;
  background: linear-gradient(180deg, #6c717a, #5d626a);
}
.btn-danger {
  border-color: var(--danger-line);
  background: var(--surface);
  color: var(--danger);
}
.btn-danger:hover {
  border-color: #eaa3a7;
  background: var(--danger-soft);
}
/* Deleting for good: the one red button. */
.btn-danger-solid {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}
.btn-danger-solid:hover {
  border-color: #a81f26;
  background: #a81f26;
}

.input {
  border: 1px solid #dce2eb;
  border-radius: var(--radius);
  background: #f3f7ff;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}
.input:hover {
  border-color: var(--border-strong);
}
.input:focus {
  border-color: #868c94;
  background: var(--surface);
  box-shadow: var(--ring);
}
.field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ---- Notices ------------------------------------------------------------ */

.notice {
  border-radius: 12px;
}

/* ---- Overview tiles ----------------------------------------------------- */

.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.tile-value {
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tile-label {
  color: var(--muted);
  font-weight: 500;
}

/* ---- Deleting a user: what goes with them ------------------------------- */

.confirm-row td {
  background: var(--danger-soft);
}
.table tbody tr.confirm-row:hover {
  background: none;
}
.confirm-text {
  margin: 0 0 10px;
  color: var(--text);
}

/* ---- Mailboxes: reading a mailbox ---------------------------------------- */

.read-title {
  gap: 8px;
  margin-bottom: 12px;
  font-size: 16px;
}
.read-title .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}
.chip:hover {
  background: var(--hover);
}
.chip.active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}
.chip:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}
.chip-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.chip-count-quiet {
  background: var(--hover-strong);
  color: var(--muted);
}
.read-search {
  margin-top: 12px;
}
.read-search .input {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
}
.read-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}
.read-split > .card + .card {
  margin-top: 0;
}
.read-row {
  cursor: pointer;
}
.read-row:focus-visible {
  outline: 2px solid #868c94;
  outline-offset: -2px;
}
.table tbody tr.read-row.open {
  background: var(--accent-soft);
}
.read-row.unread .read-from,
.read-row.unread .read-subject > div:first-child {
  font-weight: 600;
}
/* Lists of mail fit their pane: fixed columns, long text cut with "…". */
.read-table {
  width: 100%;
  table-layout: fixed;
}
.read-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.read-table-3 th:nth-child(1) {
  width: 34%;
}
.read-table-3 th:nth-child(3),
.read-table-4 th:nth-child(4) {
  width: 92px;
}
.read-table-4 th:nth-child(1) {
  width: 28%;
}
.read-table-4 th:nth-child(2) {
  width: 26%;
}
.read-from {
  overflow: hidden;
  text-overflow: ellipsis;
}
.read-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.read-more {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.read-message {
  position: sticky;
  top: calc(var(--topbar) + 8px);
  max-height: calc(100vh - var(--topbar) - 24px);
  overflow-y: auto;
}
.read-message .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.read-facts {
  margin: 0 0 12px;
  font-size: 13.5px;
}
.read-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.read-files li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--head);
  font-size: 13px;
}
.read-files .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.read-text {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .read-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .read-message {
    position: static;
    max-height: none;
  }
}

/* ---- The admin inbox ------------------------------------------------------ */

.sidebar .nav-count {
  min-width: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--side-ink);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: center;
}
.read-title .spacer {
  flex: 1;
}
.read-title .btn .icon,
.read-actions .btn .icon {
  width: 15px;
  height: 15px;
}
.read-actions {
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.read-to {
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-text {
  min-height: 220px;
  font-family: var(--font);
  line-height: 1.55;
  resize: vertical;
}

/* ---- Sign-in page --------------------------------------------------------- */

.auth .brand {
  color: var(--text);
}

/* ---- Phones and narrow windows ------------------------------------------ */

@media (max-width: 760px) {
  .app-body {
    display: block;
  }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 12px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
    overflow: hidden;
  }
  .sidebar-art {
    display: none;
  }
  .side-brand {
    padding: 0 6px 8px;
    font-size: 17px;
  }
  .side-mark {
    width: 26px;
    height: 28px;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-link {
    min-height: 38px;
    white-space: nowrap;
  }
  .topbar {
    position: static;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }
  .main {
    padding: 4px max(12px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .page-title {
    font-size: 22px;
  }
  /* Wide tables scroll sideways rather than squeezing addresses. */
  .scroll-x > .table {
    min-width: 620px;
  }
  .scroll-x .break {
    overflow-wrap: normal;
    white-space: nowrap;
  }
  .card {
    padding: 16px;
  }
  .card:not(.card-flush) .table {
    margin: 4px -16px -16px;
    width: calc(100% + 32px);
  }
  .card:not(.card-flush) .scroll-x {
    margin: 0 -16px -16px;
  }
  .card:not(.card-flush) .scroll-x .table {
    margin: 4px 0 0;
  }
}
