:root {
  --rs-yellow: #f5c400;
  --rs-yellow-soft: #fff5bf;
  --sidebar: #2f3338;
  --sidebar-dark: #25292e;
  --text: #20242a;
  --muted: #68717d;
  --line: #e2ded0;
  --panel: #ffffff;
  --bg: #f3f4f6;
  --blue: #1769aa;
  --green: #16864d;
  --red: #b73535;
  --sidebar-width: 340px;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: var(--rs-yellow);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.16);
  display: flex;
  gap: 12px;
  height: 54px;
  left: 0;
  padding: 0 14px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.search {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  flex: 1 1 240px;
  min-width: 120px;
  padding: 8px 10px;
  max-width: 420px;
  width: auto;
}

#passkeyRegister {
  margin-left: auto;
}

.editor-open-button {
  margin-left: auto;
}

.button-icon {
  display: inline-flex;
  font-size: 18px;
  line-height: 1;
  margin-right: 7px;
}

.header-danger-button {
  background: var(--red);
  border-color: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.header-danger-button:hover {
  background: #9f2c2c;
}

.sidebar {
  background: var(--sidebar);
  bottom: 0;
  color: #fff;
  left: 0;
  overflow: auto;
  padding: 70px 10px 14px;
  position: fixed;
  top: 0;
  transition: transform 0.18s ease;
  width: var(--sidebar-width);
  z-index: 10;
}

.sidebar-section {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.sidebar-title {
  color: #f5c400;
  font-size: 13px;
  letter-spacing: 0;
  padding: 0 4px;
}

.sidebar-panel {
  gap: 7px;
}

.sidebar-panel-head {
  align-items: center;
  background: #272b30;
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #e9ecef;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: 16px minmax(0, 1fr);
  min-height: 36px;
  padding: 7px 8px;
  text-align: left;
  width: 100%;
}

.sidebar-panel-head:hover {
  border-color: rgba(245, 196, 0, 0.55);
}

.sidebar-panel-head span:last-child {
  color: var(--rs-yellow);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-panel-body {
  display: grid;
  gap: 9px;
}

.sidebar-panel-body[hidden] {
  display: none;
}

.sidebar p {
  color: #cfd4da;
  padding: 0 4px;
}

.login-shell {
  background: var(--bg);
  min-height: 100vh;
  padding: 0;
}

.login-topbar {
  align-items: center;
  background: var(--rs-yellow);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.16);
  display: flex;
  height: 54px;
  left: 0;
  padding: 0 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.login-main {
  align-items: center;
  background: var(--sidebar);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 78px 18px 24px;
}

.login-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rs-yellow);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 12px;
  max-width: 430px;
  padding: 16px;
  width: 100%;
}

.login-brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.login-panel-head {
  border-bottom: 1px solid #e1e4e8;
  padding-bottom: 10px;
}

.login-panel-head h1,
.login-form h1 {
  font-size: 21px;
  font-weight: 600;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 5px;
}

.login-form input {
  color: var(--text);
}

.login-form.is-hidden {
  display: none;
}

.qr-card {
  align-items: center;
  background: #f7f8fa;
  border: 1px solid #e1e4e8;
  display: grid;
  gap: 14px;
  grid-template-columns: 180px 1fr;
  padding: 12px;
}

.qr-code svg {
  display: block;
  height: auto;
  width: 180px;
}

.secret-line {
  word-break: break-all;
}

.passkey-login {
  border-top: 1px solid #e1e4e8;
  padding-top: 10px;
}

.login-status {
  color: var(--muted);
  min-height: 18px;
}

.sidebar label {
  color: #e9ecef;
  display: grid;
  font-size: 12px;
  gap: 5px;
}

.sidebar input,
.sidebar select {
  background: #fff;
  color: var(--text);
}

.admin-main {
  display: grid;
  gap: 14px;
  margin-left: var(--sidebar-width);
  padding: 68px 14px 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rs-yellow);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 14px;
}

.editor-panel {
  position: relative;
}

.save-fab {
  align-items: center;
  background: var(--green);
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 50%;
  bottom: 22px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 30px;
  font-weight: 700;
  height: 58px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: fixed;
  right: 24px;
  text-decoration: none;
  width: 58px;
  z-index: 18;
}

.save-fab:hover {
  background: #0f733f;
  transform: translateY(-1px);
}

