/* Moss design system, shared with File Transfer.
   Tokens, fonts and component classes match uktransfers so the two apps read
   as one product. Anything below the component section is specific to this
   app: dense tables, progress meters and the printable evidence record. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --charcoal:   #565759;
  --charcoal-d: #3D3E40;
  --blue:       #3C8DC4;
  --blue-dark:  #2D6E9E;
  --blue-pale:  #EBF4FB;
  --white:      #FFFFFF;
  --off-white:  #F4F3F1;
  --warm-gray:  #E5E2DC;
  --mid:        #9C9A96;
  --text:       #3A3B3D;
  --muted:      #74726E;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 2px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);

  /* Status, extending the badge palette */
  --green:      #1D6B3A;
  --green-pale: #EDF6EE;
  --amber:      #7A5020;
  --amber-pale: #F5F0EA;
  --red:        #8C2F28;
  --red-pale:   #FAEDEC;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--off-white);
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5 { font-family: 'Syne', 'Outfit', sans-serif; font-weight: 700; line-height: 1.1; }
h1 { font-size: 34px; margin-bottom: 10px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; margin-bottom: 8px; }
p { margin-bottom: 1em; max-width: 68ch; }
p:last-child { margin-bottom: 0; }
a { color: var(--blue-dark); }
a:hover { color: var(--charcoal-d); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.lede { color: var(--muted); font-size: 15px; max-width: 66ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }

/* Staff nav */
.staff-nav {
  background: var(--charcoal-d);
  padding: 0 32px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-logo { line-height: 0; }
.nav-logo div { background: #fff; padding: 5px 12px; border-radius: 6px; display: inline-block; line-height: 0; }
.nav-logo img { height: 30px; width: auto; display: block; }
.staff-nav-links { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.staff-nav-links a, .staff-nav-links button.linkish {
  color: rgba(255,255,255,.45);
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: color .2s;
  background: none; border: 0; cursor: pointer; padding: 0;
}
.staff-nav-links a:hover, .staff-nav-links a.active,
.staff-nav-links button.linkish:hover { color: #fff; }
.staff-nav-links a.nav-cta { background: var(--blue); color: #fff; padding: 7px 16px; border-radius: 6px; }
.staff-nav-links a.nav-cta:hover { background: var(--blue-dark); }
.staff-nav-links form { display: inline; margin: 0; }

/* Layout */
.staff-page { max-width: 1140px; margin: 0 auto; padding: 36px 32px 80px; }
.pagehead { display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.pagehead .grow { flex: 1 1 340px; }
.pagehead .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card, .panel {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--warm-gray);
  margin-bottom: 22px;
  overflow: hidden;
}
.panel > header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--warm-gray);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.panel > header h2 { font-size: 17px; }
.panel > header .grow { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel .body { padding: 24px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 13px 24px; border-bottom: 1px solid var(--warm-gray); vertical-align: top; }
th {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--off-white);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FBFAF9; }
td.num, th.num { text-align: right; }
td.tight { white-space: nowrap; }

/* Progress meter */
.meter { display: block; height: 7px; background: var(--warm-gray); border-radius: 4px; overflow: hidden; min-width: 130px; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.meter.low i { background: var(--blue); }
.meter.zero i { background: var(--mid); }
.meterline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meterline b { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; min-width: 42px; }

/* Badges */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.pill.ok,   .badge-out     { background: var(--green-pale); color: var(--green); }
.pill.wait, .badge-in      { background: var(--blue-pale);  color: #1A5A82; }
.pill.late, .badge-expired { background: var(--red-pale);   color: var(--red); }
.pill.grey                 { background: var(--off-white);  color: var(--muted); border: 1px solid var(--warm-gray); }

/* Stat strip */
.stats {
  display: flex; flex-wrap: wrap; background: #fff;
  border: 1px solid var(--warm-gray); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden;
}
.stats div { padding: 20px 26px; border-right: 1px solid var(--warm-gray); flex: 1 1 150px; }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 32px; line-height: 1.1; }
.stats span { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.stats div.alert b { color: var(--blue-dark); }

/* Forms */
.field, .form-group { margin-bottom: 20px; }
label, .form-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase;
}
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=file], select, textarea, .form-control {
  width: 100%; padding: 12px 14px;
  background: var(--off-white);
  border: 1.5px solid var(--warm-gray);
  border-radius: var(--radius);
  font-family: 'Outfit', sans-serif; font-size: 15px; color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
input:focus, select:focus, textarea:focus, .form-control:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(60,141,196,.12); background: #fff;
}
input:disabled, textarea:disabled { color: var(--mid); }
textarea { resize: vertical; min-height: 90px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > .field { flex: 1 1 220px; }
fieldset { border: 1px solid var(--warm-gray); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
legend { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; font-size: 14px; }
.check input { margin-top: 3px; flex: none; width: 17px; height: 17px; accent-color: var(--blue); }
.check label { font-weight: 400; color: var(--text); margin: 0; font-size: 14px; text-transform: none; letter-spacing: 0; }
.scrollbox { max-height: 280px; overflow-y: auto; border: 1px solid var(--warm-gray); border-radius: var(--radius); padding: 14px; background: #fff; }

/* Buttons */
button, .btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: var(--radius); border: none;
  background: var(--blue); color: #fff;
  cursor: pointer; text-decoration: none; transition: all .2s; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--blue-dark); color: #fff; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-charcoal, button.charcoal { background: var(--charcoal-d); color: #fff; }
.btn-charcoal:hover, button.charcoal:hover { background: #2a2b2d; }
.btn.secondary, button.secondary, .btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--warm-gray);
}
.btn.secondary:hover, button.secondary:hover, .btn-ghost:hover {
  background: transparent; border-color: var(--mid); color: var(--text);
}
.btn.danger, button.danger { background: transparent; color: var(--red); border: 1px solid #E4C8C5; }
.btn.danger:hover, button.danger:hover { background: var(--red-pale); color: var(--red); border-color: var(--red); }
.btn.small, button.small, .btn-sm { font-size: 12px; padding: 7px 14px; }
.btn-lg { font-size: 16px; padding: 14px 32px; border-radius: 12px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: var(--blue); }
button.secondary:disabled:hover { background: transparent; }
.inline-form { display: inline; }

/* Flash */
.flash {
  border-radius: var(--radius); padding: 13px 17px; font-size: 14px; margin-bottom: 18px;
  background: #E8F3FB; color: #1A5A82; border: 1px solid #B8D8EE;
}
.flash.ok    { background: var(--green-pale); color: var(--green); border-color: #C6E2CD; }
.flash.warn  { background: var(--amber-pale); color: var(--amber); border-color: #E4D6C2; }
.flash.error { background: var(--red-pale);   color: var(--red);   border-color: #E8C9C6; }
.flash a { color: inherit; font-weight: 600; }

/* Brand split panel, used on login and the acknowledgement landing */
.split { display: flex; min-height: 100vh; }
.brand-panel {
  width: 440px; flex-shrink: 0; background: var(--charcoal-d);
  display: flex; flex-direction: column; justify-content: space-between; padding: 52px 48px;
}
.brand-logo { background: #fff; padding: 20px; border-radius: 12px; text-align: center; }
.brand-logo img { width: 100%; max-width: 200px; height: auto; display: inline-block; }
.eyebrow {
  color: rgba(255,255,255,.35); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 18px;
}
.brand-panel h1 { color: #fff; font-size: 44px; line-height: 1; margin-bottom: 18px; }
.brand-panel .tagline { color: rgba(255,255,255,.4); font-size: 14px; line-height: 1.75; }
.brand-points { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.brand-points div { display: flex; align-items: center; gap: 10px; }
.brand-points i { width: 7px; height: 7px; background: var(--blue); border-radius: 50%; flex: none; }
.brand-points span { color: rgba(255,255,255,.35); font-size: 12px; }
.brand-foot { color: rgba(255,255,255,.15); font-size: 12px; }
.split-form { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--off-white); padding: 40px 24px; }
.split-form > div { width: 360px; max-width: 100%; }

/* Acknowledgement pages */
.ack-shell { max-width: 880px; margin: 0 auto; padding: 32px 24px 72px; }
.ack-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.ack-brand .mark { background: #fff; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--warm-gray); line-height: 0; }
.ack-brand .mark img { height: 34px; width: auto; display: block; }
.ack-head { border-bottom: 1px solid var(--warm-gray); padding-bottom: 20px; margin-bottom: 24px; }
.ack-head .who { font-size: 13px; color: var(--muted); margin-top: 10px; }
.viewer { width: 100%; height: 620px; border: 1px solid var(--warm-gray); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); }
.confirm-box {
  background: #fff; border: 1px solid var(--warm-gray); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 28px; margin-top: 24px;
}
.done-mark { display: inline-flex; align-items: center; gap: 12px; font-family: 'Syne', sans-serif;
             font-size: 22px; font-weight: 700; color: var(--green); margin-bottom: 10px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 26px; font-size: 14px; }
dl.facts dt { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .03em;
              text-transform: uppercase; padding-top: 2px; }
dl.facts dd { overflow-wrap: anywhere; }

/* Evidence record */
.receipt {
  background: #fff; border: 1px solid var(--warm-gray); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 44px; max-width: 780px; margin: 0 auto;
}
.receipt h1 { font-size: 26px; margin-bottom: 4px; }
.receipt .rule { height: 2px; background: var(--charcoal-d); margin: 20px 0 26px; }

@media print {
  .staff-nav, .noprint, .flash, .ack-brand { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .receipt { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .staff-page { padding: 0; }
}

@media (max-width: 900px) {
  .split { flex-direction: column; min-height: 0; }
  .brand-panel { width: 100%; padding: 32px 28px; gap: 28px; }
  .brand-logo { max-width: 220px; }
  .brand-panel h1 { font-size: 34px; }
  .split-form { padding: 36px 24px 60px; }
}

@media (max-width: 720px) {
  .staff-nav { padding: 12px 18px; }
  .staff-page { padding: 24px 16px 64px; }
  th, td { padding: 11px 16px; }
  .hide-sm { display: none; }
  .viewer { height: 440px; }
  h1 { font-size: 27px; }
  .stats div { padding: 16px 18px; }
  .stats b { font-size: 26px; }
  dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
  dl.facts dd { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── In-document signing ─────────────────────────────────────────────── */

.sign-shell { max-width: 1000px; margin: 0 auto; padding: 32px 24px 130px; }

.pdf-frame { position: relative; padding-left: 62px; }
.pdf-frame.prepare { padding-left: 0; }
.pdf-pages { display: flex; flex-direction: column; gap: 18px; }

.pdf-page {
  position: relative; background: #fff; border: 1px solid var(--warm-gray);
  border-radius: 6px; box-shadow: var(--shadow); overflow: hidden;
}
.pdf-page canvas { display: block; width: 100%; height: auto; }
.pdf-overlay { position: absolute; inset: 0; }
.pdf-overlay.editable { cursor: crosshair; }
.pdf-fallback { background: #fff; border: 1px solid var(--warm-gray); border-radius: var(--radius-lg);
                padding: 32px; text-align: center; }

/* Field markers */
.pdf-overlay .field {
  position: absolute; display: flex; align-items: center;
  background: rgba(60,141,196,.13); border: 1px solid var(--blue);
  border-radius: 3px; cursor: pointer; font-size: 12px; color: #1A5A82;
  padding: 0 4px; overflow: visible; min-height: 16px;
  transition: background .15s, box-shadow .15s;
}
.pdf-overlay .field:hover, .pdf-overlay .field:focus-visible { background: rgba(60,141,196,.22); box-shadow: 0 0 0 2px rgba(60,141,196,.3); }
.pdf-overlay .field.filled { background: rgba(60,141,196,.05); border-color: rgba(60,141,196,.55); }
.pdf-overlay .field .field-hint {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: clamp(9px, 1.1vw, 13px); font-weight: 500;
}
.pdf-overlay .field .field-hint b { color: var(--red); }
.pdf-overlay .field .field-text { font-size: clamp(9px, 1.1vw, 13px); color: var(--text); white-space: nowrap; }
.pdf-overlay .field .field-script {
  font-family: 'Caveat', cursive; font-size: clamp(14px, 2.4vw, 30px);
  color: #1a1a1a; line-height: 1; white-space: nowrap;
}
.pdf-overlay .field img { max-height: 100%; max-width: 100%; object-fit: contain; }
.pdf-overlay .field .field-caption {
  position: absolute; left: 1px; top: 100%; font-size: 8px; line-height: 1.3;
  color: var(--blue-dark); background: rgba(255,255,255,.85); padding: 0 2px;
  white-space: nowrap; pointer-events: none;
}
.pdf-overlay .field .field-tick { font-size: clamp(11px, 1.6vw, 18px); color: #1a1a1a; line-height: 1; }
.pdf-overlay .field.pulse { animation: fieldpulse 1.4s ease-out; }
@keyframes fieldpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(60,141,196,0); }
  30% { box-shadow: 0 0 0 7px rgba(60,141,196,.45); }
}

/* Gutter tab */
.gutter-tab {
  position: absolute; left: 0; z-index: 4;
  background: var(--blue); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px 5px 14px; border-radius: 3px 0 0 3px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.gutter-tab::after {
  content: ''; position: absolute; left: 100%; top: 0;
  border: 14px solid transparent; border-left-color: var(--blue); border-right-width: 0;
}
.gutter-tab:hover { background: var(--blue-dark); }
.gutter-tab:hover::after { border-left-color: var(--blue-dark); }

/* Bottom signing bar */
.signbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--charcoal-d); color: #fff;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; box-shadow: 0 -2px 14px rgba(0,0,0,.18);
}
.signbar span { font-size: 14px; color: rgba(255,255,255,.75); }
.signbar .small { font-size: 12px; color: rgba(255,255,255,.4); }
.signbar-btn { margin-left: auto; background: var(--blue); }
.signbar-btn.go { background: #fff; color: var(--charcoal-d); font-weight: 600; }
.signbar-btn.go:hover { background: #E8F3FB; color: var(--charcoal-d); }

/* Signature dialog */
.sigdialog {
  position: fixed; inset: 0; z-index: 40; background: rgba(61,62,64,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sigdialog[hidden] { display: none; }
.sigdialog-box {
  background: #fff; border-radius: var(--radius-lg); width: 620px; max-width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden;
}
.sigdialog-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--warm-gray); }
.sigdialog-tabs button {
  flex: 1; background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 14px 10px; font-size: 13px; font-weight: 600; justify-content: center;
}
.sigdialog-tabs button:hover { background: var(--off-white); color: var(--text); }
.sigdialog-tabs button.on { color: var(--blue-dark); border-bottom-color: var(--blue); }
.sigdialog-body { padding: 28px 28px 10px; }
.sig-script-input {
  width: 100%; border: 0; background: none; padding: 6px 2px; outline: none;
  font-family: 'Caveat', cursive; font-size: 46px; line-height: 1.2;
  text-align: center; color: #1a1a1a;
}
.sig-script-input:focus { box-shadow: none; background: none; border: 0; }
#sig-draw-canvas { width: 100%; height: 150px; display: block; touch-action: none; cursor: crosshair; }
.sig-rule { height: 1.5px; background: var(--blue); }
.sig-caption { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.sigdialog-foot { display: flex; gap: 10px; align-items: center; padding: 18px 24px 22px; }

/* Field placement screen */
.prepare-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--warm-gray); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 16px;
  position: sticky; top: 0; z-index: 10;
}
.prepare-bar button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.prepare-props { margin-bottom: 16px; }
.editable-field { cursor: move; }
.editable-field.selected { box-shadow: 0 0 0 2px var(--blue-dark); background: rgba(60,141,196,.26); }
.pdf-overlay .field-del {
  position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; padding: 0;
  border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; line-height: 1;
  display: none; align-items: center; justify-content: center; border: 0;
}
.editable-field:hover .field-del, .editable-field.selected .field-del { display: flex; }
.pdf-overlay .field-grip {
  position: absolute; right: -4px; bottom: -4px; width: 11px; height: 11px;
  background: var(--blue-dark); border: 1.5px solid #fff; border-radius: 2px;
  cursor: nwse-resize; display: none;
}
.editable-field:hover .field-grip, .editable-field.selected .field-grip { display: block; }

@media (max-width: 720px) {
  .sign-shell { padding: 22px 12px 130px; }
  .pdf-frame { padding-left: 40px; }
  .gutter-tab { font-size: 11px; padding: 4px 8px 4px 10px; }
  .gutter-tab::after { border-width: 12px; border-right-width: 0; }
  .signbar { padding: 11px 14px; gap: 10px; }
  .sig-script-input { font-size: 34px; }
}
