/* Forge - bench styling.
   Written for a phone held in one hand, in a workshop, by someone whose other
   hand is holding a part. Big targets, high contrast, no dense tables, nothing
   that needs a hover. */

:root {
  color-scheme: light dark;
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #faf8f5;
  --ink: #1c1a17;
  --ink-soft: #5c564d;
  --line: #ddd7cd;
  --accent: #b4530a;
  --accent-ink: #ffffff;
  --ok: #256b3d;
  --ok-bg: #e4f2e8;
  --warn: #8a5a00;
  --warn-bg: #fbf0d8;
  --crit: #99241b;
  --crit-bg: #fbe4e1;
  --skip: #5c564d;
  --radius: 12px;
  --tap: 3rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --panel: #211f19;
    --panel-2: #2a271f;
    --ink: #f0ece3;
    --ink-soft: #b0a897;
    --line: #3b372d;
    --accent: #e07b28;
    --accent-ink: #17150f;
    --ok: #7bc48f;
    --ok-bg: #1d3226;
    --warn: #e0b357;
    --warn-bg: #33290f;
    --crit: #ef8478;
    --crit-bg: #3a1c18;
    --skip: #b0a897;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; letter-spacing: .02em; color: var(--ink); text-decoration: none;
                    display: inline-flex; align-items: center; gap: .45rem; }
/* The mark takes currentColor from the link, so it follows the theme. */
header.top .brandmark { flex: 0 0 auto; }
header.top .crumb { color: var(--ink-soft); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 1rem; max-width: 46rem; margin: 0 auto 5rem; }

h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
p  { margin: .5rem 0; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: .75rem 0;
}
.card.tight { padding: .75rem; }

.stack > * + * { margin-top: .6rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.grow { flex: 1 1 8rem; }

/* Controls: nothing smaller than a thumb. */
.btn, button, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: 0 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none;
  cursor: pointer;
}
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.wide, button.wide { width: 100%; }
.btn.big, button.big { min-height: 3.75rem; font-size: 1.1rem; }
.btn.quiet, button.quiet { background: transparent; }
.btn.danger, button.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  min-height: var(--tap); width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--ink);
  font: inherit;
}
textarea { min-height: 5rem; resize: vertical; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .2rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin: .6rem 0; }
legend { font-size: .85rem; font-weight: 700; color: var(--ink-soft); padding: 0 .3rem; }
.field { margin-bottom: .6rem; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (max-width: 30rem) { .fields-2 { grid-template-columns: 1fr; } }

.checks { display: grid; gap: .3rem; max-height: 15rem; overflow: auto; padding: .3rem; border: 1px solid var(--line); border-radius: var(--radius); }
.checks label { display: flex; gap: .5rem; align-items: center; font-weight: 400; color: var(--ink); margin: 0; min-height: 2.25rem; }
.checks input[type=checkbox] { width: 1.4rem; height: 1.4rem; min-height: 0; flex: 0 0 auto; }

/* Advisories: prominent, and never a block. */
.advisory { border-left: 5px solid var(--warn); background: var(--warn-bg); color: var(--ink); padding: .75rem .9rem; border-radius: var(--radius); margin: .6rem 0; }
.advisory.critical { border-left-color: var(--crit); background: var(--crit-bg); }
.advisory.info { border-left-color: var(--ink-soft); background: var(--panel-2); }
.advisory .label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.advisory strong { display: block; margin: .15rem 0; }

.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: var(--panel-2); color: var(--ink-soft); border: 1px solid var(--line); }
.pill.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.in_progress { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.skipped { background: transparent; color: var(--skip); }
.pill.failed, .pill.crit { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.pill.good { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.printed_unverified { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.bar { height: .5rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* Lists of things you tap. */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list a.item, .item {
  display: flex; align-items: center; gap: .7rem;
  min-height: 3.4rem; padding: .7rem .2rem;
  color: var(--ink); text-decoration: none;
}
.item .title { flex: 1; font-weight: 600; }
.item .meta { color: var(--ink-soft); font-size: .82rem; font-weight: 400; }
.item.done .title { color: var(--ink-soft); }
.item.skipped .title { color: var(--ink-soft); text-decoration: line-through; }

.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin: .5rem 0 0; }
.tabs a { flex: 0 0 auto; padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 600; }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.actions-bar {
  position: sticky; bottom: 0;
  display: grid; gap: .5rem;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  margin: 1.5rem -1rem 0;
  background: var(--panel); border-top: 1px solid var(--line);
}

details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: .6rem 0; }
details > summary { min-height: var(--tap); display: flex; align-items: center; padding: 0 .9rem; font-weight: 600; cursor: pointer; }
details > .body { padding: 0 .9rem .9rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .92rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }

.notice { border-radius: var(--radius); padding: .7rem .9rem; margin: .6rem 0; background: var(--panel-2); border: 1px solid var(--line); }
.notice.good { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.notice.bad { background: var(--crit-bg); border-color: transparent; color: var(--crit); }

.count { display: flex; align-items: center; gap: .5rem; }
.count .n { font-size: 1.6rem; font-weight: 800; min-width: 6rem; text-align: center; }
.count button { min-width: 4rem; font-size: 1.4rem; }

.empty { text-align: center; color: var(--ink-soft); padding: 2rem 1rem; }
code { background: var(--panel-2); padding: .1rem .3rem; border-radius: 4px; font-size: .88em; }
.body-text { white-space: pre-wrap; }

/* Sign-in, setup and the account pages. */
.authbox { max-width: 24rem; margin: 2rem auto; }
.authbox h1 { text-align: center; }
.code { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: flex; justify-content: center; padding: .8rem; background: #fff; border-radius: var(--radius); margin: .6rem 0; }
.qr svg { width: 100%; max-width: 13rem; height: auto; }

/* The account menu in the header. */
.usermenu { margin-left: auto; border: 0; background: transparent; }
.usermenu > summary {
  list-style: none; min-height: 2.4rem; width: 2.4rem; padding: 0;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; justify-content: center;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu .menu {
  position: absolute; right: 1rem; margin-top: .5rem; z-index: 30;
  min-width: 14rem; padding: .5rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.usermenu .menu a {
  display: flex; align-items: center; min-height: 2.75rem; padding: 0 .7rem;
  color: var(--ink); text-decoration: none; border-radius: 8px;
}
.usermenu .menu a:hover { background: var(--panel-2); }
.usermenu .menu-head {
  display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  padding: .3rem .7rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem;
  font-weight: 700;
}
.usermenu .menu form { margin-top: .3rem; }
