:root {
  --orange: #f7931a;
  --orange-dk: #e6851a;
  --ink: #111827;
  --ink2: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100%;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Nav ── */
nav {
  background: var(--ink);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--orange);
  text-transform: uppercase;
}
.nav-tag {
  font-weight: 500;
  color: #9ca3af;
  letter-spacing: 0.5px;
  font-size: 11px;
  margin-left: 6px;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 13px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--orange-dk); }
.btn-primary:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; }
.btn-primary.full { width: 100%; padding: 12px; }

.btn-ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

.btn-ghost-sm {
  background: transparent;
  color: #9ca3af;
  border: 1px solid #4b5563;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.btn-ghost-sm:hover { border-color: #9ca3af; color: #d1d5db; }

/* ── Page layout ── */
.view { min-height: calc(100vh - 52px); }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-head h1 { font-size: 22px; font-weight: 700; }

/* ── Auth ── */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--ink);
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-logo {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.auth-sub {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 22px;
}
.tab-btn {
  flex: 1;
  padding: 7px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.tab-btn.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* ── Form fields ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }

.req { color: var(--orange); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.hint { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.char-count { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }

.input-suffix-wrap { display: flex; align-items: center; gap: 10px; }
.input-suffix-wrap input { flex: 1; }
.input-suffix { font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }

.err-msg { color: var(--red); font-size: 13px; margin-bottom: 12px; }

/* ── Card ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 28px 24px;
}
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 22px; }

/* ── Wizard progress ── */
.wizard-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.wizard-head h1 { font-size: 22px; font-weight: 700; }
.back-link {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  white-space: nowrap;
}
.back-link:hover { color: var(--ink); }

.wizard-progress {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}
.wp-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.wp-step.active { color: var(--orange); }
.wp-step.done { color: var(--green); }
.wp-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.wp-step.active .wp-num { background: var(--orange); color: #fff; }
.wp-step.done .wp-num { background: var(--green); color: #fff; }
.wp-line { flex: 1; height: 1px; background: var(--border); margin: 0 12px; }

.step-panel { margin-bottom: 16px; }

.step-actions { margin-top: 24px; display: flex; justify-content: flex-end; }
.step-actions.two { justify-content: space-between; }

/* ── Ad preview ── */
.preview-wrap { margin: 20px 0 8px; }
.preview-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }

.preview-widget {
  width: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  background: #fff;
}
.pw-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.pw-brand-text { font-size: 9px; font-weight: 800; letter-spacing: 1.5px; color: var(--orange); }
.pw-status { display: flex; align-items: center; gap: 4px; font-size: 9px; color: var(--green); font-weight: 600; }
.pw-dot { width: 5px; height: 5px; background: var(--green); border-radius: 50%; }

.pw-body { display: flex; align-items: flex-start; gap: 10px; padding: 12px; }
.pw-logo {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dk));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.pw-logo img { width: 100%; height: 100%; object-fit: cover; }
.pw-text { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pw-headline { font-size: 12px; font-weight: 500; color: var(--ink); line-height: 1.4; }
.pw-cta {
  background: var(--orange); color: #fff;
  border: none; border-radius: 5px;
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  cursor: default; font-family: inherit; align-self: flex-start;
}

/* ── Summary box ── */
.summary-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0 0;
}
.summary-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 10px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border: none; }
.summary-row span:first-child { color: var(--muted); }
.summary-row span:last-child { font-weight: 600; text-align: right; max-width: 60%; word-break: break-all; }

/* ── Dashboard / campaigns table ── */
.loading { padding: 40px; text-align: center; color: var(--muted); }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 14px; }

.campaigns-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13px;
}
.campaigns-table thead { background: var(--bg); }
.campaigns-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.campaigns-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.campaigns-table tr:last-child td { border-bottom: none; }
.campaigns-table tr:hover td { background: #fafafa; }

.camp-name { font-weight: 600; color: var(--ink); }
.camp-headline { color: var(--muted); font-size: 12px; margin-top: 2px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.budget-bar-wrap { min-width: 100px; }
.budget-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.budget-fill { height: 100%; background: var(--orange); border-radius: 2px; transition: width .3s; }
.budget-text { font-size: 11px; color: var(--muted); }

.toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.toggle-btn.live { background: #dcfce7; color: #15803d; }
.toggle-btn.paused { background: #f3f4f6; color: var(--muted); }
.toggle-btn:hover { opacity: 0.8; }

@media (max-width: 600px) {
  .page { padding: 20px 16px 40px; }
  .campaigns-table th:nth-child(3),
  .campaigns-table td:nth-child(3),
  .campaigns-table th:nth-child(4),
  .campaigns-table td:nth-child(4) { display: none; }
  .card { padding: 20px 16px; }
  .preview-widget { width: 100%; }
}

/* ── Edit modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 520px;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--muted); padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}
