:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(111, 142, 196, 0.18);
  --text: #172033;
  --muted: #63708a;
  --accent: #4c86ff;
  --accent-strong: #2f6fff;
  --danger: #ef5d6d;
  --success: #1ca875;
  --shadow: 0 24px 70px rgba(44, 73, 122, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(76, 134, 255, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(28, 168, 117, 0.1), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
}

body.dialog-open {
  overflow: hidden;
}

.shell {
  width: min(1220px, calc(100% - 20px));
  margin: 0 auto;
  min-height: 100vh;
  height: auto;
  padding: 2px 0 8px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  align-content: start;
}

.hero {
  display: block;
  margin-bottom: 0;
}

.hero-copy-wrap {
  padding: 6px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
  box-shadow: var(--shadow);
}

.hero-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hero-brand {
  display: grid;
  gap: 4px;
}

.hero-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.eyebrow {
  margin: 0;
  color: #4c86ff;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(20px, 2.8vw, 28px);
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.hero-copy {
  max-width: 560px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex: 0 0 auto;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-points span {
  padding: 6px 10px;
  border: 1px solid rgba(120, 138, 170, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #54627d;
  font-size: 12px;
}

.mailbox-headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.mailbox-toolbar {
  justify-content: flex-end;
}

.mailbox-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.muted,
.tips p {
  color: var(--muted);
}

.section-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 10px;
  min-height: clamp(640px, 72vh, 780px);
  height: auto;
  align-items: stretch;
  margin-top: -2px;
}

.panel {
  padding: 12px;
  min-height: 0;
  height: 100%;
}

.controls-panel,
.mailbox-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 252, 255, 0.92));
  overflow: visible;
}

.controls-panel,
.mailbox-panel {
  padding-bottom: 22px;
}

.controls-panel,
.mailbox-panel,
.message-list-wrap,
.message-detail {
  align-self: stretch;
}

.panel-header,
.toolbar,
.status-row,
.message-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.message-item-top {
  min-height: 18px;
}

.message-item-top > * {
  min-width: 0;
}

.mailbox-form {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  min-height: 0;
  overflow: visible;
}

.controls-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.form-block {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-radius: 13px;
  border: 1px solid rgba(120, 138, 170, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 249, 255, 0.78));
}

.form-block-head {
  display: grid;
  gap: 2px;
}

.form-block-head span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.form-block-head small {
  font-size: 11px;
  color: var(--muted);
}

.mailbox-form label {
  display: grid;
  gap: 6px;
}

.provider-selector-frame {
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(120, 138, 170, 0.14);
  background: linear-gradient(180deg, #ffffff, #f5f8fd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}

.segment-btn {
  min-height: 40px;
  padding: 6px 8px;
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  border: 1px solid rgba(120, 138, 170, 0.22);
  box-shadow: 0 4px 14px rgba(56, 87, 138, 0.06);
  font-size: 12px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
  text-align: center;
  font-size: 12px;
}

#refreshProvidersBtn {
  min-width: 78px;
  white-space: nowrap;
}

.segment-btn:hover {
  border-color: rgba(76, 134, 255, 0.35);
  background: linear-gradient(180deg, #ffffff, #eef4ff);
}

.segment-btn:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(76, 134, 255, 0.28);
  outline-offset: 2px;
}

.segment-btn.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 28px rgba(76, 134, 255, 0.26);
}

.mailbox-form span {
  font-size: 12px;
  color: var(--muted);
}

input,
select,
button,
textarea {
  font: inherit;
  line-height: 1.2;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(120, 138, 170, 0.22);
  border-radius: 12px;
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--text);
  background: rgba(246, 249, 255, 0.95);
  outline: none;
}

