/* library.css: Kutubxona list/grid view, selection, delete. Loaded after extra.css. */
.l-sp { flex: 1 1 auto; }
.l-tools { align-items: center; gap: 8px; min-height: 36px; }
.l-all { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; color: var(--muted); font-size: .8125rem; }
.l-v-grid:not(.l-selmode) .l-all, .l-v-list .l-selbtn { display: none; }
.l-cb { width: 18px; height: 18px; margin: 0; accent-color: var(--amber); cursor: pointer; flex: none; }
.l-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.l-vbtn { min-width: 36px; min-height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; }
.l-vbtn + .l-vbtn { border-left: 1px solid var(--line); }
.l-vbtn.on { background: var(--pale); color: var(--gold-ink); }
.l-vbtn:focus-visible, .l-dots:focus-visible, .l-rthumb:focus-visible, .l-rname:focus-visible, .l-mi:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* checkbox wrapper + dots */
.l-chk { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; cursor: pointer; }
.l-dots { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--fg); font-size: 22px; line-height: 1; cursor: pointer; }
.l-dots:hover { background: rgba(26, 26, 26, .07); }

/* list */
.l-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.l-row, .l-lhead { display: grid; align-items: center; gap: 8px; grid-template-columns: 36px 46px minmax(0, 1fr) 36px; padding: 2px 4px 2px 0; }
.l-lhead { display: none; }
.l-row { border-top: 1px solid var(--line); min-height: 52px; }
.l-row:first-child, .l-lhead + .l-row { border-top: 0; }
.l-row:hover { background: #FAF9F6; }
.l-row.l-sel { background: var(--pale); }
.l-rthumb { width: 46px; height: 36px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #111; cursor: pointer; }
.l-rthumb .l-img { width: 100%; height: 100%; object-fit: cover; font-size: 10px; padding: 2px; overflow: hidden; }
.l-rmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }
.l-rname { max-width: 100%; padding: 0; border: 0; background: none; color: var(--fg); font-weight: 700; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-rsub { font-size: .75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-rnew { margin-top: 2px; }
.l-rtype, .l-rfrom, .l-rdate { display: none; }
@media (min-width: 760px) {
  .l-row, .l-lhead { grid-template-columns: 36px 50px minmax(0, 1fr) 140px 140px 140px 36px; }
  .l-lhead { display: grid; min-height: 34px; color: var(--muted); font-size: .75rem; font-weight: 600; border-bottom: 1px solid var(--line); }
  .l-lhead .l-h-n { grid-column: 3; }
  .l-rsub { display: none; }
  .l-rtype, .l-rfrom, .l-rdate { display: block; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .l-rdate, .l-rfrom { color: var(--muted); }
  .l-rthumb { width: 50px; height: 38px; }
}

/* grid cards */
.l-item { position: relative; }
.l-item .l-chk { position: absolute; top: 2px; left: 2px; z-index: 3; opacity: 0; transition: opacity .12s; }
.l-item .l-dots { position: absolute; top: 2px; right: 2px; z-index: 3; background: rgba(255, 255, 255, .85); }
.l-item .l-chk .l-cb { background: #fff; }
@media (hover: hover) { .l-item:hover .l-chk { opacity: 1; } }
.l-selmode .l-item .l-chk, .l-item .l-chk:focus-within { opacity: 1; }
.l-item.l-sel { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }
.l-kind { font-size: .75rem; }

/* sticky action bar */
.l-bar { position: sticky; z-index: 60; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border: 1px solid var(--amber); border-radius: 14px; box-shadow: var(--shadow); }
.l-bar[hidden] { display: none; }
.l-bar-n { font-weight: 700; }
@media (min-width: 1000px) { .l-bar { bottom: 16px; } }
@media (max-width: 460px) { .l-bar { padding: 8px; gap: 4px; } .l-bar .btn.small { padding: 0 10px; } .l-bar-n { font-size: .9rem; } }

/* menu */
.l-menu { position: fixed; z-index: 400; min-width: 170px; padding: 6px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(26,26,26,.18); }
.l-mi { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--fg); text-align: left; cursor: pointer; }
.l-mi:hover { background: var(--raise); }
.l-mi-del { color: var(--warn); }

/* confirm + undo */
.l-delwhat { font-weight: 700; overflow-wrap: anywhere; }
.l-dellist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
.btn.danger.l-del, .btn.danger.l-yes { background: #C0392B; border-color: #C0392B; color: #fff; font-weight: 700; }
.btn.danger.l-del:hover, .btn.danger.l-yes:hover { background: #A93226; }
.l-toasts { z-index: 310; }
.l-toast { display: flex; align-items: center; gap: 12px; }
.l-undo { background: var(--amber); border-color: var(--amber); color: #1A1A1A; font-weight: 700; }
/* keep toasts above the action bar */
body:has(.l-bar:not([hidden])) .toasts { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 76px); }
@media (min-width: 1000px) { body:has(.l-bar:not([hidden])) .toasts { bottom: 82px; } }

/* archive */
.l-ico { flex: none; vertical-align: -3px; }
.l-chip-arch { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.l-archnote { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--pale); color: var(--muted); font-size: .875rem; }
.l-archnote[hidden] { display: none; }
.l-mi { display: flex; align-items: center; gap: 8px; }
.btn.l-bar-arch { display: inline-flex; align-items: center; gap: 6px; }
.l-arch-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; text-align: center; color: var(--muted); }
.l-empty-t { font-weight: 700; color: var(--fg); }
@media (max-width: 460px) { .l-bar { flex-wrap: wrap; } .l-bar-n { flex: 1 0 100%; } .l-bar .l-sp { display: none; } }
