@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./assets/fonts/sora-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./assets/fonts/sora-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./assets/fonts/sora-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./assets/fonts/sora-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --font: 'Sora', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --bg: #f3efe7;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #201e1a;
  --ink-2: #6b655b;
  --ink-3: #8a847a;
  --ink-4: #a49c8f;
  --border: #e6e1d8;
  --border-strong: #ddd6ca;
  --accent: #4c5bd4;
  --accent-hover: #3a45b0;
  --accent-tint: #eceffb;
  --success: #1f8a5b;
  --success-tint: #e5f3ea;
  --danger: #c25b57;
  --danger-tint: #f7e9e8;
  --warn: #d98a2b;
  --warn-tint: #fbf6ea;
  --radius-card: 14px;
  --radius-control: 10px;
  --radius-chip: 8px;
  --radius-pill: 999px;
  --space-card: 20px;
  --space-card-lg: 24px;
  --space-grid: 16px;
  --space-grid-lg: 20px;

  /* Legacy aliases keep the existing stylesheet on the canonical token layer. */
  --surface-3: var(--surface-2);
  --muted: var(--ink-2);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --accent-soft: var(--accent-tint);
  --accent-2: var(--danger);
  --accent-3: var(--warn);
  --info: var(--accent);
  --danger-soft: var(--danger-tint);
  --warning-soft: var(--warn-tint);
  --blue-soft: var(--accent-tint);
  --shadow: 0 12px 28px color-mix(in srgb, var(--ink) 7%, transparent);
  --shadow-soft: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 260px),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(232, 211, 159, 0.34);
  background:
    linear-gradient(180deg, rgba(8, 36, 34, 0.96), rgba(5, 22, 28, 0.98)),
    #071b20;
  backdrop-filter: blur(14px);
  padding: 22px 18px;
  color: #ecf7f2;
  box-shadow: 12px 0 36px rgba(6, 24, 28, 0.12);
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #193b34, var(--accent));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(22, 115, 94, 0.22);
}

.brand h1 {
  margin: 0;
  color: #f5fffb;
  font-size: 16px;
  line-height: 1.25;
}

.brand p {
  color: rgba(236, 247, 242, 0.64);
}

.brand p,
.eyebrow,
.section-head p,
.side-note span,
.muted {
  margin: 0;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(236, 247, 242, 0.84);
  padding: 11px 12px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(14, 177, 148, 0.16);
}

.nav-item.active {
  color: #e9fffa;
  font-weight: 700;
  box-shadow:
    inset 3px 0 0 #2df0c4,
    0 10px 22px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(45, 240, 196, 0.24);
}

.side-note {
  display: grid;
  gap: 8px;
  margin-top: auto;
  border: 1px solid rgba(45, 240, 196, 0.2);
  border-radius: 8px;
  background: rgba(8, 52, 52, 0.46);
  padding: 14px;
  line-height: 1.55;
}

.side-note strong {
  color: #f5fffb;
}

.side-note span {
  color: rgba(236, 247, 242, 0.66);
}

.workspace {
  min-width: 0;
  max-width: 1540px;
  padding: 26px 32px 44px;
}

.topbar,
.section-head,
.toolbar,
.queue-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(251, 248, 238, 0.72)),
    #fff;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  white-space: nowrap;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(22, 115, 94, 0.16);
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 650;
}

.btn.secondary:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--accent);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid #ecd9a7;
  border-left: 4px solid var(--accent-3);
  border-radius: 8px;
  background: linear-gradient(90deg, #fff8e4, #fffdf7);
  padding: 13px 15px;
  line-height: 1.6;
  box-shadow: var(--shadow-soft);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(250, 246, 234, 0.74)),
    var(--surface);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(22, 115, 94, 0.15);
}

.stat:nth-child(2)::before {
  background: var(--warning-soft);
}

.stat:nth-child(3)::before {
  background: var(--blue-soft);
}

.stat:nth-child(4)::before {
  background: #efe8ff;
}

.stat span {
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 30px;
  line-height: 1.1;
}

.section-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(252, 250, 243, 0.92)),
    var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

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

.progress-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fff, #fbfaf4),
    var(--surface-3);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.progress-item strong {
  font-size: 13px;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #48a889);
}

.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

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

.compact-row,
.queue-card {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, #fff, #fbf8ef),
    #fff;
  box-shadow: var(--shadow-soft);
}

.template-preview {
  min-height: 180px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fffdf8, #f7fbf6),
    #fbfcfa;
  padding: 12px;
  color: var(--ink);
  white-space: pre-wrap;
}

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

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

.wide-field {
  grid-column: span 2;
}

.match-summary {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #f8fcf8, #fff9ec),
    #fbfcfa;
  padding: 12px;
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.match-summary strong {
  color: var(--ink);
}

.match-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.match-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 4px 8px;
}

.template-editor {
  display: grid;
  gap: 12px;
}

.template-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mail-account-picker {
  display: grid;
  grid-template-columns: minmax(260px, 520px) minmax(220px, 1fr);
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #f8fcf8, #fff8e7),
    #fbfcfa;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.mail-account-picker .wide-field {
  grid-column: auto;
}

.mail-account-picker .template-note {
  margin: 0 0 10px;
}

.manual-mail-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fffdf8);
  padding: 0;
  box-shadow: var(--shadow-soft);
}

.manual-mail-details summary {
  cursor: pointer;
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.manual-mail-details .form-grid {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fffdf8);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(22, 115, 94, 0.68);
  box-shadow:
    0 0 0 3px rgba(22, 115, 94, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input[readonly] {
  background: #f4f7f5;
  color: var(--muted);
  cursor: default;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fffdf8);
  padding-left: 10px;
  box-shadow: var(--shadow-soft);
}

.search-wrap input {
  border: 0;
  padding-left: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #f8fbf6, #eef5ef);
  color: var(--muted);
  font-weight: 700;
  z-index: 1;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #fbf8ed;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.contact-platform {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.col-check {
  width: 52px;
}

.col-actions {
  width: 150px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(31, 48, 43, 0.04);
}

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

.status-pill.sent {
  background: var(--accent-soft);
  color: #12684f;
}

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

.status-pill.rejected {
  background: var(--danger-soft);
  color: #9f2f2f;
}

.status-pill.accepted {
  background: linear-gradient(180deg, #ffe9a8, #ffd66c);
  color: #6c4703;
}

.status-pill.replied {
  background: var(--blue-soft);
  color: #1d4f91;
}

.reply-note {
  max-width: 210px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.queue-actions {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.queue-grid {
  display: grid;
  gap: 10px;
}

.send-status-panel {
  margin-bottom: 12px;
}

.send-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.send-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fff, #fbf7ed),
    #fbfcfa;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
}

.send-metric span {
  color: var(--muted);
}

.send-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.send-log {
  display: grid;
  gap: 6px;
}

.send-log-row {
  display: grid;
  grid-template-columns: 150px 60px minmax(160px, 0.8fr) minmax(160px, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 9px 0 0;
  color: var(--muted);
}

.send-log-row strong {
  color: var(--ink);
}

.test-status {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.reply-report {
  margin-top: 12px;
}

.reply-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.reply-controls label {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.reply-controls label span {
  color: var(--muted);
  font-size: 12px;
}

.test-ok,
.test-warn,
.reply-report-head {
  display: grid;
  gap: 4px;
}

.test-ok strong {
  color: #14733a;
}

.test-warn strong {
  color: var(--danger);
}

.test-ok span,
.test-warn span,
.reply-report-head span,
.reply-empty {
  color: var(--muted);
  font-size: 13px;
}

.reply-row {
  display: grid;
  grid-template-columns: 96px minmax(150px, 0.75fr) minmax(220px, 1.35fr) 132px;
  align-items: start;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
}

.reply-row::-webkit-details-marker {
  display: none;
}

.reply-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.reply-account-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.reply-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #fbf7ec);
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: var(--shadow-soft);
}

.reply-account-chip span {
  color: var(--muted);
}

.reply-errors {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  border: 1px solid #f0c1b7;
  border-radius: 8px;
  background: #fff5f2;
  padding: 10px 12px;
  color: var(--danger);
  font-size: 13px;
}

.reply-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fff, #fbf8ee),
    #fff;
  padding: 9px 10px;
  box-shadow: var(--shadow-soft);
}

.reply-summary-item span,
.reply-contact span,
.reply-content span,
.reply-row time,
.reply-group-head span {
  color: var(--muted);
  font-size: 12px;
}

.reply-summary-item strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.reply-groups,
.reply-list,
.reply-contact,
.reply-content {
  display: grid;
  gap: 4px;
}

.reply-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 249, 240, 0.88)),
    #fff;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.reply-group + .reply-group {
  margin-top: 8px;
}

.reply-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
}

.reply-content strong,
.reply-content span,
.reply-contact strong,
.reply-contact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replies-panel {
  max-width: 1180px;
}

.reply-empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
}

.reply-empty-state strong {
  color: var(--ink);
}

.reply-card {
  border-top: 1px solid var(--line);
  transition: background 140ms ease, box-shadow 140ms ease;
}

.reply-card[open] {
  margin: 0 -6px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(31, 48, 43, 0.08);
}

.reply-card[open] .reply-row {
  padding-left: 6px;
  padding-right: 6px;
}

.reply-body {
  display: grid;
  gap: 8px;
  padding: 0 0 12px 106px;
}

.reply-body-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.reply-body pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf8, #f8fbf6);
  padding: 12px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font: inherit;
}

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

.queue-card {
  grid-template-columns: 88px minmax(160px, 1fr) minmax(160px, 1.2fr) minmax(120px, 0.8fr);
  background:
    linear-gradient(180deg, #fff, #fbf8ef),
    #fff;
  box-shadow: var(--shadow-soft);
}

.queue-time {
  color: var(--info);
  font-weight: 700;
}

.rules-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.9;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Editorial manuscript-desk theme */
body {
  background:
    linear-gradient(90deg, rgba(177, 130, 42, 0.08) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(177, 130, 42, 0.06) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 40% 0%, rgba(255, 248, 226, 0.8), transparent 360px),
    #f4edda;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(9, 55, 46, 0.97), rgba(3, 31, 34, 0.99)),
    #052521;
}

.brand {
  align-items: flex-start;
  border-bottom: 1px solid rgba(231, 193, 116, 0.28);
  padding-bottom: 16px;
}

.brand-mark {
  border: 1px solid rgba(231, 193, 116, 0.56);
  background:
    linear-gradient(145deg, rgba(255, 245, 214, 0.18), rgba(26, 132, 104, 0.34)),
    #0a4038;
  color: #ffe5a6;
}

.brand h1,
.topbar h2,
.section-head h3 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", serif;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  margin-top: 4px;
  color: rgba(255, 232, 181, 0.72);
}

.nav {
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  color: rgba(255, 246, 222, 0.82);
  font-weight: 650;
}

.nav-item:hover {
  border-color: rgba(231, 193, 116, 0.2);
  background: rgba(255, 239, 193, 0.08);
}

.nav-item.active {
  border-color: rgba(231, 193, 116, 0.38);
  background: linear-gradient(90deg, rgba(255, 238, 187, 0.18), rgba(25, 144, 113, 0.16));
  color: #fff8df;
  box-shadow:
    inset 4px 0 0 #d8a846,
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.side-note {
  border-color: rgba(231, 193, 116, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 239, 193, 0.1), rgba(9, 73, 59, 0.34)),
    rgba(6, 51, 48, 0.5);
}

.workspace {
  padding-top: 28px;
}

.topbar {
  position: relative;
  border-color: rgba(198, 154, 73, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 252, 240, 0.96), rgba(248, 237, 211, 0.88)),
    #fff8e8;
  box-shadow:
    0 20px 46px rgba(72, 54, 20, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), transparent);
}

.topbar h2 {
  color: #172d29;
  font-size: 32px;
}

.eyebrow {
  color: #9a7140;
}

.notice {
  border-color: rgba(211, 165, 73, 0.5);
  background:
    linear-gradient(90deg, rgba(255, 243, 207, 0.96), rgba(255, 251, 239, 0.9)),
    #fff6db;
}

.section-band,
.stat,
.table-wrap {
  border-color: rgba(198, 154, 73, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.98), rgba(250, 241, 220, 0.9)),
    #fffaf0;
  box-shadow:
    0 18px 42px rgba(72, 54, 20, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.section-head h3 {
  position: relative;
  padding-left: 14px;
  color: #203a34;
}

.section-head h3::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-3), #b87819);
}

.stat {
  border-top-width: 3px;
}

.stat:nth-child(1) {
  border-top-color: var(--accent);
}

.stat:nth-child(2) {
  border-top-color: #c47b16;
}

.stat:nth-child(3) {
  border-top-color: #2d7797;
}

.stat:nth-child(4) {
  border-top-color: #8b5fb7;
}

.stat strong {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  color: #073f35;
}

.progress-item,
.send-metric,
.reply-summary-item,
.compact-row,
.queue-card {
  border-color: rgba(198, 154, 73, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(250, 241, 221, 0.82)),
    #fffaf0;
}

.match-summary,
.mail-account-picker,
.manual-mail-details,
.template-preview,
.search-wrap,
input,
select,
textarea {
  border-color: rgba(198, 154, 73, 0.24);
}

