*,
*::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: 16px 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 {
  position: relative;
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 16px;
}

.list-item .marker > * {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

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

.account-tag {
  display: inline-block;
  max-width: 110px;
  overflow: hidden;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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;
  top: 2px;
  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;
}

.quick-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.quick-filter .icon {
  width: 13px;
  height: 13px;
}

.quick-filter:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.quick-filter.is-active {
  border-style: solid;
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-surface);
}

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

.quick-clear .icon {
  width: 14px;
  height: 14px;
}

.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;
  }
}

/* ===== 0.9 – refreshed sidebar ===== */

.sidebar {
  --nav-h: 34px;
  --nav-font: 14px;
  --nav-icon: 18px;
  --nav-gap: 2px;
}

.sidebar[data-size='compact'] {
  --nav-h: 28px;
  --nav-font: 13px;
  --nav-icon: 16px;
  --nav-gap: 0px;
}

.sidebar[data-size='large'] {
  --nav-h: 40px;
  --nav-font: 15.5px;
  --nav-icon: 20px;
  --nav-gap: 3px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--nav-gap);
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-sidebar-active) transparent;
}

.nav > * {
  flex-shrink: 0;
}

.nav-item {
  height: var(--nav-h);
  padding: 0 10px 0 12px;
  border-radius: 9px;
  font-size: var(--nav-font);
  color: color-mix(in srgb, var(--color-sidebar-text) 88%, transparent);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-item .icon {
  width: var(--nav-icon);
  height: var(--nav-icon);
  flex: none;
  opacity: 0.8;
}

.nav-item:hover {
  background: color-mix(in srgb, var(--color-sidebar-active) 70%, transparent);
  color: var(--color-sidebar-text);
}

.nav-item.is-active {
  background: color-mix(in srgb, var(--color-brand) 16%, var(--color-sidebar));
  box-shadow: none;
  color: #fff;
  font-weight: 600;
}

.nav-item.is-active .icon {
  color: var(--color-brand);
  opacity: 1;
}

.nav-item .badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  color: var(--color-sidebar-muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.nav-item .badge.is-strong {
  background: var(--color-brand);
  color: #fff;
}

.nav-item.is-sub {
  height: calc(var(--nav-h) - 4px);
  padding-left: 22px;
  font-size: calc(var(--nav-font) - 1px);
}

.nav-section,
.nav-section.has-action {
  display: flex;
  align-items: center;
  margin: 16px 4px 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.nav > .nav-section:first-child {
  margin-top: 4px;
}

.nav-section-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-sidebar-muted);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
}

.nav-section-toggle:hover {
  color: var(--color-sidebar-text);
}

.nav-section-toggle .icon {
  width: 13px;
  height: 13px;
  transition: transform 0.15s ease;
}

.nav-section.is-collapsed .nav-section-toggle .icon {
  transform: rotate(-90deg);
}

.nav-account {
  margin-top: 4px;
  border-radius: 9px;
  font-size: calc(var(--nav-font) - 1px);
}

.nav-account:hover {
  background: color-mix(in srgb, var(--color-sidebar-active) 70%, transparent);
  color: var(--color-sidebar-text);
}

.sidebar .compose-button {
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--color-brand) 35%, transparent);
  font-weight: 600;
}

/* ===== 0.9 – message list ===== */

.list-item {
  transition: background-color 0.1s ease;
}

.list-item .meta {
  gap: 8px;
}

/* ===== 0.9 – composer ===== */

.composer-subject {
  padding: 14px 20px 4px;
}

.subject-big {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subject-big::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.composer-row {
  padding: 0 20px;
}

.composer .editor {
  padding: 8px 20px 14px;
}

.composer .rich-editor .editor,
.composer .rich-editor .editor-source,
.composer .rich-editor .quote-toggle {
  order: 1;
}

.composer .rich-editor .editor-toolbar {
  order: 2;
  margin: 0 12px 8px;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-alt);
}

.editor.quote-folded > blockquote[type='cite'] {
  display: none;
}

.quote-toggle {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  margin: 0 20px 10px;
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 12px;
}

.quote-toggle .dots {
  letter-spacing: 1px;
}

.quote-toggle:hover {
  color: var(--color-text);
}

.editor-toolbar .align-btn {
  width: auto;
  padding: 0 4px;
  gap: 1px;
}

.editor-toolbar .align-btn .icon:last-child {
  width: 12px;
  height: 12px;
}

.editor-toolbar .dictate-btn {
  width: auto;
  gap: 6px;
  padding: 0 12px 0 10px;
  border: 1px solid color-mix(in srgb, var(--color-brand) 45%, transparent);
  border-radius: 15px;
  color: var(--color-brand);
  font-weight: 700;
}

.editor-toolbar .dictate-btn:hover {
  background: var(--color-brand-soft);
  color: var(--color-brand);
}

.editor-toolbar .dictate-btn.is-recording {
  border-color: var(--color-brand);
}

.editor-toolbar .translate-btn {
  width: auto;
  gap: 4px;
  padding: 0 8px;
}

.translate-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.menu .menu-icon-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.menu .menu-icon-item .icon {
  width: 16px;
  height: 16px;
}

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

/* ===== 0.9 – undo toast with progress ===== */

.toast {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.toast.has-progress > :not(.toast-progress) {
  position: relative;
  z-index: 1;
}

.toast-progress {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.toast-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(232, 52, 59, 0.25), rgba(232, 52, 59, 0.6));
  transform-origin: left center;
}

/* ===== 0.9 – sidebar settings ===== */

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--color-surface-alt);
}

