:root {
  color-scheme: light;
  --page: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #1f2933;
  --text-muted: #6b7785;
  --text-faint: #9aa5b1;
  --line: #dce2e8;
  --line-soft: #e9edf1;
  --blue: #0877c9;
  --blue-strong: #0563a8;
  --cyan: #20b8d6;
  --green: #158765;
  --green-soft: #e9f7f1;
  --amber: #b66b00;
  --red: #c53a45;
  --red-soft: #fff0f1;
  --navy: #15344c;
  --shadow: 0 14px 36px rgba(23, 43, 58, 0.09);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

html.dark {
  color-scheme: dark;
  --page: #141719;
  --surface: #1e2225;
  --surface-2: #272d31;
  --text: #eef2f4;
  --text-muted: #a7b0b7;
  --text-faint: #76818a;
  --line: #374047;
  --line-soft: #2d3439;
  --green-soft: #17392e;
  --red-soft: #3c2024;
  --navy: #102d43;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(32, 184, 214, 0.28);
  outline-offset: 2px;
}

.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;
}

.announcement {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  background: #172c3c;
  color: #d9e4eb;
  font-size: 12px;
}

.announcement-dot,
.status-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #37d39a;
  box-shadow: 0 0 0 3px rgba(55, 211, 154, 0.15);
}

.announcement-separator {
  color: #6f899b;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 66px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(1120px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 760;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 7px;
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.header-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: #8fb8d5;
  color: var(--blue);
  background: color-mix(in srgb, var(--surface) 80%, var(--blue) 5%);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.page-shell {
  width: min(1020px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}

.back-link:hover {
  color: var(--blue);
}

.back-link svg {
  width: 15px;
  height: 15px;
}

.hero {
  text-align: center;
  padding: 8px 16px 34px;
  animation: enter-down 420ms ease both;
}

.hero-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 8px;
  box-shadow: 0 13px 26px rgba(8, 119, 201, 0.24);
}

.hero-icon svg {
  width: 29px;
  height: 29px;
}

.hero h1 {
  margin: 0 0 7px;
  font-size: 28px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.credential-panel,
.accounts-panel,
.search-panel {
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  animation: enter-up 380ms ease both;
}

.search-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

#search-input {
  flex: 1 1 240px;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

#search-input::placeholder {
  color: var(--text-faint);
}

#search-input:focus {
  outline: none;
  border-color: var(--blue);
}

.search-submit {
  min-width: 104px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(8, 119, 201, 0.22);
}

.search-form .secondary-button {
  height: 42px;
}

.search-results {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.search-results[hidden] {
  display: none;
}

.search-summary {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.result-group {
  margin-bottom: 14px;
}

.result-group[hidden] {
  display: none;
}

.result-group h3 {
  margin: 0 0 8px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.result-list {
  display: grid;
  gap: 8px;
}

.result-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.3fr) auto;
  grid-template-areas:
    "main meta actions"
    "credentials credentials credentials";
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface-2);
}

.result-main {
  grid-area: main;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.result-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.result-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.result-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.result-meta svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}

.result-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.result-credentials {
  grid-area: credentials;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.credential-field {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.credential-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.credential-field code {
  display: block;
  max-height: 88px;
  overflow: auto;
  color: var(--text);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: text;
}

.credential-field-token {
  grid-column: 1 / -1;
}

.result-credentials.is-incomplete {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.result-credentials.is-incomplete svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--amber);
}

.credential-panel {
  padding: 26px;
  background: linear-gradient(135deg, #12324a 0%, #174c70 100%);
  color: #fff;
  animation: enter-up 420ms 80ms ease both;
}

.accounts-panel {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  animation: enter-up 360ms ease both;
}

.panel-heading,
.section-heading,
.input-toolbar,
.input-meta,
.security-strip,
.site-footer,
.dialog-header,
.mail-meta {
  display: flex;
  align-items: center;
}

.panel-heading {
  gap: 13px;
}

.panel-heading h2 {
  margin: 0 0 3px;
  font-size: 17px;
  line-height: 1.3;
}

.panel-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.panel-heading-inverse {
  margin-bottom: 17px;
}

.panel-heading-inverse h2 {
  color: #fff;
}

.panel-heading-inverse p {
  color: rgba(255, 255, 255, 0.56);
}

.panel-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}

.panel-icon svg {
  width: 20px;
  height: 20px;
}

.panel-icon-inverse {
  color: #70e7f7;
  background: rgba(255, 255, 255, 0.13);
}

.panel-icon-blue {
  color: var(--blue);
  background: #e6f2fb;
}

html.dark .panel-icon-blue {
  background: rgba(8, 119, 201, 0.17);
}

#credential-input {
  width: 100%;
  min-height: 116px;
  max-height: 280px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  caret-color: #6ce9f7;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  transition: background 160ms ease, border-color 160ms ease;
}

#credential-input:hover {
  border-color: rgba(255, 255, 255, 0.38);
}

