:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: #e9eef5;
  color: #172033;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 320px;
  background: #eef2f7;
}

button,
input,
a {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  display: inline-grid;
  width: 1.2em;
  height: 1.2em;
  place-items: center;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(251, 252, 254, 0.76);
  box-shadow: none;
  backdrop-filter: none;
}

.auth-shell {
  display: grid;
  width: 100vw;
  min-height: 100dvh;
  place-items: center;
  padding: 22px;
}

.auth-panel {
  display: grid;
  gap: 20px;
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid rgba(115, 132, 156, 0.32);
  border-radius: 22px;
  background: rgba(251, 252, 254, 0.84);
  box-shadow: 0 24px 80px rgba(49, 65, 94, 0.18);
  backdrop-filter: blur(28px) saturate(1.2);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h1,
.auth-brand p,
.auth-form h2,
.auth-form p {
  margin: 0;
}

.auth-brand h1 {
  font-size: 28px;
  line-height: 1.05;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form h2 {
  font-size: 22px;
}

.auth-form p,
.auth-hint {
  color: #657388;
  line-height: 1.45;
}

.auth-primary,
.auth-passkey {
  width: 100%;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
  padding: 18px;
  border-right: 1px solid rgba(117, 132, 154, 0.22);
  background: rgba(232, 238, 247, 0.72);
}

.brand-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.app-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(145deg, #2670ef, #12a078);
  box-shadow: 0 12px 28px rgba(38, 112, 239, 0.25);
}

.brand-block h1,
.brand-block p {
  margin: 0;
}

.brand-block h1 {
  font-size: 20px;
  line-height: 1.15;
}

.brand-block p {
  margin-top: 2px;
  overflow: hidden;
  color: #67748a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-stack,
.folder-stack {
  display: grid;
  gap: 8px;
}

.account-button,
.folder-button,
.message-row,
.icon-button,
.primary-action {
  cursor: pointer;
}

.account-button {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  color: #253047;
  background: transparent;
  text-align: left;
}

.account-button:hover,
.account-button.is-active,
.folder-button:hover,
.folder-button.is-active {
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.account-button.is-active,
.folder-button.is-active {
  color: #10213c;
}

.account-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.unified-dot {
  background: linear-gradient(135deg, #2670ef, #15a36d);
}

.account-copy {
  display: grid;
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 14px;
}

.account-copy span {
  color: #66758c;
  font-size: 12px;
}

.mobile-label {
  display: none;
}

.badge,
.folder-count {
  display: grid;
  min-width: 24px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: #2670ef;
  font-size: 12px;
  font-weight: 700;
}

.folder-button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  color: #41506a;
  background: transparent;
  text-align: left;
}

.folder-count {
  color: #5b687c;
  background: rgba(122, 137, 159, 0.16);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.sync-stamp {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: #68768b;
  font-size: 12px;
}

.sync-stamp span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 74px minmax(0, 1fr);
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 340px) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(117, 132, 154, 0.18);
  background: rgba(250, 251, 253, 0.72);
}

.toolbar-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.toolbar-title span,
.toolbar-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-title span {
  color: #66758c;
  font-size: 12px;
}

.toolbar-title strong {
  font-size: 18px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(113, 128, 149, 0.2);
  border-radius: 10px;
  color: #27344c;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.icon-button:hover {
  background: #ffffff;
}

.sidebar-toggle {
  display: none;
}

.search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(113, 128, 149, 0.2);
  border-radius: 12px;
  color: #758197;
  background: rgba(255, 255, 255, 0.72);
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: #1f2a40;
  background: transparent;
}

.search-field input::placeholder {
  color: #8a96a8;
}

.primary-action {
  display: inline-flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #1f75ff, #12a078);
  box-shadow: 0 12px 26px rgba(31, 117, 255, 0.22);
  font-weight: 700;
}

.secondary-action:disabled,
.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

.content-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  overflow: hidden;
}

.message-list {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid rgba(117, 132, 154, 0.18);
  padding: 0 10px 12px;
  background: rgba(238, 243, 249, 0.74);
}

.list-status {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin: 0 -10px 8px;
  padding: 0 16px;
  color: #66758c;
  background: rgba(245, 248, 252, 0.9);
  backdrop-filter: blur(16px);
  font-size: 13px;
}

.list-status strong {
  color: #253047;
}

.message-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: 104px;
  gap: 9px;
  padding: 13px 16px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(117, 132, 154, 0.16);
  border-radius: 10px;
  color: #243047;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  box-shadow: 0 1px 2px rgba(32, 44, 67, 0.04);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.message-row:hover {
  border-color: rgba(38, 112, 239, 0.22);
  background: rgba(255, 255, 255, 0.9);
}

