:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #173652;
  background: #f2f5fa;
  --blue: #005091;
  --light-blue: #819ac6;
  --yellow: #ffd54d;
  --light-yellow: #ffe69e;
  --muted: #4d6076;
  --line: #d7e0ee;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
select, input { font: inherit; }
button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner, main, footer > div { width: min(1440px, calc(100% - 64px)); margin-inline: auto; }
.top-inner { display: flex; align-items: center; min-height: 76px; }
.app-nav { display: flex; gap: 6px; margin-left: auto; }
.app-nav { align-items: center; flex-wrap: wrap; }
.app-nav form { display: block; margin: 0 0 0 8px; }
.auth-main { width: min(480px, calc(100% - 36px)); margin: 30px auto; }
.auth-main h1 { font-size: 24px; color: var(--blue); }
.auth-main summary { cursor: pointer; color: var(--blue); margin: 16px 0; font-size: 14px; }
.users-layout { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 20px; }
.users-layout h2 { margin-top: 0; }
.users-list { list-style: none; padding: 0; margin: 0; }
.users-list li { padding: 16px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.users-list li p { margin: 4px 0 10px; font-size: 13px; }
.users-list form { margin-top: 12px; }
@media (max-width: 650px) { .users-layout { grid-template-columns: minmax(0, 1fr); } }
.app-nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.app-nav a:hover, .app-nav a[aria-current="page"] { background: #eaf0f8; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { flex: none; display: block; width: 62px; height: auto; }
.brand-name {
  color: var(--blue);
  font-size: clamp(19px, 2.7vw, 24px);
  font-weight: 700;
  line-height: 1.15;
}

main { padding: 26px 0 38px; }
.intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 24px 28px;
  margin-bottom: 22px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
}
.intro::before, .intro::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: min(38%, 420px);
  z-index: -1;
}
.intro::before {
  background: var(--light-blue);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.intro::after {
  background: linear-gradient(110deg, var(--light-yellow), var(--yellow));
  clip-path: polygon(100% 24%, 100% 100%, 35% 100%);
}
.intro-copy { max-width: 62%; }
.eyebrow {
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--light-yellow);
  font-weight: 700;
}
h1 { font-size: clamp(34px, 5vw, 49px); letter-spacing: -.04em; line-height: 1.05; margin: 6px 0 9px; }
h2 { color: var(--blue); font-size: 21px; letter-spacing: -.025em; margin: 0 0 4px; }
p { margin: 0; }
.intro p { line-height: 1.4; }
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 4px 14px #102b4508;
  min-width: 0;
  padding: clamp(14px, 1.55vw, 24px);
}
.panel-heading { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 21px; }
.panel-heading p { color: var(--muted); font-size: 13px; }
.step {
  flex: 0 0 33px;
  height: 33px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--light-yellow);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; font-size: 13px; font-weight: 700; }
