:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #eef3f8;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4ee;
  --line-soft: #e9eef5;
  --primary: #16c784;
  --primary-strong: #0ea66d;
  --primary-soft: rgba(22, 199, 132, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --radius: 22px;
}

body.dark {
  color-scheme: dark;
  --bg: #11151e;
  --surface: #11151e;
  --surface-strong: #151a24;
  --surface-soft: #1b202b;
  --text: #e7edf7;
  --muted: #95a3b8;
  --line: #273041;
  --line-soft: #202838;
  --primary: #45e6a3;
  --primary-strong: #2bd489;
  --primary-soft: rgba(69, 230, 163, 0.13);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.13);
  --warning: #fbbf24;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
  outline-offset: 2px;
}

[hidden],
#code-strip {
  display: none !important;
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 34%, transparent);
  background-clip: content-box;
}

.app-shell {
  width: min(1440px, calc(100vw - 40px));
  height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.login-view {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: var(--radius);
}

.login-card h1 {
  margin: 0;
  font-size: 32px;
  line-height: 40px;
}

.login-intro,
.login-footnote {
  color: var(--muted);
  line-height: 1.6;
}

.login-intro {
  margin: 10px 0 24px;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface-strong);
}

.login-card .btn {
  width: 100%;
  margin-top: 14px;
}

.login-footnote {
  margin: 18px 0 0;
  font-size: 13px;
}

.glass {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

.soft-card {
  border: 1px solid var(--line-soft);
  background: var(--surface-strong);
}

.rounded-panel {
  border-radius: var(--radius);
}

.rounded-inner {
  border-radius: 20px;
}

.muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.hero-panel {
  margin-bottom: 18px;
  padding: 28px;
}

.header-row,
.hero-actions,
.panel-heading,
.toolbar-row,
.toolbar-actions,
.drawer-head,
.modal-head,
.modal-actions,
.json-import-row {
  display: flex;
  align-items: center;
}

.header-row,
.panel-heading,
.toolbar-row,
.drawer-head,
.modal-head {
  justify-content: space-between;
}

.header-row {
  gap: 20px;
}

.product-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
}

.status-dot,
.account-health {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.hero-panel h1 {
  margin: 0;
  font-size: 36px;
  line-height: 40px;
  font-weight: 900;
}

h2,
.toolbar-row h2 {
  margin: 0;
  font-size: 18px;
  line-height: 28px;
  font-weight: 850;
}

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

.btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  background: var(--surface-strong);
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #052e1d;
}

.btn-danger {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
}

.btn-secondary {
  background: var(--surface-strong);
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 200ms ease;
}

.switch.on::after {
  transform: translateX(19px);
  background: var(--primary);
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.layout > aside,
.layout > section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mailbox-panel,
.mail-panel {
  padding: 20px;
}

.panel-heading,
.toolbar-row {
  gap: 12px;
  margin-bottom: 16px;
}

.count-pill {
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 14px;
  line-height: 20px;
  font-weight: 850;
  white-space: nowrap;
}

.search-wrap {
  margin-bottom: 16px;
}

.search-wrap input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--surface-strong);
  font-size: 14px;
  line-height: 20px;
}

.mailbox-list {
  flex: 1;
  min-height: 0;
  padding: 2px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}

.mailbox-list > p,
.empty-mailbox {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--surface-strong);
  text-align: center;
  font-size: 14px;
  line-height: 20px;
}

.account-item {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--surface-strong);
  transition: border-color 160ms ease, background 160ms ease;
}

.account-item:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}

.account-item.selected {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--line));
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--primary) 35%, transparent);
}

.account-item[data-status="error"] .account-health {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.account-email {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-type {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.account-actions {
  display: flex;
  gap: 4px;
}

.mini-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.mini-button.danger {
  color: var(--danger);
}

.mail-panel {
  position: relative;
}

.toolbar-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.mail-table {
  table-layout: fixed;
}

th,
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: normal;
  font-weight: 700;
  text-align: left;
}

th:first-child,
td:first-child,
th:nth-child(3),
td:nth-child(3),
th:nth-child(5),
td:nth-child(5) {
  text-align: center;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-soft) 66%, transparent);
}

.mail-subject-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-value {
  color: var(--primary-strong);
  font-weight: 700;
}

