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

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  font-size: var(--font-size);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: var(--color-brand-contrast);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--color-brand-hover);
}

.btn-danger {
  color: var(--color-danger);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
}

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

.btn-icon.is-active {
  color: var(--color-flag);
}

.split-button {
  display: inline-flex;
  position: relative;
}

.split-button .btn-primary:first-child {
  border-radius: var(--radius-small) 0 0 var(--radius-small);
}

.split-button .btn-primary:last-of-type {
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0 8px;
}

/* Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.field label {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.input,
.select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
}

.input:focus,
.select:focus {
  outline: 2px solid var(--color-brand);
  outline-offset: -1px;
}

.hint {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.row {
  display: flex;
  gap: 12px;
}

.row > * {
  flex: 1;
}

.row > .narrow {
  flex: 0 0 90px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

/* Login */

.login {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--color-sidebar);
}

.login-card {
  width: 340px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-popup);
}

.login-card .brand {
  margin-bottom: 24px;
  color: var(--color-text);
}

.login-card .btn {
  width: 100%;
  justify-content: center;
}

.form-error {
  min-height: 20px;
  margin: 8px 0;
  color: var(--color-danger);
  font-size: var(--font-size-small);
}

/* Layout */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) var(--list-w, 400px) minmax(0, 1fr);
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--color-brand);
  color: var(--color-brand-contrast);
  font-size: 13px;
  font-weight: 800;
}

/* Sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 10px;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
}

.sidebar .brand {
  padding: 0 8px 18px;
}

.sidebar .compose-button {
  justify-content: center;
  width: 100%;
  height: 40px;
  margin-bottom: 16px;
}

.nav {
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  margin: 14px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-sidebar-muted);
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--color-sidebar-muted);
  font-size: var(--font-size-small);
  text-align: left;
}

.nav-account .email {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-account.has-error {
  color: var(--color-danger);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-sidebar-text);
  text-align: left;
}

.nav-item:hover {
  background: var(--color-sidebar-active);
}

.nav-item.is-active {
  background: var(--color-sidebar-active);
  box-shadow: inset 3px 0 0 var(--color-brand);
}

.nav-item .label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .badge {
  font-size: 12px;
  font-weight: 600;
}

.nav-item.is-sub {
  height: 30px;
  padding-left: 26px;
  font-size: var(--font-size-small);
}

.account-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

.sidebar-footer {
  display: flex;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--color-sidebar-active);
}

.sidebar-footer .nav-item {
  flex: 1;
}

/* Message list */

.list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}

.list-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--color-border);
}

.list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.list-title h1 {
  flex: 1;
  margin: 0;
  font-size: var(--font-size-title);
}

.search {
  position: relative;
}

.search .icon {
  position: absolute;
  top: 9px;
  left: 10px;
  color: var(--color-text-muted);
}

.search .input {
  width: 100%;
  padding-left: 34px;
}

.list {
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.list-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  column-gap: 8px;
  padding: 11px 14px 11px 10px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

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

.list-item.is-selected {
  background: var(--color-selected);
}

.list-item .marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 5px;
}

.list-item .unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-unread-dot);
}

.list-item .sender,
.list-item .subject,
.list-item .snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .sender {
  grid-column: 2;
}

.list-item.is-unread .sender,
.list-item.is-unread .subject {
  font-weight: 700;
}

.list-item .meta {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.list-item .subject {
  grid-column: 2 / 4;
  margin-top: 2px;
}

.list-item .snippet {
  grid-column: 2 / 4;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.list-item .flag {
  color: var(--color-flag);
}

.list-empty {
  padding: 40px 20px;
  color: var(--color-text-muted);
  text-align: center;
}

.list-more {
  display: block;
  margin: 12px auto;
}

/* Reader */

.reader-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--color-surface);
}

.reader-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border);
}

.reader-toolbar .spacer {
  flex: 1;
}

.reader-toolbar .select {
  height: 32px;
  max-width: 180px;
}

.reader-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 40px;
}

.reader-subject {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.3;
}

.reader-head {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--color-brand-soft);
  color: var(--color-brand);
  font-weight: 700;
}

.reader-people {
  flex: 1;
  min-width: 0;
}

.reader-people .from-name {
  font-weight: 600;
}

