:root {
  color-scheme: light;
  --bg: #eef3f7;
  --bg-grid: rgba(17, 24, 39, 0.04);
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --ink: #111827;
  --muted: #667085;
  --line: #d8e0ea;
  --line-soft: #ebf0f5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0ff;
  --accent: #059669;
  --accent-soft: #e7f7f0;
  --warning: #b7791f;
  --warning-soft: #fff7df;
  --danger: #c2413d;
  --danger-soft: #fff1f1;
  --side: #101827;
  --side-2: #172033;
  --side-hover: #22304a;
  --side-line: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.09);
  --shadow-soft: 0 10px 28px rgba(17, 24, 39, 0.06);
  --button-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none !important;
  box-shadow: none !important;
}

::selection {
  color: #fff;
  background: rgba(37, 99, 235, 0.82);
}

* {
  scrollbar-color: #c9d5e4 transparent;
  scrollbar-width: thin;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.15), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(5, 150, 105, 0.12), transparent 34%),
    #eef3f7;
}

.login-card {
  width: min(1080px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) 420px;
  overflow: hidden;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-copy {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: space-between;
  gap: 36px;
  padding: 40px;
  overflow: hidden;
  color: #fff;
  background: #101827;
}

.login-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(16, 24, 39, 0.88), rgba(16, 24, 39, 0.58)),
    url("/login-ops-visual.png") center / cover no-repeat;
}

.login-copy::after {
  content: "";
  position: absolute;
  inset: auto 24px 24px 24px;
  height: 1px;
  z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
}

.login-visual {
  position: absolute;
  right: 30px;
  bottom: 120px;
  width: 190px;
  height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}

.login-visual::before {
  top: 20px;
}

.login-visual::after {
  top: 42px;
  right: 62px;
  background: rgba(45, 212, 191, 0.55);
}

.login-copy h1 {
  max-width: 520px;
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.04;
}

.login-copy .muted,
.login-copy .eyebrow {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.78);
}

.login-hero {
  align-self: center;
}

.login-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.login-stats span {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.login-stats b {
  display: block;
  color: #fff;
  font-size: 18px;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 42px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.85), rgba(255, 255, 255, 0)),
    #fff;
}

.login-form h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand.large {
  align-self: start;
}

.brand strong {
  display: block;
  line-height: 1.2;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #9da9bd;
}

