/* Influencer CRM — modern SaaS theme (indigo / neutral, comfortable density) */

:root {
  /* Surfaces */
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #eceef4;

  /* Text */
  --ink: #15171c;
  --text: #2b2f38;
  --muted: #6b7280;
  --subtle: #9aa1ad;

  /* Lines */
  --line: #e7e8ee;
  --line-strong: #d7d9e2;

  /* Brand */
  --accent: #5b5bd6;
  --accent-hover: #4f4fcb;
  --accent-press: #4444b8;
  --accent-soft: #eef0fd;
  --accent-ink: #3a3aa3;

  /* Status / feedback */
  --danger: #d4304a;
  --danger-soft: #fdecef;
  --danger-line: #f3c6cf;

  /* Effects */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 7px;
  --pill: 999px;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 2px 6px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 8px 24px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 24px 56px rgba(17, 24, 39, 0.22);
  --ring: 0 0 0 3px rgba(91, 91, 214, 0.18);

  --maxw: 1440px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-width: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3 {
  color: var(--ink);
  letter-spacing: -0.012em;
}

::selection {
  background: var(--accent-soft);
}

/* ---------- App header ---------- */
.appHeader {
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-width: 0;
  padding: 9px 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.appHeader h1 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.appHeader p,
.subtle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.tabs {
  padding: 3px;
}

.tabs a {
  padding: 6px 14px;
}

.iconButton {
  min-height: 34px;
}

.tabs {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  padding: 4px;
}

.tabs a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  text-align: center;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.active {
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--accent-ink);
}

/* ---------- Page shell ---------- */
.pageShell {
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 16px 32px 48px;
  width: 100%;
}

.sectionHeader,
.toolbar,
.panelHeader,
.detailHeader {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  min-width: 0;
}

.sectionHeader,
.detailHeader {
  margin-bottom: 20px;
}

.detailHeader {
  align-items: flex-start;
}

.sectionHeader h2,
.detailHeader h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

/* Detail page header bits */
.breadcrumb {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  gap: 5px;
  margin-bottom: 12px;
  min-height: 0;
  padding: 2px 0;
}

.breadcrumb:hover {
  background: transparent;
  color: var(--accent);
}

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

.metaStrip {
  align-items: center;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px 20px;
  margin-top: 12px;
}

.metaKey {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  margin-right: 7px;
  text-transform: uppercase;
}

.metaLink {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.metaLink:hover {
  text-decoration: underline;
}

.colStack {
  align-content: start;
  display: grid;
  gap: 18px;
}

.infoList {
  display: grid;
  gap: 12px;
}

.infoRow {
  display: grid;
  gap: 2px;
}

.infoRow .metaKey {
  margin: 0;
}

.infoRow span:last-child {
  color: var(--ink);
  font-size: 14px;
  word-break: break-word;
}

.sectionHeader p,
.detailHeader p,
.meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding: 20px;
}

.panelHeader {
  margin-bottom: 14px;
}

.panelHeader h3 {
  font-size: 15px;
  font-weight: 650;
}

.toolbar {
  margin-bottom: 18px;
}

.toolbarLeft,
.toolbarRight,
.buttonRow {
  align-items: center;
  display: flex;
  gap: 10px;
}

.toolbarLeft {
  flex: 1;
  flex-wrap: wrap;
}

.toolbarLeft input {
  max-width: 300px;
}

.toolbarLeft select {
  max-width: 190px;
}

.grid {
  display: grid;
  gap: 18px;
}

.twoColumn {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 0.95fr) minmax(400px, 1.15fr);
}

.campaignBody {
  padding-top: 12px;
}

.subTabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 -4px 18px;
  min-width: 0;
}

.subTabs button {
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  color: var(--muted);
  flex: 0 1 auto;
  min-height: 38px;
  padding: 8px 14px 10px;
}

.subTabs button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.subTabs button.active {
  border-bottom-color: var(--accent);
  color: var(--accent-ink);
}

.inlineAssign[hidden] {
  display: none;
}

.inlineAssign {
  align-items: end;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) auto;
}

.accountToolbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) max-content;
  margin-bottom: 14px;
  min-width: 0;
}

.searchField {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  display: flex;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
  padding: 0 12px;
}

