:root {
  --bg: #0b1020;
  --bg-soft: #11182c;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --panel-muted: #eef2f7;
  --text: #18212f;
  --text-soft: #5b677a;
  --line: #d9e1ec;
  --brand: #0f5ef7;
  --brand-deep: #0b43ad;
  --success: #0f9f6e;
  --warning: #d97706;
  --danger: #d92d20;
  --shadow: 0 18px 40px rgba(12, 20, 38, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 94, 247, 0.14), transparent 22%),
    radial-gradient(circle at top right, rgba(15, 159, 110, 0.12), transparent 18%),
    linear-gradient(180deg, #edf2f9 0%, #e7edf6 100%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7d8ba1;
}

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

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(11, 16, 32, 0.16);
}

.login-brand {
  padding: 42px;
  color: white;
  background:
    linear-gradient(160deg, rgba(15, 94, 247, 0.94), rgba(11, 67, 173, 0.92)),
    linear-gradient(180deg, #0f5ef7, #0b43ad);
}

.login-brand h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1.06;
}

.login-copy {
  max-width: 420px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 16px;
  line-height: 1.7;
}

.login-form {
  padding: 42px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.login-form label {
  font-weight: 700;
  color: var(--text-soft);
}

.login-row {
  display: flex;
  gap: 12px;
}

.login-row input,
.login-row button { height: 54px; }

.login-row button {
  flex: 0 0 auto;
  min-width: 132px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: white;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(15, 94, 247, 0.56);
  box-shadow: 0 0 0 4px rgba(15, 94, 247, 0.12);
}

button {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  color: white;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 24px rgba(15, 94, 247, 0.18);
  white-space: nowrap;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    filter .16s ease,
    opacity .16s ease,
    background .16s ease,
    color .16s ease,
    border-color .16s ease;
}

button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 94, 247, 0.24);
}
button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(15, 94, 247, 0.18);
}
button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  box-shadow: none;
}
button.ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
button.ghost:hover {
  border-color: #b8c7dc;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}
button.danger {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
}
button.danger:hover {
  box-shadow: 0 16px 28px rgba(185, 28, 28, 0.22);
}
button.wide { width: 100%; }
button.is-loading {
  position: relative;
}

.status-text {
  margin: 0;
  min-height: 20px;
  color: var(--text-soft);
}

.hint-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid #e3eaf4;
  color: var(--text-soft);
}

.hint-box span,
.sidebar-meta span,
.metric-label,
.panel-head p,
.table-note {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
}

.hint-box strong,
.sidebar-meta strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  color: white;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 24%),
    linear-gradient(180deg, #0d1326 0%, #101a33 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar h2 {
  margin: 0;
  font-size: 30px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin: 28px 0;
}

.sidebar-link {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  color: rgba(255,255,255,0.82);
  background: rgba(255,255,255,0.04);
  box-shadow: none;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: white;
  background: rgba(255,255,255,0.08);
}

.sidebar-meta {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  padding: 28px;
  overflow: hidden;
}

.action-status {
  min-width: 180px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #304154;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(184, 199, 220, 0.8);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.action-status.info {
  color: #304154;
}

.action-status.pending {
  color: #8a5204;
  background: #fff7eb;
  border-color: #f6d7a8;
}

.action-status.success {
  color: #0f6a4a;
  background: #ebfaf2;
  border-color: #b8e8d0;
}

.action-status.error {
  color: #a22c20;
  background: #fff0ee;
  border-color: #f0c0bb;
}