.login-copy .brand small {
  color: rgba(255, 255, 255, 0.72);
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: block;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 18px rgba(15, 35, 70, 0.16);
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.primary,
.secondary,
.ghost,
.danger,
.button-link {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.primary:active,
.secondary:active,
.ghost:active,
.danger:active {
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover {
  transform: translateY(-1px);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button-link:hover {
  text-decoration: none;
}

.primary::before,
.secondary::before,
.danger::before,
.button-link::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 999px;
  opacity: 0.82;
}

#syncBtn::before,
#syncAllBtn::before,
[data-sync]::before {
  border-radius: 4px;
  border-right-color: transparent;
}

#refreshDashboardBtn::before {
  border-right-color: transparent;
}

#testAccountFormBtn::before,
[data-test-account]::before {
  border-radius: 4px;
  box-shadow: inset 0 0 0 3px currentColor;
}

#bulkImportBtn::before,
.button-link::before {
  border-radius: 3px;
  border-top-color: transparent;
}

.danger::before,
[data-delete-account]::before,
#deleteLocalBtn::before,
#deleteRemoteBtn::before {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border-top-width: 4px;
}

.primary {
  color: #fff;
  background: linear-gradient(180deg, #2f6feb, var(--primary));
  box-shadow: var(--button-shadow);
}

.primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 13px 24px rgba(37, 99, 235, 0.24);
}

.secondary {
  color: #26344b;
  background: linear-gradient(180deg, #ffffff, #f3f6fa);
  border: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.04);
}

.secondary:hover {
  background: #e8eef6;
  border-color: #cbd8ea;
}

.ghost {
  color: #dde5f2;
  background: rgba(255, 255, 255, 0.09);
}

.danger {
  color: var(--danger);
  background: linear-gradient(180deg, #fff8f8, var(--danger-soft));
  border: 1px solid #ffd6d6;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

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

.sidebar {
  min-height: 100vh;
  padding: 22px 16px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.28), transparent 28%),
    linear-gradient(180deg, rgba(5, 150, 105, 0.08), transparent 34%),
    var(--side);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.nav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-top: 2px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px 0 10px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  color: #cbd5e1;
  background: transparent;
  font-weight: 780;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item::before {
  content: "";
  width: 32px;
  height: 32px;
  border: 1px solid var(--side-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid #9fb2d0;
  border-radius: 4px;
  transform: translateY(-50%);
  opacity: 0.9;
}

.nav-item[data-view="dashboard"]::after {
  box-shadow: 8px 0 0 -2px #9fb2d0, 0 8px 0 -2px #9fb2d0, 8px 8px 0 -2px #9fb2d0;
}

.nav-item[data-view="inbox"]::after,
.nav-item[data-view="send"]::after {
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.nav-item[data-view="inbox"]::after {
  border-top-color: transparent;
}

.nav-item[data-view="codes"]::after {
  width: 14px;
  height: 8px;
  border-radius: 999px;
}

.nav-item[data-view="accounts"]::after {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 9px 0 -3px #9fb2d0;
}

.nav-item[data-view="guides"]::after {
  width: 12px;
  height: 14px;
  border-radius: 2px;
  border-left-width: 5px;
}

.nav-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(34, 48, 74, 0.88)),
    var(--side-hover);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-item.active::before {
  border-color: rgba(147, 197, 253, 0.5);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.55), rgba(37, 99, 235, 0.26)),
    rgba(255, 255, 255, 0.08);
}

.nav-item.active::after,
.nav-item:hover::after {
  border-color: #ffffff;
  box-shadow: inherit;
}

.nav-item.active {
  color: #fff;
}

.nav-item.active span::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #5eead4;
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.12);
}

.side-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--side-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.side-card span,
.side-card small {
  color: #aab6c8;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(216, 224, 234, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.topbar > div:first-child {
  min-width: 220px;
}

.topbar h2 {
  margin-bottom: 4px;
  font-size: 26px;
}

.topbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(240px, 360px) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(216, 224, 234, 0.76);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.view {
  min-height: 0;
  padding: 20px 24px;
}