#credential-input:focus {
  outline: none;
  border-color: #6ce9f7;
  background: rgba(255, 255, 255, 0.14);
}

#credential-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.input-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin-top: 15px;
}

.input-meta {
  min-width: 0;
  flex-wrap: wrap;
  gap: 16px;
}

#line-count {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.segment-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
}

.segment-control legend {
  float: left;
  margin: 0 7px 0 3px;
  padding: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 28px;
}

.segment-control label {
  cursor: pointer;
}

.segment-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-control span {
  min-width: 46px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 650;
}

.segment-control input:checked + span {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.primary-button,
.secondary-button,
.row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 650;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.primary-button {
  min-width: 126px;
  height: 42px;
  border: 0;
  padding: 0 18px;
  background: #fff;
  color: #0e4a70;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.row-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.primary-button svg,
.secondary-button svg,
.row-button svg {
  width: 16px;
  height: 16px;
}

.inline-error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 126, 135, 0.35);
  border-radius: 7px;
  background: rgba(197, 58, 69, 0.18);
  color: #ffb1b7;
  font-size: 13px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.secondary-button {
  height: 36px;
  border: 1px solid var(--line);
  padding: 0 13px;
  background: var(--surface);
  color: var(--text-muted);
}

.danger-button:hover {
  border-color: #ecb4b8;
  background: var(--red-soft);
  color: var(--red);
}

.security-strip {
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #bde2d3;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
}

.security-strip svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.table-scroll {
  overflow-x: auto;
}

.account-table {
  min-width: 760px;
}

.account-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(210px, 2fr) minmax(150px, 1.2fr) minmax(165px, 1.35fr) 190px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row.is-success {
  background: color-mix(in srgb, var(--green-soft) 58%, transparent);
}

.account-row.is-error {
  background: color-mix(in srgb, var(--red-soft) 58%, transparent);
}

.account-row.is-highlight {
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  box-shadow: inset 3px 0 var(--blue);
}

.account-header {
  min-height: 40px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.cell {
  min-width: 0;
  padding: 8px 6px;
}

.cell-index {
  text-align: center;
  color: var(--text-muted);
  font-weight: 700;
}

.cell-email,
.cell-password {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-email {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 650;
}

.email-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-password {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "Cascadia Code", Consolas, monospace;
  color: var(--text-muted);
  font-size: 12px;
}

.password-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-icon-button {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.mini-icon-button:hover {
  color: var(--blue);
  background: var(--surface-2);
}

.mini-icon-button.danger:hover {
  color: var(--red);
  background: var(--red-soft);
}

.mini-icon-button svg {
  width: 16px;
  height: 16px;
}

.cell-status {
  color: var(--text-muted);
  font-size: 12px;
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.status-wrap span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-icon {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-icon.loading {
  border: 2px solid #b7d9ef;
  border-top-color: var(--blue);
  background: transparent;
  animation: spin 700ms linear infinite;
}

.status-icon.success {
  background: var(--green);
}

.status-icon.error {
  background: var(--red);
}

.token-tag {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 21px;
  margin-right: 5px;
  padding: 0 7px;
  border-radius: 5px;
  color: #fff;
  background: var(--green);
  font-size: 10px;
  font-weight: 750;
}

.token-tag.oa2 {
  background: #6254b3;
}

.cell-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.row-button {
  height: 32px;
  border: 1px solid #a8cae2;
  padding: 0 10px;
  background: #f1f8fd;
  color: var(--blue-strong);
  font-size: 12px;
}

html.dark .row-button {
  background: rgba(8, 119, 201, 0.12);
}

.row-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.pagination[hidden] {
  display: none;
}

#page-info {
  min-width: 54px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.site-footer {
  min-height: 70px;
  justify-content: center;
  gap: 18px;
  padding: 18px 24px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-muted);
  background: var(--surface);
  font-size: 12px;
}

.site-footer div {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
}

.site-footer svg {
  width: 15px;
  height: 15px;
}

.mail-dialog {
  width: min(1060px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 27, 36, 0.32);
}

.mail-dialog::backdrop {
  background: rgba(14, 25, 34, 0.56);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dialog-header {
  min-height: 72px;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px 14px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.dialog-titles {
  min-width: 0;
}

.dialog-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.poll-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

#poll-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poll-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--green);
}

.poll-status[data-status="refreshing"] .poll-dot {
  background: var(--blue);
  animation: pulse 900ms ease-in-out infinite;
}

.poll-status[data-status="paused"] {
  color: var(--amber);
}

.poll-status[data-status="paused"] .poll-dot {
  background: var(--amber);
}

.poll-status[data-status="error"] {
  color: var(--red);
  border-color: #ecb4b8;
}

.poll-status[data-status="error"] .poll-dot {
  background: var(--red);
}

#dialog-refresh {
  height: 32px;
  font-size: 12px;
}

.new-tag {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.4px;
}

.mail-item.is-new {
  animation: mail-arrive 520ms ease both;
}

.dialog-kicker {
  margin: 0;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}

.mail-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(310px, 38%) 1fr;
}

.mail-list {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 65%, var(--surface));
}

.mail-item {
  width: 100%;
  min-height: 104px;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.mail-item:hover,
.mail-item.is-active {
  background: var(--surface);
}

.mail-item.is-active {
  box-shadow: inset 3px 0 var(--blue);
}

.unread-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}

.mail-item.is-unread .unread-dot {
  background: var(--blue);
}

.mail-item-content {
  min-width: 0;
}

.mail-topline,
.mail-subject {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-topline {
  justify-content: space-between;
  margin-bottom: 5px;
}

.mail-from,
.mail-subject span,
.mail-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-from {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.mail-time {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 10px;
}

.mail-subject {
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
}

.mail-subject svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--text-faint);
}

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

.mail-reader {
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px;
}

.reader-empty,
.reader-loading,
.mail-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-faint);
}

.reader-empty svg,
.mail-empty svg {
  width: 38px;
  height: 38px;
  stroke-width: 1.4;
}

.reader-loading svg {
  width: 26px;
  height: 26px;
  animation: spin 750ms linear infinite;
}

.reader-header {
  margin-bottom: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.reader-header h3 {
  margin: 0 0 11px;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mail-meta {
  flex-wrap: wrap;
  gap: 7px 15px;
  color: var(--text-muted);
  font-size: 11px;
}

.mail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mail-meta svg {
  width: 13px;
  height: 13px;
}

.reader-body {
  color: var(--text);
  font-size: 13px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.reader-body pre {
  white-space: pre-wrap;
  font-family: inherit;
}

.reader-body img,
.reader-body table {
  max-width: 100%;
}

.reader-body a {
  color: var(--blue);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in 220ms ease both;
}

.toast.success svg {
  color: var(--green);
}

.toast.error svg {
  color: var(--red);
}

.toast svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

@keyframes enter-down {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes enter-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.28; }
}

@keyframes mail-arrive {
  from { opacity: 0; transform: translateY(-8px); background: color-mix(in srgb, var(--blue) 14%, transparent); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 760px) {
  .announcement {
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
  }

  .header-inner,
  .page-shell {
    width: min(100% - 24px, 1020px);
  }

  .header-status {
    display: none;
  }

  .hero {
    padding-bottom: 26px;
  }

  .hero h1 {
    font-size: 25px;
  }

  .credential-panel,
  .accounts-panel,
  .search-panel {
    padding: 19px 15px;
  }

  .search-form {
    gap: 8px;
  }

  #search-input {
    flex: 1 1 100%;
  }

  .search-submit {
    flex: 1 1 100%;
    width: 100%;
  }

  .search-form .secondary-button {
    flex: 1 1 calc(50% - 4px);
  }

  .result-item {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "main"
      "meta"
      "credentials"
      "actions";
    gap: 7px;
  }

  .result-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .result-credentials {
    grid-template-columns: minmax(0, 1fr);
  }

  .credential-field-token {
    grid-column: auto;
  }

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

  .input-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .primary-button {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
  }

  .security-strip {
    align-items: flex-start;
    line-height: 1.5;
  }

  .table-scroll {
    overflow-x: visible;
  }

  .account-table {
    min-width: 0;
  }

  .account-header {
    display: none;
  }

  .account-row {
    min-height: 0;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
      "index email"
      "index password"
      "index status"
      "actions actions";
    gap: 2px 8px;
    padding: 12px 0;
  }

  .account-row .cell-index {
    grid-area: index;
    align-self: start;
    padding-top: 10px;
  }

  .account-row .cell-email {
    grid-area: email;
  }

  .account-row .cell-password {
    grid-area: password;
  }

  .account-row .cell-status {
    grid-area: status;
  }

  .account-row .cell-actions {
    grid-area: actions;
    justify-content: flex-start;
    padding: 7px 6px 2px 48px;
  }

  .account-row .row-button {
    min-width: 92px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .mail-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .dialog-header {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .dialog-titles {
    flex: 1 1 100%;
    min-width: 0;
  }

  .dialog-header h2 {
    font-size: 16px;
  }

  .dialog-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .mail-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 42%) 1fr;
  }

  .mail-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mail-reader {
    padding: 20px 18px;
  }
}

@media (max-width: 430px) {
  .segment-control {
    width: 100%;
  }

  .segment-control legend {
    display: none;
  }

  .segment-control label {
    flex: 1;
  }

  .segment-control span {
    width: 100%;
  }

  .section-heading .panel-heading p {
    max-width: 165px;
  }

  .search-panel .panel-heading p {
    max-width: 190px;
  }

  .dialog-tools {
    gap: 6px;
  }

  .poll-status {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    overflow: hidden;
  }

  #dialog-refresh {
    flex: 0 0 auto;
    margin-left: 0;
    padding: 0 10px;
  }
}