.reader-people .from-addr,
.reader-people .recipients {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.reader-date {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  white-space: nowrap;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--color-text-muted);
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-small);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  font-size: var(--font-size-small);
}

.banner .btn {
  height: 28px;
}

.reader-body {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--color-border);
  background: #ffffff;
  border-radius: var(--radius-small);
}

.attachments {
  margin-top: 18px;
}

.attachments h3,
.thread h3 {
  margin: 0 0 8px;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  font-weight: 600;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-small);
}

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

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

.attachment .size {
  color: var(--color-text-muted);
}

.thread {
  margin-top: 26px;
}

.thread-item {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
  text-align: left;
}

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

.thread-item .who {
  flex: none;
  width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.thread-item .what {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
}

.thread-item .when {
  flex: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

/* Outbox list */

.outbox-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}

.outbox-item .top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.outbox-item .subject {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.outbox-item .when {
  color: var(--color-brand);
  font-size: var(--font-size-small);
  font-weight: 600;
  white-space: nowrap;
}

.outbox-item .when.is-failed {
  color: var(--color-danger);
}

.outbox-item .to {
  margin: 3px 0 8px 16px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.outbox-item .actions {
  display: flex;
  gap: 6px;
  margin-left: 16px;
}

.outbox-item .actions .btn {
  height: 28px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

/* Composer */

.composer {
  position: fixed;
  right: 24px;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 620px;
  height: 600px;
  max-height: calc(100vh - 24px);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-popup);
}

.composer.is-max {
  inset: 24px 24px 0 calc(240px + 24px);
  width: auto;
  height: auto;
}

.composer.is-min {
  height: 44px;
}

.composer.is-min .composer-body {
  display: none;
}

.composer-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 6px 0 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  cursor: pointer;
}

.composer-head .title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.composer-head .btn-icon {
  color: var(--color-sidebar-muted);
}

.composer-head .btn-icon:hover {
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-text);
}

.composer-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
}

.composer-row > label {
  flex: none;
  width: 44px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.composer-row .bare {
  flex: 1;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
}

.composer-row .link {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.recipients {
  position: relative;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.recipients input {
  flex: 1;
  min-width: 140px;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 13px;
  background: var(--color-hover);
  font-size: var(--font-size-small);
}

.chip.is-invalid {
  background: var(--color-brand-soft);
  color: var(--color-danger);
}

.chip button {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
}

.chip button:hover {
  background: var(--color-border);
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  width: 360px;
  max-width: 100%;
  margin: 0;
  padding: 4px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  box-shadow: var(--shadow-popup);
  list-style: none;
}

.suggestions li {
  padding: 7px 12px;
  cursor: pointer;
}

.suggestions li.is-active,
.suggestions li:hover {
  background: var(--color-hover);
}

.suggestions .addr {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.editor-toolbar {
  display: flex;
  gap: 2px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--color-border);
}

.editor-toolbar .btn-icon {
  width: 30px;
  height: 30px;
}

.editor {
  flex: 1;
  min-height: 0;
  padding: 14px 16px;
  overflow-y: auto;
  outline: 0;
  line-height: 1.5;
}

.editor blockquote {
  margin: 10px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--color-border);
  color: var(--color-text-muted);
}

.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
}

.composer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
}

.composer-footer .status {
  flex: 1;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 250px;
  padding: 6px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  box-shadow: var(--shadow-popup);
}

.menu-title {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.menu button {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}

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

.menu .when {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.menu .picker {
  display: flex;
  gap: 6px;
  padding: 6px 14px 8px;
}

.menu .picker .input {
  flex: 1;
  height: 32px;
}

.menu .picker .btn {
  height: 32px;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.modal {
  display: flex;
  flex-direction: column;
  width: 860px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 32px);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-popup);
}

.modal-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}

.modal-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
}

.tab.is-active {
  border-bottom-color: var(--color-brand);
  color: var(--color-text);
  font-weight: 600;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}

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

