:root {
  --shell-app-width: min(460px, 100%);
  --shell-app-radius: 24px;
  --shell-app-background: var(--surface);
  --shell-app-shadow: var(--shadow-soft);
}

.topbar-action {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.topbar-action:hover,
.topbar-action:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
  outline: none;
}

.top-toast {
  position: absolute;
  top: calc(78px + var(--telegram-top-inset));
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(15, 32, 66, 0.08);
  box-shadow: 0 14px 32px rgba(11, 29, 58, 0.18);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.top-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.top-toast.is-info {
  background: linear-gradient(180deg, rgba(237, 243, 255, 0.97), rgba(255, 255, 255, 0.96));
}

.top-toast.is-muted {
  background: linear-gradient(180deg, rgba(247, 248, 250, 0.98), rgba(255, 255, 255, 0.96));
}

.top-toast.is-warning {
  background: linear-gradient(180deg, rgba(255, 245, 230, 0.98), rgba(255, 255, 255, 0.96));
}

.top-toast.is-error {
  background: linear-gradient(180deg, rgba(255, 237, 236, 0.98), rgba(255, 255, 255, 0.96));
}

.top-toast-body {
  min-width: 0;
  flex: 1;
}

.top-toast-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-100);
}

.top-toast-text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-60);
}

.top-toast.is-error .top-toast-title,
.top-toast.is-error .top-toast-text {
  color: #a62b22;
}

.top-toast.is-warning .top-toast-title,
.top-toast.is-warning .top-toast-text {
  color: #8b4513;
}

.top-toast-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  background: rgba(15, 32, 66, 0.06);
  color: var(--ink-60);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.top-toast-close:hover,
.top-toast-close:focus-visible {
  outline: none;
  background: rgba(15, 32, 66, 0.11);
}

.composer {
  margin: 0 18px 8px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(43, 95, 217, 0.07), rgba(30, 63, 149, 0.03));
  border: 1px solid rgba(43, 95, 217, 0.08);
  animation: composer-reveal 0.22s ease;
}

.composer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-100);
}

.composer-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.composer-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(15, 32, 66, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink-100);
  background: #ffffff;
}

.composer-input:focus {
  outline: none;
  border-color: rgba(43, 95, 217, 0.42);
  box-shadow: 0 0 0 4px rgba(43, 95, 217, 0.08);
}

.composer-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  width: 100%;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--vk-blue) 0%, var(--vk-blue-dark) 100%);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.composer-button:hover,
.composer-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.composer-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.status.is-success {
  color: #067647;
}

.email-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.email-item {
  padding: 0;
  border-top: 1px solid var(--divider);
  background: var(--surface);
  opacity: 0;
  transform: translateY(10px);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.email-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.email-card {
  display: flex;
  align-items: center;
  gap: 8px;
}

.email-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.email-link:hover {
  background: rgba(43, 95, 217, 0.05);
}

.email-link:focus-visible {
  outline: none;
  background: rgba(43, 95, 217, 0.08);
  box-shadow: inset 0 0 0 2px rgba(43, 95, 217, 0.24);
}

.email-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(43, 95, 217, 0.25), rgba(30, 63, 149, 0.2));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.email-avatar-text {
  font-size: 16px;
  font-weight: 700;
  color: #1d2b46;
}

.email-body {
  flex: 1;
  min-width: 0;
}

.email-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-status {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.email-status.is-new {
  background: rgba(43, 95, 217, 0.12);
  color: #2147a7;
}

.email-status.is-processing {
  background: rgba(180, 95, 26, 0.14);
  color: #9a4d16;
}

.email-status.is-failed {
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.email-status.is-empty {
  background: rgba(52, 64, 84, 0.1);
  color: #344054;
}

.email-status.is-to-pay {
  background: rgba(180, 95, 26, 0.18);
  color: #8b4513;
}

.email-status.is-done {
  background: rgba(6, 118, 71, 0.12);
  color: #067647;
}

.email-arrow {
  font-size: 18px;
  color: var(--ink-40);
  flex-shrink: 0;
}

.email-actions {
  position: relative;
  flex-shrink: 0;
  padding-right: 14px;
}

.email-menu-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-60);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.email-menu-button:hover,
.email-menu-button:focus-visible {
  outline: none;
  background: rgba(43, 95, 217, 0.08);
  color: var(--vk-blue-dark);
}

.email-menu-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.email-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 14px;
  min-width: 168px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 32, 66, 0.08);
  box-shadow: 0 18px 38px rgba(11, 29, 58, 0.16);
  z-index: 12;
}

.email-menu-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink-100);
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.email-menu-item:hover,
.email-menu-item:focus-visible {
  outline: none;
  background: rgba(43, 95, 217, 0.07);
}

.email-menu-item.is-danger {
  color: #b42318;
}

.email-menu-item.is-danger:hover,
.email-menu-item.is-danger:focus-visible {
  background: rgba(180, 35, 24, 0.08);
}

@keyframes composer-reveal {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
