/*
 * Mail Admin visual refresh
 * Native CSS implementation inspired by Fluent 2 and Linear-style admin surfaces.
 * This is not the official Fluent UI package; the existing framework-free app is preserved.
 * Dials: DESIGN_VARIANCE 4 / MOTION_INTENSITY 3 / VISUAL_DENSITY 8.
 */

:root {
  color-scheme: light;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f2f5f8;
  --bg-pattern: none;
  --glass-bg: #fbfcfe;
  --glass-bg-hover: #fbfcfe;
  --glass-border: #dfe5ec;
  --glass-shadow: 0 1px 2px rgba(28, 39, 55, 0.04), 0 8px 24px rgba(28, 39, 55, 0.035);
  --glass-shadow-lg: 0 8px 30px rgba(28, 39, 55, 0.10);
  --glass-blur: none;
  --text-primary: #172033;
  --text-secondary: #596579;
  --text-tertiary: #8490a3;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.09);
  --danger: #c2414a;
  --danger-hover: #a9343d;
  --success: #2e7d57;
  --border: #e4e9ef;
  --border-input: #d8dfe8;
  --radius-sm: 7px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

html { background: var(--bg); }

body {
  background: var(--bg);
  background-image: none;
  color: var(--text-primary);
  line-height: 1.5;
}

button,
input,
select,
textarea { font-family: var(--font-body); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.72);
  outline-offset: 2px;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.glass-card:hover {
  border-color: #d9e0e8;
  box-shadow: var(--glass-shadow);
}

/* Header: z-index 100, dropdowns 60, modals 1000, toasts 1100. */
.glass-header {
  min-height: 60px;
  background: rgba(248, 250, 252, 0.94);
  border-bottom: 1px solid #dfe5ec;
  box-shadow: 0 1px 0 rgba(28, 39, 55, 0.02);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.header-inner {
  max-width: 1600px;
  min-height: 60px;
  padding: 0 24px;
}

.header-left { gap: 9px; }
.header-left > svg { width: 27px; height: 27px; stroke-width: 2; }

.header-title {
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.header-right {
  gap: 5px;
  padding: 3px;
  border: 1px solid #e2e7ed;
  border-radius: 10px;
  background: rgba(251, 252, 254, 0.8);
}

.btn {
  min-height: 38px;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 100ms ease;
}

.btn:active,
.btn-icon:active,
.view-tab:active,
.btn-paste:active { transform: translateY(1px); }

.btn-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #f8fbff;
}

.btn-primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  transform: none;
}

.btn-ghost {
  border-color: #d8dfe8;
  background: #f9fbfd;
  color: #4f5b6f;
}

.btn-ghost:hover {
  border-color: #cbd4df;
  background: #f0f4f8;
  color: #172033;
}

.btn-danger {
  border-color: #c2414a;
  background: #c2414a;
  color: #fff8f8;
}

.btn-danger:hover { background: #a9343d; }

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #637085;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 100ms ease;
}

.btn-icon:hover {
  border-color: #dce3eb;
  background: #eef3f8;
  color: #172033;
}

.main-content {
  max-width: 1600px;
  gap: 18px;
  padding: 22px 24px 56px;
}

/* Metrics are one summary surface, not two floating cards. */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  background: #fbfcfe;
  box-shadow: var(--glass-shadow);
}