.save-fab:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.save-fab:focus-visible {
  outline: 3px solid rgba(245, 196, 0, 0.75);
  outline-offset: 3px;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 600;
}

h2 {
  font-size: 19px;
  font-weight: 600;
}

p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.upload-row {
  display: grid;
  gap: 9px;
}

.upload-status {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 3px solid var(--rs-yellow);
  color: #eef1f4;
  display: grid;
  font-size: 12px;
  gap: 7px;
  line-height: 1.35;
  padding: 9px 10px;
}

.upload-status[hidden] {
  display: none;
}

.upload-status strong {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.upload-status ul {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.upload-status li {
  color: #d7dce1;
  overflow-wrap: anywhere;
}

.upload-status.is-error {
  background: rgba(183, 53, 53, 0.18);
  border-color: rgba(255, 130, 130, 0.38);
  border-left-color: var(--red);
}

.upload-status.is-success {
  background: rgba(22, 134, 77, 0.16);
  border-color: rgba(71, 190, 132, 0.36);
  border-left-color: var(--green);
}

.upload-progress {
  background: rgba(255, 255, 255, 0.18);
  height: 7px;
  overflow: hidden;
}

.upload-progress span {
  background: var(--rs-yellow);
  display: block;
  height: 100%;
  transition: width 0.16s ease;
}

.orphan-files {
  background: rgba(245, 196, 0, 0.1);
  border: 1px solid rgba(245, 196, 0, 0.5);
  border-left: 3px solid var(--rs-yellow);
  color: #eef1f4;
  display: grid;
  gap: 8px;
  padding: 9px 10px;
}

.orphan-files[hidden] {
  display: none;
}

.orphan-files strong {
  color: #fff;
  font-size: 13px;
}

.orphan-files p {
  color: #d7dce1;
  font-size: 12px;
  margin: 0;
  padding: 0;
}

.orphan-list {
  display: grid;
  gap: 6px;
}

.orphan-row {
  align-items: center;
  display: grid;
  gap: 5px 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.orphan-row span,
.orphan-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orphan-row span {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.orphan-row small {
  color: #cfd4da;
  font-size: 11px;
}

.orphan-row button {
  grid-row: span 2;
  min-height: 30px;
  padding: 5px 8px;
}

.orphan-delete-all {
  justify-self: stretch;
}

.publication-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  margin-bottom: 14px;
}

.publication-title-field {
  grid-column: 1 / -1;
}

.publication-group-field {
  min-width: 0;
}

.publication-slug-field {
  min-width: 0;
}

.publication-share-field {
  grid-column: 1 / -1;
  min-width: 0;
}

.publication-embed {
  border-left: 3px solid var(--rs-yellow);
  display: grid;
  gap: 7px;
  grid-column: 1 / -1;
  min-width: 0;
  padding: 7px 10px;
}

.publication-embed-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 12px;
  justify-content: space-between;
}

.embed-fullscreen-toggle {
  align-items: center;
  color: var(--text) !important;
  cursor: pointer;
  display: inline-flex !important;
  font-size: 12px !important;
  font-weight: 600;
  gap: 6px !important;
}

.embed-fullscreen-toggle input {
  height: 15px;
  margin: 0;
  padding: 0;
  width: 15px;
}

.publication-optimize {
  align-items: center;
  background: #f7f8fa;
  border: 1px solid #e1e4e8;
  border-left: 3px solid var(--rs-yellow);
  display: grid;
  gap: 7px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-column: 1 / -1;
  min-height: 46px;
  padding: 7px 10px;
}

.publication-optimize .ghost-button {
  min-height: 30px;
  padding: 5px 9px;
}

.publication-optimize span {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.password-panel {
  background: #f7f8fa;
  border: 1px solid #e1e4e8;
  border-left: 3px solid var(--rs-yellow);
  grid-column: 1 / -1;
}

.password-panel-head {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.password-panel-arrow {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.password-panel.is-open .password-panel-arrow {
  transform: rotate(90deg);
}

.password-panel-head span:not(.password-panel-arrow) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.password-panel-head strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.password-panel-body {
  align-items: end;
  border-top: 1px solid #e1e4e8;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  padding: 10px;
}

.password-panel-body[hidden] {
  display: none;
}

.password-panel-body label {
  margin: 0;
}

.password-panel-body label input[readonly] {
  background: #eef1f4;
  color: var(--text);
}

.password-settings span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.password-settings strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.password-settings label {
  margin: 0;
}

.meta-item {
  background: #f7f8fa;
  border: 1px solid #e1e4e8;
  border-left: 3px solid var(--rs-yellow);
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 9px 10px;
}

.meta-dates {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.meta-item strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
select,
textarea {
  border: 1px solid #cfd4da;
  border-radius: 4px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.copy-field {
  align-items: start;
  align-self: start;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.copy-field input,
.copy-field textarea,
.copy-field .round-copy-button {
  align-self: start;
}

.copy-field textarea {
  min-height: 54px;
}

.round-copy-button {
  align-items: center;
  background: #fff;
  border: 1px solid #c8cdd2;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 17px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.round-copy-button:hover {
  border-color: var(--rs-yellow);
  box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.2);
}

.icon-button,
.tool-button,
.ghost-button,
.primary-button,
.success-button,
.danger-button {
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  text-decoration: none;
}

.icon-button:disabled,
.tool-button:disabled,
.ghost-button:disabled,
.primary-button:disabled,
.success-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.icon-button,
.tool-button,
.ghost-button {
  background: #fff;
  color: var(--text);
}

.tool-button {
  font-size: 20px;
  line-height: 1;
  min-width: 38px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.success-button {
  background: var(--green);
  color: #fff;
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.muted-danger-button {
  background: #7a3333;
}

.book-list {
  display: grid;
  gap: 9px;
}

.group-create-row {
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.group-create-row input {
  min-height: 34px;
  padding: 7px 9px;
}

.group-create-row button {
  font-size: 21px;
  min-height: 34px;
  padding: 0;
}

.group-manage-list {
  display: grid;
  gap: 6px;
}

.group-manage-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) 24px 30px 30px;
}

.group-manage-row input {
  min-height: 30px;
  padding: 5px 7px;
}

.group-manage-row span {
  color: #cfd4da;
  font-size: 12px;
  text-align: center;
}

.group-manage-row button {
  font-size: 15px;
  min-height: 30px;
  min-width: 30px;
  padding: 0;
}

.book-group {
  display: grid;
  gap: 5px;
}

.book-group-head {
  align-items: center;
  background: #272b30;
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #e9ecef;
  cursor: pointer;
  display: grid;
  gap: 7px;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  min-height: 32px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}

.book-group-head:hover {
  border-color: rgba(245, 196, 0, 0.55);
}

.book-group-name {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.book-group-count {
  align-items: center;
  background: rgba(245, 196, 0, 0.18);
  border: 1px solid rgba(245, 196, 0, 0.4);
  color: var(--rs-yellow);
  display: inline-flex;
  font-size: 11px;
  justify-content: center;
  min-width: 22px;
  padding: 2px 5px;
}

.book-group-items {
  display: grid;
  gap: 6px;
  padding-left: 8px;
  position: relative;
}

.book-group-items[hidden] {
  display: none;
}

.book-group-items::before {
  background: rgba(245, 196, 0, 0.34);
  bottom: 7px;
  content: "";
  left: 2px;
  position: absolute;
  top: 0;
  width: 1px;
}

.book-item {
  align-items: start;
  background: #3a3f45;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr);
  padding: 7px 8px;
}

.book-item.active {
  border-color: var(--rs-yellow);
  box-shadow: inset 0 0 0 1px var(--rs-yellow);
}

.book-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  grid-column: 1 / -1;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.book-optimized-badge {
  align-items: center;
  background: rgba(29, 136, 79, 0.22);
  border: 1px solid rgba(95, 214, 143, 0.52);
  color: #c9f3d6;
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
  justify-self: start;
  line-height: 1;
  padding: 3px 5px;
  text-transform: uppercase;
}

.book-optimized-badge[hidden] {
  display: none !important;
}

.book-details {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.book-details span {
  color: #cfd4da;
  display: block;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-file {
  color: #eef1f4;
  font-weight: 600;
}

.book-actions {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: 0.8fr 1.3fr 0.8fr;
  margin-top: 2px;
  min-width: 0;
  width: 100%;
}

.book-replace,
.book-optimize,
.book-delete {
  align-self: stretch;
  font-size: 10px;
  min-height: 22px;
  padding: 2px 5px;
}

.empty-list {
  color: #cfd4da;
  padding: 0 4px;
}

.book-meta .book-dates {
  color: #aeb6bf;
  font-size: 11px;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-start;
}

.editor-toolbar {
  margin: 0 0 12px;
}

.toolbar-group {
  align-items: center;
  background: #f7f8fa;
  border: 1px solid #dde1e5;
  border-left: 3px solid var(--rs-yellow);
  display: inline-flex;
  gap: 7px;
  min-height: 46px;
  padding: 5px 7px;
}

.toolbar-group-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-right: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.scale-control {
  align-items: center;
  color: var(--muted);
  display: inline-grid;
  font-size: 12px;
  gap: 3px;
  grid-template-columns: auto 116px 42px;
}

.page-jump {
  align-items: center;
  color: var(--muted);
  display: inline-grid;
  font-size: 12px;
  gap: 6px;
  grid-template-columns: auto 68px auto;
}

.page-jump input {
  min-height: 36px;
  padding: 7px 8px;
  text-align: center;
}

.scale-control input {
  padding: 0;
}

.workspace {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(300px, 1fr) 310px;
}

.page-stage,
.reader-stage {
  background: #dfe3e7;
  border: 1px solid #c8cdd2;
  margin: 0 auto;
  max-width: 100%;
  min-height: 420px;
  overflow: auto;
  position: relative;
  text-align: center;
}

.page-stage.is-loading::after {
  align-items: center;
  background: rgba(37, 41, 46, 0.78);
  color: #fff;
  content: "PDF betöltése...";
  display: flex;
  font-size: 14px;
  font-weight: 700;
  inset: 0;
  justify-content: center;
  position: absolute;
  z-index: 6;
}

.page-stage.is-loading canvas {
  opacity: 0.3;
}

.page-stage canvas,
.reader-stage canvas {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  display: block;
  margin: 18px auto;
}

.linkLayer {
  left: 50%;
  position: absolute;
  top: 18px;
  transform: translateX(-50%);
}

.hotspot {
  background: rgba(245, 196, 0, 0.16);
  border: 2px solid rgba(245, 196, 0, 0.92);
  cursor: move;
  min-height: 24px;
  min-width: 24px;
  position: absolute;
  touch-action: none;
}

.hotspot.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.22);
}

.resize-handle {
  background: #fff;
  border: 2px solid var(--blue);
  display: none;
  height: 12px;
  position: absolute;
  width: 12px;
}

.hotspot.selected .resize-handle {
  display: block;
}

.resize-nw {
  cursor: nwse-resize;
  left: -7px;
  top: -7px;
}

.resize-ne {
  cursor: nesw-resize;
  right: -7px;
  top: -7px;
}

.resize-sw {
  bottom: -7px;
  cursor: nesw-resize;
  left: -7px;
}

.resize-se {
  bottom: -7px;
  cursor: nwse-resize;
  right: -7px;
}

.hotspot-view {
  background: rgba(245, 196, 0, 0.02);
  border: 0;
  display: block;
  position: absolute;
}

.hotspot-view:focus,
.hotspot-view:hover {
  background: rgba(245, 196, 0, 0.14);
  outline: 2px solid rgba(245, 196, 0, 0.7);
}

.link-editor {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-left: 14px;
}

.link-editor label,
.publication-meta label {
  align-content: start;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

.button-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.button-row .muted-danger-button {
  grid-column: 1 / -1;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, 0.48);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 40;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rs-yellow);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 12px;
  max-width: 440px;
  padding: 14px;
  width: 100%;
}

.editor-panel[hidden],
.overview-panel[hidden] {
  display: none;
}

.overview-stats {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  padding: 12px 0 18px;
}

.overview-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  margin: 12px 0;
}

.overview-filters label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
  min-width: 0;
}

.overview-filter-status {
  align-items: center;
  background: #fff8d6;
  border-left: 3px solid var(--rs-yellow);
  color: #30363b;
  display: flex;
  font-size: 13px;
  gap: 12px;
  justify-content: space-between;
  padding: 5px 10px;
}

.overview-filter-status span {
  overflow-wrap: anywhere;
  min-width: 0;
}

.overview-filter-status[hidden] {
  display: none;
}

.overview-stats strong {
  font-size: 18px;
}

.overview-table-wrap {
  overflow-x: auto;
}

.overview-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.overview-table th,
.overview-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
}

.overview-table th {
  color: var(--muted);
  font-weight: 600;
}

.overview-table small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.overview-publication {
  align-items: center;
  display: flex;
  gap: 12px;
}

.overview-publication > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.overview-cover {
  align-items: center;
  background: #f2f4f6;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex: 0 0 60px;
  height: 78px;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  width: 60px;
}

.overview-cover img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.overview-cover-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  height: min(480px, calc(100vh - 24px));
  padding: 6px;
  pointer-events: none;
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  z-index: 35;
}

.overview-cover-preview[hidden] {
  display: none;
}

.overview-cover-preview img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.overview-cover:hover,
.overview-cover:focus-visible {
  border-color: var(--rs-yellow);
  outline: 2px solid var(--rs-yellow);
  outline-offset: 2px;
}

.overview-table .ghost-button {
  min-height: 30px;
  padding: 5px 10px;
}

.upload-dialog {
  background: transparent;
  border: 0;
  max-height: calc(100dvh - 36px);
  max-width: 470px;
  padding: 0;
  width: calc(100% - 36px);
}

.upload-dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.upload-dialog .modal-panel {
  max-width: none;
}

.modal-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.modal-copy {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.modal-book-title {
  background: #f7f8fa;
  border-left: 3px solid var(--rs-yellow);
  display: block;
  font-size: 14px;
  padding: 8px 10px;
}

.modal-panel label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.geometry-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.links-list {
  display: grid;
  gap: 6px;
}

.link-row {
  background: #f7f7f7;
  border: 1px solid #dedede;
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 8px;
}

.link-row.active {
  border-color: var(--blue);
}

.link-row strong {
  font-size: 13px;
}

.link-row span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-shell {
  background: #20242a;
  height: 100vh;
  overflow: hidden;
}

.viewer-lock-shell {
  background: var(--sidebar);
  min-height: 100vh;
}

.viewer-lock-main {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 18px;
}

.viewer-lock-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rs-yellow);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
  display: grid;
  gap: 12px;
  max-width: 390px;
  padding: 16px;
  width: 100%;
}

.viewer-lock-panel h1 {
  font-size: 21px;
}

.viewer-lock-panel p {
  margin: 0;
}

.viewer-lock-panel label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 5px;
}

.viewer-lock-error {
  background: rgba(183, 53, 53, 0.1);
  border-left: 3px solid var(--red);
  color: var(--red);
  font-size: 13px;
  padding: 8px 10px;
}

.viewer-shell.is-embed {
  height: 100%;
  min-height: 100vh;
}

.viewer-tools {
  align-items: center;
  background: rgba(76, 79, 83, 0.94);
  bottom: 0;
  box-shadow: 0 -2px 9px rgba(0, 0, 0, 0.22);
  color: #fff;
  display: flex;
  gap: 14px;
  height: 48px;
  left: 0;
  padding: 0 16px;
  position: fixed;
  right: 0;
  z-index: 30;
}

.viewer-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 25px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-width: 32px;
  padding: 0 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.viewer-button:hover {
  color: var(--rs-yellow);
}

.viewer-reset-button {
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  height: 26px;
  min-width: 44px;
  padding: 0 7px;
  text-shadow: none;
}

.viewer-page-info {
  font-size: 14px;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
}

.viewer-progress {
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  flex: 1 1 auto;
  height: 3px;
  min-width: 90px;
  position: relative;
  touch-action: none;
}

.viewer-progress span {
  background: #fff;
  display: block;
  height: 100%;
  width: 0;
}

.viewer-progress::before {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  content: "";
  height: 14px;
  left: var(--viewer-progress, 0%);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
}

.viewer-progress::after {
  content: "";
  inset: -14px 0;
  position: absolute;
}

.viewer-progress:focus-visible {
  outline: 2px solid var(--rs-yellow);
  outline-offset: 8px;
}

.viewer-main {
  height: calc(100vh - 48px);
  overflow: hidden;
  padding: 8px;
}

.viewer-fullscreen-prompt {
  background: rgba(36, 39, 43, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 7px;
  left: 50%;
  padding: 7px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
}

.viewer-fullscreen-prompt[hidden] {
  display: none;
}

.viewer-fullscreen-prompt-open {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 9px;
  padding: 12px 16px;
}

.viewer-fullscreen-prompt-open:hover,
.viewer-fullscreen-prompt-open:focus-visible {
  background: #2f3439;
  border-color: var(--rs-yellow);
  outline: 0;
}

.viewer-fullscreen-prompt-icon {
  font-size: 22px;
  line-height: 1;
}

.viewer-fullscreen-prompt-cancel {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px 6px;
}

.viewer-fullscreen-prompt-cancel:hover,
.viewer-fullscreen-prompt-cancel:focus-visible {
  color: #fff;
  outline: 0;
  text-decoration: underline;
}

.viewer-side-nav {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  display: flex;
  font-size: 96px;
  font-weight: 200;
  height: 160px;
  justify-content: center;
  line-height: 1;
  padding: 0 10px;
  position: fixed;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.72);
  top: calc(50% - 24px);
  transform: translateY(-50%);
  transition: color 0.16s ease, opacity 0.16s ease, text-shadow 0.16s ease;
  width: 72px;
  z-index: 25;
}

.viewer-side-nav[hidden] {
  display: none;
}

.viewer-side-nav:focus {
  outline: 0;
}

.viewer-side-nav:hover,
.viewer-side-nav:focus-visible {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.86);
}

.viewer-side-nav:focus-visible {
  outline: 2px solid var(--rs-yellow);
  outline-offset: -10px;
}

.viewer-side-nav-prev {
  left: 0;
}

.viewer-side-nav-next {
  right: 0;
}

.reader-stage {
  align-items: center;
  background: transparent;
  border: 0;
  display: flex;
  justify-content: center;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  perspective: 1600px;
  position: relative;
  width: 100%;
  --drag-progress: 0;
}

.viewer-startup {
  align-items: center;
  color: #f3f5f7;
  display: flex;
  flex-direction: column;
  gap: 16px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
  z-index: 30;
}

.viewer-startup-preview {
  align-items: center;
  color: #f3f5f7;
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  max-width: min(520px, 90vw);
  padding: 12px;
  text-align: center;
}

.viewer-startup-preview strong {
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.viewer-startup-preview span {
  color: rgba(243, 245, 247, 0.72);
  font-size: 14px;
}

.pageflip-book {
  height: 100%;
  margin: 0 auto;
  max-width: none;
  transform-origin: center center;
  user-select: none;
  will-change: transform;
}

.reader-stage.is-initializing-book .pageflip-book {
  opacity: 0.22;
}

.reader-stage:not(.is-starting) .viewer-startup {
  display: none;
}

.reader-stage.is-pan-enabled .pageflip-book {
  cursor: grab;
}

.reader-stage.is-panning .pageflip-book {
  cursor: grabbing;
}

.reader-stage.is-single-page-view:not(.is-pan-enabled) .pageflip-book,
.reader-stage.is-single-page-view:not(.is-pan-enabled) .stf__wrapper,
.reader-stage.is-single-page-view:not(.is-pan-enabled) .stf__block {
  max-width: 100%;
}

.reader-stage.is-single-page-view:not(.is-pan-enabled) .pageflip-book {
  min-width: 0 !important;
  width: min(var(--single-page-width), 100%) !important;
  max-width: min(var(--single-page-width), 100%) !important;
}

.reader-stage.is-single-page-view:not(.is-pan-enabled) .stf__wrapper,
.reader-stage.is-single-page-view:not(.is-pan-enabled) .stf__block {
  width: 100% !important;
}

.reader-stage.is-zoomed-view:not(.is-single-page-view) .pageflip-book,
.reader-stage.is-zoomed-view:not(.is-single-page-view) .stf__wrapper,
.reader-stage.is-zoomed-view:not(.is-single-page-view) .stf__block {
  max-width: none !important;
}

.reader-stage.is-single-page-view .stf__wrapper,
.reader-stage.is-single-page-view .stf__block {
  overflow: hidden;
}

.reader-stage.is-standalone-document .pageflip-book,
.reader-stage.is-standalone-document .stf__wrapper,
.reader-stage.is-standalone-document .stf__block {
  margin-left: auto !important;
  margin-right: auto !important;
}

.viewer-shell.is-standalone-document #homePage,
.viewer-shell.is-standalone-document #prevPage,
.viewer-shell.is-standalone-document #nextPage,
.viewer-shell.is-standalone-document .viewer-page-info,
.viewer-shell.is-standalone-document .viewer-progress {
  display: none;
}

.pageflip-book .reader-page {
  box-shadow: none;
}

.pageflip-book .reader-page::before,
.pageflip-book .reader-page::after {
  display: none;
}

.pageflip-book .stf__item {
  overflow: visible;
}

.book-spread {
  display: flex;
  gap: 2px;
  justify-content: center;
  max-width: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: filter 0.28s ease;
}

.reader-page {
  background: #fff;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.35);
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
}

.is-paged .reader-page::before,
.is-paged .reader-page::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 196, 0, 0.18) 48%, rgba(0, 0, 0, 0.14));
  content: "";
  height: 34px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 0.18s ease;
  width: 34px;
  z-index: 5;
}

