/* CCS PSD Onboarding. One stylesheet, system fonts, mobile first. */

:root {
  --ink: #16181d;
  --muted: #5d6470;
  --line: #d9dde3;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --ok: #1d7a3e;
  --ok-bg: #e8f5ec;
  --err: #b42318;
  --err-bg: #fdecea;
  --info-bg: #eaf0fd;
  --orange: #d9730d;
  --gray: #8a919c;
  --blue: #2563eb;
  --green: #16a34a;
  --dark: #1f2937;
  --red: #dc2626;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: none; padding: 0 24px; }

header.top { background: var(--card); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.wordmark { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }

.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 15px; }
.nav a { color: var(--accent); text-decoration: none; }
.nav a[aria-current="page"] { font-weight: 700; color: var(--ink); }
.nav .who { color: var(--muted); }

main.wrap { padding-top: 20px; padding-bottom: 32px; }
.foot { color: var(--muted); font-size: 14px; padding-top: 8px; padding-bottom: 32px; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.1rem; line-height: 1.3; margin: 0; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="search"], select, textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  padding: 10px 12px;
  border: 1px solid #b8bec8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input[readonly] { background: var(--bg); color: var(--muted); }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 3px solid rgba(31, 79, 209, 0.35); outline-offset: 1px; }
textarea { min-height: 72px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }

.stack > * + * { margin-top: 12px; }
.field { margin-bottom: 18px; }
.hint { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.req { font-weight: 400; color: var(--muted); font-size: 14px; }
.field-error { display: block; color: var(--err); font-size: 14px; margin-top: 4px; }
.has-error input { border-color: var(--err); }
.choices { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.choice { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 6px; }
.choice input { width: 20px; height: 20px; margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; }

/* Buttons */
button, .button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); }
button.big { width: 100%; font-size: 1.05rem; padding: 14px 16px; }
.button.secondary { border-color: #b8bec8; color: var(--ink); }
button.danger, .button.danger { border-color: var(--err); color: var(--err); }
button.danger.solid { background: var(--err); color: #fff; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); font-weight: 400; text-decoration: underline; }
button.link.danger { color: var(--err); }
button[disabled], .button.disabled { opacity: 0.5; cursor: not-allowed; }
form.inline { display: inline; }
.logout { margin: 0; }

/* Notices */
.notice { padding: 12px 14px; border-radius: 8px; border: 1px solid transparent; }
.notice.ok { background: var(--ok-bg); border-color: #b7e0c3; color: #0f4d27; }
.notice.error { background: var(--err-bg); border-color: #f5c2bd; color: #7a1a12; }
.notice.info { background: var(--info-bg); border-color: #c6d4f7; color: #1c327a; }
.tips { background: var(--card); border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; font-size: 15px; color: var(--muted); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 16px 0; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.item-head .num { color: var(--muted); }
.instructions { font-size: 15px; }
.redo-note { background: #fff4e5; border-left: 4px solid var(--orange); padding: 8px 12px; font-size: 15px; }
.state { flex: none; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.state-pending { background: #eef0f3; color: var(--muted); }
.state-complete { background: var(--ok-bg); color: var(--ok); }
.state-redo { background: #fff4e5; color: #9a4b00; }
.upload { margin: 12px 0; }
.upload input[type="file"] { display: block; width: 100%; margin: 6px 0 10px; font-size: 15px; }
.upload progress { display: block; width: 100%; height: 10px; margin-top: 10px; }
.files { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--line); }
.files li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fname { font-weight: 600; word-break: break-all; }
.fmeta { color: var(--muted); font-size: 14px; flex: 1; }
.submit { margin-top: 20px; }

/* Admin */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { display: flex; gap: 8px; }
.search input { width: 240px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f2f5; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
.detail-json { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-invited { background: var(--gray); }
.badge-in_progress { background: var(--blue); }
.badge-submitted { background: var(--green); }
.badge-sent { background: var(--dark); }
.badge-expired { background: var(--red); }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 3px; vertical-align: middle; border: 1px solid transparent; }
.dot-pending { background: #fff; border-color: var(--gray); }
.dot-complete { background: var(--green); }
.dot-redo { background: var(--orange); }
.dot-none { background: transparent; border: 1px dashed #c3c8d0; }
.legend { font-size: 13px; color: var(--muted); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h2 { margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; margin: 0 0 12px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
details.confirm { display: inline-block; }
details.confirm > summary { list-style: none; cursor: pointer; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { margin-bottom: 8px; }
.confirm-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fffdf7; max-width: 520px; }
.doc-row { border-top: 1px solid var(--line); padding: 12px 0; }
.doc-row:first-of-type { border-top: 0; }
.pager { display: flex; gap: 16px; margin-top: 12px; }

@media (min-width: 720px) {
  h1 { font-size: 1.75rem; }
  .item { padding: 20px; }
  button.big { width: auto; }
}

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