input, select {
  border: 1px solid #cfd9e2;
  border-radius: 7px;
  color: inherit;
  background: #fff;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 400;
}
input::placeholder { color: #67798a; }
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.checkbox-field input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}
select { background: #f2f5fa; color: var(--blue); font-weight: 700; }
.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; }
.text-button { border: 0; background: none; padding: 5px 0; color: var(--blue); }
.text-button:hover { text-decoration: underline; }
.text-button.muted { color: var(--muted); }
.text-button.danger { color: #872e22; }

.template-controls { display: grid; gap: 10px; }
#template-new { justify-self: start; min-height: 36px; padding: 7px 15px; }
#template-list, .template-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5fa;
}
#template-list {
  max-height: clamp(180px, 36vh, 320px);
  margin: 0;
  overflow-y: auto;
  list-style: none;
  padding: 4px;
}
.template-row {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  text-align: left;
  overflow-wrap: anywhere;
}
.template-row:hover, .template-row[aria-current="true"] { background: #dfe8f4; }
.template-row:focus-visible { outline-offset: -2px; }
.template-facility { color: var(--muted); }
.template-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.template-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.template-actions .button { min-height: 36px; padding: 7px 11px; }
#template-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; gap: 8px; }
.template-status { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.template-status:empty { display: none; }
.template-status[data-error] { color: #872e22; }

.proof {
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: #eaf0f8;
  background-image: radial-gradient(#cbd8eb 1px, transparent 1px);
  background-size: 17px 17px;
  padding: 10px;
}
.proof-top { display: grid; gap: 8px; }
.switch { display: flex; padding: 3px; border: 1px solid #c9d6e9; background: #dfe8f4; border-radius: 9px; }
.switch button { flex: 1; color: var(--blue); background: transparent; border: 0; border-radius: 6px; padding: 7px 3px; }
.switch button[aria-pressed="true"] { color: #fff; background: var(--blue); }
.proof-label { font-size: 12px; color: var(--muted); font-weight: 700; text-align: right; }
.canvas { padding: 14px 0; display: grid; place-items: center; }
.card-frame {
  width: min(100%, 490px);
  aspect-ratio: 91 / 61;
  background: white;
  box-shadow: 0 16px 32px #14345023, 0 2px 5px #102b4520;
  overflow: hidden;
}
.card-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
#original-image { width: min(100%, 490px); box-shadow: 0 8px 24px #14345023; }
.original-download { display: inline-block; margin-top: 12px; color: var(--blue); font-size: 13px; font-weight: 700; }
.proof-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.export { margin-top: 20px; }
.export-copy { display: grid; gap: 3px; }
.export-copy strong { font-size: 14px; }
.export-copy span, .download-status { color: var(--muted); font-size: 13px; }
.export-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.button { border: 1px solid transparent; border-radius: 8px; padding: 10px 15px; min-height: 43px; }
.primary { background: var(--blue); color: #fff; }
.primary:hover { background: #003d70; }
.secondary { background: white; border-color: var(--light-blue); color: var(--blue); }
.secondary:hover { background: var(--light-yellow); }
.error { margin-top: 12px; padding: 9px 12px; border-radius: 7px; background: #fff0ea; color: #872e22; font-size: 13px; }
.download-status:not(:empty) { display: block; margin-top: 9px; }
footer > div { border-top: 1px solid var(--line); padding: 17px 0; color: var(--muted); font-size: 12px; }
footer span { color: var(--blue); padding: 0 4px; }

.ad-studio { grid-template-columns: minmax(0, .85fr) minmax(0, 2fr) minmax(0, 2.15fr); }
.ad-list { list-style: none; padding: 0; margin: 0; }
.ad-list a { text-decoration: none; font-size: 13px; font-weight: 700; }
.ad-source-list { padding-left: 18px; margin: 6px 0 0; font-size: 13px; }
.ad-source-list a { color: var(--blue); }
.ad-ai { padding: 12px; background: #f2f5fa; border: 1px solid var(--line); border-radius: 8px; }
.ad-ai h3 { margin: 0 0 10px; font-size: 15px; color: var(--blue); }
.ad-ai button { justify-self: start; }
.ad-hint, #ad-ai-status:not(:empty), #ad-status:not(:empty) { margin-top: 10px; }
.ad-studio textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cfd9e2;
  border-radius: 7px;
  font: 400 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
  resize: vertical;
}
.ad-proof { display: grid; place-items: center; min-height: 125px; }
.ad-proof img { display: block; width: 100%; aspect-ratio: 136 / 70; object-fit: contain; }
#ad-review { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
#ad-changes { display: grid; gap: 10px; margin-top: 12px; }
.ad-change-group { background: white; border: 1px solid var(--line); border-radius: 7px; }
.ad-change-group h4 { margin: 0; padding: 8px 10px; color: var(--blue); font-size: 13px; overflow-wrap: anywhere; }
.ad-change-group dl { margin: 0; }
.ad-change {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.ad-change dt { grid-column: 1 / -1; font-weight: 700; }
.ad-change dd { margin: 0; padding: 6px; background: #f2f5fa; border-radius: 4px; white-space: pre-line; }
.ad-change dd:last-child { background: #fff4d4; }
.ad-change dd span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }

@media (max-width: 900px) {
  .top-inner, main, footer > div { width: calc(100% - 36px); }
  .studio { gap: 13px; grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
  #template-list { max-height: 180px; }
  .canvas { padding: 18px 0; }
}
@media (max-width: 650px) {
  main { padding-top: 18px; }
  .top-inner { min-height: 64px; }
  .brand img { width: 51px; }
  .intro { padding: 21px 17px; }
  .intro-copy { max-width: 82%; }
  .intro::before, .intro::after { width: 18%; }
  .proof { padding-inline: 12px; }
}
@media (max-width: 420px) {
  .top-inner { flex-wrap: wrap; gap: 0 10px; padding-block: 7px; }
  .app-nav { margin-left: 0; }
}