.view-button {
  min-width: 56px;
  height: 32px;
  padding: 0 10px;
}

.mobile-mail-list {
  display: none;
}

.total-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(720px, 46vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.24);
  transform: translateX(105%);
  transition: transform 220ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 69px;
  padding: 16px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-title-wrap {
  flex: 1;
  min-width: 0;
}

.drawer-title-wrap h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 16px;
}

.drawer h3,
.modal h3 {
  margin: 0;
  font-size: 18px;
  line-height: 28px;
  font-weight: 800;
}

.drawer-content {
  flex: 1;
  padding: 20px;
  overflow: auto;
}

.detail-meta {
  margin-bottom: 20px;
  padding-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.detail-meta > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.detail-meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.detail-meta strong {
  overflow-wrap: anywhere;
  line-height: 20px;
}

.detail-code {
  margin-bottom: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--line));
  border-radius: 8px;
  background: var(--primary-soft);
}

.detail-code span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-code code {
  color: var(--primary-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 26px;
  line-height: 32px;
  font-weight: 800;
}

.detail-code .mini-button {
  margin-left: auto;
}

.detail-section-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
}

.detail-body {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: visible;
  background: var(--surface-soft);
  color: var(--text);
  font: 14px/1.7 ui-sans-serif, system-ui, sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 6, 23, 0.58);
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  width: min(720px, calc(100vw - 32px));
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -48%) scale(0.98);
  transition: transform 180ms ease, opacity 180ms ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-head {
  gap: 12px;
  margin-bottom: 16px;
}

.modal h3 {
  font-size: 20px;
  font-weight: 850;
}

.import-hint {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.14);
  color: var(--text);
  font-size: 14px;
  line-height: 28px;
}

.import-hint code {
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  word-break: break-all;
}

.format-label {
  color: var(--primary-strong);
}

.account-form textarea {
  width: 100%;
  min-height: 224px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: var(--surface-strong);
}

.json-import-row,
.account-form > .field-hint {
  display: none;
}

.modal-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.form-error {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 18px;
}

.form-error:empty {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: 34px;
  z-index: 80;
  max-width: min(720px, calc(100vw - 48px));
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  background: var(--surface-strong);
  color: var(--text);
  line-height: 1.45;
  text-align: left;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.list-loading {
  position: absolute;
  inset: 64px 20px 20px;
  z-index: 8;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(3px);
}

.loading-box {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 800;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid color-mix(in srgb, var(--muted) 24%, transparent);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 750ms linear infinite;
}

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

.guest-view {
  min-height: 100vh;
  padding: 28px;
  background: var(--bg);
}

.guest-shell {
  width: min(1120px, 100%);
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.guest-topbar,
.guest-brand,
.guest-secret-row,
.guest-access-summary {
  display: flex;
  align-items: center;
}

.guest-topbar {
  min-height: 44px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.guest-brand {
  gap: 10px;
  font-size: 15px;
}

.guest-admin-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.guest-admin-link:hover {
  color: var(--text);
}

.guest-heading {
  padding: 64px 0 40px;
}

.guest-heading h1 {
  margin: 0;
  font-size: 40px;
  line-height: 48px;
}

.guest-heading p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 24px;
}

.guest-workspace {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.guest-form,
.guest-result {
  min-width: 0;
  padding: 40px;
}

.guest-form {
  align-self: center;
}

.guest-field + .guest-field {
  margin-top: 20px;
}

.guest-field label,
.guest-key-output label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
}

.guest-field input,
.guest-secret-row input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface-strong);
}

.guest-field input:focus,
.guest-secret-row input:focus {
  border-color: var(--primary);
}

.guest-submit {
  width: 100%;
  height: 46px;
  margin-top: 24px;
}

.guest-submit:disabled,
.guest-access-actions .btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.guest-error {
  min-height: 18px;
}

.guest-result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
  background: var(--surface-soft);
}

