/* Resources: reports, documents, keys, harvest, equipment, plot journal. Uses the tokens and shared patterns in app.css. */

/* One readable column for pages without a side panel */
.res-col { max-width: 760px; }
.res-col > .group + .group, .res-col > .card + .group { margin-top: 1.5rem; }

/* Card header: title left, small actions (CSV links, a chip) right; wraps under the title when narrow */
.res-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.res-card-head h2 { margin: 0; }
.res-csv { display: flex; align-items: baseline; gap: .25rem .85rem; flex-wrap: wrap; font-size: .875rem; }
.res-csv .quiet { font-size: .875rem; }

/* Reports: a grid of equal-standing cards; numbers first, then charts and tables */
.res-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.res-grid > .card + .card { margin-top: 0; }
.res-kv dd { color: var(--ink); }
.res-kv > div { padding-top: .4rem; padding-bottom: .4rem; font-size: .95rem; }
.res-kv > div:first-child { padding-top: 0; }
.res-num { font-variant-numeric: tabular-nums; }
.res-block { margin-top: 1.25rem; }
.res-block:first-child { margin-top: 0; }
.res-sub { font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); margin: 0 0 .5rem; }
.res-table { font-size: .9rem; }
.res-table td, .res-table th { padding-top: .45rem; padding-bottom: .45rem; }
.res-nowrap { white-space: nowrap; }
.res-after { margin-top: 1.5rem; }
.res-after > .group { margin: 0; }

/* Bar charts: label, bar, value on one line; stacks on phones */
.res-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.res-bars li { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr auto; align-items: center; gap: .6rem; font-size: .9rem; }
.res-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-bar-track { height: 10px; background: var(--fill-strong); border-radius: 999px; overflow: hidden; }
.res-bar { display: block; height: 100%; background: var(--tint); border-radius: 999px; }
.res-bar-value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3.5rem; text-align: end; }

/* Keys: one row per key; its hand-out / return form or history opens in a row underneath */
.res-keys td { vertical-align: middle; }
.res-keys .row-meta { white-space: nowrap; }
/* background-color, not the shorthand: the shorthand would wipe the select's chevron */
.res-inline-form input, .res-inline-form select, .res-inline-form button:not(.quiet) { background-color: var(--surface); }
.res-keys .res-form-row td { border-top: 0; padding-top: 0; background: none; }
.res-keys tbody tr.res-form-row:hover { background: none; }
.res-inline-form { display: grid; gap: .75rem 1rem; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr) auto; align-items: end;
  background: var(--fill); border-radius: var(--r-ctl); padding: .85rem 1rem; }
.res-inline-form[data-lend] { grid-template-columns: minmax(0, 2fr) minmax(8rem, 1fr) auto; }
.res-inline-form .form-error { grid-column: 1 / -1; }
.res-inline-form .form-error:empty { display: none; }
.res-inline-end { display: flex; align-items: center; gap: .9rem; }
.res-history { margin: 0; padding: .6rem 1rem .6rem 2rem; font-size: .875rem; color: var(--muted); background: var(--fill); border-radius: var(--r-ctl); }
.res-history li + li { margin-top: .2rem; }
.res-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Equipment: a card per tool; bookings, then the booking form on one line */
.res-tools > .res-tool + .res-tool { margin-top: 1rem; }
.res-tool-desc { margin: -.35rem 0 .75rem; }
.res-bookings { margin-bottom: .75rem; }
.res-past { margin-bottom: .5rem; }
.res-past > summary { font-size: .95rem; color: var(--muted); }
.res-return { display: flex; align-items: center; gap: .9rem; margin-top: .4rem; }
.res-return input { flex: 1 1 10rem; max-width: 18rem; min-height: 36px; padding: .35rem .6rem; font-size: .9rem; }
.res-book { display: grid; gap: .75rem 1rem; grid-template-columns: minmax(10rem, 1.3fr) repeat(2, minmax(7.75rem, 1fr)) auto; align-items: end;
  padding-top: .9rem; box-shadow: inset 0 .5px 0 var(--sep); margin: 0 -1.25rem; padding-inline-start: 1.25rem; padding-inline-end: 1.25rem; }