.message-row.is-active {
  background: rgba(226, 241, 255, 0.76);
  border-color: rgba(38, 112, 239, 0.28);
  box-shadow:
    4px 0 0 #2670ef inset,
    0 8px 20px rgba(38, 112, 239, 0.1);
}

.message-row.is-unread .message-subject,
.message-row.is-unread .message-topline strong {
  font-weight: 800;
}

.message-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.message-line,
.message-flags {
  display: flex;
  min-width: 0;
  align-items: center;
}

.message-topline {
  justify-content: space-between;
  gap: 12px;
}

.message-topline strong,
.message-subject,
.message-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-topline strong {
  min-width: 0;
  color: #172238;
  font-size: 14px;
  line-height: 1.2;
}

.message-topline time {
  flex: 0 0 auto;
  color: #79869a;
  font-size: 12px;
}

.message-subject {
  color: #253047;
  font-size: 15px;
  line-height: 1.25;
}

.message-preview {
  color: #67758b;
  font-size: 13px;
  line-height: 1.25;
}

.message-flags {
  justify-content: flex-start;
  gap: 8px;
  color: #66758c;
}

.zfo-chip {
  display: inline-flex;
  height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #0f6d50;
  background: rgba(18, 160, 120, 0.13);
  font-size: 11px;
  font-weight: 800;
}

.delivery-chip {
  color: #1a5ac9;
  background: rgba(38, 112, 239, 0.12);
}

.message-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2670ef;
}

.message-row.is-unread .message-dot {
  display: inline-flex;
}

.message-account-chip {
  display: inline-flex;
  max-width: 150px;
  height: 24px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 999px;
  color: #526177;
  background: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  font-weight: 800;
}

.message-account-chip span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.attachment-chip {
  display: inline-flex;
  height: 24px;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 999px;
  color: #526177;
  background: rgba(113, 128, 149, 0.12);
  font-size: 11px;
  font-weight: 800;
}

.attachment-chip .icon {
  width: 14px;
  height: 14px;
}

.message-detail {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: 24px;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(249, 251, 253, 0.9)),
    #ffffff;
}

.mobile-detail-bar {
  display: none;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 32px 18px;
}

.detail-header h2,
.detail-header p {
  margin: 0;
}

.detail-header h2 {
  max-width: 820px;
  margin: 6px 0 8px;
  color: #141c2d;
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.16;
}

.detail-header p:not(.eyebrow) {
  color: #657388;
  font-size: 15px;
}

.eyebrow {
  color: #2670ef;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-actions {
  display: flex;
  gap: 10px;
}

.message-facts,
.envelope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0 32px 20px;
}

.message-facts div,
.envelope-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(119, 133, 153, 0.18);
  border-radius: 12px;
  background: rgba(244, 247, 251, 0.76);
}

.message-facts dt,
.message-facts dd,
.envelope-grid dt,
.envelope-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.message-facts dt,
.envelope-grid dt {
  color: #748096;
  font-size: 12px;
}

.message-facts dd,
.envelope-grid dd {
  margin-top: 6px;
  color: #1d2840;
  font-size: 14px;
  font-weight: 700;
}

.envelope-card {
  display: grid;
  gap: 14px;
  margin: 0 32px 22px;
}

.envelope-card > header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #243047;
}

.envelope-card > header .icon {
  width: 22px;
  height: 22px;
  color: #2670ef;
}

.envelope-card h3,
.envelope-card p {
  margin: 0;
}

.envelope-card p {
  margin-top: 3px;
  color: #748096;
  font-size: 13px;
}