select {
  padding-right: 24px;
  background-image:
    linear-gradient(45deg, transparent 50%, #7a86a2 50%),
    linear-gradient(135deg, #7a86a2 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 1px),
    calc(100% - 10px) calc(50% - 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

input::placeholder {
  font-size: 12px;
  color: #8a96ad;
}

#providerSelect {
  display: none;
}

#domainSelect {
  display: none;
}

.domain-picker {
  position: relative;
}

.domain-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  color: var(--text);
  background: rgba(246, 249, 255, 0.95);
  border: 1px solid rgba(120, 138, 170, 0.22);
  box-shadow: 0 8px 20px rgba(56, 87, 138, 0.04);
}

.domain-picker.open .domain-trigger,
.domain-trigger:hover {
  border-color: rgba(76, 134, 255, 0.35);
  background: linear-gradient(180deg, #ffffff, #eef4ff);
}

.domain-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.domain-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  transition: transform 140ms ease;
}

.domain-picker.open .domain-caret {
  transform: rotate(180deg);
}

.domain-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  max-height: 260px;
  padding: 8px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(120, 138, 170, 0.18);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 40px rgba(56, 87, 138, 0.14);
}

.domain-menu[hidden] {
  display: none !important;
}

.domain-option {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  text-align: left;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border: 1px solid rgba(120, 138, 170, 0.14);
}

.domain-option:hover,
.domain-option.active {
  border-color: rgba(76, 134, 255, 0.35);
  background: rgba(76, 134, 255, 0.08);
}

input:focus,
select:focus {
  border-color: rgba(120, 166, 255, 0.8);
}

button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.primary-btn {
  min-height: 34px;
  padding: 6px 10px;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 30px rgba(76, 134, 255, 0.24);
  font-size: 11px;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(76, 134, 255, 0.28);
}

.ghost-btn {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff, #f3f7ff);
  border: 1px solid rgba(120, 138, 170, 0.2);
  box-shadow: 0 8px 20px rgba(56, 87, 138, 0.06);
  font-size: 12px;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  box-shadow: 0 12px 24px rgba(56, 87, 138, 0.08);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 6px;
}

.tips {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  padding: 9px;
  border-radius: 14px;
  background: rgba(76, 134, 255, 0.05);
  border: 1px solid rgba(120, 138, 170, 0.14);
}

.form-preview {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed rgba(120, 138, 170, 0.18);
  background: rgba(76, 134, 255, 0.04);
}

.form-preview span {
  font-size: 11px;
  color: var(--muted);
}

.form-preview code {
  font-size: 12px;
  color: var(--accent-strong);
  word-break: break-all;
}

.address-box {
  padding: 10px;
  border-radius: 14px;
  background: rgba(76, 134, 255, 0.08);
  border: 1px solid rgba(120, 166, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.address-box code {
  font-size: clamp(13px, 1.6vw, 16px);
  word-break: break-all;
}

.status-row {
  margin-top: 16px;
}

.mailbox-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.refresh-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(76, 134, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.refresh-progress-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 240px;
  min-width: 180px;
  max-width: 420px;
}

.refresh-progress {
  position: relative;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(174, 188, 214, 0.35);
  overflow: hidden;
}

.refresh-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(76, 134, 255, 0.72), rgba(84, 177, 231, 0.72));
  transition: width 140ms linear;
}

.refresh-countdown {
  min-width: 56px;
  text-align: right;
  color: #5c6d8f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}

.refresh-info time {
  flex: 0 0 auto;
}

.summary-card {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(120, 138, 170, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 250, 255, 0.82));
  box-shadow: 0 6px 18px rgba(56, 87, 138, 0.03);
}

.summary-card:nth-child(1) {
  background: linear-gradient(180deg, rgba(76, 134, 255, 0.1), rgba(247, 250, 255, 0.82));
}

.summary-card:nth-child(2) {
  background: linear-gradient(180deg, rgba(28, 168, 117, 0.08), rgba(247, 250, 255, 0.82));
}

.summary-card:nth-child(3) {
  background: linear-gradient(180deg, rgba(120, 138, 170, 0.08), rgba(247, 250, 255, 0.82));
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
}

.summary-card strong {
  font-size: 13px;
  line-height: 1.2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(76, 134, 255, 0.08);
}

.status-badge.success {
  color: #116e4f;
  background: rgba(28, 168, 117, 0.16);
}

.status-badge.error {
  color: #9a2431;
  background: rgba(239, 93, 109, 0.16);
}

