/*
 * Application styles. Propshaft serves this file directly - no preprocessing, no
 * manifest directives. The layout links it via stylesheet_link_tag :app.
 */

:root {
  --indigo-900: #221a5e;
  --indigo-700: #4338ca;
  --indigo-600: #5b52e0;
  --indigo-500: #7c6ff0;
  --ink:        #1b1b2b;
  --ink-soft:   #52526b;
  --line:       #e3e3ef;
  --tint:       #f6f5fd;
  --white:      #ffffff;
  --radius:     14px;
  --maxw:       1080px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 55%, var(--indigo-500) 100%);
  color: var(--white);
  padding: 1.25rem 1.25rem 0;
}

.hero__nav {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero__nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.hero__nav-links a {
  color: rgba(255, 255, 255, .86);
  text-decoration: none;
  font-size: .95rem;
}

.hero__nav-links a:hover { color: var(--white); }

.wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.wordmark--sm { font-size: 1.15rem; }

.hero__body {
  max-width: 760px;
  margin: 0 auto;
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .75rem;
  color: rgba(255, 255, 255, .75);
  margin-bottom: 1rem;
}

.hero__tagline {
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}

.hero__sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: rgba(255, 255, 255, .85);
  max-width: 34rem;
  margin: 0 auto 2rem;
}

.hero__cta {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: .7rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .12s ease, background-color .12s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn--solid { background: var(--white); color: var(--indigo-700); }
.btn--solid:hover { background: #f1eeff; }

.btn--ghost { border-color: rgba(255, 255, 255, .55); color: var(--white); }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); }

.btn--lg { padding: .9rem 2.1rem; font-size: 1.05rem; }

.cta-band .btn--solid {
  background: var(--indigo-700);
  color: var(--white);
}
.cta-band .btn--solid:hover { background: var(--indigo-600); }

/* ---------- stats ---------- */

.stats {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.5rem 0 3rem;
  text-align: center;
}

.stat__value {
  display: block;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  display: block;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .75);
}

/* ---------- sections ---------- */

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4rem 1.25rem;
}

.section--tint {
  max-width: none;
  background: var(--tint);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section--tint > * {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
}

.section__title {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 750;
  letter-spacing: -.015em;
  text-align: center;
}

.section__lede {
  text-align: center;
  color: var(--ink-soft);
  max-width: 40rem;
  margin: 0 auto 2.5rem;
}

/* ---------- panels & cards ---------- */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  background: var(--white);
}