.segment {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.segment.is-active {
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  color: var(--color-text);
  font-weight: 600;
}

.sidebar-group h4 {
  margin: 18px 0 6px;
  color: var(--color-text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-setting {
  display: grid;
  grid-template-columns: 40px 20px 1fr 30px 30px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.sidebar-setting > .icon {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
}

.sidebar-setting .input {
  height: 32px;
}

.sidebar-setting .btn-icon {
  width: 30px;
  height: 30px;
}

.sidebar-setting .btn-icon:disabled {
  opacity: 0.25;
}

.sidebar-setting.is-off .input,
.sidebar-setting.is-off > .icon {
  opacity: 0.45;
}

.icon.is-up {
  transform: rotate(180deg);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--color-border);
  transition: background-color 0.15s ease;
}

.switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  content: '';
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--color-brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* ===== 0.9.1 – narrow (icon) sidebar ===== */

.app {
  transition: grid-template-columns 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app.is-resizing {
  transition: none;
}

.app.sidebar-mini {
  --sidebar-w: 72px !important;
}

.sidebar .brand {
  gap: 10px;
}

.sidebar .brand-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-toggle {
  width: 30px;
  height: 30px;
  color: var(--color-sidebar-muted);
}

.sidebar-toggle:hover {
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-text);
}

.icon.is-left {
  transform: rotate(90deg);
}

.icon.is-right {
  transform: rotate(-90deg);
}

.app.is-animating .sidebar {
  overflow: hidden;
}

.app.is-animating .sidebar .nav-item,
.app.is-animating .sidebar .nav-section,
.app.is-animating .sidebar .compose-button {
  animation: nav-slide-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes nav-slide-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
}

.sidebar-mini .sidebar {
  padding: 16px 10px;
}

.sidebar-mini .brand {
  flex-direction: column;
  padding: 0 0 12px;
}

.sidebar-mini .brand-name,
.sidebar-mini .nav-item .label,
.sidebar-mini .compose-button .label {
  display: none;
}

.sidebar-mini .compose-button {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  padding: 0;
  border-radius: 14px;
}

.sidebar-mini .nav-item {
  position: relative;
  justify-content: center;
  width: 48px;
  height: 44px;
  margin: 0 auto;
  padding: 0;
}

.sidebar-mini .nav-item .icon {
  width: 20px;
  height: 20px;
}

.sidebar-mini .nav-item .badge {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 16px;
  padding: 0 4px;
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-text);
  font-size: 10px;
  line-height: 16px;
}

.sidebar-mini .nav-item .badge.is-strong {
  background: var(--color-brand);
  color: #fff;
}

.nav-divider {
  height: 1px;
  margin: 8px 12px;
  background: var(--color-sidebar-active);
}

.sidebar-mini .sidebar-footer {
  flex-direction: column;
  align-items: center;
}

.sidebar-mini .sidebar-footer .nav-item {
  width: 48px;
}

.sidebar-mini .splitter-sidebar {
  display: none;
}

/* ===== 0.9.1 – selecting drafts ===== */

.drafts-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  font-size: var(--font-size-small);
}

.drafts-bar .checkbox {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.drafts-bar .checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-brand);
}

.drafts-bar .hint {
  color: var(--color-text-muted);
}

.btn-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn-small .icon {
  width: 15px;
  height: 15px;
}

.nav-section.is-primary {
  margin-top: 6px;
}

.nav-section.is-primary .nav-section-toggle {
  color: var(--color-sidebar-text);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

/* =====================================================================
   1.0 – new look (light, rounded, themeable). Overrides earlier rules.
   ===================================================================== */

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

button,
input,
select,
textarea {
  font-family: inherit;
}

/* Controls */

.btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: var(--color-card);
  color: var(--color-text);
  font-weight: 500;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--color-text) 18%, var(--color-border));
  background: var(--color-hover);
}

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

.btn-primary {
  box-shadow: var(--shadow-accent);
}

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

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

.btn-small {
  height: 32px;
  border-radius: 9px;
}

.btn-icon {
  border-radius: 10px;
  color: var(--color-text-muted);
}

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

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

.input,
.select,
textarea.input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-input-border);
  border-radius: 11px;
  background: var(--color-input);
  color: var(--color-text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

textarea.input {
  height: auto;
  padding: 10px 12px;
}

.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--color-brand);
  outline: 0;
  background: var(--color-card);
  box-shadow: 0 0 0 3px var(--color-brand-soft);
}

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

input[type='checkbox'] {
  accent-color: var(--color-brand);
}

/* Sidebar */

.sidebar {
  gap: 12px;
  padding: 16px 14px;
  border-right: 1px solid var(--color-border);
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
}

.sidebar .brand {
  padding: 0 4px;
  font-size: 15px;
}

.brand-mark {
  border-radius: 9px;
  background: var(--color-brand);
  color: var(--color-brand-contrast);
}

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

