.dash {
  padding-block: 24px 32px;
}

.header-inner {
  max-width: none;
}

.dash-wrap {
  width: 100%;
  padding-inline: 24px;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 71px - 56px);
  height: calc(100dvh - 71px - 56px);
  min-height: 480px;
}

.dash-grid[hidden],
.dash-nothing[hidden],
.read-content[hidden],
.read-empty[hidden],
.mail-list[hidden],
.mail-empty[hidden] {
  display: none;
}

.dash-nothing {
  height: calc(100vh - 71px - 56px);
  height: calc(100dvh - 71px - 56px);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 40px 24px;
}

.dash-nothing svg {
  width: 44px;
  height: 44px;
  color: var(--faint);
  margin-bottom: 8px;
}

.dash-nothing h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.dash-nothing p {
  color: var(--muted);
  font-size: 0.95rem;
}

.dash-nothing .btn {
  margin-top: 12px;
}

.dash-side,
.mail-col,
.read-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: background-color 0.25s ease;
}

.dash-side {
  padding: 16px;
  gap: 14px;
}

.menu-btn,
.side-close,
.side-backdrop {
  display: none;
}

.dash-new {
  width: 100%;
  gap: 8px;
  flex: 0 0 auto;
}

.dash-new svg {
  width: 16px;
  height: 16px;
}

.side-current {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px 14px;
}

.side-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.side-copy:hover {
  color: var(--blue-strong);
  border-color: var(--line);
}

.side-copy:active {
  transform: scale(0.92);
}

.side-copy svg {
  width: 15px;
  height: 15px;
}

.side-copy .icon-check {
  display: none;
}

.side-copy.is-copied .icon-copy {
  display: none;
}

.side-copy.is-copied .icon-check {
  display: block;
  color: var(--ok);
}

.current-email {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--paper);
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  overflow: hidden;
}

.cur-local {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 24px;
}

.cur-domain {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--blue-strong);
}

.cur-mask {
  color: var(--faint);
  letter-spacing: 0.06em;
}

.dash-side-label {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.box-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}

.box-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
    background-color 0.18s var(--ease-out);
}

.box-item:hover {
  border-color: var(--line-hover);
}

.box-item.is-active {
  border-color: var(--blue);
  background: rgba(78, 143, 232, 0.08);
}

.box-email {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  display: flex;
  align-items: baseline;
  overflow: hidden;
  min-width: 0;
}

.mail-col {
  min-width: 0;
}

.mail-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
}

.mail-refresh {
  padding: 8px 12px;
  font-size: 0.84rem;
}

.mail-refresh svg {
  width: 14px;
  height: 14px;
}

.mail-refresh.is-spinning svg {
  animation: spin 0.7s linear infinite;
}

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

.mail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.mail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--paper);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  border-left: 2px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-out), border-left-color 0.18s var(--ease-out);
}

.mail-item:hover {
  background: var(--bg-soft);
}

.mail-item.is-active {
  background: rgba(78, 143, 232, 0.08);
  border-left-color: var(--blue);
}

.mail-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.mail-sender {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--faint);
}

.mail-subject {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-preview {
  font-size: 0.78rem;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 32px 20px;
}

@media (min-width: 901px) {
  .mail-empty {
    margin-bottom: 63px;
  }
}

.mail-empty svg {
  width: 34px;
  height: 34px;
  color: var(--faint);
  margin-bottom: 8px;
}

.mail-empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.mail-empty-sub {
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 24rem;
}

.read-col {
  min-width: 0;
}

.read-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 32px 24px;
}

.read-empty svg {
  width: 40px;
  height: 40px;
  color: var(--faint);
  margin-bottom: 8px;
}

.read-empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.read-empty-sub {
  color: var(--muted);
  font-size: 0.88rem;
}

.read-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.read-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.read-back {
  display: none;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}

.read-back:hover {
  color: var(--paper);
  border-color: var(--line-hover);
}

.read-back svg {
  width: 14px;
  height: 14px;
}

.read-head-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.read-sender {
  font-weight: 600;
  font-size: 1rem;
  color: var(--paper);
  word-break: break-word;
}

.read-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
}

.read-subject {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--paper);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  word-break: break-word;
}

.read-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.read-frame {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 320px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 14, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--card-shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.modal-close:hover {
  color: var(--paper);
  border-color: var(--line);
}

.modal-close:active {
  transform: scale(0.92);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 18px;
}

.modal-gen-btn {
  width: 100%;
  margin-top: 14px;
}

.modal-status {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.modal-status[hidden] {
  display: none;
}

.modal-status.is-error {
  color: var(--red);
}

.modal-status.is-ok {
  color: var(--ok);
}

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

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .dash-nothing {
    height: auto;
    min-height: 320px;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
      background-color 0.18s var(--ease-out);
  }

  .menu-btn:hover {
    color: var(--paper);
    border-color: var(--blue);
    background: var(--surface);
  }

  .menu-btn svg {
    width: 19px;
    height: 19px;
  }

  .dash-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    z-index: 70;
    border: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    padding: 58px 16px 18px;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease-out);
  }

  .dash-side.is-open {
    transform: translateX(0);
  }

  .side-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
  }

  .side-close:hover {
    color: var(--paper);
    border-color: var(--line);
  }

  .side-close svg {
    width: 16px;
    height: 16px;
  }

  .side-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(5, 8, 14, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .side-backdrop.is-visible {
    display: block;
  }

  .box-list {
    flex-direction: row;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }

  .box-item {
    min-width: 210px;
  }

  .mail-list {
    flex: 0 0 auto;
    max-height: 56vh;
  }

  .mail-empty {
    padding: 40px 20px;
  }

  .read-col {
    position: fixed;
    inset: 71px 0 0;
    z-index: 45;
    display: none;
    border-radius: 0;
    border: none;
  }

  .read-col.is-open {
    display: flex;
  }

  .read-back {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .dash {
    padding-block: 16px 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .box-item,
  .mail-item,
  .modal-close,
  .read-back,
  .dash-side,
  .menu-btn,
  .side-close {
    transition: none;
  }

  .mail-refresh.is-spinning svg {
    animation: none;
  }
}
