/* nustreads: My Books (?view=shelf). Goodreads' shelf table (SPEC §11) in the new tokens. Loads after app.css. */

.myb { --myb-row: #eeeeee; }
.myb .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons (SPEC §5, no pills): dark primary, outline secondary, text link */
.myb-btn { display: inline-flex; align-items: center; justify-content: center; height: var(--btn-h); padding: 0 20px; border: 0; border-radius: var(--r-ctl);
  background: var(--ink); color: #fff; font: var(--w-sans-bold) 16px var(--font-sans); white-space: nowrap; cursor: pointer; transition: background .2s ease-in-out; }
.myb-btn:hover { background: var(--ink-hover); text-decoration: none; }
.myb-btn:active { background: var(--ink-pressed); }
.myb-btn:disabled { background: var(--line-field); cursor: default; }
.myb-btn2 { display: inline-flex; align-items: center; justify-content: center; height: var(--btn-h); padding: 0 20px; border: 2px solid var(--line-btn2); border-radius: var(--r-ctl);
  background: transparent; color: var(--ink); font: var(--w-sans-bold) 16px var(--font-sans); white-space: nowrap; cursor: pointer; }
.myb-btn2:hover { background: var(--bg-hover); }
.myb-btn2.sm { height: 36px; padding: 0 14px; font-size: 14px; }
/* "Add a book": Goodreads' small secondary button, same height as the shelf search beside it */
.myb-btn2.myb-addbtn { height: 32px; padding: 0 12px; border-width: 1px; font-size: 14px; }
.myb-addbtn[aria-expanded="true"] { background: var(--bg-hover); }
.myb-btn:focus-visible, .myb-btn2:focus-visible, .myb-go:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.myb-link { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; font-weight: var(--w-sans-bold); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.myb-link:hover { text-decoration-thickness: 2px; }

/* title row: "My Books › Read (12)", search-in-shelf + Add a book at the right */
.myb-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 8px 0 16px; }
.myb-head h1 { font: var(--hw) 28px/38px var(--font-serif); color: var(--ink); }
.myb-crumb { font-weight: 400; }
.myb-crumb .sep { margin: 0 10px; color: var(--subdued); }
.myb-crumb b { font-weight: var(--hw); }
.myb-crumb .n { color: var(--subdued); font-weight: 400; }
.myb-tools { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.myb-filter-box { position: relative; display: block; width: 240px; }
.myb-filter { width: 100%; height: 32px; padding: 4px 30px 4px 8px; border: 1px solid var(--line-input); border-radius: var(--r-input); background: #fff;
  color: var(--ink); font: 14px/22px var(--font-sans); }
.myb-filter:focus { outline: none; box-shadow: var(--sh-input-focus); border-color: var(--line-field); }
.myb-filter-box svg { position: absolute; right: 7px; top: 7px; width: 18px; height: 18px; color: var(--ink); pointer-events: none; }
.myb-filter::-webkit-search-cancel-button { display: none; }
.myb-sortsel { display: none; }

/* left column: Bookshelves */
.myb-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; align-items: start; }
.myb-side h2 { font: var(--w-sans-bold) 14px/24px var(--font-sans); color: var(--ink); margin: 0 0 2px; letter-spacing: 0; }
.myb-side ul { list-style: none; margin: 0; padding: 0; }
.myb-side-watch { margin-top: 16px !important; padding-top: 16px !important; border-top: 1px solid var(--divider); }
.myb-shelf { border: 0; background: none; padding: 0; text-align: left; color: var(--ink); font: 14px/24px var(--font-sans); cursor: pointer; }
.myb-shelf:hover { text-decoration: underline; text-underline-offset: 2px; }
.myb-shelf .n { color: var(--subdued); }
.myb-shelf[aria-current="page"] { font-weight: var(--w-sans-bold); text-decoration: none; cursor: default; }
.myb-shelf .back { color: var(--green-text); font-weight: var(--w-sans-bold); }

/* the shelf table */
.myb-table { width: 100%; border-collapse: collapse; font: 14px/18px var(--font-sans); color: var(--ink); }
.myb-table th { text-align: left; font: var(--w-sans-bold) 12px/18px var(--font-sans); color: var(--subdued); padding: 12px 8px 6px 0; vertical-align: bottom;
  border-bottom: 2px solid var(--divider); white-space: nowrap; }
.myb-table td { padding: 8px 8px 8px 0; vertical-align: middle; border-bottom: 1px solid var(--myb-row); }
.myb-table tbody tr:hover { background: var(--bg-alt); }
.myb-table tr.busy { opacity: .55; }
.myb-table tr.flash { animation: myb-flash 2.2s ease-out; }
@keyframes myb-flash { 0%, 30% { background: color-mix(in srgb, var(--wtr) 16%, transparent); } 100% { background: transparent; } }
.myb-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 3px; }
.myb-sort:hover, .myb-sort.on { color: var(--ink); }
.myb-arrow { display: inline-block; min-width: 8px; }
.myb-table .c-cv { width: 50px; }
.myb-table .c-a { width: 150px; }
.myb-table .c-r { width: 100px; }
.myb-table .c-s { width: 148px; }
.myb-table .c-n { width: 130px; }
.myb-table .c-x { width: 28px; padding-right: 0; }
.myb .cv { width: 50px; filter: none; box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
.myb-table .cv { width: 40px; }
.myb .cv .ph { padding: 3px; }
.myb .cv .ph b { font-size: 8px; line-height: 1.2; -webkit-line-clamp: 5; word-break: normal; overflow-wrap: anywhere; hyphens: auto; }
.myb-table .cv .ph { padding: 2px; }
.myb-table .cv .ph b { font-size: 6px; }
.myb-table .t { font: var(--hw) 15px/19px var(--font-serif); color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.myb-table td.c-a { font-size: 14px; line-height: 18px; }
a.t:hover { text-decoration: underline; }
.myb-table td.c-t small { display: block; margin-top: 4px; color: var(--danger); font-size: 12px; }
.myb-table td.c-t small:empty { display: none; }
.myb-table .rater { font-size: 16px; }
.myb-table .rater button { width: 1.15em; height: 1.4em; }
/* NUST status: small grey text, green only when a copy is in */
.myb-table td.c-n { font-size: 13px; line-height: 17px; color: var(--subdued); }
.myb-st { color: var(--subdued); }
.myb-st:hover { text-decoration: underline; text-underline-offset: 2px; }
.myb-st.in { color: var(--green-text); font-weight: var(--w-sans-bold); }
.myb-table td.c-n small { display: block; color: var(--subdued); font-size: 12px; line-height: 16px; }
.myb-none { color: var(--subdued); }
.myb-table .myb-sel { height: 30px; padding: 0 22px 0 8px; font-size: 13px; background-position: right 8px center; background-size: 8px; }
.myb-sel { height: 32px; max-width: 100%; padding: 0 26px 0 10px; border: 1px solid var(--line-input); border-radius: var(--r-input); color: var(--ink); font: 14px var(--font-sans);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23707070'/%3E%3C/svg%3E") no-repeat right 9px center / 9px;
  appearance: none; -webkit-appearance: none; cursor: pointer; }
.myb-sel:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.myb-x { width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-ctl); background: none; color: var(--subdued); cursor: pointer; display: grid; place-items: center; opacity: 0; }
.myb-x svg { width: 14px; height: 14px; }
.myb-table tr:hover .myb-x, .myb-x:focus-visible { opacity: 1; }
.myb-x:hover { background: var(--bg-hover); color: var(--ink); }
@media (hover: none) { .myb-x { opacity: 1; } }
.myb-nomatch { margin: 16px 0; color: var(--ink-soft); font-size: 16px; }
.myb-more { margin: 20px 0 0; text-align: center; }

/* empty shelf + add a book */
.myb-empty { text-align: center; padding: 24px 0 8px; }
.myb-empty h2 { font: var(--hw) 20px/28px var(--font-serif); margin-bottom: 6px; }
.myb-empty p { margin: 0 auto; max-width: 52ch; color: var(--ink-soft); font-size: 16px; line-height: 22px; }
.myb-add { margin: 0 0 8px; padding: 0 0 24px; border-bottom: 1px solid var(--divider); }
.myb-add.lone { max-width: 724px; margin: 20px auto 24px; border-bottom: 0; }
.myb-add-h { display: flex; align-items: center; justify-content: space-between; }
.myb-add-h h2 { font: var(--hw) 20px/28px var(--font-serif); }
.myb-add-close { width: 36px; height: 36px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--subdued); font: 24px/1 var(--font-sans); cursor: pointer; }
.myb-add-close:hover { background: var(--bg-hover); color: var(--ink); }
.myb-add-lbl { display: block; margin: 4px 0 10px; font-size: 14px; color: var(--ink-soft); }
.myb-add-form { display: flex; align-items: center; height: 54px; padding: 4px 8px 4px 16px; background: #fff; border: 1px solid var(--line-field); border-radius: var(--r-ctl); }
.myb-add-form:focus-within { border-color: var(--ink-soft); box-shadow: var(--sh-input-focus); }
.myb-add-form input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--ink); font: 16px/23px var(--font-sans); }
.myb-add-form input::-webkit-search-cancel-button { cursor: pointer; }
.myb-go { flex: none; width: 34px; height: 34px; border: 0; border-radius: var(--r-ctl); background: var(--ink); color: #fff; display: grid; place-items: center; cursor: pointer; }
.myb-go:hover { background: var(--ink-hover); }
.myb-go svg { width: 18px; height: 18px; }
.myb-hits:not(:empty) { margin-top: 12px; }
.myb-hits .loading { min-height: 0; padding: 10px 0; justify-content: flex-start; }
.myb-hit { display: grid; grid-template-columns: 50px minmax(0, 1fr) 216px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.myb-hit:last-child { border-bottom: 0; }
.myb-hit .meta { min-width: 0; display: grid; gap: 1px; }
.myb-hit .t { font: var(--hw) 16px/22px var(--font-serif); color: var(--ink); }
.myb-hit .by { font-size: 14px; line-height: 18px; color: var(--ink); }
.myb-hit small { font-size: 14px; line-height: 18px; color: var(--subdued); }
.myb-hit small b { font-weight: var(--w-sans-bold); }
.myb-hit small b.in { color: var(--green-text); }
.myb-nohit { margin: 4px 0 0; color: var(--ink-soft); font-size: 16px; }
.myb-add-foot { margin: 14px 0 0; font-size: 14px; color: var(--ink-soft); }

/* manual form */
.myb-manual-box:not([hidden]) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }
.myb-manual { display: grid; gap: 14px; max-width: 520px; }
.myb-manual h3 { font: var(--hw) 16px/24px var(--font-serif); }
.myb-manual-sub { margin: -12px 0 0; font-size: 14px; color: var(--subdued); }
.myb-f { display: grid; gap: 4px; }
.myb-f label, .myb-f-l { font: var(--w-sans-bold) 14px/18px var(--font-sans); color: var(--ink); }
.myb-f .req { color: var(--subdued); }
.myb-f input { height: 40px; padding: 0 10px; border: 1px solid var(--line-field); border-radius: var(--r-input); background: #fff; color: var(--ink); font: 16px var(--font-sans); }
.myb-f input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.myb-f input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.myb-f input::placeholder { color: var(--disabled); }
.myb-f .myb-sel { height: 40px; font-size: 16px; }
.myb-f-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: end; }
.myb-f-rate { display: flex; align-items: center; gap: 10px; height: 40px; }
.myb-f-rate .rater button { font-size: 24px; }
.myb-rate-lbl { font-size: 14px; color: var(--subdued); }
.myb-f-end { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 4px; }
.myb-state { margin: 0; font-size: 14px; color: var(--ink-soft); }
.myb-state:empty { display: none; }
.myb-state.bad { color: var(--danger); }

/* Watching */
.myb-watch-intro { margin: 4px 0 8px; color: var(--ink-soft); font-size: 14px; }
.myb-w { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 8px; margin: 0 -8px; border-bottom: 1px solid var(--myb-row); }
.myb-w.back { background: color-mix(in srgb, var(--wtr) 9%, transparent); }
.myb-w .t { font: var(--hw) 16px/22px var(--font-serif); color: var(--ink); }
.myb-w p { margin: 2px 0 0; font-size: 14px; color: var(--subdued); }
.myb-w.back p b { color: var(--green-text); font-weight: var(--w-sans-bold); }

/* signed out */
.myb-pitch { max-width: 560px; padding: 8px 0 24px; }
.myb-pitch h2 { font: var(--hw) 20px/28px var(--font-serif); margin-bottom: 8px; }
.myb-pitch ul { margin: 0 0 20px; padding-left: 20px; font-size: 16px; line-height: 26px; color: var(--ink); }
.myb-pitch-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.myb-pitch-key { font-weight: 600; }

/* phone: Goodreads collapses the table to rows (SPEC §11, §14) */
@media (max-width: 767px) {
  .myb-head { padding: 0 0 12px; gap: 12px; }
  .myb-head h1 { font-size: 24px; line-height: 32px; flex: 1 1 100%; }
  .myb-tools { margin-left: 0; flex: 1 1 100%; }
  .myb-filter-box { flex: 1 1 100%; width: auto; }
  .myb-tools { flex-wrap: nowrap; gap: 8px; }
  .myb-filter-box { flex: 1 1 auto; min-width: 0; }
  .myb-sortsel:not([hidden]) { display: block; flex: none; height: 32px; width: auto; padding: 0 22px 0 8px; font-size: 14px; background-position: right 8px center; background-size: 8px; }
  .myb-tools .myb-addbtn { flex: none; }
  .myb-filter { height: 32px; font-size: 16px; }
  .myb-filter-box svg { top: 7px; }
  .myb-layout { grid-template-columns: 1fr; gap: 4px; }
  /* shelf tabs: one row that scrolls sideways edge to edge, fading out at the right so it reads as more */
  .myb-side { display: flex; gap: 0 16px; overflow-x: auto; border-bottom: 1px solid var(--divider); scrollbar-width: none;
    margin-inline: calc((100% - 100vw) / 2); padding-inline: calc((100vw - 100%) / 2); scroll-padding-inline: calc((100vw - 100%) / 2);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .myb-side::-webkit-scrollbar { display: none; }
  .myb-side::after { content: ""; flex: 0 0 12px; }
  .myb-side h2 { display: none; }
  .myb-side ul { display: flex; gap: 16px; flex: none; }
  .myb-side-watch { margin: 0 !important; padding: 0 0 0 16px !important; border-top: 0; border-left: 1px solid var(--divider); align-self: center; line-height: 20px; }
  .myb-shelf { white-space: nowrap; line-height: 40px; }
  .myb-shelf[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ink); }
  .myb-table thead { display: none; }
  .myb-table, .myb-table tbody { display: block; }
  /* one dense row per book, like the reader compare list:
     cover | title (+ remove) / by author / stars · shelf · NUST status */
  .myb-table tr { display: grid; grid-template-columns: 40px auto auto minmax(0, 1fr) 24px; grid-template-rows: auto auto auto; column-gap: 8px;
    align-items: center; padding: 6px 0; border-bottom: 1px solid var(--myb-row); }
  .myb-table tbody tr:hover { background: none; }
  .myb-table td { display: block; width: auto !important; border: 0; padding: 0 !important; min-width: 0; }
  .myb-table td.c-cv { grid-column: 1; grid-row: 1 / span 3; align-self: start; margin-right: 2px; }
  .myb-table td.c-t { grid-column: 2 / 5; grid-row: 1; }
  .myb-table td.c-a { grid-column: 2 / 6; grid-row: 2; font-size: 13px; line-height: 17px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .myb-table td.c-a:not(:empty)::before { content: "by "; }
  .myb-table td.c-r { grid-column: 2; grid-row: 3; margin-top: 2px; }
  .myb-table .rater { font-size: 14px; }
  .myb-table td.c-s { grid-column: 3; grid-row: 3; margin-top: 2px; }
  /* status + copies detail stacked in the 26 px band beside the select */
  .myb-table td.c-n { grid-column: 4 / 6; grid-row: 3; margin-top: 2px; font-size: 12px; line-height: 13px; }
  .myb-table td.c-n > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .myb-table td.c-n small { font-size: 11px; line-height: 13px; }
  .myb-table td.c-x { grid-column: 5; grid-row: 1; align-self: start; justify-self: end; margin: -3px -4px -2px 0; }
  .myb-table .t { -webkit-line-clamp: 1; line-clamp: 1; }
  .myb-table td.c-t small { -webkit-line-clamp: none; }
  .myb-table .myb-sel { height: 26px; padding: 0 20px 0 6px; font-size: 12px; background-position: right 6px center; }
  .myb-x { width: 24px; height: 24px; }
  .myb-x { opacity: 1; }
  .myb-add.lone { margin-top: 12px; }
  .myb-hit { grid-template-columns: 50px minmax(0, 1fr); gap: 4px 12px; }
  .myb-hit .shelf-ctl { grid-column: 2; margin-top: 6px; }
  .myb-f-row { grid-template-columns: 1fr; }
  .myb-w { grid-template-columns: 50px minmax(0, 1fr); }
  .myb-w > button { grid-column: 2; justify-self: start; }
}