.searchField svg,
.filterButton svg,
.lastContactIcon svg,
.filterHint svg {
  fill: none;
  flex: 0 0 auto;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.searchField input {
  border: 0;
  box-shadow: none;
  min-height: 40px;
  padding: 7px 0;
}

.searchField input:focus {
  box-shadow: none;
}

.filterButton {
  min-height: 44px;
}

.campaignAccountsTable {
  max-height: min(560px, calc(100vh - 300px));
  min-height: 260px;
  overflow: auto;
}

.campaignAccountsTable thead th {
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.lastContact {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 10px;
  max-width: 100%;
  min-width: 250px;
}

.lastContactIcon {
  align-items: center;
  background: #eef0ff;
  border: 1px solid #dfe3ff;
  border-radius: var(--pill);
  color: var(--accent-ink);
  display: inline-flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.lastContactBody {
  min-width: 0;
}

.lastContact strong {
  display: block;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
}

.contactActorMark {
  background: #e9ebf3;
  border-radius: 2px;
  padding: 0 2px;
}

.miniStep {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  color: var(--muted);
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 800;
  margin-left: 6px;
  padding: 2px 7px;
  vertical-align: middle;
}

.lastContact small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 2px;
  max-width: min(360px, 34vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lastContact.inbound .lastContactIcon {
  background: #eaf8f0;
  border-color: #ccebd8;
  color: #047857;
}

.lastContact.outbound .lastContactIcon {
  background: #eef0ff;
  border-color: #dfe3ff;
  color: var(--accent-ink);
}

.lastContact.draft .lastContactIcon {
  background: #fff7ed;
  color: #b45309;
}

.mutedContact {
  color: var(--subtle);
  font-size: 13px;
}

.analyticsLayout {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.campaignRatioCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  min-width: 0;
  padding: 16px;
}

.ratioMetric {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  min-height: 120px;
  min-width: 0;
  padding: 20px 22px;
}

.ratioMetricTitle {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: space-between;
}

.ratioMetricTitle span {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--subtle);
  display: inline-flex;
  font-size: 10px;
  height: 16px;
  justify-content: center;
  width: 16px;
}

.ratioMetric strong {
  color: var(--ink);
  display: block;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
  line-height: 1.1;
  margin-top: 28px;
  overflow-wrap: anywhere;
}

.ratioMetric em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
  margin: 0 8px;
}

.ratioMetric small {
  color: var(--muted);
  font-size: 18px;
}

.ratioMetric.muted strong {
  color: var(--subtle);
  font-size: 20px;
}

.ratioBar {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  grid-column: 1 / -1;
  min-width: 0;
  padding: 22px 28px;
}

.ratioLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: flex-end;
  margin-bottom: 26px;
}

.ratioLegend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
}

.ratioLegend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.ratioLegend .sent,
.stageChartTrack .sent {
  background: #168bf2;
}

.ratioLegend .contacted,
.stageChartTrack .contacted {
  background: #ffc400;
}

.ratioLegend .replied,
.stageChartTrack .replied {
  background: #9bf20c;
}

.ratioLegend .opportunity,
.stageChartTrack .opportunity {
  background: #15d18d;
}

.ratioLegend .conversion,
.stageChartTrack .conversion {
  background: #dfeff4;
}

.stageChart {
  display: grid;
  gap: 12px;
  margin: 0 auto;
  max-width: 980px;
  padding: 4px 0 8px;
}

.stageChartRow {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(120px, 170px) minmax(160px, 1fr) 36px;
}

.stageChartLabel {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.stageChartTrack {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 18px;
  overflow: hidden;
}

.stageChartTrack span {
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 0;
  opacity: 0.88;
}

.stageChartRow strong {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
}

.stageBreakdown {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-top: 20px;
  padding-top: 16px;
}

.stageBreakdown span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stageBreakdown strong {
  color: var(--ink);
  display: block;
  font-size: 18px;
  margin-top: 4px;
}

.bounceMetric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 16px 18px;
}

.bounceMetric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.bounceMetric strong {
  color: var(--ink);
  display: block;
  font-size: 26px;
  line-height: 1.1;
  margin-top: 8px;
}

.analyticsPanel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  min-width: 0;
  padding: 18px;
}

.analyticsTabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: -4px 0 18px;
  min-width: 0;
}

.analyticsTabs button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-weight: 800;
  min-height: 42px;
  padding: 0 0 12px;
}

.analyticsTabs button.active {
  border-bottom: 3px solid #1769ff;
  color: #1769ff;
}

.bounceGrid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.analyticsTable {
  max-height: 460px;
  overflow: auto;
}

.stepAnalyticsTable th,
.stepAnalyticsTable td {
  white-space: nowrap;
}