.account-row .status {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.account-row .status.is-error {
  color: var(--color-danger);
}

.form-card {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.form-actions .result {
  flex: 1;
  font-size: var(--font-size-small);
}

.result.is-ok {
  color: var(--color-success);
}

.result.is-error {
  color: var(--color-danger);
}

.signature-editor {
  min-height: 120px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #ffffff;
  color: #1a1a1a;
  outline: 0;
}

/* Toasts */

.toasts {
  position: fixed;
  bottom: 20px;
  left: 260px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

@media (max-width: 820px) {
  .toasts {
    left: 12px;
    right: 12px;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 280px;
  padding: 11px 14px 11px 18px;
  border-radius: var(--radius-small);
  background: #1c1c1e;
  color: #f2f2f2;
  box-shadow: var(--shadow-popup);
}

.toast .text {
  flex: 1;
}

.toast button {
  border: 0;
  background: transparent;
  color: #ff6b6f;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Small screens */

.only-mobile {
  display: none;
}

@media (max-width: 1100px) {
  .app[data-layout="columns"] {
    grid-template-columns: min(var(--sidebar-w, 240px), 210px) min(var(--list-w, 400px), 340px) minmax(0, 1fr);
  }

  .composer.is-max {
    left: 24px;
  }
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .reader-pane {
    display: none;
  }

  .app.show-sidebar .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 260px;
  }

  .app.show-reader .list-pane {
    display: none;
  }

  .app.show-reader .reader-pane {
    display: flex;
  }

  .only-mobile {
    display: inline-flex;
  }

  .composer,
  .composer.is-max {
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 0;
  }

  .reader-scroll {
    padding: 16px;
  }
}

/* Floating menus, selection, follow-ups */

.menu-floating {
  position: fixed;
  bottom: auto;
}

.list-item .select-box {
  display: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-brand);
  cursor: pointer;
}

.list-item:hover .select-box,
.list.has-selection .select-box {
  display: block;
}

.list-item:hover .unread-dot,
.list.has-selection .unread-dot {
  display: none;
}

.list-item.is-checked {
  background: var(--color-selected);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
}

.bulk-bar .count {
  flex: 1;
  font-weight: 600;
}

.snooze-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-small);
  background: var(--color-brand-soft);
  font-size: var(--font-size-small);
}

.snooze-note .btn {
  height: 28px;
  margin-left: auto;
}

.reader-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.reader-actions .btn {
  height: 28px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

.composer-footer .remind {
  height: 32px;
  max-width: 170px;
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.composer-footer .remind.is-on {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.template-row {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}

.mcp-url {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.mcp-url .input {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

/* Rich editor */

.rich-editor {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.rich-editor .editor-toolbar {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 2px;
}

.editor-sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--color-border);
}

.editor-select {
  height: 28px;
  max-width: 104px;
  margin: 0 2px;
  padding: 0 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  font-size: var(--font-size-small);
}

.editor-toolbar .btn-icon:disabled,
.editor-select:disabled {
  opacity: 0.35;
  cursor: default;
}

.editor-toolbar .btn-icon.is-active {
  background: var(--color-brand-soft);
  color: var(--color-brand);
}

.editor-toolbar .btn-icon.is-recording {
  background: var(--color-brand);
  color: var(--color-brand-contrast);
  animation: recording 1.2s ease-in-out infinite;
}

@keyframes recording {
  50% {
    box-shadow: 0 0 0 5px var(--color-brand-soft);
  }
}

.editor img {
  max-width: 100%;
  cursor: pointer;
}

.editor img:hover {
  outline: 2px solid var(--color-brand);
}

.editor h1,
.editor h2,
.editor h3 {
  margin: 0.5em 0 0.3em;
  line-height: 1.25;
}

.editor-source {
  flex: 1;
  min-height: 160px;
  padding: 12px 16px;
  border: 0;
  outline: 0;
  resize: none;
  background: var(--color-surface-alt);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(6, 26px);
  gap: 6px;
  padding: 6px 14px 10px;
}

.menu .swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 5px;
}

.size-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 8px;
}

.menu .size-buttons .btn {
  width: auto;
  height: 28px;
  padding: 0 10px;
}

.menu .picker .input[type="number"] {
  width: 64px;
  flex: none;
}

/* Settings: signatures */

.settings-editor .rich-editor {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #ffffff;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.settings-editor .editor {
  min-height: 140px;
  max-height: 340px;
}

.settings-editor .editor-toolbar {
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-small) var(--radius-small) 0 0;
}

.signature-card {
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  overflow: hidden;
}

.signature-card .head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.signature-card .head strong {
  flex: 1;
}

.signature-card .head .btn {
  height: 28px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

.signature-preview {
  padding: 12px 14px;
  background: #ffffff;
  color: #1a1a1a;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  overflow-x: auto;
}

.signature-preview img {
  max-width: 100%;
}

.assign-table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
}

.assign-table th,
.assign-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: var(--font-size-small);
}

.assign-table .select {
  width: 100%;
  height: 32px;
}

.builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
}