.workspace-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.workspace-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.workspace-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.view-page {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.view-page.active {
  display: block;
}

.view-page[data-view="messages"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 4px;
}

.view-page[data-view="messages"].active {
  display: flex;
  flex-direction: column;
}

.view-page[data-view="messages"] .section-grid.full {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

.topbar-actions,
.button-row,
.toolbar-row,
.panel-head,
.switch-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-head {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(760px, 1.45fr);
  align-items: end;
  gap: 18px;
  min-width: 0;
}

.solo-toolbar {
  grid-template-columns: 1fr;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.filter-toolbar .compact-select {
  min-width: 220px;
  width: 100%;
}

.filter-toolbar input {
  min-width: 0;
  width: 100%;
}

.filter-toolbar button {
  justify-self: start;
}

.toolbar-slot {
  min-width: 0;
}

.toolbar-slot-actions {
  display: flex;
  justify-content: flex-start;
  margin-left: 14px;
  min-width: max-content;
}

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

.toolbar-slot-actions .workspace-toolbar-actions button {
  padding: 10px 14px;
}

.toolbar-slot-actions .action-status {
  min-width: 150px;
  padding: 9px 12px;
}

.section-block,
.section-grid {
  margin-bottom: 18px;
}

.section-grid {
  display: grid;
  gap: 18px;
}

.section-grid.two-one {
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr);
}

.section-grid.one-one {
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
}

.section-grid.full {
  grid-template-columns: 1fr;
}

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

.metric-card,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 700;
}

.panel {
  padding: 22px;
}

.panel-head {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-head h3 {
  margin: 0;
  font-size: 22px;
}

.panel-head p {
  margin: 6px 0 0;
  font-size: 13px;
}

.compact { margin-bottom: 12px; }
.sticky-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.switch-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.switch-row input { width: auto; margin: 0; }

.table-wrap {
  overflow: auto;
  border: 1px solid #edf1f6;
  border-radius: 18px;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-top: 8px;
  padding: 8px 2px 0;
  overflow-x: auto;
}

.pagination-summary {
  color: var(--text-soft);
  font-size: 11px;
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-left: auto;
}

.pagination-btn {
  min-width: 32px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #d6e0ed;
  background: white;
  color: var(--text);
  box-shadow: none;
  font-size: 13px;
}

.pagination-btn:hover:not(:disabled) {
  border-color: #b3c4db;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.pagination-btn.icon-btn {
  min-width: 30px;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1;
}

.pagination-state {
  min-width: 58px;
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: white;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f6;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e8f0ff;
  color: var(--brand-deep);
}

.badge.success { background: #e7f8f0; color: var(--success); }
.badge.warn { background: #fff3e6; color: var(--warning); }
.badge.danger { background: #ffe8e6; color: var(--danger); }
.badge.neutral { background: #eef2f7; color: #526173; }

.codebox {
  margin: 0;
  border-radius: 16px;
  padding: 16px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.codebox.small { min-height: 180px; }
.codebox.medium { min-height: 160px; }
.codebox.large { min-height: 420px; }
.compact-select { min-width: 170px; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.generated-result {
  display: grid;
  gap: 12px;
  min-height: 180px;
  padding: 16px;
  border: 1px solid #e2eaf4;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}

.generated-result.empty {
  place-items: center;
  color: var(--text-soft);
  text-align: center;
}

.generated-head,
.generated-item,
.copy-inline,
.mail-recipient-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.generated-summary {
  display: grid;
  gap: 4px;
}

.generated-summary span,
.generated-meta {
  color: var(--text-soft);
  font-size: 12px;
}

.generated-list {
  display: grid;
  gap: 10px;
}

.generated-item {
  padding: 12px 14px;
  border: 1px solid #dfe8f5;
  border-radius: 16px;
  background: white;
}

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

.generated-email,
.copy-value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.copy-btn,
.copy-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid #d3dff1;
  background: #f7fbff;
  color: var(--brand-deep);
  box-shadow: none;
}

.copy-btn {
  min-height: 36px;
  padding: 8px 12px;
}

.copy-btn svg,
.copy-chip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: currentColor;
}

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

.copy-btn.subtle {
  background: #ffffff;
}

.copy-btn:hover,
.copy-chip:hover {
  border-color: #9cb8eb;
  background: #eef5ff;
  box-shadow: 0 10px 22px rgba(15, 94, 247, 0.12);
}

.copy-btn.copied,
.copy-chip.copied {
  color: var(--success);
  background: #ebfaf2;
  border-color: #b8e8d0;
}

.copy-chip {
  padding: 6px 10px;
  border-radius: 999px;
}

.copy-chip-label {
  color: #5d6a7b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.copy-chip strong {
  color: inherit;
  font-size: 13px;
}

.copy-chip.muted {
  color: var(--text-soft);
  background: #f4f7fb;
  border-color: #e4ebf4;
  cursor: default;
}

.mail-center-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.mail-center-layout > * {
  min-width: 0;
}

.mail-list-panel,
.mail-detail-panel {
  min-height: 0;
  border: 1px solid #edf1f6;
  border-radius: 18px;
  background: #fbfcfe;
}

.messages-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mail-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-list {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.mail-item {
  display: grid;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 94px;
  padding: 14px 14px 13px;
  border: 1px solid #dfe7f2;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  background: white;
  box-shadow: none;
  white-space: normal;
  overflow: hidden;
  cursor: pointer;
}

.mail-item:hover {
  border-color: #b7c8e2;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.07);
}

.mail-item:focus-visible {
  outline: 3px solid rgba(15, 94, 247, 0.18);
  outline-offset: 2px;
}

.mail-item.active {
  border-color: rgba(15, 94, 247, 0.35);
  background: linear-gradient(180deg, rgba(15, 94, 247, 0.06), rgba(15, 94, 247, 0.02));
  box-shadow: 0 12px 24px rgba(15, 94, 247, 0.1);
}

.mail-item-top,
.mail-item-meta,
.detail-head,
.detail-meta-grid {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.mail-item-subject {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.mail-item-snippet {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.mail-item-meta {
  color: var(--text-soft);
  font-size: 11px;
  align-items: center;
}

.mail-recipient,
.mail-sender {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mail-recipient {
  font-size: 13px;
  line-height: 1.45;
}

.mail-recipient-group .copy-btn.icon-only {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.mail-detail-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.detail-head {
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f6;
}

.detail-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #526173;
  background: #eef2f7;
}

.detail-empty {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 520px;
  padding: 24px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.8;
}

.detail-pane {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding-top: 16px;
}

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

.detail-meta,
.detail-block {
  display: grid;
  gap: 6px;
}

.detail-block:last-child {
  flex: 1 1 auto;
  min-height: 0;
}

.detail-meta {
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e8eef6;
}

.detail-meta span,
.detail-block span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-meta strong,
.detail-block strong {
  color: var(--text);
}

.detail-block p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.detail-body-box {
  min-height: 260px;
  height: 100%;
  padding: 22px 24px;
  background: linear-gradient(180deg, #fffefc, #f7fbff);
  color: #1f3248;
  border: 1px solid #dfe8f5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-family: "Georgia", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.detail-body-box::selection {
  background: rgba(15, 94, 247, 0.18);
}

.detail-body-box:empty::before {
  content: "无文本正文";
  color: #7b8aa0;
  font-style: italic;
}

.dialog-card {
  width: min(980px, calc(100vw - 24px));
  padding: 22px;
  background: white;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 28px 60px rgba(11, 16, 32, 0.22);
}

dialog {
  border: none;
  padding: 0;
  background: transparent;
}

dialog::backdrop { background: rgba(15, 23, 42, 0.58); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  padding: 14px 16px;
  border-radius: 14px;
  color: white;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 18px 38px rgba(0,0,0,0.24);
  animation: toast-in .18s ease;
}

.toast.success { background: rgba(15, 159, 110, 0.96); }
.toast.error { background: rgba(217, 45, 32, 0.96); }

.empty-row {
  text-align: center;
  color: var(--text-soft);
  padding: 32px 16px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-grid.two-one { grid-template-columns: 1fr; }
  .filter-head,
  .mail-center-layout {
    grid-template-columns: 1fr;
  }
  .sticky-panel { position: static; }
  .mail-center-layout {
    height: auto;
  }
  .filter-toolbar {
    grid-template-columns: minmax(190px, 240px) minmax(220px, 1fr) auto;
  }
  .toolbar-slot-actions {
    grid-column: 1 / -1;
    margin-left: 0;
    margin-top: 6px;
  }
}

@media (max-width: 1120px) {
  .section-grid.one-one { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .login-card { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .workspace {
    height: auto;
    padding: 18px;
    overflow: visible;
  }
  .workspace-body,
  .view-page {
    height: auto;
    overflow: visible;
  }
  .view-page[data-view="messages"] {
    overflow: visible;
  }
  .view-page[data-view="messages"].active {
    display: block;
  }
  .view-page[data-view="messages"] .section-grid.full,
  .messages-panel {
    min-height: auto;
  }
  .action-status {
    min-width: 0;
  }
  .filter-head {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .filter-toolbar {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .workspace-toolbar {
    justify-content: stretch;
  }
  .workspace-toolbar-actions {
    width: 100%;
  }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .login-shell,
  .workspace { padding: 14px; }
  .summary-grid,
  .switch-grid { grid-template-columns: 1fr; }
  .login-row,
  .topbar-actions,
  .toolbar-row,
  .button-row { flex-direction: column; }
  .filter-toolbar {
    grid-template-columns: 1fr;
  }
  .filter-toolbar .compact-select,
  .filter-toolbar input,
  .filter-toolbar button {
    min-width: 0;
    width: 100%;
  }
  .toolbar-slot-actions {
    margin-top: 2px;
    margin-left: 0;
  }
  .toolbar-slot-actions .workspace-toolbar-actions {
    width: 100%;
    flex-direction: column;
  }
  .mail-list {
    min-height: 360px;
  }
  .list-pagination {
    gap: 8px;
  }
  .detail-empty {
    min-height: 260px;
  }
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }
}
