:root {
  --blue: #2A7DE1;
  --green: #2BB673;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f9fbfe;
  --text: #132238;
  --muted: #627489;
  --line: #d9e4f1;
  --shadow-sm: 0 8px 20px rgba(19,34,56,0.05);
  --shadow-md: 0 18px 44px rgba(19,34,56,0.08);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

a { color: inherit; }

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.page-glow-left,
.page-glow-right {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.16;
}
.page-glow-left {
  background: var(--blue);
  top: -80px;
  left: -80px;
}
.page-glow-right {
  background: var(--green);
  top: 90px;
  right: -120px;
}

.topbar,
.stat-card,
.card,
.flash,
.preview-box,
.soft-card,
.info-box,
.template-card,
.login-card {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

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

.brand-icon-wrap {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(42,125,225,0.12);
  box-shadow: var(--shadow-sm);
}

.brand-full-logo {
  display: block;
  width: 126px;
  max-width: 100%;
}

.topbar h1,
.login-brand h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.topbar p,
.login-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 760px;
}

.topbar-boxes,
.dashboard-stats,
.stats-grid {
  display: grid;
  gap: 14px;
}
.topbar-boxes {
  min-width: 360px;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}
.stats-grid,
.dashboard-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.topbar-box,
.stat-card,
.card,
.preview-box,
.soft-card,
.info-box,
.template-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.topbar-box,
.stat-card {
  padding: 18px;
}

.topbar-box span,
.stat-card span,
.info-box span,
.send-action-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar-box strong,
.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 18px auto 18px 0;
  width: 5px;
  border-radius: 0 999px 999px 0;
  background: var(--blue);
}
.stat-card:nth-child(2)::before { background: var(--green); }
.stat-card:nth-child(3)::before { background: var(--blue); }
.stat-card:nth-child(4)::before { background: var(--green); }

.card {
  padding: 24px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.card h2::after {
  content: '';
  display: block;
  width: 54px;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.flash {
  margin: 18px 0;
  padding: 15px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(43,182,115,0.28);
  background: #f4fcf8;
  line-height: 1.6;
}
.flash-error {
  background: #fff6f6;
  border-color: rgba(192,70,70,0.25);
}
.flash-success {
  background: #f4fcf8;
}

.two-col,
.two-col-send,
.toolbar-grid,
.form-grid {
  display: grid;
  gap: 14px;
}
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col-send { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr); }
.toolbar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.compact-grid { grid-template-columns: 1.15fr 1.2fr 1fr 1fr 1fr; }
.single-col { grid-template-columns: 1fr !important; }

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(42,125,225,0.7);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(42,125,225,0.12);
}
textarea { resize: vertical; min-height: 112px; }

button,
.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 12px 22px rgba(42,125,225,0.20);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
button:hover,
.btn:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.75; cursor: not-allowed; transform: none; }

.button-secondary,
.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 1px solid rgba(42,125,225,0.22);
  box-shadow: none;
}
.button-secondary:hover,
.btn-outline:hover {
  background: #f5f9ff;
}
.danger-button {
  color: #b84d4d;
  border-color: rgba(184,77,77,0.22);
}
.small-button { padding: 9px 13px; font-size: 13px; }

