/* The admin side's own styling.
 *
 * The forms do not use this. They wear the Formsite styling in forms.css and
 * forms/themes.css, which is generated from the CSS Formsite built for each
 * of the thirty-seven originals; /admin/design shows all nineteen of them. */
:root {
  --ink: #1b1f2a;
  --muted: #5b6272;
  --bg: #f6f7f9;
  --card: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap {
  max-width: 720px;
  margin: 48px auto;
  padding: 32px 16px;
  background: var(--card);
  border-radius: 8px;
}
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
p { color: var(--muted); }

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

.wrap { max-width: 860px; }

.form { display: flex; flex-wrap: wrap; gap: 0 16px; }
.form > * { flex: 1 1 100%; min-width: 0; }

h2.section {
  flex-basis: 100%;
  margin: 28px 0 4px;
  padding: 10px 14px;
  font-size: 1.05rem;
  color: #fff;
  background: #009688;      /* the teal the Formsite bursaries form used */
  border-radius: 6px;
}
.prose { color: var(--muted); }
.prose p { margin: .4rem 0; }

.field { margin: 0 0 16px; }
.field-half    { flex: 1 1 calc(50% - 16px); }
.field-quarter { flex: 1 1 calc(25% - 16px); }
@media (max-width: 640px) {
  .field-half, .field-quarter { flex-basis: 100%; }
}

.field label,
.signature legend { display: block; font-weight: 600; margin: 0 0 4px; }
.required { color: #c62828; }
.help { margin: 2px 0 6px; font-size: .875rem; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], select, textarea {
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(0, 150, 136, .35);
  border-color: #009688;
  outline-offset: 1px;
}

.choices { display: grid; gap: 6px 16px; }
.choices.columns-2 { grid-template-columns: repeat(2, 1fr); }
.choices.columns-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .choices[class*="columns-"] { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 8px; align-items: baseline; font-weight: 400; }

.files { margin: 0 0 8px; padding: 0; list-style: none; }
.files li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.filesize { color: var(--muted); font-size: .85rem; }

.signature { margin: 0; padding: 0; border: 0; }
.signature-pad {
  width: 100%; max-width: 600px; height: 180px;
  background: #fff; border: 1px dashed #bdbdbd; border-radius: 8px;
  touch-action: none;                 /* so a drawn line does not scroll the page */
}
.signature-actions { display: flex; gap: 12px; align-items: baseline; margin-top: 6px; }
.signed { color: #00695c; font-size: .875rem; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0 0; }
button, .button {
  padding: 12px 22px;
  font: inherit; font-weight: 600;
  color: #fff; background: #009688;
  border: 0; border-radius: 10px; cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: #00796b; }
button.secondary { color: var(--ink); background: #e0f2f1; }
button.secondary:hover { background: #b2dfdb; }
button.link, .link {
  padding: 0; color: #00695c; background: none;
  font-weight: 400; text-decoration: underline; cursor: pointer;
}

.notice { padding: 10px 14px; background: #e0f2f1; border-radius: 8px; color: var(--ink); }
.error-summary {
  padding: 10px 14px; background: #ffebee; border-radius: 8px;
  color: #b71c1c; font-weight: 600;
}
ul.error-summary { padding-left: 32px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #c62828; }
p.error { margin: 4px 0 0; color: #c62828; font-size: .875rem; }
.progress { color: var(--muted); font-size: .875rem; }
.save-note { flex-basis: 100%; margin-top: 18px; font-size: .9rem; }
.reference { font-size: 1.05rem; }
.form.narrow { max-width: 420px; }
[hidden] { display: none !important; }

/* ---- admin ------------------------------------------------------------ */

.adminbar {
  display: flex; gap: 16px; align-items: center;
  margin: -12px 0 24px; padding: 0 0 12px;
  border-bottom: 1px solid #e0e0e0;
}
.adminbar .spacer { flex: 1; }
.adminbar a { color: #00695c; }
.adminbar form { margin: 0; }
.crumbs { margin: 0 0 4px; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

table.grid { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
table.grid th, table.grid td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid #eceff1; vertical-align: top;
}
table.grid th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid tbody tr:hover { background: #f5fbfa; }

table.meta { border-collapse: collapse; margin: 0 0 20px; }
table.meta th { padding: 3px 16px 3px 0; text-align: left; font-weight: 600; color: var(--muted); }
table.meta td { padding: 3px 0; }

.searchbar { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.searchbar input[type=search] {
  flex: 1 1 340px; padding: 9px 10px; font: inherit;
  border: 1px solid #bdbdbd; border-radius: 8px;
}
.pager { display: flex; gap: 10px; }

.answer { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid #f1f3f4; }
.answer-label { flex: 0 0 38%; font-weight: 600; }
.answer-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.shot { margin: 0 0 10px; }
.shot img {
  max-width: 340px; max-height: 180px;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
}
.shot figcaption, .file { font-size: .875rem; }
.secret {
  padding: 10px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem; letter-spacing: .08em; background: #f5f5f5; border-radius: 8px;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* The suitability score's workings, folded away until somebody wants them. */
.scoring { margin: 0 0 20px; }
.scoring > summary { cursor: pointer; font-weight: 600; }
.scoring table.grid { margin-top: 10px; }
.warn {
  padding: 8px 12px; border-left: 3px solid #b26a00; background: #fff8e6;
  border-radius: 4px; color: #4a3b1a;
}

/* A form that exists but is not open to anyone. */
.tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: #4a3b1a; background: #fff2cc; border-radius: 10px; vertical-align: 1px;
}

/* Reaching the form itself from the list of forms. */
td.rowlinks { white-space: nowrap; }
.rowlink {
  display: inline-block; padding: 3px 10px; margin-right: 4px;
  font: inherit; font-size: .85rem; color: var(--muted);
  background: #fff; border: 1px solid #d8dbe0; border-radius: 999px;
  text-decoration: none; cursor: pointer;
}
.rowlink:hover { border-color: #9aa0a6; color: #1a1a1a; }
.rowlink.said { border-color: #0f766e; color: #0f766e; }

.inline-form { display: inline; }
.tag-quiet { color: #41525d; background: #e8eef2; }

/* The publish control says where a form stands; pressing it changes that. */
.state { font-weight: 600; }
.state-open {
  color: #0f6e3d; background: #eefaf3; border-color: #a9d9bf;
}
.state-open:hover { color: #0a5730; border-color: #6fc098; background: #e3f6ea; }
.state-closed {
  color: #96530a; background: #fdf4e8; border-color: #e8c18b;
}
.state-closed:hover { color: #7a4208; border-color: #d9a254; background: #fbecd8; }
span.state { display: inline-block; padding: 1px 9px; border: 1px solid; border-radius: 999px;
  font-size: .85rem; }

/* ---- the form design system page -------------------------------------- */

.design-heading { margin: 32px 0 6px; font-size: 1.15rem; }
table.grid tr.is-current td { background: #f0f7f6; }
table.tokens td:first-child { width: 36%; }
.swatch {
  display: inline-block; width: 14px; height: 14px; margin-right: 6px;
  border: 1px solid rgba(0,0,0,.15); border-radius: 3px; vertical-align: -2px;
  background: var(--fs-section-bg);
}

/* The sample is a page within a page: it carries the form styling and must
   not inherit the admin's. */
.design-sample {
  margin: 12px 0 8px;
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: var(--fs-page-bg);
}
.design-sample .wrap { margin: 0 auto; }

/* ---- a form's logo and hero, in the admin ----------------------------- */

.branding-shown { margin: 8px 0 14px; }
.branding-shown img {
  display: block; max-width: 420px; max-height: 180px;
  padding: 10px; background: #fff;
  border: 1px solid #e0e0e0; border-radius: 8px;
}
.branding-shown p { margin: 8px 0; font-size: .875rem; }
.branding-upload { display: flex; gap: 10px; align-items: center; margin: 0 0 8px; flex-wrap: wrap; }
.branding-upload input[type=file] { font: inherit; }

/* When a question is shown. The rules sit with the question they govern,
   folded into it, because a list of rules away from the questions is a list
   nobody reads and everybody mistrusts. */
.rules {
  margin: 14px 0 4px; padding: 12px 14px;
  background: #f7f8fa; border: 1px solid #e3e6ea; border-radius: 8px;
}
.rules h3 { margin: 0 0 6px; font-size: .95rem; }
.rules > p { margin: 0 0 8px; }
.rule-list { margin: 0 0 10px; padding-left: 20px; }
.rule-list li { margin-bottom: 4px; }
.rule-choices { margin: 6px 0 12px; }
.rule-choices > summary { cursor: pointer; font-size: .9rem; color: var(--muted); }
.rule-choices ul { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; }

/* What stands between a form and the public. */
.findings { margin: 0 0 20px; padding-left: 0; list-style: none; }
.findings li {
  margin-bottom: 8px; padding: 8px 12px 8px 14px; border-radius: 4px;
  border-left: 3px solid #d8dbe0; background: #fbfbfc;
}
.findings li.stop { border-left-color: #b3261e; background: #fdf3f2; color: #4a1a17; }
.findings li.warn-item { border-left-color: #b26a00; background: #fff8e6; color: #4a3b1a; }
.checked-list { margin: 0 0 20px; padding-left: 20px; font-size: .9rem; }
.checked-list li { margin-bottom: 4px; }

/* Revoking an invitation asks for a reason, folded into the row until it is
   wanted — a one-click revoke on a list is a mis-click waiting to happen. */
.revoke { display: inline-block; }
.revoke > summary { display: inline-block; list-style: none; }
.revoke > summary::-webkit-details-marker { display: none; }
.revoke .form { margin-top: 8px; }

/* ---------------------------------------------------------------------------
   The NDA: one page, the agreement above the form it is signed with.
   --------------------------------------------------------------------------- */

/* Dancing Script, under the SIL Open Font License, self-hosted. The signature
   has to look the same to everybody who opens the document afterwards, so the
   browser shows it in the same hand GD draws it in for the PDF, and neither
   depends on what the reader happens to have installed. */
@font-face {
  font-family: 'Signature';
  src: url('/assets/fonts/dancing-script-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193;
}
@font-face {
  font-family: 'Signature';
  src: url('/assets/fonts/dancing-script-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

.nda { max-width: 760px; margin: 0 auto; }
.nda-narrow { max-width: 540px; }
.nda h1 { margin-bottom: 4px; }

/* The agreement itself: scrollable, so the form stays reachable on a phone
   without scrolling past four pages of clauses to find it. */
.agreement {
  max-height: 60vh; overflow-y: auto; margin: 18px 0 24px; padding: 20px 22px;
  background: #fff; border: 1px solid #d8dbe0; border-radius: 8px;
  font-size: .9rem; line-height: 1.6;
}
.agreement h2 { margin: 0 0 14px; font-size: 1.05rem; letter-spacing: .02em; }
.agreement h3 { margin: 18px 0 6px; font-size: .92rem; }
.agreement p { margin: 0 0 10px; }

/* A gap in the agreement, and the same gap once it has been filled in. The
   point of the highlight is that somebody can see their own details appear in
   the document rather than trusting that they will. */
.fill {
  padding: 0 3px; border-radius: 3px;
  background: #fdf4e8; color: #7a4208; box-decoration-break: clone;
}
.fill.filled { background: #eefaf3; color: #0a5730; font-weight: 600; }
.agreement .later { color: var(--muted); font-style: italic; }

.nda-form { margin-top: 8px; }
.nda-form fieldset { margin: 0 0 18px; padding: 0; border: 0; }
.nda-form legend { padding: 0; font-weight: 600; }
.nda-form input[readonly] { background: #f5f6f7; color: #41525d; }

/* The typed signature, shown as it will be written. */
.signature-shown {
  min-height: 52px; margin: 8px 0 0; padding: 4px 2px;
  font-family: 'Signature', 'Snell Roundhand', cursive; font-size: 2rem; line-height: 1.3;
  color: #102040; border-bottom: 1px solid #d8dbe0;
}
.signature-shown.matches { border-bottom-color: #0f766e; }

.nda .button {
  display: inline-block; padding: 10px 18px; border-radius: 6px;
  background: #0f766e; color: #fff; text-decoration: none; font-weight: 600;
}
.nda .button:hover { background: #0b5d57; }

@media (max-width: 640px) {
  .agreement { max-height: 48vh; padding: 14px 16px; }
  .signature-shown { font-size: 1.6rem; }
}

/* Reviewing a signed NDA: the text as it was agreed, read-only. */
.agreement-plain {
  max-height: 420px; overflow-y: auto; margin: 0 0 24px; padding: 16px 18px;
  background: #fbfbfc; border: 1px solid #e3e6ea; border-radius: 8px;
  font: .82rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-wrap: break-word;
}
.decide { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; margin-bottom: 24px; }
/* The review page uses a grid as a list of facts rather than a table of rows,
   so its headers are a left-hand column. Scoped, because every other grid on
   the site has its headers across the top. */
.nda-facts th { text-align: left; white-space: nowrap; vertical-align: top; width: 10em; }

/* The switches. The first column carries a name, an identifier and a line of
   history, so it needs room; the middle one is prose and takes what is left. */
.settings-table td:first-child { width: 17em; }
.settings-table td { vertical-align: top; }
