:root {
  color-scheme: light;
  --canvas: #f3f5f8;
  --ink: #17233c;
  --muted: #526179;
  --line: #dce3ed;
  --accent: #244ec9;
  --nav: #121b31;
  --paper: #fff;
  --radius: 12px;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
body.application { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, .button, input, select, textarea { font: inherit; }
button, .button {
  background: var(--paper); color: var(--ink); border: 1px solid #c9d3e2; border-radius: 7px;
  padding: .5rem .85rem; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 650; text-decoration: none; cursor: pointer; min-height: 40px;
}
button:hover, .button:hover { background: #edf2fb; }
button:disabled { cursor: wait; opacity: .6; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover { background: #173a9f; }
.danger { color: #a4263d; border-color: #e7b6c0; }
:focus-visible { outline: 3px solid #597cff; outline-offset: 3px; }
.sidebar { background: var(--nav); color: #f4f6fd; padding: 2rem 1rem 1.1rem; display: flex; flex-direction: column; min-width: 0; }
.brand { display: flex; align-items: center; gap: .75rem; font-size: 1.2rem; font-weight: 750; line-height: 1.1; text-decoration: none; color: inherit; }
.sidebar .brand { margin: 0 .45rem 2rem; }
.brand small { display: block; margin-top: .25rem; font-weight: 500; font-size: .75rem; color: inherit; opacity: .78; }
.mark { position: relative; display: block; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 9px; background: #355bdf; }
.mark::before { content: ""; position: absolute; inset: 12px 8px; border: 2px solid white; border-radius: 70% 70%; }
.mark::after { content: ""; position: absolute; inset: 15px; background: white; border-radius: 50%; }
.sidebar nav { display: grid; gap: .2rem; }
.sidebar nav a { color: #c9d4eb; text-decoration: none; border-radius: 7px; padding: .58rem .75rem; font-weight: 560; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { color: white; background: #233257; }
.sidebar nav a[aria-current] { box-shadow: inset 3px 0 #92a8ff; }
.nav-rule { border-top: 1px solid #35425e; margin: .7rem .75rem; }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: 1rem .3rem 0; margin-top: auto; overflow-wrap: anywhere; }
.account small { display: block; color: #aebdde; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #2e406c; }
.signout { background: transparent; color: white; border-color: #576583; }
.signout:hover { background: #2e406c; }
.main { width: min(100%, 1500px); padding: 2.4rem clamp(1.1rem, 3.8vw, 3.4rem) 3rem; }
.page-heading, .panel-heading, .section-heading, .actions, .form-actions, .pagination { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.page-heading, .panel-heading, .section-heading { justify-content: space-between; }
.page-heading { margin-bottom: 1.55rem; }
h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.65rem); line-height: 1.15; overflow-wrap: anywhere; letter-spacing: -.035em; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: .55rem 0 1rem; }
small, .muted, time { color: var(--muted); }
.metric-grid, .dashboard-grid, .detail-grid { display: grid; gap: 1rem; }
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); margin-bottom: 1rem; }
.metric, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.metric { padding: 1rem 1.05rem; }
.metric span { color: var(--muted); font-weight: 580; }
.metric strong { display: block; margin-top: .2rem; font-size: 1.85rem; font-variant-numeric: tabular-nums; }
.dashboard-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.wide { grid-column: 1 / -1; }
.panel-heading, .panel-body { padding: 1rem 1.15rem; }
.panel-heading { border-bottom: 1px solid var(--line); }
.panel-heading p { margin: 0; }
.panel-body form + form, .panel-body a + form, .panel-body dl + h2 { margin-top: 1rem; }
.activity { padding: 0; margin: 0; list-style: none; }
.activity li { display: flex; justify-content: space-between; align-items: baseline; gap: .65rem; padding: .65rem 1.15rem; flex-wrap: wrap; overflow-wrap: anywhere; }
.activity li + li { border-top: 1px solid var(--line); }
.activity.compact li { padding-inline: 0; }
.empty { padding: 1rem 1.15rem; color: var(--muted); margin: 0; }
.panel-body .empty { padding-inline: 0; }
.filter { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.filter label:first-child { flex: 1 1 210px; }
label { display: grid; gap: .28rem; font-weight: 600; }
label small { font-weight: 400; }
input, select, textarea {
  width: 100%; color: var(--ink); min-width: 0; background: #fff; padding: .5rem .65rem; border: 1px solid #b9c6d9;
  border-radius: 6px; min-height: 40px;
}
textarea { resize: vertical; }
form label + label { margin-top: .7rem; }
.filter label + label { margin-top: 0; }
label.checkbox { display: flex; align-items: center; }
label.checkbox input { width: 1.05rem; min-height: 1.05rem; accent-color: var(--accent); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; white-space: nowrap; }
th, td { padding: .7rem .95rem; text-align: left; }
th { background: #f2f5fa; color: var(--muted); }
td { border-top: 1px solid var(--line); }
th a { color: inherit; }
th[aria-sort] a::after { content: " ↑"; }
th[aria-sort="descending"] a::after { content: " ↓"; }
.status { display: inline-flex; border-radius: 99px; padding: .2rem .55rem; font-weight: 650; font-size: .78rem; }
.positive { color: #136443; background: #e0f6ea; }
.warning { color: #725215; background: #fff0cc; }
.pagination { justify-content: flex-end; padding: .85rem; }
.breadcrumbs { margin-bottom: .65rem; }
.editor { max-width: 760px; padding: 1.2rem; }
.form-actions { justify-content: flex-end; margin-top: 1.15rem; }
fieldset { border: 1px solid var(--line); border-radius: 7px; margin: .9rem 0; min-width: 0; }
legend { font-weight: 650; }
.grant-picker { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; }
.grant-picker label { flex: 1 1 190px; }
.grant .checkbox { margin-bottom: .4rem; }
dl { display: grid; grid-template-columns: minmax(112px, 1fr) minmax(0, 1.6fr); row-gap: .55rem; column-gap: .8rem; }
dt { color: var(--muted); }
dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
pre { margin: 0; white-space: pre-wrap; }
[data-feedback] { color: #8d2036; background: #fff1f4; border-radius: 6px; padding: .55rem; margin-top: .65rem; }
.secret-output { margin-top: .8rem; padding: .8rem; background: #ecf2ff; border: 1px solid #b6c7f7; border-radius: 7px; display: grid; justify-items: start; gap: .6rem; overflow-wrap: anywhere; }
.unauthenticated { display: grid; place-items: center; background: #e9eef8; }
.unauthenticated .main { width: min(100%, 525px); }
.login-panel { width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.4rem, 6vw, 2.4rem); box-shadow: 0 18px 48px #13295217; }
.login-panel h1 { margin: 1.3rem 0 1rem; font-size: 1.65rem; }
.login-panel button { margin-top: 1rem; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 900px) {
  body.application { grid-template-columns: 175px minmax(0, 1fr); }
  .dashboard-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 660px) {
  body.application { display: block; }
  .sidebar { padding: .85rem 1rem; }
  .sidebar .brand { margin: 0 0 .7rem; }
  .sidebar nav { display: flex; overflow: auto; padding: .2rem; }
  .sidebar nav a { white-space: nowrap; }
  .nav-rule { display: none; }
  .account { padding-top: .55rem; }
  .main { padding-top: 1.5rem; }
}
