:root {
  color-scheme: light;
  --navy: #12344d;
  --blue: #17466c;
  --blue-light: #e8f1f8;
  --green: #13744a;
  --red: #a22c29;
  --amber: #8b5a00;
  --ink: #17212b;
  --muted: #596875;
  --line: #d7e0e8;
  --paper: #ffffff;
  --background: #f3f6f9;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); line-height: 1.5; }
a { color: var(--blue); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 20; background: white; padding: .7rem; }
.site-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .85rem max(1rem, calc((100% - 1100px)/2)); background: var(--navy); color: white; }
.site-header a { color: white; text-decoration: none; }
.brand { font-size: 1.15rem; font-weight: 750; margin-right: auto; }
nav { display: flex; gap: .35rem; flex-wrap: wrap; }
nav a, .link-button { padding: .45rem .65rem; border-radius: .35rem; }
nav a:hover, nav a:focus-visible, .link-button:hover { background: rgba(255,255,255,.14); }
.logout-form { margin: 0; }
.link-button { border: 0; background: none; color: white; font: inherit; cursor: pointer; }
.network-status { background: #fff0c7; color: #5f4100; padding: .65rem 1rem; text-align: center; font-weight: 650; }
.container { width: min(1100px, calc(100% - 2rem)); margin: 1.4rem auto 3rem; }
.page-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1rem; }
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 0 0 .5rem; font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.25rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; padding: clamp(1rem, 3vw, 1.5rem); box-shadow: 0 3px 14px rgba(20,50,70,.05); margin-bottom: 1rem; }
.narrow { max-width: 520px; margin: 2rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent; border-radius: .55rem; padding: .72rem 1rem; min-height: 44px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--blue); color: white; }
.button.danger { background: var(--red); color: white; }
.button.success { background: var(--green); color: white; }
.button.secondary { background: white; color: var(--blue); border-color: var(--blue); }
.button:disabled { opacity: .55; cursor: wait; }
.full { width: 100%; }
label { display: block; font-weight: 650; margin-bottom: .25rem; }
input, select, textarea { width: 100%; padding: .7rem; border: 1px solid #9eabb5; border-radius: .45rem; font: inherit; background: white; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #7ab8e8; outline-offset: 2px; }
.errorlist { color: var(--red); font-weight: 650; }
.helptext { display: block; color: var(--muted); font-size: .9rem; }
.messages { margin-bottom: 1rem; }
.message { padding: .8rem 1rem; border-radius: .5rem; background: var(--blue-light); }
.message.error { background: #fde8e7; color: #711b19; }
.message.success { background: #e5f5ed; color: #0f5938; }
.status { display: inline-flex; padding: .3rem .65rem; border-radius: 999px; font-weight: 750; background: var(--blue-light); }
.status.working, .status.approved, .status.confirmed { background: #dff5e9; color: #0f5938; }
.status.pending, .status.pause { background: #fff0c7; color: #624300; }
.status.rejected, .status.conflict { background: #fde8e7; color: #711b19; }
.big-action { width: 100%; min-height: 74px; font-size: 1.2rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .88rem; }
.metric { font-size: 1.65rem; font-weight: 800; }
.qr svg { display: block; width: min(300px, 100%); height: auto; margin: 1rem auto; }
.site-footer { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; padding: 1rem; color: var(--muted); font-size: .85rem; }
.hidden { display: none !important; }

@media (max-width: 700px) {
  .site-header { align-items: flex-start; }
  nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  nav a { white-space: nowrap; }
  .container { width: min(100% - 1rem, 1100px); margin-top: .7rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .card { border-radius: .55rem; }
}