.dashboard-view {
  display: grid;
  gap: 16px;
  align-content: start;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.dashboard-panels {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.dashboard-panels .wide {
  grid-column: 1 / -1;
}

.inbox-layout {
  display: grid;
  gap: 16px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.metric-row article,
.info-panel,
.message-list,
.message-detail,
.compose-panel,
.account-form,
.account-list {
  border: 1px solid rgba(216, 224, 234, 0.92);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.metric-card,
.metric-row article {
  position: relative;
  display: grid;
  gap: 4px;
  overflow: hidden;
  padding: 16px;
}

.metric-card:hover,
.metric-row article:hover,
.guide-card:hover,
.account-card:hover,
.info-panel:hover {
  border-color: #cbd8ea;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
}

.metric-card::before,
.metric-row article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.metric-card span,
.metric-card small,
.metric-row span,
.metric-row small {
  color: var(--muted);
}

.metric-card strong,
.metric-row strong {
  font-size: 30px;
  line-height: 1.1;
}

.info-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.panel-title h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title h3::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-soft);
}

.compact-list,
.log-list {
  display: grid;
  gap: 10px;
}

.compact-item,
.log-item {
  display: grid;
  gap: 6px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-soft);
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

button.compact-item {
  border-color: var(--line-soft);
}

button.compact-item:hover {
  border-color: #cfe0ff;
  background: #f3f8ff;
  transform: translateY(-1px);
}

.compact-item strong,
.log-item strong {
  line-height: 1.35;
}

.compact-item small,
.log-item small {
  color: var(--muted);
}

.mail-workbench {
  min-height: calc(100vh - 238px);
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 16px;
}

.message-list {
  overflow: auto;
}

.message-item {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 15px 16px;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.message-item:last-child {
  border-bottom: 0;
}

.message-item:hover,
.message-item.active {
  border-left-color: var(--primary);
  background: #f5f9ff;
}

.message-subject {
  color: var(--ink);
  font-weight: 850;
  line-height: 1.35;
}

.message-meta,
.message-account,
.message-preview {
  color: var(--muted);
  font-size: 13px;
}

.message-account {
  color: var(--primary);
  font-weight: 800;
}

.code-pill {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 2px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 900;
  letter-spacing: 0;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-pill {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 2px 8px;
  color: #335071;
  background: #e9eef5;
  font-size: 12px;
  font-weight: 850;
}

.status-pill.ok {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-pill.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pill.bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.message-detail {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}

.message-detail .empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px dashed #d5dee9;
  border-radius: 8px;
  background: var(--panel-soft);
}

.detail-head {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.message-body {
  color: #293548;
  line-height: 1.72;
  white-space: pre-wrap;
}

.form-view {
  max-width: 900px;
}

.compose-panel,
.account-form {
  display: grid;
  gap: 15px;
  padding: 22px;
}

.panel-title {
  display: grid;
  gap: 4px;
  margin-bottom: 2px;
}

.panel-title h3 {
  margin-bottom: 0;
}

.panel-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.accounts-layout {
  display: grid;
  grid-template-columns: minmax(340px, 520px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.account-left {
  display: grid;
  gap: 16px;
}

.list-title {
  margin-bottom: 12px;
}

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

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.check input {
  width: auto;
  min-height: auto;
}

.account-list {
  overflow: hidden;
}

.account-card {
  display: grid;
  gap: 8px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.account-card:hover {
  background: #f8fbff;
}

.account-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

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

.account-card strong {
  font-size: 16px;
}

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

.error-text {
  color: var(--danger);
  font-size: 13px;
}

.padded {
  padding: 16px;
}

.import-summary {
  min-height: 42px;
  display: grid;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: #334155;
  background: var(--panel-soft);
}

.import-preview {
  overflow: auto;
}

.import-preview table {
  width: 100%;
  min-width: 560px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  border-collapse: collapse;
}

.import-preview th,
.import-preview td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: #334155;
  text-align: left;
  font-size: 13px;
}

.import-preview th {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 850;
}

.import-preview tr:hover td {
  background: #f8fbff;
}

.guides-view {
  display: grid;
  gap: 16px;
  align-content: start;
}

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

.guide-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.guide-card h3 {
  margin-bottom: 0;
}

.guide-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.guide-card dl {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 10px;
  margin: 0;
}

.guide-card dt {
  color: var(--muted);
  font-weight: 800;
}

.guide-card dd {
  margin: 0;
  color: #26344b;
}

.official-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.official-links a {
  font-weight: 800;
}

.code-block {
  overflow: auto;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: #26344b;
  background: var(--panel-soft);
  font: 13px/1.6 Consolas, "Courier New", monospace;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #101828;
  box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
  .app-shell,
  .login-card,
  .mail-workbench,
  .accounts-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    grid-template-rows: auto auto auto;
  }

  .nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .side-card {
    display: none;
  }

  .topbar {
    display: grid;
  }

  .toolbar,
  .dashboard-grid,
  .dashboard-panels,
  .guide-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-shell,
  .view,
  .topbar {
    padding: 14px;
  }

  .login-copy,
  .login-form {
    padding: 24px;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .login-stats,
  .nav,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .toolbar {
    gap: 8px;
  }

  .message-detail {
    padding: 18px;
  }
}

.fa-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.fa-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item::before,
.nav-item::after,
.primary::before,
.secondary::before,
.danger::before,
.button-link::before {
  content: none !important;
  display: none !important;
}

.nav-item {
  grid-template-columns: 36px minmax(0, 1fr);
}

.nav-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--side-line);
  border-radius: 8px;
  color: #aebddb;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #fff;
  border-color: rgba(147, 197, 253, 0.5);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.55), rgba(37, 99, 235, 0.26)),
    rgba(255, 255, 255, 0.08);
}

.nav-item.active::after {
  content: "";
  display: block !important;
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #5eead4;
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.12);
  transform: translateY(-50%);
}

.primary .fa-icon,
.secondary .fa-icon,
.danger .fa-icon,
.button-link .fa-icon {
  width: 15px;
  height: 15px;
}

.detail-actions button,
.account-actions button,
.dashboard-actions button,
.toolbar button,
.form-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Product prototype redesign layer */
:root {
  --bg: #f3f6fb;
  --bg-grid: rgba(15, 23, 42, 0.025);
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --ink: #172033;
  --muted: #6b778c;
  --line: #dbe3ee;
  --line-soft: #edf1f6;
  --primary: #1f6feb;
  --primary-dark: #1857c7;
  --primary-soft: #e9f1ff;
  --accent: #0f9f78;
  --accent-soft: #e8f8f2;
  --danger: #d44646;
  --danger-soft: #fff0f0;
  --side: #0b1220;
  --side-2: #111b2e;
  --side-hover: #18243a;
  --side-line: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.1);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.07);
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #f8fbff 0%, #f1f5fa 42%, #edf3f9 100%);
}