.envelope-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding: 0;
}

.message-body {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  margin: 0 32px 24px;
  padding: 18px;
  border: 1px solid rgba(18, 160, 120, 0.22);
  border-radius: 14px;
  color: #1e5d4d;
  background: rgba(18, 160, 120, 0.08);
}

.message-body p {
  margin: 0;
  color: #26374e;
  line-height: 1.55;
}

.delivery-card {
  display: grid;
  gap: 14px;
  margin: 0 32px 24px;
  padding: 16px;
  border: 1px solid rgba(38, 112, 239, 0.18);
  border-radius: 14px;
  background: rgba(241, 246, 255, 0.78);
}

.delivery-card > header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.delivery-card > header .icon {
  width: 22px;
  height: 22px;
  color: #2670ef;
}

.delivery-card h3,
.delivery-card p {
  margin: 0;
}

.delivery-card p {
  margin-top: 3px;
  color: #526177;
  font-size: 13px;
}

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

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

.delivery-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(113, 128, 149, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.delivery-grid dt,
.delivery-grid dd {
  margin: 0;
}

.delivery-grid dt {
  color: #748096;
  font-size: 12px;
}

.delivery-grid dd {
  margin-top: 5px;
  color: #1d2840;
  font-size: 13px;
  font-weight: 800;
}

.delivery-events {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.delivery-events li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  color: #26374e;
  font-size: 13px;
}

.delivery-events time {
  color: #68768b;
}

.delivery-empty {
  color: #526177;
}

.document-preview {
  display: grid;
  gap: 14px;
  margin: 0 32px 24px;
}

.document-preview > header,
.pdf-preview > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.document-preview > header {
  justify-content: flex-start;
  color: #243047;
}

.document-preview > header .icon {
  width: 22px;
  height: 22px;
  color: #2670ef;
}

.document-preview h3,
.document-preview p,
.pdf-preview h3,
.pdf-preview p {
  margin: 0;
}

.document-preview header p {
  margin-top: 3px;
  color: #748096;
  font-size: 13px;
}

.paper-preview {
  padding: 24px;
  border: 1px solid rgba(119, 133, 153, 0.22);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(49, 65, 94, 0.08);
}

.paper-preview h3 {
  margin: 6px 0 16px;
  font-size: 20px;
  line-height: 1.18;
}

.paper-eyebrow {
  color: #2670ef;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.paper-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.paper-preview dt,
.paper-preview dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.paper-preview dt {
  color: #748096;
  font-size: 12px;
}

.paper-preview dd {
  margin-top: 3px;
  color: #1d2840;
  font-weight: 700;
}

.paper-preview > p:last-child {
  color: #26374e;
  line-height: 1.58;
}

.attachment-section {
  padding: 0 32px 32px;
}

.attachment-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.attachment-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(119, 133, 153, 0.2);
  border-radius: 12px;
  background: rgba(247, 249, 252, 0.9);
}

.attachment-actions {
  display: flex;
  grid-column: 2;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.mini-action {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(113, 128, 149, 0.18);
  border-radius: 9px;
  color: #27344c;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.mini-action .icon {
  width: 15px;
  height: 15px;
}

.pdf-preview {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(119, 133, 153, 0.22);
  border-radius: 14px;
  background: rgba(247, 249, 252, 0.9);
}

.pdf-preview h3 {
  margin-top: 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.pdf-preview > header > div {
  min-width: 0;
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #526177;
  background: rgba(255, 255, 255, 0.72);
}

.preview-tabs button.is-active {
  color: #ffffff;
  background: #2670ef;
}

.pdf-preview iframe {
  width: 100%;
  min-height: min(78dvh, 860px);
  border: 1px solid rgba(119, 133, 153, 0.22);
  border-radius: 12px;
  background: #ffffff;
}

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

.attachment-item span {
  display: grid;
  min-width: 0;
}

.attachment-item strong {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

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

.attachment-item small {
  margin-top: 3px;
  color: #748096;
}

.empty-state,
.empty-detail {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: #7a879a;
}

.empty-detail {
  height: 100%;
  gap: 12px;
  align-content: center;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 36, 55, 0.26);
  backdrop-filter: blur(18px);
}

.settings-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(880px, 100%);
  max-height: min(760px, calc(100dvh - 48px));
  overflow: hidden;
  border: 1px solid rgba(113, 128, 149, 0.25);
  border-radius: 20px;
  background: rgba(251, 252, 254, 0.94);
  box-shadow: 0 30px 90px rgba(32, 44, 67, 0.28);
}

.sync-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(460px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid rgba(113, 128, 149, 0.25);
  border-radius: 20px;
  background: rgba(251, 252, 254, 0.95);
  box-shadow: 0 30px 90px rgba(32, 44, 67, 0.28);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(117, 132, 154, 0.18);
}

.settings-header h2,
.settings-header p {
  margin: 0;
}

.settings-header h2 {
  font-size: 24px;
  line-height: 1.1;
}

.settings-layout {
  display: grid;
  min-height: 0;
  grid-template-columns: 260px minmax(0, 1fr);
}

.settings-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid rgba(117, 132, 154, 0.16);
  background: rgba(239, 244, 250, 0.66);
}

.secondary-action,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 800;
}