input,
select,
textarea,
.search-wrap {
  background:
    linear-gradient(180deg, rgba(255, 254, 249, 1), rgba(255, 248, 231, 0.94)),
    #fffaf0;
}

.btn {
  border-color: #096851;
  background: linear-gradient(180deg, #16896d, #0b6b54);
  box-shadow:
    0 10px 22px rgba(11, 107, 84, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn:hover {
  border-color: #075843;
  background: linear-gradient(180deg, #127d62, #085942);
}

.btn.secondary {
  border-color: rgba(166, 127, 57, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 1), rgba(248, 235, 205, 0.85)),
    #fff8e7;
}

.data-table th {
  background:
    linear-gradient(180deg, #f5ead0, #ead9b6),
    #ead9b6;
  color: #70522a;
}

.data-table tbody tr:hover {
  background: rgba(255, 240, 199, 0.42);
}

.status-pill {
  border: 1px solid rgba(114, 82, 36, 0.12);
}

.reply-group {
  border-color: rgba(198, 154, 73, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.96), rgba(250, 240, 216, 0.9)),
    #fff8e8;
}

.reply-group-head {
  border-bottom: 1px solid rgba(198, 154, 73, 0.22);
}

.reply-card[open] {
  background:
    linear-gradient(180deg, #fffdf7, #fff5dc),
    #fff8e8;
}

.reply-body pre {
  border-color: rgba(198, 154, 73, 0.28);
  background:
    linear-gradient(90deg, rgba(203, 166, 89, 0.08) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, #fffdf8, #fff8e7);
}

.toast {
  background: #082b28;
  color: #fff4d5;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: block;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(232, 211, 159, 0.34);
    padding: 12px 14px;
  }

  .brand,
  .side-note {
    display: none;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .stats-grid,
  .form-grid,
  .mail-account-picker,
  .dashboard-split,
  .reply-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px 14px 30px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .button-row {
    flex-wrap: wrap;
  }

  .stats-grid,
  .form-grid,
  .mail-account-picker,
  .dashboard-split,
  .progress-lane {
    grid-template-columns: 1fr;
  }

  .compact-row,
  .queue-card,
  .reply-row,
  .reply-summary {
    grid-template-columns: 1fr;
  }

  .reply-body {
    padding-left: 0;
  }
}

/* Dark Mode Design inspired final theme */

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 280px),
    #030303;
  color: var(--ink);
}

.app-shell {
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 260px),
    #050505;
  color: var(--ink);
  box-shadow: none;
}

.brand {
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  border: 1px solid var(--line-strong);
  background: #f4f4f1;
  color: #050505;
  box-shadow: none;
}

.brand h1,
.topbar h2,
.section-head h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.brand h1 {
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0;
}

.brand p,
.side-note span {
  color: var(--muted);
}

.nav {
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  color: #b9b9bf;
  font-weight: 700;
}

.nav-item:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
}

.nav-item.active {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055)),
    #111;
  color: #fff;
  box-shadow: none;
}

.nav-item.active span {
  color: var(--accent-3);
}

.side-note {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.side-note strong {
  color: var(--ink);
}

.workspace {
  max-width: 1600px;
  padding: 34px 38px 54px;
}

.topbar {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0 0 28px;
  box-shadow: none;
}

.topbar::after {
  display: none;
}

.topbar h2 {
  margin-top: 6px;
  color: #fff;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 850;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.notice {
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: #d7d7d9;
  box-shadow: none;
}

.section-band,
.stat,
.table-wrap,
.reply-group,
.manual-mail-details,
.mail-account-picker {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    #0b0b0c;
  box-shadow: var(--shadow);
}

.section-band,
.stat {
  position: relative;
}

.section-band::before,
.stat::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
}

.section-head h3 {
  padding-left: 0;
  color: #fff;
  font-family: inherit;
  font-weight: 850;
}

.section-head h3::before {
  display: none;
}

.section-head p,
.muted,
label,
.template-note,
.reply-report-head span,
.reply-empty,
.reply-summary-item span,
.reply-contact span,
.reply-content span,
.reply-row time,
.reply-group-head span,
.send-metric span,
.stat span,
.contact-platform {
  color: var(--muted);
}

.stat {
  border-top-width: 1px;
}

.stat::before {
  background: rgba(255, 255, 255, 0.07);
}

.stat:nth-child(2)::before,
.stat:nth-child(3)::before,
.stat:nth-child(4)::before {
  background: rgba(255, 255, 255, 0.07);
}

.stat strong {
  color: #fff;
  font-family: inherit;
  font-size: 34px;
}

.progress-item,
.send-metric,
.reply-summary-item,
.compact-row,
.queue-card,
.match-summary,
.template-preview,
.reply-account-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}

.progress-bar {
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar span {
  background: linear-gradient(90deg, #f4f4f1, var(--accent-3));
}

input,
select,
textarea,
.search-wrap {
  border-color: var(--line);
  background: #070708;
  color: var(--ink);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 255, 116, 0.52);
  box-shadow: 0 0 0 3px rgba(214, 255, 116, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #5f5f66;
}

input[readonly] {
  background: #101012;
}

.btn {
  border-color: #f4f4f1;
  background: #f4f4f1;
  color: #050505;
  box-shadow: none;
}

.btn:hover {
  border-color: #fff;
  background: #fff;
  box-shadow: none;
}

.btn.secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
}

.btn.secondary:hover {
  border-color: rgba(214, 255, 116, 0.55);
  background: rgba(214, 255, 116, 0.08);
  color: #fff;
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #070708;
}

.data-table th {
  border-bottom-color: var(--line);
  background: #111113;
  color: #bdbdc4;
}

.data-table td {
  border-bottom-color: var(--line);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

.status-pill {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8eb;
}

.status-pill.sent {
  background: rgba(214, 255, 116, 0.13);
  color: #d6ff74;
}

.status-pill.accepted {
  background: rgba(214, 255, 116, 0.18);
  color: #d6ff74;
}

.status-pill.failed,
.status-pill.rejected,
.status-pill.paused {
  background: rgba(255, 107, 97, 0.14);
  color: #ff8178;
}

.status-pill.replied {
  background: rgba(133, 166, 255, 0.14);
  color: #b8c7ff;
}

.reply-group {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    #0b0b0c;
}

.reply-group-head {
  border-bottom: 1px solid var(--line);
}

.reply-card {
  border-top-color: var(--line);
}

.reply-card[open] {
  background: #111113;
  box-shadow: none;
}

.reply-body pre {
  border-color: var(--line);
  background: #070708;
  color: #e4e4e7;
}

.reply-errors {
  border-color: rgba(255, 107, 97, 0.28);
  background: rgba(255, 107, 97, 0.08);
}

.toast {
  border: 1px solid var(--line-strong);
  background: #f4f4f1;
  color: #050505;
}

@media (max-width: 1100px) {
  .sidebar {
    background: #050505;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px 14px 30px;
  }

  .topbar {
    padding-bottom: 18px;
  }
}

/* Dark Mode Design final pass */

html {
  background: #030303;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0, rgba(255, 255, 255, 0) 290px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 22%, rgba(255, 255, 255, 0.028) 76%, rgba(255, 255, 255, 0)),
    #030303;
  color: var(--ink);
  letter-spacing: 0;
}

::selection {
  background: rgba(217, 255, 104, 0.28);
  color: #ffffff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #050506;
}

::-webkit-scrollbar-thumb {
  border: 3px solid #050506;
  border-radius: 999px;
  background: #333338;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background: transparent;
}

.sidebar {
  gap: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 220px),
    #050505;
  color: var(--ink);
  padding: 24px 16px;
  box-shadow: none;
}

.brand {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f6f5ef;
  color: #050505;
  box-shadow: none;
}

.brand h1,
.topbar h2,
.section-head h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.brand h1 {
  color: #ffffff;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand p,
.side-note span,
.section-head p,
.muted,
.template-note,
label {
  color: var(--muted);
}

.nav {
  gap: 7px;
}

.nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b8b8c0;
  font-weight: 760;
  letter-spacing: 0;
}

.nav-item span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #f6f5ef;
  font-size: 12px;
}

.nav-item:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: #ffffff;
  transform: translateY(-1px);
}

.nav-item.active {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055)),
    #101011;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-item.active span {
  border-color: rgba(217, 255, 104, 0.36);
  background: rgba(217, 255, 104, 0.12);
  color: var(--accent-3);
}

.side-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    #0a0a0b;
  padding: 14px;
  box-shadow: none;
}

.side-note strong {
  color: #ffffff;
}

.workspace {
  width: 100%;
  max-width: 1520px;
  padding: 38px 42px 58px;
}

.topbar {
  align-items: end;
  margin-bottom: 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0 0 30px;
  box-shadow: none;
}

.topbar::after {
  display: none;
}

.topbar h2 {
  margin: 8px 0 0;
  color: #ffffff;
  font-size: 54px;
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  padding: 5px 9px;
  color: #b5b5bd;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.top-actions,
.toolbar,
.queue-actions,
.button-row,
.reply-controls,
.reply-actions,
.row-actions {
  gap: 8px;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(217, 255, 104, 0.08), rgba(255, 255, 255, 0.035)),
    #0a0a0b;
  color: #d8d8dc;
  box-shadow: none;
}

.notice strong {
  color: #ffffff;
}

.view.active {
  animation: darkFadeIn 180ms ease both;
}

@keyframes darkFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-grid {
  gap: 12px;
}

.stat,
.section-band,
.table-wrap,
.reply-group,
.manual-mail-details,
.mail-account-picker,
.match-summary,
.send-metric,
.progress-item,
.compact-row,
.queue-card,
.reply-summary-item,
.template-preview,
.reply-account-chip,
.reply-empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.024)),
    #0a0a0b;
  box-shadow: var(--shadow-soft);
}

.stat,
.section-band,
.reply-group {
  position: relative;
  overflow: hidden;
}

.stat::before,
.section-band::before,
.reply-group::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
}

.stat::after {
  display: none;
}

