:root {
  --blue: #145386;
  --navy: #0b3558;
  --navy-deep: #082b48;
  --green: #4da57f;
  --ink: #172333;
  --muted: #596777;
  --border: #ccd6df;
  --surface: #ffffff;
  --background: #f3f6f8;
  --error: #a72b32;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body { font-size: 16px; line-height: 1.55; }

a { color: var(--blue); text-underline-offset: 3px; }

a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid #70b9ef;
  outline-offset: 3px;
}

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }

.brand-panel {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, var(--navy-deep), var(--blue));
}

.brand-panel::after {
  content: "";
  position: absolute;
  right: -12rem;
  bottom: -13rem;
  width: 30rem;
  height: 30rem;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 50%;
  box-shadow: 0 0 0 5rem rgb(255 255 255 / 3%), 0 0 0 10rem rgb(255 255 255 / 2%);
}

.brand-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 650px);
  min-height: 100%;
  margin-left: auto;
  padding: clamp(2rem, 5vw, 5rem);
}

.brand { display: inline-flex; align-items: center; gap: .75rem; width: fit-content; color: var(--navy); font-size: 1.25rem; font-weight: 750; letter-spacing: .08em; text-decoration: none; }
.brand-on-dark { color: #fff; }
.brand-mark { display: grid; grid-template-columns: repeat(3, .35rem); align-items: end; gap: .2rem; width: 1.45rem; height: 1.45rem; padding: .2rem; border: 1px solid currentColor; border-radius: .3rem; }
.brand-mark span { display: block; background: var(--green); border-radius: .08rem; }
.brand-mark span:nth-child(1) { height: 45%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; }

.brand-message { max-width: 34rem; margin: auto 0; padding: 5rem 0; }
.brand-kicker, .eyebrow { margin: 0 0 .75rem; color: var(--green); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.brand-message h2 { max-width: 31rem; margin: 0; font-size: clamp(2rem, 3.2vw, 3.6rem); line-height: 1.08; letter-spacing: -.035em; }
.brand-message > p:last-child { max-width: 32rem; margin: 1.5rem 0 0; color: #d9e7f1; font-size: 1.05rem; }

.workflow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.workflow li { display: grid; gap: .2rem; padding-top: .8rem; border-top: 1px solid rgb(255 255 255 / 30%); }
.workflow span { color: #a8c8dd; font-size: .75rem; letter-spacing: .08em; }
.workflow strong { font-size: .92rem; }

.form-panel { display: grid; place-items: center; padding: clamp(2rem, 6vw, 7rem); background: var(--surface); }
.form-wrap { width: min(100%, 29rem); }
.brand-mobile { display: none; margin-bottom: 3.5rem; }
.form-wrap h1, .simple-card h1 { margin: 0; color: var(--navy-deep); font-size: clamp(2.25rem, 4vw, 3.25rem); line-height: 1.1; letter-spacing: -.035em; }
.intro { margin: 1rem 0 2rem; color: var(--muted); font-size: 1.05rem; }
.alert, .success { margin: 0 0 1.5rem; padding: .8rem 1rem; border-radius: .4rem; }
.alert { color: #7d1d23; background: #fff1f1; border: 1px solid #e9b8bb; border-left: 4px solid var(--error); }
.success { color: #174d38; background: #edf8f3; border: 1px solid #a9d7c4; border-left: 4px solid var(--green); }
.field { margin-bottom: 1.4rem; }
.field-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
label { display: block; margin-bottom: .45rem; color: var(--ink); font-size: .9rem; font-weight: 700; }
.field-heading a { font-size: .88rem; font-weight: 650; }
input { width: 100%; min-height: 3.25rem; padding: .7rem .85rem; color: var(--ink); background: #fff; border: 1px solid var(--border); border-radius: .4rem; font: inherit; }
select { width: 100%; min-height: 3.25rem; padding: .7rem .85rem; background: #fff; border: 1px solid var(--border); border-radius: .4rem; font: inherit; }
input:hover { border-color: #8293a2; }
button { width: 100%; min-height: 3.25rem; margin-top: .25rem; padding: .75rem 1rem; color: #fff; background: var(--blue); border: 0; border-radius: .4rem; font: inherit; font-weight: 750; cursor: pointer; }
button:hover { background: var(--navy); }
.access-help { margin: 1.6rem 0 0; color: var(--muted); text-align: center; font-size: .9rem; }

.simple-page { display: grid; place-items: center; min-height: 100vh; padding: 1.25rem; background: var(--background); }
.simple-card { width: min(100%, 34rem); padding: clamp(2rem, 6vw, 4rem); background: #fff; border: 1px solid #dde4ea; border-radius: .75rem; box-shadow: 0 1.5rem 4rem rgb(8 43 72 / 8%); }
.simple-card .brand { margin-bottom: 4rem; }
.simple-card p:not(.eyebrow) { margin: 1.25rem 0; color: var(--muted); }
.text-link { display: inline-block; font-weight: 700; }
.public-authorise { background: linear-gradient(145deg, #edf3f7, #f8fafb); }
.public-shell { display: grid; place-items: center; min-height: 100vh; padding: clamp(1rem, 4vw, 3rem); }
.public-card { width: min(100%, 44rem); padding: clamp(2rem, 7vw, 5rem); background: #fff; border: 1px solid #dce5eb; border-radius: 1rem; box-shadow: 0 2rem 5rem rgb(8 43 72 / 10%); }
.public-card .brand { margin-bottom: clamp(3rem, 8vw, 6rem); }
.public-card h1 { max-width: 35rem; margin: 0; color: var(--navy-deep); font-size: clamp(2.25rem, 6vw, 4.2rem); line-height: 1.04; letter-spacing: -.045em; }
.public-form-card h1, .result-card h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.public-lead { max-width: 36rem; margin: 1.25rem 0 2rem; color: var(--muted); font-size: 1.1rem; }
.privacy-note { margin: 2rem 0; padding: 1rem 1.15rem; color: #174d38; background: #edf8f3; border-left: 4px solid var(--green); border-radius: .35rem; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: .75rem 1.35rem; color: #fff; background: var(--blue); border-radius: .4rem; font-weight: 750; text-decoration: none; }
.button-link:hover { color: #fff; background: var(--navy); }
.public-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 3rem 0 0; padding: 0; color: var(--muted); list-style: none; font-size: .88rem; }
.public-steps li { display: grid; gap: .5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.public-steps span { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; color: #fff; background: var(--blue); border-radius: 50%; font-weight: 800; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field-error { margin: .35rem 0 0; color: var(--error); font-size: .88rem; }
.submit-error { margin: 0 0 .75rem; padding: .75rem; background: #fff1f1; border-left: 4px solid var(--error); }
.result-icon { display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: 2rem; color: #fff; border-radius: 50%; font-size: 2rem; font-weight: 800; }
.success-icon { background: var(--green); }
.failure-icon { background: var(--blue); }
.support-reference { color: var(--muted); font-family: ui-monospace, monospace; font-size: .85rem; }
.app-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem; padding: .9rem clamp(1rem,4vw,3rem); background: #fff; border-bottom: 1px solid var(--border); }
.app-nav { display: flex; align-items: center; gap: 1.25rem; }
.app-nav a { font-weight: 700; text-decoration: none; }
.signed-in { display: flex; align-items: center; gap: 1rem; }
.signed-in > span { display: grid; text-align: right; }
.signed-in small, td small, dd small { display: block; color: var(--muted); font-size: .85rem; }
.signed-in form { margin: 0; }
button.button-quiet { width: auto; min-height: 2.5rem; margin: 0; padding: .45rem .8rem; color: var(--blue); background: #edf3f7; }
.console-main { width: min(94%, 90rem); margin: 2.5rem auto 5rem; }
.console-main > h1 { margin: 0; color: var(--navy-deep); font-size: clamp(2rem,4vw,3rem); }
.page-intro { margin: .75rem 0 2rem; color: var(--muted); }
.content-card, .filter-card, .empty-state { padding: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: .65rem; }
.home-entry { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-top: 2rem; }
.home-entry h2, .outcome-panel h2 { margin-top: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin: 0 0 1.5rem; }
.summary-grid > div { display: grid; gap: .25rem; padding: 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: .65rem; }
.summary-grid strong { color: var(--navy-deep); font-size: 1.8rem; }
.summary-grid span { color: var(--muted); }
.compact-summary { max-width: 48rem; margin-top: 1rem; grid-template-columns: repeat(3,1fr); }
.filter-card { margin-bottom: 1.5rem; }
.filter-grid { display: grid; grid-template-columns: 2fr repeat(4,1fr); gap: 1rem; }
.filter-card .field { margin-bottom: 0; }
.filter-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.filter-actions button { width: auto; min-width: 10rem; }
.authorisations-table { border: 1px solid var(--border); border-radius: .65rem; }
.authorisations-table th { white-space: nowrap; }
.authorisations-table td { vertical-align: top; }
.status-pill { display: inline-block; max-width: 14rem; padding: .25rem .55rem; color: var(--navy); background: #e8eef2; border-radius: 999px; font-size: .82rem; font-weight: 750; line-height: 1.25; }
.status-succeeded, .connection-connected { color: #174d38; background: #dff2e9; }
.status-failed, .status-exhausted, .connection-reauthorisation_required { color: #7d1d23; background: #fff1f1; }
.status-in_progress, .status-redirected, .status-callback_received { color: #0b4775; background: #e2f0fa; }
.status-expired, .connection-disabled { color: #4d5965; background: #e9edf0; }
.pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: var(--muted); }
.pagination div { display: flex; gap: 1rem; }
.empty-state { text-align: center; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin: 2rem 0; }
.detail-heading h1 { margin: 0; font-size: clamp(2rem,4vw,3rem); }
.outcome-panel { margin-bottom: 1.5rem; border-left: 4px solid var(--green); }
.detail-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; padding: 1px; background: var(--border); border-radius: .65rem; overflow: hidden; }
.detail-grid > div { padding: 1.1rem; background: #fff; }
dt { color: var(--muted); font-size: .85rem; font-weight: 700; }
dd { margin: .3rem 0 0; }
.attempt-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.attempt-grid article dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; }
.timeline { margin: 1rem 0 0; padding: 0 0 0 1.25rem; border-left: 2px solid #c9d8e2; list-style: none; }
.timeline li { position: relative; padding: 0 0 1.5rem 1.25rem; }
.timeline li::before { content: ""; position: absolute; left: -1.68rem; top: .35rem; width: .75rem; height: .75rem; background: var(--blue); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--blue); }
.timeline li > div { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.timeline strong { flex-basis: 100%; }
.timeline time, .timeline span, .timeline small { color: var(--muted); font-size: .88rem; }
.admin-page { min-height: 100vh; background: var(--background); }
.admin-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem clamp(1rem,4vw,3rem); background: #fff; border-bottom: 1px solid var(--border); }
.admin-main { width: min(94%, 80rem); margin: 3rem auto; }
.admin-main h1 { margin-top: 0; font-size: 2.5rem; }
.admin-grid { display: grid; grid-template-columns: minmax(16rem, 24rem) 1fr; gap: 3rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }

@media (max-width: 760px) {
  .auth-shell { display: block; min-height: 100vh; }
  .brand-panel { display: none; }
  .form-panel { min-height: 100vh; padding: 2rem max(1.25rem, 5vw); }
  .brand-mobile { display: inline-flex; }
  .admin-grid { grid-template-columns: 1fr; }
  .public-steps { grid-template-columns: 1fr; }
  .app-header { grid-template-columns: 1fr auto; gap: .75rem; }
  .app-nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; padding-top: .7rem; border-top: 1px solid var(--border); }
  .signed-in > span { display: none; }
  .summary-grid, .compact-summary, .detail-grid, .attempt-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .home-entry, .detail-heading, .pagination { align-items: flex-start; flex-direction: column; }
  .authorisations-table table, .authorisations-table thead, .authorisations-table tbody, .authorisations-table tr, .authorisations-table th, .authorisations-table td { display: block; }
  .authorisations-table thead { position: absolute; left: -10000px; }
  .authorisations-table tr { padding: 1rem; border-bottom: 1px solid var(--border); }
  .authorisations-table td { padding: .35rem 0; border: 0; }
}

@media (max-width: 340px) {
  .form-panel { padding-inline: 1rem; }
  .field-heading { align-items: flex-start; flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
