:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3344;
  --text: #e8eaed;
  --text-muted: #9aa0b0;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

.hidden { display: none !important; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f1117 0%, #1a1f35 50%, #0f1117 100%); }
.login-container { display: flex; gap: 4rem; align-items: center; padding: 2rem; }
.login-brand { text-align: center; }
.login-brand .logo { width: 72px; height: 72px; background: linear-gradient(135deg, var(--primary), #6366f1); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.5rem; margin: 0 auto 1rem; }
.login-brand h1 { font-size: 2rem; margin-bottom: .5rem; }
.login-brand p { color: var(--text-muted); }
.login-form { background: var(--surface); padding: 2.5rem; border-radius: var(--radius); border: 1px solid var(--border); width: 380px; box-shadow: var(--shadow); }
.login-form h2 { margin-bottom: 1.5rem; font-size: 1.25rem; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 10; }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.sidebar-brand .logo { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #6366f1); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 1rem .75rem; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; color: var(--text-muted); text-decoration: none; border-radius: 8px; margin-bottom: .25rem; transition: all .15s; font-size: .9rem; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,.15); color: var(--primary); }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-muted); }

.main { flex: 1; margin-left: 240px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 2rem; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.35rem; font-weight: 600; }
.content { padding: 2rem; }

.page { display: none; }
.page.active { display: block; }

/* Cards & Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.stat-card .label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; }
.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.danger .value { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: .75rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface2); }
tr:hover td { background: rgba(255,255,255,.02); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.5rem; }
.form-grid.narrow { max-width: 480px; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: .65rem .85rem; color: var(--text); font-family: inherit; font-size: .9rem;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus,
.form-group input:-webkit-autofill:active,
.form-group textarea:-webkit-autofill,
.form-group textarea:-webkit-autofill:hover,
.form-group textarea:-webkit-autofill:focus,
.form-group select:-webkit-autofill,
.form-group select:-webkit-autofill:hover,
.form-group select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  border-color: var(--border);
  box-shadow: 0 0 0 1000px var(--surface2) inset !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface2) inset !important;
  transition: background-color 99999s ease-out 0s;
}
.form-group input:autofill,
.form-group textarea:autofill,
.form-group select:autofill {
  box-shadow: 0 0 0 1000px var(--surface2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
}
.form-group small { color: var(--text-muted); font-size: .75rem; }
.form-actions { display: flex; gap: .75rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.2rem; border-radius: 8px; border: none; font-family: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* Badges */
.badge { display: inline-block; padding: .25rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 500; }
.badge-gray { background: var(--surface2); color: var(--text-muted); }
.badge-blue { background: rgba(59,130,246,.2); color: #60a5fa; }
.badge-green { background: rgba(34,197,94,.2); color: #4ade80; }
.badge-yellow { background: rgba(245,158,11,.2); color: #fbbf24; }
.badge-red { background: rgba(239,68,68,.2); color: #f87171; }
.badge-purple { background: rgba(168,85,247,.2); color: #c084fc; }
.badge-warmup { background: rgba(245,158,11,.15); color: #fbbf24; font-size: .75rem; }
.form-hint { display: block; margin-top: .35rem; font-size: .8rem; color: var(--text-muted); line-height: 1.4; }
.campaign-pause-alert {
  margin-top: .75rem;
  padding: .75rem 1rem;
  border-radius: 8px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
  font-size: .9rem;
  line-height: 1.45;
}

/* Progress */
.progress-bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: .35rem; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.progress-bar .progress-fill-ok { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-bar .progress-fill-fail { background: linear-gradient(90deg, var(--danger), #f87171); }
.campaign-progress { margin-top: .5rem; }
.campaign-progress-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .35rem .75rem;
  font-size: .85rem;
}
.campaign-progress-pct { font-size: .95rem; }
.campaign-progress-counts { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.campaign-progress-bar { height: 10px; display: flex; }
.campaign-progress-mini { min-width: 120px; margin-top: .35rem; }
.delivery-stats-highlight {
  padding: .75rem .9rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(59,130,246,.08));
  border: 1px solid var(--border);
}

/* Campaigns list table */
.campaigns-table-wrap { border-radius: 10px; }
.campaigns-table {
  table-layout: fixed;
  font-size: .8125rem;
}
.campaigns-table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.campaigns-table td {
  padding: .7rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.campaigns-table tbody tr.campaign-row {
  cursor: pointer;
  transition: background .15s;
}
.campaigns-table tbody tr.campaign-row:hover td {
  background: rgba(255, 255, 255, .03);
}
.campaigns-table tbody tr:last-child td { border-bottom: none; }
.campaigns-table .col-check { width: 2.25rem; text-align: center; }
.campaigns-table .col-id { width: 3.25rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.campaigns-table .col-name { width: 14%; min-width: 8rem; }
.campaigns-table .col-subject { width: 16%; min-width: 7rem; color: var(--text-muted); }
.campaigns-table .col-status { width: 8.5rem; }
.campaigns-table .col-progress { width: 9.5rem; min-width: 7.5rem; }
.campaigns-table .col-num { width: 4.75rem; text-align: right; font-variant-numeric: tabular-nums; }
.campaigns-table .col-rate { width: 3.75rem; text-align: center; }
.campaigns-table .col-actions { width: 8.5rem; }
.campaigns-table .muted-cell { color: var(--text-muted); text-align: center; }
.campaigns-table .empty-cell { text-align: center; color: var(--text-muted); padding: 2rem; }
.campaign-name-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.campaign-name-link:hover { text-decoration: underline; }
.campaign-row-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem;
  font-size: .75rem;
  margin-bottom: .3rem;
  color: var(--text-muted);
}
.campaign-row-progress-meta strong {
  color: var(--text);
  font-size: .8rem;
}
.campaign-row-bar {
  height: 5px;
  margin: 0;
  display: flex;
}
.campaign-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
  flex-wrap: nowrap;
}
.campaign-row-actions .btn-sm {
  padding: .28rem .45rem;
  font-size: .75rem;
  line-height: 1.2;
  white-space: nowrap;
}
.delivery-rate-badge {
  display: inline-block;
  min-width: 2.75rem;
  padding: .15rem .35rem;
  border-radius: 6px;
  background: rgba(34, 197, 94, .12);
  color: var(--success);
  font-weight: 600;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

/* Alert & Toast */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .875rem; }
.alert-error { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.toast { position: fixed; bottom: 2rem; right: 2rem; background: var(--surface2); border: 1px solid var(--border); padding: 1rem 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100; animation: slideIn .3s; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.info-box { padding: 1.5rem; font-size: .9rem; color: var(--text-muted); }
.info-box code { background: var(--surface2); padding: .15rem .4rem; border-radius: 4px; color: var(--text); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .login-container { flex-direction: column; }
}

.action-group { display: flex; gap: .5rem; flex-wrap: wrap; }

.import-zone {
  position: relative;
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 0;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  overflow: hidden;
  min-height: 140px;
}
.import-zone:hover,
.import-zone.is-dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, .06);
  color: var(--text);
}
.import-zone.is-disabled {
  opacity: .55;
  pointer-events: none;
  cursor: not-allowed;
}
.import-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.import-zone-content {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
  pointer-events: none;
}
.import-zone-content .import-icon {
  font-size: 2rem;
  margin-bottom: .5rem;
  line-height: 1;
}
.import-zone-content p { margin: 0 0 .35rem; color: var(--text); font-weight: 500; }
.import-zone-content small { color: var(--text-muted); font-size: .8rem; line-height: 1.4; }

.import-progress {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}
.import-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .6rem;
  font-size: .9rem;
}
.import-progress-bar { height: 10px; margin-top: 0; }
.import-progress-bar .progress-fill { background: linear-gradient(90deg, var(--primary), #6366f1); }
.import-progress-detail {
  display: block;
  margin-top: .6rem;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.4;
}

.campaign-sent-banner {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(245, 158, 11, .4);
  background: rgba(245, 158, 11, .1);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.campaign-sent-banner:hover {
  background: rgba(245, 158, 11, .16);
  border-color: rgba(245, 158, 11, .55);
}
.campaign-sent-banner-icon { font-size: 1.1rem; line-height: 1; }
.campaign-sent-banner-hint {
  margin-left: auto;
  color: var(--text-muted);
  font-size: .82rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-card {
  width: min(900px, 100%);
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1rem 1.1rem; overflow: auto; }
.modal-summary {
  margin: 0 0 .75rem;
  color: var(--text-muted);
  font-size: .85rem;
}
.modal-table-wrap { max-height: 55vh; }
.modal-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: .75rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.exclude-recent-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.exclude-recent-title {
  margin: 0 0 .35rem;
  font-weight: 600;
  font-size: .9rem;
}
.exclude-recent-hint {
  margin: 0 0 .75rem;
  font-size: .82rem;
  color: var(--text-muted);
}
.exclude-recent-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.exclude-recent-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  cursor: pointer;
  font-size: .875rem;
}
.exclude-recent-option:hover { border-color: var(--primary); }
.exclude-recent-option input { accent-color: var(--primary); cursor: pointer; }
.exclude-recent-option.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}
.exclude-recent-option.is-disabled:hover { border-color: var(--border); }

.smtp-stats-wrap { max-height: 320px; overflow: auto; }
.smtp-stats-table { font-size: .85rem; }
.smtp-stats-table th, .smtp-stats-table td { padding: .45rem .5rem; vertical-align: top; }

.quota-info-box {
  padding: .65rem .75rem;
  margin-bottom: .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
}
.quota-info-box p { margin: 0; }

.alibaba-quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.alibaba-quota-stat .label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.alibaba-quota-stat .value {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
}
.alibaba-quota-stat small {
  display: block;
  margin-top: .2rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.alibaba-quota-box {
  padding: .75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.alibaba-quota-warn {
  border-color: rgba(245, 158, 11, .35);
  background: rgba(245, 158, 11, .08);
}

.limits-page-tabs { margin-bottom: 1rem; }
.limits-panel { display: none; }
.limits-panel.active { display: block; }

.alibaba-accounts-panel { padding: 0; }
.alibaba-accounts-table .table-wrap { border: none; border-radius: 0; }
.address-page-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.address-page-header h3 { margin: 0; }
.account-test-results {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(59, 130, 246, .04);
}
.account-test-results-inner p { margin: 0; font-size: .875rem; }
.account-test-results-inner ul { color: var(--text-muted); }
.alibaba-accounts-table .table-wrap { border: none; border-radius: 0; }
.alibaba-accounts-table tr.row-active td { background: rgba(59, 130, 246, .08); }
.alibaba-account-detail { padding: 0; }
.alibaba-account-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.alibaba-account-detail .section-subtitle {
  margin: 0 0 .75rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.alibaba-account-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  overflow: hidden;
}
.alibaba-account-card .card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.alibaba-account-keys {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(59,130,246,.04);
}
.alibaba-account-keys .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
}
.alibaba-account-keys label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.alibaba-account-keys input {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
}
.alibaba-account-smtp {
  padding: 1rem 1.25rem;
}
.alibaba-account-smtp .table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.campaign-timing {
  margin-top: .75rem;
  padding: .65rem .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
}
.campaign-timing p { margin: 0; }
.recipient-tab {
  padding: .6rem 1rem; background: none; border: none; color: var(--text-muted);
  font-family: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.recipient-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.recipient-panel { display: none; }
.recipient-panel.active { display: block; }

.manual-recipients textarea {
  width: 100%; min-height: 180px; resize: vertical;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: .85rem; color: var(--text); font-family: ui-monospace, monospace; font-size: .82rem; line-height: 1.5;
}
.manual-recipients textarea:focus { outline: none; border-color: var(--primary); }
.manual-recipients-hint {
  margin: 0 0 .75rem;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.manual-recipients-hint code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .8rem;
}
.manual-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .75rem; flex-wrap: wrap; }
.manual-meta small { color: var(--text-muted); }
.contact-list-members-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.contact-list-members-section .section-subtitle {
  margin: 0 0 .75rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

.limits-table th,
.limits-table td {
  vertical-align: middle;
}
.limits-table input[type="number"] {
  width: 100px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: .4rem .55rem; color: var(--text); font-size: .85rem;
}
.limits-table input[type="number"]:disabled { opacity: .45; }
.limits-table .limit-check {
  text-align: center;
  width: 4.5rem;
  white-space: nowrap;
}
.limits-table .limit-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
}
.limits-table tbody tr:last-child td { border-bottom: none; }

.smtp-checkbox-list { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); }
.smtp-check-item { display: flex; align-items: center; gap: .75rem; cursor: pointer; font-size: .9rem; }
.smtp-check-item input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }

.template-preview {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color-scheme: dark;
}
.template-preview-wrap { margin-top: .5rem; }
.template-preview-wrap label { color: var(--text-muted); }

.template-editor-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.template-editor-header h3 { margin: 0; }
.template-editor-form textarea[name="html_body"] {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
  resize: vertical;
}
.template-editor-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.template-editor-preview-wrap .card-body { padding-top: 0; }
.ab-subjects-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.ab-subject-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ab-subject-label {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.ab-subject-row input.ab-subject-input,
.ab-subject-row input.ab-from-name-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .85rem;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
}
.ab-subject-row input.ab-subject-input:focus,
.ab-subject-row input.ab-from-name-input:focus {
  outline: none;
  border-color: var(--primary);
}

.live-stats { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; font-size: .85rem; }
.live-stats .stat-ok { color: var(--success); font-weight: 600; }
.alibaba-quota-stat .stat-warn { color: #f59e0b; font-weight: 600; }
.alibaba-quota-stat .stat-ok { color: var(--success); font-weight: 600; }
.live-stats .stat-fail { color: var(--danger); font-weight: 600; }
.live-stats .stat-open { color: var(--primary); font-weight: 600; }
.live-stats .stat-click { color: #a78bfa; font-weight: 600; }

.recipients-toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.recipients-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  color: var(--text);
}
.recipients-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.1rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
}

.chart-wrap { position: relative; min-height: 200px; }
.link-stat-row { margin-bottom: .85rem; }
.link-stat-url { font-size: .8rem; word-break: break-all; margin-bottom: .25rem; }
.link-stat-bar { height: 6px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.link-stat-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a78bfa); }
.link-stat-meta { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.ab-variant-box { padding: .65rem .75rem; margin-bottom: .5rem; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); }
.ab-variant-box.ab-winner { border-color: var(--success); }
.domain-health-item { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.domain-health-item:last-child { border-bottom: none; }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-brand span { display: none; }
  .sidebar-brand { justify-content: center; padding: 1rem; }
  .nav-item { justify-content: center; padding: .75rem; font-size: 0; gap: 0; }
  .nav-item svg { width: 20px; height: 20px; }
  .sidebar-footer { flex-direction: column; gap: .5rem; font-size: 0; }
  .main { margin-left: 64px; }
  .content { padding: 1rem; }
  .topbar { padding: 1rem; flex-wrap: wrap; gap: .5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .action-group { flex-wrap: wrap; }
  th, td { padding: .5rem .75rem; font-size: .8rem; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
}