.secondary-action {
  color: #20304a;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(113, 128, 149, 0.2);
}

.toolbar-compose {
  height: 42px;
  white-space: nowrap;
}

.danger-button {
  color: #9f1d35;
  background: rgba(217, 79, 112, 0.12);
}

.settings-account-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border-radius: 12px;
  color: #253047;
  background: transparent;
  text-align: left;
}

.settings-account-row:hover,
.settings-account-row.is-active {
  background: rgba(255, 255, 255, 0.78);
}

.settings-account-row span:not(.account-dot):not(.badge) {
  display: grid;
  min-width: 0;
}

.settings-account-row strong,
.settings-account-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-account-row small {
  margin-top: 3px;
  color: #68768b;
}

.settings-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 24px;
}

.account-editor {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

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

.field,
.color-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #526177;
  font-size: 13px;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: #2670ef;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span,
.color-field legend {
  color: #657388;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(113, 128, 149, 0.24);
  border-radius: 12px;
  outline: 0;
  color: #1f2a40;
  background: rgba(255, 255, 255, 0.82);
}

.field select {
  appearance: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(38, 112, 239, 0.58);
  box-shadow: 0 0 0 3px rgba(38, 112, 239, 0.12);
}

.file-field input[type="file"] {
  height: auto;
  padding: 11px 12px;
  color: #526177;
}

.color-field {
  padding: 0;
  border: 0;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-option {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  cursor: pointer;
}

.color-option input {
  position: absolute;
  opacity: 0;
}

.color-option span {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--color);
  box-shadow: 0 0 0 1px rgba(31, 42, 64, 0.08) inset;
}

.color-option input:checked + span {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.95),
    0 0 0 5px var(--color);
}