.is-paged .reader-page::before {
  right: 0;
  top: 0;
}

.is-paged .reader-page::after {
  bottom: 0;
  right: 0;
  transform: scaleY(-1);
}

.is-paged .reader-page:hover::before,
.is-paged .reader-page:hover::after {
  opacity: 0.82;
}

.is-paged.is-spread .reader-page:first-child::before,
.is-paged.is-spread .reader-page:first-child::after {
  left: 0;
  right: auto;
  transform: scaleX(-1);
}

.is-paged.is-spread .reader-page:first-child::after {
  transform: scale(-1);
}

.reader-page canvas {
  margin: 0;
}

.reader-page .page-preview-canvas {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.page-gutter-shadow {
  bottom: 0;
  display: none;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 26px;
  z-index: 4;
}

.pageflip-book .stf__wrapper.--landscape .reader-page.--left .page-gutter-shadow,
.pageflip-book .stf__wrapper.--landscape .reader-page.--right .page-gutter-shadow {
  display: block;
}

.pageflip-book .stf__wrapper.--landscape .reader-page.--left .page-gutter-shadow {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.08) 42%, rgba(0, 0, 0, 0));
  right: 0;
}

.pageflip-book .stf__wrapper.--landscape .reader-page.--right .page-gutter-shadow {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.07) 42%, rgba(0, 0, 0, 0));
  left: 0;
}

