:root {
  --bg: #f4f7fa;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --fg: #0f2433;
  --fg-muted: #5a7388;
  --line: rgba(15, 56, 82, 0.12);
  --accent: #0d9f6e;
  --accent-2: #087ea4;
  --accent-hover: #0b865e;
  --danger: #d6455d;
  --success: #0d9f6e;
  --warn: #b7791f;
  --pending: #087ea4;
  --glow: rgba(13, 159, 110, 0.22);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(15, 36, 51, 0.08);
  --shadow-sm: 0 8px 24px rgba(15, 36, 51, 0.06);
  --font: 'Sora', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--fg);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(8, 126, 164, 0.12), transparent 55%),
    radial-gradient(800px 420px at 92% 0%, rgba(13, 159, 110, 0.1), transparent 50%),
    linear-gradient(165deg, #eef4f8 0%, #f4f7fa 48%, #e8f0f5 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Animations */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow); }
  50% { box-shadow: 0 0 20px 2px var(--glow); }
}

@keyframes headline-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-rise { animation: rise-in 0.55s ease both; }
.animate-rise-d1 { animation: rise-in 0.55s 0.08s ease both; }
.animate-rise-d2 { animation: rise-in 0.55s 0.16s ease both; }
.animate-rise-d3 { animation: rise-in 0.55s 0.24s ease both; }

.headline-gradient {
  background-image: linear-gradient(110deg, #087ea4 0%, #0d9f6e 28%, #1a7f5a 52%, #0b6e99 76%, #087ea4 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: headline-shift 5s ease-in-out infinite;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 159, 110, 0.28);
  animation: pulse-glow 2.4s ease-in-out infinite;
}

.brand h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  background: none;
  border: 1px solid transparent;
  color: var(--fg-muted);
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover {
  background: rgba(8, 126, 164, 0.06);
  color: var(--fg);
  border-color: var(--line);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(8, 126, 164, 0.1), rgba(13, 159, 110, 0.12));
  color: var(--accent);
  border-color: rgba(13, 159, 110, 0.25);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item .icon { opacity: 0.75; }
.nav-item.active .icon { opacity: 1; color: var(--accent); }

.sidebar-footer { padding-top: 16px; }

.status-badge {
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  transition: all 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.status-badge.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.2);
  animation: status-pulse 2s ease infinite;
}

.status-badge.online { color: var(--success); border-color: rgba(13, 159, 110, 0.3); }
.status-badge.offline { color: var(--danger); border-color: rgba(214, 69, 93, 0.25); }

.content {
  padding: 28px 32px 48px;
  overflow-y: auto;
  max-width: 1280px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
  animation: rise-in 0.45s ease both;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-header p {
  color: var(--fg-muted);
  font-size: 14px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 96px;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  opacity: 0.6;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(8, 126, 164, 0.08);
  color: var(--accent-2);
}

.stat-card.pending .stat-icon { background: rgba(8, 126, 164, 0.1); color: var(--pending); }
.stat-card.success .stat-icon { background: rgba(13, 159, 110, 0.1); color: var(--success); }
.stat-card.failed .stat-icon { background: rgba(214, 69, 93, 0.1); color: var(--danger); }

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  transition: transform 0.3s ease;
}

.stat-value.pending { color: var(--pending); }
.stat-value.success { color: var(--success); }
.stat-value.failed { color: var(--danger); }

/* Cards */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3 { margin: 0; }

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.col-select {
  width: 44px;
  text-align: center;
  padding-left: 12px !important;
  padding-right: 8px !important;
}

.col-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

th, td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(244, 247, 250, 0.8);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover td {
  background: rgba(8, 126, 164, 0.04);
}

td.empty {
  text-align: center;
  color: var(--fg-muted);
  padding: 40px;
}

td code {
  background: rgba(8, 126, 164, 0.08);
  color: var(--accent-2);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.pending { background: rgba(8, 126, 164, 0.12); color: var(--pending); }
.badge.running {
  background: rgba(183, 121, 31, 0.12);
  color: var(--warn);
  animation: status-pulse 1.5s infinite;
}
.badge.success { background: rgba(13, 159, 110, 0.12); color: var(--success); }
.badge.failed { background: rgba(214, 69, 93, 0.12); color: var(--danger); }

.running-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(183, 121, 31, 0.1);
  border: 1px solid rgba(183, 121, 31, 0.2);
  animation: status-pulse 1.5s infinite;
}

