/* RegisterLens. No external fonts or frameworks; the CSP allows only this origin. */
:root {
  /* Warm palette taken from the logo: parchment, brown, deep orange. */
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #6b5d50;
  --line: #e8dfd3;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e3;
  --brand: #c2410c;       /* "Lens" in the wordmark: deep orange */
  --ok: #166534;      --ok-bg: #dcfce7;
  --info: #1e40af;    --info-bg: #dbeafe;
  --warn: #92400e;    --warn-bg: #fef3c7;
  --bad: #991b1b;     --bad-bg: #fee2e2;
  --grey: #57534e;    --grey-bg: #e7e5e4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 4px 16px rgba(28, 25, 23, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
/* Land anchors (#billing, #keys) below the sticky header. */
[id] { scroll-margin-top: 9rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.05rem; }
code, pre { font-family: var(--mono); font-size: .9em; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; border-radius: 6px; z-index: 10; }
.skip:focus { left: 1rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; padding-block: .5rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
/* The logo is /assets/favicon.svg (self-coloured). */
.logo { width: 40px; height: 40px; }
.wordmark { font-style: italic; }
.brand-lens { color: var(--brand); }
.header-search { flex: 1 1 260px; max-width: 420px; }
.header-search input { width: 100%; }
.main-nav { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: var(--accent); }

/* Forms */
input[type=search], input[type=text], input[type=url], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .75rem; min-height: 42px;
}
input[type=search]:focus, input[type=text]:focus, input[type=url]:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); padding: .6rem 1.2rem; min-height: 42px;
}
button:hover { filter: brightness(1.08); }