.stat {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.stat span {
  color: #96969f;
  font-size: 12px;
  font-weight: 740;
}

.stat strong {
  margin-top: 22px;
  color: #ffffff;
  font-family: inherit;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
}

.stat:nth-child(2) strong {
  color: var(--accent-3);
}

.stat:nth-child(3) strong {
  color: var(--info);
}

.stat:nth-child(4) strong {
  color: var(--accent-2);
}

.section-band {
  margin-bottom: 16px;
  padding: 18px;
}

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

.section-head h3 {
  padding-left: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 860;
  letter-spacing: 0;
}

.section-head h3::before {
  display: none;
}

.section-head p,
.reply-report-head span,
.reply-empty,
.reply-summary-item span,
.reply-contact span,
.reply-content span,
.reply-row time,
.reply-group-head span,
.send-metric span,
.contact-platform,
.reply-body-meta {
  color: var(--muted);
}

.progress-lane {
  gap: 10px;
}

.progress-item,
.send-metric,
.reply-summary-item {
  padding: 12px;
}

.progress-item strong,
.send-metric strong,
.reply-summary-item strong,
.compact-row strong,
.queue-card strong,
.reply-content strong,
.reply-contact strong {
  color: #ffffff;
}

.progress-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar span {
  border-radius: inherit;
  background: linear-gradient(90deg, #f6f5ef, var(--accent-3));
}

.dashboard-split {
  gap: 12px;
}

.compact-row,
.queue-card {
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.compact-row:hover,
.queue-card:hover {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.034)),
    #101011;
  transform: translateY(-1px);
}

.template-preview,
.reply-body pre,
.send-log {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.template-preview {
  color: #dedee3;
  line-height: 1.72;
}

.form-grid {
  gap: 12px;
}

label {
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea,
.search-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070708;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

input,
select,
textarea {
  min-height: 42px;
}

textarea {
  line-height: 1.64;
}

input::placeholder,
textarea::placeholder {
  color: #5f5f67;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 255, 104, 0.58);
  background: #09090a;
  box-shadow:
    0 0 0 3px rgba(217, 255, 104, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input[readonly] {
  background: #111113;
  color: #9e9ea6;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  padding: 7px 10px;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent-3);
}

.search-wrap {
  min-height: 42px;
  padding-left: 12px;
}

.search-wrap input {
  background: transparent;
  box-shadow: none;
}

.btn {
  min-height: 40px;
  border: 1px solid #f6f5ef;
  border-radius: 8px;
  background: #f6f5ef;
  color: #050505;
  font-weight: 820;
  box-shadow: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.btn:hover {
  border-color: #ffffff;
  background: #ffffff;
  color: #050505;
  box-shadow: none;
  transform: translateY(-1px);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: #f0f0f2;
}

.btn.secondary:hover {
  border-color: rgba(217, 255, 104, 0.55);
  background: rgba(217, 255, 104, 0.095);
  color: #ffffff;
}

.btn.danger {
  border-color: rgba(255, 108, 97, 0.78);
  background: rgba(255, 108, 97, 0.18);
  color: #ffb2ac;
}

.btn.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #050505;
}

.table-wrap {
  background: #080809;
  box-shadow: var(--shadow);
}

.data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  color: #dadade;
}

.data-table th {
  background: #101011;
  color: #9898a2;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.02em;
}

.data-table tbody tr {
  background: transparent;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.data-table tbody tr:hover {
  background: rgba(217, 255, 104, 0.045);
}

.contact-platform,
.reply-note {
  color: #85858f;
}

.row-actions {
  flex-wrap: wrap;
}

.status-pill {
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #e9e9ec;
  box-shadow: none;
}

.status-pill.sent,
.status-pill.accepted {
  border-color: rgba(217, 255, 104, 0.25);
  background: rgba(217, 255, 104, 0.13);
  color: var(--accent-3);
}

.status-pill.replied {
  border-color: rgba(174, 189, 255, 0.22);
  background: var(--blue-soft);
  color: var(--info);
}

.status-pill.failed,
.status-pill.rejected,
.status-pill.paused {
  border-color: rgba(255, 108, 97, 0.25);
  background: var(--danger-soft);
  color: #ff938b;
}

.queue-actions {
  margin-bottom: 12px;
}

.send-status-panel {
  margin-bottom: 12px;
}

.send-metrics {
  gap: 10px;
}

.send-log-row {
  border-top-color: var(--line);
  color: var(--muted);
}

.send-log-row strong,
.queue-time {
  color: #ffffff;
}

.test-status {
  border-top-color: var(--line);
}

.test-ok strong {
  color: var(--accent-3);
}

.test-warn strong {
  color: var(--danger);
}

.reply-controls label span,
.test-ok span,
.test-warn span {
  color: var(--muted);
}

.reply-summary,
.reply-account-summary {
  gap: 8px;
}

.reply-account-chip {
  color: #ececef;
}

.reply-account-chip span {
  color: var(--muted);
}

.reply-errors {
  border-color: rgba(255, 108, 97, 0.28);
  background: rgba(255, 108, 97, 0.09);
  color: #ff9a92;
}

.reply-group {
  padding: 12px;
}

.reply-group-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.reply-card {
  border-top-color: var(--line);
}

.reply-card[open] {
  margin: 0;
  border-radius: 8px;
  background: #111113;
  box-shadow: none;
}

.reply-card[open] .reply-row {
  padding-left: 8px;
  padding-right: 8px;
}

.reply-row {
  align-items: center;
}

.reply-body {
  padding: 0 8px 12px 104px;
}

.reply-body pre {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070708;
  color: #e5e5e9;
  line-height: 1.75;
}

.reply-empty-state {
  border-style: dashed;
  color: var(--muted);
}

.reply-empty-state strong {
  color: #ffffff;
}

.manual-mail-details summary {
  color: #ffffff;
}

.manual-mail-details .form-grid {
  border-top-color: var(--line);
}

.mail-account-picker {
  align-items: end;
}

.match-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #d9d9dd;
}

.rules-list {
  color: #d7d7dc;
}

.rules-list li::marker {
  color: var(--accent-3);
}

.toast {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f6f5ef;
  color: #050505;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

@media (max-width: 1100px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    padding: 28px 22px 44px;
  }

  .stats-grid,
  .progress-lane,
  .send-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-split {
    grid-template-columns: 1fr;
  }

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

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

  .brand {
    padding-bottom: 14px;
  }

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

  .workspace {
    padding: 22px 14px 34px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding-bottom: 22px;
  }

  .topbar h2 {
    font-size: 40px;
    line-height: 1;
  }

  .top-actions,
  .reply-controls,
  .toolbar,
  .queue-actions,
  .button-row {
    width: 100%;
  }

  .btn,
  .reply-controls label,
  .search-wrap {
    width: 100%;
  }

  .stats-grid,
  .progress-lane,
  .send-metrics,
  .form-grid,
  .mail-account-picker,
  .reply-summary,
  .compact-row,
  .queue-card,
  .reply-row {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .reply-body {
    padding-left: 8px;
  }
}

/* Penultimate dark layout refinement */

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 260px),
    #030303;
  color: var(--ink);
}

.view.active {
  animation: none;
}

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

.sidebar {
  gap: 20px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 260px),
    #050505;
  padding: 22px 18px;
  box-shadow: none;
  overflow-y: auto;
}

.brand {
  border-bottom: 0;
  padding-bottom: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f4f4f1;
  color: #050505;
  box-shadow: none;
}

.brand h1 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.nav {
  gap: 6px;
}

.nav-item {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: #b9b9bf;
  font-weight: 700;
  transform: none;
}

.nav-item span {
  display: inline;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.nav-item:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  transform: none;
}

.nav-item.active {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055)),
    #111;
  box-shadow: none;
}

.nav-item.active span {
  color: var(--accent-3);
}

.side-note {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
  font-size: 13px;
}

.workspace {
  max-width: 1520px;
  padding: 28px 32px 44px;
}

.topbar {
  align-items: center;
  margin-bottom: 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0 0 22px;
  box-shadow: none;
}

.topbar h2 {
  margin: 5px 0 0;
  color: #fff;
  font-size: clamp(30px, 2.8vw, 42px);
  font-weight: 850;
  line-height: 1.08;
}

.eyebrow {
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.top-actions,
.toolbar,
.queue-actions,
.button-row,
.reply-controls,
.reply-actions,
.row-actions {
  gap: 8px;
}

.notice {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  padding: 12px 14px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat,
.section-band,
.table-wrap,
.reply-group,
.manual-mail-details,
.mail-account-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    #0b0b0c;
  box-shadow: var(--shadow);
}

.stat {
  display: block;
  min-height: 0;
  padding: 15px 16px;
}

.stat:nth-child(1),
.stat:nth-child(2),
.stat:nth-child(3),
.stat:nth-child(4) {
  border-color: var(--line);
}

.stat::before {
  top: 14px;
  right: 14px;
  left: auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.stat::after {
  display: none;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 32px;
  font-weight: 850;
  line-height: 1.08;
}

.stat:nth-child(2) strong,
.stat:nth-child(3) strong,
.stat:nth-child(4) strong {
  color: #fff;
}

.section-band {
  margin-bottom: 14px;
  padding: 16px;
  overflow: visible;
}

.section-head {
  align-items: center;
  margin-bottom: 13px;
}

.section-head h3 {
  padding-left: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 820;
}

.section-head h3::before {
  display: none;
}

.section-band::before,
.reply-group::before {
  display: none;
}

.progress-lane {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.progress-item,
.send-metric,
.reply-summary-item,
.compact-row,
.queue-card,
.match-summary,
.template-preview,
.reply-account-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}

.compact-row,
.queue-card {
  transform: none;
}

.compact-row:hover,
.queue-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  transform: none;
}

.dashboard-split {
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 12px;
}

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

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea,
.search-wrap {
  border-color: var(--line);
  border-radius: 8px;
  background: #070708;
  color: var(--ink);
  box-shadow: none;
}

input,
select,
textarea {
  min-height: 40px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 255, 116, 0.52);
  box-shadow: 0 0 0 3px rgba(214, 255, 116, 0.08);
}

.btn {
  width: auto;
  min-height: 38px;
  border-color: #f4f4f1;
  border-radius: 8px;
  background: #f4f4f1;
  color: #050505;
  padding: 0 14px;
  box-shadow: none;
}

.btn:hover {
  border-color: #fff;
  background: #fff;
  transform: none;
}

.btn.secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
}

.btn.secondary:hover {
  border-color: rgba(214, 255, 116, 0.55);
  background: rgba(214, 255, 116, 0.08);
}

.table-wrap {
  background: #0b0b0c;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom-color: var(--line);
}

.data-table th {
  background: #111113;
  color: #bdbdc4;
  font-size: 13px;
}

.data-table tbody tr:nth-child(even) {
  background: transparent;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

.status-pill.sent,
.status-pill.accepted {
  background: rgba(214, 255, 116, 0.13);
  color: #d6ff74;
}

.status-pill.failed,
.status-pill.rejected,
.status-pill.paused {
  background: rgba(255, 107, 97, 0.14);
  color: #ff8178;
}

.status-pill.replied {
  background: rgba(133, 166, 255, 0.14);
  color: #b8c7ff;
}

.send-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.reply-summary {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.reply-card[open] {
  margin: 0 -6px;
  background: #111113;
}

.reply-body {
  padding: 0 0 12px 106px;
}

.reply-body pre {
  border-color: var(--line);
  background: #070708;
  color: #e4e4e7;
}

.toast {
  border: 1px solid var(--line-strong);
  background: #f4f4f1;
  color: #050505;
}

@media (max-width: 1100px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    padding: 24px 20px 40px;
  }

  .stats-grid,
  .progress-lane,
  .send-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-split,
  .form-grid,
  .mail-slot {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }
}

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

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

  .workspace {
    padding: 18px 14px 30px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 32px;
  }

  .top-actions,
  .toolbar,
  .queue-actions,
  .button-row,
  .reply-controls {
    width: 100%;
  }

  .btn,
  .search-wrap,
  .reply-controls label {
    width: 100%;
  }

  .stats-grid,
  .progress-lane,
  .send-metrics,
  .form-grid,
  .mail-account-picker,
  .reply-summary,
  .compact-row,
  .queue-card,
  .reply-row {
    grid-template-columns: 1fr;
  }

  .reply-body {
    padding-left: 0;
  }
}

/* Light operations dashboard based on reference mockup */

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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f4f8;
}

::-webkit-scrollbar-thumb {
  border: 3px solid #f1f4f8;
  border-radius: 999px;
  background: #cbd5e1;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(20, 152, 127, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfcfd 0, #f6f8fb 280px);
  color: var(--ink);
  font-size: 14px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 22px 12px;
  box-shadow: none;
  backdrop-filter: blur(14px);
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  box-shadow: none;
}

.brand h1 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
}

.brand p {
  position: relative;
  padding-left: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.brand p::before,
.side-note span:last-child::before,
.runtime-pill::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: middle;
}

.brand p::before {
  position: absolute;
  left: 0;
  top: 7px;
  margin-right: 0;
}

.nav {
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5565;
  padding: 0 14px;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-item span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 14px;
}

.nav-item:hover {
  background: #f2f6f8;
  color: var(--ink);
  transform: none;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(20, 152, 127, 0.14), rgba(20, 152, 127, 0.06));
  color: #0f766e;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.active span {
  color: var(--accent);
}

.side-note {
  display: grid;
  gap: 7px;
  margin: auto 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
  box-shadow: var(--shadow-soft);
}

.side-note strong {
  color: #344054;
  font-size: 13px;
}

.side-note span {
  color: var(--muted);
  font-size: 13px;
}

.side-note span:last-child {
  color: var(--accent);
  font-weight: 700;
}

.workspace {
  width: 100%;
  max-width: none;
  padding: 22px 28px 34px;
}

.topbar {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.top-heading {
  display: grid;
  gap: 5px;
}

.top-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  margin: 0;
  color: #101828;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.2;
}

.runtime-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #b7eadc;
  border-radius: 7px;
  background: var(--accent-soft);
  color: #08775f;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.eyebrow {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.top-actions,
.toolbar,
.queue-actions,
.button-row,
.reply-controls,
.reply-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(20, 152, 127, 0.12);
  transform: none;
}

.btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
  transform: none;
  box-shadow: 0 10px 20px rgba(20, 152, 127, 0.16);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: #ffffff;
  color: #263446;
  box-shadow: var(--shadow-soft);
}

.btn.secondary:hover {
  border-color: #b9c5d3;
  background: #f8fafc;
  color: #111827;
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #475467;
  padding: 12px 16px;
  box-shadow: var(--shadow-soft);
}

.notice strong {
  color: #101828;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  min-height: 118px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 12px 18px;
  box-shadow: var(--shadow-soft);
}

.stat::before,
.stat::after {
  display: none;
}

.stat-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
}

.stat-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.stat span {
  color: #344054;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat strong {
  margin: 0;
  color: #101828;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.stat em {
  color: #667085;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.stat-track {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f5;
}

.stat-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.stat-green .stat-icon,
.stat-green .stat-track {
  color: var(--accent);
  background: var(--accent-soft);
}

.stat-green .stat-track {
  background: #edf1f4;
}

.stat-green .stat-track i {
  background: var(--accent);
}

.stat-blue .stat-icon {
  background: #e8f1ff;
  color: #2f7fe5;
}

.stat-blue .stat-track i {
  background: #2f7fe5;
}

.stat-amber .stat-icon {
  background: #fff2d7;
  color: #f59e0b;
}

.stat-amber .stat-track i {
  background: #f59e0b;
}

.stat-red .stat-icon {
  background: #ffe8e6;
  color: var(--danger);
}

.stat-red .stat-track i {
  background: var(--danger);
}

.stat-slate .stat-icon {
  background: #eef2f6;
  color: #667085;
}

.stat-slate .stat-track i {
  background: #667085;
}

.stat-violet .stat-icon {
  background: #eef2ff;
  color: #5268d9;
}

.stat-violet .stat-track i {
  background: #5268d9;
}

.section-band,
.table-wrap,
.reply-group,
.manual-mail-details,
.mail-account-picker,
.match-summary,
.template-preview,
.progress-item,
.send-metric,
.reply-summary-item,
.compact-row,
.queue-card,
.reply-account-chip,
.reply-empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.section-band {
  margin-bottom: 18px;
  padding: 18px 20px;
  overflow: visible;
}

.section-band::before,
.reply-group::before {
  display: none;
}

.section-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0 0 4px;
  padding: 0;
  color: #101828;
  font-size: 18px;
  font-weight: 850;
}

