:root {
  --red: #ed1c24;
  --red-dark: #c4161c;
  --black: #000000;
  --ink: #111111;
  --muted: #8c8e90;
  --line: #d8d8d8;
  --paper: #f2f3f4;
  --card: #ffffff;
  --ok: #1f7a45;
  --wait: #9a6b12;
  --font: "Century Gothic", CenturyGothic, AppleGothic, "Didact Gothic", Futura, "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  letter-spacing: 0.01em;
}
a { color: var(--red); }
a:hover { color: var(--red-dark); }
.wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 2.5vw, 2.5rem) 4rem;
}
.wrap-wide { max-width: none; }

.top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--black);
  color: #fff;
  padding: 0.85rem clamp(1rem, 2.5vw, 2.5rem);
}
.top a, .top .who { color: #fff; text-decoration: none; }
.top nav a:hover { color: var(--red); }
.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.brand img { height: 22px; width: auto; display: block; }
.brand-product {
  border-left: 1px solid #444;
  padding-left: 0.85rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
}
.top nav { display: flex; gap: 1.1rem; flex: 1; font-size: 0.92rem; }
.who { display: flex; gap: 1rem; align-items: center; font-size: 0.85rem; color: #d9d9d9; }
.linkish, .top button {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}
.top button:hover { color: var(--red); }

h1, h2, h3 { font-weight: 700; color: var(--black); letter-spacing: 0.02em; }
h1 { margin: 0 0 0.35rem; font-size: 1.55rem; }
h2 { font-size: 0.98rem; margin: 0 0 0.75rem; }
h3 { font-size: 0.88rem; margin: 0 0 0.3rem; }
.lede, .hint, .help, .kicker, .empty { color: var(--muted); }
.lede { max-width: 54rem; font-size: 0.88rem; margin: 0; }
.help { font-size: 0.85rem; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  margin: 0 0 0.35rem;
  color: var(--red);
  font-weight: 700;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: flex-end;
}
.row-actions form {
  display: inline-flex;
  margin: 0;
}
.grid td.row-actions-cell {
  text-align: right;
  white-space: nowrap;
  width: 1%;
  vertical-align: middle;
}
.table-action {
  appearance: none;
  -webkit-appearance: none;
  display: inline;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--red);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.table-action:hover { color: var(--red-dark); text-decoration: underline; }
.icon-action {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0.15rem;
  margin: 0;
  color: var(--red);
  cursor: pointer;
  line-height: 0;
  border-radius: 2px;
}
.icon-action svg { width: 1.05rem; height: 1.05rem; display: block; }
.icon-action:hover { color: var(--red-dark); }
.grid th.col-icon {
  width: 2rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}
.grid th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.grid th.sortable::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: middle;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  opacity: 0.35;
  border-top: 4px solid currentColor;
}
.grid th.sortable:hover { color: var(--ink); }
.grid th.sortable.sort-asc::after {
  opacity: 1;
  border-top: 0;
  border-bottom: 4px solid currentColor;
}
.grid th.sortable.sort-desc::after {
  opacity: 1;
}
.pdf-link {
  display: inline-flex;
  align-items: center;
  color: var(--red);
  line-height: 0;
}
.pdf-link svg { width: 1.1rem; height: 1.1rem; display: block; }
.pdf-link:hover { color: var(--red-dark); }

.btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: 0;
  padding: 0.6rem 1rem;
  border-radius: 2px;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.btn:hover { background: var(--red-dark); color: #fff; }
.btn.secondary {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--black);
}
.btn.secondary:hover { border-color: var(--red); color: var(--red); background: transparent; }

.input, select.input, textarea.input {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}
.input-date {
  max-width: 14rem;
  min-height: 2.5rem;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}
label { display: block; font-size: 0.82rem; color: var(--black); font-weight: 700; margin: 0.7rem 0; letter-spacing: 0.03em; }
label .input, label select, label textarea { margin-top: 0.3rem; font-weight: 400; color: var(--ink); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem 1.3rem;
  margin: 0 0 1rem;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.full { grid-column: 1 / -1; }

.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.88rem; }
.grid th, .grid td { border-bottom: 1px solid var(--line); text-align: left; padding: 0.45rem 0.35rem; vertical-align: middle; }
.grid th { font-size: 0.7rem; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.brief-list-grid td { font-size: 0.84rem; }
.table-link {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
}
.table-link:hover { text-decoration: underline; }
.table-link.muted { font-weight: 500; color: var(--muted); }
.journey .input { margin: 0; }
.field { margin: 0.7rem 0; }
.checks { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem 0.8rem; }
.checks li { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.checks input { width: auto; margin: 0; }
@media (max-width: 860px) {
  .checks { grid-template-columns: 1fr 1fr; }
}

.pill {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  background: #ebebeb;
  color: var(--ink);
}
.pill.complete { background: #e8f1fb; color: #1a4f8b; }
.pill.submitted { background: #f8eed4; color: var(--wait); }
.pill.approved { background: #e4f3ea; color: var(--ok); }
.pill.draft { background: #ebebeb; color: var(--ink); }
.pill.archived { background: #f0eef0; color: #6a6570; }
.pill.empty { background: transparent; color: var(--muted); }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 0.5rem;
}
.campaign-grid {
  width: 100%;
  table-layout: fixed;
  font-size: 0.82rem;
}
.campaign-grid col.col-job { width: 7%; }
.campaign-grid col.col-name { width: auto; }
.campaign-grid col.col-stage { width: 6.5%; }
.campaign-grid col.col-updated { width: 8%; }
.campaign-grid col.col-action { width: 2.75rem; }
.campaign-grid th,
.campaign-grid td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-grid th.stage-col,
.campaign-grid th.col-updated,
.campaign-grid th.col-icon {
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  vertical-align: bottom;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}
.campaign-grid .job-cell {
  font-weight: 700;
  white-space: nowrap;
}
.campaign-grid .name-cell {
  white-space: nowrap;
}
.campaign-grid .name-cell a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-grid .stage-cell,
.campaign-grid .updated-cell,
.campaign-grid .row-actions-cell {
  text-align: center;
  white-space: nowrap;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}
.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 50%;
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.status-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}
.status-icon:hover { transform: scale(1.08); }
.status-icon.status-draft { color: #5c5c5c; }
.status-icon.status-draft:hover { background: #ebebeb; }
.status-icon.status-complete { color: #1a4f8b; }
.status-icon.status-complete:hover { background: #e8f1fb; }
.status-icon.status-submitted { color: var(--wait); }
.status-icon.status-submitted:hover { background: #f8eed4; }
.status-icon.status-approved { color: var(--ok); }
.status-icon.status-approved:hover { background: #e4f3ea; }
.status-icon.status-empty { color: #b0b0b0; }
.status-icon.status-empty:hover { color: var(--red); background: #fde8e9; }
.status-icon.is-static { cursor: default; }
.status-icon.is-static:hover { transform: none; background: none; color: #b0b0b0; }
.pill-link {
  text-decoration: none;
  display: inline-block;
}
.pill-link:hover .pill {
  filter: brightness(0.97);
  outline: 1px solid rgba(0,0,0,0.08);
}
.stage-add {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
.campaign-form .field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1rem;
}
.campaign-form .field.full { grid-column: 1 / -1; }
.campaign-grid .job-cell a,
.campaign-grid .name-cell a {
  color: inherit;
  text-decoration: none;
}
.campaign-grid .job-cell a:hover,
.campaign-grid .name-cell a:hover {
  color: var(--red);
  text-decoration: underline;
}

.internal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.15rem;
}
.internal-link {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
}
.internal-link:hover { text-decoration: underline; }
.internal-link.muted { font-weight: 500; color: var(--muted); }
.internal-sep { color: var(--muted); margin: 0 0.1rem; }
.internal-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #fafafa;
  border: 1px solid var(--line);
  font-size: 0.84rem;
}
.internal-jump-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.intake-brief {
  margin: 0 0 1.5rem;
}
.intake-head {
  margin-bottom: 0.75rem;
}
.intake-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}
.actions form { margin: 0; }
.client-group { margin: 1.25rem 0 1.5rem; }
.client-group h2 {
  margin-bottom: 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--red);
  font-size: 0.95rem;
}

.flash { list-style: none; padding: 0; }
.flash li { background: #e4f3ea; padding: 0.6rem 0.8rem; margin: 0 0 0.8rem; }
.note { background: #fde8e9; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.meta { display: grid; gap: 0.5rem; margin: 1rem 0; }
.meta dt { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.meta dd { margin: 0; }
.inline-actions, .form-actions, .stack, .filters { margin: 1rem 0; }
.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 0.8rem 0;
  align-items: center;
}

.login-page {
  background: var(--black);
  min-height: 100vh;
}
.login-page .wrap { max-width: none; padding: 0; }
.login-card {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  padding: 2.1rem 2rem 2rem;
}
.login-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}
.login-logo { height: 36px; width: auto; }
.errorlist { color: var(--red); padding-left: 1rem; }

.wizard {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}
.wizard-nav { min-width: 0; }
.stepper {
  position: sticky;
  top: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.9rem 0.7rem;
}
.stepper-count {
  margin: 0 0.6rem 0.8rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.step-list { list-style: none; margin: 0; padding: 0; }
.step-link {
  display: flex;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0.45rem 0.5rem;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
}
.step-link.static { cursor: default; }
.step-link.disabled { opacity: 0.45; cursor: not-allowed; }
.step-list li.current .step-link { background: #fde8e9; }
.step-list li.done .marker { background: var(--red); color: #fff; }
.marker {
  flex: 0 0 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #ebebeb;
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-family: var(--font);
  font-weight: 700;
}
.step-copy { min-width: 0; }
.step-copy strong { display: block; font-size: 0.86rem; }
.step-copy em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 1rem;
}
.review-grid dt { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.review-grid dd { margin: 0.15rem 0 0; }
.review-field { margin: 0.8rem 0; }
.review-field p { margin: 0; white-space: pre-wrap; }
.review-missing { color: var(--muted); font-style: italic; }
.review-incomplete { border-style: dashed; }
.review-submit { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.type-card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.type-card:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}
.type-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
.type-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid var(--red);
  vertical-align: middle;
}
.type-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.ai-panel { border-left: 3px solid var(--red); }
.ai-panel .actions { margin: 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ai-warn { color: var(--wait); font-weight: 700; }
.ai-ok { color: var(--ok); font-weight: 700; }
.ai-subhead {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.ai-report {
  background: #fafafa;
  border: 1px solid var(--line);
  padding: 1rem 1.15rem;
  font-size: 0.95rem;
  line-height: 1.5;
  max-height: 36rem;
  overflow: auto;
  margin: 0.75rem 0 0.35rem;
}
.ai-report > *:first-child { margin-top: 0; }
.ai-report > *:last-child { margin-bottom: 0; }
.ai-report h1,
.ai-report h2,
.ai-report h3,
.ai-report h4 {
  margin: 1.1rem 0 0.4rem;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ink);
}
.ai-report h1 { font-size: 1.15rem; }
.ai-report h2 { font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.ai-report p { margin: 0.45rem 0; }
.ai-report ul,
.ai-report ol { margin: 0.4rem 0 0.6rem 1.2rem; padding: 0; }
.ai-report li { margin: 0.2rem 0; }
.ai-report strong { font-weight: 700; }
.ai-report hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.9rem 0;
}
.ai-report table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0 0.9rem;
  font-size: 0.88rem;
}
.ai-report th,
.ai-report td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.ai-report th { background: #f0f0f0; }
.ai-report blockquote {
  margin: 0.6rem 0;
  padding: 0.35rem 0.75rem;
  border-left: 3px solid var(--red);
  color: var(--muted);
}

@media (max-width: 860px) {
  .wizard { display: block; }
  .stepper {
    position: static;
    margin-bottom: 1rem;
    overflow-x: auto;
  }
  .step-list { display: flex; gap: 0.3rem; }
  .step-copy em { display: none; }
  .step-link { min-width: 9rem; }
  .two, .page-head, .top, .review-grid { display: block; }
  .top {
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }
  .top nav, .who { margin-top: 0.15rem; }
  .brand-product { border-left: 0; padding-left: 0; }
  .wrap { padding: 1.1rem 0.9rem 3rem; }
  .campaign-grid {
    min-width: 720px; /* keep columns usable; scroll on narrow phones */
  }
  .page-head .actions {
    margin-top: 0.75rem;
  }
}

@media (min-width: 1400px) {
  .wrap {
    padding-left: clamp(1.5rem, 4vw, 3.5rem);
    padding-right: clamp(1.5rem, 4vw, 3.5rem);
  }
  .top {
    padding-left: clamp(1.5rem, 4vw, 3.5rem);
    padding-right: clamp(1.5rem, 4vw, 3.5rem);
  }
}