.polling-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.polling-toggle input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.mailbox-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.58fr) minmax(0, 1.42fr);
  gap: 6px;
  margin-top: 6px;
  height: auto;
  min-height: 0;
  max-height: none;
  align-items: stretch;
}

.message-list-wrap,
.message-detail {
  min-height: 0;
  height: 100%;
  border-radius: 18px;
  border: 0;
  background: transparent;
}

.message-list-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.subpanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 6px 6px;
  border-bottom: 1px solid rgba(120, 138, 170, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 250, 255, 0.9));
  position: relative;
  z-index: 1;
}

.subpanel-header h3 {
  margin: 0;
  font-size: 14px;
}

.message-list {
  display: grid;
  gap: 6px;
  padding: 5px 2px 5px 0;
  min-height: 0;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  scrollbar-gutter: stable;
}

.message-item {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  height: 84px;
  min-height: 84px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(120, 138, 170, 0.1);
  box-shadow: 0 10px 24px rgba(56, 87, 138, 0.05);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
}

.message-item-wrap {
  position: relative;
}

.message-item-wrap .message-item {
  padding-right: 40px;
}

.message-delete-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(120, 138, 170, 0.26);
  background: rgba(244, 247, 253, 0.95);
  color: #6f7d97;
  box-shadow: 0 2px 6px rgba(35, 53, 86, 0.12);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.message-delete-btn:hover {
  border-color: rgba(215, 86, 103, 0.35);
  background: rgba(244, 232, 235, 0.95);
  color: #b34758;
}

.message-delete-btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-delete-btn[hidden] {
  display: none !important;
}

.message-item.active,
.message-item:hover {
  border-color: rgba(120, 166, 255, 0.46);
  background: rgba(76, 134, 255, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(76, 134, 255, 0.12);
}

.message-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.message-from,
.message-preview,
.message-time {
  color: var(--muted);
}

.message-from {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 14px;
}

.message-preview {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.35;
  color: #6d7891;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  min-height: 15px;
}

.message-subject {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.message-time {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  margin-left: 8px;
}

.message-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  overflow: visible;
  min-width: 0;
  min-height: 0;
  background: transparent;
}

.message-detail.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: auto;
  min-height: 140px;
  padding: 12px 18px;
  overflow: hidden;
  align-self: start;
}

.detail-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
  padding: 7px 6px 0;
  border-bottom: 1px solid rgba(120, 138, 170, 0.12);
}

.detail-meta h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.detail-body {
  line-height: 1.7;
  color: #2b3852;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0 6px 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.detail-body > * {
  max-width: 100%;
}

.detail-html-shell,
.detail-text-shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(120, 138, 170, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 255, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  box-sizing: border-box;
}

.detail-html-viewport,
.detail-text-viewport {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(242, 246, 252, 0.95), rgba(248, 250, 255, 0.98));
  box-sizing: border-box;
}

.detail-html-shell {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  max-height: none;
}

.detail-text-shell {
  max-height: 46vh;
}

.detail-body pre {
  margin: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font: inherit;
  padding: 16px;
  border: 1px solid rgba(120, 138, 170, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  max-width: 100%;
  max-height: 100%;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  overflow: auto;
  box-sizing: border-box;
}

.code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(76, 134, 255, 0.18);
  background: linear-gradient(180deg, rgba(76, 134, 255, 0.12), rgba(76, 134, 255, 0.05));
  overflow: visible;
}