.stepAnalyticsTable td:first-child,
.stepAnalyticsTable td:nth-child(4) {
  min-width: 220px;
  white-space: normal;
}

.metricMuted {
  color: var(--subtle);
  font-weight: 750;
  margin-left: 4px;
}

.sequenceLayout {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.sequenceHeader {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  min-width: 0;
}

.sequenceHeader h3 {
  font-size: 17px;
}

.sequenceEditor {
  align-items: start;
  display: grid;
  gap: clamp(16px, 2vw, 30px);
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.7fr);
  min-width: 0;
}

.sequenceSteps {
  display: grid;
  gap: 14px;
  max-height: none;
  min-width: 0;
  overflow: visible;
}

.sequenceStep {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  display: grid;
  gap: 22px;
  overflow: hidden;
  padding: 0;
}

.sequenceStep input {
  margin: 0 24px;
  min-height: 44px;
}

.sequenceStep.active {
  border-color: var(--accent);
  border-left: 3px solid #0b73ff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}

.sequenceStepTop {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 22px 24px;
}

.sequenceStepTop strong {
  color: var(--ink);
  font-size: 16px;
}

.sequenceTrashButton {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 28px;
  padding: 0;
}

.sequenceTrashButton.muted {
  opacity: 0.45;
}

.sequenceVariantButton {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  gap: 12px;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
}

.sequenceVariantButton span {
  color: #0b73ff;
  font-size: 24px;
  font-weight: 500;
}

.sequenceDelay {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 90px 120px;
  padding: 24px;
}

.sequenceDelay span {
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
}

.sequenceDelay select {
  background: var(--surface);
  min-height: 44px;
}

.addSequenceStep {
  background: var(--surface);
  border: 1px dashed var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
  min-height: 56px;
}

.sequenceMessagePane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  min-width: 0;
  min-height: 500px;
  overflow: hidden;
  padding: 0;
}

.sequenceMessage {
  display: none;
}

.sequenceMessage.active {
  display: grid;
}

.sequenceSubject {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: auto minmax(0, 1fr) max-content;
  padding: 28px 34px;
}

.sequenceSubject span {
  color: var(--muted);
  font-weight: 700;
}

.sequenceSubject input {
  border-color: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  min-height: 42px;
  padding-left: 0;
}

.sequenceSubject input:focus {
  border-color: transparent;
  box-shadow: none;
}

.sequenceSubjectActions {
  align-items: center;
  border-left: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-left: 24px;
}

.sequencePreviewButton,
.sequenceQuickButton,
.sequenceToolButton,
.sequenceSaveMenuButton {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  color: var(--muted);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sequencePreviewButton {
  color: #3f7cff;
  gap: 8px;
  padding: 8px 16px;
}

.sequenceQuickButton,
.sequenceToolButton,
.sequenceSaveMenuButton {
  min-width: 46px;
  padding: 8px 10px;
}

.sequencePreviewButton:hover,
.sequenceQuickButton:hover,
.sequenceToolButton:hover,
.sequenceSaveMenuButton:hover {
  background: var(--accent-soft);
  border-color: #cfd8ff;
  color: var(--accent-ink);
}

.sequencePreviewButton svg,
.sequenceQuickButton svg,
.sequenceToolButton svg,
.sequenceSaveMenuButton svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 20px;
}

.sequenceMessageEditor {
  padding: 28px 34px 8px;
}

.sequenceMessageEditor textarea {
  border-color: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1.7;
  min-height: 230px;
  padding: 6px 10px;
  resize: vertical;
}

.sequenceMessageEditor textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.sequenceVariants {
  display: grid;
  gap: 14px;
  padding: 0 34px 28px;
}

.sequenceVariantBox {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  display: grid;
  overflow: hidden;
}

.sequenceVariantHeader {
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}

.sequenceVariantBox textarea {
  border: 0;
  border-radius: 0;
  font-size: 16px;
  line-height: 1.6;
  min-height: 160px;
  padding: 18px;
  resize: vertical;
}

.sequenceActionBar.compact {
  border-top: 1px solid var(--line);
  min-height: 58px;
  padding: 10px 16px;
}

.sequenceActionBar {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 34px 24px;
}

.sequencePrimaryActions {
  display: inline-flex;
}

.sequenceSaveButton {
  background: #3f7cff;
  border-color: #3f7cff;
  border-radius: var(--radius-xs) 0 0 var(--radius-xs);
  color: #fff;
  font-weight: 800;
  min-height: 44px;
  padding: 9px 22px;
}

