:root {
  color-scheme: light;
  --ink: #202833;
  --muted: #727c88;
  --line: #e8ebef;
  --paper: #ffffff;
  --canvas: #f6f7f8;
  --accent: #236c56;
  --accent-dark: #185440;
  --soft-green: #eaf4ef;
  --blue: #315d85;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

.shell {
  width: min(760px, calc(100% - 36px));
  margin: 0 auto;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.brand-mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-size: 14px;
}

.topbar-note {
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid #d8dde2;
  color: var(--muted);
  font-weight: 450;
}

.intro {
  padding: 46px 0 30px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1.15;
}

.intro-copy {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.freelancer-panel {
  margin: 0 0 30px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

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

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

.campaign-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.campaign-option:has(input:checked) {
  border-color: #a9cbb8;
  background: #f5faf7;
}

.campaign-option input {
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.campaign-option > span {
  display: grid;
  gap: 3px;
}

.campaign-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.campaign-keywords {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.budget-row {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.budget-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.budget-row input,
.budget-row select {
  width: 120px;
  height: 36px;
  border: 1px solid #dfe3e7;
  border-radius: 7px;
  padding: 0 9px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 12px;
}

.budget-row select {
  width: 82px;
}

.budget-row .run-button {
  min-height: 36px;
  margin-left: auto;
}

.filter-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.freelancer-panel > .run-status:empty {
  display: none;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.live-label span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55a77e;
  box-shadow: 0 0 0 3px #e1f1e8;
}

.script-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.script-card {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.script-card:last-child {
  border-bottom: 0;
}

.script-info {
  flex: 1;
  min-width: 0;
}

.script-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.script-description {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.run-button,
.download-button {
  min-width: 82px;
  border: 1px solid #d7e5dd;
  border-radius: 7px;
  padding: 8px 13px;
  color: var(--accent-dark);
  background: #f5faf7;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.run-button:hover:not(:disabled),
.download-button:hover {
  border-color: #a9cbb8;
  background: var(--soft-green);
}

.run-button.stop-button {
  color: #8b3b31;
  border-color: #efd4cf;
  background: #fff7f5;
}

.run-button.stop-button:hover:not(:disabled) {
  border-color: #dfaaa1;
  background: #fff0ed;
}

.run-button:disabled {
  color: #87918b;
  background: #f3f4f4;
  border-color: #e7e9e8;
  cursor: not-allowed;
}

.run-status {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.run-status.success {
  color: var(--accent);
}

.run-status.error {
  color: #a33f3f;
}

.recent-section {
  margin-top: 30px;
}

.recent-head {
  margin-bottom: 12px;
}

.recent-list {
  display: grid;
  gap: 9px;
}

.recent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.recent-info {
  flex: 1;
  min-width: 0;
}

.recent-title {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
}

.recent-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.loading {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

footer {
  padding: 23px 0 35px;
  color: #88919a;
  font-size: 11px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid #cfe3d8;
  border-radius: 9px;
  padding: 11px 15px;
  color: #174d39;
  background: white;
  box-shadow: 0 8px 24px #1b30251a;
  font-size: 13px;
  transition: opacity .2s, transform .2s;
}

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 24px, 760px);
  }

  .intro {
    padding-top: 36px;
  }

  .script-card {
    gap: 10px;
    padding: 14px 12px;
  }

  .freelancer-panel {
    padding: 14px 12px;
  }

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

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

  .budget-row input {
    width: min(30vw, 120px);
  }

  .budget-row .run-button {
    margin-left: 0;
  }

  .run-button,
  .download-button {
    min-width: 72px;
    padding: 8px 9px;
  }
}
