:root {
  color-scheme: light;
  --ink: #202d3b;
  --muted: #6d7883;
  --paper: #f6f7f5;
  --line: #e5e9e7;
  --accent: #147d70;
  --accent-soft: #e7f3ee;
  --danger: #b74343;
  font:
    14px/1.5 Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover,
.button:hover {
  background: #eef3f0;
  border-color: #c6d8d0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: var(--accent);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #62b9a7;
  outline-offset: 3px;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  padding: 9px 10px;
  min-width: 0;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
[hidden] {
  display: none !important;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}
.primary:hover {
  background: #106b60;
  color: white;
}
.quiet,
.icon-button {
  background: transparent;
  border-color: transparent;
}
.icon-button {
  font-size: 21px;
  line-height: 1;
  width: 40px;
  height: 40px;
  padding: 5px;
}
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 196px;
  color: var(--ink);
  text-decoration: none;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -1px;
}
.brand-symbol {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  width: 34px;
  height: 36px;
  font: italic 31px Georgia;
}
.brand-section {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-left: 5px;
}
.workspace-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.workspace-nav a {
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.workspace-nav a:hover {
  background: var(--paper);
  color: var(--ink);
}
.workspace-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.sidebar > #contacts-link,
.sidebar > a[href="/calendar"],
.sidebar-bottom > a[href="/settings"] {
  display: none;
}
#search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 580px;
  width: 100%;
  margin-right: auto;
  background: var(--paper);
  padding: 0 14px;
  border-radius: 9px;
}
#search-form > span {
  font-size: 26px;
  color: var(--muted);
}
#search {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 12px 0;
  outline-offset: 0;
}
#clear-search {
  padding: 3px 8px;
  font-size: 12px;
}
#status {
  margin: 0;
  padding: 0 28px;
  background: var(--accent-soft);
  color: #216b5d;
  font-size: 13px;
  line-height: 30px;
  min-height: 0;
}
#status:empty {
  display: none;
}
#status.error {
  background: #fff0ed;
  color: var(--danger);
}
main {
  display: grid;
  grid-template-columns: 248px minmax(290px, 365px) minmax(0, 1fr);
  height: calc(100dvh - 78px);
}
body:has(#status:not(:empty)) main {
  height: calc(100dvh - 108px);
}
.sidebar {
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border-right: 1px solid var(--line);
}
.mailbox-label,
.eyebrow,
.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--muted);
}
.mailbox-label {
  padding: 0 9px;
  margin-bottom: 8px;
}
#mailboxes {
  width: 100%;
  font-size: 13px;
  background: transparent;
  border-color: transparent;
  padding-left: 8px;
}
.compose-button {
  margin: 22px 0 20px;
  text-align: left;
  padding: 12px 17px;
}
.compose-button span {
  font-size: 20px;
  vertical-align: -1px;
  margin-right: 8px;
}
#folders {
  display: grid;
  gap: 3px;
}
.nav-button,
#folders button {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 12px;
  border: 0;
  background: transparent;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 7px;
  font-size: 13px;
  color: #596773;
}
#folders button.active {
  background: var(--accent-soft);
  color: #156d60;
  font-weight: 650;
}
#folders button:hover,
.nav-button:hover {
  background: #eaf0ec;
}
.nav-button > span:first-child,
.folder-icon {
  font-size: 17px;
  width: 19px;
  text-align: center;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 10px 5px;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 35px;
}
.sidebar-note {
  font-size: 11px;
  color: #8a9694;
  margin: 20px 10px 0;
}
.admin-link > span:last-child {
  margin-left: auto;
}
.list {
  background: white;
  border-right: 1px solid var(--line);
  overflow: auto;
}
.list-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 24px 18px;
}
.eyebrow {
  margin: 0 0 5px;
}
h1 {
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.7px;
  font-weight: 650;
  margin: 0;
}
h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
  line-height: 1.35;
  margin: 0 0 20px;
}
.count {
  font-size: 12px;
  color: var(--muted);
  background: var(--paper);
  border-radius: 6px;
  padding: 3px 9px;
}
.list-tools {
  padding: 0 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.list-tools select {
  border: 0;
  background: var(--paper);
  font-size: 12px;
  padding: 5px;
}
.check-label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.row-wrap {
  display: flex;
  border-bottom: 1px solid #edf0ee;
  position: relative;
}
.row-wrap.selected {
  background: #edf6f1;
}
.row-check {
  align-self: flex-start;
  margin: 24px 0 0 18px;
}
.row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  padding: 18px 20px 19px 12px;
  background: transparent;
  white-space: normal;
  min-width: 0;
}
.row:hover {
  background: #f6f9f7;
  border: 0;
}
.row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.row-from {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 450;
}
.row-date {
  font-size: 10px;
  color: #8a949c;
  white-space: nowrap;
}
.row strong {
  display: block;
  font-size: 13px;
  font-weight: 450;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #60707b;
}
.row.unread .row-from,
.row.unread strong {
  font-weight: 650;
  color: var(--ink);
}
.row.unread .row-from:before {
  content: "";
  display: inline-block;
  background: var(--accent);
  height: 6px;
  width: 6px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 2px;
}
.row-preview {
  display: block;
  font-size: 12px;
  color: #87918f;
  margin-top: 5px;
}
.row[aria-current="true"] {
  background: #edf6f1;
}
.row[aria-current="true"]:after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.reader {
  background: #fff;
  overflow: auto;
  min-width: 0;
  padding: 24px 36px;
}
.empty-reader {
  height: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  background: #f0f6f2;
  color: #80a798;
  font-size: 38px;
  border-radius: 23px;
  margin-bottom: 24px;
}
.empty-reader h2 {
  font-size: 21px;
  font-weight: 550;
  margin: 0 0 8px;
}
.empty-reader p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.reader-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
#back {
  font-size: 12px;
  padding-left: 0;
}
#message-heading {
  font-size: 27px;
  overflow-wrap: anywhere;
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: 20px;
}
.metadata {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  line-height: 1.9;
}
.toolbar {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar button,
.toolbar select {
  font-size: 12px;
}
#message-actions {
  margin: 18px 0 28px;
}
#body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.9;
  min-height: 80px;
}
#html-body {
  width: 100%;
  height: 550px;
  border: 0;
}
#html-body:not([hidden]) {
  display: block;
}
.message-more {
  position: relative;
}
.message-more summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.more-menu {
  position: absolute;
  right: 0;
  z-index: 2;
  top: 42px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px #20352a15;
  border-radius: 10px;
  padding: 10px;
  width: 230px;
  display: grid;
  gap: 8px;
}
.more-menu label {
  font-size: 12px;
  display: grid;
  gap: 4px;
}
.danger {
  color: var(--danger);
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}
.attachments button {
  font-size: 12px;
  white-space: normal;
  text-align: left;
}
.reader-footer {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin: 30px 0;
  display: flex;
  gap: 10px;
}
.reader-footer button {
  font-size: 12px;
}
.load-more {
  display: block;
  margin: 20px auto;
}
.empty-list {
  text-align: center;
  padding: 60px 28px;
  color: var(--muted);
}
.empty-list strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 10px;
}
.bulk-actions {
  padding: 8px 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.bulk-actions button {
  font-size: 11px;
  padding: 5px;
}
.bulk-actions > span {
  margin-right: auto;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  background: white;
  color: var(--ink);
  width: min(700px, 94vw);
  max-height: 90dvh;
  box-shadow: 0 30px 100px #16392b30;
}
dialog::backdrop {
  background: #1a2c3d66;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.dialog-heading h2 {
  margin: 0;
}
.dialog-heading .icon-button {
  margin-top: -5px;
}
#compose-form {
  display: grid;
  gap: 0;
}
#compose-fields {
  border: 0;
  padding: 0;
  min-width: 0;
}
#compose-from {
  font-size: 12px;
  margin: 0 0 15px;
}
.address-field {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.address-field input {
  flex: 1;
  width: 100%;
  border: 0;
  padding: 12px 3px;
  color: var(--ink);
}
.cc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.subject-field {
  border-bottom: 1px solid var(--line);
}
#compose-body {
  border: 0;
  resize: vertical;
  min-height: 240px;
  width: 100%;
  padding: 20px 0;
  line-height: 1.7;
  outline-offset: 2px;
}
.file-picker {
  font-size: 12px;
  display: block;
  color: var(--accent);
  cursor: pointer;
}
.file-picker input {
  font-size: 11px;
  padding: 6px;
  margin-left: 10px;
  max-width: 75%;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 14px;
}
#file-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#file-list button {
  font-size: 11px;
}
.composer-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 14px;
}
#compose-state {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.muted {
  color: var(--muted);
}
#panel-content form {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}
#panel-content label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}
#panel-content p {
  overflow-wrap: anywhere;
}
#panel-content pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 16px;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 12px;
}
#panel-content pre:empty {
  display: none;
}
.panel-row,
.queue-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.panel-row > strong {
  display: block;
}
.panel-row p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 12px;
}
.panel-row button {
  font-size: 12px;
  margin-right: 6px;
}
.queue-row p {
  font-size: 12px;
}
.queue-row button {
  font-size: 12px;
  margin-right: 8px;
}
.skip-link {
  position: fixed;
  top: -100px;
  z-index: 10;
  background: white;
  padding: 12px;
}
.skip-link:focus {
  top: 0;
}
.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;
}
@media (min-width: 1600px) {
  main {
    grid-template-columns: 260px 420px minmax(0, 1fr);
  }
  .reader {
    padding: 30px 60px;
  }
}
@media (max-width: 1100px) {
  main {
    grid-template-columns: 210px 310px minmax(0, 1fr);
  }
  .brand {
    min-width: 181px;
  }
  .reader {
    padding: 22px;
  }
  .reader-top {
    display: block;
  }
  .reader-top .toolbar {
    margin-top: 10px;
  }
  .sidebar {
    padding-left: 12px;
    padding-right: 12px;
  }
  .topbar {
    padding: 0 20px;
  }
}
@media (max-width: 850px) {
  .topbar {
    height: auto;
    min-height: 78px;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .workspace-nav {
    order: 3;
    width: 100%;
  }
  #search-form {
    order: 4;
    max-width: none;
    margin-right: 0;
  }
  .topbar #refresh {
    margin-left: auto;
  }
  main,
  body:has(#status:not(:empty)) main {
    height: auto;
    min-height: calc(100dvh - 150px);
  }
  main {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  .reader {
    display: none;
  }
  body.reading .reader {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }
  body.reading .list {
    display: none;
  }
  .brand {
    min-width: 165px;
  }
  .brand-section {
    display: none;
  }
  .topbar {
    gap: 8px;
  }
  .sidebar {
    padding-top: 18px;
  }
}
@media (max-width: 560px) {
  .topbar {
    padding: 10px 14px;
  }
  .brand {
    font-size: 21px;
    min-width: 0;
    margin-right: auto;
  }
  .brand-symbol {
    width: 29px;
    height: 31px;
    font-size: 26px;
  }
  #search-form {
    order: 4;
    position: static;
    width: 100%;
    max-width: none;
    background: #fff;
    border: 1px solid var(--line);
    min-height: 40px;
  }
  .topbar #logout {
    font-size: 12px;
  }
  .topbar #refresh {
    font-size: 25px;
  }
  main,
  body:has(#status:not(:empty)) main {
    height: auto;
    min-height: calc(100dvh - 66px);
    display: block;
  }
  .sidebar {
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: block;
  }
  .mailbox-label,
  .sidebar-heading,
  .sidebar-note {
    display: none;
  }
  #mailboxes {
    width: calc(100% - 147px);
    display: inline-block;
    font-size: 12px;
  }
  .compose-button {
    margin: 0 0 12px 8px;
    padding: 8px 10px;
    width: 135px;
    font-size: 12px;
  }
  .compose-button span {
    font-size: 15px;
    margin-right: 2px;
  }
  #folders {
    display: flex;
    overflow: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  #folders button {
    width: auto;
    white-space: nowrap;
    padding: 7px 12px;
  }
  .sidebar > .nav-button,
  .sidebar-bottom {
    display: inline-flex;
    width: auto;
    padding: 0;
    margin: 3px 0;
  }
  .sidebar-bottom .nav-button,
  .sidebar > .nav-button {
    width: auto;
    font-size: 11px;
    padding: 6px 8px;
  }
  .sidebar-bottom {
    flex-wrap: wrap;
  }
  .nav-button span:first-child {
    display: none;
  }
  .sidebar-bottom .admin-link {
    display: none;
  }
  .list {
    border: 0;
    overflow: visible;
  }
  .list-heading {
    padding: 20px;
  }
  .list-tools {
    padding-left: 18px;
    padding-right: 18px;
  }
  .reader {
    padding: 20px;
  }
  body.reading .sidebar,
  body.reading #search-form {
    display: none;
  }
  body.reading .reader {
    display: block;
  }
  .reader-top {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
  }
  .reader-top .toolbar {
    margin: 0;
  }
  .reader-top .toolbar button {
    font-size: 10px;
    padding: 7px;
  }
  #message-heading {
    font-size: 23px;
  }
  #status {
    padding: 0 14px;
    font-size: 11px;
    line-height: 1.5;
  }
  #status:not(:empty) {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  dialog {
    padding: 20px;
  }
  .composer-footer {
    flex-wrap: wrap;
  }
  #compose-state {
    width: 100%;
    margin: 0;
  }
  .cc-fields {
    gap: 10px;
  }
  #compose-body {
    min-height: 200px;
  }
}

