/* AIoli Labs brand tokens (brand/02-design-system/tokens.json in the aiolilabs repo): Paper and Terminal themes. */
@font-face { font-family: "Jost"; src: url("Jost-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #fdfcf8; --well: #f3f1ea; --ink: #0e0e0c; --muted: #5c5a52; --rule: #d9d6ca;
  --yellow: #ffd23f; --on-yellow: #0e0e0c; --link: #1b4fd8; --ok: #0f7a3d; --bad: #d8321f; --warn: #8a5a00; --focus: #1b4fd8;
  --display: "Jost", Futura, "Century Gothic", "Avenir Next", sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0c0c0b; --well: #161614; --ink: #f3f1ea; --muted: #a19e93; --rule: #262621;
    --link: #8ab4ff; --ok: #4ade80; --bad: #ff7a5c; --warn: #f5c451; --focus: #8ab4ff; }
}
.dark-only { display: none; }
@media (prefers-color-scheme: dark) { .dark-only { display: inline; } .light-only { display: none; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--ui); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 14px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 18px; }
.brand b { font-weight: 700; }
.brand .mark { width: 28px; height: auto; image-rendering: pixelated; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--ink); text-decoration: none; }
nav a:hover { text-decoration: underline; }
main { max-width: 1080px; margin: 0 auto; padding: 24px; }
body.narrow main { max-width: 440px; padding-top: 56px; }
.foot { max-width: 1080px; margin: 32px auto 24px; padding: 0 24px; color: var(--muted); font-size: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.flash { background: var(--well); border-left: 3px solid var(--ok); padding: 8px 12px; margin: 0 0 16px; }
.error { color: var(--bad); border-left: 3px solid var(--bad); padding: 6px 12px; margin: 12px 0; }
.okline { color: var(--ok); }
.dev { background: var(--yellow); color: var(--on-yellow); padding: 8px; word-break: break-all; }
.dev a { color: inherit; }
.crumbs { color: var(--muted); margin: 0 0 8px; }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=date], select {
  font: 15px var(--ui); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 8px 10px; min-height: 40px; width: 100%; }
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 1px var(--focus); }
button { font: 600 15px var(--ui); background: var(--ink); color: var(--paper); border: 0; border-radius: 4px; padding: 10px 18px;
  min-height: 40px; cursor: pointer; }
button:hover { opacity: 0.88; }
button.secondary { background: var(--well); color: var(--ink); border: 1px solid var(--rule); }
button.danger { background: none; color: var(--bad); border: 1px solid var(--bad); }
button.link { background: none; color: var(--link); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }
form.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 260px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 4px; width: 100%; }
.chip { flex-direction: row; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; border: 1px solid var(--rule); border-radius: 4px; padding: 8px 14px; min-height: 40px;
  color: var(--ink); font: 600 15px var(--mono); cursor: pointer; }
.chip input:checked + span { background: var(--yellow); color: var(--on-yellow); border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.entry { background: var(--well); border-radius: 6px; padding: 16px; margin-top: 12px; }
.entry .fields { display: grid; grid-template-columns: 170px 90px auto 1fr; gap: 12px; align-items: end; }
.entry button { margin-top: 12px; }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); min-height: 1.2em; }
.hint.bad { color: var(--bad); }
.danger-zone { margin-top: 32px; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; max-width: 820px; }

/* Meters */
.meters, .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0 8px; }
.meter { margin: 6px 0 12px; }
.meter-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter-text b { color: var(--ink); font: 600 13px var(--mono); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--well); overflow: hidden; display: block; margin-top: 4px; }
progress::-webkit-progress-bar { background: var(--well); }
progress::-webkit-progress-value { background: var(--ink); }
progress::-moz-progress-bar { background: var(--ink); }
.meter.over progress::-webkit-progress-value { background: var(--bad); }
.meter.over progress::-moz-progress-bar { background: var(--bad); }
.meter-note { color: var(--bad); font-size: 12px; margin-top: 2px; }
.card { border: 1px solid var(--rule); border-radius: 6px; padding: 16px; }
.card h2 { margin-top: 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px; border-bottom: 1px solid var(--ink); }
td { padding: 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tfoot td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 600; }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.day { white-space: nowrap; font-weight: 600; }
.desc { width: 45%; overflow-wrap: anywhere; }
.when { white-space: nowrap; font-size: 12px; color: var(--muted); }
.act { white-space: nowrap; text-align: right; }
.act form + form { margin-left: 12px; }
tr.empty td { color: var(--muted); padding: 4px 8px; }
tr.empty.weekend td { opacity: 0.6; }
tr.current td { background: var(--well); }
tr.flagged td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
tr.inactive td { color: var(--muted); }
table.compact { width: auto; min-width: 320px; }
.week-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 8px; }
.week-head h1, .week-head h2 { margin: 0; }
.nav-week { font-size: 20px; text-decoration: none; padding: 0 6px; }
.nav-week.off { color: var(--rule); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; border: 1px solid currentColor;
  white-space: nowrap; color: var(--muted); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.decide { margin: 20px 0; padding: 16px; border: 1px solid var(--rule); border-radius: 6px; }
.history { padding-left: 18px; font-size: 13px; }
.history li { margin: 4px 0; overflow-wrap: anywhere; }
.rules li { margin: 6px 0; }
.totals { display: flex; gap: 32px; flex-wrap: wrap; margin: 20px 0; }
.report-head { display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.report-head .mark { width: 40px; image-rendering: pixelated; }
.report-head h1 { margin: 0; }
.report-head p { margin: 2px 0 0; color: var(--muted); }

@media (max-width: 720px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; }
  .entry .fields { grid-template-columns: 1fr 1fr; }
  .entry .f-tag, .entry .f-desc { grid-column: 1 / -1; }
  .grid-form { grid-template-columns: 1fr; }
  table.entries thead { display: none; }
  table.entries tr { display: grid; grid-template-columns: auto auto auto 1fr; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  table.entries td { border: 0; padding: 2px 0; }
  table.entries td.desc, table.entries td.when, table.entries td.act { grid-column: 1 / -1; width: auto; text-align: left; }
  table.entries tfoot tr { display: flex; justify-content: space-between; }
  table.people, table.people tbody, table.people tr, table.people td { display: block; }
  table.people thead { display: none; }
  table.people tr { padding: 8px 0; border-bottom: 1px solid var(--rule); }
  table.people td { border: 0; padding: 2px 0; text-align: left; }
  table.compact { min-width: 0; width: 100%; }
}

@media print {
  :root { --paper: #fff; --well: #f3f1ea; --ink: #000; --muted: #444; --rule: #ccc; --link: #000; }
  .top, .foot, .noprint, .flash { display: none !important; }
  main { max-width: none; padding: 0; }
  body { font-size: 11px; }
  .dark-only { display: none !important; } .light-only { display: inline !important; }
  table { font-size: 11px; }
  tr { break-inside: avoid; }
  @page { margin: 14mm; }
}

/* Sign out sits in the nav and looks like its links; the report's toolbar centres its button. */
nav button.link { color: var(--ink); text-decoration: none; font: inherit; }
nav button.link:hover { text-decoration: underline; }
.noprint.row { align-items: center; }