.panel__title {
  font-size: 1.25rem;
  color: var(--indigo-700);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.grid--tight { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.card__title { font-size: 1.05rem; margin-bottom: .5rem; }

.card--trust { border-left: 3px solid var(--indigo-600); }

/* ---------- snippet ---------- */

.snippet {
  /* ~60% of the 1080px content width. max-width, so narrow screens still go full width. */
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  background: var(--indigo-900);
  color: #dcd9ff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.7;
}

.snippet code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.snippet__note {
  color: var(--ink-soft);
  font-size: .9rem;
  max-width: 650px;
  margin: 1rem auto 0;
  text-align: center;
}

.snippet__note code {
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .05rem .3rem;
  font-size: .85rem;
}

.cta-band { text-align: center; }

/* ---------- footer ---------- */

.footer {
  background: var(--ink);
  color: rgba(255, 255, 255, .75);
  text-align: center;
  padding: 2.5rem 1.25rem;
}

.footer .wordmark { color: var(--white); }
.footer__tag { margin: .35rem 0 .75rem; }
.footer__legal { font-size: .85rem; color: rgba(255, 255, 255, .5); margin: 0; }

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero__nav-links { gap: .9rem; }
}

/* ==========================================================================
   App chrome - the signed-in area (ad groups, moderation, reports).
   Same palette as the landing page so the product reads as one thing.
   ========================================================================== */

.appbar {
  background: var(--indigo-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.5rem;
  flex-wrap: wrap;
}

.appbar__brand {
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  letter-spacing: -.02em;
}

.appbar__links { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }

.appbar__links a {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: .92rem;
}

.appbar__links a:hover { color: var(--white); }

.appbar__signout {
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  padding: .3rem .9rem;
}

.flashes { max-width: var(--maxw); margin: 1rem auto 0; padding: 0 1.25rem; }

.flash {
  border-radius: 10px;
  padding: .7rem 1rem;
  margin: 0 0 .5rem;
  font-size: .93rem;
  border: 1px solid;
}

.flash--notice { background: #eef6ee; border-color: #bcd9bd; color: #1f5223; }
.flash--alert  { background: #fdeeee; border-color: #edbcbc; color: #7a1f1f; }

.page { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.page__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page__title { font-size: 1.6rem; font-weight: 750; letter-spacing: -.015em; margin: 0; }
.page__sub { color: var(--ink-soft); margin: .25rem 0 0; font-size: .95rem; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

.tab {
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem 1rem;
  font-size: .9rem;
  background: var(--white);
}

.tab:hover { border-color: var(--indigo-500); color: var(--indigo-700); }

.tab--on {
  background: var(--indigo-700);
  border-color: var(--indigo-700);
  color: var(--white);
}

.tab__count { opacity: .7; margin-left: .35rem; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--white);
}

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }

table.data th, table.data td {
  text-align: left;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th {
  background: var(--tint);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}

table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap { white-space: normal; }

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- status pills ---------- */

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.pill--pending  { background: #fdf3da; color: #7a5a12; }
.pill--approved { background: #e6f5e8; color: #1f5223; }
.pill--rejected { background: #fdeaea; color: #7a1f1f; }
.pill--muted    { background: var(--tint); color: var(--ink-soft); }

/* ---------- forms ---------- */

.form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 620px;
}

.form--wide { max-width: none; }

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .3rem;
}

.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field select,
.field textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--white);
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--indigo-500);
  outline-offset: 1px;
  border-color: transparent;
}

.field__hint { color: var(--ink-soft); font-size: .82rem; margin: .3rem 0 0; }

.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .5rem; }

.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; }
.check input { margin: 0; }

.form__actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }

.btn--app {
  background: var(--indigo-700);
  color: var(--white);
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.3rem;
  border-radius: 999px;
}

.btn--app:hover { background: var(--indigo-600); }

.btn--quiet {
  background: var(--white);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
}

.btn--danger { color: #7a1f1f; border-color: #edbcbc; }
.btn--sm { padding: .3rem .8rem; font-size: .85rem; }

.errors {
  background: #fdeeee;
  border: 1px solid #edbcbc;
  color: #7a1f1f;
  border-radius: 10px;
  padding: .8rem 1rem;
  margin-bottom: 1.2rem;
  font-size: .9rem;
}

.errors ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* ---------- snippet callout inside the app ---------- */

.embed-box {
  background: var(--indigo-900);
  color: #dcd9ff;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
  line-height: 1.6;
  white-space: pre;
}

.footer__links { margin: .75rem 0 .5rem; font-size: .9rem; }
.footer__links a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.footer__links a:hover { color: var(--white); text-decoration: underline; }

/* ==========================================================================
   Modal dialog - replaces OVS's Bootstrap 3 modal. Native <dialog>, opened by
   modal_controller.js when its Turbo Frame loads.
   ========================================================================== */

dialog.modal {
  /* fixed + inset + auto margins, NOT position: relative. A showModal() dialog is
     centred by the UA's default `position: absolute; margin: auto`; overriding it to
     relative drops the dialog into normal flow at the end of <body>, where it is open
     but scrolled far off screen. Non-static is still required for .modal__close. */
  position: fixed;
  inset: 0;
  margin: auto;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(92vw, 520px);
  max-height: 88vh;
  overflow: auto;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(20, 16, 60, .28);
}

dialog.modal::backdrop {
  background: rgba(20, 16, 60, .55);
  backdrop-filter: blur(2px);
}

.modal__close {
  position: absolute;
  top: .55rem;
  right: .8rem;
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 6px;
}

.modal__close:hover { background: var(--tint); color: var(--ink); }

.modal__head { padding: 1.75rem 1.75rem 0; }
.modal__head .page__title { font-size: 1.35rem; }
.modal__head .page__sub { margin-bottom: 0; }

/* Inside the dialog the form supplies the padding, so drop its own frame. */
dialog.modal .form--flush {
  border: 0;
  border-radius: 0;
  max-width: none;
  padding: 1.25rem 1.75rem 1.75rem;
}

dialog.modal .errors { margin: 1rem 1.75rem 0; }

/* On the standalone /signin and /signup pages the same partial is a normal card. */
.page .form--flush {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 620px;
}

.page .modal__head { padding: 0 0 1.25rem; }

@media (max-width: 560px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; }
}

