/* id.cldrn.uk — EEUK brand: purple #3C1053, red #F4384C, light grey #ECECEC, dark grey #5E514D */
@font-face { font-family: 'Barlow'; font-weight: 300; font-display: swap; src: url('fonts/Barlow-Light.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('fonts/Barlow-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Bebas Neue'; font-weight: 400; font-display: swap; src: url('fonts/BebasNeue-Regular.woff2') format('woff2'); }

:root {
  --purple: #3C1053;
  --purple-2: #5a2a75;
  --purple-tint: #f3eef6;
  --red: #F4384C;
  --grey: #ECECEC;
  --ink: #2b2230;
  --muted: #5E514D;
  --line: #dcd6df;
  --ok: #1f7a4d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Barlow', system-ui, sans-serif; font-weight: 300; font-size: 17px; line-height: 1.5;
  color: var(--ink); background: #faf8fb;
}
strong, b, th, label, .btn, h2, h3 { font-weight: 600; }
h1 { font-family: 'Bebas Neue', 'Barlow', sans-serif; font-weight: 400; font-size: 2.6rem; line-height: 1; letter-spacing: .02em; color: var(--purple); margin: 0 0 .3em; }
h2 { font-size: 1.15rem; color: var(--purple); margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
a { color: var(--purple); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--purple-tint); padding: .1em .35em; border-radius: 4px; }
.lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.2em; }
.hint, .help, .muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; }
.empty { color: var(--muted); font-style: italic; }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 600; font-size: .98rem; line-height: 1.2; padding: .7em 1.2em; border-radius: 999px;
  border: 2px solid var(--purple); background: #fff; color: var(--purple); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--purple-tint); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: #d92a3f; border-color: #d92a3f; }
.btn-quiet { border-color: var(--line); color: var(--muted); }
.btn-small { padding: .35em .8em; font-size: .85rem; }
.btn-big { width: 100%; padding: 1em 1.2em; font-size: 1.1rem; }
.btn-icon { width: 1.4em; height: 1.4em; }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

