:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142538;
  background: #f2f5f9;
  --ink: #142538;
  --muted: #536579;
  --line: #dce4ee;
  --navy: #102339;
  --accent: #1e56a3;
  --accent-dark: #134484;
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem .95rem;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
}
.button:hover { text-decoration: none; }
.primary { color: white; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.secondary { color: var(--ink); background: white; border-color: #c9d5e2; }
.secondary:hover { background: #f5f8fc; }
.danger { color: #9a2a25; background: #fff1ef; border-color: #efc7c4; }
.danger:hover { background: #ffe3e0; }
:focus-visible { outline: 3px solid #4387de; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.muted, .empty { color: var(--muted); }
.block { display: block; }
.inline { display: inline-block; }
.spaced { margin-top: 1.2rem; }
.mono, code, pre { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.mono { font-size: .85rem; }
.skip { position: absolute; z-index: 5; top: .5rem; left: .5rem; padding: .7rem 1rem; background: white; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  display: flex;
  flex-direction: column;
  align-self: start;
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 1.45rem 1.05rem 1rem;
  color: #ebf3fc;
  background: var(--navy);
}
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; font-weight: 750; font-size: 1.08rem; letter-spacing: -.015em; padding: 0 .4rem; }
.brand:hover { text-decoration: none; }
.brand-mark, .company-mark { width: 34px; height: 34px; display: grid; flex-shrink: 0; place-items: center; border-radius: 9px; }
.brand-mark { background: #4c86da; color: #101f32; font-size: 1.26rem; }
.company { display: flex; gap: .65rem; align-items: center; background: #1a334e; border-radius: 9px; padding: .6rem; margin: 2.1rem .15rem 1.6rem; min-width: 0; }
.company-mark { color: #bed5f7; background: #274664; }
.company small, .company strong { display: block; overflow-wrap: anywhere; }
.company small { color: #aebfd2; font-size: .72rem; margin-bottom: .18rem; }
.company strong { font-size: .85rem; }
.nav-label { padding: .05rem .62rem .55rem; color: #a8bed5; font-size: .74rem; font-weight: 650; }
.admin-label { margin-top: 1.55rem; }
nav a { display: flex; align-items: center; gap: .7rem; padding: .61rem .65rem; margin: .15rem 0; border-radius: 8px; color: #d1e1f3; font-size: .92rem; }
nav a span { width: 1rem; text-align: center; color: #a4bee0; }
nav a:hover, nav a[aria-current="page"] { background: #244364; text-decoration: none; color: #fff; }
nav a[aria-current="page"] { box-shadow: inset 3px 0 #6ca0ee; }
.sidebar-footer { border-top: 1px solid #29435d; margin-top: auto; padding: .86rem .5rem .3rem; overflow-wrap: anywhere; }
.sidebar-footer p { font-size: .86rem; font-weight: 650; }
.foot-links { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: .3rem; }
.foot-links a, .text-button { color: #bad1ed; font-size: .8rem; padding: 0; }
.text-button { min-height: 26px; background: transparent; font-weight: 400; border: 0; }
.text-button:hover { text-decoration: underline; }
.main-area { min-width: 0; }
.topbar { min-height: 64px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .55rem; padding: .8rem 2.3rem; background: #fff; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .89rem; }
.top-divider { color: #97a7b8; padding: 0 .55rem; }
.top-roles { display: flex; flex-wrap: wrap; gap: .25rem; }
.main { max-width: 1460px; padding: 2rem 2.3rem 3.2rem; margin: auto; min-width: 0; }
.page-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.55rem; }
.page-head h1 { font-size: clamp(1.7rem, 2.7vw, 2.24rem); letter-spacing: -.039em; line-height: 1.13; }
.page-head p { margin-top: .46rem; color: var(--muted); line-height: 1.45; }
.cards, .pair, .detail-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; align-items: stretch; }
.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-layout { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
.column { display: grid; gap: 1rem; min-width: 0; }
.metric, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; min-width: 0; box-shadow: 0 2px 5px #152b4a06; }
.metric { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding: 1.08rem 1.15rem; color: var(--ink); }
.metric:hover { text-decoration: none; border-color: #8db1df; }
.metric div > span { color: var(--muted); font-size: .87rem; font-weight: 650; display: block; margin-bottom: .4rem; }
.metric strong { font-size: 2.2rem; line-height: 1; letter-spacing: -.045em; }
.metric-icon { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px; border-radius: 9px; font-weight: 650; }
.blue { color: #184d95; background: #e9f2ff; }
.amber { color: #88511e; background: #fff1dd; }
.teal { color: #196459; background: #dff3eb; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .95rem 1.14rem; border-bottom: 1px solid #e8eef5; }
.panel-header h2 { font-size: 1rem; font-weight: 730; }
.panel-header a { font-size: .88rem; font-weight: 600; }
.panel-content { padding: 1rem 1.15rem; }
.panel-content p { line-height: 1.5; }
.distribution a { display: flex; justify-content: space-between; gap: .65rem; font-size: .91rem; color: var(--ink); }
.distribution meter { display: block; width: 100%; height: .7rem; margin: .3rem 0 .65rem; appearance: none; }
meter::-webkit-meter-bar { background: #e8eef6; border-radius: 12px; border: 0; }
meter::-webkit-meter-optimum-value { background: #3f77c2; border-radius: 12px; }
meter::-moz-meter-bar { background: #3f77c2; border-radius: 12px; }
.statuses meter::-webkit-meter-optimum-value { background: #33887c; }
.statuses meter::-moz-meter-bar { background: #33887c; }
.table-scroll { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; text-align: left; }
thead { background: #f7f9fc; color: #4b6075; }
thead th { font-weight: 650; white-space: nowrap; }
th, td { padding: .78rem 1.12rem; border-bottom: 1px solid #e9eef4; vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #f9fbfe; }
td small { margin-top: .19rem; }
th[scope="row"] { font-weight: 600; }
.record { color: #174d91; font-weight: 680; }
.pill { display: inline-flex; align-items: center; padding: .23rem .48rem; border-radius: 99px; font-size: .75rem; font-weight: 680; white-space: nowrap; }
.pill.neutral { background: #e9eff6; color: #344e69; }
.pill.pending_checker { color: #7b4d14; background: #fff1d9; }
.pill.pending_signer { color: #214e91; background: #e6effe; }
.pill.applied, .pill.success { color: #176250; background: #dcf3eb; }
.pill.rejected, .pill.denied { color: #9b3028; background: #fce9e7; }
.pill.invalidated { color: #5a4c70; background: #efe9f6; }

.form-panel { max-width: 770px; }
.form-stack { display: grid; gap: .95rem; }
.form-stack > button { justify-self: start; }
.form-grid, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-grid .wide { grid-column: 1 / -1; }
.filters { padding: 1rem 1.14rem; grid-template-columns: minmax(175px, 1.3fr) minmax(115px, .85fr) minmax(112px, .7fr) auto auto; align-items: end; }
.audit-filters { grid-template-columns: repeat(4, minmax(110px, 1fr)); }
.filters > button, .filters > a { width: max-content; }
label { display: grid; gap: .36rem; font-size: .88rem; font-weight: 620; }
input:not([type="checkbox"]), textarea, select {
  width: 100%; min-width: 0; padding: .59rem .65rem; min-height: 42px; background: #fff; color: var(--ink);
  border: 1px solid #bbc9da; border-radius: 7px; font-size: .95rem;
}
input::placeholder { color: #627387; }
textarea { resize: vertical; }
fieldset { margin: 0; padding: 0 0 .65rem; border: 0; border-bottom: 1px solid #e9eef4; min-width: 0; }
legend { padding: 0 0 .62rem; font-weight: 720; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: .37rem; }
.checks input { width: 17px; height: 17px; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .55rem; margin: 0 0 .95rem; }
.tabs a { color: #31485f; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .52rem .75rem; font-weight: 620; font-size: .86rem; }
.tabs a[aria-current="page"] { background: #dfeeff; border-color: #b3cdeb; color: #154787; }
.details { display: grid; grid-template-columns: minmax(105px, 25%) minmax(0,1fr); gap: .63rem 1rem; margin: 0; font-size: .94rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.timeline + .timeline { border-top: 1px solid #e9eef4; margin-top: .7rem; padding-top: .7rem; }
.timeline small { margin-top: .19rem; }
.timeline p { margin-top: .25rem; }
.notice, .error { padding: .72rem .95rem; border-radius: 8px; margin-bottom: .9rem; }
.notice { background: #e4f6ef; color: #1c5b48; border: 1px solid #b9dfd1; }
.error { background: #fff0ee; color: #822b26; border: 1px solid #e7b8b4; }
summary { cursor: pointer; color: var(--accent); }
pre { max-width: 24rem; white-space: pre-wrap; color: #334b63; background: #f0f4f9; padding: .55rem; border-radius: 7px; font-size: .76rem; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; min-height: 100vh; overflow: hidden; padding: min(6vw, 5rem); color: #fff; background: linear-gradient(145deg, #102339 12%, #183c67 100%); }
.auth-brand .brand { z-index: 1; padding: 0; }
.auth-copy { z-index: 1; margin-block: auto; max-width: 30rem; }
.auth-copy h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); letter-spacing: -.055em; line-height: 1; max-width: 9ch; }
.auth-copy p { margin-top: 1.2rem; max-width: 34ch; color: #c3d8f2; line-height: 1.5; font-size: 1.08rem; }
.auth-decoration { pointer-events: none; position: absolute; bottom: -12vw; right: -12vw; width: 42vw; height: 42vw; border: 1px solid #9ac5f944; border-radius: 30%; transform: rotate(-16deg); }
.auth-decoration i { position: absolute; inset: 10%; border-radius: inherit; border: inherit; }
.auth-decoration i:nth-child(2) { inset: 20%; }
.auth-decoration i:nth-child(3) { inset: 30%; }
.auth-panel { display: grid; place-items: center; padding: 2rem; }
.auth-card { width: min(100%, 440px); }
.auth-card h2 { font-size: 2rem; letter-spacing: -.04em; }
.auth-card p { margin: .55rem 0 1.6rem; line-height: 1.5; }
.auth-card .form-stack > button { width: 100%; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 203px minmax(0, 1fr); }
  .main, .topbar { padding-inline: 1.35rem; }
}
@media (max-width: 810px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; min-height: 0; padding: .85rem 1.1rem; gap: .66rem; }
  .company, .nav-label { display: none; }
  nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  nav a { padding: .44rem .48rem; font-size: .82rem; }
  .sidebar-footer { display: flex; justify-content: space-between; align-items: baseline; padding: .38rem .4rem 0; gap: .5rem; }
  .topbar { min-height: 47px; }
  .filters, .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 530px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 0; padding: 1.4rem; }
  .auth-copy h1 { font-size: 2.2rem; max-width: none; }
  .auth-copy p { font-size: .95rem; margin-top: .55rem; }
  .auth-panel { padding: 1.5rem 1.15rem 2.2rem; }
  .main, .topbar { padding-inline: 1rem; }
  .main { padding-top: 1.3rem; }
  .cards, .pair, .form-grid { grid-template-columns: 1fr; }
  .cards, .pair { gap: .65rem; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metric strong { font-size: 1.9rem; }
}