.guest-result-label {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.guest-code {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 46px;
  line-height: 56px;
  font-weight: 850;
}

.guest-result[data-state="success"] .guest-code {
  color: var(--primary-strong);
}

.guest-result[data-state="loading"] .guest-code {
  animation: guest-pulse 900ms ease-in-out infinite alternate;
}

@keyframes guest-pulse {
  to { opacity: 0.35; }
}

.guest-subject {
  margin: 18px 0 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 22px;
  font-weight: 750;
}

.guest-time {
  min-height: 20px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.guest-copy {
  align-self: flex-start;
  margin-top: 24px;
}

.guest-access-modal {
  width: min(720px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow-y: auto;
}

.guest-access-summary {
  min-width: 0;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.guest-access-summary > div {
  min-width: 0;
}

.guest-access-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-access-status {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.guest-access-status.is-enabled {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.guest-key-output {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 36%, var(--line));
  border-radius: 8px;
  background: var(--primary-soft);
}

.guest-secret-row {
  gap: 8px;
}

.guest-key-target {
  display: block;
  margin: 3px 0 10px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.guest-secret-row input {
  min-width: 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.guest-key-output p,
.guest-access-note {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 20px;
}

.guest-access-actions {
  justify-content: space-between;
}

.guest-alias-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.guest-alias-heading,
.guest-alias-form,
.guest-alias-row,
.guest-alias-identity,
.guest-alias-actions {
  display: flex;
  align-items: center;
}

.guest-alias-heading {
  justify-content: space-between;
  gap: 12px;
}

.guest-alias-heading h4 {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
}

.guest-alias-form {
  gap: 8px;
  margin-top: 12px;
}

.guest-alias-form input {
  min-width: 0;
  flex: 1;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface-strong);
}

.guest-alias-form input:focus {
  border-color: var(--primary);
}

.guest-alias-list {
  margin-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.guest-alias-empty {
  margin: 0;
  padding: 16px 0 2px;
  font-size: 13px;
}

.guest-alias-row {
  min-width: 0;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.guest-alias-identity {
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.guest-alias-identity strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 18px;
}

.guest-alias-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.guest-alias-actions .btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.guest-alias-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

@media (max-width: 960px) {
  .app-shell {
    width: min(calc(100vw - 24px), 760px);
    height: auto;
    min-height: 100vh;
    padding: 16px 0 24px;
    overflow: visible;
  }

  .layout {
    flex: none;
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .layout > aside,
  .layout > section {
    overflow: visible;
  }

  .mailbox-list {
    flex: none;
    min-height: auto;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .table-wrap {
    flex: none;
    min-height: auto;
  }

  .desktop-table {
    display: none;
  }

  .mobile-mail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-message-card {
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: var(--surface-strong);
  }

  .mobile-message-top,
  .mobile-message-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-message-subject {
    margin: 10px 0;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .drawer {
    width: 100vw;
  }

}

@media (max-width: 620px) {
  .guest-view {
    padding: 18px;
    background: var(--bg);
  }

  .guest-shell {
    min-height: calc(100vh - 36px);
  }

  .guest-heading {
    padding: 44px 0 30px;
  }

  .guest-heading h1 {
    font-size: 32px;
    line-height: 40px;
  }

  .guest-workspace {
    grid-template-columns: 1fr;
  }

  .guest-form,
  .guest-result {
    padding: 28px 20px;
  }

  .guest-result {
    min-height: 260px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .guest-code {
    font-size: 38px;
    line-height: 48px;
  }

  .guest-access-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .guest-access-actions .btn {
    width: 100%;
  }

  .guest-alias-form,
  .guest-alias-row {
    align-items: stretch;
    flex-direction: column;
  }

  .guest-alias-form .btn {
    width: 100%;
  }

  .guest-alias-actions {
    display: flex;
  }

  .guest-alias-actions .btn:not(.icon-btn) {
    min-width: 0;
    flex: 1;
  }

  .app-shell {
    width: calc(100vw - 18px);
    padding-top: 10px;
  }

  .hero-panel,
  .mailbox-panel,
  .mail-panel {
    padding: 20px;
  }

  .hero-panel {
    padding: 20px;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-panel h1 {
    font-size: 30px;
    line-height: 36px;
  }

  .hero-actions {
    width: 100%;
    justify-content: stretch;
  }

  .hero-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .mailbox-list {
    max-height: 420px;
    padding: 0 12px 10px 0;
    grid-template-columns: 1fr;
    overflow: auto;
    scrollbar-gutter: stable;
  }

  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions .btn {
    width: 100%;
  }

  .drawer {
    top: auto;
    bottom: 0;
    height: 92vh;
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(105%);
  }

  .drawer.open {
    transform: translateY(0);
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .drawer-content {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
