:root {
  --blue: #1b76bb;
  --blue-dark: #0d4f8b;
  --ink: #1c2530;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --accent: #0f9d6c;
  --danger: #c0392b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.markimg { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Whiten the blue mark when it sits on a coloured background. */
.brandmark.light .markimg, .formbanner .markimg { filter: brightness(0) invert(1); }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 12px 22px; position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--blue); }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }
.brandmark { color: var(--blue); width: 26px; height: 26px; display: inline-flex; }
.brandmark.big { width: 40px; height: 40px; }
.brandmark.light { color: #fff; width: 34px; height: 34px; }
nav { display: flex; align-items: center; gap: 18px; }
nav a { color: var(--ink); font-weight: 500; }
nav a.active { color: var(--blue); }
.who { color: var(--muted); font-size: 14px; }
.linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.linkbtn.danger { color: var(--danger); }

.wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 80px; }
.pagetitle { font-size: 30px; margin: 6px 0 18px; }
.grouphead { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 10px; }
.subhead { margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--blue); }
.eyebrow.light { color: rgba(255,255,255,.9); }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #e5f6ee; color: #0b6b46; }
.flash.err { background: #fdecea; color: #9a2b20; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
  display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink);
}
.card:hover { border-color: var(--blue); text-decoration: none; box-shadow: 0 2px 10px rgba(27,118,187,.08); }
.cardmark { color: var(--blue); width: 30px; height: 30px; background: rgba(27,118,187,.1); border-radius: 8px; padding: 6px; display: inline-flex; }
.cardbody { display: flex; flex-direction: column; }
.cardbody em { color: var(--muted); font-style: normal; font-size: 13px; }
.badge { margin-left: auto; background: rgba(27,118,187,.15); color: var(--blue); font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 999px; }

/* Panels & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.detailhead { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rowactions { display: flex; gap: 12px; align-items: center; }
.rowactions form { display: inline; }
.status { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #eef2f7; color: var(--muted); text-transform: capitalize; }
.status.complete { background: #e5f6ee; color: #0b6b46; }
.status.draft { background: #fef3e0; color: #9a6b16; }
.empty { color: var(--muted); padding: 8px 0; }

/* Login */
.loginwrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.loginbox { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; width: 340px; box-shadow: 0 10px 40px rgba(20,40,70,.08); }
.loginlockup { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 26px; }
.lockupimg { width: 210px; max-width: 80%; height: auto; }
.loginsub { color: var(--muted); font-size: 15px; letter-spacing: .02em; }
.loginbox label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* Form banner + sections */
.formbanner { display: flex; align-items: center; justify-content: space-between; background: var(--blue); color: #fff; border-radius: 16px; padding: 16px 20px; margin-bottom: 18px; }
.bannercode { font-size: 13px; opacity: .85; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 0 0 18px; }
.section legend, .section .grouphead { color: var(--blue); font-weight: 700; font-size: 16px; padding: 0 6px; }
.section.readonly .grouphead { color: var(--blue); }

/* Fields */
.field { margin-bottom: 16px; }
.flabel { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: 12px; font-style: italic; margin-bottom: 6px; }
.note { display: block; color: #94a3b8; font-size: 11px; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #f6f8fa;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(27,118,187,.35); border-color: var(--blue); background: #fff; }
textarea { resize: vertical; }
.datefield { width: auto; min-width: 220px; }
.readvalue { background: #f6f8fa; border-radius: 10px; padding: 10px 12px; min-height: 20px; }
.readvalue.multiline { white-space: pre-wrap; }
.infoline { background: rgba(27,118,187,.07); border-radius: 10px; padding: 12px; color: var(--muted); }
.infoline.online { color: var(--blue); }

/* Chips */
.chips, .scale { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2f7; border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; user-select: none; }
.chip input { display: none; width: auto; }
.chip.on, .chip:has(input:checked) { background: var(--blue); color: #fff; }
.matrixrow { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rowlabel { width: 210px; font-weight: 500; font-size: 14px; }
.scale .chip { padding: 5px 11px; font-size: 13px; }

/* Signature */
.sigpad canvas { width: 100%; max-width: 460px; height: 150px; background: #fff; border: 1px dashed rgba(27,118,187,.5); border-radius: 10px; touch-action: none; display: block; }
.sigrow { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.sigthumb { height: 44px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.sigimg { max-width: 300px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }

/* Photos */
.photos { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.photothumb { width: 120px; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photoadd { width: 120px; height: 150px; border: 1px dashed rgba(27,118,187,.5); border-radius: 10px; background: rgba(27,118,187,.06); color: var(--blue); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; cursor: pointer; }
.photoadd span { pointer-events: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.actionbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.actionbar.top { margin-bottom: 6px; }
.actionbar form { display: inline; }

.emailform { display: inline-flex; gap: 6px; align-items: center; }
.emailform input { width: auto; min-width: 200px; padding: 6px 8px; }
.mfawarn { display: inline-block; margin-left: 8px; font-size: 12px; color: #9a6b16; }
.inlineform { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inlineform input, .inlineform select { width: auto; flex: 1 1 150px; }
.stackform label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.tokenbox .token { display: block; background: #0f172a; color: #7ee2b8; padding: 12px; border-radius: 10px; word-break: break-all; font-family: ui-monospace, Menlo, monospace; }