.running-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

/* Forms */
.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;
}

.form-group { margin-bottom: 16px; }

.form-group-compact { margin-bottom: 14px; }

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.form-label-row label {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  text-transform: none;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .form-row-2 { grid-template-columns: 1fr; }
}

.form-group-inline {
  max-width: 140px;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-suffix input {
  width: 72px;
  flex-shrink: 0;
}

.input-suffix {
  font-size: 13px;
  color: var(--fg-muted);
}

.task-form .btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}

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

.dot-sep {
  color: var(--fg-muted);
  font-size: 12px;
}

.multi-actions.inline {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.15);
}

.form-group small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.form-group textarea {
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.hint {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.hint-sm {
  font-size: 12px;
  margin: 6px 0 0;
}

.admin-card {
  margin-top: 20px;
}

.admin-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.admin-list-wrap {
  overflow-x: auto;
}

.admin-actions {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .admin-create-form {
    grid-template-columns: 1fr;
  }
}

.options-block {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(13, 159, 110, 0.03);
}

.option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

.option-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-chip span {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  transition: all 0.15s ease;
}

.option-chip input:checked + span {
  border-color: var(--accent);
  background: rgba(13, 159, 110, 0.12);
  color: var(--accent-dark, #087ea4);
  font-weight: 600;
}

.option-chip-warn input:checked + span {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.1);
  color: #b45309;
}

.option-chip:hover span {
  border-color: var(--accent);
}

.scope-card {
  margin-bottom: 20px;
}

.scope-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.scope-option {
  display: block;
  cursor: pointer;
}

.scope-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scope-option-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}

.scope-option-body strong {
  display: block;
  font-size: 14px;
  color: var(--fg);
}

.scope-tip {
  flex-shrink: 0;
}

.scope-option.active .scope-option-body,
.scope-option:has(input:checked) .scope-option-body {
  border-color: var(--accent);
  background: rgba(13, 159, 110, 0.08);
}

.profile-multi-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: var(--surface);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px;
}

.profile-multi-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-weight: 400;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.profile-multi-list label:hover {
  background: rgba(13, 159, 110, 0.06);
}

.profile-multi-list label:has(input:checked) {
  background: rgba(13, 159, 110, 0.1);
  border-color: rgba(13, 159, 110, 0.25);
}

.profile-multi-list label code {
  font-size: 10px;
  opacity: 0.65;
  margin-left: auto;
}

.profile-multi-list label .profile-name {
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-multi-list .empty-hint {
  margin: 0;
  padding: 12px;
  grid-column: 1 / -1;
}

.profile-jobs-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.profile-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.profile-job-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
}

.profile-job-row .job-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.profile-job-row input {
  min-width: 0;
}

.batch-job-row input[type="text"],
.profile-job-row input {
  font-size: 12px;
}

.batch-defaults {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.batch-defaults input,
.batch-job-row input[type="text"],
.profile-job-row input {
  background: rgba(238, 244, 248, 0.9);
  border: 1px solid rgba(15, 56, 82, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--fg);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.batch-defaults input:focus,
.batch-job-row input[type="text"]:focus,
.profile-job-row input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(13, 159, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.1);
}

.batch-defaults input::placeholder,
.batch-job-row input[type="text"]::placeholder,
.profile-job-row input::placeholder {
  color: rgba(90, 115, 136, 0.6);
}

.batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.batch-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-muted);
}

.batch-jobs-header,
.batch-job-row {
  display: grid;
  grid-template-columns: 28px minmax(90px, 120px) minmax(72px, 96px) 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.batch-jobs-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
  padding: 0 8px 6px;
  border-bottom: 1px solid var(--border);
}

.batch-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 4px 0;
}

.batch-job-row {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 56, 82, 0.08);
}

