:root {
  --library-text: #17233a;
  --library-muted: #70819a;
  --library-border: rgba(148, 163, 184, .22);
  --library-panel: rgba(255, 255, 255, .86);
  --library-accent: #347ff0;
  --library-accent-soft: #edf5ff;
  --library-danger: #dc5d55;
}

body.mzpi-library-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #edf6fd 0%, #e8f2fb 52%, #eaf4fc 100%) !important;
  color: var(--library-text);
}

body.mzpi-library-page .gateway-footer { display: none !important; }
body.mzpi-library-page .mzpi-library > .library-heading { display: none !important; }

.mzpi-library {
  --library-main-height: clamp(700px, calc(100vh - 164px), 900px);
  width: min(1350px, calc(100vw - 340px));
  min-height: calc(100vh - 100px);
  margin-left: max(300px, calc(260px + (100vw - 1610px) / 2));
  padding: 100px 32px 64px;
}

.library-home { width: 100%; max-width: 1350px; min-height: var(--library-main-height); margin: 0 auto; }
.library-home__notice { margin-bottom: 14px; padding: 11px 15px; border-radius: 10px; background: #fff3e4; color: #a45d23; font-size: .84rem; }
.library-home__notice[hidden] { display: none; }
.library-home[hidden], .library-browser[hidden] { display: none !important; }
.library-home__hero { position: relative; overflow: hidden; min-height: 204px; padding: 28px 36px 22px; background: transparent; }
.library-home__title { position: relative; z-index: 1; display: flex; align-items: center; gap: 22px; }
.library-home__hero-icon { display: grid; place-items: center; flex: 0 0 88px; height: 88px; border-radius: 18px; background: #e1efff; color: #287df0; font-size: 3.2rem; }
.library-home__title h1 { margin: 0 0 5px; color: #17295a; font-size: clamp(1.6rem,2.5vw,2.15rem); }
.library-home__title p { margin: 0; color: #6c80a4; font-size: .95rem; }
.library-home__art { position: absolute; right: 5%; bottom: -28px; width: 240px; height: 190px; color: #9dc4ff; pointer-events: none; }
.library-home__art i { position: absolute; font-size: 6rem; filter: drop-shadow(0 8px 12px rgba(74,129,213,.18)); }
.library-home__art i:first-child { left: 37px; top: 15px; transform: rotate(-10deg); color: #fff; }
.library-home__art i:nth-child(2) { right: 22px; top: 6px; transform: rotate(8deg); color: #f8fbff; }
.library-home__art i:last-child { left: 33px; bottom: 2px; font-size: 9rem; color: #79adf8; }
.library-home__search { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: min(810px,calc(100% - 260px)); height: 50px; margin-top: 18px; padding: 4px 5px 4px 16px; border: 1px solid #dce8f7; border-radius: 12px; background: #fff; color: #3184f7; }
.library-home__search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #21365c; font: inherit; }
.library-home__search button { align-self: stretch; min-width: 100px; border: 0; border-radius: 9px; background: #287cf3; color: white; cursor: pointer; font: inherit; font-weight: 700; }
.library-home__entries { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin: 22px 0; }
.library-home__entry { display: flex; align-items: center; gap: 13px; min-height: 132px; padding: 16px; border: 0; border-radius: 17px; cursor: pointer; text-align: left; font: inherit; transition: transform .15s,box-shadow .15s; }
.library-home__entry:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(53,96,150,.1); }
.library-home__entry > span:nth-child(2) { display: grid; gap: 5px; min-width: 0; flex: 1; }
.library-home__entry strong { color: #172849; font-size: 1rem; }
.library-home__entry small,.library-home__entry em { overflow: hidden; color: #7486a3; font-size: .8rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.library-home__entry > i { color: #347ff0; }
.library-home__entry-icon { display: grid; place-items: center; flex: 0 0 58px; height: 58px; border-radius: 14px; background: rgba(255,255,255,.55); font-size: 1.9rem; }
.library-home__entry.is-public { background: #eaf9f5; } .library-home__entry.is-public .library-home__entry-icon { color: #efad27; }
.library-home__entry.is-personal { background: #dceaff; } .library-home__entry.is-personal .library-home__entry-icon { color: #2f83f5; }
.library-home__entry.is-temp { background: #f3edff; } .library-home__entry.is-temp .library-home__entry-icon { color: #9451ed; }
.library-home__entry.is-favorite { background: #fff6e9; } .library-home__entry.is-favorite .library-home__entry-icon { color: #f5a420; }
.library-home__lower { display: grid; grid-template-columns: minmax(0,2.4fr) minmax(260px,1fr); gap: 18px; }
.library-home__recent,.library-home__panel { border-radius: 17px; background: rgba(255,255,255,.92); box-shadow: 0 8px 22px rgba(54,85,130,.05); }
.library-home__recent { min-height: 310px; padding: 14px 20px 18px; }
.library-home__section-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e5edf8; }
.library-home__tabs { display: flex; gap: 20px; }
.library-home__tabs button,.library-home__more { padding: 12px 5px; border: 0; background: none; color: #6d80a1; cursor: pointer; font: inherit; font-weight: 700; }
.library-home__tabs button.is-active { border-bottom: 2px solid #2b83f7; color: #287cf3; }
.library-home__table-head,.library-home__row { display: grid; grid-template-columns: minmax(0,2fr) .65fr .65fr 40px; gap: 12px; align-items: center; }
.library-home__table-head { margin-top: 8px; padding: 9px 12px; border-radius: 8px; background: #f5f8fc; color: #8191ac; font-size: .78rem; }
.library-home__table-head span:last-child { white-space: nowrap; }
.library-home__row { width: 100%; min-height: 48px; padding: 7px 12px; border: 0; border-bottom: 1px solid #edf1f7; background: transparent; color: #7385a5; cursor: pointer; text-align: left; font: inherit; font-size: .83rem; }
.library-home__row:hover { background: #f5f9ff; }
.library-home__row-title { display: flex; align-items: center; min-width: 0; gap: 11px; color: #203253; font-weight: 650; }
.library-home__row-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-home__row-title i { color: #3183f4; font-size: 1.15rem; }
.library-home__no-files { padding: 28px 12px; color: #7f90a9; }
.library-home__aside { display: grid; align-content: start; gap: 15px; }
.library-home__panel { padding: 18px; } .library-home__panel h2 { margin: 0 0 14px; color: #1d2d4f; font-size: 1rem; }
.library-home__panel p { margin: 0; color: #7d8ca5; font-size: .84rem; line-height: 1.7; }
.library-home__quick { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.library-home__quick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 86px; border: 0; border-radius: 12px; background: #eef6ff; color: #3480e7; cursor: pointer; font: inherit; font-size: .76rem; }
.library-home__quick button:nth-child(2) { background: #eafaf6; color: #20ae91; } .library-home__quick button:nth-child(3) { background: #f4efff; color: #8c59d8; }
.library-home__quick i { font-size: 1.5rem; }
@media (max-width: 1250px) { .library-home__entries { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 850px) { .library-home__lower { grid-template-columns: 1fr; } .library-home__search { width: 100%; } .library-home__art { opacity: .2; } }
@media (max-width: 550px) { .library-home__hero { padding: 20px; } .library-home__hero-icon { flex-basis: 60px; height: 60px; font-size: 2.2rem; } .library-home__entries { gap: 10px; } .library-home__entry { min-height: 116px; padding: 12px; } .library-home__entry-icon { display: none; } .library-home__entry > i { display: none; } .library-home__tabs { gap: 8px; } .library-home__tabs button { font-size: .8rem; } .library-home__table-head,.library-home__row { grid-template-columns: minmax(0,1fr) 55px 40px; } .library-home__table-head span:nth-child(3),.library-home__row > span:nth-child(3) { display: none; } }

.library-browser {
  max-width: 1350px;
  margin: 0 auto;
}

.library-refresh,
.library-back,
.library-view-switch button,
.library-search button,
.library-error button,
.library-selection button,
.library-modal button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.library-refresh,
.library-back {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--library-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  color: #41536f;
  font-size: .82rem;
  font-weight: 700;
}

.library-refresh:hover,
.library-back:not(:disabled):hover {
  border-color: rgba(52, 127, 240, .32);
  background: #fff;
  color: var(--library-accent);
}

.library-back:disabled { cursor: not-allowed; opacity: .42; }

.library-browser {
  position: relative;
  min-width: 0;
  display: flex;
  width: 100%;
  height: var(--library-main-height);
  min-height: 0;
  flex-direction: column;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 18px;
  background: var(--library-panel);
  box-shadow: 0 12px 32px rgba(36, 70, 115, .07);
}

.library-browser__topline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
}

.library-breadcrumb {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.library-breadcrumb::-webkit-scrollbar { display: none; }

.library-breadcrumb button {
  flex: 0 0 auto;
  max-width: 180px;
  overflow: hidden;
  padding: 6px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--library-muted);
  cursor: pointer;
  font: inherit;
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-breadcrumb button:hover,
.library-breadcrumb button.is-current { background: var(--library-accent-soft); color: var(--library-accent); }
.library-breadcrumb i { flex: 0 0 auto; color: #a4b1c0; font-size: .62rem; }

.library-view-switch {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--library-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
}

.library-view-switch button {
  display: grid;
  width: 30px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: #8190a4;
}

.library-view-switch button.is-active { background: #e7f0ff; color: var(--library-accent); }

.library-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, 100%);
  min-height: 44px;
  margin: 18px 0 14px;
  padding: 0 6px 0 15px;
  border: 1px solid var(--library-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .78);
}

.library-search:focus-within { border-color: rgba(52, 127, 240, .42); box-shadow: 0 0 0 3px rgba(52, 127, 240, .09); }
.library-search > i { color: var(--library-accent); }
.library-search input { flex: 1 1 auto; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; color: var(--library-text); font: inherit; font-size: .88rem; }
.library-search input::placeholder { color: #95a3b6; }
.library-search button { flex: 0 0 auto; min-height: 32px; padding: 0 13px; border-radius: 8px; background: var(--library-accent); color: #fff; font-size: .78rem; font-weight: 700; }
.library-search button:hover { background: #216ae0; }

.library-directory-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 38px; margin: 0; }
.library-directory-actions:empty { display: none; }
.library-directory-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 11px; border: 1px solid rgba(52, 127, 240, .16); border-radius: 10px; background: #f4f8ff; color: #3974cc; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 700; }
.library-directory-actions button:hover { border-color: rgba(52, 127, 240, .36); background: #e8f1ff; }
.library-directory-actions button.is-active { border-color: rgba(52, 127, 240, .3); background: #e7f0ff; color: var(--library-accent); }
.library-directory-actions button i,
.library-refresh i,
.library-view-switch button i { display: inline-flex; align-items: center; line-height: 1; }

.library-notice { min-height: 0; margin: 0 0 12px; color: var(--library-muted); font-size: .82rem; }
.library-notice:empty { display: none; }
.library-notice.is-warning { color: #a36b0e; }

.library-loading,
.library-empty,
.library-error {
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 30px;
  color: var(--library-muted);
  text-align: center;
}

.library-loading {
  position: absolute;
  z-index: 2;
  inset: 110px 20px 20px;
  min-height: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.library-loading[hidden],
.library-empty[hidden],
.library-error[hidden],
.library-selection[hidden],
.library-modal[hidden],
.library-menu[hidden] { display: none !important; }

.library-loading i { color: var(--library-accent); animation: library-spin 1s linear infinite; }
.library-empty > i { color: #9db5d8; font-size: 2rem; }
.library-empty strong,
.library-error strong { color: var(--library-text); }
.library-error > i { color: #e09b53; font-size: 1.7rem; }
.library-error button { margin-top: 6px; padding: 8px 14px; border-radius: 9px; background: #eaf2ff; color: var(--library-accent); font-weight: 700; }

.library-items {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  scroll-behavior: auto;
  padding: 2px 4px 6px;
  scrollbar-color: rgba(112, 129, 154, .34) transparent;
  scrollbar-width: thin;
}

.library-items.is-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.library-items.is-list { grid-template-columns: 1fr; gap: 7px; }

.library-item {
  position: relative;
  display: flex;
  min-width: 0;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .62);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.library-items.is-grid .library-item { min-height: 122px; flex-direction: column; align-items: center; padding: 16px; border-radius: 14px; }
.library-items.is-list .library-item { align-items: center; min-height: 62px; padding: 10px 16px; border-radius: 11px; }
.library-item:hover,
.library-item.is-selected { border-color: rgba(52, 127, 240, .3); background: #fff; box-shadow: 0 7px 18px rgba(48, 82, 128, .08); }
.library-item:hover { transform: translateY(-1px); }

.library-item__icon { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: #edf4ff; color: #5e84c9; font-size: 1.3rem; }
.library-item.is-folder .library-item__icon { background: #fff4d8; color: #e9ab35; }
.library-item.is-image .library-item__icon { background: #e8f8f4; color: #38a987; }
.library-item.is-pdf .library-item__icon { background: #fff0f0; color: #dc6464; }
.library-item.is-office .library-item__icon { background: #ebf3ff; color: #4780df; }
.library-items.is-grid .library-item__icon { margin-bottom: 0; }
.library-items.is-grid .library-item.is-image .library-item__icon { width: 100%; height: 82px; }
.library-items.is-list .library-item__icon { margin-right: 12px; }

.library-item__content { min-width: 0; }
.library-items.is-grid .library-item__content { width: 100%; margin-top: 7px; text-align: center; }
.library-items.is-list .library-item__content { flex: 1 1 auto; }
.library-item__name { display: -webkit-box; overflow: hidden; color: var(--library-text); font-size: .9rem; font-weight: 700; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.library-items.is-list .library-item__name { -webkit-line-clamp: 1; }
.library-item__select { position: absolute; top: 10px; right: 10px; display: none; width: 22px; height: 22px; place-items: center; border: 1px solid #b7c5d7; border-radius: 50%; background: rgba(255, 255, 255, .92); color: transparent; font-size: .66rem; }
.library-items.is-selection-mode .library-item__select { display: grid; }
.library-item.is-selected .library-item__select { border-color: var(--library-accent); background: var(--library-accent); color: #fff; }
.library-selection {
  position: fixed;
  z-index: 180;
  right: max(28px, calc((100vw - 1350px) / 2));
  bottom: 24px;
  left: max(calc(var(--sidebar-width) + 28px), calc((100vw - 1350px + var(--sidebar-width)) / 2));
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 14px 10px 18px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 15px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 14px 34px rgba(28, 54, 90, .16);
  backdrop-filter: blur(12px);
}

.library-selection__file { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; gap: 9px; color: var(--library-text); font-size: .84rem; font-weight: 700; }
.library-selection__file i { color: var(--library-accent); }
.library-selection__file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-selection__actions { display: inline-flex; flex: 0 0 auto; gap: 8px; }
.library-selection__actions button { min-height: 34px; padding: 0 11px; border-radius: 9px; background: #edf4ff; color: var(--library-accent); font-size: .76rem; font-weight: 700; }
.library-selection__actions button:hover { background: #dceaff; }
.library-selection__close { display: grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: #f3f6fa; color: #8190a4; }

.library-modal { position: fixed; z-index: 3000; inset: 0; display: grid; place-items: center; padding: 28px; }
.library-modal__backdrop { position: absolute; inset: 0; background: rgba(8, 18, 34, .68); }
.library-modal__dialog { position: relative; z-index: 1; display: flex; width: min(960px, 100%); max-height: min(86vh, 900px); flex-direction: column; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, .34); }
.library-modal__dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid #edf0f5; }
.library-modal__dialog h2 { overflow: hidden; margin: 0; font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.library-modal__dialog header button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; background: #f2f5fa; color: #536276; }
.library-modal__dialog img { display: block; width: 100%; min-height: 0; object-fit: contain; }
.library-modal__dialog img[hidden],
.library-modal__dialog iframe[hidden] { display: none; }

.library-preview-modal { padding: 22px; }
.library-preview-modal__dialog { width: min(1120px, 100%); height: min(82vh, 820px); max-height: none; }
.library-preview-modal__dialog:fullscreen { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
.library-preview-modal__header { flex: 0 0 auto; }
.library-preview-modal__header > div:first-child { min-width: 0; }
.library-preview-modal__header p { margin: 0 0 4px; color: var(--library-muted); font-size: .72rem; font-weight: 700; }
.library-preview-modal__header h2 { max-width: min(720px, 64vw); }
.library-preview-modal__header-actions { display: inline-flex; flex: 0 0 auto; gap: 8px; }
.library-preview-modal__header-actions .library-preview-open { display: inline-flex; width: auto; min-width: 66px; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; font-size: .78rem; font-weight: 700; }
.library-preview-modal__header-actions .library-preview-image-control[hidden] { display: none; }
.library-preview-stage { position: relative; display: grid; flex: 1 1 auto; min-height: 0; place-items: center; overflow: auto; padding: 20px 20px 0; background: #eef2f6; }
.library-preview-stage img { max-width: 100%; max-height: 100%; transition: transform .2s ease; }
.library-preview-stage iframe { width: 100%; height: 100%; min-height: 420px; border: 0; background: #fff; transform-origin: top center; transition: transform .2s ease; }
.library-preview-stage #libraryFileViewer { width: 100%; height: 100%; min-height: 0; background: #fff; }
.library-preview-stage #libraryFileViewer flyfish-file-viewer { display: block; width: 100%; height: 100%; min-height: 0; }

.library-upload-modal__dialog { width: min(960px, 100%); }
.library-move-modal__dialog { width: min(560px, 100%); min-height: 460px; }
.library-move-modal__body { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; padding: 18px 20px; }
.library-move-breadcrumb { display: flex; min-height: 36px; align-items: center; gap: 9px; overflow-x: auto; color: #718198; font-size: .82rem; white-space: nowrap; }
.library-move-breadcrumb button { padding: 0; border: 0; background: transparent; color: #566a83; cursor: pointer; font: inherit; }
.library-move-breadcrumb button:not(:disabled):hover { color: var(--library-accent); }
.library-move-breadcrumb button:disabled { color: #1f3048; cursor: default; font-weight: 700; }
.library-move-breadcrumb i { color: #abb7c6; font-size: .65rem; }
.library-move-hint { margin: 9px 0 12px; color: #8190a3; font-size: .76rem; }
.library-move-folders { min-height: 0; flex: 1 1 auto; overflow: auto; }
.library-move-folder { display: grid; width: 100%; grid-template-columns: 28px minmax(0, 1fr) 20px; align-items: center; gap: 8px; padding: 11px 4px; border: 0; border-radius: 8px; background: transparent; color: #43546d; cursor: pointer; font: inherit; font-size: .86rem; text-align: left; }
.library-move-folder:hover { background: #f0f6ff; color: var(--library-accent); }
.library-move-folder > i:first-child { color: #f5b92e; font-size: 1.05rem; }
.library-move-folder > i:last-child { color: #b3bfce; font-size: .72rem; }
.library-move-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-move-empty { padding: 38px 0; color: #9aa8ba; font-size: .8rem; text-align: center; }
.library-move-modal__footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-top: 1px solid #edf0f5; }
.library-move-modal__footer > div { display: inline-flex; gap: 9px; }
.library-move-modal__footer button { min-height: 34px; padding: 0 14px; border-radius: 8px; font-size: .78rem; font-weight: 700; }
.library-move-new-folder { border: 0; background: transparent; color: #667991; }
.library-move-new-folder:hover { color: var(--library-accent); }
.library-move-cancel { border: 1px solid #dce4ee; background: #fff; color: #63738a; }
.library-move-confirm { border: 1px solid var(--library-accent); background: var(--library-accent); color: #fff; }
.library-upload-modal__body { min-height: 0; overflow: auto; padding: 24px 16px 20px; }
.library-upload-dropzone { padding: 25px 20px 20px; border: 2px dashed #d6dfed; border-radius: 13px; background: #f9fbfe; text-align: center; transition: border-color .18s ease, background-color .18s ease; }
.library-upload-dropzone.is-dragover { border-color: var(--library-accent); background: #eef6ff; }
.library-upload-dropzone > i { display: grid; width: 58px; height: 58px; margin: 0 auto 8px; place-items: center; border-radius: 50%; background: #edf5ff; color: var(--library-accent); font-size: 1.35rem; }
.library-upload-dropzone p { margin: 0 0 14px; color: #63738a; font-size: .92rem; }
.library-upload-dropzone p button { padding: 0; border: 0; background: transparent; color: var(--library-accent); cursor: pointer; font: inherit; font-weight: 700; }
.library-upload-dropzone__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.library-upload-dropzone__actions button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 9px; background: #edf5ff; color: var(--library-accent); font-size: .78rem; font-weight: 700; }
.library-upload-dropzone button[hidden] { display: none; }
.library-upload-dropzone__actions button:last-child { background: #fff4e9; color: #e77735; }
.library-upload-dropzone small { display: block; margin-top: 13px; overflow: hidden; color: #9aa8ba; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.library-upload-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; color: #63738a; font-size: .78rem; }
.library-upload-summary button { padding: 5px 9px; border: 1px solid var(--library-border); border-radius: 7px; background: #fff; color: #718198; font-size: .72rem; }
.library-upload-tasks { display: flex; min-height: 94px; max-height: 260px; flex-direction: column; gap: 7px; overflow: auto; padding: 2px; }
.library-upload-task { display: grid; grid-template-columns: minmax(0, 1fr) 160px 42px; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid #edf1f6; border-radius: 8px; background: #fff; }
.library-upload-task__name { overflow: hidden; color: #40516a; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.library-upload-task__progress { height: 6px; overflow: hidden; border-radius: 99px; background: #edf1f6; }
.library-upload-task__progress span { display: block; height: 100%; border-radius: inherit; background: var(--library-accent); transition: width .15s ease; }
.library-upload-task__status { color: #8492a5; font-size: .7rem; text-align: right; }
.library-upload-task.is-done .library-upload-task__progress span { background: #38ad82; }
.library-upload-task.is-done .library-upload-task__status { color: #29936b; }
.library-upload-task.is-error .library-upload-task__progress span { background: var(--library-danger); }
.library-upload-task.is-error .library-upload-task__status { color: var(--library-danger); }

.library-menu { position: fixed; z-index: 5000; min-width: 172px; max-height: calc(100vh - 16px); overflow: auto; padding: 6px; border: 1px solid var(--library-border); border-radius: 11px; background: #fff; box-shadow: 0 12px 28px rgba(20, 43, 75, .2); }
.library-menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: #41536f; cursor: pointer; font: inherit; font-size: .8rem; text-align: left; }
.library-menu button:hover { background: #f0f6ff; color: var(--library-accent); }

body.dark.mzpi-library-page { background: #0b1120 !important; }
body.dark .library-home__hero { background: transparent; }
body.dark .library-home__title h1,body.dark .library-home__entry strong,body.dark .library-home__panel h2,body.dark .library-home__row-title { color: #e7efff; }
body.dark .library-home__entry.is-public,body.dark .library-home__entry.is-personal,body.dark .library-home__entry.is-temp,body.dark .library-home__entry.is-favorite,body.dark .library-home__recent,body.dark .library-home__panel { background: #1e293b; }
body.dark .library-home__table-head,body.dark .library-home__row:hover { background: #26354a; }
body.dark .library-home__search { background: #17243a; border-color: #40516a; } body.dark .library-home__search input { color: #e7efff; }
body.dark .library-empty strong,
body.dark .library-error strong,
body.dark .library-item__name,
body.dark .library-selection__file { color: #e7edf7; }
body.dark .library-notice { color: #9eacc1; }
body.dark .library-browser,
body.dark .library-item { border-color: rgba(148, 163, 184, .14); background: rgba(30, 41, 59, .78); }
body.dark .library-loading { background: rgba(15, 23, 42, .62); }
body.dark .library-item:hover,
body.dark .library-item.is-selected { background: #26354a; }
body.dark .library-refresh,
body.dark .library-back,
body.dark .library-view-switch,
body.dark .library-search { border-color: rgba(148, 163, 184, .2); background: rgba(30, 41, 59, .78); color: #cfdaea; }
body.dark .library-search input { color: #e2e8f0; }
body.dark .library-selection { border-color: rgba(148, 163, 184, .2); background: rgba(30, 41, 59, .96); }
body.dark .library-modal__dialog,
body.dark .library-menu { background: #1e293b; }
body.dark .library-modal__dialog header { border-color: rgba(148, 163, 184, .16); }
body.dark .library-modal__dialog h2,
body.dark .library-menu button { color: #d8e2ee; }
body.dark .library-preview-stage { background: #111b29; }
body.dark .library-upload-dropzone { border-color: rgba(148, 163, 184, .24); background: rgba(15, 23, 42, .48); }
body.dark .library-upload-dropzone p,
body.dark .library-upload-task__name { color: #d8e2ee; }
body.dark .library-upload-task,
body.dark .library-upload-summary button { border-color: rgba(148, 163, 184, .16); background: #26354a; }
body.dark .library-move-breadcrumb button:disabled { color: #e2e8f0; }
body.dark .library-move-folder { color: #d8e2ee; }
body.dark .library-move-folder:hover { background: #26354a; color: #8fc1ff; }
body.dark .library-move-modal__footer { border-color: rgba(148, 163, 184, .16); }
body.dark .library-move-cancel { border-color: rgba(148, 163, 184, .2); background: #26354a; color: #d8e2ee; }

@media (max-width: 1100px) {
  .mzpi-library { width: 100%; margin: 0; padding: 42px clamp(18px, 5vw, 40px) 76px; }
  .library-selection { right: 24px; left: 24px; }
}

/* At 150% browser zoom the shared .8 page scale leaves 20% of the physical
   viewport outside the scaled coordinate space. Recenter only the library
   panel in that remaining desktop space; the navigation stays anchored. */
@media (min-width: 1101px) and (max-width: 1280px) {
  body.mzpi-library-page.desktop-page-scale .mzpi-library {
    transform: translateX(12.5vw);
  }
}

@media (max-width: 700px) {
  .mzpi-library { min-height: 100vh; padding: 28px 14px 88px; }
  .library-home { min-height: 0; }
  .library-refresh { width: 38px; min-width: 38px; padding: 0; }
  .library-refresh span { display: none; }
  .library-browser { height: calc(100vh - 126px); min-height: 420px; padding: 13px; border-radius: 14px; }
  .library-loading { inset: 94px 13px 13px; }
  .library-browser__topline { flex-wrap: wrap; gap: 8px; }
  .library-back { min-height: 34px; padding: 0 10px; font-size: .75rem; }
  .library-breadcrumb { order: 3; width: 100%; }
  .library-breadcrumb button { max-width: 132px; font-size: .8rem; }
  .library-view-switch { margin-left: auto; }
  .library-search { width: 100%; margin: 14px 0 10px; }
  .library-items.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .library-items.is-grid .library-item { min-height: 112px; padding: 14px; border-radius: 12px; }
  .library-item__icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .library-item__name { font-size: .82rem; }
  .library-selection { right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); left: 12px; gap: 8px; min-height: 54px; padding: 8px 10px; border-radius: 13px; }
  .library-selection__actions { gap: 5px; }
  .library-selection__actions button { min-height: 32px; padding: 0 8px; font-size: .7rem; }
  .library-selection__close { width: 30px; height: 30px; }
  .library-modal { padding: 14px; }
  .library-modal__dialog { max-height: 82vh; border-radius: 14px; }
  .library-preview-modal { padding: 0; }
  .library-preview-modal__dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .library-preview-stage { padding: 10px 10px 0; }
  .library-preview-stage iframe { min-height: 360px; }
  .library-upload-modal__body { padding: 16px 12px; }
  .library-upload-task { grid-template-columns: minmax(0, 1fr) 58px; gap: 8px; }
  .library-upload-task__progress { grid-column: 1 / 2; }
  .library-upload-task__status { grid-column: 2 / 3; grid-row: 1 / span 2; }
}

@keyframes library-spin { to { transform: rotate(360deg); } }