.builder .full {
  grid-column: 1 / -1;
}

.builder .field {
  margin-bottom: 10px;
}

.builder .logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.builder .logo-row img {
  max-height: 40px;
  max-width: 120px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #ffffff;
}

.composer-footer .signature-select {
  height: 32px;
  max-width: 150px;
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.composer-footer {
  flex-wrap: wrap;
  row-gap: 6px;
}

.wizard-result {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.wizard-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.wizard-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.wizard-dot.is-ok {
  background: var(--color-success);
}

.wizard-dot.is-error {
  background: var(--color-danger);
}

/* Smart inbox, rules, contacts, tracking */

.smart-tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  overflow-x: auto;
}

.smart-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 15px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  white-space: nowrap;
}

.smart-tab .icon {
  width: 15px;
  height: 15px;
}

.smart-tab.is-active {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  color: var(--color-brand);
  font-weight: 600;
}

.smart-tab .badge {
  font-weight: 700;
}

.tracking-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-small);
}

.track-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  cursor: pointer;
}

.track-toggle input {
  accent-color: var(--color-brand);
}

.list-action {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.contact-card {
  max-width: 620px;
}

.rule-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.rule-row {
  display: grid;
  grid-template-columns: 200px 170px 1fr 34px;
  gap: 8px;
  align-items: center;
}

.rule-row .select,
.rule-row .input {
  width: 100%;
}

.rule-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}

.rule-heading .select {
  width: auto;
}

.rule-summary {
  font-size: var(--font-size-small);
}

.blocked-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.rule-row.is-action {
  grid-template-columns: 200px 1fr 34px;
}

.password-field {
  position: relative;
}

.password-field .input {
  width: 100%;
  padding-right: 40px;
}

.password-field .btn-icon {
  position: absolute;
  top: 1px;
  right: 2px;
}

.nav-item.is-hidden {
  opacity: 0.55;
}

.nav-item.nav-more {
  color: var(--color-sidebar-muted);
  font-size: var(--font-size-small);
}

.list-older {
  padding-bottom: 12px;
  text-align: center;
}