.res-book .form-error { grid-column: 1 / -1; }
.res-tool { container-type: inline-size; }
@container (max-width: 560px) {
  .res-book { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-book > div:first-child, .res-book-go { grid-column: 1 / -1; }
  .res-book-go button { width: 100%; min-height: 44px; }
}
.res-book .form-error:empty { display: none; }

/* Harvest log */
.res-figure-note { margin: -.5rem 1.25rem 1.5rem; }
.res-weight { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: .5rem; }
.res-pantry-form { margin-top: 1rem; padding-top: 1rem; box-shadow: inset 0 .5px 0 var(--sep); }

/* Plot journal */
.res-journal { display: grid; gap: .25rem; }
.res-journal-note { margin: .1rem 0 0; max-width: 65ch; }
.res-photo { margin-top: .5rem; border-radius: var(--r-ctl); max-height: 260px; width: auto; max-width: 100%; object-fit: cover; }
.res-frost { padding-top: 1rem; box-shadow: inset 0 .5px 0 var(--sep); margin: 0 -1.25rem; padding-inline-start: 1.25rem; padding-inline-end: 1.25rem; }

@media (max-width: 680px) {
  .res-inline-form, .res-inline-form[data-lend] { grid-template-columns: minmax(0, 1fr); }
  .res-save { width: 100%; min-height: 44px; }
}
@media (max-width: 560px) {
  .res-bars li { grid-template-columns: 1fr auto; }
  .res-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .res-return input { max-width: none; }
}

/* Home card: one line for the harvest, one for anything borrowed */
.res-home-line { margin: 0; }
.res-home-line + .res-home-line { margin-top: .35rem; }

/* Phones: one block per key (name and status, then holder, then actions), so nothing hides off to the side. */
@media (max-width: 560px) {
  .res-keys thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .res-keys, .res-keys tbody { display: block; }
  .res-keys tbody tr:not(.res-form-row) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .75rem; padding: .8rem 1.25rem; border-top: .5px solid var(--sep); }
  .res-keys tbody tr:first-child { border-top: 0; }
  .table.res-keys td { display: block; padding: 0; border: 0; width: auto; }
  .res-keys td:nth-child(2) { grid-row: 2; grid-column: 1; }
  .res-keys td:nth-child(3) { grid-row: 1; grid-column: 2; justify-self: end; }
  .res-keys td:nth-child(4) { grid-row: 2; grid-column: 2; align-self: end; }
  .res-keys .row-meta { white-space: normal; }
  .res-keys .row-actions button { min-height: 44px; }
  .res-keys tr.res-form-row:not([hidden]) { display: block; padding: 0 1.25rem .8rem; }
}

/* Phones: every row button in these pages is at least 40px tall */
@media (max-width: 600px) {
  .res-keys .row-actions button, .res-inline-end button, .res-csv .quiet, .res-return .quiet,
  .row-split > button.quiet:is([data-del], [data-delp], [data-cancel]) { min-height: 44px; display: inline-flex; align-items: center; }
  .ph-actions > a.quiet[href="#/fees/deposits"] { min-height: 40px; display: inline-flex; align-items: center; }
}

/* Admin search results (admin_shell.js): group headings and the row the arrow keys are on */
.srch-h { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: .7rem 1.25rem .25rem; }
.side-found .srch-h { padding: .6rem .75rem .2rem; }
.mg-list > li.srch-h + li .mg-row, .mg-list > li.srch-h + li .mg-row::before { box-shadow: none; }
.mg-list > li.srch-h + li .mg-row:has(.mg-icon)::before { display: none; }
.mg-list > li + li.srch-h { margin-top: .25rem; box-shadow: inset 0 .5px 0 var(--sep); }
.mg-row[aria-selected="true"] { background: var(--fill); }
@media (prefers-color-scheme: dark) { .mg-row[aria-selected="true"] { background: var(--fill-strong); } }

/* Documents: this season's paperwork, one row per document, last season's version flagged, older ones folded. */
.doc-season > li { padding-block: .65rem; }
.doc-kind { font-size: .8rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin-bottom: .15rem; }
.doc-versions { margin: 0; }
.doc-versions > li { padding: .15rem 0 !important; }
.doc-versions > li::before { display: none; }
.doc-behind { margin-inline-start: .35rem; }
.doc-older { margin-top: .1rem; }

/* Signing a document: two numbered steps (read it, then type your name), and the signed state. */
.doc-signed { font-size: .85rem; color: var(--muted); margin-top: .1rem; }
.doc-sign { min-height: 40px; display: inline-flex; align-items: center; }
.doc-count { text-decoration: none; white-space: nowrap; }
.sign-page { max-width: 36rem; }
.sign-step { display: flex; gap: .85rem; align-items: flex-start; }
.sign-step + .sign-step { padding-top: 1rem; box-shadow: inset 0 .5px 0 var(--sep); }
.sign-step h2 { font-size: 1.05rem; margin: .1rem 0 .55rem; }
.sign-num { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--tint); color: var(--tint-ink); font-weight: 600; font-size: .9rem; }
.sign-read { min-height: 44px; display: inline-flex; align-items: center; }
.sign-ok { font-size: 1.2rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .5rem; }
.sign-tick { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--tint); color: var(--tint-ink); font-size: 1rem; }
@media (max-width: 600px) {
  .sign-page .primary, .sign-done .btn { width: 100%; justify-content: center; }
  .sign-read { width: 100%; justify-content: center; }
}