.section-head h3::before {
  display: none;
}

.section-head p,
.muted,
label,
.template-note,
.reply-report-head span,
.reply-empty,
.reply-summary-item span,
.reply-contact span,
.reply-content span,
.reply-row time,
.reply-group-head span,
.send-metric span,
.contact-platform,
.reply-body-meta {
  color: var(--muted);
}

.progress-lane {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.progress-item,
.send-metric,
.reply-summary-item {
  padding: 12px;
}

.progress-item strong,
.send-metric strong,
.reply-summary-item strong,
.compact-row strong,
.queue-card strong,
.reply-content strong,
.reply-contact strong {
  color: #101828;
}

.progress-bar {
  height: 7px;
  border-radius: 999px;
  background: #edf1f5;
}

.progress-bar span {
  border-radius: inherit;
  background: var(--accent);
}

.dashboard-split {
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
}

.compact-row,
.queue-card {
  border-radius: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.compact-row:hover,
.queue-card:hover {
  border-color: #cad4e0;
  background: #ffffff;
  box-shadow: var(--shadow);
  transform: none;
}

.template-preview {
  min-height: 210px;
  background: #fbfcfd;
  color: #344054;
  line-height: 1.75;
}

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

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

.simple-mail-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.simple-mail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.simple-mail-head h4 {
  margin: 0 0 4px;
  color: #101828;
  font-size: 17px;
}

.simple-mail-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.mail-slots {
  display: grid;
  gap: 10px;
}

.mail-slot {
  display: grid;
  grid-template-columns: 34px minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(140px, 0.8fr) 78px;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.mail-slot-badge {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}

.mail-slot-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mail-slot-state.ready {
  border-color: #bde9dc;
  background: var(--accent-soft);
  color: var(--accent);
}

label {
  gap: 6px;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea,
.search-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #101828;
  box-shadow: none;
}

input,
select,
textarea {
  min-height: 42px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 152, 127, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(20, 152, 127, 0.11);
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  color: #344054;
  padding: 7px 10px;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.search-wrap {
  min-height: 42px;
  padding-left: 12px;
}

.search-wrap input {
  border: 0;
  background: transparent;
}

.table-wrap {
  overflow: auto;
  background: #ffffff;
}

.data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  color: #344054;
  padding: 11px 12px;
}

.data-table th {
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.data-table tbody tr:nth-child(even) {
  background: transparent;
}

.data-table tbody tr:hover {
  background: #f8fbfb;
}

.contact-platform,
.reply-note {
  color: #667085;
}

.status-pill {
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #f3f4f6;
  color: #475467;
  box-shadow: none;
}

.status-pill.sent,
.status-pill.accepted {
  border-color: #bde9dc;
  background: var(--accent-soft);
  color: #08775f;
}

.status-pill.replied {
  border-color: #cfe2ff;
  background: var(--blue-soft);
  color: #2563eb;
}

.status-pill.failed,
.status-pill.rejected,
.status-pill.paused {
  border-color: #ffd0cc;
  background: var(--danger-soft);
  color: var(--danger);
}

.send-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.send-log-row {
  border-top-color: var(--line);
  color: var(--muted);
}

.send-log-row strong,
.queue-time {
  color: #101828;
}

.test-status {
  border-top-color: var(--line);
}

.test-ok strong {
  color: var(--accent);
}

.test-warn strong {
  color: var(--danger);
}

.reply-group {
  padding: 12px;
}

.reply-group-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.reply-card {
  border-top-color: var(--line);
}

.reply-card[open] {
  margin: 0;
  border-radius: 8px;
  background: #fbfcfd;
  box-shadow: none;
}

.reply-card[open] .reply-row {
  padding-left: 8px;
  padding-right: 8px;
}

.reply-body {
  padding: 0 8px 12px 104px;
}

.reply-body pre {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  line-height: 1.75;
}

.reply-errors {
  border-color: #ffd0cc;
  background: var(--danger-soft);
  color: var(--danger);
}

.match-tags span {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f3f6f8;
  color: #344054;
}

.rules-list {
  color: #344054;
}

.rules-list li::marker {
  color: var(--accent);
}

.toast {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.22);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(6, 28, 31, 0.96), rgba(14, 57, 53, 0.9)),
    var(--bg);
  padding: 28px;
}

.auth-panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(249, 246, 235, 0.9)),
    #fff;
  padding: 30px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
}

.auth-brand,
.auth-copy {
  grid-column: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1,
.auth-copy h2 {
  margin: 0;
}

.auth-brand p,
.auth-copy p,
.auth-note {
  color: var(--muted);
}

.auth-copy {
  align-self: end;
}

.auth-copy h2 {
  margin-top: 16px;
  font-size: 34px;
  line-height: 1.15;
}

.auth-copy p {
  max-width: 520px;
  line-height: 1.8;
}

.auth-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: stretch;
  display: grid;
  gap: 12px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #fff, #fbf8ed),
    #fff;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.auth-note {
  grid-column: 2;
  margin: 0;
  font-size: 13px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.user-chip strong {
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip span {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
}

.account-card {
  min-height: 220px;
}

.quota-display {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, #f5fbf8, #fff7e4),
    #fff;
  padding: 20px;
}

.quota-number {
  display: grid;
  min-width: 116px;
  min-height: 116px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #1f9a7d);
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  box-shadow: 0 18px 34px rgba(22, 115, 94, 0.2);
}

.quota-display strong {
  display: block;
  font-size: 20px;
}

.quota-display span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.8;
}

.invite-box {
  display: grid;
  gap: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.admin-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fff, #fbf7ed),
    #fff;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

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

.admin-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.admin-table {
  min-width: 980px;
}

.admin-actions {
  flex-wrap: wrap;
}

.readiness-list {
  display: grid;
  gap: 12px;
}

.readiness-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #ffd0cc;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px;
}

.readiness-banner.ready {
  border-color: #bde9dc;
  background: var(--accent-soft);
  color: var(--accent);
}

.readiness-banner span {
  color: inherit;
  opacity: 0.86;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.readiness-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.readiness-item span {
  width: fit-content;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.readiness-item.ok span {
  background: var(--accent-soft);
  color: var(--accent);
}

.readiness-item em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.5;
}

/* Phase 9: the admin console is deliberately isolated from the author theme. */
#adminView {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-soft);
}

#adminView .admin-console-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--ink);
  padding: 10px 22px;
}

#adminView .admin-console-brand,
#adminView .admin-console-account {
  display: flex;
  align-items: center;
}

#adminView .admin-console-brand {
  gap: 11px;
}

#adminView .admin-flag {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #3a352d;
  border-radius: 9px;
  background: #2a2722;
  color: var(--warn);
  font-size: 16px;
}

#adminView .admin-console-brand h3,
#adminView .admin-console-brand p {
  margin: 0;
}

#adminView .admin-console-brand h3 {
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
}

#adminView .admin-console-brand p {
  margin-top: 2px;
  color: #948c7d;
  font-size: 11px;
}

#adminView .admin-console-account {
  justify-content: flex-end;
  gap: 10px;
}

#adminView .admin-console-account > span {
  color: #948c7d;
  font-size: 12px;
}

#adminView .admin-console-account > strong {
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

#adminView .admin-console-account button {
  border: 1px solid #3a352d;
  border-radius: 9px;
  background: #2a2621;
  color: #cfc9bd;
  padding: 7px 13px;
  font-size: 12px;
}

#adminView .admin-console-account button:hover {
  border-color: var(--warn);
  color: var(--warn);
}

#adminView .admin-console-body {
  padding: 24px;
}

#adminView.admin-denied .admin-console-header,
#adminView.admin-denied .admin-console-grid {
  display: none;
}

#adminView.admin-denied .admin-stats {
  margin: 0;
}

#adminView .section-head .btn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  background: var(--warn-tint);
  color: #8d5719;
  box-shadow: none;
}

#adminView .admin-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#adminView .admin-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

#adminView .admin-stat span {
  color: var(--ink-3);
  font-size: 12px;
}

#adminView .admin-stat strong {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

#adminView .admin-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  align-items: start;
  gap: 16px;
}

#adminView .admin-console-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

#adminView .section-band {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow);
}

#adminView .section-band::before,
#adminView .section-head h3::before {
  display: none;
}

#adminView .section-head h3 {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

#adminView .section-head p {
  color: var(--ink-3);
  font-size: 12px;
}

#adminView .product-config-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#adminView .product-config-grid .wide-field {
  grid-column: auto;
}

#adminView .product-config-grid .wide-field:nth-child(3) {
  grid-column: 1 / -1;
}

#adminView .product-config-grid label > span {
  color: var(--ink-3);
  font-size: 11px;
}

#adminView input,
#adminView select {
  border-color: var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: none;
}

#adminView input:focus,
#adminView select:focus {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 15%, transparent);
}

#adminView #saveProductConfig {
  border-color: var(--warn);
  background: var(--warn);
  color: #fff;
}

#adminView #productConfigHint {
  margin-top: 14px;
  color: var(--ink-3);
}

#adminView .admin-readiness-card {
  position: sticky;
  top: 16px;
}

#adminView .readiness-summary {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: -6px 0 16px;
  color: var(--ink-3);
  font-size: 12px;
}

#adminView .readiness-summary strong {
  color: var(--ink-2);
  font-size: 13px;
}

#adminView .readiness-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

#adminView .readiness-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  padding: 11px 14px;
  box-shadow: none;
}

#adminView .readiness-mark {
  width: 22px;
  height: 22px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-pill);
  padding: 0;
  background: var(--warn);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

#adminView .readiness-item.ok .readiness-mark {
  background: var(--success);
  color: #fff;
}

#adminView .readiness-copy {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 2px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

#adminView .readiness-copy strong,
#adminView .readiness-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#adminView .readiness-copy strong {
  font-size: 13px;
  font-weight: 500;
}

#adminView .readiness-copy small {
  color: var(--ink-4);
  font-size: 10px;
}

#adminView .readiness-tag {
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--warn-tint);
  color: var(--warn);
  padding: 3px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
}

#adminView .readiness-item.ok .readiness-tag {
  background: var(--success-tint);
  color: var(--success);
}

#adminView .admin-users-card {
  overflow: hidden;
  padding: 0;
}

#adminView .admin-users-card .section-head {
  padding: 16px 22px 0;
}

#adminView .admin-users-card .table-wrap {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

#adminView .admin-table {
  min-width: 820px;
  font-size: 12px;
}

#adminView .admin-table th {
  background: var(--surface);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

#adminView .admin-table th,
#adminView .admin-table td {
  border-color: #f1ece4;
  padding: 11px 10px;
}

#adminView .admin-table th:first-child,
#adminView .admin-table td:first-child {
  padding-left: 22px;
}

#adminView .admin-table th:last-child,
#adminView .admin-table td:last-child {
  padding-right: 22px;
}

#adminView .admin-table tbody tr:hover {
  background: var(--warn-tint);
}

#adminView .admin-table .contact-platform {
  display: block;
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 10px;
}

#adminView .admin-role-badge,
#adminView .admin-status-badge {
  display: inline-flex;
  border-radius: var(--radius-pill);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
}

#adminView .admin-role-badge.admin {
  background: var(--warn-tint);
  color: var(--warn);
}

#adminView .admin-role-badge.user {
  background: var(--surface-2);
  color: var(--ink-3);
}

#adminView .admin-status-badge.active {
  background: var(--success-tint);
  color: var(--success);
}

#adminView .admin-status-badge.frozen {
  background: var(--danger-tint);
  color: var(--danger);
}

#adminView .admin-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 5px;
}

#adminView .admin-actions .btn {
  min-height: 28px;
  border-color: var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  padding: 4px 7px;
  box-shadow: none;
  font-size: 10px;
  white-space: nowrap;
}

#adminView .admin-actions .btn:hover {
  border-color: var(--warn);
  color: var(--warn);
}

@media (max-width: 1280px) {
  #adminView .admin-console-grid {
    grid-template-columns: 1fr;
  }

  #adminView .admin-readiness-card {
    position: static;
  }
}

@media (max-width: 760px) {
  #adminView .admin-console-header,
  #adminView .admin-console-account {
    align-items: flex-start;
    flex-direction: column;
  }

  #adminView .admin-console-account {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  #adminView .admin-console-body {
    padding: 14px;
  }

  #adminView .admin-stats,
  #adminView .product-config-grid {
    grid-template-columns: 1fr;
  }

  #adminView .product-config-grid .wide-field:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .progress-lane {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 1100px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    padding: 22px 18px 32px;
  }

  .dashboard-split,
  .form-grid,
  .account-grid,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-brand,
  .auth-copy,
  .auth-actions,
  .auth-note {
    grid-column: auto;
    grid-row: auto;
  }

  .wide-field {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .sidebar {
    padding: 16px 12px;
  }

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

  .workspace {
    padding: 18px 12px 28px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

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

  .top-actions,
  .toolbar,
  .queue-actions,
  .button-row,
  .reply-controls,
  .simple-mail-head,
  .quota-display {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn,
  .search-wrap,
  .reply-controls label {
    width: 100%;
  }

  .stats-grid,
  .progress-lane,
  .admin-stats,
  .readiness-grid,
  .send-metrics,
  .form-grid,
  .mail-slot,
  .mail-account-picker,
  .reply-summary,
  .compact-row,
  .queue-card,
  .reply-row {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    padding: 14px;
  }

  .auth-panel {
    padding: 20px;
  }

  .auth-copy h2 {
    font-size: 28px;
  }

  .stat {
    min-height: 128px;
  }

  .reply-body {
    padding-left: 8px;
  }
}

/* Phase 1 shared-element token overrides must remain last in the cascade. */
html,
body {
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
}

.brand h1,
.topbar h2,
.section-head h3 {
  font-family: var(--font);
  font-weight: 600;
}

.stat strong {
  font-family: var(--font);
  font-weight: 700;
}

.template-preview,
.reply-body pre,
.send-log {
  font-family: var(--font);
}

.card,
.section-band,
.stat,
.auth-panel {
  border-color: var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.btn {
  border-color: var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--surface);
  font-family: var(--font);
  font-weight: 600;
}

.btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--surface);
}