.list-older .btn {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.list-older-note {
  margin-top: -4px;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

/* Labels */

.list-item {
  position: relative;
}

.label-bars {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  gap: 1px;
}

.label-bar {
  width: 4px;
  height: 100%;
}

.list-item .label-chips {
  grid-column: 2 / span 2;
  margin-top: 6px;
}

.label-chips,
.reader-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reader-labels {
  margin-bottom: 12px;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.label-chip.is-small {
  height: 20px;
  padding: 0 8px;
  font-size: 11.5px;
}

.label-swatch {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
}

.label-remove {
  display: inline-flex;
  margin: 0 -4px 0 0;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.label-remove .icon {
  width: 12px;
  height: 12px;
}

.label-remove:hover {
  background: rgba(0, 0, 0, 0.08);
}

.label-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: 1px dashed var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12.5px;
  cursor: pointer;
}

.label-add .icon {
  width: 13px;
  height: 13px;
}

.label-add:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.nav-label-bar {
  width: 4px;
  height: 18px;
  margin: 0 6px;
  flex: none;
  border-radius: 2px;
}

.nav-section.has-action {
  display: flex;
  align-items: center;
  margin-top: 18px;
}

.nav-section.has-action > span {
  flex: 1;
}

.nav-section-action {
  width: 22px;
  height: 22px;
  color: var(--color-sidebar-muted);
}

.nav-section-action:hover {
  color: var(--color-sidebar-text);
  background: var(--color-sidebar-active);
}

.menu.is-form {
  width: 280px;
  padding: 10px;
}

.label-picker .input {
  width: 100%;
  margin-bottom: 6px;
}

.label-options {
  max-height: 300px;
  overflow-y: auto;
}

.label-option {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.label-option:hover {
  background: var(--color-hover);
}

.label-option input {
  margin: 0;
  accent-color: var(--color-brand);
}

.label-option .name {
  flex: 1;
}

.label-option .label-swatch {
  width: 4px;
  height: 16px;
}

.label-option .when {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.menu .label-create,
.label-create {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  margin-top: 4px;
  padding: 0 8px;
  border: 0;
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
  color: var(--color-brand);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.label-form .field-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.label-form .field span {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.label-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.menu .label-color,
.label-color {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.menu .label-color.is-active,
.label-color.is-active {
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-text);
}

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

.label-form-actions .spacer {
  flex: 1;
}

.menu .label-form-actions .btn {
  width: auto;
  height: 32px;
  padding: 0 12px;
}

.menu .label-form-actions .btn {
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
}

.menu .label-form-actions .btn-primary {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-contrast);
}

.menu .label-form-actions .btn-primary:hover {
  background: var(--color-brand-hover);
}

.label-settings-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.label-settings-row .nav-label-bar {
  height: auto;
  margin: 0;
}

.label-settings-row .grow {
  flex: 1;
  min-width: 0;
}

.label-settings-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.label-settings-head .input {
  flex: 1;
}

.label-settings-row .label-colors {
  margin-bottom: 0;
}

.label-settings-row .hint {
  margin: 8px 0 0;
}

.outbox-item .countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 16px;
}

.countdown-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-border);
}

.countdown-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-brand);
  transition: width 0.9s linear;
}

.countdown-text {
  min-width: 150px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.countdown.is-soon .countdown-text {
  color: var(--color-brand);
  font-weight: 600;
}

.list-item .thread-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--color-hover);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

.list-server-search {
  padding: 12px 14px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-align: center;
}

.autoreply-card {
  margin-bottom: 16px;
  padding: 14px;
}

.autoreply-head {
  margin-bottom: 12px;
}

/* Calendar */

.reader-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(420px, 90%);
}

.reader-empty-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.today-agenda {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.agenda-day h3,
.agenda-group h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.agenda-day .hint {
  margin: 0;
}

.agenda-group {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--color-border);
}

.agenda-event {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 5px 0;
}

.agenda-bar {
  width: 4px;
  flex: none;
  border-radius: 2px;
}

.agenda-time {
  width: 92px;
  flex: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}

.agenda-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 20px;
}

.agenda-location {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.calendar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.calendar-row .grow {
  flex: 1;
  min-width: 0;
}

.calendar-color {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
}

.calendar-form-title {
  margin: 0 0 12px;
  font-size: 15px;
}

.calendar-howto {
  margin: 0 0 14px;
  padding-left: 18px;
  line-height: 1.6;
}

.tabs {
  overflow-x: auto;
}

.tab {
  flex: none;
  white-space: nowrap;
}

.translate-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-small);
}

.translate-bar .grow {
  flex: 1;
  min-width: 160px;
}

.btn-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.settings-group {
  margin: 18px 0 6px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.settings-group h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.settings-group .row .password-field {
  flex: 1;
}

.key-row .password-field {
  flex: 1;
}

.key-row .btn {
  flex: none;
}

.translate-always {
  margin: 0 0 14px;
}

.guard-backdrop {
  z-index: 120;
}

.modal.guard-modal {
  width: 460px;
  height: auto;
  padding: 20px 22px;
}

.guard-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-danger);
}

.guard-head h2 {
  margin: 0;
  color: var(--color-text);
  font-size: 18px;
}

.guard-list {
  margin: 14px 0 18px;
  padding-left: 20px;
  line-height: 1.5;
}

.guard-list li + li {
  margin-top: 6px;
}

.guard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Attachment preview */

.attachment .attachment-download {
  display: inline-flex;
  margin-left: 4px;
  padding: 2px;
  border-radius: 4px;
  color: var(--color-text-muted);
}

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

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 20, 0.88);
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #141414;
  color: #e6e6e6;
}

.preview-bar .btn-icon {
  color: #e6e6e6;
}

.preview-bar .btn-icon:hover {
  background: #262626;
}

.preview-next .icon {
  transform: scaleX(-1);
}

.preview-counter {
  min-width: 44px;
  font-size: var(--font-size-small);
  text-align: center;
}