.batch-job-row .job-profile-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-job-row .job-profile-id {
  font-size: 11px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-job-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .batch-defaults {
    grid-template-columns: 1fr;
  }

  .batch-jobs-header {
    display: none;
  }

  .batch-job-row {
    grid-template-columns: 28px 1fr;
    grid-template-areas:
      "cb name"
      "cb id"
      "kw kw"
      "target target";
  }

  .batch-job-row .batch-kw { grid-column: 1 / -1; }
  .batch-job-row .batch-target { grid-column: 1 / -1; }

  .profile-job-row {
    grid-template-columns: 1fr;
  }
}

#multiConcurrencyGroup select {
  width: 100%;
}

.info-box-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.info-box-compact .icon {
  flex-shrink: 0;
  color: var(--accent);
}

.info-box {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 126, 164, 0.08);
  border: 1px solid rgba(8, 126, 164, 0.2);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
}

.module-card {
  margin-bottom: 16px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.card-title-row h3 { margin: 0; }

.card-badge {
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.module-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .module-tabs { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .module-tabs { grid-template-columns: 1fr; }
}

.module-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  min-height: 64px;
}

.module-tab-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-icon-organic { background: rgba(13, 159, 110, 0.12); color: var(--accent); }
.module-icon-stealth { background: rgba(8, 126, 164, 0.12); color: #087ea4; }
.module-icon-deep { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.module-icon-fast { background: rgba(245, 158, 11, 0.12); color: #d97706; }

.module-tab-body {
  flex: 1;
  min-width: 0;
}

.module-tab-body strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.module-tab-sub {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.3;
  margin-top: 2px;
}

.module-tab:hover {
  border-color: var(--accent);
}

.module-tab.active {
  border-color: var(--accent);
  background: rgba(13, 159, 110, 0.06);
  box-shadow: 0 0 0 1px rgba(13, 159, 110, 0.12);
}

/* Tooltips */
.tip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--fg-muted);
  cursor: help;
  transition: color 0.15s, background 0.15s;
}

.tip-trigger.tip-sm {
  width: 18px;
  height: 18px;
}

.tip-trigger .icon-info {
  width: 14px;
  height: 14px;
}

.tip-trigger:hover,
.tip-trigger:focus-visible {
  color: var(--accent);
  background: rgba(13, 159, 110, 0.1);
  outline: none;
}

.tip-trigger::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 50;
  bottom: calc(100% + 8px);
  right: 0;
  width: max-content;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1a2332;
  color: #f0f4f8;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  pointer-events: none;
  white-space: normal;
}

.tip-trigger::before {
  content: '';
  position: absolute;
  z-index: 51;
  bottom: calc(100% + 2px);
  right: 6px;
  border: 6px solid transparent;
  border-top-color: #1a2332;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
}

.tip-trigger:hover::after,
.tip-trigger:hover::before,
.tip-trigger:focus-visible::after,
.tip-trigger:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.module-tab .tip-trigger {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
}

.module-tab .tip-trigger::after {
  right: 0;
  left: auto;
}

@media (max-width: 640px) {
  .tip-trigger::after {
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
  }
  .tip-trigger:hover::after,
  .tip-trigger:focus-visible::after {
    transform: translateX(-50%) translateY(0);
  }
}

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

.btn-stop {
  background: rgba(214, 69, 93, 0.1);
  color: var(--danger);
  border: 1px solid rgba(214, 69, 93, 0.35);
}

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

.icon-sm { width: 14px; height: 14px; }

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

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

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 159, 110, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(13, 159, 110, 0.3);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(13, 159, 110, 0.04);
}

.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 10px; }

.btn-danger {
  background: rgba(214, 69, 93, 0.1);
  color: var(--danger);
  border: 1px solid rgba(214, 69, 93, 0.2);
}

.btn-danger:hover {
  background: rgba(214, 69, 93, 0.16);
}

.btn-icon-only {
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* Test result */
.test-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  animation: rise-in 0.4s ease both;
}

.test-result.ok {
  background: rgba(13, 159, 110, 0.08);
  color: var(--success);
  border: 1px solid rgba(13, 159, 110, 0.25);
}

.test-result.err {
  background: rgba(214, 69, 93, 0.08);
  color: var(--danger);
  border: 1px solid rgba(214, 69, 93, 0.25);
}

.info-card ol {
  padding-left: 20px;
  line-height: 1.9;
  font-size: 14px;
  color: var(--fg-muted);
}