.greeting {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 16px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  animation: card-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.greeting.is-shown {
  animation: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.greet-hello {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.greet-date {
  margin-top: -6px;
  color: var(--color-text-muted);
  font-size: 12.5px;
}

.greet-date::first-letter {
  text-transform: uppercase;
}

.greet-weather {
  display: flex;
  align-items: center;
  gap: 12px;
}

.greet-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--color-brand-soft);
  color: var(--color-accent-text);
}

.greet-icon .icon {
  width: 22px;
  height: 22px;
}

.greet-temp {
  flex: 1;
  min-width: 0;
}

.greet-temp .deg {
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.greet-temp .what {
  margin-top: 3px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.greet-range {
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: right;
}

.greet-sun {
  display: flex;
  gap: 8px;
}

.greet-sun span {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 10px;
  background: var(--color-chip);
  font-size: 12.5px;
}

.greet-sun .icon,
.greet-names .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--color-text-muted);
}

.greet-names {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}

.greet-names .muted {
  color: var(--color-text-muted);
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.sidebar .compose-button {
  flex: 1;
  height: 46px;
  margin: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
}

.sidebar-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
}

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

.sidebar-refresh .icon {
  width: 20px;
  height: 20px;
}

.is-spinning .icon {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.nav-item {
  border-radius: 12px;
  color: var(--color-sidebar-text);
  font-weight: 500;
}

.nav-item .icon {
  color: var(--color-sidebar-muted);
  opacity: 1;
}

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

.nav-item.is-active {
  background: var(--color-brand-soft);
  color: var(--color-accent-text);
  font-weight: 600;
}

.nav-item.is-active .icon {
  color: var(--color-accent-text);
}

.nav-item .badge {
  color: var(--color-sidebar-muted);
}

.nav-item .badge.is-strong {
  background: var(--color-brand);
  color: var(--color-brand-contrast);
}

.nav-section-toggle {
  color: var(--color-sidebar-muted);
}

.nav-section-toggle:hover {
  color: var(--color-sidebar-text);
}

.nav-section.is-primary .nav-section-toggle {
  color: var(--color-sidebar-text);
}

.nav-account {
  color: var(--color-sidebar-muted);
}

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

.nav-divider {
  background: var(--color-border);
}

.sidebar-footer {
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.sidebar-mini .sidebar-actions {
  flex-direction: column;
  align-items: center;
}

.sidebar-mini .sidebar-refresh {
  width: 48px;
  height: 44px;
}

.sidebar-mini .nav-item .badge {
  background: var(--color-chip);
  color: var(--color-text);
}

/* Message list */

.list-pane {
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}

.list-header {
  padding: 18px 16px 12px;
  border-bottom: 0;
}

.list-title {
  gap: 8px;
  margin-bottom: 12px;
}

.list-heading {
  flex: 1;
  min-width: 0;
}

.list-title h1 {
  overflow: hidden;
  font-size: var(--font-size-title);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-subtitle {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 12.5px;
}

.list-refresh {
  height: 38px;
  border-radius: 12px;
  font-weight: 600;
}

.list-refresh .icon {
  width: 17px;
  height: 17px;
}

.search .input {
  height: 44px;
  padding-left: 42px;
  border-radius: 14px;
}

.search > .icon {
  top: 13px;
  left: 14px;
}

.search-filter {
  right: 6px;
  width: 34px;
  height: 34px;
}

.search-filter .icon {
  position: static;
}

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

.smart-tabs {
  gap: 0;
  margin-top: 12px;
  padding: 4px;
  border-radius: 12px;
  background: var(--color-chip);
}

.smart-tab {
  flex: 1;
  justify-content: center;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.smart-tab.is-active {
  border: 0;
  background: var(--color-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: var(--color-text);
  font-weight: 600;
}

.smart-tab.is-active .badge {
  color: var(--color-accent-text);
}

.smart-tab.smart-clean {
  flex: none;
}

.quick-filters {
  gap: 6px;
  margin-top: 10px;
}

.quick-filter {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.quick-filter.is-active {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-surface);
  font-weight: 600;
}

.list {
  padding: 0 8px 12px;
}

.list-item {
  grid-template-columns: 40px 1fr auto;
  column-gap: 12px;
  margin: 2px 0;
  padding: 12px 30px 12px 12px;
  border: 0;
  border-radius: 14px;
  transition: background-color 0.12s ease;
}

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

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

.list-item .marker {
  width: 40px;
}

.list-item .marker > * {
  top: 0;
  left: 0;
  transform: none;
}

.list-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.list-item .select-box {
  top: 10px;
  left: 11px;
  width: 18px;
  height: 18px;
}

.list-item:hover .list-avatar,
.list.has-selection .list-avatar {
  visibility: hidden;
}

.list-item .unread-dot {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-brand);
  transform: translateY(-50%);
}

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

.list-item .sender {
  font-size: 14px;
}

.list-item .subject {
  font-size: 13.5px;
}

.list-item .snippet {
  font-size: 12.5px;
}

.list-item .meta {
  font-size: 12px;
}

.drafts-bar {
  margin: 0 -8px 6px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* Reader */

.reader-pane {
  background: var(--color-bg);
}

.reader-toolbar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px 10px;
  border-bottom: 0;
}

.tool-group {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-card);
}

.tool-group .btn-icon {
  width: 34px;
  height: 34px;
}

.tool-group .btn-icon.has-label {
  width: auto;
  gap: 6px;
  padding: 0 12px 0 10px;
  color: var(--color-text);
  font-weight: 600;
}

.reader-toolbar .select {
  height: 38px;
  border-radius: 12px;
  background: var(--color-card);
}

.reader-scroll {
  padding: 0 20px 20px;
}

.reader-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100% - 4px);
  box-sizing: border-box;
  padding: 24px 28px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.reader-subject {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.reader-body {
  border: 0;
  border-radius: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  background: var(--color-brand-soft);
  color: var(--color-accent-text);
}

.tracking-note,
.banner,
.snooze-note {
  border-radius: 12px;
}

.contact-panel {
  margin: 0 20px 20px 0;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.reader-empty {
  background: var(--color-bg);
}

.quick-reply {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--color-input-border);
  border-radius: 16px;
  background: var(--color-input);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.quick-reply:focus-within {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-soft);
}

.quick-reply-input {
  flex: 1 1 240px;
  min-height: 38px;
  max-height: 180px;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 14.5px;
  line-height: 1.45;
  resize: none;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-mic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--color-brand-soft);
  color: var(--color-accent-text);
  font-weight: 700;
  cursor: pointer;
}

.quick-mic .icon {
  width: 16px;
  height: 16px;
}

.quick-mic.is-recording {
  background: var(--color-brand);
  color: var(--color-brand-contrast);
  animation: recording 1.2s ease-in-out infinite;
}

/* Composer */

.composer {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px 20px 0 0;
  background: var(--color-card);
  box-shadow: var(--shadow-popup);
}

.composer-head {
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-card);
  color: var(--color-text);
}

.composer-head .title {
  font-weight: 700;
}

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

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

.composer-row > label {
  color: var(--color-text-muted);
}

.composer-row select.bare {
  width: auto;
  max-width: 100%;
  height: 32px;
  flex: 0 1 auto;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
}

.recipients .chip,
.chip {
  border-radius: 15px;
  background: var(--color-chip);
}

.subject-big {
  font-size: 28px;
  font-weight: 800;
}

.composer .rich-editor .editor-toolbar {
  border-radius: 14px;
  background: var(--color-surface-alt);
}

.composer-footer {
  border-top: 1px solid var(--color-border);
}

.composer-footer .select,
.composer-footer select {
  border-radius: 11px;
}

/* Menus, dialogs, toasts */

.menu-floating,
.menu {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-card);
}

.menu button {
  border-radius: 9px;
}

.modal {
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-card);
}