.preview-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-bar .spacer {
  flex: 1;
}

.preview-body {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.preview-doc {
  width: min(1000px, 100%);
  height: 100%;
  border: 0;
  border-radius: 6px;
  background: #fff;
}

.preview-loading {
  color: #e6e6e6;
}

.smart-tab.smart-clean {
  margin-left: auto;
  border-style: dashed;
}

.cleanup-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}

.cleanup-item .top {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.cleanup-item .who {
  flex: 1;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cleanup-item .count {
  color: var(--color-brand);
  font-size: var(--font-size-small);
  font-weight: 600;
  white-space: nowrap;
}

.cleanup-item .to {
  margin: 3px 0 8px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cleanup-item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cleanup-item .actions .btn {
  height: 30px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

.cleanup-status {
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.cleanup-item.is-done {
  opacity: 0.55;
}

.cleanup-intro {
  text-align: left;
}

.security-banner {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #f5d38a;
  border-radius: var(--radius-small);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  font-size: var(--font-size-small);
}

.security-banner.is-danger {
  border-color: #f2b8b8;
  background: #fdecec;
  color: #9f1239;
}

.security-banner .icon {
  flex: none;
  margin-top: 1px;
}

.security-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
}

.security-banner ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
}

.invoice-intro {
  padding: 14px;
  border-bottom: 1px solid var(--color-border);
}

.invoice-intro .hint {
  margin: 0 0 12px;
}

.invoice-intro .field span {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.invoice-month {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.invoice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.invoice-head .name {
  flex: 1;
  font-weight: 600;
}

.invoice-head .count {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.invoice-head .sent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-success);
  font-size: var(--font-size-small);
  font-weight: 600;
}

.invoice-head .sent .icon {
  width: 14px;
  height: 14px;
}

.invoice-month .actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.invoice-month .actions .btn {
  height: 30px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

.invoice-files {
  margin-top: 8px;
}

.invoice-file {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

.invoice-file .name {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-size-small);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-file .name:hover {
  text-decoration: underline;
}

.invoice-file .btn-icon {
  width: 28px;
  height: 28px;
}

.menu.is-form.is-wide {
  width: 360px;
}

.task-form .field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.task-form .field span {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.task-form .row {
  display: flex;
  gap: 8px;
}

.task-form textarea {
  resize: vertical;
}

.task-request.is-done {
  opacity: 0.6;
}

.chip.is-link {
  border-color: #c7d7fe;
  background: #eef3ff;
}

.chip .chip-note {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

a.btn {
  color: var(--color-text);
  text-decoration: none;
}

a.btn-primary {
  color: var(--color-brand-contrast);
}


/* Layouts and splitters */

.sidebar,
.list-pane {
  position: relative;
}

.splitter {
  position: absolute;
  z-index: 5;
  background: transparent;
  touch-action: none;
}

.splitter-sidebar,
.splitter-list {
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
}

.splitter-row {
  display: none;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 6px;
  cursor: row-resize;
}

.splitter:hover,
.app.is-resizing .splitter:active {
  background: var(--color-brand);
  opacity: 0.35;
}

.app.is-resizing {
  user-select: none;
}

.app.is-resizing iframe {
  pointer-events: none;
}

.app[data-layout="bottom"] {
  grid-template-columns: var(--sidebar-w, 240px) minmax(0, 1fr);
  grid-template-rows: var(--list-h, 45%) minmax(0, 1fr);
}

.app[data-layout="bottom"] .sidebar {
  grid-row: 1 / span 2;
}

.app[data-layout="bottom"] .list-pane {
  border-right: 0;
  border-bottom: 1px solid var(--color-border);
}

.app[data-layout="bottom"] .splitter-list {
  display: none;
}

.app[data-layout="bottom"] .splitter-row {
  display: block;
}

.app[data-layout="list"] {
  grid-template-columns: var(--sidebar-w, 240px) minmax(0, 1fr);
}

.app[data-layout="list"] .splitter-list,
.app[data-layout="list"] .reader-pane {
  display: none;
}

.app[data-layout="list"].show-reader .list-pane {
  display: none;
}

.app[data-layout="list"].show-reader .reader-pane {
  display: flex;
}

.app[data-layout="list"] .reader-back {
  display: inline-flex;
}

.app[data-layout="focus"] {
  grid-template-columns: var(--list-w, 400px) minmax(0, 1fr);
}

.app[data-layout="focus"] .sidebar {
  display: none;
}

@media (max-width: 820px) {
  .app[data-layout] {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .splitter {
    display: none !important;
  }
}

.app[data-layout="focus"] .list-title .only-mobile {
  display: inline-flex;
}

.app[data-layout="focus"].show-sidebar .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: 260px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

/* Send and archive */

.send-archive {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  height: 36px;
  margin-left: 6px;
  padding: 0 10px;
  font-size: var(--font-size-small);
}

/* Search filters */

.search {
  position: relative;
}

.search-filter {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
}

.search .input {
  padding-right: 38px;
}

.menu-hint {
  max-width: 280px;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* List row extras */

.sender-color {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
}

.row-pin {
  display: inline-flex;
  margin-right: 4px;
  color: var(--color-brand);
  vertical-align: -2px;
}

.row-pin .icon {
  width: 13px;
  height: 13px;
}

/* Command palette */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.35);
}

.palette {
  width: min(620px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.palette-input {
  height: 54px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  font: 16px inherit;
  font-family: inherit;
  outline: none;
}

.palette-list {
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.palette-item.is-active {
  background: var(--color-hover);
}

.palette kbd {
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 11.5px;
  white-space: nowrap;
}

.palette.shortcuts {
  padding: 18px 22px;
  overflow-y: auto;
}

.palette.shortcuts h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.palette.shortcuts td {
  padding: 5px 16px 5px 0;
}

/* Attachments grid */

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.attachment-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.attachment-card:hover {
  border-color: var(--color-text-muted);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.attachment-visual {
  position: relative;
  height: 120px;
  overflow: hidden;
  background: var(--color-surface-alt);
}

.attachment-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-thumb.is-pdf {
  width: 100%;
  height: 400px;
  border: 0;
  pointer-events: none;
  background: #fff;
}

.attachment-thumb.is-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.attachment-thumb.is-icon .icon {
  width: 28px;
  height: 28px;
}

.attachment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-small);
}

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

.attachment-meta .size {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.attachment-meta .attachment-download {
  display: inline-flex;
  padding: 2px;
  border-radius: 4px;
  color: var(--color-text-muted);
}

.attachment-meta .attachment-download:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

/* Contact panel */

.reader-main {
  display: flex;
  flex: 1;
  min-height: 0;
}

.reader-main .reader-scroll {
  flex: 1;
  min-width: 0;
}

.contact-panel {
  width: 290px;
  flex: none;
  overflow-y: auto;
  padding: 18px 16px;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  font-size: 13px;
}

.contact-panel[hidden] {
  display: none;
}

.cp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.cp-name {
  font-size: 15px;
  font-weight: 700;
}

.cp-head .hint {
  overflow-wrap: anywhere;
}

.cp-section {
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}

.cp-section h4 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.cp-open {
  color: var(--color-brand);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.cp-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.cp-label {
  margin-bottom: 2px;
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.cp-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cp-color {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.cp-color.is-none {
  border: 1px dashed var(--color-text-muted);
  background: transparent;
}

.cp-color.is-active {
  box-shadow: 0 0 0 2px var(--color-surface-alt), 0 0 0 4px var(--color-text);
}

.cp-client {
  margin-bottom: 8px;
  font-weight: 700;
}

.cp-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fdecec;
  color: #9f1239;
  font-weight: 600;
}

.cp-alert .icon {
  width: 14px;
  height: 14px;
}

.cp-projects {
  margin: 0 0 8px;
  padding-left: 16px;
}

.cp-projects li {
  margin-bottom: 4px;
}

.cp-stage {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-hover);
  font-size: 11px;
}

.cp-updated {
  font-size: 11px;
}

.cp-mail {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 6px;
  width: 100%;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cp-mail:hover .cp-subj {
  text-decoration: underline;
}

.cp-dir {
  color: var(--color-text-muted);
}

.cp-subj {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-date {
  color: var(--color-text-muted);
  font-size: 11.5px;
}

@media (max-width: 1250px) {
  .contact-panel {
    width: 240px;
  }
}