.nav-button > svg,
#folders svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.empty-icon svg {
  width: 36px;
  height: 36px;
}
#panel-content label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-link > svg {
  margin: 0;
}
@media (max-width: 560px) {
  .sidebar .nav-button > svg {
    width: 14px;
    height: 14px;
  }
  .sidebar .nav-button {
    gap: 5px;
  }
}
@media (max-width: 560px) {
  .sidebar > .nav-button,
  .sidebar-bottom .nav-button {
    min-height: 40px;
    padding: 9px 10px;
    margin: 2px 3px;
    font-size: 12px;
    gap: 6px;
  }
  .sidebar > .nav-button {
    display: inline-flex;
  }
  .sidebar-bottom {
    gap: 2px;
    margin-top: 2px;
  }
  .sidebar-bottom .admin-link {
    display: inline-flex;
  }
  .sidebar .nav-button > svg {
    width: 15px;
    height: 15px;
  }
  #folders button {
    min-height: 40px;
  }
}

.invitation-card {
  margin: 20px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: white;
}
.invitation-card h2 {
  font-size: 20px;
  margin: 8px 0 16px;
}
.invitation-card p {
  overflow-wrap: anywhere;
}

#search-form select { max-width: 120px; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 6px 2px; }
#search-form select[hidden] { display: none; }
@media (max-width: 700px) { #search-form { flex-wrap: wrap; } #search-form input { min-width: 100px; flex: 1; } #search-form select { max-width: 110px; } }

#search-form input { min-width: 80px; flex: 1; width: auto; }
@media (max-width: 560px) {
  body.server-search #search-form { height: auto; min-height: 76px; padding: 4px 10px; gap: 2px 10px; }
  body.server-search #search-form input { flex-basis: calc(100% - 45px); min-width: 0; }
}