.login-shell {
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.1), transparent 30%),
    linear-gradient(315deg, rgba(15, 159, 120, 0.1), transparent 34%),
    #f3f6fb;
}

.login-card,
.info-panel,
.compose-panel,
.account-form,
.import-panel,
.guide-card,
.message-list,
.message-detail {
  border-color: rgba(219, 227, 238, 0.95);
}

.login-form input,
.login-form select,
.login-form textarea,
input,
select,
textarea {
  min-height: 42px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(31, 111, 235, 0.14);
  border-color: rgba(31, 111, 235, 0.62);
}

.app-shell {
  min-height: 100vh;
  grid-template-columns: 272px minmax(0, 1fr);
  background: #f3f6fb;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 20px 16px;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(31, 111, 235, 0.18), transparent 30%),
    linear-gradient(0deg, rgba(15, 159, 120, 0.1), transparent 32%),
    var(--side);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.07);
}

.brand {
  padding: 4px;
}

.brand strong {
  line-height: 1.2;
}

.brand small,
.side-card small {
  color: #96a3b8;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.nav {
  gap: 7px;
}

.nav-item {
  min-height: 46px;
  padding: 0 12px 0 8px;
  border-radius: 8px;
  color: #c4ccda;
  font-weight: 800;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

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

.nav-icon {
  width: 34px;
  height: 34px;
  color: #9fb0c9;
  background: rgba(255, 255, 255, 0.045);
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(31, 111, 235, 0.34), rgba(24, 36, 58, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #fff;
  border-color: rgba(147, 197, 253, 0.52);
  background: rgba(31, 111, 235, 0.38);
}

.side-card {
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.04);
}

.ghost {
  min-height: 42px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.12);
  color: #dce5f4;
  background: rgba(255, 255, 255, 0.05);
}

.workspace {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0)),
    #f3f6fb;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.topbar h2 {
  font-size: 24px;
  line-height: 1.18;
}

.topbar p {
  max-width: 700px;
  line-height: 1.55;
}

.toolbar {
  grid-template-columns: minmax(140px, 180px) minmax(220px, 340px) auto;
  gap: 10px;
  align-items: center;
}

.toolbar select,
.toolbar input {
  width: 100%;
}

.view {
  padding: 22px 24px 28px;
}

.dashboard-actions {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.dashboard-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metric-row {
  gap: 14px;
}

.metric-card,
.metric-row article {
  min-height: 124px;
  padding: 18px;
  border: 1px solid rgba(219, 227, 238, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96));
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.055);
}