.sequenceSaveButton:hover,
.sequenceSaveMenuButton:hover {
  background: #356ee6;
  border-color: #356ee6;
  color: #fff;
}

.sequenceSaveMenuButton {
  background: #3f7cff;
  border-color: rgba(255, 255, 255, 0.16);
  border-left-color: rgba(255, 255, 255, 0.22);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: #fff;
}

.sequenceToolbarDivider {
  background: var(--line);
  height: 32px;
  width: 1px;
}

.sequenceHint {
  color: var(--muted);
  font-size: 13px;
}

.iconOnly {
  min-height: 30px;
  min-width: 30px;
  padding: 0;
}

/* ---------- Stats ---------- */
.statGrid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.stat strong {
  color: var(--ink);
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat .meta,
.stat span {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
}

/* ---------- Form controls ---------- */
input,
select,
textarea,
button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font: inherit;
  min-height: 40px;
  padding: 9px 12px;
}

input,
select,
textarea {
  background: var(--surface);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
  outline: none;
}

textarea {
  line-height: 1.5;
  min-height: 96px;
  resize: vertical;
}

label {
  color: var(--text);
  display: grid;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  letter-spacing: 0.01em;
}

/* ---------- Buttons ---------- */
button,
.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
  white-space: nowrap;
}

button svg,
.button svg {
  fill: none;
  flex: 0 0 auto;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

button:hover,
.button:hover {
  background: var(--accent-hover);
}

button:active,
.button:active {
  background: var(--accent-press);
  transform: translateY(0.5px);
}

button:focus-visible {
  box-shadow: var(--ring);
  outline: none;
}

.secondaryButton,
.ghostButton,
.dangerButton,
.iconButton,
.closeDrawer {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.secondaryButton:hover,
.ghostButton:hover,
.iconButton:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.ghostButton {
  color: var(--muted);
  font-weight: 600;
}

.dangerButton {
  border-color: var(--danger-line);
  color: var(--danger);
}

.dangerButton:hover {
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.iconButton {
  min-width: 92px;
}

/* ---------- Tables ---------- */
.tableWrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.panel > .tableWrap {
  border: none;
  border-radius: 0;
  margin: 4px -4px -4px;
}

.dataTable {
  border-collapse: collapse;
  min-width: 680px;
  table-layout: auto;
  width: 100%;
}

.dataTable th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.dataTable th:first-child {
  border-top-left-radius: var(--radius);
}

.dataTable th:last-child {
  border-top-right-radius: var(--radius);
}

.dataTable td {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 14px 16px;
  vertical-align: middle;
  word-break: break-word;
}

.dataTable tbody tr:last-child td {
  border-bottom: none;
}

.dataTable tbody tr {
  transition: background 100ms ease;
}

.dataTable tbody tr:hover td {
  background: var(--surface-2);
}

.dataTable td .meta {
  margin-top: 3px;
}

.dataTable select {
  max-width: 180px;
  min-height: 34px;
  padding: 5px 10px;
}

.campaignAccountsTable .dataTable {
  min-width: 900px;
}

.analyticsTable .dataTable {
  min-width: 860px;
}

.rowLink {
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
}

.rowLink:hover {
  color: var(--accent);
}

/* ---------- Badges ---------- */
.badge {
  background: var(--surface-3);
  border-radius: var(--pill);
  color: var(--text);
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  padding: 3px 10px;
  text-transform: capitalize;
}

.badge.draft,
.badge.prospect {
  background: #eef0f4;
  color: #5b6472;
}

.badge.active,
.badge.contacted {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.badge.completed,
.badge.won,
.badge.replied {
  background: #e6f6ec;
  color: #1f8a4c;
}

.badge.paused,
.badge.negotiating,
.badge.in_negotiation,
.badge.advance_payment,
.badge.shortlisted {
  background: #fdf2da;
  color: #97670c;
}

.badge.video_released {
  background: #e9f7fb;
  color: #11738a;
}

.badge.rejected,
.badge.fail,
.badge.not_interested,
.badge.not_interested_high_exp,
.badge.not_interested_content_mismatch,
.badge.not_interested_no_reply {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Forms (drawer / compact) ---------- */
.formGrid,
.drawerForm,
.compactForm {
  display: grid;
  gap: 13px;
}

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

.formGrid .full,
.formGrid button {
  grid-column: 1 / -1;
}

.compactForm {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  padding: 14px;
}

.compactForm input,
.compactForm select,
.compactForm textarea {
  background: var(--surface);
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

/* ---------- Messages ---------- */
.messageList {
  display: grid;
  gap: 12px;
}

.messageCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.messageCard .buttonRow {
  flex-wrap: wrap;
  gap: 8px;
}

.messageCard strong {
  color: var(--ink);
  font-size: 14px;
}

.messageCard p {
  color: var(--text);
  line-height: 1.5;
  margin-top: 8px;
}

.messageCard .ghostButton {
  margin-left: auto;
  min-height: 30px;
  padding: 4px 10px;
}

.messageCard .buttonRow .dangerButton {
  margin-left: auto;
  min-height: 30px;
  padding: 4px 10px;
}

.messageCard .badge {
  align-self: center;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 4px;
  text-align: center;
}

/* ---------- Toast notice ---------- */
.notice {
  background: var(--ink);
  border-radius: var(--radius-sm);
  bottom: 22px;
  box-shadow: var(--shadow-lg);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 60;
}

.notice.error {
  background: var(--danger);
}

/* ---------- Drawer ---------- */
.drawerOverlay {
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
  inset: 0;
  position: fixed;
  z-index: 50;
}

.sideDrawer {
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  height: 100vh;
  max-width: 460px;
  overflow-y: auto;
  padding: 26px;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  width: min(460px, 92vw);
  z-index: 55;
}

.sideDrawer.open {
  transform: translateX(0);
}

.drawerHeader {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}

.drawerHeader h3 {
  font-size: 17px;
  font-weight: 700;
}

.drawerHeader p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.drawerActions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.filterDrawerForm {
  gap: 18px;
}

.filterDrawerForm select,
.filterDrawerForm input {
  min-height: 54px;
}

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

.filterHint {
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  color: var(--muted);
  display: flex;
  gap: 10px;
  padding: 12px;
}

.filterHint span {
  color: var(--accent-ink);
  display: inline-flex;
  margin-top: 2px;
}

.filterHint p {
  font-size: 12.5px;
  line-height: 1.45;
}

.drawerStats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.drawerStats div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.drawerStats strong {
  color: var(--ink);
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

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

.drawerSection {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 18px 0 0;
}

.drawerSection + .drawerSection {
  margin-top: 18px;
}

.drawerSection .panelHeader {
  margin-bottom: 0;
}

.closeDrawer {
  font-size: 16px;
  line-height: 1;
  min-height: 34px;
  min-width: 34px;
  padding: 0;
}

.closeDrawer:hover {
  background: var(--surface-2);
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .sequenceEditor {
    grid-template-columns: 1fr;
  }

  .sequenceMessagePane {
    min-height: 420px;
  }

  .sequenceSubject {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sequenceSubjectActions {
    border-left: 0;
    grid-column: 1 / -1;
    padding-left: 0;
  }
}

@media (max-width: 980px) {
  .twoColumn,
  .inlineAssign,
  .sequenceEditor,
  .campaignRatioCard,
  .bounceGrid,
  .stageBreakdown,
  .statGrid {
    grid-template-columns: 1fr;
  }

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

  .ratioBar {
    padding: 18px;
  }

  .ratioLegend {
    justify-content: flex-start;
  }

  .stageChartRow {
    grid-template-columns: minmax(110px, 140px) minmax(120px, 1fr) 32px;
  }
}

@media (max-width: 720px) {
  .appHeader {
    align-items: stretch;
    grid-template-columns: 1fr;
    padding: 14px 18px;
  }

  .pageShell {
    padding: 20px 18px 48px;
  }

  .sectionHeader,
  .detailHeader,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbarLeft,
  .toolbarRight,
  .buttonRow {
    flex-wrap: wrap;
  }

  .toolbarLeft input,
  .toolbarLeft select {
    max-width: none;
  }

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

  .filterButton {
    justify-self: stretch;
  }

  .subTabs,
  .analyticsTabs {
    gap: 6px;
  }

  .subTabs button,
  .analyticsTabs button {
    flex: 1 1 auto;
  }

  .campaignAccountsTable {
    max-height: calc(100vh - 280px);
  }

  .lastContact small {
    max-width: 190px;
  }

  .sequenceSubject,
  .sequenceMessageEditor,
  .sequenceActionBar {
    padding-left: 18px;
    padding-right: 18px;
  }

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

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

  .stageChartRow {
    gap: 8px;
    grid-template-columns: 1fr 32px;
  }

  .stageChartLabel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 520px) {
  .panel {
    padding: 16px;
  }

  .campaignRatioCard,
  .analyticsPanel {
    padding: 14px;
  }

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