.reader-page.is-loading {
  align-items: center;
  background: #f8f8f8;
  display: flex;
  justify-content: center;
}

.page-loader {
  color: #777;
  font-size: 13px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.reader-page:not(.is-loading) .page-loader {
  display: none;
}

.reader-page .linkLayer {
  left: 0;
  top: 0;
  transform: none;
}

.is-embed .viewer-main {
  height: calc(100% - 48px);
  min-height: calc(100vh - 48px);
}

.is-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.is-collapsed .admin-main {
  margin-left: 0;
}

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 54px;
    padding-bottom: 8px;
    padding-top: 8px;
  }

  .search {
    order: 5;
    width: 100%;
  }

  .sidebar {
    width: min(var(--sidebar-width), calc(100vw - 24px));
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  body:not(.is-collapsed) .sidebar {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    padding-left: 10px;
    padding-right: 10px;
  }

  .viewer-side-nav {
    font-size: 66px;
    padding: 0 10px;
    width: 58px;
  }

  .upload-row,
  .workspace,
  .publication-meta {
    grid-template-columns: 1fr;
  }

  .password-settings,
  .password-panel-body {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .qr-card {
    grid-template-columns: 1fr;
  }

  .qr-code svg {
    margin: 0 auto;
  }

  .link-editor {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  .book-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer-tools {
    gap: 8px;
    height: 46px;
    padding: 0 10px;
  }

  .viewer-main {
    height: calc(100vh - 46px);
    padding: 8px;
  }

  .is-embed .viewer-main {
    height: calc(100% - 46px);
    min-height: calc(100vh - 46px);
  }

  .viewer-button {
    font-size: 23px;
    min-width: 26px;
  }

  .viewer-reset-button {
    font-size: 10px;
    height: 24px;
    min-width: 38px;
    padding: 0 5px;
  }

  .viewer-page-info {
    font-size: 12px;
    min-width: 42px;
  }

  .viewer-progress {
    min-width: 48px;
  }
}