.btn.secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}

.btn.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-hover);
}

.btn.danger,
.btn.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
}

input,
select,
textarea,
.search-wrap {
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-4);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

input[readonly] {
  background: var(--surface-2);
  color: var(--ink-3);
}

input[type="file"]::file-selector-button {
  border-color: var(--border-strong);
  border-radius: var(--radius-chip);
  background: var(--surface);
  color: var(--ink-2);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.badge,
.chip,
.status-pill,
.runtime-pill,
.reply-account-chip {
  border-color: var(--border);
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--font);
  font-weight: 600;
}

.user-chip {
  border-color: var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
}

.user-chip span {
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  color: var(--accent);
}

.status-pill.sent,
.status-pill.accepted {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

.status-pill.replied {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.status-pill.failed,
.status-pill.rejected {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

.status-pill.paused {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

/* Phase 2: auth and global application shell. */
[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  place-items: stretch;
  overflow: hidden;
  background: #17140f;
  padding: 0;
}

.auth-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 60px clamp(48px, 7vw, 108px);
  color: #cfc9bd;
}

.auth-hero::before,
.auth-hero::after {
  position: absolute;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  content: "";
  filter: blur(10px);
  pointer-events: none;
}

.auth-hero::before {
  top: -190px;
  left: -140px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 68%);
  opacity: 0.34;
}

.auth-hero::after {
  bottom: -250px;
  left: 24%;
  background: radial-gradient(circle, #7a4fc0 0%, transparent 70%);
  opacity: 0.22;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 44px;
}

.auth-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--surface);
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 50%, transparent);
}

.auth-brand h1 {
  margin: 0;
  color: #f3efe7;
  font-size: 20px;
  font-weight: 600;
}

.auth-copy {
  align-self: auto;
}

.auth-copy h2 {
  margin: 0;
  max-width: 560px;
  color: #f7f4ee;
  font-size: clamp(36px, 3.2vw, 48px);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.22;
}

.auth-copy p {
  max-width: 460px;
  margin: 24px 0 0;
  color: #948c7d;
  font-size: 15px;
  line-height: 1.8;
}

.auth-panel {
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  background: var(--surface-2);
  padding: 40px;
  box-shadow: none;
}

.auth-panel-inner {
  width: 100%;
  max-width: 368px;
}

.auth-heading h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.auth-heading p {
  margin: 6px 0 22px;
  color: var(--ink-3);
  font-size: 13px;
}

.wechat-qr {
  width: 100%;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink-3);
  box-shadow: var(--shadow-soft);
}

.wechat-qr .wechat-icon {
  width: 184px;
  height: 184px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: repeating-linear-gradient(45deg, #f0ece4, #f0ece4 7px, #fff 7px, #fff 14px);
  font-size: 30px;
}

.wechat-qr:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.wechat-scan-copy {
  margin: 12px 0 0;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
  pointer-events: none;
}

.auth-note {
  margin: 14px 12px 0;
  border-radius: 9px;
  background: var(--warn-tint);
  color: #a4936b;
  padding: 9px 12px;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
}

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 12px 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.55;
}

.auth-consent input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  border-color: var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  padding: 0;
  box-shadow: none;
  cursor: pointer;
}

.auth-consent span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.auth-consent a {
  color: var(--accent);
  text-decoration: none;
}

.auth-consent a:hover {
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  color: var(--ink-4);
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--border);
  content: "";
}

.auth-actions {
  display: grid;
  gap: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.auth-actions label {
  display: grid;
  gap: 7px;
}

.auth-actions label > span {
  color: var(--ink-2);
  font-size: 12px;
}

.auth-actions input,
.auth-actions .btn {
  width: 100%;
  min-height: 44px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  border: 0;
  border-right: 1px solid #34302a;
  background: var(--ink);
  color: #cfc9bd;
  padding: 20px 14px;
  box-shadow: none;
}

.sidebar .brand {
  gap: 10px;
  padding: 6px 8px 20px;
  border: 0;
}

.sidebar .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--surface);
  font-size: 17px;
  font-weight: 700;
}

.sidebar .brand h1 {
  color: #f3efe7;
  font-size: 15px;
  font-weight: 600;
}

.sidebar .brand p {
  padding: 0;
  color: #8c8578;
  font-size: 11px;
  font-weight: 400;
}

.sidebar .brand p::before {
  display: none;
}

.sidebar .nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.sidebar .nav-item {
  min-height: 42px;
  gap: 10px;
  border-radius: var(--radius-control);
  color: #cfc9bd;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.sidebar .nav-item span {
  width: 20px;
  color: inherit;
}

.sidebar .nav-item:hover {
  background: #2a2621;
  color: #f3efe7;
}

.sidebar .nav-item.active,
.sidebar .nav-item.active:hover {
  background: var(--accent);
  color: var(--surface);
  font-weight: 600;
  box-shadow: none;
}

.side-note {
  display: grid;
  gap: 2px;
  margin: 12px 2px 0;
  border: 1px solid #34302a;
  border-top: 1px solid #34302a;
  border-radius: 9px;
  background: #2a2621;
  padding: 8px 10px;
  box-shadow: none;
}

.side-note span,
.side-note span:last-child {
  color: #8c8578;
  font-size: 11px;
  font-weight: 400;
}

.side-note span:last-child::before {
  display: none;
}

.side-note strong {
  color: #f3efe7;
  font-size: 22px;
  font-weight: 700;
}

.side-note small {
  color: #8c8578;
  font-size: 11px;
  font-weight: 400;
}

.side-logout {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius-chip);
  background: transparent;
  color: #8c8578;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
}

.side-logout:hover {
  background: #2a2621;
  color: #f3efe7;
}

.workspace {
  width: 100%;
  max-width: none;
  padding: 0 28px 60px;
}

.topbar {
  min-height: 64px;
  align-items: center;
  gap: 18px;
  margin: 0 -28px 26px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  padding: 10px 28px;
  box-shadow: none;
}

.top-heading {
  flex: 1 1 230px;
  gap: 1px;
}

.top-title-row {
  gap: 8px;
}

.topbar h2 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
}

.topbar .runtime-pill {
  min-height: 20px;
  padding: 0 7px;
  font-size: 10px;
}

.topbar .eyebrow {
  color: var(--ink-3);
  font-size: 12px;
}

.top-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.current-email {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 6px 12px;
  color: var(--ink-2);
  font-size: 12px;
}

.current-email .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.current-email strong {
  max-width: 190px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip {
  min-height: 38px;
  gap: 9px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.user-meta {
  display: grid;
  gap: 0;
  text-align: right;
}

.user-meta strong {
  font-size: 13px;
  font-weight: 600;
}

.user-meta small {
  color: var(--ink-3);
  font-size: 11px;
}

.user-chip .user-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: #e7e2d9;
  color: var(--ink-2);
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.top-actions .btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    flex: 1 1 100%;
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .auth-hero {
    min-height: 360px;
    padding: 48px 8vw;
  }

  .auth-panel {
    padding: 40px 24px 56px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #34302a;
  }

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

  .side-note,
  .side-logout {
    display: inline-grid;
    width: auto;
    margin-right: 8px;
  }
}

@media (max-width: 640px) {
  .auth-hero {
    min-height: 310px;
    padding: 36px 26px;
  }

  .auth-brand {
    margin-bottom: 26px;
  }

  .auth-copy h2 {
    font-size: 28px;
  }

  .auth-copy p {
    font-size: 13px;
  }

  .auth-panel {
    padding: 32px 18px 48px;
  }

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

  .workspace {
    padding: 0 12px 32px;
  }

  .topbar {
    margin: 0 -12px 18px;
    padding: 14px 12px;
  }

  .top-actions,
  .current-email,
  .user-chip,
  .top-actions .btn {
    width: 100%;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .user-chip {
    justify-content: flex-end;
  }
}

/* Phase 5: editor directory. */
#appShell:has(#contactsView.active) .notice {
  display: none;
}

#contactsView {
  max-width: 1280px;
  margin: 0 auto;
}

.contacts-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 2px 2px 0;
}

.contacts-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.contacts-intro h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
}

.contacts-intro p {
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 12px;
}

.contacts-live-summary {
  min-width: 230px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.contacts-live-summary strong {
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
}

.contacts-live-summary > span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.contacts-live-summary small {
  grid-column: 1 / -1;
  overflow: hidden;
  margin-top: 4px;
  color: var(--ink-4);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.contacts-filter-row,
.contacts-batch-row,
.contacts-batch-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.contacts-filter-row .search-wrap {
  min-width: 300px;
  flex: 1;
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  box-shadow: none;
}

.contacts-filter-row .search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.contacts-filter-row .search-wrap input:focus {
  box-shadow: none;
}

.contacts-filter-row #statusFilter {
  width: 170px;
  flex: 0 0 170px;
}

.contacts-batch-row {
  justify-content: space-between;
  border-top: 1px solid var(--surface-2);
  padding-top: 12px;
}

.contacts-result-count {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-size: 11px;
}

.contacts-batch-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.contacts-batch-actions .btn {
  min-height: 34px;
  padding: 0 11px;
  font-size: 11px;
}

#contactsView .contacts-table-wrap {
  max-height: calc(100vh - 330px);
  min-height: 280px;
  border-color: var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

#contactsView .data-table {
  min-width: 1110px;
}

#contactsView .data-table th,
#contactsView .data-table td {
  border-color: var(--border);
  padding: 12px 14px;
  color: var(--ink-2);
  font-size: 12px;
}

#contactsView .data-table th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}

#contactsView .data-table tbody tr:hover {
  background: var(--accent-tint);
}

#contactsView .data-table td strong {
  color: var(--ink);
  font-weight: 600;
}

#contactsView .contact-platform {
  color: var(--ink-4);
  font-size: 10px;
}

#contactsView .stage-select {
  width: 128px;
  min-height: 32px;
  padding: 5px 26px 5px 8px;
  font-size: 11px;
}

.tracking-meta {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  color: var(--ink-4);
  font-size: 10px;
  white-space: nowrap;
}

#contactsView .reply-note {
  color: var(--accent);
  font-size: 10px;
}

#contactsView .row-actions {
  align-items: center;
  flex-wrap: nowrap;
}

#contactsView .row-actions .btn {
  min-height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  font-size: 10px;
}

#contactsView .row-actions .icon-btn {
  width: 30px;
  padding: 0;
}

#contactsView .pause-one.is-paused {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

#contactsView .status-pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
}

#contactsView .status-pill.sent {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-2);
}

#contactsView .status-pill.accepted {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

#contactsView .status-pill.replied {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

#contactsView .status-pill.failed,
#contactsView .status-pill.rejected {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

#contactsView .status-pill.paused {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

.contacts-empty {
  height: 260px;
  text-align: center !important;
}

.contacts-empty strong,
.contacts-empty span {
  display: block;
}

.contacts-empty span {
  margin-top: 5px;
  color: var(--ink-4);
  font-size: 11px;
}

.contacts-load-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 0;
  color: var(--ink-3);
  font-size: 11px;
}

.contacts-load-row .btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 11px;
}

@media (max-width: 900px) {
  .contacts-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .contacts-live-summary {
    min-width: 0;
  }

  .contacts-batch-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .contacts-batch-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .contacts-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .contacts-filter-row .search-wrap,
  .contacts-filter-row #statusFilter {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .contacts-batch-actions .btn {
    flex: 1 1 calc(50% - 9px);
  }
}

/* Phase 3: dashboard overview. */
#appShell:has(#dashboardView.active) .notice {
  display: none;
}

#dashboardView .stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

#dashboardView .dashboard-stat {
  min-height: 128px;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

#dashboardView .dashboard-stat > span {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 400;
}

.dashboard-stat-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
}

#dashboardView .dashboard-stat strong {
  color: var(--ink);
  font-size: 26px;
  font-weight: 700;
}

#dashboardView .dashboard-stat small {
  color: var(--ink-3);
  font-size: 12px;
}

#dashboardView .dashboard-stat em {
  display: block;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 11px;
  font-style: normal;
}

#dashboardView .dashboard-stat-sent em,
#dashboardView .dashboard-stat-accepted em {
  color: var(--success);
}

#dashboardView .dashboard-stat-replied em {
  color: var(--accent);
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: stretch;
}

#dashboardView .dashboard-progress-card,
#dashboardView .dashboard-replies-card {
  min-width: 0;
  margin: 0;
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}