.modal-backdrop {
  backdrop-filter: blur(3px);
}

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

.tab {
  margin-bottom: -1px;
  border-radius: 0;
}

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

.toast {
  border-radius: 14px;
}

/* New-mail pop-up */

.mail-popups {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 40px);
}

.mail-popup {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 10px 14px 14px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
  box-shadow: var(--shadow-popup);
  animation: popup-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mail-popup.is-leaving {
  animation: popup-out 0.22s ease both;
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.98);
  }
}

@keyframes popup-out {
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

.mail-popup-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-accent-text);
  font-size: 13px;
  font-weight: 700;
}

.mail-popup-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.mail-popup-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-popup-from {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-popup-subject {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13.5px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mail-popup-more {
  color: var(--color-text-muted);
  font-size: 12px;
}

.mail-popup-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.mail-popup-close:hover {
  background: var(--color-hover);
}

.mail-popup-close .icon {
  width: 16px;
  height: 16px;
}

/* Settings → Appearance */

.appearance h3 {
  margin: 22px 0 10px;
  font-size: 14.5px;
  font-weight: 700;
}

.appearance h3:first-child {
  margin-top: 4px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.theme-card,
.font-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.theme-card:hover,
.font-card:hover {
  box-shadow: var(--shadow-card);
}

.theme-card.is-active,
.font-card.is-active {
  border: 2px solid var(--color-brand);
  padding: 9px;
}

.theme-preview {
  display: flex;
  gap: 6px;
  height: 70px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 10px;
}

.tp-side {
  width: 22px;
  border: 1px solid;
  border-radius: 6px;
}

.tp-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border: 1px solid;
  border-radius: 6px;
}

.tp-bar {
  width: 60%;
  height: 6px;
  border-radius: 3px;
}

.tp-line {
  width: 90%;
  height: 5px;
  border-radius: 3px;
}

.tp-line.short {
  width: 70%;
}

.theme-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.font-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.font-card {
  gap: 4px;
  padding: 12px 14px;
}

.font-card.is-active {
  padding: 11px 13px;
}

.font-sample {
  font-size: 22px;
  font-weight: 700;
}

.font-name {
  color: var(--color-text-muted);
  font-size: 12px;
}

.appearance-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  padding: 4px 16px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
}

.settings-item + .settings-item {
  border-top: 1px solid var(--color-border);
}

.settings-item > span:first-child {
  flex: 1;
}

.settings-item .input {
  width: 220px;
}

.segment.is-active {
  background: var(--color-card);
}

.segmented {
  background: var(--color-chip);
}

@media (max-width: 820px) {
  .theme-grid,
  .font-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .appearance-row {
    grid-template-columns: 1fr;
  }
}

.modal .tabs {
  flex: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.modal .tab {
  flex: none;
}

.account-row {
  border-radius: 14px;
}

.toast-progress-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-brand) 30%, transparent), color-mix(in srgb, var(--color-brand) 70%, transparent));
}

.toast {
  background: #1c1c21;
}

/* ---------- 1.0.1 – signature card, animated weather ---------- */

.editor.signature-folded > .rm-signature {
  display: none;
}

.composer .rich-editor .compose-sig {
  order: 1;
}

.compose-sig {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 14px;
  background: var(--color-chip, var(--color-surface-alt));
  color: var(--color-text-muted);
  font-size: 13px;
}

.signature-card-bar {
  width: 4px;
  height: 28px;
  flex: none;
  border-radius: 2px;
  background: var(--color-brand);
}

.compose-sig .icon {
  width: 16px;
  height: 16px;
}

.compose-sig .spacer {
  flex: 1;
}

