/* Davach Site Sign-In — shared styles. Light, high-contrast, built for a
   phone held outdoors: big type, big tap targets, no hover-only anything. */

:root {
  --ink: #1a2b30;
  --ink-2: #4d5c62;
  --ink-3: #74838a;
  --sliver: #a4bed0;
  --bg: #f1f4f6;
  --card: #ffffff;
  --line: #d5dce0;
  --ok: #17794a;
  --ok-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --bad: #a3231a;
  --bad-bg: #fdecea;
  --radius: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }

.top {
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--sliver);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.top svg { height: 30px; width: auto; flex: none; }
.top .name { font-weight: 700; letter-spacing: 0.18em; font-size: 13px; }
.top .spacer { flex: 1; }
.top .who { font-size: 14px; color: #d6e1e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top button {
  font: inherit; font-size: 14px; font-weight: 600; color: #fff; background: transparent;
  border: 1px solid #5d7279; border-radius: 8px; padding: 7px 12px; cursor: pointer; flex: none;
}

.wrap { max-width: 600px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.wrap.wide { max-width: 1000px; }

h1 { font-size: 26px; line-height: 1.15; margin: 0; }
h2 { font-size: 19px; margin: 26px 0 4px; }
h3 { font-size: 16px; margin: 0; }
p { margin: 6px 0; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.loading { color: var(--ink-2); padding: 30px 0; text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}

.site { padding: 4px 0 2px; }
.site .eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.site .project { color: var(--ink-2); margin-top: 2px; }

/* ---- forms ---- */
label { display: block; font-weight: 600; font-size: 15px; margin: 14px 0 5px; }
label:first-child { margin-top: 0; }
input[type="text"], input[type="tel"], input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 17px; /* 16px+ stops iOS zooming the page on focus */
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #aab6bc;
  border-radius: 10px;
  padding: 12px;
  min-height: 50px;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%231a2b30' stroke-width='2' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 38px;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid #5b9bd5;
  outline-offset: 1px;
}
input.invalid { border-color: var(--bad); background: #fffafa; }
.field-err { color: var(--bad); font-size: 14px; font-weight: 600; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 17px; line-height: 1.2;
  min-height: 50px; padding: 12px 18px;
  border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--ink); color: #fff;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 19px; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.quiet { background: transparent; color: var(--ink); border-color: #aab6bc; }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.sm { min-height: 40px; padding: 8px 12px; font-size: 15px; font-weight: 600; }
.btn:disabled, .btn.locked { background: #c5cfd4; border-color: #c5cfd4; color: #fff; }
.btn:disabled { cursor: default; }
.btn.ghost:disabled, .btn.quiet:disabled { background: #fff; color: #9aa7ad; border-color: var(--line); }
.linkbtn { font: inherit; color: var(--ink); background: none; border: 0; padding: 8px 0; text-decoration: underline; cursor: pointer; }

.note { border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.note.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid #f3b7b0; font-weight: 600; }
.note.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd492; }
.note.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #a9d8bd; }
.note.info { background: #e9f0f4; color: var(--ink); border: 1px solid #c5d3da; }

/* ---- the safety document list ---- */
.docs { list-style: none; margin: 10px 0 0; padding: 0; }
.doc {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 12px 12px 14px; margin: 8px 0;
}
.doc .tick {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #aab6bc; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: var(--ink-2);
}
.doc.done { border-color: #a9d8bd; background: #f6fbf8; }
.doc.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.doc .info { flex: 1; min-width: 0; }
.doc .title { font-weight: 700; overflow-wrap: anywhere; }
.doc .meta { font-size: 14px; color: var(--ink-2); }
.doc.done .meta { color: var(--ok); font-weight: 600; }
.progress { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.progress.done { color: var(--ok); }

.fine { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 14px; }

/* ---- the document reader ---- */
.reader {
  position: fixed; inset: 0; z-index: 50; background: #525c61;
  display: flex; flex-direction: column;
}
.reader-top {
  flex: none; background: var(--ink); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.reader-top .t { flex: 1; min-width: 0; }
.reader-top .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-top .t span { font-size: 14px; color: #d6e1e8; }
.reader-top button {
  flex: none; font: inherit; font-size: 15px; font-weight: 600; color: #fff; background: transparent;
  border: 1px solid #5d7279; border-radius: 8px; min-height: 42px; padding: 8px 12px; cursor: pointer;
}
.reader-scroll { flex: 1; position: relative; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pages { max-width: 900px; margin: 0 auto; padding: 8px; }
.reader.zoomed .pages { width: 210%; max-width: none; }
.pg { background: #fff; margin: 0 0 8px; position: relative; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pg img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.pg .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa7ad; font-size: 15px; }
.pg.failed .ph { color: var(--bad); font-weight: 600; padding: 20px; text-align: center; }
.end { color: #e6ecef; text-align: center; font-size: 14px; padding: 10px 0 16px; }
.reader-foot {
  flex: none; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}
.reader-foot .hint { font-size: 15px; color: var(--ink-2); text-align: center; margin: 0 0 8px; min-height: 21px; }
.reader-foot .hint.ready { color: var(--ok); font-weight: 700; }

/* ---- signed in ---- */
.signed {
  background: var(--ok); color: #fff; border-radius: var(--radius); padding: 18px 16px; margin: 12px 0;
}
.signed .big { font-size: 24px; font-weight: 800; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.signed .big svg { width: 30px; height: 30px; flex: none; }
.signed .who { font-size: 18px; font-weight: 700; margin-top: 10px; }
.signed .when { font-size: 16px; opacity: .95; }
.bulletin { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
.bulletin a { color: var(--ink); font-weight: 600; }
.card .stamp { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.card .tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }

/* ---- admin ---- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 8px; position: sticky; top: 0; z-index: 10; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit; font-weight: 700; font-size: 15px; color: var(--ink-2); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: 14px 8px 11px; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; min-width: 0; }
.row > .fit { flex: 0 0 auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.count { font-size: 30px; font-weight: 800; line-height: 1; }

.list { list-style: none; margin: 10px 0 0; padding: 0; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; }
.item .l1 { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.item .l1 b { overflow-wrap: anywhere; }
.item .time { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .l2 { color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; }
.item .l2 a { color: var(--ink); }
.item details { margin-top: 6px; font-size: 14px; }
.item summary { cursor: pointer; color: var(--ok); font-weight: 600; padding: 4px 0; }
.item summary.none { color: var(--warn); }
.item details ul { margin: 4px 0 0; padding-left: 20px; color: var(--ink-2); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: #e9f0f4; color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.off { background: #eceff1; color: var(--ink-3); }
.empty { text-align: center; color: var(--ink-2); padding: 26px 10px; }
.group { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin: 20px 0 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
.pin { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 30px; font-weight: 800; letter-spacing: 0.18em; }
.bar { height: 8px; background: #dfe6ea; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login input { text-align: center; font-size: 26px; letter-spacing: 0.25em; font-weight: 700; text-transform: uppercase; }

dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 20, 24, .55); }
dialog .dbody { padding: 18px 16px 16px; }
dialog h3 { font-size: 19px; margin-bottom: 4px; }