.dashboard-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-card-head h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.dashboard-card-head p,
.dashboard-card-head > span {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

.dashboard-card-head > span {
  flex: 0 0 auto;
}

#dashboardView .dashboard-workflow {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.dashboard-step {
  position: relative;
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.dashboard-step-line {
  position: absolute;
  top: 14px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.dashboard-step:first-child .dashboard-step-line {
  display: none;
}

.dashboard-step.is-done .dashboard-step-line {
  background: var(--success);
}

.dashboard-step-dot {
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-4);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-step.is-done .dashboard-step-dot {
  border-color: var(--success);
  background: var(--success);
  color: var(--surface);
}

.dashboard-step.is-active .dashboard-step-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.dashboard-step strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-step small {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 10px;
}

.dashboard-progress-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  border-top: 1px solid var(--surface-2);
  padding-top: 18px;
}

.dashboard-progress-actions .btn {
  min-height: 38px;
  padding: 0 18px;
  font-size: 13px;
}

.dashboard-reset {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: 8px 0;
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
}

.dashboard-reset:hover {
  color: var(--danger);
}

.dashboard-replies-card .dashboard-card-head {
  margin-bottom: 14px;
}

.dashboard-reply-list {
  min-height: 194px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-reply-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.dashboard-reply-tag {
  min-width: 72px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  color: var(--accent);
  background: var(--accent-tint);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-reply-tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.dashboard-reply-tag.accepted {
  color: var(--success);
  background: var(--success-tint);
}

.dashboard-reply-tag.rejected {
  color: var(--danger);
  background: var(--danger-tint);
}

.dashboard-reply-copy {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 3px;
}

.dashboard-reply-copy strong,
.dashboard-reply-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-reply-copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.dashboard-reply-copy small {
  color: var(--ink-3);
  font-size: 12px;
}

.dashboard-reply-row time {
  color: var(--ink-4);
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-reply-empty {
  min-height: 160px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--ink-3);
  text-align: center;
}

.dashboard-reply-empty strong {
  color: var(--ink-2);
  font-size: 13px;
}

.dashboard-reply-empty span {
  font-size: 11px;
}

.dashboard-replies-link {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--accent);
  padding: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-replies-link:hover {
  background: var(--accent-tint);
}

@media (max-width: 900px) {
  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #dashboardView .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboardView .dashboard-workflow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .dashboard-step-line {
    display: none;
  }

  .dashboard-progress-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-reset {
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  #dashboardView .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-reply-row {
    flex-wrap: wrap;
  }

  .dashboard-reply-copy {
    flex-basis: calc(100% - 82px);
  }

  .dashboard-reply-row time {
    margin-left: 82px;
  }
}

/* Phase 4: submission plan. */
#appShell:has(#planView.active) .notice {
  display: none;
}

#planView {
  max-width: 1180px;
  margin: 0 auto;
}

#planView .plan-form {
  gap: 18px;
}

.plan-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 2px 4px;
}

.plan-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-intro h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
}

.plan-intro p {
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 12px;
}

.plan-required-note {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 11px;
}

.plan-required-note i {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

#planView .plan-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}

.plan-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--surface-2);
}

.plan-step {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.plan-card-head h4 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.plan-card-head p {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
}

#planView .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

#planView label {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

#planView label > span:first-child em {
  color: var(--danger);
  font-style: normal;
}

#planView input,
#planView select,
#planView textarea {
  width: 100%;
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

#planView input:focus,
#planView select:focus,
#planView textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-tint);
  outline: none;
}

#planView .wide-field {
  grid-column: span 2;
}

.field-help,
.attachment-rule {
  color: var(--ink-4);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
}

.attachment-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 500;
}

.attachment-status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.attachment-status.is-ready {
  color: var(--success);
}

#planView .template-editor label {
  gap: 8px;
}

#planView .template-note {
  margin: -6px 0 0;
  color: var(--ink-3);
  font-size: 11px;
}

#planView .match-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  padding: 14px 16px;
  color: var(--ink-3);
  font-size: 11px;
  box-shadow: none;
}

#planView .match-summary strong {
  color: var(--ink-2);
  font-weight: 600;
}

#planView .match-tags {
  grid-column: 1 / -1;
}

#planView .match-tags span {
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--accent-tint);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
}

#planView .plan-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

#planView .plan-actions .btn {
  min-height: 40px;
  padding: 0 18px;
  font-size: 12px;
}

@media (max-width: 1050px) {
  #planView .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .plan-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  #planView .plan-card {
    padding: 16px;
  }

  #planView .form-grid,
  #planView .match-summary {
    grid-template-columns: 1fr;
  }

  #planView .wide-field,
  #planView .match-tags {
    grid-column: auto;
  }

  #planView .plan-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #planView .plan-actions .btn {
    width: 100%;
  }
}

/* Phase 6 · 正式发送与发送引擎 */
#queueView {
  display: none;
  gap: 16px;
}

#queueView.active {
  display: grid;
}

.queue-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 2px 4px;
}

.queue-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.queue-intro h3,
.queue-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.queue-intro h3 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.queue-intro p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
}

.queue-intro > .btn {
  min-height: 38px;
  flex: 0 0 auto;
}

.queue-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

#queueView .section-band {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.queue-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.queue-panel-head > div:first-child {
  min-width: 0;
}

.queue-panel-head h3 {
  display: inline;
  font-size: 14px;
}

.queue-panel-head p {
  margin: 5px 0 0;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.6;
}

.queue-section-index {
  margin-right: 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.queue-limit-note {
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  color: var(--accent);
  padding: 5px 9px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

#queueView .test-status {
  margin: 16px 0 0;
  border: 0;
  padding: 0;
}

#queueView .test-ok,
#queueView .test-warn {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 92px;
  border: 1px solid;
  border-radius: var(--radius-control);
  padding: 14px;
}

#queueView .test-ok {
  border-color: var(--success);
  background: var(--success-tint);
}

#queueView .test-warn {
  border-color: var(--warn);
  background: var(--warn-tint);
}

#queueView .test-ok > i,
#queueView .test-warn > i {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

#queueView .test-ok > i {
  background: var(--success);
}

#queueView .test-warn > i {
  background: var(--warn);
}

#queueView .test-ok > div,
#queueView .test-warn > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#queueView .test-ok strong,
#queueView .test-warn strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

#queueView .test-ok span,
#queueView .test-warn span {
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.queue-launch-actions,
.engine-actions,
.queue-list-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-launch-actions {
  margin-top: 12px;
}

.queue-launch-actions .btn {
  min-height: 38px;
  flex: 1 1 150px;
}

.queue-safety-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.queue-safety-list span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.45;
}

.queue-safety-list i {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-3);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
}

#queueView .send-status-panel {
  margin: 0;
}

#queueView #sendStatePill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
}

#queueView #sendStatePill.sent {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

#queueView #sendStatePill.paused {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

#queueView #sendStatePill.failed {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

#queueView .send-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 14px;
}

#queueView .send-metric {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  padding: 11px 12px;
  box-shadow: none;
}

#queueView .send-metric span {
  display: block;
  color: var(--ink-3);
  font-size: 9px;
  white-space: nowrap;
}

#queueView .send-metric strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

#queueView .send-metric small {
  margin-left: 3px;
  color: var(--ink-3);
  font-size: 8px;
  font-weight: 500;
}

.engine-actions .btn,
.queue-list-actions .btn {
  min-height: 32px;
  padding: 0 11px;
  font-size: 10px;
}

#queueView .btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.queue-list-panel,
.send-log-panel {
  min-width: 0;
}

.queue-list-head {
  align-items: center;
  margin-bottom: 14px;
}

.queue-table-head,
.queue-card {
  display: grid;
  grid-template-columns: 54px minmax(240px, 1fr) 150px 100px;
  align-items: center;
  gap: 14px;
}

.queue-table-head {
  border-bottom: 1px solid var(--border);
  padding: 0 12px 9px;
  color: var(--ink-4);
  font-size: 9px;
  font-weight: 600;
}

#queueView .queue-grid {
  display: grid;
  max-height: 355px;
  gap: 0;
  overflow: auto;
}

#queueView .queue-card {
  min-width: 650px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 11px 12px;
  box-shadow: none;
}

#queueView .queue-card:hover {
  background: var(--accent-tint);
  transform: none;
}

#queueView .queue-card > strong {
  color: var(--ink-4);
  font-size: 10px;
  font-weight: 600;
}

.queue-recipient {
  min-width: 0;
  color: var(--ink-2);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#queueView .queue-time {
  color: var(--ink-3);
  font-size: 10px;
}

#queueView .queue-card .status-pill {
  justify-self: start;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 9px;
}

#queueView .queue-card .status-pill.sent {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-2);
}

#queueView .queue-card .status-pill.accepted {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

#queueView .queue-card .status-pill.replied {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

#queueView .queue-card .status-pill.failed,
#queueView .queue-card .status-pill.rejected {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

#queueView .queue-card .status-pill.paused {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

.queue-empty,
.send-log-empty {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 116px;
  color: var(--ink-4);
  text-align: center;
}

.queue-empty strong,
.send-log-empty strong {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}

.queue-empty span,
.send-log-empty span {
  font-size: 10px;
}

.send-log-panel .queue-panel-head {
  margin-bottom: 14px;
}

.send-log-head,
#queueView .send-log-row {
  display: grid;
  grid-template-columns: 145px 90px minmax(190px, 0.8fr) minmax(260px, 1.2fr);
  align-items: center;
  gap: 14px;
}

.send-log-head {
  min-width: 760px;
  border-bottom: 1px solid var(--border);
  padding: 0 12px 9px;
  color: var(--ink-4);
  font-size: 9px;
  font-weight: 600;
}

#queueView .send-log {
  max-height: 300px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

#queueView .send-log-row {
  min-width: 760px;
  border-top: 0;
  border-bottom: 1px solid var(--border);
  padding: 11px 12px;
  color: var(--ink-3);
  font-size: 10px;
}

#queueView .send-log-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#queueView .send-log-row strong {
  color: var(--ink-2);
  font-size: 9px;
  font-weight: 600;
}

#queueView .send-log-row strong.is-sent {
  color: var(--success);
}

#queueView .send-log-row strong.is-failed {
  color: var(--danger);
}

@media (max-width: 1050px) {
  .queue-control-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .queue-intro,
  .queue-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-intro > .btn {
    width: 100%;
  }

  #queueView .section-band {
    padding: 16px;
  }

  #queueView .send-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .queue-list-actions .btn {
    flex: 1 1 150px;
  }

  .queue-table-head {
    display: none;
  }

  .send-log-head {
    display: none;
  }

  #queueView .queue-card {
    grid-template-columns: 34px minmax(180px, 1fr) 92px;
    min-width: 500px;
  }

  #queueView .queue-card .status-pill {
    grid-column: 2;
  }

  #queueView .send-log-row {
    grid-template-columns: 88px minmax(0, 1fr);
    min-width: 0;
  }

  #queueView .send-log-row span:nth-child(3),
  #queueView .send-log-row span:nth-child(4) {
    grid-column: 1 / -1;
  }
}

/* Phase 7: inbox reply organizer (no standalone comp; follows the author workspace language). */
#repliesView {
  max-width: 1220px;
}

.replies-intro,
.replies-toolbar,
.reply-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.replies-intro {
  margin-bottom: 18px;
  padding: 2px 2px 0;
}

.replies-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.replies-intro h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
}

.replies-intro p,
.replies-toolbar p {
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 12px;
}

.replies-window-note,
.reply-sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  padding: 8px 11px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.replies-window-note i,
.reply-sync-state i,
.reply-summary-item i,
.reply-group-head strong i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

#repliesView .replies-panel {
  max-width: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.replies-toolbar {
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

.replies-toolbar h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

#repliesView .reply-controls {
  flex-wrap: nowrap;
  gap: 9px;
}

#repliesView .reply-controls label {
  min-width: 270px;
  gap: 5px;
}

#repliesView .reply-controls label span {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 500;
}

#repliesView .reply-controls select {
  min-height: 38px;
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  box-shadow: none;
  font-size: 11px;
}

#repliesView .reply-controls .btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 11px;
  white-space: nowrap;
}

#repliesView .reply-report {
  margin-top: 18px;
}

#repliesView .reply-report-head {
  align-items: flex-start;
  border: 0;
  padding: 0;
}

#repliesView .reply-report-head > div {
  display: grid;
  gap: 4px;
}

#repliesView .reply-report-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

#repliesView .reply-report-head span {
  color: var(--ink-3);
  font-size: 10px;
}

#repliesView .reply-sync-state {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

#repliesView .reply-sync-state i {
  background: currentColor;
}

#repliesView .reply-report-head.is-loading .reply-sync-state {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

#repliesView .reply-account-summary {
  gap: 7px;
  margin-top: 13px;
}

#repliesView .reply-account-chip {
  border-color: var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  padding: 6px 9px;
  box-shadow: none;
  color: var(--ink-2);
  font-size: 10px;
}

#repliesView .reply-account-chip strong {
  font-weight: 500;
}

#repliesView .reply-account-chip span {
  color: var(--ink-4);
}

#repliesView .reply-errors {
  margin-top: 12px;
  border-color: var(--danger);
  border-radius: var(--radius-control);
  background: var(--danger-tint);
  padding: 10px 12px;
  color: var(--danger);
  font-size: 10px;
}

