/* The kit stylesheet: classless base plus a few component classes.
   One file, no framework, no build step, no remote reference. */

:root {
  color-scheme: light dark;
  --bg: #ffffff; --fg: #1b1f24; --muted: #566170; --line: #c9d0d8; --card: #f3f5f8;
  --link: #0a58b0; --btn-bg: #0a58b0; --btn-fg: #ffffff; --warn: #9a5b00; --bad: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --fg: #e8ebef; --muted: #a3adba; --line: #3a424d; --card: #1e232a;
    --link: #8cb8f5; --btn-bg: #3b82e0; --btn-fg: #08111f; --warn: #e3b341; --bad: #ff8a80;
  }
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 42rem;
  padding: 1rem;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}

h1, h2, h3 { line-height: 1.25; margin: 1.5rem 0 0.75rem; }
h1 { font-size: 1.6rem; margin-top: 1rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p, ul, ol, form, table { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; }
li { margin: 0.25rem 0; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--card);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* forms: 16 px text (no zoom on iOS) and touch targets of 44 px and more */
label { display: inline-block; }
input, select, textarea, button { font: inherit; font-size: 1rem; color: inherit; }

input[type="text"], input[type="email"], input[type="search"], input[type="password"],
input[type="number"], select, textarea {
  min-height: 2.75rem;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; vertical-align: middle; }

button {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 0;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* tables scroll sideways inside the column on a narrow screen */
table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-weight: 600; white-space: nowrap; }

/* the navigation bar: a wrapping row of links, the current page marked */
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; list-style: none; margin: 0; padding: 0; }
nav li { margin: 0; }
nav form { margin: 0 0 0 auto; }

nav a {
  display: inline-block;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
}

nav a[aria-current] { background: var(--card); color: var(--fg); font-weight: 700; box-shadow: inset 0 -3px 0 var(--link); }

/* the status strip of the scan page: one card per condition, the glyph beside
   the label, the hint on its own line below it */
#scan-strip, ul.strip { list-style: none; margin: 0 0 1rem; padding: 0; }

#scan-strip li, ul.strip li {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  margin: 0 0 0.5rem;
  padding: 0.75rem;
  background: var(--card);
  border-left: 6px solid var(--warn);
  border-radius: 6px;
}

#scan-strip .glyph, ul.strip .glyph { grid-row: 1 / span 2; font-size: 1.5rem; line-height: 1.2; }
#scan-strip li > span:not(.glyph):not(.hint), ul.strip li > span:not(.glyph):not(.hint) { grid-column: 2; font-weight: 600; }
#scan-strip .hint, ul.strip .hint { grid-column: 2; font-size: 0.875rem; color: var(--muted); }

/* the photo button: a label that looks like a big button over a visually hidden file input */
.photo-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.photo-button:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }

/* not display:none: the input stays focusable and a test can still set its file */
.photo-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* a small pill, and the empty state */
.badge, .flag {
  display: inline-block;
  padding: 0.05rem 0.6rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}

.flag { color: var(--bad); border-color: var(--bad); }
.empty { padding: 1rem; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 6px; }

/* the assign page rows: each board or room is a link that is a touch target on the phone */
main[data-step] li > a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.25rem 0.5rem;
}

/* The desktop layout, from 900 px: the page uses the width and the controls are
   sized for a pointer. Up to 899 px the rules above are the whole sheet (the phone
   layout: the 42rem column and the 2.75rem targets). */
@media (min-width: 900px) {
  body { max-width: 90rem; padding: 1rem 2rem; }

  input[type="text"], input[type="email"], input[type="search"], input[type="password"],
  input[type="number"], select, textarea { min-height: 2rem; max-width: 36rem; padding: 0.2rem 0.5rem; }
  button { min-height: 2rem; min-width: 2rem; padding: 0.2rem 0.9rem; }
  nav a { min-height: 2rem; min-width: 2rem; padding: 0.25rem 0.75rem; }
  main[data-step] li > a { min-height: 2rem; }
  .photo-button { min-height: 2.5rem; width: auto; display: inline-flex; padding: 0.4rem 1rem; font-size: 1rem; }

  table { display: table; width: 100%; overflow-x: visible; }
  th { white-space: normal; }

  /* Boards and Places: one wrapper, the list on the left and the form on the right */
  .split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); column-gap: 2rem; align-items: start; }
  .split > * { grid-column: 2; }
  .split > table, .split > ul.boards, .split > .empty { grid-column: 1; grid-row: 1 / span 40; }
  .split > h2:first-child { margin-top: 0; }
}
