/* Read — styles copied from Yenush's design canvas ("Book Sharing Logo").
   Fredoka, thick navy outlines, pill buttons with a solid drop edge, cream paper. */

:root {
  --cream: #FFFDF6;
  --navy: #1E2A4A;
  --blue: #2B59C3;
  --green: #1F7A4D;
  --orange: #C2410C;
  --yellow: #FFC93C;
  --grey: #5A6275;
  --note: #FFF1C2;
  --mint: #D6EFE1;
  --line: #E3DCC8;
  --error: #B42318;
  --warn: #9A3412;
  --font: "Fredoka", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.35;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- the phone-sized screen ---------- */

.screen {
  position: relative;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.screen > * { position: relative; z-index: 1; }

.home { padding-top: 36px; gap: 28px; overflow: hidden; }
.home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("doodles.png") center / cover no-repeat;
  opacity: 0.45;
  pointer-events: none;
}

.loading { padding: 60px 20px; text-align: center; color: var(--grey); }

.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.title { font-size: 30px; font-weight: 700; line-height: 1.1; }
.sub { font-size: 17px; font-weight: 500; color: var(--grey); }

.head { display: flex; align-items: center; gap: 14px; }
.head-split { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* ---------- buttons ---------- */

.round {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 48px; height: 48px;
  border: 3px solid var(--navy); border-radius: 999px;
  background: #fff; color: var(--navy);
  box-shadow: 0 4px 0 var(--navy);
}

.pill {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 22px;
  border: 3px solid var(--navy); border-radius: 999px;
  background: #fff; color: var(--navy);
  font-family: inherit; font-size: 19px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 5px 0 var(--navy);
}
.pill:hover { color: var(--navy); }
.pill:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy); }
.pill:disabled { cursor: not-allowed; opacity: 0.6; }
.pill-yellow { background: var(--yellow); }
.pill-white { background: #fff; }
.pill-wide { width: 100%; height: 58px; font-size: 21px; font-weight: 700; }
.pill-sm { height: 44px; padding: 0 16px; font-size: 16px; box-shadow: 0 3px 0 var(--navy); }
.pill-green { background: var(--green); color: #fff; }
.pill-blue { background: var(--blue); color: #fff; }
.pill-orange { background: var(--orange); color: #fff; }
.pill-green:hover, .pill-blue:hover, .pill-orange:hover { color: #fff; }
.pill-grey { background: var(--line); color: var(--grey); }
.pill-huge { width: 100%; height: 84px; font-size: 26px; font-weight: 700; box-shadow: 0 6px 0 var(--navy); }

.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; }

.nav { display: flex; flex-direction: column; gap: 16px; }
.nav .pill {
  justify-content: flex-start; gap: 14px;
  width: 100%; height: 64px; padding: 0 22px; font-size: 21px;
}

.link {
  appearance: none; background: none; border: 0; padding: 0;
  min-height: 44px; display: inline-flex; align-items: center;
  font-family: inherit; font-size: 17px; font-weight: 600;
  color: var(--blue); text-decoration: underline; cursor: pointer;
}
.link-quiet { color: var(--grey); font-size: 15px; }
.center { align-self: center; }

/* ---------- forms ---------- */

.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 17px; font-weight: 600; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }

input, select, textarea {
  width: 100%; height: 52px;
  padding: 0 14px;
  border: 3px solid var(--navy); border-radius: 16px;
  background: #fff; color: var(--navy);
  font-family: inherit; font-size: 18px;
  box-shadow: 0 3px 0 var(--navy);
}
input[readonly] { background: #F6F2E6; }
textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
input::placeholder { color: #8A90A0; }
select { appearance: none; -webkit-appearance: none; padding-right: 46px; }
.select { position: relative; }
.select .icon { position: absolute; right: 16px; top: 15px; pointer-events: none; }
.with-button { position: relative; }
.with-button input { padding-right: 58px; }
.with-button .eye {
  position: absolute; top: 4px; right: 4px;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: transparent; color: var(--navy); cursor: pointer;
}
.isbn-row { display: flex; gap: 10px; }
.isbn-row input { flex: 1; min-width: 0; }
.isbn-row .pill { height: 52px; flex-shrink: 0; }

.error { font-size: 16px; font-weight: 600; color: var(--error); }

.section { display: flex; flex-direction: column; gap: 12px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; }
.dot { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--navy); border-radius: 999px; }
.dot-blue { background: var(--blue); }
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-yellow { background: var(--yellow); }

/* ---------- boxes ---------- */

.note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--navy); border-radius: 16px;
  background: var(--note);
  font-size: 16px; font-weight: 500; line-height: 1.35;
}
.note-white { background: #fff; }
.note .icon { flex-shrink: 0; }
.note-stack { flex-direction: column; gap: 6px; }
.note h2 { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.ok {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 3px solid var(--navy); border-radius: 16px;
  background: var(--mint);
  font-size: 17px; font-weight: 600;
}

.card {
  border: 3px solid var(--navy); border-radius: 22px;
  background: #fff;
  box-shadow: 0 5px 0 var(--navy);
  overflow: hidden;
}

/* ---------- tables (the "charts") ---------- */

.chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart { width: 100%; border-collapse: collapse; font-size: 17px; }
.chart th {
  background: var(--yellow);
  border-bottom: 3px solid var(--navy);
  padding: 12px 14px;
  text-align: left; font-weight: 700; line-height: 1.15;
  white-space: nowrap;
}
.chart td {
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
  vertical-align: middle;
  background: #fff;
}
.chart tr:last-child td { border-bottom: 0; }
.chart .muted { color: var(--grey); }
.chart .sticky { position: sticky; left: 0; z-index: 1; border-right: 2px solid var(--line); }
.chart th.sticky { border-right: 2px solid var(--navy); background: var(--yellow); }
.chart .empty-row td { text-align: center; color: var(--grey); padding: 18px 14px; }
.wide-chart { min-width: 660px; }

.book-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.book-cell .title-btn {
  appearance: none; background: none; border: 0; padding: 0; text-align: left;
  font-family: inherit; font-size: 17px; font-weight: 600; color: var(--navy);
  cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.owner-line { display: block; font-size: 14px; color: var(--grey); font-weight: 500; }
.thumb {
  flex-shrink: 0; width: 36px; height: 48px; object-fit: cover;
  border: 2px solid var(--navy); border-radius: 6px; background: var(--note);
}
.thumb-blank { display: flex; align-items: center; justify-content: center; color: var(--grey); }

.get {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 124px; height: 44px; padding: 0;
  border: 3px solid var(--navy); border-radius: 999px;
  font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 3px 0 var(--navy);
}
.get-request { background: var(--blue); color: #fff; }
.get-reserve { background: var(--orange); color: #fff; }
.get-done { background: #fff; color: var(--navy); }
.tag { font-size: 15px; font-weight: 600; color: var(--grey); white-space: nowrap; }
.late { color: var(--error); font-weight: 600; }
.queue { display: block; font-size: 13px; color: var(--grey); margin-top: 4px; text-align: center; }

.swipe { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--grey); }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.legend > div { display: flex; align-items: center; gap: 10px; }
.legend .dot { width: 18px; height: 18px; flex-shrink: 0; }
.legend .strong { font-weight: 600; }

/* swap tables on Borrow and return: two columns that fit a phone */
.chart-2 { table-layout: fixed; }
.chart-2 th { white-space: normal; width: 50%; }
.chart-2 td { overflow-wrap: anywhere; }
.who { font-weight: 600; }
.small { display: block; font-size: 14px; color: var(--grey); font-weight: 500; margin-top: 2px; }
.answers { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.answers .pill { height: 40px; padding: 0 14px; font-size: 15px; box-shadow: 0 3px 0 var(--navy); }
.answered { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; }
.answered-yes { color: var(--green); }

.messages { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li { list-style: none; padding-left: 0; }

/* photo picker */
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick input[type=file] { display: none; }
.photo-preview {
  width: 72px; height: 96px; flex-shrink: 0; object-fit: cover;
  border: 3px solid var(--navy); border-radius: 10px; background: var(--note);
}
.hint { font-size: 14px; color: var(--grey); }

/* ---------- admin page ---------- */

.people { display: flex; flex-direction: column; gap: 12px; }
.person {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
  border: 3px solid var(--navy); border-radius: 18px;
  background: #fff; box-shadow: 0 4px 0 var(--navy);
}
.person-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.person-name { font-size: 19px; font-weight: 700; }
.person-class { color: var(--grey); }
.status-ok { color: var(--green); font-weight: 600; }
.status-wait { color: var(--warn); font-weight: 600; }
.person .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.person .actions .pill { height: 42px; padding: 0 14px; font-size: 15px; box-shadow: 0 3px 0 var(--navy); }
.role {
  display: inline-block; margin-left: 6px; padding: 1px 10px;
  border: 2px solid var(--navy); border-radius: 999px;
  font-size: 13px; font-weight: 600; vertical-align: 2px;
}
.role-admin { background: #DCE6FB; }
.role-superadmin { background: var(--yellow); }
.signed-in { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.signed-in .chip {
  padding: 6px 14px; border: 3px solid var(--navy); border-radius: 999px; background: var(--yellow);
}

details.more { border: 3px solid var(--navy); border-radius: 18px; background: #fff; }
details.more > summary {
  cursor: pointer; list-style: none; padding: 14px 16px; font-size: 19px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary .icon { transform: rotate(180deg); }
details.more .inner { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.line-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 2px solid var(--line); }
.line-item:first-child { border-top: 0; }
.line-item .actions .pill { height: 40px; padding: 0 12px; font-size: 15px; box-shadow: 0 3px 0 var(--navy); }

.mother a { color: var(--navy); }

/* ---------- dialogs and toasts ---------- */

.dialog {
  border: 3px solid var(--navy); border-radius: 22px;
  padding: 22px;
  width: min(420px, calc(100vw - 32px));
  background: var(--cream); color: var(--navy);
  font-family: var(--font);
  box-shadow: 0 6px 0 var(--navy);
}
.dialog::backdrop { background: rgba(30, 42, 74, 0.5); }
.dialog-title { font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.dialog-text { font-size: 18px; margin-bottom: 18px; }
.dialog .field { margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.book-photo { display: block; width: 100%; max-height: 360px; object-fit: contain; border: 3px solid var(--navy); border-radius: 14px; background: #fff; margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; }
.facts dt { color: var(--grey); }
.facts dd { margin: 0; font-weight: 600; }

#toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(400px, calc(100vw - 32px)); z-index: 20;
}
.toast {
  padding: 12px 16px;
  border: 3px solid var(--navy); border-radius: 16px;
  background: var(--mint); color: var(--navy);
  font-size: 17px; font-weight: 600;
  box-shadow: 0 4px 0 var(--navy);
}
.toast-error { background: #FDE2DF; color: var(--error); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 0.2s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
}

/* spacing helpers (no inline styles, so the security policy can stay strict) */
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-22 { gap: 22px; }
.self-start { align-self: flex-start; }
.grow-1 { flex-grow: 1; }
.grow-14 { flex-grow: 1.4; }