#repliesView .reply-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 18px;
}

#repliesView .reply-summary-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  padding: 12px 13px;
  box-shadow: none;
}

#repliesView .reply-summary-item span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 10px;
  white-space: nowrap;
}

#repliesView .reply-summary-item strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
}

#repliesView .reply-summary-item small {
  color: var(--ink-4);
  font-size: 9px;
  font-weight: 500;
}

#repliesView .reply-summary-item.accepted i,
#repliesView .reply-group-head strong.accepted i { background: var(--success); }
#repliesView .reply-summary-item.rejected i,
#repliesView .reply-summary-item.failed i,
#repliesView .reply-group-head strong.rejected i,
#repliesView .reply-group-head strong.failed i { background: var(--danger); }
#repliesView .reply-summary-item.manual-reply i,
#repliesView .reply-group-head strong.manual-reply i { background: var(--accent); }
#repliesView .reply-summary-item.auto-reply i,
#repliesView .reply-group-head strong.auto-reply i { background: var(--warn); }

#repliesView .reply-groups {
  gap: 12px;
}

#repliesView .reply-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 0 14px;
  box-shadow: none;
}

#repliesView .reply-group + .reply-group {
  margin-top: 0;
}

#repliesView .reply-group-head {
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 12px 2px;
}

#repliesView .reply-group-head strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}

#repliesView .reply-group-head span {
  color: var(--ink-4);
  font-size: 10px;
}

#repliesView .reply-card {
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

#repliesView .reply-card:last-child {
  border-bottom: 0;
}

#repliesView .reply-card[open] {
  margin: 0;
  border-radius: 0;
  background: var(--surface-2);
  box-shadow: none;
}

#repliesView .reply-row {
  grid-template-columns: 92px minmax(150px, 0.75fr) minmax(220px, 1.35fr) 112px 18px;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
}

#repliesView .reply-card[open] .reply-row {
  padding: 13px 10px;
}

#repliesView .status-pill {
  justify-self: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  padding: 4px 7px;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
}

#repliesView .status-pill.accepted {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

#repliesView .status-pill.rejected,
#repliesView .status-pill.failed {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

#repliesView .status-pill.manual-reply {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

#repliesView .status-pill.auto-reply {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

#repliesView .reply-contact,
#repliesView .reply-content {
  gap: 3px;
}

#repliesView .reply-contact strong,
#repliesView .reply-content strong {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}

#repliesView .reply-contact span,
#repliesView .reply-content span,
#repliesView .reply-row time {
  color: var(--ink-4);
  font-size: 9px;
}

.reply-expand-icon {
  color: var(--ink-4);
  font-size: 14px;
  transition: transform 140ms ease;
}

#repliesView .reply-card[open] .reply-expand-icon {
  transform: rotate(180deg);
}

#repliesView .reply-body {
  gap: 10px;
  padding: 0 10px 14px 114px;
}

#repliesView .reply-body-meta {
  gap: 8px 14px;
  color: var(--ink-4);
  font-size: 9px;
}

#repliesView .reply-body pre {
  max-height: 360px;
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 14px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.7;
}

#repliesView .reply-actions .btn {
  min-height: 31px;
  border-radius: var(--radius-chip);
  padding: 0 9px;
  font-size: 9px;
}

#repliesView .reply-empty-state,
#repliesView .reply-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  padding: 24px;
  color: var(--ink-4);
  text-align: center;
}

#repliesView .reply-empty-state strong {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

#repliesView .reply-empty-state > span:last-child {
  max-width: 450px;
  font-size: 10px;
}

.reply-empty-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 16px;
}

.reply-empty-state.is-loading .reply-empty-icon,
.button-spinner {
  animation: reply-spin 800ms linear infinite;
}

.reply-empty-state.is-error .reply-empty-icon {
  background: var(--danger-tint);
  color: var(--danger);
}

.button-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

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

@media (prefers-reduced-motion: reduce) {
  .reply-empty-state.is-loading .reply-empty-icon,
  .button-spinner,
  .reply-expand-icon {
    animation: none;
    transition: none;
  }
}

@media (max-width: 980px) {
  #repliesView .reply-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #repliesView .reply-row {
    grid-template-columns: 90px minmax(150px, 0.8fr) minmax(200px, 1.2fr) 96px 18px;
  }
}

@media (max-width: 720px) {
  .replies-intro,
  .replies-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .replies-window-note {
    align-self: flex-start;
  }

  #repliesView .replies-panel {
    padding: 16px;
  }

  #repliesView .reply-controls {
    align-items: stretch;
    flex-direction: column;
  }

  #repliesView .reply-controls label {
    min-width: 0;
  }

  #repliesView .reply-controls .btn {
    width: 100%;
  }

  #repliesView .reply-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #repliesView .reply-report-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #repliesView .reply-row,
  #repliesView .reply-card[open] .reply-row {
    grid-template-columns: 88px minmax(0, 1fr) 18px;
    padding: 12px 4px;
  }

  #repliesView .reply-content {
    grid-column: 1 / -1;
  }

  #repliesView .reply-row time {
    grid-column: 2;
  }

  #repliesView .reply-expand-icon {
    grid-column: 3;
    grid-row: 1;
  }

  #repliesView .reply-body {
    padding: 0 4px 14px;
  }

  #repliesView .reply-actions .btn {
    flex: 1 1 140px;
  }
}

/* Phase 8 · account invitation */
#accountView .account-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-grid);
}

#accountView .account-quota-card,
#accountView .account-invite-card {
  min-height: 286px;
  border-radius: 16px;
  padding: 26px;
}

#accountView .account-quota-card {
  background: linear-gradient(135deg, var(--accent), #6b57c7);
  color: #fff;
  box-shadow: 0 16px 40px rgba(76, 91, 212, 0.28);
}

#accountView .account-card-kicker {
  font-size: 13px;
  opacity: 0.85;
}

#accountView .quota-display {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
}

#accountView .quota-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}

#accountView .quota-value strong {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.15;
}

#accountView .quota-value span {
  margin: 0;
  color: inherit;
  font-size: 14px;
  opacity: 0.85;
}

#accountView .quota-display > p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.8;
}

#accountView .quota-breakdown {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#accountView .quota-breakdown > div {
  flex: 1;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.14);
  padding: 12px 14px;
}

#accountView .quota-breakdown span {
  margin: 0;
  color: inherit;
  font-size: 11px;
  opacity: 0.85;
}

#accountView .quota-breakdown strong {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
}

#accountView .account-invite-card {
  border: 1px solid var(--border);
  background: var(--surface);
}

#accountView .account-invite-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

#accountView .account-invite-card > p {
  margin: 0 0 18px;
  color: var(--ink-3);
  font-size: 12px;
}

#accountView .invite-box label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 12px;
}

#accountView .invite-copy-row {
  display: flex;
  gap: 8px;
}

#accountView .invite-copy-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 11px 14px;
  color: var(--ink);
}

#accountView #inviteCodeDisplay {
  font-size: 15px;
  letter-spacing: 2px;
}

#accountView #inviteLinkDisplay {
  color: var(--ink-2);
  font-size: 12px;
}

#accountView .invite-copy-primary,
#accountView .invite-copy-secondary {
  border: 0;
  border-radius: 9px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
}

#accountView .invite-copy-primary {
  background: var(--ink);
  color: #fff;
}

#accountView .invite-copy-secondary {
  background: #f5f2ec;
  color: var(--accent);
}

#accountView .invite-summary {
  margin-top: 18px;
  border-top: 1px solid #f0ece4;
  padding-top: 16px;
  color: var(--ink-2);
  font-size: 13px;
}

#accountView .invite-summary strong:first-child {
  color: var(--ink);
}

#accountView .invite-summary strong:last-child {
  color: var(--success);
}

@media (max-width: 900px) {
  #accountView .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  #accountView .account-quota-card,
  #accountView .account-invite-card {
    min-height: 0;
    padding: 20px;
  }

  #accountView .invite-copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  #accountView .invite-copy-primary,
  #accountView .invite-copy-secondary {
    min-height: 42px;
  }
}

/* Phase 8 · mailbox settings */
#settingsView .mail-settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

#settingsView .mail-settings-toolbar p {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

#settingsView .mail-settings-toolbar strong {
  color: var(--ink-2);
}

#settingsView .mail-data-actions,
#settingsView .mail-account-actions,
#settingsView .mail-modal-actions {
  display: flex;
  gap: 8px;
}

#settingsView .mail-data-actions .btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

#settingsView .compatibility-hook {
  display: none !important;
}

#settingsView .mail-settings-form {
  display: grid;
  gap: 16px;
}

#settingsView .mail-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#settingsView .mail-account-card,
#settingsView .mail-add-card {
  min-height: 190px;
  border-radius: var(--radius-card);
}

#settingsView .mail-account-card {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

#settingsView .mail-account-card.active {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}

#settingsView .mail-account-head,
#settingsView .mail-account-title,
#settingsView .manual-mail-details summary,
#settingsView .mail-modal-head {
  display: flex;
  align-items: center;
}

#settingsView .mail-account-head,
#settingsView .manual-mail-details summary,
#settingsView .mail-modal-head {
  justify-content: space-between;
}

#settingsView .mail-account-head {
  gap: 12px;
  margin-bottom: 14px;
}

#settingsView .mail-account-title {
  min-width: 0;
  gap: 10px;
}

#settingsView .mail-account-title i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--ink-4);
}

#settingsView .mail-account-card.active .mail-account-title i {
  background: var(--success);
}

#settingsView .mail-account-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#settingsView .mail-active-badge,
#settingsView .mail-set-active {
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

#settingsView .mail-active-badge {
  background: var(--success-tint);
  color: var(--success);
}

#settingsView .mail-set-active {
  background: var(--accent-tint);
  color: var(--accent);
}

#settingsView .mail-account-meta {
  display: grid;
  gap: 10px;
  margin: 0;
  font-size: 13px;
}

#settingsView .mail-account-meta > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#settingsView .mail-account-meta dt {
  color: var(--ink-3);
}

#settingsView .mail-account-meta dd {
  margin: 0;
  color: var(--ink);
  text-align: right;
}

#settingsView .mail-secret-mask {
  letter-spacing: 2px;
}

#settingsView .mail-account-meta .mail-auto-config {
  color: var(--success);
}

#settingsView .mail-account-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

#settingsView .mail-account-actions button {
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  padding: 7px 10px;
  color: var(--ink-2);
  font-size: 11px;
}

#settingsView .mail-account-actions button:hover,
#settingsView .mail-account-actions button:focus-visible {
  background: var(--accent-tint);
  color: var(--accent);
}

#settingsView .mail-account-actions .mail-unbind {
  color: var(--danger);
}

#settingsView .mail-account-actions .mail-unbind:hover,
#settingsView .mail-account-actions .mail-unbind:focus-visible {
  background: var(--danger-tint);
  color: var(--danger);
}

#settingsView .mail-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 1.5px dashed #d3ccbe;
  background: var(--surface-2);
  padding: 22px;
  color: var(--ink-3);
}

#settingsView .mail-add-card span {
  font-size: 26px;
}

#settingsView .mail-add-card strong {
  color: inherit;
  font-size: 13px;
  font-weight: 600;
}

#settingsView .mail-add-card small {
  font-size: 11px;
}

#settingsView .manual-mail-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 0;
  box-shadow: var(--shadow);
}

#settingsView .manual-mail-details summary {
  gap: 16px;
  padding: 20px 22px;
  list-style: none;
}

#settingsView .manual-mail-details summary::-webkit-details-marker {
  display: none;
}

#settingsView .manual-mail-details summary > span:first-child {
  display: grid;
  gap: 2px;
}

#settingsView .manual-mail-details summary strong {
  font-size: 14px;
  font-weight: 600;
}

#settingsView .manual-mail-details summary small,
#settingsView .manual-mail-toggle {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 400;
}

#settingsView .manual-mail-content {
  border-top: 1px solid #f0ece4;
  margin: 0 22px;
  padding: 16px 0 20px;
}

#settingsView .manual-mail-details .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 0;
  padding: 0;
  gap: 12px;
}

#settingsView .manual-mail-details label > span {
  color: var(--ink-3);
  font-size: 11px;
}

#settingsView .manual-mail-details input,
#settingsView .manual-mail-details select {
  border-color: var(--border-strong);
  border-radius: var(--radius-chip);
  background: #fdfcfa;
  padding: 9px 11px;
  font-size: 13px;
}

#settingsView .manual-mail-actions {
  margin-top: 16px;
}

body.modal-open {
  overflow: hidden;
}

#settingsView .mail-modal[hidden] {
  display: none;
}

#settingsView .mail-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

#settingsView .mail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 30, 26, 0.46);
  backdrop-filter: blur(3px);
}

#settingsView .mail-modal-dialog {
  position: relative;
  width: min(480px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 24px 70px rgba(32, 30, 26, 0.22);
}

#settingsView .mail-modal-head {
  gap: 16px;
  margin-bottom: 20px;
}

#settingsView .mail-modal-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

#settingsView .mail-modal-head p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

#settingsView .mail-modal-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 22px;
  line-height: 1;
}

#settingsView #mailAccountForm {
  display: grid;
  gap: 14px;
}