.stat-card,
.stat-card:hover {
  min-height: 82px;
  gap: 13px;
  padding: 15px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stat-card + .stat-card { border-left: 1px solid #e5eaf0; }

.stat-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #dce5f4;
  border-radius: 9px;
  background: #edf4ff;
  color: #315fa8;
}

.stat-icon svg { width: 20px; height: 20px; stroke-width: 1.8; }

.stat-value {
  color: #172033;
  font-size: 21px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.stat-label {
  margin-top: 1px;
  color: #6f7b8e;
  font-size: 11px;
  font-weight: 550;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.form-card,
.domain-card,
.dns-card {
  padding: 22px;
}

.form-card h2,
.list-card h2,
.dns-card h2,
.domain-card h2 {
  margin-bottom: 17px;
  color: #172033;
  font-size: 16px;
  font-weight: 730;
  letter-spacing: -0.015em;
}

.section-header {
  margin-bottom: 16px;
}

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

.input-group label {
  margin-bottom: 6px;
  color: #5b6678;
  font-size: 12px;
  font-weight: 650;
}

.input-group input,
.input-group textarea,
.input-group select,
.template-row select,
.pw-label-input,
.forward-create-input,
#saved-pw-select,
#modal-saved-pw-select {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #d8dfe8;
  border-radius: 8px;
  background: #fdfefe;
  color: #202a3c;
  font-size: 13px;
  box-shadow: inset 0 1px 1px rgba(28, 39, 55, 0.025);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-group input:hover,
.input-group textarea:hover,
.input-group select:hover,
.template-row select:hover,
.pw-label-input:hover,
.forward-create-input:hover,
#saved-pw-select:hover,
#modal-saved-pw-select:hover { border-color: #c7d0db; }

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus,
.template-row select:focus,
.pw-label-input:focus,
.forward-create-input:focus,
#saved-pw-select:focus,
#modal-saved-pw-select:focus {
  border-color: #5b8def;
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.input-group input::placeholder,
.input-group textarea::placeholder,
.pw-label-input::placeholder,
.forward-create-input::placeholder { color: #8b96a7; opacity: 1; }

.input-group input:disabled,
.input-group select:disabled,
.pw-label-input:disabled,
.forward-create-input:disabled,
#saved-pw-select:disabled {
  background: #f0f3f6;
  color: #7f8a9a;
  opacity: 1;
  cursor: not-allowed;
}

.checkbox-row {
  min-height: 36px;
  gap: 7px;
  color: #4f5b6d;
  font-size: 12px;
  font-weight: 550;
}

.checkbox-row input,
.email-select { accent-color: #2563eb; }

.password-wrapper .toggle-pw {
  right: 3px;
  width: 34px;
  height: 34px;
}

.domain-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px max-content max-content;
  align-items: end;
  gap: 9px;
}

.domain-form .input-group,
.domain-form .btn { margin-bottom: 0; }

.domain-form .btn { min-height: 40px; }
#manage-domain { min-width: 0; padding: 9px 11px; font-size: 13px; }
.provider-group { width: auto; }

.domain-input-wrap { gap: 7px; }

.btn-paste {
  min-width: 42px;
  border-color: #d8dfe8;
  border-radius: 8px;
  background: #f8fafc;
  color: #596579;
}

.btn-paste:hover {
  border-color: #cbd4df;
  background: #edf2f7;
}

.extra-dns-collapse,
.domain-list-collapse {
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid #e1e7ee;
  border-radius: 9px;
  background: #f7f9fb;
}

.extra-dns-collapse[open],
.domain-list-collapse[open] { padding-bottom: 12px; }

.extra-dns-summary {
  min-height: 28px;
  color: #334055;
  font-size: 13px;
  font-weight: 650;
}

.extra-dns-summary::before { color: #7d899a; }
.extra-dns-summary .hint { color: #7c8797; font-size: 11px; }

.required-dns-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 7px 0 8px;
  color: #788496;
  font-size: 11px;
}

.required-dns-records {
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #fff;
}

.required-dns-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 58px minmax(110px, .75fr) minmax(180px, 1.8fr) 78px;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-bottom: 1px solid #edf0f4;
}

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

.required-dns-copy {
  min-width: 0;
  padding: 4px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #344158;
  font: 500 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: copy;
}

.required-dns-copy:hover,
.required-dns-copy:focus-visible { background: #edf4ff; color: #245bb1; outline: 0; }
.required-dns-value { color: #4d5a6e; }
.required-dns-extra { color: #8791a0; font-size: 10px; text-align: right; white-space: nowrap; }
.required-dns-empty { padding: 17px 12px; color: #7c8797; font-size: 12px; text-align: center; }
.required-dns-empty.is-error { color: #b44242; }

.spaceship-credential-form {
  display: grid;
  grid-template-columns: minmax(110px, .65fr) minmax(180px, 1fr) minmax(200px, 1.25fr);
  gap: 9px;
  margin-top: 8px;
}

.spaceship-credential-form .input-group { margin-bottom: 0; }
.spaceship-credential-form input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.spaceship-credential-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.spaceship-credential-actions .credential-remove { color: #a73b3b; }

.domain-item,
.saved-pw-item,
.forward-item {
  border: 1px solid #e2e7ed;
  border-radius: 8px;
  background: #fbfcfd;
}

.domain-item { padding: 10px 12px; }
.domain-name { font-size: 13px; }
.domain-meta { color: #687589; }

.saved-pw-item { padding: 9px 11px; }
.saved-pw-label { font-size: 13px; font-weight: 650; }
.saved-pw-secret { color: #596579; font-size: 12px; }
.hint-text { color: #788496; }

.pwd-options,
.create-forward-row {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}

.create-forward-row { margin-bottom: 14px; }

.combo-dropdown {
  border-color: #d8dfe8;
  border-radius: 9px;
  background: #fbfcfe;
  box-shadow: 0 16px 36px rgba(28, 39, 55, 0.14);
}

.combo-item { border-radius: 7px; font-size: 13px; }
.combo-item:hover,
.combo-item.hi { background: #edf4ff; }

.status-pill {
  border: 1px solid #e0e5eb;
  border-radius: 6px;
  background: #f0f3f6;
}

.status-pill.ok {
  border-color: rgba(46, 125, 87, 0.18);
  background: rgba(46, 125, 87, 0.08);
}

.status-pill.warn {
  border-color: rgba(154, 106, 31, 0.18);
  background: rgba(154, 106, 31, 0.09);
}

/* Unified inbox */
.unified-card {
  margin-bottom: 0;
  border-color: #dfe5ec;
  background: #fbfcfe;
  box-shadow: var(--glass-shadow);
}

.unified-card:hover { border-color: #dfe5ec; box-shadow: var(--glass-shadow); }

.unified-header {
  padding: 20px 22px 17px;
  border-bottom-color: #e5eaf0;
  background: #fbfcfe;
}

.unified-title-icon { color: #365a8d; }

.unified-title-row h2 {
  color: #172033;
  font-size: 18px;
  font-weight: 740;
}

.unified-title-row p { color: #6b7688; }

.unified-meta { margin-top: 10px; }

.ustat { color: #667286; }
.ustat strong { color: #273247; }
.ustat + .ustat::before {
  width: 1px;
  height: 12px;
  margin: 0 10px;
  border-radius: 0;
  background: #d8dfe8;
}
.ustat-unread,
.ustat-unread strong { color: #2563eb; }

.unified-period-control > span,
.unified-mailbox-filter > span {
  color: #788496;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.unified-period-control select,
.unified-mailbox-filter select,
.unified-refresh,
.unified-search-field,
.unified-unread-filter {
  border-color: #d8dfe8;
  border-radius: 8px;
  background: #f9fbfd;
}

.unified-period-control select,
.unified-mailbox-filter select { color: #2a3548; }

.unified-toolbar {
  padding: 12px 22px;
  border-bottom-color: #e5eaf0;
  background: #f5f7fa;
}

.unified-search-field:focus-within,
.unified-period-control select:focus,
.unified-mailbox-filter select:focus {
  border-color: #5b8def;
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.unified-toggle { background: #ccd3dc; }
.unified-unread-filter input:checked + .unified-toggle { background: #2563eb; }

.unified-list-head {
  border-bottom-color: #e7ebf0;
  color: #7d8999;
  background: #fafbfd;
}

.unified-list-shell { background: #fbfcfe; }
.unified-item { border-bottom-color: #e9edf2; }
.unified-item:hover { background: #f3f6fa; }
.unified-item.is-unread { background: #f2f7ff; }
.unified-item.is-unread:hover { background: #ebf3ff; }
.unified-item.is-unread::before { background: #2563eb; }
.unified-dot { opacity: 0; }
.unified-item.is-unread .unified-dot { opacity: 1; background: #2563eb; }

.unified-avatar {
  border-radius: 8px;
  background: #eef1f5;
  color: #5c687a;
}

.unified-item.is-unread .unified-avatar {
  border-color: #d5e4fb;
  background: #e6f0ff;
  color: #245bb1;
}

.unified-more { background: #f7f9fb; }

.unified-reader-card {
  width: 100%;
  max-width: 920px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  animation: slideUp 220ms cubic-bezier(.16,1,.3,1);
}

.meta-separator {
  display: inline-block;
  width: 1px;
  height: 12px;
  margin: 0 9px;
  vertical-align: -1px;
  background: #d8dfe8;
}

.attachment-label {
  margin-right: 3px;
  color: #687589;
  font-size: 11px;
  font-weight: 650;
}

/* Email list becomes a contained workspace instead of an endless page. */
.list-card {
  height: clamp(560px, 78dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.list-header {
  flex: 0 0 auto;
  gap: 12px;
  margin: 0;
  padding: 17px 20px;
  border-bottom: 1px solid #e4e9ef;
  background: #fbfcfe;
}

.list-header h2 {
  margin: 0;
  font-size: 16px;
}

.list-tools { gap: 7px; }

.view-tabs {
  gap: 2px;
  padding: 2px;
  border: 1px solid #dce3eb;
  border-radius: 9px;
  background: #eef2f6;
}

.view-tab {
  min-height: 29px;
  padding: 0 11px;
  border-radius: 7px;
  color: #657186;
  font-size: 12px;
}

.view-tab.active {
  background: #fbfcfe;
  color: #245bb1;
  box-shadow: 0 1px 2px rgba(28, 39, 55, 0.09);
}

.tab-count {
  min-width: 17px;
  height: 17px;
  margin-left: 5px;
  border-radius: 5px;
  background: #e3f3e9;
  color: #2e7d57;
}

.selected-count { color: #6c788b; }

.search-wrapper {
  min-height: 34px;
  border-color: #d8dfe8;
  border-radius: 8px;
  background: #f9fbfd;
}

.search-wrapper:focus-within {
  border-color: #5b8def;
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.search-wrapper input {
  width: 180px;
  color: #253044;
  font-size: 12px;
}

.email-list {
  flex: 1 1 auto;
  min-height: 0;
  gap: 3px;
  overflow: auto;
  padding: 9px 11px 18px;
  scrollbar-width: thin;
  scrollbar-color: #c7d0dc transparent;
}

.email-list::-webkit-scrollbar { width: 9px; }
.email-list::-webkit-scrollbar-track { background: transparent; }
.email-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #c7d0dc;
  background-clip: padding-box;
}

.domain-group + .domain-group { margin-top: 5px; }

.domain-group-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 38px;
  margin-bottom: 2px;
  padding: 7px 10px;
  border-color: #e1e6ed;
  border-radius: 8px;
  background: rgba(247, 249, 252, 0.97);
  box-shadow: 0 1px 0 rgba(28, 39, 55, 0.025);
  backdrop-filter: blur(10px);
}

.domain-group-header:hover { background: #f1f5f9; }
.dg-name { color: #273247; font-size: 13px; }
.dg-count {
  border-radius: 5px;
  background: #e8edf3;
  color: #647084;
}
.dg-pin { color: #8b6724; }
.domain-group-body { gap: 1px; padding-left: 0; }

.email-item {
  grid-template-columns: 18px minmax(0, 1fr) 250px;
  min-height: 54px;
  column-gap: 12px;
  padding: 7px 9px;
  border-radius: 8px;
}

.email-item:hover,
.email-item.is-clickable:hover { background: #f1f5f9; }

.email-avatar {
  width: 32px;
  height: 32px;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  background: #eef1f5;
  color: #4f5b6f;
  font-size: 12px;
}

.email-info { gap: 10px; }
.email-detail { gap: 3px; }
.email-address { color: #253044; font-size: 13px; font-weight: 650; }
.email-domain,
.email-domain-text,
.email-time { color: #8792a3; }
.email-note { color: #6f7b8e; }

.email-actions {
  width: 250px;
  gap: 1px;
  opacity: 0.72;
  transition: opacity var(--transition);
}

.email-item:hover .email-actions,
.email-item:focus-within .email-actions { opacity: 1; }

.email-actions .btn-icon,
.email-copy-all {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.takeover-badge {
  gap: 3px;
  padding: 1px 6px;
  border-color: #cadcf8;
  border-radius: 6px;
  background: #eaf2ff;
  color: #245bb1;
  font-size: 10px;
}

.tier-header { border-radius: 8px; }
.tier-taken .tier-header { background: rgba(37, 99, 235, 0.07); }
.tier-taken .tier-dot { background: #2563eb; }
.tier-count,
.suffix-label { border-radius: 5px; }

/* Modals and transient feedback */
.modal-overlay {
  z-index: 1000;
  background: rgba(23, 32, 51, 0.34);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.modal-card,
.modal-content {
  border-color: #d8dfe8;
  background: #fbfcfe;
  box-shadow: 0 24px 64px rgba(23, 32, 51, 0.22);
}

.modal-card { padding: 22px; }
.modal-card h3 { color: #172033; font-size: 17px; }
.modal-card p { color: #657186; }

.toast {
  z-index: 1100;
  border: 1px solid #d8dfe8;
  border-radius: 9px;
  background: #172033;
  color: #f7f9fc;
  box-shadow: 0 14px 34px rgba(23, 32, 51, 0.20);
}

.toast.success { background: #256b4e; }
.toast.error { background: #a9343d; }

.empty-state {
  color: #7a8698;
  padding: 34px 20px;
}

.skeleton {
  background: linear-gradient(90deg, #edf0f4 25%, #f7f9fb 50%, #edf0f4 75%);
}

/* Authentication remains simple and product-like. */
.auth-screen { background: #f2f5f8; }
.auth-card {
  max-width: 390px;
  padding: 34px 30px;
  background: #fbfcfe;
  border-color: #dce2e9;
  box-shadow: 0 20px 55px rgba(28, 39, 55, 0.11);
}
.auth-logo { color: #2d3b52; }
.auth-card h1 { color: #172033; font-size: 19px; }
.auth-subtitle { color: #657186; }

@media (max-width: 1100px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .domain-form { grid-template-columns: minmax(0, 1fr) 170px max-content max-content; }
}

@media (max-width: 820px) {
  .header-inner { padding: 0 16px; }
  .main-content { padding: 16px 16px 44px; }

  .unified-header { padding: 18px; }
  .unified-toolbar { padding: 12px 18px; }

  .list-card { height: 76dvh; min-height: 540px; }
  .list-header { align-items: stretch; padding: 15px 16px; }
  .list-tools { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .search-wrapper { flex: 1 1 190px; }
  .search-wrapper input { width: 100%; }
  .email-list { padding: 8px 7px 14px; }
}

@media (max-width: 680px) {
  .glass-header,
  .header-inner { min-height: 56px; }
  .header-inner { padding: 0 12px; }
  .header-left > svg { width: 25px; height: 25px; }
  .header-title { font-size: 15px; }
  .header-right { border: 0; background: transparent; padding: 0; }
  .header-right .btn-icon { width: 32px; height: 32px; }

  .main-content { gap: 12px; padding: 12px 10px 36px; }

  .stats-row { grid-template-columns: 1fr 1fr; border-radius: 12px; }
  .stat-card,
  .stat-card:hover { min-height: 72px; gap: 9px; padding: 12px; }
  .stat-card + .stat-card { border-left: 1px solid #e5eaf0; border-top: 0; }
  .stat-icon { width: 34px; height: 34px; border-radius: 8px; }
  .stat-icon svg { width: 18px; height: 18px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }

  .form-card,
  .domain-card,
  .dns-card { padding: 17px; }

  .domain-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .domain-form .btn { width: 100%; justify-content: center; }

  .pwd-options,
  .create-forward-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }

  .unified-card { border-radius: 12px; }
  .unified-header { padding: 17px 15px 14px; }
  .unified-meta { gap: 4px 11px; }
  .ustat + .ustat::before { display: none; }
  .unified-toolbar { padding: 11px 14px; }

  .list-card { min-height: 520px; height: 76dvh; border-radius: 12px; }
  .list-header { padding: 14px 12px; }
  .view-tabs { order: 1; }
  .selected-count { order: 2; margin-left: auto; }
  #domain-only-tools { order: 3; }
  .list-tools > .btn { order: 4; }
  .search-wrapper { order: 5; flex-basis: 100%; }

  .email-item {
    grid-template-columns: 18px minmax(0, 1fr);
    min-height: 58px;
    row-gap: 5px;
    padding: 8px 7px;
  }
  .email-actions {
    grid-column: 2;
    width: auto;
    justify-content: flex-start;
    flex-wrap: wrap;
    opacity: 1;
  }
  .email-actions .btn-icon,
  .email-copy-all { width: 29px; height: 29px; }
  .domain-group-header { top: 0; }

  .unified-reader-card { max-height: 92dvh; padding: 17px; border-radius: 12px; }
  .auth-screen { padding: 18px; }
  .auth-card { padding: 30px 24px; border-radius: 14px; }
}

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

/* Unified inbox virtual categories */
.unified-category-bar {
  padding: 12px 22px;
  border-bottom: 1px solid #e5eaf0;
  background: #fbfcfe;
}

.unified-category-tabs {
  position: relative;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #dce3eb;
  border-radius: 10px;
  background: #edf1f5;
}

.unified-category-slider {
  display: none;
}

.unified-category-tab {
  position: relative;
  z-index: 1;
  min-width: 112px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #647084;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition);
}

.unified-category-tab:hover { color: #273247; }
.unified-category-tab.active {
  border: 1px solid #d5dce5;
  background: #fbfcfe;
  color: #245bb1;
  box-shadow: 0 1px 3px rgba(28, 39, 55, 0.10);
}

.unified-custom-tabs { display: contents; }
.unified-custom-tab-wrap { position: relative; display: inline-flex; min-width: 112px; }
.unified-custom-tab-wrap .unified-category-tab { width: 100%; padding-right: 25px; }
.unified-filter-delete {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 5px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8a95a5;
  font-size: 15px;
  cursor: pointer;
}
.unified-filter-delete:hover { background: #feecec; color: #a73b3b; }
.unified-category-add {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px dashed #bdc8d5;
  border-radius: 7px;
  background: transparent;
  color: #59677a;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.unified-category-add:hover { border-color: #7fa4d5; background: #edf4ff; color: #245bb1; }
.unified-filter-modal-card { width: min(92vw, 450px); }

.unified-category-count {
  min-width: 20px;
  max-width: 54px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(100, 112, 132, 0.11);
  color: #657186;
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.unified-category-tab.active .unified-category-count {
  background: #e4efff;
  color: #245bb1;
}

@media (max-width: 680px) {
  .unified-category-bar { padding: 10px 14px; }
  .unified-category-tabs { width: 100%; }
  .unified-category-tab {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
    min-height: 33px;
    gap: 4px;
    padding: 0 4px;
    font-size: 10.5px;
  }
  .unified-category-count {
    min-width: 18px;
    max-width: 38px;
    height: 17px;
    padding: 0 4px;
    font-size: 9px;
  }
  .unified-custom-tab-wrap { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .unified-custom-tab-wrap .unified-category-tab { flex-basis: auto; }
  .unified-category-add { flex: 1 1 calc(50% - 4px); }
  .required-dns-row { grid-template-columns: 48px minmax(0, 1fr) 58px; gap: 5px; }
  .required-dns-value { grid-column: 2 / 4; white-space: normal; overflow-wrap: anywhere; }
  .required-dns-extra { grid-column: 3; grid-row: 1; }
  .spaceship-credential-form { grid-template-columns: 1fr; }
}

/* ===== Team Longlink workspace · 2026-07-14 ===== */
.header-tool-link {
  appearance:none; border:1px solid rgba(45,45,58,.18); border-radius:999px;
  background:rgba(255,255,255,.72); color:var(--text-primary); padding:7px 12px;
  font-size:12px; font-weight:700; letter-spacing:.01em; cursor:pointer;
  transition:background var(--transition), border-color var(--transition), transform var(--transition);
}
.header-tool-link:hover { background:#fff; border-color:rgba(45,45,58,.34); transform:translateY(-1px); }
.team-longlink-card { margin-bottom:var(--space-xl); overflow:hidden; padding:0; scroll-margin-top:88px; }
.team-tool-header {
  display:flex; align-items:flex-start; justify-content:space-between; gap:24px;
  padding:28px 30px 24px; border-bottom:1px solid var(--border);
  background:linear-gradient(115deg, rgba(250,250,252,.98), rgba(238,241,246,.86));
}
.team-kicker { display:block; margin-bottom:7px; color:#54606f; font:700 10px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.17em; }
.team-tool-header h2 { margin:0; font-size:24px; letter-spacing:-.035em; color:var(--text-primary); }
.team-tool-header p { max-width:760px; margin:8px 0 0; color:var(--text-secondary); font-size:13px; line-height:1.65; }
.team-security-badge { display:inline-flex; align-items:center; gap:8px; white-space:nowrap; border:1px solid rgba(21,128,61,.2); background:#effaf2; color:#166534; border-radius:999px; padding:8px 11px; font-size:11px; font-weight:700; }
.team-security-badge span { width:7px; height:7px; border-radius:50%; background:#22c55e; box-shadow:0 0 0 4px rgba(34,197,94,.12); }
.team-tool-layout { display:grid; grid-template-columns:minmax(0,1.16fr) minmax(340px,.84fr); }
.team-generator { padding:28px 30px 30px; border-right:1px solid var(--border); min-width:0; }
.team-side-panel { padding:28px 26px 30px; background:rgba(246,247,249,.72); min-width:0; }
.team-subhead { display:flex; align-items:center; gap:10px; margin-bottom:18px; }
.team-subhead > span { width:26px; height:26px; display:grid; place-items:center; border:1px solid var(--border-input); border-radius:50%; color:var(--text-tertiary); font:700 9px/1 ui-monospace,monospace; }
.team-subhead strong { font-size:15px; letter-spacing:-.015em; }
.team-label-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.team-file-button { position:relative; cursor:pointer; color:var(--accent); font-size:11px; font-weight:700; }
.team-file-button input, .team-config-actions label input { position:absolute; inset:0; opacity:0; width:100%; cursor:pointer; }
.team-token-input { resize:vertical; min-height:126px; font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace; }
.team-inline-hint { margin-top:6px; color:var(--text-tertiary); font:10px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; }
.team-inline-hint.is-ok { color:#15803d; }
.team-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; margin-top:22px; }
.team-span-2 { grid-column:1 / -1; }
.team-promo-row { display:grid; grid-template-columns:1.1fr 1fr; gap:9px; }
.team-promo-row #team-custom-promo { grid-column:1 / -1; }
.team-generate-btn { width:100%; min-height:52px; display:flex; align-items:center; justify-content:space-between; margin-top:20px; padding:0 14px 0 18px; }
.team-generate-btn b { width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:rgba(255,255,255,.18); font-size:15px; }
.team-generate-btn:disabled { opacity:.58; cursor:not-allowed; }
.team-clear-token { margin-top:10px; justify-content:center; color:var(--text-tertiary); font-size:11px; }
.team-message { margin-top:16px; border-radius:var(--radius-md); padding:11px 13px; font-size:12px; line-height:1.55; }
.team-message-error { color:#991b1b; border:1px solid rgba(220,38,38,.2); background:#fef2f2; }
.team-config-block { border:1px solid var(--border-input); border-radius:var(--radius-md); background:rgba(255,255,255,.7); margin-bottom:12px; overflow:hidden; }
.team-config-block summary { display:flex; align-items:center; justify-content:space-between; padding:13px 14px; cursor:pointer; font-size:12px; font-weight:700; user-select:none; }
.team-config-block summary span { min-width:22px; height:20px; display:grid; place-items:center; border-radius:999px; padding:0 6px; background:rgba(45,45,58,.07); color:var(--text-secondary); font-size:10px; }
.team-config-block > p { margin:0; padding:0 14px 10px; color:var(--text-tertiary); font-size:10px; line-height:1.55; }
.team-config-block > p code { color:var(--text-secondary); }
.team-config-block textarea { width:calc(100% - 28px); margin:0 14px; box-sizing:border-box; resize:vertical; font:10px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.team-config-actions { display:flex; justify-content:flex-end; gap:8px; padding:10px 14px 13px; }
.team-config-actions label { position:relative; }
.team-chip-list { display:flex; flex-wrap:wrap; gap:6px; padding:0 14px 13px; }
.team-chip { display:inline-flex; align-items:center; max-width:100%; gap:6px; border:1px solid var(--border-input); background:#fff; color:var(--text-secondary); border-radius:999px; padding:5px 6px 5px 9px; font-size:10px; }
.team-chip span { min-width:0; max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.team-chip button { width:18px; height:18px; border:0; border-radius:50%; background:rgba(0,0,0,.05); color:var(--text-tertiary); cursor:pointer; line-height:1; }
.team-chip button:hover { background:#fee2e2; color:#b91c1c; }
.team-default-promo { display:grid; gap:9px; margin:14px 0 18px; padding:14px; border:1px solid var(--border-input); border-radius:var(--radius-md); background:#fff; }
.team-default-promo .checkbox-row { justify-content:flex-start; font-size:12px; font-weight:700; }
.team-result-empty { min-height:220px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:22px; border:1px dashed var(--border-input); border-radius:var(--radius-md); color:var(--text-tertiary); }
.team-result-empty strong { margin-top:14px; color:var(--text-primary); font-size:14px; }
.team-result-empty p { max-width:300px; margin:7px 0 0; font-size:11px; line-height:1.6; }
.team-result-orbit { width:42px; height:42px; border:1px solid var(--border-input); border-radius:50%; position:relative; }
.team-result-orbit::after { content:""; position:absolute; width:9px; height:9px; left:15px; top:15px; border-radius:50%; background:var(--accent); }
.team-result-ready { display:grid; gap:9px; }
.team-result-status { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px; border-radius:var(--radius-md); background:#eefbf2; border:1px solid rgba(21,128,61,.2); color:#166534; }
.team-result-status strong { font-size:12px; }
.team-result-status span { font-size:10px; color:#3f6f4e; }
.team-result-link { border:1px solid var(--border-input); border-radius:var(--radius-md); background:#fff; padding:11px 12px; }
.team-result-link-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; color:var(--text-tertiary); font-size:10px; font-weight:700; }
.team-result-link-head button { border:0; background:transparent; color:var(--accent); font-size:10px; font-weight:700; cursor:pointer; }
.team-result-link a { display:block; color:var(--text-secondary); text-decoration:none; word-break:break-all; font:10px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.team-result-meta { display:flex; flex-wrap:wrap; gap:6px; color:var(--text-tertiary); font-size:10px; }
.team-result-meta span { border-radius:999px; background:rgba(45,45,58,.06); padding:5px 8px; }

@media (max-width:1050px) {
  .team-tool-layout { grid-template-columns:1fr; }
  .team-generator { border-right:0; border-bottom:1px solid var(--border); }
}
@media (max-width:700px) {
  .header-tool-link { padding:6px 9px; font-size:10px; }
  .team-tool-header { padding:22px 18px; flex-direction:column; }
  .team-security-badge { align-self:flex-start; }
  .team-generator, .team-side-panel { padding:22px 18px; }
  .team-form-grid { grid-template-columns:1fr; }
  .team-span-2 { grid-column:auto; }
  .team-promo-row { grid-template-columns:1fr; }
  .team-promo-row #team-custom-promo { grid-column:auto; }
}

/* Unified inbox sender-only exclusions · 2026-08-28 */
.ustat-excluded,
.ustat-excluded strong { color: #9a5b16; }

.unified-sender-filter {
  padding: 14px 22px 15px;
  border-bottom: 1px solid #e5eaf0;
  background: #fbfcfe;
}

.unified-sender-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.unified-sender-filter-head > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}

.unified-sender-filter-head strong {
  color: #273247;
  font-size: 12px;
  font-weight: 750;
}

.unified-sender-filter-head span {
  color: #7a8596;
  font-size: 11px;
  line-height: 1.5;
}

.unified-sender-filter-clear {
  flex: 0 0 auto;
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: #526a89;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.unified-sender-filter-clear:hover { color: #245bb1; }

.unified-sender-filter-editor {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}

.unified-sender-filter-input {
  min-width: 220px;
  max-width: 560px;
  flex: 1 1 420px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #d8dfe8;
  border-radius: 8px;
  background: #f9fbfd;
  color: #768398;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.unified-sender-filter-input:focus-within {
  border-color: #5b8def;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.unified-sender-filter-input input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #253147;
  font: inherit;
  font-size: 12px;
}

.unified-sender-filter-input input::placeholder { color: #96a0ae; }

.unified-sender-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.unified-exclude-chip-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  min-height: 31px;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.unified-exclude-chip-wrap:hover {
  border-color: #b9c7d8;
  box-shadow: 0 1px 3px rgba(28, 39, 55, 0.08);
}

.unified-exclude-chip-wrap.active {
  border-color: #e2b77c;
  background: #fff8ed;
  box-shadow: inset 0 0 0 1px rgba(194, 116, 31, 0.06);
}

.unified-exclude-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: #556276;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.unified-exclude-chip-wrap.active .unified-exclude-chip { color: #8a5014; }

.unified-exclude-check {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: #eef1f5;
  color: #738094;
  font-size: 10px;
  font-weight: 800;
}

.unified-exclude-chip-wrap.active .unified-exclude-check {
  background: #d8872d;
  color: #fff;
}

.unified-exclude-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-exclude-count {
  min-width: 18px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 5px;
  background: #eef1f5;
  color: #6b7789;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.unified-exclude-chip-wrap.active .unified-exclude-count {
  background: #f6dfc1;
  color: #8a5014;
}

.unified-exclude-delete {
  width: 25px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e4e8ed;
  background: transparent;
  color: #8a95a5;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.unified-exclude-chip-wrap.active .unified-exclude-delete { border-left-color: #edd3ad; }
.unified-exclude-delete:hover { background: #feecec; color: #a73b3b; }

.unified-sender-filter-empty {
  margin: 9px 0 0;
  color: #909aa8;
  font-size: 11px;
}

@media (max-width: 820px) {
  .unified-sender-filter { padding: 13px 18px 14px; }
}

@media (max-width: 680px) {
  .unified-sender-filter { padding: 12px 14px 13px; }
  .unified-sender-filter-head { gap: 9px; }
  .unified-sender-filter-head > div { display: block; }
  .unified-sender-filter-head span { display: block; margin-top: 3px; }
  .unified-sender-filter-editor { align-items: stretch; }
  .unified-sender-filter-input { min-width: 0; height: 35px; }
  .unified-sender-filter-editor .btn { flex: 0 0 auto; padding-inline: 10px; font-size: 11px; }
  .unified-exclude-label { max-width: 165px; }
}