/* Home */
.hero { padding: 3.5rem 0 1.5rem; text-align: center; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .9rem; margin: 0 0 .6rem; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0 0 .8rem; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 760px; }
.hero .lede { margin: 0 auto 1.6rem; }
.big-search { display: flex; gap: .5rem; max-width: 680px; margin: 0 auto; }
.big-search input { flex: 1; font-size: 1.1rem; min-height: 54px; padding-inline: 1rem; border-radius: 12px; box-shadow: var(--shadow); }
.big-search button { min-height: 54px; border-radius: 12px; padding-inline: 1.6rem; }
.hint { color: var(--muted); font-size: .92rem; margin-top: .9rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2rem 0 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-num { font-size: 1.7rem; font-weight: 700; }
.stat span:last-child { color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card-link { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.card-link:hover { border-color: var(--accent); }
.card-title { font-weight: 600; }
.three-up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 3rem 0 1rem; padding: 1.5rem; background: var(--accent-soft); border-radius: var(--radius); }
.three-up h3 { margin-top: 0; }
.three-up p { margin-bottom: 0; color: var(--muted); }

/* Search */
.page-title { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 2rem 0 .6rem; }
.search-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.4rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 200px; }
.field.grow { flex: 1 1 280px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field select { max-width: 360px; }
.check { display: flex; align-items: center; gap: .4rem; font-size: .92rem; min-height: 42px; }
.result-count { color: var(--muted); }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; }
.result-name { font-size: 1.1rem; font-weight: 600; text-decoration: none; }
.result-name:hover { text-decoration: underline; }
.matched { margin: .3rem 0 0; color: var(--muted); font-size: .92rem; }
.badges { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .3rem; font-size: .92rem; }
.badges li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Chips and badges */
.ref, .kind { font-size: .82rem; border-radius: 999px; padding: .1rem .6rem; border: 1px solid var(--line); white-space: nowrap; }
.ref { font-family: var(--mono); background: var(--surface); }
.kind { color: var(--muted); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .12rem .6rem; white-space: nowrap; }
.badge-authorised { color: var(--ok); background: var(--ok-bg); }
.badge-passported_in { color: var(--info); background: var(--info-bg); }
.badge-run_off { color: var(--warn); background: var(--warn-bg); }
.badge-revoked { color: var(--bad); background: var(--bad-bg); }
.badge-other, .badge-removed { color: var(--grey); background: var(--grey-bg); }

/* Firm page */
.crumbs { margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.firm-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: .4rem 0 .5rem; }
.firm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.status { border-radius: var(--radius); padding: .9rem 1.1rem; margin: 1rem 0 .4rem; display: flex; flex-direction: column; gap: .2rem; border: 1px solid transparent; }
.status-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.status-bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.status-warn { background: var(--warn-bg); color: var(--warn); }
.status-info { background: var(--info-bg); color: var(--info); }
.confirm { font-size: .92rem; color: var(--muted); }
.subhead { color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; margin: 1.4rem 0 .6rem; }
.reg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.reg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.reg-card-head { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; margin-bottom: .6rem; }
.reg-name { font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: 0; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts-wide { grid-template-columns: minmax(120px, 30%) 1fr; margin-top: .6rem; }
.more { margin-top: .7rem; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.name-list { columns: 2 260px; padding-left: 1.1rem; margin: .3rem 0; }

/* Lists and tables */
.reg-group h2 { font-size: 1.1rem; }
.reg-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.reg-list li { padding: .75rem 1rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .3rem; }
.reg-list li:first-child { border-top: 0; }
.reg-list a { font-weight: 500; }
.reg-list-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .9rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; margin: 1.2rem 0 .8rem; font-size: .93rem; }
.toolbar .spacer { flex: 1; }
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.listing { width: 100%; border-collapse: collapse; font-size: .93rem; }
.listing th, .listing td { text-align: left; padding: .6rem .8rem; border-top: 1px solid var(--line); vertical-align: top; }
.listing thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.listing .num { text-align: right; font-variant-numeric: tabular-nums; }
.listing tr.is-removed td { opacity: .65; }
.check { font-size: .82rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; white-space: nowrap; }
.check-ok { color: var(--ok); background: var(--ok-bg); }
.check-warn { color: var(--warn); background: var(--warn-bg); }
.check-na { color: var(--grey); background: var(--grey-bg); }
.change-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.change-list li { padding: .65rem 1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.change-list li:first-child { border-top: 0; }
.change-list time { margin-left: auto; font-size: .88rem; }
.event { font-size: .78rem; font-weight: 700; border-radius: 6px; padding: .05rem .45rem; }
.event-added, .event-reinstated { color: var(--ok); background: var(--ok-bg); }
.event-removed { color: var(--bad); background: var(--bad-bg); }
.event-renamed { color: var(--info); background: var(--info-bg); }
.event-date { color: var(--grey); background: var(--grey-bg); }
.event-cro { color: var(--warn); background: var(--warn-bg); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.empty p { margin: .3rem 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1.2rem; margin: 1.5rem 0; }
.plain { padding-left: 1.1rem; }
.plain li { margin: .3rem 0; }
.prose { max-width: 800px; }

/* Plans */
.error-page { text-align: center; padding: 4rem 0; }
.error-page .lede { margin: 0 auto 1.5rem; }

/* Footer */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; padding-block: 1.6rem; }
.footer-links { display: flex; flex-direction: column; gap: .4rem; }

/* Account area, top right: "Log in / Sign up", or the name and a gear menu */
.account-area { display: flex; align-items: center; gap: .9rem; }
.login-link { color: var(--ink); text-decoration: none; font-weight: 500; }
.login-link:hover { color: var(--accent); }
.signup-link { text-decoration: none; font-weight: 600; color: var(--accent-ink); background: var(--accent); padding: .4rem .9rem; border-radius: 6px; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; display: flex; align-items: center; gap: .45rem; cursor: pointer; font-weight: 600; padding: .35rem .5rem; border-radius: 6px; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary { background: var(--accent-soft); }
.account-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gear { width: 20px; height: 20px; flex: none; }
.menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 250px; display: grid; gap: .2rem; padding: .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); z-index: 20; }
.menu-email { margin: .25rem .5rem .35rem; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.menu > a { color: var(--ink); text-decoration: none; padding: .45rem .5rem; border-radius: 6px; }
.menu > a:hover { background: var(--accent-soft); }
.menu-logout { width: 100%; min-height: 36px; padding: .45rem .5rem; text-align: left; font-weight: 500; background: transparent; color: var(--ink); border-radius: 6px; }
.menu-logout:hover { background: var(--accent-soft); filter: none; }

/* Log in / sign up */
.auth { max-width: 440px; margin: 0 auto 2rem; }
.providers { display: grid; gap: .6rem; margin: 1.5rem 0; }
.provider { display: flex; align-items: center; justify-content: center; min-height: 48px; font-weight: 600; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.provider:hover { border-color: var(--ink); }
.notice { margin: 1rem 0; padding: .75rem 1rem; border-radius: 8px; background: var(--grey-bg); color: var(--ink); }
.notice p { margin: .4rem 0; }
.notice-bad { background: var(--bad-bg); color: var(--bad); }
.notice-ok { background: var(--ok-bg); border: 1px solid var(--ok); }
.small { font-size: .9rem; }

/* Account */
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin: 1rem 0 1.5rem; }
.inline-form label { width: 100%; font-size: .85rem; font-weight: 600; color: var(--muted); }
.inline-form input { flex: 1 1 240px; max-width: 360px; }
.form-error { width: 100%; margin: 0; color: var(--bad); }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.key-row code { font-size: 1rem; padding: .4rem .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; user-select: all; }
.button-secondary { min-height: 34px; padding: .3rem .8rem; font-weight: 500; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.button-secondary:hover { border-color: var(--ink); filter: none; }
.button-danger { background: var(--bad); color: var(--bg); }
.billing-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .5rem; }
/* Watchlist and alerts */
.count { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: .4rem; }
.alert-list { list-style: none; padding: 0; margin: 1rem 0; }
.alert-list li { display: flex; gap: .9rem; padding: .5rem .1rem; border-bottom: 1px solid var(--line); }
.alert-list time { color: var(--muted); white-space: nowrap; font-size: .9rem; min-width: 7.5rem; }
.alert-list .unread a { font-weight: 600; }
.alert-list .unread time::before { content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .4em; border-radius: 50%; background: var(--accent); vertical-align: middle; }
#watch-form textarea { width: 100%; max-width: 560px; }
#webhook-url { width: 100%; max-width: 560px; }
.checkbox-line { display: flex; gap: .5rem; align-items: center; margin: .6rem 0 1rem; }
.watch-button { margin-top: .5rem; }
.watch-button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.cro .facts { margin-top: .6rem; }
.danger-zone { margin-top: 3rem; border-top: 1px solid var(--line); }

/* API documentation */
.docs .toc { color: var(--muted); }
.docs pre { margin: .8rem 0 1rem; }
.endpoints dt { margin-top: 1rem; font-weight: 600; }
.endpoints dd { margin: .25rem 0 0; color: var(--muted); }
.key-tag { margin-left: .4rem; font-size: .78rem; font-weight: 600; color: var(--accent); }

@media (max-width: 760px) {
  .stats, .three-up, .footer-grid { grid-template-columns: 1fr; }
  .account-area { margin-left: auto; }
  .big-search { flex-direction: column; }
  .main-nav { margin-left: 0; gap: .9rem; }
  .header-search { order: 3; max-width: none; flex-basis: 100%; }
  .reg-cards { grid-template-columns: 1fr; }
  .facts-wide { grid-template-columns: 1fr; }
  .change-list time { margin-left: 0; }
}

/* Group: other regulated firms in the same corporate group */
.group .facts { margin-top: .6rem; }
.group-firms { columns: 2 18rem; column-gap: 2rem; padding-left: 1.1rem; margin: .4rem 0 .8rem; }
.group-firms li { break-inside: avoid; margin: .1rem 0; }

/* New entrants / exits */
.tabs { display: flex; gap: .4rem; margin: .4rem 0 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .45rem .9rem; text-decoration: none; color: var(--ink); border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; margin-bottom: -1px; }
.tabs a[aria-current="page"] { border-color: var(--line); background: var(--surface); font-weight: 600; }
.listing.moves td { vertical-align: top; }

/* Central Bank warnings and enforcement */
.warning-box { border: 1px solid #e0a39a; background: #fdf1ef; border-radius: 8px; padding: .8rem 1rem; margin: 0 0 1.2rem; }
.warning-box ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.notices h3 { font-size: 1rem; margin: .9rem 0 .3rem; }
.notice-list { list-style: none; padding: 0; margin: .3rem 0 .6rem; }
.notice-list li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.notice-list time { color: var(--muted); font-size: .9rem; }
.notice-summary { margin: 0 0 .2rem; }