.metric-card::before {
  height: 3px;
  background: linear-gradient(90deg, #1f6feb, #0f9f78);
}

.metric-card strong,
.metric-row article strong {
  color: #0f172a;
  font-size: 34px;
  letter-spacing: 0;
}

.metric-card span,
.metric-row article span,
.metric-card small,
.metric-row article small {
  color: #6b778c;
}

.dashboard-panels {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.dashboard-panels .wide {
  grid-column: 1 / -1;
}

.info-panel,
.compose-panel,
.account-form,
.import-panel,
.guide-card {
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.panel-title {
  gap: 6px;
}

.panel-title h3,
.panel-title h2 {
  color: #172033;
  line-height: 1.2;
}

.compact-item,
.log-item,
.account-card,
.message-item {
  border-radius: 8px;
  border-color: #e2e8f0;
  background: #fff;
}

.compact-item,
.log-item {
  padding: 12px;
}

.mail-workbench {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
}

.message-list {
  max-height: calc(100vh - 236px);
  overflow: auto;
  padding: 10px;
  background: #fff;
}

.message-item {
  padding: 14px;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.message-item:hover,
.message-item.active {
  border-color: rgba(31, 111, 235, 0.5);
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.08);
}

.message-detail {
  min-height: 560px;
  padding: 24px;
  background: #fff;
}

.detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.code-box,
.detail-code {
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
}

mark,
.code-badge {
  border-radius: 8px;
  color: #0f3f97;
  background: #dbeafe;
}

.primary,
.secondary,
.danger,
.button-link,
.ghost,
.detail-actions button,
.account-actions button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.primary {
  border-color: #1f6feb;
  background: linear-gradient(180deg, #2f7df2, #1f6feb);
  box-shadow: 0 10px 20px rgba(31, 111, 235, 0.18);
}

.primary:hover {
  background: linear-gradient(180deg, #236fe6, #1857c7);
}

.secondary,
.button-link.secondary,
.detail-actions button {
  color: #26344b;
  border-color: #d6deea;
  background: #fff;
}

.secondary:hover,
.button-link.secondary:hover,
.detail-actions button:hover {
  color: #1f6feb;
  border-color: rgba(31, 111, 235, 0.42);
  background: #f8fbff;
}

.danger {
  color: #fff;
  border-color: #d44646;
  background: linear-gradient(180deg, #e05252, #d44646);
}

.account-form,
.compose-panel {
  max-width: 760px;
}

.accounts-layout {
  grid-template-columns: minmax(340px, 560px) minmax(0, 1fr);
  gap: 16px;
}

.account-list,
.accounts {
  gap: 12px;
}

.account-card {
  padding: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #101827;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mail-workbench,
  .accounts-layout {
    grid-template-columns: 1fr;
  }

  .message-list {
    max-height: 460px;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .sidebar {
    padding: 14px;
  }

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

  .topbar,
  .view {
    padding: 14px;
  }

  .dashboard-grid,
  .dashboard-panels,
  .metric-row,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary,
  .danger,
  .button-link,
  .detail-actions button,
  .account-actions button,
  .form-actions button {
    width: 100%;
    white-space: normal;
  }
}

/* Redesign v2: stronger product-console prototype */
:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --ink: #182235;
  --muted: #68758a;
  --line: #d7e0ec;
  --line-soft: #e9eef5;
  --primary: #1769e0;
  --primary-dark: #1254ba;
  --primary-soft: #e6f0ff;
  --accent: #13a67a;
  --side: #08111f;
  --side-2: #101b2f;
  --side-hover: #17263e;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.09);
}

body {
  background: #eef3f8;
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
  background: #eef3f8;
}

.sidebar {
  position: sticky !important;
  top: 0;
  height: 100vh;
  min-height: 0;
  padding: 18px 14px;
  gap: 18px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(23, 105, 224, 0.24), rgba(8, 17, 31, 0) 190px),
    linear-gradient(0deg, rgba(19, 166, 122, 0.12), rgba(8, 17, 31, 0) 230px),
    #08111f;
}

.sidebar .brand {
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.sidebar .brand strong {
  color: #fff;
  font-size: 16px;
}

.sidebar .brand small {
  color: #91a3bd;
  font-size: 12px;
}

.nav {
  padding: 2px 0;
  gap: 8px;
}

.nav-item {
  min-height: 50px;
  grid-template-columns: 38px minmax(0, 1fr);
  padding: 0 12px 0 8px;
  border: 1px solid transparent;
  color: #aebed4;
  background: transparent;
}

.nav-icon {
  width: 36px;
  height: 36px;
  border-color: rgba(255, 255, 255, 0.1);
  color: #8ea1bb;
  background: rgba(255, 255, 255, 0.04);
}

.nav-item:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #fff;
  border-color: rgba(99, 171, 255, 0.34);
  background:
    linear-gradient(90deg, rgba(23, 105, 224, 0.62), rgba(23, 105, 224, 0.2) 44%, rgba(255, 255, 255, 0.055));
}

.nav-item.active::after {
  right: 8px;
  width: 4px;
  height: 22px;
  border-radius: 999px;
  background: #21d19f;
  box-shadow: none;
}

.nav-item.active .nav-icon {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.side-card {
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
}

.side-card span {
  color: #91a3bd;
}

.side-card strong {
  color: #fff;
}

.workspace {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbff, #eef3f8 230px),
    #eef3f8;
}

.topbar {
  margin: 0;
  padding: 18px 24px;
  border-bottom: 1px solid #dbe4ef;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.045);
}

.topbar h2 {
  margin-bottom: 5px;
  color: #111827;
  font-size: 26px;
}

.eyebrow {
  color: #1769e0;
  font-size: 11px;
}

.toolbar {
  padding: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.toolbar input,
.toolbar select,
.toolbar button {
  min-height: 38px;
}

.view {
  padding: 24px;
}

.dashboard-actions {
  padding: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
}

.dashboard-grid {
  gap: 16px;
}

.metric-card,
.metric-row article {
  min-height: 136px;
  padding: 18px 18px 16px;
  border: 1px solid #dbe4ef;
  background: #fff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.065);
}

.metric-card::before {
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #1769e0, #13a67a);
}

.metric-card strong,
.metric-row article strong {
  margin-top: 8px;
  color: #0f172a;
  font-size: 38px;
}

.dashboard-panels,
.mail-workbench,
.accounts-layout {
  gap: 16px;
}

.info-panel,
.message-list,
.message-detail,
.compose-panel,
.account-form,
.import-panel,
.guide-card {
  border: 1px solid #dbe4ef;
  background: #fff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
}

.panel-title {
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1f6;
}

.panel-title h2,
.panel-title h3 {
  color: #111827;
}

.compact-list,
.log-list {
  gap: 10px;
}

.compact-item,
.log-item {
  border: 1px solid #e3e9f1;
  background: #f9fbfd;
}

.message-list {
  padding: 12px;
}

.message-item {
  border: 1px solid #e3e9f1;
  background: #fff;
}

.message-item.active,
.message-item:hover {
  border-color: rgba(23, 105, 224, 0.46);
  background: #f4f8ff;
}

.message-detail {
  padding: 26px;
}

.detail-head h3,
.detail-head h2 {
  color: #101828;
}

.code-box,
.detail-code {
  background:
    linear-gradient(180deg, #f8fbff, #eaf3ff);
  box-shadow: inset 0 0 0 1px rgba(23, 105, 224, 0.1);
}

.primary,
.secondary,
.danger,
.button-link,
.ghost,
.detail-actions button,
.account-actions button,
.form-actions button {
  min-height: 42px;
  padding-inline: 14px;
}

.primary {
  color: #fff;
  border-color: #1769e0;
  background: linear-gradient(180deg, #2c7bf0, #1769e0);
}

.secondary,
.button-link.secondary,
.detail-actions button,
.form-actions button:not(.primary):not(.danger),
.account-actions button:not(.primary):not(.danger) {
  color: #243247;
  border: 1px solid #d5deea;
  background: linear-gradient(180deg, #fff, #f7f9fc);
}

.danger {
  color: #fff;
  background: linear-gradient(180deg, #e55a5a, #d44646);
}

.account-card {
  border: 1px solid #dbe4ef;
  background: #fff;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative !important;
    height: auto;
  }
}