.settings-note,
.settings-error,
.settings-notice {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.settings-note {
  color: #526177;
  background: rgba(239, 244, 250, 0.86);
}

.settings-error {
  color: #9f1d35;
  background: rgba(217, 79, 112, 0.12);
}

.settings-notice {
  color: #0f6d50;
  background: rgba(18, 160, 120, 0.12);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.empty-settings {
  display: grid;
  min-height: 88px;
  place-items: center;
  color: #7a879a;
}

.security-box,
.backup-box,
.contacts-box,
.deployment-box {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(113, 128, 149, 0.18);
  border-radius: 14px;
  background: rgba(239, 244, 250, 0.72);
}

.security-box,
.backup-box {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.security-box div,
.backup-box div,
.contacts-box header div,
.deployment-box header div {
  display: grid;
  min-width: 0;
}

.security-box strong,
.security-box small,
.backup-box strong,
.backup-box small,
.contacts-box strong,
.contacts-box small,
.deployment-box strong,
.deployment-box small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-box small,
.backup-box small,
.contacts-box small,
.deployment-box small {
  margin-top: 3px;
  color: #68768b;
}

.contacts-box header,
.deployment-box header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-list,
.deployment-list {
  display: grid;
  gap: 8px;
}

.contact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 8px;
}

.contact-form input {
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(113, 128, 149, 0.2);
  border-radius: 10px;
  color: #1f2a40;
  background: rgba(255, 255, 255, 0.78);
}

.contact-row,
.deployment-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(113, 128, 149, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
}

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

.contact-row .icon,
.deployment-row .icon {
  width: 18px;
  height: 18px;
  color: #2670ef;
}

.deployment-row.is-ok .icon {
  color: #0f8a63;
}

.deployment-row.is-warning .icon {
  color: #b46b00;
}

.deployment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deployment-meta span {
  padding: 6px 8px;
  border-radius: 999px;
  color: #526177;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.compose-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(720px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid rgba(113, 128, 149, 0.25);
  border-radius: 20px;
  background: rgba(251, 252, 254, 0.96);
  box-shadow: 0 30px 90px rgba(32, 44, 67, 0.28);
}

.compose-form {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 24px;
}

.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 190px;
  resize: vertical;
  padding: 12px;
  border: 1px solid rgba(113, 128, 149, 0.24);
  border-radius: 12px;
  outline: 0;
  color: #1f2a40;
  background: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

.field textarea:focus {
  border-color: rgba(38, 112, 239, 0.58);
  box-shadow: 0 0 0 3px rgba(38, 112, 239, 0.12);
}

.compose-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
  color: #68768b;
  font-size: 13px;
}

.compose-file-list span {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(113, 128, 149, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.compose-file-list svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #2670ef;
}

.compose-file-list strong {
  overflow: hidden;
  max-width: min(360px, 62vw);
  color: #1f2a40;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-file-list small {
  color: #68768b;
  white-space: nowrap;
}

.context-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid rgba(113, 128, 149, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(32, 44, 67, 0.22);
  backdrop-filter: blur(18px);
}

.context-menu button,
.context-menu a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: #243047;
  background: transparent;
  text-align: left;
}

.context-menu button:hover,
.context-menu a:hover {
  background: rgba(239, 244, 250, 0.92);
}

.sync-form {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 24px;
}

.sync-account-card {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid rgba(113, 128, 149, 0.18);
  border-radius: 14px;
  background: rgba(239, 244, 250, 0.72);
}

.sync-account-card span:not(.account-dot) {
  display: grid;
  min-width: 0;
}

.sync-account-card strong,
.sync-account-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-account-card small {
  margin-top: 3px;
  color: #68768b;
}

.sync-status-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(38, 112, 239, 0.18);
  border-radius: 14px;
  color: #26374e;
  background: rgba(241, 246, 255, 0.82);
}

.sync-status-card.is-ok {
  border-color: rgba(18, 160, 120, 0.22);
  background: rgba(18, 160, 120, 0.08);
}

.sync-status-card.is-error {
  border-color: rgba(217, 79, 112, 0.22);
  background: rgba(217, 79, 112, 0.1);
}

.sync-status-card > .icon {
  width: 24px;
  height: 24px;
  color: #2670ef;
}

.sync-status-card.is-ok > .icon {
  color: #0f8a63;
}

.sync-status-card.is-error > .icon {
  color: #9f1d35;
}

.sync-status-card strong,
.sync-status-card small {
  display: block;
}

.sync-status-card small {
  margin-top: 4px;
  color: #68768b;
}

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