.compose-sig .signature-select {
  min-width: 0;
  max-width: 320px;
  height: 30px;
  padding: 0 26px 0 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background-color: transparent;
  color: var(--color-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.compose-sig .signature-select:hover,
.compose-sig .signature-select:focus {
  border-color: var(--color-border);
  background-color: var(--color-surface);
  outline: none;
}

.signature-card-toggle {
  border: 0;
  background: transparent;
  color: var(--color-accent-text, var(--color-brand));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.signature-card-toggle:hover {
  text-decoration: underline;
}

/* Weather icon animations */
.icon.wx * {
  transform-box: view-box;
}

.icon.wx circle.wx-flake {
  fill: currentColor;
  stroke: none;
}

.wx-spin {
  transform-origin: 12px 12px;
  animation: wx-spin 14s linear infinite;
}

.wx-spin-small {
  transform-origin: 7.5px 7.5px;
  animation-duration: 12s;
}

.wx-core {
  transform-origin: 12px 12px;
  animation: wx-pulse 3s ease-in-out infinite;
}

.wx-cloud {
  animation: wx-drift 5s ease-in-out infinite alternate;
}

.wx-drop {
  animation: wx-rain 1.1s linear infinite;
}

.wx-flake {
  animation: wx-snow 2.6s linear infinite;
}

.wx-d2 { animation-delay: -0.37s; }
.wx-d3 { animation-delay: -0.74s; }
.wx-flake.wx-d2 { animation-delay: -0.9s; }
.wx-flake.wx-d3 { animation-delay: -1.8s; }

.wx-fog {
  animation: wx-fog 3.5s ease-in-out infinite alternate;
}

.wx-fog2 {
  animation-direction: alternate-reverse;
}

.wx-bolt {
  animation: wx-flash 2.8s linear infinite;
}

@keyframes wx-spin {
  to { transform: rotate(360deg); }
}

@keyframes wx-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes wx-drift {
  from { transform: translateX(-0.8px); }
  to { transform: translateX(0.8px); }
}

@keyframes wx-rain {
  0% { transform: translate(0.4px, -2px); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-0.8px, 4px); opacity: 0; }
}

@keyframes wx-snow {
  0% { transform: translate(0, -2px); opacity: 0; }
  20% { opacity: 1; }
  50% { transform: translate(0.9px, 1.5px); }
  85% { opacity: 1; }
  100% { transform: translate(-0.6px, 5px); opacity: 0; }
}

@keyframes wx-fog {
  from { transform: translateX(-1.6px); }
  to { transform: translateX(1.6px); }
}

@keyframes wx-flash {
  0%, 62%, 74%, 100% { opacity: 0.25; }
  64%, 66% { opacity: 1; }
  68% { opacity: 0.3; }
  70%, 72% { opacity: 1; }
}


/* ---------- 1.0.2 – settings with a side menu instead of scrolling tabs ---------- */

.settings-modal {
  width: 1040px;
  height: 700px;
}

.settings-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.modal .tabs.settings-nav {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 2px;
  width: 210px;
  padding: 12px 10px;
  border-bottom: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  border-bottom-left-radius: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.modal .tabs.settings-nav::-webkit-scrollbar {
  display: none;
}

.settings-nav .tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-nav .tab .icon {
  width: 17px;
  height: 17px;
}

.settings-nav .tab:hover {
  background: var(--color-chip, var(--color-surface));
  color: var(--color-text);
}

.settings-nav .tab.is-active {
  border: 0;
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-weight: 600;
}

.settings-layout .modal-body {
  flex: 1;
  min-width: 0;
  padding: 22px 26px;
}

@media (max-width: 760px) {
  .settings-layout {
    flex-direction: column;
  }

  .modal .tabs.settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
  }

  .settings-nav .tab {
    width: auto;
    padding: 7px 10px;
  }
}

/* ---------- 1.0.4 – Gmail guide, sound picker ---------- */

.gmail-guide {
  margin: 4px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-brand);
  border-radius: 14px;
  background: var(--color-surface-alt);
}

.gmail-guide-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent-text, var(--color-brand));
}

.gmail-guide .hint {
  margin: 6px 0;
}

.gmail-guide ol {
  margin: 8px 0 10px;
  padding-left: 20px;
  line-height: 1.6;
}

.gmail-guide code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--color-chip, var(--color-surface));
  font-size: 12.5px;
}

.gmail-guide-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.gmail-guide-actions .btn {
  text-decoration: none;
}

.sound-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--color-border);
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.sound-card {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sound-card:hover {
  border-color: var(--color-brand);
}

.sound-card.is-active {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-weight: 600;
}

.sound-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-size: 9px;
}

.sound-card.is-active .sound-play {
  background: var(--color-brand);
  color: #fff;
}

.sound-volume {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}

.sound-volume input[type='range'] {
  flex: 1;
  max-width: 320px;
  accent-color: var(--color-brand);
}

.sound-volume-value {
  width: 42px;
  color: var(--color-text-muted);
}

/* ---------- 1.1 – spell check panel ---------- */

.proof-btn {
  width: auto;
  gap: 3px;
  padding: 0 6px;
}

.proof-btn .icon {
  width: 14px;
  height: 14px;
}

.proof-btn-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.composer .rich-editor .proof-panel {
  order: 1;
}

.proof-panel {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-card, var(--color-surface));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.proof-panel.is-clean .proof-title {
  color: #15803d;
}

.proof-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.proof-head .spacer {
  flex: 1;
}

.proof-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
}

.proof-title.is-busy .icon {
  animation: spin 1s linear infinite;
}

.proof-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.proof-item {
  padding: 8px 10px;
  border-left: 3px solid #dc2626;
  border-radius: 8px;
  background: var(--color-surface-alt);
  font-size: 13px;
}