/* button_to wraps its button in a form, so the flex row needs the form to disappear. */
.appbar__links form { display: inline; margin: 0; }

.appbar__signout--button {
  background: transparent;
  color: rgba(255, 255, 255, .82);
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
}

.appbar__signout--button:hover { color: var(--white); background: rgba(255, 255, 255, .12); }

/* ---------- admin: manage users ---------- */

.search { margin-bottom: 1.5rem; }

.search__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.search__fields .field { margin-bottom: 0; }
.search__submit { display: flex; gap: .5rem; align-items: center; }

table.data tr.row--disabled { background: #f4f4f6; color: var(--ink-soft); }
table.data td .muted { color: var(--ink-soft); font-size: .85rem; }
table.data td form { display: inline; margin: 0 .25rem .25rem 0; }

.role-form { display: flex; gap: .35rem; align-items: center; flex-wrap: nowrap; }
.role-form select { padding: .3rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: .85rem; }
.role-form__note { width: 11rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: .85rem; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.25rem; }
.pager__label { color: var(--ink-soft); font-size: .9rem; }

/* ---------- admin menu (ad_groups index) ---------- */

.admin-menu {
  border: 1px solid var(--line);
  border-left: 3px solid var(--indigo-600);
  border-radius: var(--radius);
  background: var(--tint);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.admin-menu__title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
  margin: 0 0 .75rem;
}

.admin-menu__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
}

.admin-menu__link {
  display: block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem .9rem;
  text-decoration: none;
  color: var(--ink);
}

.admin-menu__link:hover { border-color: var(--indigo-500); }

.admin-menu__label { display: block; font-weight: 600; font-size: .95rem; }
.admin-menu__hint { display: block; color: var(--ink-soft); font-size: .82rem; margin-top: .15rem; }

.admin-menu__badge {
  display: inline-block;
  background: var(--indigo-700);
  color: var(--white);
  border-radius: 999px;
  padding: 0 .45rem;
  font-size: .75rem;
  margin-left: .3rem;
  vertical-align: middle;
}

/* ---------- admin: system services ---------- */

.services { display: grid; gap: .6rem; }

.service {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .9rem;
}

.service__name {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95rem;
  min-width: 5rem;
}

.service__hint { color: var(--ink-soft); font-size: .84rem; }
.service__hint a { color: var(--indigo-700); }

.services__note { color: var(--ink-soft); font-size: .82rem; margin: .75rem 0 0; }

/* ---------- brand mark ---------- */

.brand { display: inline-flex; align-items: center; text-decoration: none; }

/* The source PNG is 2170x725. Without an explicit height it renders at natural size and
   blows the nav apart, so constrain the height and let the width follow. */
.brand__mark {
  height: 30px;
  width: auto;
  display: block;
}

@media (max-width: 560px) {
  .brand__mark { height: 25px; }
}