.sync-result-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(113, 128, 149, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.sync-result-grid dt,
.sync-result-grid dd {
  margin: 0;
}

.sync-result-grid dt {
  color: #748096;
  font-size: 12px;
}

.sync-result-grid dd {
  margin-top: 5px;
  color: #1d2840;
  font-size: 15px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .content-grid {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }

  .toolbar {
    grid-template-columns: minmax(140px, 1fr) auto auto;
  }

  .sidebar-toggle,
  .search-field {
    display: none;
  }

  .toolbar .primary-action > span:last-child {
    display: none;
  }

  .toolbar-compose > span:last-child {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    grid-template-columns: 88px minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    gap: 14px;
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  .brand-block p,
  .account-copy span,
  .folder-button span:not(.folder-count):not(.icon),
  .sidebar-footer .sync-stamp {
    display: none;
  }

  .brand-block {
    justify-content: center;
  }

  .brand-block h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .account-button {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    min-height: 48px;
    padding: 8px;
  }

  .account-dot {
    width: 18px;
    height: 18px;
  }

  .account-copy strong {
    max-width: 58px;
    font-size: 11px;
    text-align: center;
  }

  .badge {
    position: absolute;
    min-width: 18px;
    height: 18px;
    margin-left: 34px;
    margin-top: -24px;
    font-size: 10px;
  }

  .folder-button {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    min-height: 44px;
  }

  .folder-count {
    display: none;
  }

  .sidebar-footer {
    justify-content: center;
  }

  .toolbar {
    min-width: 0;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .toolbar-title strong {
    font-size: 17px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 200%;
    transform: translateX(0);
    transition: transform 220ms ease;
  }

  .app-shell.detail-open .content-grid {
    transform: translateX(-50%);
  }

  .message-list,
  .message-detail {
    width: 100%;
  }

  .message-row {
    min-height: 104px;
  }

  .mobile-detail-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(117, 132, 154, 0.18);
    background: rgba(250, 251, 253, 0.92);
    backdrop-filter: blur(16px);
  }

  .mobile-detail-bar span {
    min-width: 0;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .detail-header {
    padding: 22px 18px 16px;
  }

  .detail-header h2 {
    font-size: 24px;
  }

  .message-facts,
  .envelope-grid {
    grid-template-columns: 1fr;
    padding: 0 18px 18px;
  }

  .envelope-card {
    margin: 0 18px 22px;
  }

  .message-body {
    margin: 0 18px 22px;
  }

  .delivery-card {
    margin: 0 18px 22px;
  }

  .delivery-card > header {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .delivery-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .delivery-grid,
  .delivery-events li {
    grid-template-columns: 1fr;
  }

  .document-preview {
    margin: 0 18px 22px;
  }

  .paper-preview dl {
    grid-template-columns: 1fr;
  }

  .attachment-section {
    padding: 0 18px 28px;
  }
}

@media (max-width: 700px) {
  .settings-overlay {
    align-items: stretch;
    padding: 10px;
  }

  .settings-panel {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .sync-panel {
    align-self: center;
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .settings-header {
    padding: 18px 18px 14px;
  }

  .settings-header h2 {
    font-size: 28px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-list {
    display: flex;
    min-height: 0;
    gap: 8px;
    overflow-x: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(117, 132, 154, 0.16);
  }

  .settings-list .secondary-action,
  .settings-account-row {
    flex: 0 0 176px;
  }

  .settings-account-row {
    min-height: 62px;
  }

  .settings-main {
    padding: 16px;
  }

  .account-editor {
    padding: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .contact-form {
    grid-template-columns: 1fr;
  }

  .sync-result-grid {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    justify-content: flex-start;
  }

  .security-box,
  .backup-box {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    border-top: 1px solid rgba(117, 132, 154, 0.24);
    border-right: 0;
    background: rgba(242, 246, 251, 0.94);
    backdrop-filter: blur(20px);
  }

  .brand-block,
  .sidebar-footer {
    display: none;
  }

  .account-stack,
  .folder-stack {
    display: contents;
  }

  .account-button,
  .folder-button {
    min-height: 48px;
    border-radius: 12px;
  }

  .folder-button[data-folder-id="archive"] {
    display: none;
  }

  .unified-account .desktop-label {
    display: none;
  }

  .unified-account .mobile-label {
    display: inline;
  }

  .mail-stage {
    grid-template-rows: 64px minmax(0, 1fr);
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

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

  .toolbar-title span {
    display: none;
  }

  .toolbar .primary-action {
    width: 42px;
    padding: 0;
  }

  .toolbar .primary-action .icon {
    width: 19px;
    height: 19px;
  }

  .detail-header {
    display: grid;
  }

  .detail-header h2 {
    font-size: 22px;
  }

  .detail-actions {
    order: -1;
    justify-content: flex-end;
  }

  .attachment-list {
    grid-template-columns: 1fr;
  }

  .attachment-item {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .attachment-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .pdf-preview iframe {
    min-height: 430px;
  }
}