label { display: block; font-size: .92rem; color: var(--ink); }
label > input:not([type=checkbox]), label > select, label > textarea, .search input, .add-passkey input, form.inline input {
  display: block; width: 100%; margin-top: .3em; font: inherit; font-weight: 300; padding: .6em .75em;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
label > select {
  -webkit-appearance: none; appearance: none; padding-right: 2.4em; line-height: 1.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233C1053' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9em center; background-size: .75em;
}
input:disabled, select:disabled { background: var(--grey); color: var(--muted); }
.check { display: flex; align-items: center; gap: .5em; font-weight: 300; margin: .6em 0; }
.check input { width: 1.1em; height: 1.1em; accent-color: var(--purple); }
.stack > * + * { margin-top: .9em; }
.stack > input[type=hidden] + * { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9em 1.2em; }
.form-actions { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .6em; align-items: center; }
form.inline { display: inline-flex; gap: .4em; align-items: center; margin: 0; }
form.inline input { margin: 0; width: auto; padding: .35em .6em; }

.error { color: #9b1027; background: #fde8eb; border-left: 4px solid var(--red); padding: .6em .8em; border-radius: 6px; }
.flash { padding: .7em .9em; border-radius: 8px; margin: 0 0 1.2em; }
.flash-ok { background: #e6f4ec; color: var(--ok); }
.flash-error { background: #fde8eb; color: #9b1027; border-left: 4px solid var(--red); }
.note { background: var(--purple-tint); padding: .6em .8em; border-radius: 8px; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; letter-spacing: .06em; background: var(--purple-tint); padding: .7em .9em; border-radius: 8px; word-break: break-all; cursor: copy; }
[data-copy].copied { outline: 2px solid var(--ok); }
.qr-row { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.qr { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
@media (max-width: 560px) { .qr-row { grid-template-columns: 1fr; } .qr { margin: 0 auto; } }

/* Sign-in card */
body.bare { background: var(--purple); min-height: 100vh; }
.card-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.card { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.card-head { position: relative; background: var(--purple); padding: 26px 28px 18px; border-bottom: 4px solid var(--red); }
.card-head .logo { height: 46px; width: auto; display: block; }
.card-head .stripes { position: absolute; top: 0; right: 0; width: 96px; height: 96px; opacity: .9; }
.card-body { padding: 28px; }
.card-body h1 { font-size: 2.4rem; }
.foot { color: rgba(255,255,255,.7); font-size: .85rem; margin-top: 18px; }
.signin .hint { text-align: center; margin: .5em 0 1em; }
.alt { margin-top: 1.2em; border-top: 1px solid var(--line); padding-top: 1em; }
.alt summary { cursor: pointer; color: var(--purple); font-weight: 600; }
.alt form { margin-top: 1em; }
.alt form > * + * { margin-top: .8em; }
.steps { padding-left: 1.2em; }
.steps li { margin-bottom: .5em; }

/* App pages */
.top { display: flex; align-items: center; gap: 24px; background: var(--purple); color: #fff; padding: 10px 24px; border-bottom: 4px solid var(--red); flex-wrap: wrap; }
.top-logo img { height: 38px; display: block; }
.top-nav { display: flex; gap: 4px; flex: 1; }
.top-nav a { color: #fff; text-decoration: none; padding: .45em .9em; border-radius: 999px; font-weight: 600; }
.top-nav a:hover, .top-nav a[aria-current] { background: rgba(255,255,255,.14); }
.top-me { display: flex; align-items: center; gap: 10px; }
.top-name { font-weight: 600; }
.top-out { color: #fff; opacity: .8; font-size: .9rem; }
.subnav { display: flex; gap: 6px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subnav a { text-decoration: none; padding: .35em .9em; border-radius: 999px; font-weight: 600; }
.subnav a:hover { background: var(--purple-tint); }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.panel.notice { border-color: var(--red); border-width: 2px; }
.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.section { margin-top: 1.6em; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--grey); flex: none; }
.avatar-sm { width: 34px; height: 34px; }
.avatar-lg { width: 96px; height: 96px; }
.hero, .who { display: flex; align-items: center; gap: 20px; }
.hero h1, .who h1 { margin-bottom: .1em; }
.profile { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: start; }
.profile .hint { grid-column: 1 / -1; margin: .6em 0 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35em 1.2em; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
.message-facts { grid-template-columns: 1fr; gap: .1em; margin: 0 0 1.2em; }
.message-facts dd { margin-bottom: .6em; }
.message-facts code { word-break: break-all; font-size: .85rem; }

.tiles { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; padding: 18px; background: #fff;
        border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); min-height: 92px; transition: transform .08s, box-shadow .08s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(60,16,83,.12); border-color: var(--purple); }
.tile-mark { grid-row: 1 / 3; width: 46px; height: 46px; border-radius: 12px; background: var(--purple); color: #fff; display: grid; place-items: center;
             font-family: 'Bebas Neue', sans-serif; font-size: 1.7rem; border-bottom: 3px solid var(--red); }
.tile-name { font-weight: 600; font-size: 1.05rem; color: var(--purple); }
.tile-desc { color: var(--muted); font-size: .9rem; }

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { text-align: left; font-size: .85rem; color: var(--muted); border-bottom: 2px solid var(--line); padding: .5em .6em; }
.table td { border-bottom: 1px solid var(--line); padding: .55em .6em; vertical-align: middle; }
.table.people td:first-child { width: 46px; }
.table tr.alert td { background: #fff1f3; }
.audit td { font-size: .9rem; }
/* A button or note under a table gets the same space above it as the panel has below it. */
.table + form, .table + .actions, .table + p { margin-top: 20px; }
.panel > :last-child { margin-bottom: 0; }
.indent { color: var(--muted); }
.rows { list-style: none; padding: 0; margin: 0 0 1em; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6em 1em; padding: .55em 0; border-bottom: 1px solid var(--line); }
.row > span:first-child { font-weight: 600; }
.rows.small .row { font-size: .9rem; }
.add-passkey { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; }
.add-passkey input { flex: 1 1 200px; width: auto; margin: 0; }
.add-passkey .error { flex-basis: 100%; }
.search { display: flex; gap: .6em; margin-bottom: 16px; max-width: 520px; }
.search input { margin: 0; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15em .6em; border-radius: 999px; vertical-align: middle; }
.badge-active { background: #e6f4ec; color: var(--ok); }
.badge-suspended { background: #fff4d6; color: #7a5a00; }
.badge-left { background: var(--grey); color: var(--muted); }

/* Admin → System */
.sys-summary { list-style: none; padding: 0; margin: 0 0 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.sys-summary li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 18px; border-left-width: 5px; }
.sys-summary b { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 1.8rem; margin-right: .2em; vertical-align: -3px; }
.sys-summary .sys-pass { border-left-color: var(--ok); }
.sys-summary .sys-warn { border-left-color: #d9a300; }
.sys-summary .sys-fail { border-left-color: var(--red); }
.sys-mark { display: inline-block; white-space: nowrap; font-size: .78rem; font-weight: 600; padding: .15em .6em; border-radius: 999px; background: var(--grey); color: var(--muted); }
tr.sys-pass .sys-mark { background: #e6f4ec; color: var(--ok); }
tr.sys-warn .sys-mark { background: #fff4d6; color: #7a5a00; }
tr.sys-fail .sys-mark { background: var(--red); color: #fff; }
tr.sys-fail td { background: #fff1f3; }
.sys-checks td:last-child { overflow-wrap: anywhere; }
.sys-files { margin: 1em 0 1.2em; }
.sys-files summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.sys-files ul { margin: .5em 0 0; padding-left: 1.2em; max-height: 260px; overflow: auto; }

/* Teams within teams */
.tree-1 { padding-left: 1.4em !important; } .tree-2 { padding-left: 2.6em !important; } .tree-3 { padding-left: 3.8em !important; }
.tree-4 { padding-left: 5em !important; } .tree-5 { padding-left: 6.2em !important; } .tree-6 { padding-left: 7.4em !important; }
td.tree-0 { padding-left: .6em; }
.table tr.mine td { background: var(--purple-tint); }
.facts + form, .facts + .actions { margin-top: 14px; }
fieldset.manages { border: 0; padding: 0; margin: 0; }
fieldset.manages legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .2em; }
fieldset.manages .check { margin: .35em 0; }

/* Initials and signature */
.signing { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 18px 32px; align-items: start; }
.signing .label { display: block; font-size: .92rem; font-weight: 600; }
.initials-input { max-width: 9em; text-transform: uppercase; letter-spacing: .08em; }
.signature-img { display: block; max-width: 100%; width: 300px; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.signature-img.signature-sm { width: 180px; padding: 6px; }
.signature-empty { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.signature-pad { position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.signature-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.signature-line { position: absolute; left: 6%; right: 6%; bottom: 24%; border-bottom: 1px solid var(--line); pointer-events: none; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .signing { grid-template-columns: 1fr; }
  .top { gap: 10px; padding: 10px 16px; }
  .top-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .top-name { display: none; }
  .page { padding: 20px 16px 48px; }
  .profile { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  h1 { font-size: 2.1rem; }
}