.proof-item.is-grammar { border-left-color: #ea580c; }
.proof-item.is-style { border-left-color: #2563eb; }
.proof-item.is-typo { border-left-color: #64748b; }

.proof-kind {
  margin-bottom: 2px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.proof-context {
  color: var(--color-text-muted);
}

.proof-context mark {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(220, 38, 38, 0.14);
  color: var(--color-text);
  text-decoration: underline wavy #dc2626;
}

.proof-message {
  margin: 3px 0 6px;
}

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

.proof-fix,
.proof-skip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: var(--color-surface);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.proof-fix {
  border-color: transparent;
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-weight: 600;
}

.proof-fix:hover {
  background: var(--color-brand);
  color: #fff;
}

.proof-skip {
  color: var(--color-text-muted);
}

.proof-foot {
  font-size: 11.5px;
}

.composer .rich-editor .editor {
  min-height: 90px;
}

.proof-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--color-text-muted);
  font-size: 12.5px;
}

.proof-nav .btn-icon {
  width: 28px;
  height: 28px;
}

.proof-panel > .proof-item {
  flex: none;
}
.compose-sig { flex: none; }

/* ---------- 1.1 – waiting for reply ---------- */

.waiting-age {
  grid-column: 2 / -1;
  color: #c2410c;
  font-size: 12px;
  font-weight: 600;
}

.waiting-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 4px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.list-item:hover .waiting-done,
.waiting-done:focus-visible {
  opacity: 1;
}

.waiting-done:hover {
  border-color: #16a34a;
  color: #16a34a;
}

.waiting-done .icon {
  width: 13px;
  height: 13px;
}

.cp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

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

/* ---------- 1.1 – phone layout ---------- */

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

  .list-pane,
  .reader-pane {
    min-width: 0;
  }

  .smart-tabs,
  .quick-filters {
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .smart-tabs::-webkit-scrollbar,
  .quick-filters::-webkit-scrollbar {
    display: none;
  }

  .smart-tab,
  .quick-filters > * {
    flex: none;
  }
}

@media (max-width: 820px) {
  .contact-panel {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    width: auto;
    max-height: 78vh;
    margin: 0;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(20, 20, 30, 0.25);
  }

  .cp-close {
    position: absolute;
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 820px) {
  .reader-toolbar {
    flex-wrap: wrap;
    min-width: 0;
  }

  .reader-toolbar .tool-group {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .reader-toolbar .btn-icon {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 820px) {
  .app.show-sidebar .sidebar {
    width: min(300px, 86vw);
    overflow-y: auto;
    box-shadow: 12px 0 40px rgba(20, 20, 30, 0.25);
  }

  .app.show-sidebar .list-pane::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(20, 20, 30, 0.35);
  }
}

/* ---------- 1.1 – Claude in the reader ---------- */

.ai-group .btn-icon.has-label {
  color: var(--color-accent-text, var(--color-brand));
}

.ai-summary {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--color-brand) 30%, transparent);
  border-radius: 14px;
  background: var(--color-brand-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.ai-summary[hidden] {
  display: none;
}

.ai-summary-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--color-accent-text, var(--color-brand));
}

.ai-summary-head .spacer {
  flex: 1;
}

.ai-summary.is-busy .ai-summary-head .icon:first-child {
  animation: wx-pulse 1.2s ease-in-out infinite;
}

.ai-summary-body p {
  margin: 0 0 6px;
}

.ai-summary-body ul {
  margin: 0;
  padding-left: 18px;
}

.ai-reply-form {
  width: min(380px, calc(100vw - 32px));
}

.ai-reply-form .btn .icon {
  width: 15px;
  height: 15px;
}

/* ---------- 1.2 – attachments library ---------- */

.att-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 4px 10px;
  list-style: none;
}

.att-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.att-from {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent-text, var(--color-brand));
  font-size: 13px;
  font-weight: 600;
}

.att-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  padding: 10px 12px;
  border-radius: 12px;
  list-style: none;
  cursor: pointer;
}

.att-row:hover {
  background: var(--color-chip, var(--color-surface-alt));
}

.att-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 10px;
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-size: 11px;
  font-weight: 800;
}

.att-icon.is-image { background: #dcfce7; color: #166534; }
.att-icon.is-application { background: #fee2e2; color: #b91c1c; }

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

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

.att-meta,
.att-subject {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 1.2 – meeting times ---------- */

.meeting-form {
  width: min(400px, calc(100vw - 32px));
}

.meeting-prefs {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
}

.meeting-prefs label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.meeting-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  margin: 10px 0;
  overflow-y: auto;
}

.meeting-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  cursor: pointer;
}

.meeting-slot:hover {
  background: var(--color-chip, var(--color-surface-alt));
}

.meeting-slot span::first-letter {
  text-transform: uppercase;
}

.meeting-note {
  margin-bottom: 6px;
}

/* Forms inside floating menus (note to Centrala, AI reply, meeting times) */
.menu .task-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.menu .task-form > strong {
  font-size: 14px;
}

.menu .task-form .hint {
  margin: 0;
}

.menu .task-form .form-actions {
  display: flex;
  gap: 8px;
  margin: 0;
}

.menu .task-form .form-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
}

.menu .task-form .form-actions .btn-primary {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-contrast, #fff);
}

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

.menu .task-form .form-actions .btn:disabled {
  opacity: 0.55;
}

.menu .task-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.menu .task-form label.meeting-slot {
  flex-direction: row;
  font-size: 13.5px;
  color: var(--color-text);
}

/* ---------- 1.2 – morning report ---------- */

.briefing-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 4px 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--color-brand) 25%, transparent);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--color-brand-soft), var(--color-card));
  list-style: none;
}

.brief-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent-text, var(--color-brand));
}

.brief-head .spacer {
  flex: 1;
}

.brief-head .hint {
  color: var(--color-text-muted);
}

.brief-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.brief-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brief-stat {
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  font-size: 12.5px;
}

button.brief-stat {
  border-color: transparent;
  background: var(--color-brand);
  color: #fff;
  cursor: pointer;
}

