@font-face { font-family: 'Fredoka'; src: url('/fonts/Fredoka-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --blue: #4fa6c0; --blue-deep: #2a6f7d; --blue-soft: #e6f4f8;
  --yellow: #f2b33d; --yellow-soft: #fdf3dc;
  --red: #c9354b; --red-soft: #fbe7ea;
  --purple: #7c66aa; --purple-soft: #efebf7;
  --green: #3f8f5c; --green-soft: #e3f3e8;
  --ink: #1f3340; --muted: #5d6f78; --line: #dde7ea; --bg: #f5f9fa; --surface: #ffffff;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,51,64,.06), 0 4px 16px rgba(31,51,64,.06);
  --display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--blue-deep); margin: 0 0 .5rem; letter-spacing: .01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--blue-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { width: 100%; max-width: 200px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.nav a:hover { background: var(--blue-soft); }
.nav a.active { background: var(--blue); color: #fff; }
.nav .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.who { margin-top: auto; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.who strong { color: var(--ink); display: block; }
main { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 60px; max-width: 1200px; width: 100%; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea { max-width: 100%; min-width: 0; border: 1px solid #c7d6db; border-radius: 10px; padding: 10px 12px; background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(79,166,192,.35); outline-offset: 1px; border-color: var(--blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; font-weight: 700; cursor: pointer; background: var(--blue); color: #fff; text-decoration: none; }
.btn:hover { filter: brightness(.95); }
.btn.secondary { background: #fff; color: var(--blue-deep); border: 1.5px solid var(--blue); }
.btn.ghost { background: transparent; color: var(--blue-deep); padding: 8px 10px; min-height: 36px; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-top: 5px solid var(--blue); }
.card .k { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card .v { font-family: var(--display); font-size: 1.7rem; color: var(--ink); margin-top: 4px; }
.card.c2 { border-color: var(--purple); } .card.c3 { border-color: var(--green); } .card.c4 { border-color: var(--yellow); } .card.c5 { border-color: var(--red); }
.neg { color: var(--red) !important; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--blue-soft); color: var(--blue-deep); white-space: nowrap; }
.pill.outdoor { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--yellow-soft); color: #8a5a00; }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }
.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.banner.warn { background: var(--yellow-soft); color: #6d4700; }
.banner.bad { background: var(--red-soft); color: #8a1f30; }
.banner.ok { background: var(--green-soft); color: #23603b; }
.banner.info { background: var(--blue-soft); color: var(--blue-deep); }
.muted { color: var(--muted); font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.line-row { display: grid; grid-template-columns: minmax(0,2.2fr) minmax(0,1.2fr) auto minmax(0,1fr) auto; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.seg { display: inline-flex; border: 1.5px solid var(--blue); border-radius: 999px; overflow: hidden; min-height: 44px; }
.seg button { border: 0; background: #fff; padding: 8px 14px; font-weight: 700; color: var(--blue-deep); cursor: pointer; }
.seg button.on { background: var(--blue); color: #fff; }
.recon { font-weight: 700; padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.recon.ok { background: var(--green-soft); color: var(--green); } .recon.bad { background: var(--red-soft); color: var(--red); }
.policy-callout { background: var(--yellow-soft); border-left: 6px solid var(--yellow); padding: 14px 18px; border-radius: 10px; font-size: 1.1rem; margin: 12px 0 18px; }
.policy h2 { margin-top: 1.2rem; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; min-width: 0; border: 1.5px solid var(--blue); background: #fff; color: var(--blue-deep); border-radius: 12px; padding: 14px; font-weight: 700; font-family: var(--display); font-size: 1.05rem; cursor: pointer; }
.tabs button.on { background: var(--blue); color: #fff; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--blue); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--red); }
dialog { border: 0; border-radius: 16px; padding: 22px; max-width: 640px; width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(31,51,64,.45); }
.menu-btn { display: none; }
.order-lines { margin: 6px 0 0; padding: 0; list-style: none; font-size: .92rem; }
.order-lines li { padding: 2px 0; }
.empty { text-align: center; padding: 30px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .controls > label, .controls > .btn { flex: 1 1 140px; }
  .topbar > div:first-child { min-width: 0; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; position: sticky; top: 0; z-index: 30; width: 100%; justify-content: space-between; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .menu-btn img { height: 36px; }
  main { padding-top: 16px; }
  .line-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .line-row .desc { grid-column: 1 / -1; }
  .hide-sm { display: none; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack td { border: 0; padding: 4px 0; text-align: left !important; }
  table.stack td.num:empty { display: none; }
  .card .v { font-size: 1.4rem; }
}

/* sign-in screens */
body.signed-out .sidebar, body.signed-out .menu-btn { display: none; }
body.signed-out .layout { grid-template-columns: minmax(0, 1fr); }
body.signed-out main { max-width: none; }
.signin { max-width: 420px; margin: 6vh auto 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }
.signin .logo { width: 180px; max-width: 70%; display: block; margin: 0 auto 16px; }
.signin h1 { text-align: center; }
.signin > p.muted { text-align: center; }
.signin form { display: flex; flex-direction: column; gap: 12px; }
.signin input[type=password] { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.groups { border: 0; padding: 0; margin: 0 0 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.groups legend { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.groups button { border: 1.5px solid var(--blue); background: #fff; color: var(--blue-deep); border-radius: 12px; padding: 12px 8px; min-height: 48px; font-weight: 700; cursor: pointer; }
.groups button.on { background: var(--blue); color: #fff; }
.groups button:last-child:nth-child(odd) { grid-column: 1 / -1; }
[hidden] { display: none !important; }
