/* Original palette and layout for this app. Not derived from any third-party design. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1d2433;
  --muted: #4f5a6b;
  --line: #d9dee7;
  --control-border: #667085;
  --control-border-hover: #515d70;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --accent-hover: #184c99;
  --ok: #1e6b43;
  --ok-bg: #e7f4ec;
  --warn: #7a4b00;
  --warn-bg: #fff4dc;
  --err: #a1262d;
  --err-bg: #fbe9ea;
  --info-bg: #e8f0fb;
  --focus: #0b57d0;
  --radius: 8px;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -3rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { top: .5rem; }
.ico { width: 20px; height: 20px; flex: none; }
.ico-wrap { display: inline-flex; }

/* Shell */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.brand { font-weight: 700; margin: 0; }
.brand-sub { color: var(--muted); font-size: .9rem; margin: -.75rem 0 0; }
.side ul { list-style: none; padding: 0; margin: 0; }
.navlink { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .5rem .7rem; border-radius: var(--radius); color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; width: 100%; text-align: left; cursor: pointer; }
.navlink:hover { background: var(--bg); }
.navlink[aria-current="page"] { background: var(--info-bg); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: .75rem; }
main { padding: 2rem clamp(1rem, 4vw, 3rem); max-width: 1100px; width: 100%; }
main:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.sub { color: var(--muted); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--control-border); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--control-border-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: progress; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.field { display: grid; gap: .35rem; margin: 0 0 1rem; border: 0; padding: 0; min-width: 0; }
.field.inline { display: inline-grid; margin: 0; }
label, legend { font-weight: 600; font-size: .95rem; }
input, select, textarea { font: inherit; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--control-border); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; max-width: 100%; }
textarea { min-height: 6rem; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 0 .4rem 0 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; min-height: 44px; font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--err); }
.field-error { color: var(--err); font-size: .9rem; margin: 0; }

/* Cards and content */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 4rem auto; }
.auth { padding: 1rem; }
.step { color: var(--muted); font-size: .9rem; margin: 0 0 .25rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { margin: 0; }
.stat-link { color: var(--ink); text-decoration: none; }
.stat-link:hover { border-color: var(--control-border-hover); }
.stat-label { color: var(--muted); margin: 0; font-size: .9rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin: .25rem 0 0; }
.plain { padding-left: 1.1rem; margin: 0; }
.data-status { display: flex; align-items: flex-start; gap: .5rem; color: var(--muted); font-size: .92rem; margin-bottom: 1rem; }
.data-status .ico { margin-top: 2px; }
.empty { background: var(--surface); border: 1px dashed #aab3c2; border-radius: 12px; padding: 2rem; text-align: center; color: var(--muted); }
.empty p { color: var(--ink); }
.loading .skeleton { height: 1rem; background: #e6e9ef; border-radius: 4px; margin: .6rem 0; width: 80%; }
.loading .skeleton.short { width: 45%; }

/* Banners: colour is paired with an icon and text */
.banner { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.banner p { margin: 0; }
.banner .btn { margin-top: .5rem; }
.banner-error { background: var(--err-bg); color: var(--err); border: 1px solid #efc2c5; }
.banner-info { background: var(--info-bg); color: var(--accent); }
.banner-error .ico, .banner-info .ico { color: currentColor; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table th { font-size: .85rem; color: var(--muted); background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.filters { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .btn { margin-bottom: 0; }
.chart { display: flex; align-items: flex-end; gap: .35rem; min-height: 180px; padding: 1rem .25rem .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.chart-col { flex: 1 0 18px; min-width: 18px; max-width: 52px; height: 145px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .35rem; }
.chart-bar { display: block; width: 70%; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.chart-bar.level-0 { height: 2%; }
.chart-bar.level-10 { height: 10%; }
.chart-bar.level-20 { height: 20%; }
.chart-bar.level-30 { height: 30%; }
.chart-bar.level-40 { height: 40%; }
.chart-bar.level-50 { height: 50%; }
.chart-bar.level-60 { height: 60%; }
.chart-bar.level-70 { height: 70%; }
.chart-bar.level-80 { height: 80%; }
.chart-bar.level-90 { height: 90%; }
.chart-bar.level-100 { height: 100%; }
.chart-label { color: var(--muted); font-size: .72rem; writing-mode: vertical-rl; transform: rotate(180deg); }

/* Narrow screens: navigation moves above the content, touch targets stay 44px */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: .75rem; }
  .side ul { display: flex; overflow-x: auto; gap: .25rem; }
  .side ul li { flex: none; }
  .side-foot { display: flex; gap: .5rem; border-top: 0; margin-top: 0; }
  .brand, .brand-sub { display: none; }
  main { padding: 1.25rem 1rem; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { display: block; border-bottom: 1px solid var(--line); }
  .table td { display: block; border: 0; padding: .3rem .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