.brief-events {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.brief-events .icon {
  width: 14px;
  height: 14px;
}

.brief-top {
  display: flex;
  flex-direction: column;
}

.brief-top button {
  display: flex;
  gap: 8px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.brief-top button:hover {
  background: var(--color-card);
}

.brief-from {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-subj {
  overflow: hidden;
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.briefing-time {
  width: 120px;
}

/* ---------- 1.2 – serial mail ---------- */

.serial-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 20px 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--color-brand-soft);
  color: var(--color-accent-text, var(--color-brand));
  font-size: 12.5px;
}

.serial-bar[hidden] {
  display: none;
}

.serial-text {
  flex: 1 1 220px;
}

.composer.is-serial .serial-toggle {
  color: var(--color-accent-text, var(--color-brand));
  font-weight: 600;
}

/* Rows are selected as whole mails, never as text */
.list-item,
.att-row,
.outbox-item {
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- 1.2.1 – loading state ---------- */

.list-skeleton {
  display: flex;
  gap: 12px;
  padding: 14px 12px;
  list-style: none;
}

.sk-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--color-chip, #eee);
  animation: sk-pulse 1.2s ease-in-out infinite;
}

.sk-lines {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding-top: 3px;
}

.sk-lines span {
  height: 10px;
  border-radius: 5px;
  background: var(--color-chip, #eee);
  animation: sk-pulse 1.2s ease-in-out infinite;
}

.sk-lines span:nth-child(1) { width: 45%; }
.sk-lines span:nth-child(2) { width: 80%; }
.sk-lines span:nth-child(3) { width: 65%; opacity: 0.7; }

@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Thin moving bar under the list header while new mail is being fetched */
.list-pane {
  position: relative;
}

.app.is-refreshing .list-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-brand), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: refresh-bar 1.1s linear infinite;
}

.list-header {
  position: relative;
}

@keyframes refresh-bar {
  from { background-position: -40% 0; }
  to { background-position: 140% 0; }
}

/* 1.2.4 – keyboard cursor while selecting with Shift+arrows */
.list-item.is-cursor {
  box-shadow: inset 3px 0 0 var(--color-brand);
}

/* 1.2.6 – search words highlighted in the list */
mark.search-hit {
  background: #ffe25a;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* 1.3.0 – full calendar: day, week and month views */
.cal-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 20px 12px;
  box-sizing: border-box;
}
.cal-pane > div:last-child,
.cal {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cal-back {
  align-self: flex-start;
  margin-bottom: 8px;
}
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cal-step {
  font-size: 22px;
  line-height: 1;
  width: 34px;
  height: 34px;
}
.cal-title {
  flex: 1;
  min-width: 160px;
  margin: 0 0 0 6px;
  font-size: 19px;
  font-weight: 650;
}
.cal-title::first-letter {
  text-transform: uppercase;
}
.cal-modes {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--color-hover);
}
.cal-mode {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--color-text-muted, inherit);
  cursor: pointer;
}
.cal-mode.is-active {
  background: var(--color-surface, #fff);
  color: var(--color-text, inherit);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.cal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface, #fff);
  overflow: hidden;
}
.cal-body.is-loading {
  opacity: 0.55;
}
.cal-error {
  padding: 24px;
}
.cal-head,
.cal-allday,
.cal-grid {
  display: grid;
}
.cal-head {
  border-bottom: 1px solid var(--color-border);
}
.cal-day-head {
  border: 0;
  background: transparent;
  font: inherit;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: inherit;
}
.cal-weekday {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
}
.cal-daynum {
  font-size: 18px;
  font-weight: 600;
  width: 32px;
  height: 32px;
  line-height: 32px;
  border-radius: 50%;
}
.cal-day-head.is-today .cal-daynum {
  background: var(--color-brand);
  color: var(--color-brand-contrast, #fff);
}
.cal-allday {
  border-bottom: 1px solid var(--color-border);
}
.cal-allday-label {
  font-size: 11px;
  opacity: 0.6;
  padding: 6px 4px;
  text-align: right;
}
.cal-allday-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border-left: 1px solid var(--color-border);
  min-width: 0;
}
.cal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.cal-hours {
  display: flex;
  flex-direction: column;
}
.cal-hour {
  position: relative;
  box-sizing: border-box;
}
.cal-hour span {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 11px;
  opacity: 0.6;
}
.cal-col {
  position: relative;
  border-left: 1px solid var(--color-border);
  background-image: repeating-linear-gradient(to bottom, var(--color-border) 0, var(--color-border) 1px, transparent 1px, transparent 44px);
}
.cal-col.is-today {
  background-color: var(--color-brand-soft, rgba(225, 6, 0, 0.04));
}
.cal-event {
  position: absolute;
  box-sizing: border-box;
  border: 0;
  border-left: 4px solid var(--cal-color, var(--color-brand));
  border-radius: 6px;
  background: color-mix(in srgb, var(--cal-color, #888) 16%, var(--color-surface, #fff));
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 3px 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-event:hover {
  background: color-mix(in srgb, var(--cal-color, #888) 26%, var(--color-surface, #fff));
}
.cal-event-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}
.cal-event-time,
.cal-event-place {
  font-size: 11.5px;
  opacity: 0.75;
}
.cal-event.is-short {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-top: 0;
  padding-bottom: 0;
}
.cal-event.is-short .cal-event-title,
.cal-event.is-short .cal-event-time {
  white-space: nowrap;
}
.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-brand);
  z-index: 2;
}
.cal-now::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-brand);
}
.cal-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  border-radius: 5px;
  padding: 2px 6px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.cal-chip:hover {
  background: var(--color-hover);
}
.cal-chip.is-all-day {
  color: #fff;
  font-weight: 550;
}
.cal-chip.is-all-day:hover {
  filter: brightness(0.93);
}
.cal-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cal-color, var(--color-brand));
}
.cal-chip-time {
  flex: none;
  opacity: 0.7;
}
.cal-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-month-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--color-border);
}
.cal-month-weekday {
  padding: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  text-align: center;
}
.cal-month {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-cell {
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  min-height: 84px;
  overflow: hidden;
  cursor: pointer;
}
.cal-cell:nth-child(7n) {
  border-right: 0;
}
.cal-cell:hover {
  background: var(--color-hover);
}
.cal-cell.is-other {
  opacity: 0.45;
}
.cal-cell-num {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  min-width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  margin-bottom: 2px;
}
.cal-cell.is-today .cal-cell-num {
  background: var(--color-brand);
  color: var(--color-brand-contrast, #fff);
}
.cal-more {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 6px;
  opacity: 0.75;
}
.cal-details {
  padding: 12px 14px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-details p {
  margin: 0;
  font-size: 13px;
}
.cal-details-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.cal-details-color {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}
.cal-details-text {
  white-space: pre-line;
  max-height: 160px;
  overflow: auto;
  opacity: 0.85;
}
.agenda-event.is-link {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
}
.agenda-event.is-link:hover {
  background: var(--color-hover);
}
.agenda-open {
  margin-top: 10px;
  gap: 6px;
}
.agenda-open-row {
  list-style: none;
  padding: 8px 12px 0;
}
@media (max-width: 820px) {
  .cal-pane {
    height: 100dvh;
    padding: 12px;
  }
  .cal-title {
    font-size: 16px;
  }
  .cal-mode {
    padding: 6px 10px;
  }
  .cal-cell {
    min-height: 64px;
    padding: 2px;
  }
  .cal-cell .cal-chip-time,
  .cal-month-weekday {
    font-size: 11px;
  }
}

/* 1.4.0 – AI assistant */
.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-row .search {
  flex: 1;
  min-width: 0;
}
.btn.ai-open {
  flex: none;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 650;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #7c3aed, #e10600);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.btn.ai-open:hover {
  filter: brightness(1.07);
}
.btn.ai-open .icon {
  color: #fff;
}
.modal.ai-assistant {
  width: 640px;
  height: auto;
  max-height: calc(100vh - 80px);
  padding: 18px 20px 20px;
  gap: 12px;
  overflow: auto;
  align-self: flex-start;
  margin-top: 10vh;
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-head h2 {
  margin: 0;
  font-size: 18px;
}
.ai-head kbd {
  font-size: 11px;
  opacity: 0.6;
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #e10600);
}
.ai-badge .icon {
  color: #fff;
}
.ai-context {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ai-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
  min-height: 84px;
}
.ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-actions .hint {
  font-size: 12px;
}
.ai-mic.is-recording {
  color: var(--color-danger, #e10600);
  animation: ai-pulse 1.2s ease-in-out infinite;
}
@keyframes ai-pulse {
  50% { opacity: 0.45; }
}
.ai-output:empty {
  display: none;
}
.ai-section h3 {
  margin: 4px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.ai-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.ai-example {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: inherit;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}
.ai-example:hover {
  background: var(--color-hover);
}
.ai-safety {
  font-size: 12px;
  margin: 4px 0 0;
}
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  color: var(--color-text-muted);
}
.ai-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  border-top-color: #7c3aed;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}
.ai-error {
  color: var(--color-danger, #e10600);
  white-space: pre-line;
}
.ai-answer {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--color-hover);
  white-space: pre-line;
  line-height: 1.5;
}
.ai-change-title {
  margin: 0 0 8px;
  font-weight: 600;
}
.ai-change-list {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 10px;
}
.ai-change-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1.2fr) minmax(0, 2fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.ai-change-row:last-child {
  border-bottom: 0;
}
.ai-change-from,
.ai-change-subject {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ai-change-from {
  font-weight: 600;
}
.ai-change-date {
  color: var(--color-text-muted);
  font-size: 12px;
}
.btn.btn-danger {
  background: var(--color-danger, #e10600);
  color: #fff;
  border-color: transparent;
}
.ai-write-btn {
  gap: 3px;
  width: auto;
  padding: 0 7px;
  color: #7c3aed;
}
.ai-write-label {
  font-size: 12px;
  font-weight: 700;
}
.ai-writer {
  width: 380px;
  max-width: calc(100vw - 32px);
}
.ai-writer textarea {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 820px) {
  .modal.ai-assistant {
    margin-top: 12px;
    width: calc(100vw - 16px);
    max-width: none;
    padding: 14px;
  }
  .btn.ai-open {
    padding: 0 11px;
  }
}

/* 1.4.0 – no sideways scrolling in the mail editor */
.composer .rich-editor .editor {
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
.composer .rich-editor .editor img {
  max-width: 100%;
  height: auto;
}
.composer .rich-editor .editor table {
  max-width: 100%;
}

/* 1.4.3 – recipient chips show the address next to the name */
.chip .chip-addr {
  margin-left: 6px;
  font-size: 0.86em;
  color: var(--color-text-muted);
}
.chip .chip-addr::before {
  content: '·';
  margin-right: 6px;
}
.ai-names {
  margin: -4px 0 0;
  font-size: 12.5px;
  color: #7c3aed;
}

/* 1.5.0 – first steps, provider help, first-start password */
.setup-card {
  max-width: 440px;
}
.setup-card .hint {
  margin: 0;
  line-height: 1.5;
}
.welcome-card {
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--color-brand-soft, #fdecec);
  line-height: 1.5;
}
.welcome-card strong {
  font-size: 16px;
}
.welcome-card ol {
  margin: 8px 0 0;
  padding-left: 20px;
}
.welcome-card.is-done {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #e9f8ef;
}
.welcome-card.is-done p {
  margin: 0;
}
.wizard-help {
  font-size: 13.5px;
  line-height: 1.5;
}
.wizard-help p {
  margin: 4px 0;
}
.wizard-help ul {
  margin: 0 0 6px;
  padding-left: 20px;
}
.provider-guide.is-warning {
  border-color: #f3b4b4;
  background: #fff4f4;
}
