body.library-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-top: 85px; }
.library-page > .account-bar { top: 0; flex-shrink: 0; }
.library-page > .library-main { flex: 1 0 auto; min-height: 0; margin-top: 0; }
.library-main { justify-content: flex-start; }
.library-app { width: min(1120px, 100%); }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.library-heading h1, .library-heading h2 { margin: 0; color: var(--color1); overflow-wrap: anywhere; }
.library-heading p { margin-top: 8px; line-height: 1.4; color: #536174; }
.library-primary, .library-secondary, .library-danger { min-height: 48px; padding: 12px 16px; border-radius: 10px; cursor: pointer; }
.library-primary { background: var(--color1); color: white; }
.library-secondary { background: #e9e6f5; color: var(--color1); }
.library-danger { background: transparent; color: #a32d2d; margin-top: 16px; }
.library-status { line-height: 1.5; color: #536174; margin-bottom: 16px; }
.library-status:empty { display: none; }
.library-collections { display: flex; width: 100%; gap: 8px; overflow-x: auto; padding: 12px; margin-bottom: 20px; background: #f0eef8; border: 1px solid #e3deef; border-radius: 14px; }
.library-collections[hidden], .library-empty-notice[hidden] { display: none; }
.library-empty-notice { display: flex; align-items: flex-start; gap: 12px; padding: 18px; border: 1px solid #c8e8d7; border-radius: 14px; background: #edf8f1; color: #23704a; }
.library-empty-notice > svg { flex-shrink: 0; width: 22px; height: 22px; margin-top: 2px; }
.library-empty-notice h2 { margin: 0; font-size: 1rem; line-height: 1.4; color: #236342; }
.library-empty-notice p { margin: 6px 0 0; font-size: .9rem; line-height: 1.5; color: #426b53; }
.library-collections button { flex-shrink: 0; max-width: 240px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.library-collections button[aria-pressed="true"] { background: var(--color1); color: white; }
#collectionPanel { padding: 20px; border: 1px solid #e1e5ed; border-radius: 16px; background: #fff; }
.library-collection-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid #edf0f5; }
.library-collection-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.library-collection-name h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; color: var(--color1); }
.library-add-actions { display: flex; gap: 8px; flex-shrink: 0; }
.library-icon-button { display: grid; place-items: center; width: 48px; padding: 12px; font-size: 1.15rem; }
.library-icon-button svg, .library-settings svg { width: 20px; height: 20px; flex-shrink: 0; }
svg.library-chevron { width: 14px; height: 14px; flex-shrink: 0; }
.library-settings { position: relative; flex-shrink: 0; }
.library-settings summary { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 48px; min-height: 48px; border-radius: 10px; color: #62577e; cursor: pointer; }
.library-settings summary:hover, .library-settings[open] summary { background: #f0eef8; }
.library-settings summary, .library-disclosure summary { list-style: none; }
.library-settings summary::-webkit-details-marker, .library-disclosure summary::-webkit-details-marker { display: none; }
.library-chevron { font-size: .7rem; transition: transform .18s ease; }
details[open] > summary .library-chevron { transform: rotate(180deg); }
.library-settings-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 4; width: 210px; padding: 6px; background: white; border: 1px solid #e1e5ed; border-radius: 12px; box-shadow: 0 8px 24px #1720331a; }
.library-settings-menu button { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; text-align: left; background: transparent; }
.library-settings-menu button:hover { background: #f4f3f9; }
.library-disclosure { margin-top: 16px; border-top: 1px solid #e1e5ed; text-align: left; }
.library-disclosure summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; color: var(--color1); cursor: pointer; }
.library-disclosure .product-details { margin-top: 0; border-top: 0; }
summary:focus-visible { outline: 2px solid var(--color1); outline-offset: 3px; }
@media (min-width: 900px) { .library-products { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) {
    #collectionPanel { padding: 14px; }
    .library-collection-header { position: relative; flex-wrap: nowrap; gap: 8px; }
    .library-collection-name { flex: 1; gap: 4px; }
    .library-collection-name h2 { min-width: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .library-settings { position: static; }
    .library-settings summary { min-width: 34px; min-height: 44px; gap: 2px; }
    .library-settings svg { width: 18px; height: 18px; }
    .library-settings svg.library-chevron { width: 12px; height: 12px; }
    .library-settings-menu { left: 0; top: calc(100% - 8px); }
    .library-add-actions { gap: 4px; }
    .library-add-actions .library-icon-button { width: 44px; min-height: 44px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .library-chevron { transition: none; } }
.library-scan { width: 100%; margin-bottom: 8px; }
.library-products { display: grid; gap: 10px; margin-top: 20px; }
.library-product { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; border-bottom: 1px solid #e1e5ed; }
.library-product:last-child { border-bottom: 0; }
.library-page .library-products { grid-template-columns: 1fr; gap: 0; }
.library-import-products { max-height: 40dvh; overflow-y: auto; padding-left: 20px; margin-top: 16px; }
.library-import-products li { padding: 10px 0; border-bottom: 1px solid #e1e5ed; overflow-wrap: anywhere; }
.library-import-products small { display: block; color: #626b7a; margin-top: 4px; }
.library-product-description { min-width: 0; flex: 1; }
.library-product h3 { font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.library-product p { color: #626b7a; margin: 8px 0 12px; user-select: text; }
.library-product-actions { display: flex; gap: 6px; flex-shrink: 0; }
.library-product-code { display: flex; align-items: center; gap: 6px; }
.library-product-code svg, .library-product-actions svg { width: 20px; height: 20px; flex-shrink: 0; }
.library-product p.library-product-code { margin-bottom: 0; letter-spacing: .02em; font-size: .85rem; }
.library-view-code { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 10px 8px; }
.library-product-actions svg { width: 18px; height: 18px; }
.library-product-actions .library-remove-product { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 10px; background: #c92a38; color: white; }
.library-remove-product:hover { background: #a8212d; }
@media (max-width: 380px) { .library-product { gap: 8px; } .library-product h3 { font-size: .9rem; } .library-product p.library-product-code { font-size: .78rem; letter-spacing: 0; gap: 4px; } .library-product-code svg { width: 16px; height: 16px; } }
.library-product-actions .library-primary { flex: 1; }
.library-product-actions .library-danger { margin: 0; }
.library-dialog { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 0; border-radius: 18px; color: #172033; overflow-y: auto; }
.library-dialog::backdrop { background: rgba(12, 8, 32, .7); }
.library-confirm-dialog { width: min(440px, calc(100% - 24px)); }
.library-confirm-dialog p { margin-top: 16px; line-height: 1.5; overflow-wrap: anywhere; color: #536174; }
.library-dialog-actions .library-confirm-delete { margin: 0; background: #c92a38; color: white; }
.library-confirm-delete:hover { background: #a8212d; }
.library-dialog h2 { font-size: 1.25rem; }
.library-dialog label { display: block; margin: 16px 0; }
.library-dialog input, .library-dialog select { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 12px; border: 1px solid #b8bfd0; border-radius: 8px; background: white; font-size: 16px; user-select: text; }
.library-dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.library-dialog input[readonly] { background: #f4f3f9; color: #626b7a; border-color: #e1e5ed; }
.library-dialog [hidden] { display: none !important; }
.library-scanned-ean { margin: 16px 0; color: #626b7a; font-size: 1rem; letter-spacing: .04em; user-select: text; }
.library-save-card { padding: 18px; margin-top: 18px; border: 1px solid #e1e5ed; border-radius: 12px; background: #f8f9fc; }
.library-save-card .library-scanned-ean { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid #e1e5ed; }
.library-save-card label { margin: 12px 0; }
.library-save-card small { color: #626b7a; font-weight: 400; }
.library-save-hint { color: #626b7a; font-size: .85rem; line-height: 1.5; font-weight: 400; overflow-wrap: anywhere; }
.library-save-hint:empty { display: none; }
.library-save-hint button { display: flex; width: 44px; margin: 8px 8px 0 0; }
.library-save-hint .product-report-button { width: fit-content; max-width: 100%; padding: 10px 14px; gap: 8px; font-size: .85rem; }
@media (max-width: 360px) { .library-save-card { padding: 12px; } }
.library-dialog-actions button { flex: 1; }
.ean-navigation { gap: 10px; }
.ean-navigation button { min-width: 0; min-height: 48px; padding: 12px 16px; margin: 0; border-radius: 10px; font-size: .95rem; }
.ean-navigation button:disabled { opacity: .4; cursor: default; }
.library-ean-dialog { text-align: center; background: white; }
.library-ean-dialog label { text-align: left; }
#libraryBarcode { display: block; width: 100%; height: auto; margin: 20px auto 8px; }
#eanProductName { overflow-wrap: anywhere; }
#eanValue { font-size: 1.15rem; letter-spacing: .12em; user-select: text; }
#eanPosition { color: #626b7a; margin-top: 16px; }
.library-ean-swipe-area { touch-action: pan-y; }
.library-swipe-hint { color: #626b7a; font-size: .8rem; margin-top: 8px; }
.library-info-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.library-info-button svg { width: 20px; height: 20px; }
.library-preview-actions { display: flex; gap: 8px; margin-top: 16px; }
.library-preview-actions .library-info-button { flex: 1; min-width: 0; margin-top: 0; padding: 10px; font-size: .95rem; }
@media (max-width: 400px) {
  .library-preview-actions .library-info-button { gap: 6px; padding: 8px; font-size: .875rem; }
  .library-preview-actions .library-info-button svg { width: 18px; height: 18px; flex-shrink: 0; }
}
#libraryReader { width: 100%; }
body:has(.library-dialog[open]) { overflow: hidden; }
@media (max-width: 768px) {
    body.library-page { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
    .library-dialog { padding: 20px 16px; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
    .library-heading h1 { font-size: 1.6rem; }
    .library-heading h2 { font-size: 1.2rem; }
}

#newCollection,#generateLabels{background:#dce9ff;color:#234b8b;border:1px solid #b4cef4;box-shadow:0 2px 5px #234b8b12}#newCollection:hover,#generateLabels:hover{background:#cbdfff}#newCollection:focus-visible,#generateLabels:focus-visible{outline:2px solid #234b8b;outline-offset:3px}

#shareLibrary[hidden]{display:none}
.library-product p.library-catalog-name{font-size:.82rem;line-height:1.35;margin:3px 0 0;color:#626b7a;overflow-wrap:anywhere}.library-ean-swipe-area .library-catalog-name{font-size:.88rem;color:#626b7a;margin:4px 0 10px;overflow-wrap:anywhere}