.inline-actions,
.stack,
.inline-form,
.campaign-top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stack { flex-direction: column; }
.inline-form { margin: 0; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  color: var(--muted);
}
.toggle-row input,
.select-all-wrap input { width: auto; }
.select-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.helper,
.muted,
.helper-strong {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.helper-strong {
  padding: 12px 14px;
  border: 1px dashed rgba(42,125,225,0.24);
  background: #f8fbff;
  border-radius: 16px;
}

.selection-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: #f7fbff;
  border: 1px solid rgba(42,125,225,0.14);
}
.selection-banner strong {
  display: block;
  margin-bottom: 4px;
}
.selection-banner span { color: var(--muted); }
.selection-badge,
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge,
.selection-badge {
  color: var(--blue);
  background: #ecf5ff;
}
.status-active { background: #edf9f2; color: var(--green); }
.status-inactive { background: #eef2f7; color: #75859a; }

.live-preview-box,
.preview-box {
  min-height: 260px;
  padding: 16px;
  line-height: 1.55;
  white-space: normal;
  margin-bottom: 14px;
}
.soft-card,
.info-box,
.template-card {
  padding: 16px;
}
.info-box strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
}
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(42,125,225,0.45);
  border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-track { background: #eef4fb; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  table-layout: fixed;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #e7eef7;
  vertical-align: top;
}

.table-wrap table th:nth-child(1),
.table-wrap table td:nth-child(1) {
  width: 42px;
  padding-left: 12px;
  padding-right: 8px;
}

.table-wrap table th:nth-child(2),
.table-wrap table td:nth-child(2) {
  width: 204px;
}

.table-wrap table th:nth-child(3),
.table-wrap table td:nth-child(3) {
  width: 118px;
}

.table-wrap table th:nth-child(4),
.table-wrap table td:nth-child(4) {
  width: 148px;
}

.table-wrap table th:nth-child(5),
.table-wrap table td:nth-child(5) {
  width: 102px;
}

.table-wrap table th:nth-child(6),
.table-wrap table td:nth-child(6) {
  width: 72px;
}

.table-wrap table th:nth-child(7),
.table-wrap table td:nth-child(7) {
  width: 128px;
}

.table-wrap table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap table td:nth-child(2) strong,
.table-wrap table td:nth-child(2) .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f9ff;
  color: var(--blue);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
tbody tr:hover td { background: #fbfdff; }

.template-card h3 { margin: 0 0 6px; font-size: 18px; }
.template-body { margin-top: 10px; line-height: 1.55; white-space: normal; }

.send-progress-box {
  display: none;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(42,125,225,0.16);
  background: #f8fbff;
}
.send-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  align-items: center;
}
.send-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #eaf1f8;
  overflow: hidden;
}
.send-progress-track > div,
.send-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: inherit;
  transition: width .2s ease;
}

.send-action-bar {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(42,125,225,0.16);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}
.send-action-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.send-action-copy strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}
.send-primary-button {
  min-width: 220px;
  background: var(--green);
  box-shadow: 0 14px 26px rgba(43,182,115,0.22);
}

code {
  background: #eff6ff;
  color: var(--blue);
  border-radius: 8px;
  padding: 2px 7px;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(42,125,225,0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(43,182,115,0.12), transparent 24%),
    var(--bg);
}
.login-shell {
  width: 100%;
  max-width: 520px;
}
.login-card {
  padding: 28px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow-md);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.login-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.login-form label span {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.login-submit {
  width: 100%;
  margin-top: 6px;
}

@media (max-width: 1180px) {
  .topbar,
  .two-col,
  .two-col-send,
  .toolbar-grid,
  .form-grid,
  .compact-grid,
  .stats-grid,
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

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

  .topbar-boxes {
    min-width: 0;
    width: 100%;
  }

  .send-action-bar,
  .selection-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .send-primary-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .app-shell { padding: 12px; }
  .topbar,
  .card,
  .login-card { padding: 18px; border-radius: 22px; }
  .brand-lockup,
  .login-brand {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-full-logo { width: 108px; }
  .topbar-boxes,
  .stats-grid,
  .dashboard-stats { grid-template-columns: 1fr; }
  th, td { padding: 10px 8px; }
}


.smart-import-card {
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.template-download-btn {
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.smart-import-form {
  gap: 16px;
}

.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 28px;
  border-radius: 28px;
  border: 1.5px dashed rgba(42,125,225,0.32);
  background:
    radial-gradient(circle at top right, rgba(42,125,225,0.10), transparent 32%),
    radial-gradient(circle at bottom left, rgba(43,182,115,0.10), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  text-align: center;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.import-dropzone:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(42,125,225,0.52);
}

.import-dropzone.has-file {
  border-style: solid;
  border-color: rgba(43,182,115,0.52);
}

.import-dropzone-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(42,125,225,0.08);
  color: var(--blue);
  font-weight: 700;
}

.import-dropzone strong {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.import-dropzone span,
.import-dropzone small {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.smart-import-grid {
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: start;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.import-feature-item {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.import-feature-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.import-feature-item span {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.import-notes {
  margin-top: 16px;
}

@media (max-width: 980px) {
  .section-heading {
    flex-direction: column;
  }

  .smart-import-grid,
  .import-feature-list {
    grid-template-columns: 1fr;
  }
}