.info-card code {
  background: rgba(8, 126, 164, 0.08);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.warning {
  margin-top: 16px;
  padding: 14px;
  background: rgba(183, 121, 31, 0.08);
  border: 1px solid rgba(183, 121, 31, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--warn);
  line-height: 1.6;
}

.success-tip {
  margin-top: 12px;
  padding: 14px;
  background: rgba(13, 159, 110, 0.08);
  border: 1px solid rgba(13, 159, 110, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--success);
  line-height: 1.6;
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 36, 51, 0.35);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease both;
}

.modal-content {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(640px, 92vw);
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: slide-up 0.35s ease both;
}

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

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
  background: rgba(15, 36, 51, 0.06);
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}

.modal-close:hover {
  background: rgba(214, 69, 93, 0.1);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 70px);
  font-size: 14px;
}

.modal-body pre {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-body .detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-body .detail-row:last-of-type { border-bottom: none; }
.modal-body .detail-row span:first-child { color: var(--fg-muted); font-weight: 500; }

.modal-body a { color: var(--accent-2); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: slide-up 0.35s ease both;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.toast.success { border-color: rgba(13, 159, 110, 0.35); color: var(--success); }
.toast.error { border-color: rgba(214, 69, 93, 0.35); color: var(--danger); }

.toast.success { border-color: rgba(13, 159, 110, 0.35); color: var(--success); }
.toast.error { border-color: rgba(214, 69, 93, 0.35); color: var(--danger); }

.hidden { display: none !important; }

/* ── Live monitor (pipeline + workflow) ── */
.live-monitor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.live-monitor.is-idle .pipe-step.active .pipe-dot {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: none;
}

.live-monitor.is-idle .pipe-step.active .pipe-num {
  color: var(--fg-muted);
}

.idle-msg {
  color: var(--fg-muted);
  font-size: 12px;
}

.pipeline-card,
.workflow-card {
  overflow: hidden;
}

.pipeline-card {
  min-height: 286px;
  display: flex;
  flex-direction: column;
}

.workflow-card {
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.pipeline-header,
.workflow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pipeline-header h3,
.workflow-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 16px;
}

.hint-tight {
  margin: 0;
  font-size: 12px;
}

.pipeline-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.progress-label {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 100px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #34d399);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.progress-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

.pipeline-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 8px 0 4px;
  min-height: 108px;
  align-items: start;
}

@media (max-width: 768px) {
  .pipeline-stepper {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    min-height: 108px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .pipeline-stepper::-webkit-scrollbar { height: 4px; }
  .pipeline-stepper::-webkit-scrollbar-thumb {
    background: rgba(13, 159, 110, 0.25);
    border-radius: 999px;
  }

  .pipe-step {
    flex: 0 0 92px;
    scroll-snap-align: start;
  }

  .pipe-line { display: none; }

  .pipe-sub {
    min-height: 32px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

.pipe-step {
  text-align: center;
  position: relative;
}

.pipe-step-track {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  position: relative;
}

.pipe-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: all 0.35s ease;
}

.pipe-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
}

.pipe-line {
  position: absolute;
  top: 50%;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  transition: background 0.35s ease;
}

.pipe-line-left { left: 0; right: 50%; margin-right: 18px; }
.pipe-line-right { left: 50%; right: 0; margin-left: 18px; }

.pipe-step strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.pipe-sub {
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  line-height: 1.35;
  min-height: 28px;
}

.pipe-step.active .pipe-dot {
  border-color: var(--accent);
  background: rgba(13, 159, 110, 0.12);
  box-shadow: 0 0 0 4px rgba(13, 159, 110, 0.15), 0 0 20px rgba(13, 159, 110, 0.2);
  animation: dot-pulse 1.6s ease-in-out infinite;
}

.pipe-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

.pipe-step.active .pipe-ring {
  border-color: rgba(13, 159, 110, 0.45);
  animation: ring-pulse 1.6s ease-out infinite;
}

.pipe-step.step-flash .pipe-dot {
  animation: step-flash 0.7s ease, dot-pulse 1.6s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(13, 159, 110, 0.12), 0 0 16px rgba(13, 159, 110, 0.15); }
  50% { box-shadow: 0 0 0 8px rgba(13, 159, 110, 0.22), 0 0 28px rgba(13, 159, 110, 0.35); }
}

@keyframes ring-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes step-flash {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); border-color: #34d399; }
  100% { transform: scale(1); }
}

.progress-fill.is-animating {
  background: linear-gradient(90deg, var(--accent), #34d399, var(--accent));
  background-size: 200% 100%;
  animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.pipeline-live-line {
  min-height: 32px;
  margin: 6px 0 0;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--accent);
  background: rgba(13, 159, 110, 0.06);
  border-radius: 8px;
  border: 1px dashed rgba(13, 159, 110, 0.25);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  flex-shrink: 0;
}

.pipeline-live-line:empty::before {
  content: 'Chờ log realtime…';
  color: var(--fg-muted);
  opacity: 0.55;
}

.live-monitor.is-live .pipeline-live-line:empty::before {
  content: 'Đang chờ log…';
}

.pipeline-live-line:not(:empty)::before {
  content: none;
}

.pipeline-live-line.line-flash {
  animation: line-flash 0.5s ease;
}

@keyframes line-flash {
  0% { background: rgba(13, 159, 110, 0.2); }
  100% { background: rgba(13, 159, 110, 0.06); }
}

.pipe-step.active .pipe-num { color: var(--accent); }

.pipe-step.done .pipe-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.pipe-step.done .pipe-num { color: #fff; }

.pipe-step.done .pipe-line { background: var(--accent); }

.pipe-step.error .pipe-dot {
  border-color: var(--danger);
  background: rgba(214, 69, 93, 0.12);
  box-shadow: 0 0 0 4px rgba(214, 69, 93, 0.12);
}

.pipe-step.error .pipe-num { color: var(--danger); }

.pipeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-muted);
  min-height: 44px;
  align-items: center;
}

.pipeline-meta strong { color: var(--fg); font-weight: 600; }

.live-pulse {
  color: var(--accent);
  font-weight: 600;
  animation: live-pulse 1.5s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.workflow-badge {
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}

.workflow-canvas {
  position: relative;
  min-height: 160px;
  height: 160px;
  padding: 20px 12px;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(13, 159, 110, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  flex: 1;
}

.workflow-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: var(--border);
}

.wf-edge { stroke: var(--border); transition: stroke 0.35s; }
.wf-edge-active { stroke: var(--accent); color: var(--accent); }

.wf-edge-flow {
  stroke: var(--accent);
  color: var(--accent);
  stroke-dasharray: 8 6;
  animation: edge-flow 1s linear infinite;
}

@keyframes edge-flow {
  to { stroke-dashoffset: -14; }
}

.workflow-badge.badge-live {
  color: var(--accent);
  border-color: rgba(13, 159, 110, 0.35);
  background: rgba(13, 159, 110, 0.08);
  animation: badge-blink 1.4s ease-in-out infinite;
}

@keyframes badge-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.workflow-nodes {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 768px) {
  .workflow-nodes {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .wf-node {
    flex: 0 0 130px;
    scroll-snap-align: start;
    min-width: 130px;
  }

  .workflow-canvas {
    min-height: 150px;
    height: 150px;
  }

  .workflow-edges { display: none; }
}

@media (max-width: 640px) {
  .pipeline-card { min-height: 300px; }
  .workflow-card { min-height: 210px; }

  .pipeline-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pipeline-progress-wrap {
    width: 100%;
    min-width: 0;
  }

  .pipeline-header h3,
  .workflow-header h3 {
    font-size: 14px;
  }

  .hint-tight { font-size: 11px; }
}

.wf-node {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.wf-node-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--fg-muted);
  transition: all 0.3s;
}

.wf-node-text {
  min-width: 0;
}

.wf-node-text strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-node-text small {
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-node.pending { opacity: 0.55; }

.wf-node.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(13, 159, 110, 0.2), 0 4px 20px rgba(13, 159, 110, 0.15);
  transform: translateY(-2px);
  animation: node-glow 1.8s ease-in-out infinite;
}

@keyframes node-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(13, 159, 110, 0.2), 0 4px 16px rgba(13, 159, 110, 0.12); }
  50% { box-shadow: 0 0 0 2px rgba(13, 159, 110, 0.35), 0 6px 24px rgba(13, 159, 110, 0.28); }
}