.code-card-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.code-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.code-card strong {
  display: block;
  color: var(--accent-strong);
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-copy-btn {
  min-height: 38px;
  padding: 8px 12px;
  flex: 0 0 auto;
}

.detail-html-frame {
  display: block;
  width: 100%;
  height: 220px;
  margin: 0;
  min-height: 0;
  max-height: none;
  max-width: 100%;
  border: 1px solid rgba(120, 138, 170, 0.1);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  box-sizing: border-box;
}

.detail-html-viewport {
  height: auto;
  padding: 8px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.detail-html-viewport,
.detail-text-viewport,
.detail-body pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(116, 131, 159, 0.62) rgba(226, 233, 246, 0.45);
}

.detail-html-viewport::-webkit-scrollbar,
.detail-text-viewport::-webkit-scrollbar,
.detail-body pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.detail-html-viewport::-webkit-scrollbar-track,
.detail-text-viewport::-webkit-scrollbar-track,
.detail-body pre::-webkit-scrollbar-track {
  background: rgba(226, 233, 246, 0.45);
  border-radius: 999px;
}

.detail-html-viewport::-webkit-scrollbar-thumb,
.detail-text-viewport::-webkit-scrollbar-thumb,
.detail-body pre::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(126, 140, 168, 0.85), rgba(107, 121, 150, 0.86));
  border-radius: 999px;
  border: 2px solid rgba(226, 233, 246, 0.8);
}

.detail-html-viewport::-webkit-scrollbar-thumb:hover,
.detail-text-viewport::-webkit-scrollbar-thumb:hover,
.detail-body pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(108, 123, 154, 0.95), rgba(94, 109, 142, 0.96));
}

.detail-html-viewport::-webkit-scrollbar-button,
.detail-text-viewport::-webkit-scrollbar-button,
.detail-body pre::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  margin: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

@media (max-width: 1360px) {
  .layout {
    grid-template-columns: 262px minmax(0, 1fr);
    gap: 10px;
  }

  .mailbox-grid {
    grid-template-columns: minmax(230px, 0.57fr) minmax(0, 1.43fr);
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .message-list-wrap,
  .message-detail {
    height: auto;
  }
}

@media (max-height: 900px) {
  .hero-copy-wrap {
    padding: 6px 8px;
  }

  .panel {
    padding: 10px;
  }

  .mailbox-grid {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .detail-html-frame {
    height: 180px;
  }
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .layout,
  .mailbox-grid,
  .mailbox-summary {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 24px, 1280px);
    height: auto;
    min-height: 100vh;
  }

  .mailbox-grid {
    height: auto;
    min-height: auto;
  }

  .message-list-wrap,
  .message-detail {
    height: auto;
    max-height: none;
  }

  .detail-html-frame {
    height: 420px;
    max-height: none;
  }

  .detail-html-shell,
  .detail-text-shell {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1280px);
    padding: 20px 0 28px;
  }

  .hero {
    gap: 16px;
    margin-bottom: 16px;
  }

  .hero-copy-wrap {
    padding: 2px 0;
  }

  .hero-actions,
  .hero-points,
  .hero-topline,
  .hero-main,
  .mailbox-headline,
  .mailbox-meta-row,
  .refresh-info,
  .panel-header,
  .toolbar,
  .status-row {
    flex-wrap: wrap;
  }

  .layout {
    gap: 14px;
  }

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

  .panel {
    padding: 16px;
  }

  .mailbox-summary {
    gap: 8px;
  }

  .mailbox-grid {
    gap: 12px;
    margin-top: 14px;
  }

  .message-list-wrap,
  .message-detail {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 16px, 1280px);
    padding-top: 16px;
  }

  .panel,
  .hero-copy-wrap {
    border-radius: 18px;
    padding: 14px;
  }

  .hero-topline,
  .hero-main,
  .mailbox-headline,
  .mailbox-meta-row,
  .refresh-info,
  .panel-header,
  .toolbar,
  .status-row,
  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-points {
    gap: 8px;
  }

  .hero-points span {
    width: 100%;
    text-align: center;
  }
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 21px;
  }

  .hero-copy {
    font-size: 14px;
  }

  .address-box code {
    font-size: 15px;
  }

  .message-item-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .message-detail.empty-state {
    min-height: 260px;
  }

  .code-card {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 12px;
  }

  .code-card strong {
    font-size: 22px;
    letter-spacing: 0.05em;
  }

  .code-copy-btn {
    width: 100%;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .message-detail {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100% - 12px, 1280px);
  }

  .panel,
  .hero-copy-wrap {
    padding: 12px;
  }

  .summary-card,
  .message-item,
  .code-card {
    padding-left: 12px;
    padding-right: 12px;
  }

  .domain-menu {
    max-height: 220px;
  }
}