#settingsView #mailAccountForm label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
}

#settingsView #mailAccountForm input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  padding: 11px 13px;
  color: var(--ink);
}

#settingsView .mail-modal-actions {
  justify-content: flex-end;
  margin-top: 6px;
}

@media (max-width: 900px) {
  #settingsView .mail-settings-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  #settingsView .mail-slots {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #settingsView .mail-data-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  #settingsView .mail-data-actions .btn {
    width: auto;
    flex: 1 1 120px;
  }

  #settingsView .mail-account-card {
    padding: 16px;
  }

  #settingsView .mail-account-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #settingsView .mail-account-actions button {
    width: 100%;
  }

  #settingsView .manual-mail-details .form-grid {
    grid-template-columns: 1fr;
  }

  #settingsView .manual-mail-actions .btn {
    width: 100%;
  }

  #settingsView .mail-modal {
    align-items: end;
    padding: 0;
  }

#settingsView .mail-modal-dialog {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 20px;
  }
}

/* Phase 10 · mobile shell and narrow-screen layout */
.mobile-menu-button,
.mobile-top-actions,
.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    min-width: 0;
  }

  .sidebar {
    position: fixed;
    z-index: 1200;
    inset: 0 auto 0 0;
    width: min(292px, 84vw);
    height: 100dvh;
    border-right: 1px solid #34302a;
    border-bottom: 0;
    padding: 20px 14px;
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .nav,
  .sidebar .nav-item {
    display: flex;
  }

  .sidebar .nav {
    flex-direction: column;
  }

  .sidebar .nav-item {
    width: 100%;
  }

  .sidebar .side-note {
    display: grid;
    width: auto;
    margin: 12px 2px 0;
  }

  .sidebar .side-logout {
    display: block;
    width: 100%;
    margin: 8px 0 0;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 1190;
    inset: 0;
    border: 0;
    background: rgba(32, 30, 26, 0.44);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .app-shell.mobile-nav-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .workspace {
    min-width: 0;
    padding: 0 18px 40px;
  }

  .topbar {
    position: sticky;
    z-index: 100;
    top: 0;
    min-height: 72px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin: 0 -18px 18px;
    background: rgba(250, 248, 244, 0.96);
    padding: 10px 18px;
    backdrop-filter: blur(12px);
  }

  .mobile-menu-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-content: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    padding: 0;
  }

  .mobile-menu-button span {
    width: 16px;
    height: 1.5px;
    border-radius: var(--radius-pill);
    background: currentColor;
  }

  .top-heading {
    min-width: 0;
    flex-basis: auto;
  }

  .top-title-row {
    display: block;
  }

  .topbar h2 {
    overflow: hidden;
    font-size: 18px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .runtime-pill {
    display: none;
  }

  .topbar .eyebrow {
    overflow: hidden;
    margin-top: 2px;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar > .top-actions {
    display: none;
  }

  .mobile-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-top-actions > button {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink-2);
    padding: 0 8px;
    font: 600 13px var(--font);
  }

  .mobile-top-actions > button[aria-label="邮箱设置"] {
    color: var(--accent);
  }

  .mobile-top-actions .mobile-quota-pill {
    gap: 4px;
    border-radius: var(--radius-pill);
    color: var(--accent);
    padding-inline: 10px;
  }

  .mobile-quota-pill strong {
    max-width: 54px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
  }

  .mobile-quota-pill span {
    color: var(--ink-3);
    font-size: 9px;
  }

  .view,
  .section-band,
  .plan-card,
  .table-wrap,
  .admin-console-body,
  .admin-console-main,
  .admin-console-grid {
    min-width: 0;
  }

  #dashboardView .stats-grid,
  #adminView .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #planView .form-grid,
  #adminView .product-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  #adminView .admin-users-card .table-wrap {
    padding-bottom: 4px;
  }

  #adminView .admin-table {
    min-width: 760px;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    min-height: 100dvh;
  }

  .auth-hero {
    min-height: 250px;
    padding: 30px 22px;
  }

  .auth-panel {
    padding: 28px 16px 40px;
  }

  .workspace {
    padding: 0 14px 32px;
  }

  .topbar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 8px;
    margin-inline: -14px;
    padding: 9px 14px;
  }

  .mobile-menu-button {
    width: 36px;
    height: 36px;
  }

  .mobile-top-actions {
    gap: 4px;
  }

  .mobile-top-actions > button {
    min-width: 32px;
    height: 32px;
    padding-inline: 7px;
  }

  .mobile-top-actions .mobile-quota-pill {
    padding-inline: 8px;
  }

  .notice {
    padding: 12px 14px;
    font-size: 11px;
  }

  #dashboardView .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #dashboardView .dashboard-stat {
    min-height: 100px;
    padding: 14px;
  }

  #dashboardView .dashboard-stat strong {
    font-size: 22px;
  }

  #dashboardView .dashboard-progress-card,
  #dashboardView .dashboard-replies-card,
  #planView .plan-card,
  #queueView .section-band,
  #repliesView .replies-panel {
    padding: 16px;
  }

  #dashboardView .dashboard-workflow {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }

  .dashboard-step {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    text-align: left;
  }

  .dashboard-step strong,
  .dashboard-step small {
    margin: 0;
  }

  .dashboard-step small {
    grid-column: 3;
  }

  .dashboard-card-head,
  .plan-intro,
  .queue-intro,
  .contacts-intro {
    align-items: stretch;
    flex-direction: column;
  }

  #planView .form-grid,
  #adminView .product-config-grid {
    grid-template-columns: 1fr;
  }

  #planView .wide-field,
  #adminView .product-config-grid .wide-field {
    grid-column: auto;
  }

  .plan-card-head p,
  .plan-intro p,
  .queue-intro p,
  .contacts-intro p {
    line-height: 1.55;
  }

  .button-row,
  .plan-actions,
  .queue-launch-actions,
  .engine-actions,
  .queue-list-actions,
  .dashboard-progress-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .button-row .btn,
  .plan-actions .btn,
  .queue-launch-actions .btn,
  .engine-actions .btn,
  .queue-list-actions .btn,
  .dashboard-progress-actions .btn {
    width: 100%;
  }

  .contacts-controls {
    padding: 12px;
  }

  .contacts-live-summary {
    padding: 12px 14px;
  }

  .contacts-batch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .contacts-batch-actions .btn {
    width: 100%;
  }

  #contactsView .contacts-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #contactsView .data-table,
  #contactsView .data-table tbody,
  #contactsView .data-table tr,
  #contactsView .data-table td {
    width: 100%;
    display: block;
    min-width: 0;
  }

  #contactsView .data-table {
    border: 0;
    background: transparent;
  }

  #contactsView .data-table thead {
    display: none;
  }

  #contactsView .data-table tbody {
    display: grid;
    gap: 10px;
  }

  #contactsView .data-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
  }

  #contactsView .data-table td {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 0;
    padding: 6px 0;
    overflow-wrap: anywhere;
  }

  #contactsView .data-table td::before {
    color: var(--ink-4);
    font-size: 10px;
    font-weight: 500;
  }

  #contactsView .data-table td:nth-child(1)::before { content: "选择"; }
  #contactsView .data-table td:nth-child(2)::before { content: "编辑"; }
  #contactsView .data-table td:nth-child(3)::before { content: "平台"; }
  #contactsView .data-table td:nth-child(4)::before { content: "邮箱"; }
  #contactsView .data-table td:nth-child(5)::before { content: "ID"; }
  #contactsView .data-table td:nth-child(6)::before { content: "状态"; }
  #contactsView .data-table td:nth-child(7)::before { content: "跟踪"; }
  #contactsView .data-table td:nth-child(8)::before { content: "操作"; }

  #contactsView .row-actions {
    flex-wrap: wrap;
  }

  #contactsView .tracking-meta {
    white-space: normal;
  }

  #contactsView .contacts-empty {
    min-height: 190px;
    display: grid;
    place-content: center;
    text-align: center !important;
  }

  #contactsView .contacts-empty::before {
    display: none;
  }

  #queueView .queue-control-grid,
  #queueView .send-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #queueView .queue-table-head,
  #queueView .send-log-head {
    display: none;
  }

  #queueView .queue-card,
  #queueView .send-log-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    padding: 12px;
  }

  #queueView .queue-card > :nth-child(n + 3),
  #queueView .send-log-row > :nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  #repliesView .reply-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #repliesView .reply-row,
  #repliesView .reply-card[open] .reply-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  #repliesView .reply-row > * {
    min-width: 0;
  }

  #repliesView .status-pill,
  #repliesView .reply-expand-icon {
    grid-row: auto;
    grid-column: auto;
  }

  #repliesView .reply-contact,
  #repliesView .reply-content,
  #repliesView .reply-row time {
    grid-column: 1 / -1;
  }

  #accountView .account-quota-card,
  #accountView .account-invite-card {
    padding: 20px;
  }

  #settingsView .mail-settings-toolbar,
  #settingsView .mail-data-actions {
    width: 100%;
  }

  #settingsView .mail-data-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #settingsView .mail-data-actions .btn {
    width: 100%;
  }

  #settingsView .mail-account-meta > div {
    align-items: flex-start;
  }

  #settingsView .mail-account-meta dd {
    max-width: 68%;
    overflow-wrap: anywhere;
  }

  #adminView .admin-console-header {
    gap: 14px;
    padding: 16px;
  }

  #adminView .admin-console-account button,
  #adminView .section-head .btn {
    width: 100%;
  }

  #adminView .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .workspace {
    padding-inline: 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .topbar h2 {
    font-size: 16px;
  }

  .topbar .eyebrow {
    max-width: 122px;
  }

  .mobile-top-actions > button:not(.mobile-quota-pill) {
    min-width: 30px;
    width: 30px;
    padding: 0;
  }

  .mobile-top-actions .mobile-quota-pill {
    max-width: 72px;
  }

  #dashboardView .dashboard-stat,
  #dashboardView .dashboard-progress-card,
  #dashboardView .dashboard-replies-card,
  #planView .plan-card,
  #queueView .section-band,
  #repliesView .replies-panel {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop {
    transition: none;
  }
}

/* Phase 10 · global state vocabulary and interaction polish */
.card,
.section-band,
.plan-card,
.contacts-controls,
.contacts-live-summary,
.mail-account-card,
.manual-mail-details,
.account-invite-card {
  border-color: var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.btn,
button,
input,
select,
textarea,
.nav-item,
.reply-card,
.queue-card {
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease,
    transform 100ms ease;
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 2px;
}

.sidebar button:focus-visible {
  outline-color: color-mix(in srgb, var(--surface) 55%, transparent);
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown),
select:invalid {
  border-color: var(--danger);
}

.status-pill.sent,
#contactsView .status-pill.sent,
#queueView .queue-card .status-pill.sent {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-2);
}

.status-pill.accepted,
#contactsView .status-pill.accepted,
#queueView .queue-card .status-pill.accepted,
#repliesView .status-pill.accepted {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

.status-pill.replied,
.status-pill.manual-reply,
#contactsView .status-pill.replied,
#queueView .queue-card .status-pill.replied,
#repliesView .status-pill.manual-reply {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.status-pill.failed,
.status-pill.rejected,
.status-pill.bounced,
#contactsView .status-pill.failed,
#contactsView .status-pill.rejected,
#queueView .queue-card .status-pill.failed,
#queueView .queue-card .status-pill.rejected,
#repliesView .status-pill.failed,
#repliesView .status-pill.rejected {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

.status-pill.paused,
.status-pill.auto-reply,
#contactsView .status-pill.paused,
#queueView .queue-card .status-pill.paused,
#repliesView .status-pill.auto-reply {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

/* Engine health is not an editor's "已投" status, so running/complete remains success green. */
#queueView #sendStatePill.sent {
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
}

.dashboard-reply-empty,
.queue-empty,
.send-log-empty,
#repliesView .reply-empty-state,
#repliesView .reply-empty {
  min-height: 150px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  padding: var(--space-card);
  color: var(--ink-4);
  text-align: center;
}

.dashboard-reply-empty strong,
.queue-empty strong,
.send-log-empty strong,
#repliesView .reply-empty-state strong {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.dashboard-reply-empty span,
.queue-empty span,
.send-log-empty span,
#repliesView .reply-empty-state > span:last-child,
#repliesView .reply-empty {
  color: var(--ink-4);
  font-size: 10px;
  line-height: 1.6;
}

.reply-empty-state.is-loading,
.reply-report-head.is-loading {
  cursor: progress;
}

.reply-empty-state.is-loading {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent-tint) 54%, var(--surface));
}

.reply-empty-state.is-error,
#repliesView .reply-errors {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: var(--danger-tint);
  color: var(--danger);
}

.toast {
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--ink) 20%, transparent);
}

@media (hover: hover) {
  .section-band:hover,
  .plan-card:hover,
  .contacts-controls:hover,
  .mail-account-card:hover,
  .account-invite-card:hover {
    border-color: var(--border-strong);
  }
}

@media (max-width: 640px) {
  .dashboard-reply-empty,
  .queue-empty,
  .send-log-empty,
  #repliesView .reply-empty-state,
  #repliesView .reply-empty {
    min-height: 128px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  button,
  input,
  select,
  textarea,
  .nav-item,
  .reply-card,
  .queue-card {
    transition: none;
  }
}