.wf-node.active .wf-node-icon {
  background: rgba(13, 159, 110, 0.12);
  color: var(--accent);
}

.wf-node.done {
  border-color: rgba(13, 159, 110, 0.35);
}

.wf-node.done .wf-node-icon {
  background: var(--accent);
  color: #fff;
}

.wf-node.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(214, 69, 93, 0.2);
}

.wf-node.error .wf-node-icon {
  background: rgba(214, 69, 93, 0.12);
  color: var(--danger);
}

.loading-spin {
  animation: spin 0.8s linear infinite;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 120;
    height: auto;
    min-height: unset;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 20px rgba(15, 36, 51, 0.06);
  }

  .brand {
    width: 100%;
    margin-bottom: 10px;
    padding: 0 4px 12px;
    flex-shrink: 0;
  }

  nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    gap: 8px;
    flex: unset;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 12px;
    font-size: 13px;
  }

  .sidebar-footer {
    width: 100%;
    padding-top: 10px;
    flex-shrink: 0;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px 12px 28px; }
}

.stats-grid-compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.stats-grid-compact .stat-card {
  padding: 12px 14px;
}

.stat-value-sm {
  font-size: 1.1rem;
  line-height: 1.3;
}

.stat-sub {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.campaign-stats-grid {
  margin-bottom: 20px;
}

.campaign-stats-grid .stat-card {
  min-height: 88px;
}

.campaign-form-card {
  margin-bottom: 0;
}

.campaign-form-card .card-header {
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: none;
}

.campaign-form-header {
  align-items: flex-start;
  gap: 16px;
}

.campaign-form-header h3 {
  margin-bottom: 4px;
}

.campaign-form-sub {
  margin: 0;
}

.campaign-form .campaign-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.campaign-form .campaign-section {
  border: none;
  padding: 0;
  margin: 0 0 20px;
  min-width: 0;
}

.campaign-schedule-row {
  gap: 16px;
}

.campaign-form .field-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.campaign-form .input-with-suffix--compact {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.campaign-form .input-with-suffix--compact input[type="number"] {
  width: 88px;
  min-width: 88px;
  flex: 0 0 88px;
}

.campaign-form .input-with-suffix--compact .input-suffix {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.35;
  font-size: 13px;
  color: var(--fg-muted);
}

.campaign-variants-section {
  margin-bottom: 24px;
}

.campaign-variants-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.campaign-variants-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--fg);
  line-height: 1.45;
}

.campaign-variants-label-note {
  font-weight: 500;
  color: var(--fg-muted);
}

.campaign-variants-block textarea {
  display: block;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  min-height: 132px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.campaign-variants-block textarea::placeholder {
  color: #8aa3b5;
  opacity: 1;
}

.campaign-variants-block textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.15);
}

.campaign-variants-hint {
  margin-top: 8px;
}

.campaign-form-actions {
  padding-top: 4px;
  border-top: none;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .campaign-form .input-with-suffix--compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .campaign-form .input-with-suffix--compact .input-suffix {
    white-space: normal;
  }
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
}

.toggle-switch:hover {
  border-color: rgba(13, 159, 110, 0.35);
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(15, 36, 51, 0.18);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle-switch input:checked ~ .toggle-label {
  color: var(--accent-dark, #087ea4);
}

.toggle-switch:has(input:checked) {
  border-color: rgba(13, 159, 110, 0.45);
  background: rgba(13, 159, 110, 0.06);
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .campaign-form-header {
    flex-direction: column;
    align-items: stretch;
  }

  .toggle-switch {
    justify-content: space-between;
    width: 100%;
  }

  .campaign-form .input-with-suffix--compact {
    flex-wrap: wrap;
  }
}


.tool-sessions-recent {
  margin-top: 12px;
  overflow-x: auto;
}

.data-table.compact {
  font-size: 12px;
}

.data-table.compact th,
.data-table.compact td {
  padding: 6px 8px;
}

.info-box-warn {
  background: #fff7ed;
  border-left-color: #f97316;
  margin-top: 10px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

  .live-monitor { gap: 12px; margin-bottom: 16px; }
}
